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_CELL_H_ 00023 #define _OXML_ELEMENT_CELL_H_ 00024 00025 #include <memory> 00026 00027 // Internal includes 00028 #include "OXML_Element.h" 00029 00030 // AbiWord includes 00031 #include "ut_types.h" 00032 #include "ut_string.h" 00033 #include "pd_Document.h" 00034 00035 class OXML_Element_Table; 00036 class OXML_Element_Row; 00037 class OXML_Element_Cell; 00038 00039 typedef std::shared_ptr<OXML_Element_Cell> OXML_SharedElement_Cell; 00040 00041 class OXML_Element_Cell : public OXML_Element 00042 { 00043 public: 00044 OXML_Element_Cell(const std::string & id, OXML_Element_Table* table, 00045 UT_sint32 left, UT_sint32 right, UT_sint32 top, UT_sint32 bottom); 00046 virtual ~OXML_Element_Cell(); 00047 00048 virtual UT_Error serialize(IE_Exp_OpenXML* exporter); 00049 virtual UT_Error addToPT(PD_Document * pDocument); 00050 UT_sint32 getLeft() const 00051 { 00052 return m_iLeft; 00053 } 00054 UT_sint32 getRight() const 00055 { 00056 return m_iRight; 00057 } 00058 UT_sint32 getTop() const 00059 { 00060 return m_iTop; 00061 } 00062 UT_sint32 getBottom() const 00063 { 00064 return m_iBottom; 00065 } 00066 00067 void setLeft(UT_sint32 left); 00068 void setRight(UT_sint32 right); 00069 void setTop(UT_sint32 top); 00070 void setBottom(UT_sint32 bottom); 00071 00072 void setRow(OXML_Element_Row* row); 00073 00074 void setVerticalMergeStart(bool start); 00075 void setHorizontalMergeStart(bool start); 00076 bool startsVerticalMerge() const 00077 { 00078 return m_startVerticalMerge; 00079 } 00080 bool startsHorizontalMerge() const 00081 { 00082 return m_startHorizontalMerge; 00083 } 00084 00085 void setLastHorizontalContinuationCell(const OXML_SharedElement_Cell& cell); 00086 void setLastVerticalContinuationCell(const OXML_SharedElement_Cell& cell); 00087 00088 private: 00089 virtual UT_Error serializeProperties(IE_Exp_OpenXML* exporter); 00090 UT_sint32 m_iLeft, m_iRight, m_iTop, m_iBottom; 00091 bool m_startVerticalMerge; 00092 bool m_startHorizontalMerge; 00093 OXML_Element_Table* m_table; 00094 OXML_Element_Row* m_row; 00095 00096 OXML_SharedElement_Cell m_horizontalTail; 00097 OXML_SharedElement_Cell m_verticalTail; 00098 }; 00099 00100 #endif //_OXML_ELEMENT_CELL_H_ 00101