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

ODe_Text_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_TEXT_LISTENER_H_
00023 #define ODE_TEXT_LISTENER_H_
00024 
00025 // Internal includes
00026 #include "../../common/xp/ODc_util.h"
00027 #include "ODe_AbiDocListenerImpl.h"
00028 
00029 // Abiword includes
00030 #include <ut_string_class.h>
00031 
00032 // External includes
00033 #include <stdio.h>
00034 
00035 // Internal classes
00036 class ODe_AutomaticStyles;
00037 class ODe_AuxiliaryData;
00038 class ODe_ListenerAction;
00039 class ODe_Styles;
00040 class ODe_Style_List;
00041 
00042 // AbiWord classes
00043 class PP_AttrProp;
00044 
00045 
00049 class ODe_Text_Listener : public ODe_AbiDocListenerImpl {
00050 public:
00051 
00052     ODe_Text_Listener(ODe_Styles& rStyles,
00053                       ODe_AutomaticStyles& rAutomatiStyles,
00054                       GsfOutput* pTextOutput,
00055                       ODe_AuxiliaryData& rAuxiliaryData,
00056                       UT_uint8 zIndex,
00057                       UT_uint8 spacesOffset);
00058 
00059     ODe_Text_Listener(ODe_Styles& rStyles,
00060                       ODe_AutomaticStyles& rAutomatiStyles,
00061                       GsfOutput* pTextOutput,
00062                       ODe_AuxiliaryData& rAuxiliaryData,
00063                       UT_uint8 zIndex,
00064                       UT_uint8 spacesOffset,
00065                       const UT_UTF8String& rPendingMasterPageStyleName);
00066 
00067     ~ODe_Text_Listener();
00068 
00069     // Listener methods
00070 
00071     virtual void openTable(const PP_AttrProp* pAP, ODe_ListenerAction& rAction);
00072 
00073     virtual void closeCell(ODe_ListenerAction& rAction);
00074     virtual void closeSection(ODe_ListenerAction& rAction);
00075 
00076     virtual void openBlock(const PP_AttrProp* pAP, ODe_ListenerAction& rAction);
00077     virtual void closeBlock();
00078 
00079     virtual void openSpan(const PP_AttrProp* pAP);
00080     virtual void closeSpan();
00081 
00082     virtual void openFrame(const PP_AttrProp* pAP, ODe_ListenerAction& rAction);
00083     virtual void closeFrame(ODe_ListenerAction& rAction);
00084 
00085     virtual void openField(const fd_Field* field, const UT_UTF8String& fieldType, const UT_UTF8String& fieldValue);
00086     virtual void closeField(const UT_UTF8String& fieldType);
00087 
00088     virtual void openFootnote(const PP_AttrProp* pAP, ODe_ListenerAction& rAction);
00089     virtual void closeFootnote(ODe_ListenerAction& rAction);
00090 
00091     virtual void openEndnote(const PP_AttrProp* pAP, ODe_ListenerAction& rAction);
00092     virtual void closeEndnote(ODe_ListenerAction& rAction);
00093 
00094     virtual void openAnnotation( const PP_AttrProp* pAP, const std::string& name, PD_Document* doc = 0 );
00095     virtual void closeAnnotation( const std::string& name );
00096     virtual void endAnnotation( const std::string& name );
00097 
00098     virtual void openTOC(const PP_AttrProp* pAP);
00099     virtual void closeTOC();
00100 
00101     virtual void openBookmark(const PP_AttrProp* pAP);
00102     virtual void closeBookmark(const PP_AttrProp* pAP);
00103     virtual void closeBookmark(UT_UTF8String &sBookmarkName);
00104 
00105     virtual void openHyperlink(const PP_AttrProp* pAP);
00106     virtual void closeHyperlink();
00107 
00108     void openRDFAnchor(const PP_AttrProp* pAP);
00109     void closeRDFAnchor(const PP_AttrProp* pAP);
00110 
00111     virtual void insertText(const UT_UTF8String& rText);
00112 
00113     virtual void insertLineBreak();
00114     virtual void insertColumnBreak();
00115     virtual void insertPageBreak();
00116     virtual void insertTabChar();
00117 
00118     virtual void insertInlinedImage(const gchar* pImageName,
00119                                     const PP_AttrProp* pAP);
00120 
00121     virtual void insertPositionedImage(const gchar* pImageName,
00122                                     const PP_AttrProp* pAP);
00123     void setOpenedODNote(bool b)
00124     { m_openedODNote = b;}
00125     void setIgnoreFirstTab(bool b)
00126     { m_bIgoreFirstTab = b;}
00127 
00128 private:
00129     void _initDefaultHeadingStyles();
00130     bool _blockIsPlainParagraph(const PP_AttrProp* pAP) const;
00131     void _openODListItem(const PP_AttrProp* pAP);
00132     void _openODParagraph(const PP_AttrProp* pAP);
00133     void _closeODParagraph();
00134     void _closeODList();
00135     void _openParagraphDelayed();
00136     
00137     const PP_AttrProp* m_delayedAP;
00138     ODe_Style_List*    m_delayedListStyle;
00139     bool               m_delayedPendingMasterPageStyleChange;
00140     bool               m_delayedPageBreak;
00141     bool               m_delayedColumnBreak;
00142     std::string        m_delayedMasterPageStyleName;
00143     UT_uint32          m_delayedSpacesOffset;
00144 
00145     bool m_openedODParagraph;
00146     bool m_openedODSpan;
00147     bool m_isFirstCharOnParagraph;
00148     bool m_openedODTextboxFrame;
00149     bool m_openedODNote;
00150     bool m_bIgoreFirstTab;
00151 
00152     // Content of the current paragraph.
00153     GsfOutput* m_pParagraphContent;
00154 
00155     // The number of currently nested <text:list> tags
00156     // (meaning the current list level).
00157     UT_uint8 m_currentListLevel;
00158     ODe_Style_List* m_pCurrentListStyle;
00159 
00160     bool m_pendingColumnBreak;
00161     bool m_pendingPageBreak;
00162     bool m_bAfter;
00163 
00164     bool m_pendingMasterPageStyleChange;
00165     UT_UTF8String m_masterPageStyleName;
00166 
00167     ODe_Styles& m_rStyles;
00168     ODe_AutomaticStyles& m_rAutomatiStyles;
00169     GsfOutput* m_pTextOutput;
00170     ODe_AuxiliaryData& m_rAuxiliaryData;
00171     UT_uint8 m_zIndex;
00172 
00173     // The number of TOCs (Table of Confents) already added to the document.
00174     UT_sint32 m_iCurrentTOC;
00175 
00176     UT_UTF8String& appendAttribute( UT_UTF8String& ret, const char* key, const char* value );
00177 };
00178 
00179 #endif /*ODE_TEXT_LISTENER_H_*/

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1