00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: t -*- */ 00002 /* AbiSource 00003 * 00004 * Copyright (C) 2008 Firat Kiyak <firatkiyak@gmail.com> 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00019 * 02110-1301 USA. 00020 */ 00021 00022 #ifndef _OXML_ELEMENT_ROW_H_ 00023 #define _OXML_ELEMENT_ROW_H_ 00024 00025 #include "ut_types.h" 00026 #include "ut_string.h" 00027 #include "pd_Document.h" 00028 #include "OXML_Element.h" 00029 #include "OXML_Element_Table.h" 00030 #include "OXML_Element_Cell.h" 00031 #include "ie_exp_OpenXML.h" 00032 00033 class OXML_Element_Table; 00034 00035 class OXML_Element_Row : public OXML_Element 00036 { 00037 public: 00038 OXML_Element_Row(const std::string & id, OXML_Element_Table* table); 00039 virtual ~OXML_Element_Row(); 00040 00041 virtual UT_Error serialize(IE_Exp_OpenXML* exporter); 00042 virtual UT_Error addToPT(PD_Document * pDocument); 00043 UT_Error addChildrenToPT(PD_Document * pDocument); 00044 virtual void setNumCols(UT_sint32 numCols); 00045 00046 void setRowNumber(int row); 00047 int getRowNumber() const 00048 { 00049 return m_rowNumber; 00050 } 00051 int getCurrentColumnNumber() const 00052 { 00053 return m_currentColumnNumber; 00054 } 00055 00056 void addCell(const OXML_SharedElement_Cell& cell); 00057 00058 //this method increments the vertical merge start cell's bottom by one. 00059 //It traverses the cells in the row and finds the vertical merge starting cell 00060 //and increments its bottom value by one. Should be called for the vertMerge=continue cells. 00061 //return true if successful 00062 bool incrementBottomVerticalMergeStart(const OXML_SharedElement_Cell& cell); 00063 00064 //this method increments the horizontal merge start cell's right by one. 00065 //It traverses the cells in the row and finds the horizontal merge starting cell 00066 //and increments its right value by one. Should be called for the hMerge=continue cells. 00067 //return true if successful 00068 bool incrementRightHorizontalMergeStart(const OXML_SharedElement_Cell& cell); 00069 00070 void addMissingCell(const OXML_SharedElement_Cell& cell); 00071 00072 protected: 00073 UT_Error serializeChildren(IE_Exp_OpenXML* exporter); 00074 00075 private: 00076 virtual UT_Error serializeProperties(IE_Exp_OpenXML* exporter); 00077 UT_sint32 numCols; 00078 OXML_Element_Table* table; 00079 std::vector<OXML_SharedElement_Cell> m_cells; 00080 int m_rowNumber; 00081 int m_currentColumnNumber; 00082 std::vector<OXML_SharedElement_Cell> m_missingCells; 00083 }; 00084 00085 #endif //_OXML_ELEMENT_ROW_H_ 00086