• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

ODe_Table_Listener.h

Go to the documentation of this file.
00001 /* AbiSource
00002  *
00003  * Copyright (C) 2005 INdT
00004  * Author: Daniel d'Andrada T. de Carvalho <daniel.carvalho@indt.org.br>
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 ODE_TABLE_LISTENER_H_
00023 #define ODE_TABLE_LISTENER_H_
00024 
00025 // Internal includes
00026 #include "ODe_AbiDocListenerImpl.h"
00027 #include "ODe_Common.h"
00028 #include "ODe_Style_Style.h"
00029 
00030 // AbiWord includes
00031 #include <ut_string_class.h>
00032 #include <ut_vector.h>
00033 
00034 // External includes
00035 #include <stdio.h>
00036 
00037 // Internal classes
00038 class ODe_AutomaticStyles;
00039 class ODe_AuxiliaryData;
00040 class ODe_Styles;
00041 
00042 
00046 class ODe_Table_Cell {
00047 public:
00048 
00049     ODe_Table_Cell() : m_pTextContent(NULL) {}
00050 
00051     ~ODe_Table_Cell() {
00052         if (m_pTextContent != NULL) {
00053             ODe_gsf_output_close(m_pTextContent);
00054         }
00055     }
00056 
00057     void loadAbiProps(const PP_AttrProp* pAP);
00058 
00059     void write(GsfOutput* pTableOutput, const UT_UTF8String& rSpacesOffset);
00060 
00061     // <table:table-cell>
00062     UT_UTF8String m_numberColumnsSpanned; // table:number-columns-spanned
00063     UT_UTF8String m_numberRowsSpanned;    // table:number-columns-spanned
00064     UT_UTF8String m_styleName;            // table:style-name
00065 
00066     // A temporary holder for its text content.
00067     GsfOutput* m_pTextContent;
00068 
00069     // From AbiWord <cell> element
00070     UT_sint32 m_leftAttach, m_rightAttach, m_topAttach, m_bottomAttach;
00071 
00072     // xml:id
00073     UT_UTF8String m_xmlid;
00074 };
00075 
00076 
00081 class ODe_Table_Column {
00082 public:
00083     void write(GsfOutput* pTableOutput, const UT_UTF8String& rSpacesOffset);
00084 
00085     // <table:table-column>
00086     UT_UTF8String m_styleName; // table:style-name
00087 };
00088 
00089 
00093 class ODe_Table_Row {
00094 public:
00095 
00096     ODe_Table_Row();
00097     ~ODe_Table_Row();
00098 
00099     void write(GsfOutput* pTableOutput, const UT_UTF8String& rSpacesOffset);
00100 
00101     // A NULL value means that this cell is covered, that it's a
00102     // <table:covered-table-cell/> element
00103     ODe_Table_Cell** m_ppCells;
00104 
00105     // <table:table-row>
00106     UT_UTF8String m_styleName; // table:style-name
00107 
00108     UT_uint32 m_columnCount;
00109 };
00110 
00111 
00116 class ODe_Table_Listener : public ODe_AbiDocListenerImpl {
00117 public:
00118 
00119     ODe_Table_Listener(ODe_Styles& rStyles,
00120                        ODe_AutomaticStyles& rAutomatiStyles,
00121                        GsfOutput* pTextOutput,
00122                        ODe_AuxiliaryData& rAuxiliaryData,
00123                        UT_uint8 zIndex,
00124                        UT_uint8 spacesOffset);
00125 
00126     virtual ~ODe_Table_Listener();
00127 
00128     virtual void openTable(const PP_AttrProp* pAP, ODe_ListenerAction& rAction);
00129     virtual void closeTable(ODe_ListenerAction& rAction);
00130 
00131     virtual void openCell(const PP_AttrProp* pAP, ODe_ListenerAction& rAction);
00132 
00133 private:
00134     void _buildTable();
00135 
00136     ODe_Table_Column* m_pColumns;
00137     UT_sint32 m_numColumns;
00138 
00139     ODe_Table_Row* m_pRows;
00140     UT_sint32 m_numRows;
00141 
00142     UT_GenericVector<ODe_Table_Cell*> m_cells;
00143 
00144     GsfOutput* m_pTextOutput;
00145     ODe_Styles& m_rStyles;
00146     ODe_AutomaticStyles& m_rAutomatiStyles;
00147     ODe_AuxiliaryData& m_rAuxiliaryData;
00148     UT_uint8 m_zIndex;
00149 
00150     UT_UTF8String m_tableName;
00151     UT_UTF8String m_tableStyleName;
00152 
00153     // Abiword has table-wide cell properties (i.e.: cell properties inside
00154     // <table> element), but OpenDocument doesn't.
00155     // So I have to propagate this properties into every cell of this table.
00156     ODe_Style_Style m_tableWideCellStyle;
00157     UT_GenericVector<UT_UTF8String*> columnStyleNames;
00158     UT_GenericVector<UT_UTF8String*> rowStyleNames;
00159 };
00160 
00161 #endif /*ODE_TABLE_LISTENER_H_*/

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1