00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ 00002 00003 /* AbiSource 00004 * 00005 * Copyright (C) 2008 Firat Kiyak <firatkiyak@gmail.com> 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation; either version 2 00010 * of the License, or (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00020 * 02111-1307, USA. 00021 */ 00022 00023 #ifndef _OXML_ELEMENT_TABLE_H_ 00024 #define _OXML_ELEMENT_TABLE_H_ 00025 00026 // Internal includes 00027 #include <OXML_Element.h> 00028 #include <OXML_Element_Row.h> 00029 #include <ie_exp_OpenXML.h> 00030 00031 // AbiWord includes 00032 #include <ut_types.h> 00033 #include <ut_string.h> 00034 #include <pd_Document.h> 00035 #include <vector> 00036 00037 class OXML_Element_Table : public OXML_Element 00038 { 00039 public: 00040 OXML_Element_Table(const std::string & id); 00041 virtual ~OXML_Element_Table(); 00042 00043 virtual UT_Error serialize(IE_Exp_OpenXML* exporter); 00044 virtual UT_Error serializeChildren(IE_Exp_OpenXML* exporter); 00045 virtual UT_Error addToPT(PD_Document * pDocument); 00046 virtual std::string getColumnWidth(int colIndex) const; 00047 virtual std::string getRowHeight(int rowIndex) const; 00048 UT_Error addChildrenToPT(PD_Document * pDocument); 00049 00050 void addRow(OXML_Element_Row* row); 00051 00052 int getCurrentRowNumber() const; 00053 int getCurrentColNumber() const; 00054 00055 void setCurrentRowNumber(int row); 00056 void setCurrentColNumber(int col); 00057 00058 void incrementCurrentRowNumber(); 00059 void incrementCurrentColNumber(); 00060 00061 //this method increments the vertical merge start cell's bottom by one. 00062 //It traverses up the cells in the table and finds the vertical merge starting cell 00063 //and increments its bottom value by one. Should be called for the vertMerge=continue cells. 00064 //return true if successful 00065 bool incrementBottomVerticalMergeStart(OXML_Element_Cell* cell); 00066 00067 //this method increments the horizontal merge start cell's right by one. 00068 //It traverses up the cells in the table and finds the horizontal merge starting cell 00069 //and increments its right value by one. Should be called for the hMerge=continue cells. 00070 //return true if successful 00071 bool incrementRightHorizontalMergeStart(OXML_Element_Cell* cell); 00072 00073 void addMissingCell(unsigned int rowNumber, OXML_Element_Cell* cell); 00074 00075 void applyStyle(OXML_SharedStyle style); 00076 00077 int getNumberOfRows() const 00078 { 00079 return m_rows.size(); 00080 } 00081 00082 private: 00083 virtual UT_Error serializeProperties(IE_Exp_OpenXML* exporter); 00084 std::vector<std::string> columnWidth; 00085 std::vector<std::string> rowHeight; 00086 std::vector<OXML_Element_Row*> m_rows; 00087 int m_currentRowNumber; 00088 int m_currentColNumber; 00089 }; 00090 00091 #endif //_OXML_ELEMENT_TABLE_H_ 00092
1.7.1