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

ODe_AbiDocListener.h

Go to the documentation of this file.
00001 /* AbiSource
00002  *
00003  * Copyright (C) 2002 Dom Lachowicz <cinamod@hotmail.com>
00004  *
00005  * Copyright (C) 2005 INdT
00006  * Author: Daniel d'Andrada T. de Carvalho <daniel.carvalho@indt.org.br>
00007  *
00008  * This program is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU General Public License
00010  * as published by the Free Software Foundation; either version 2
00011  * of the License, or (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00021  * 02110-1301 USA.
00022  */
00023 
00024 
00025 #ifndef _ODE_ABIDOCLISTENER_H_
00026 #define _ODE_ABIDOCLISTENER_H_
00027 
00028 // Internal includes
00029 #include "ODe_ListenerAction.h"
00030 
00031 // Abiword includes
00032 #include <pl_Listener.h>
00033 #include <ut_vector.h>
00034 #include <ut_string_class.h>
00035 
00036 // Internal classes
00037 class ODe_AbiDocListenerImpl;
00038 class ODe_DocumentData;
00039 
00040 // AbiWord classes
00041 class PD_Document;
00042 class fd_Field;
00043 class PX_ChangeRecord_Object;
00044 
00049 class ODe_AbiDocListener : public PL_Listener
00050 {
00051 public:
00052 
00053     ODe_AbiDocListener(PD_Document* pDocument,
00054                        ODe_AbiDocListenerImpl* pListenerImpl,
00055                        bool deleteWhenPop);
00056 
00057     virtual ~ODe_AbiDocListener();
00058 
00059     virtual bool populate(fl_ContainerLayout* sfh, const PX_ChangeRecord * pcr);
00060 
00061     virtual bool populateStrux(pf_Frag_Strux* sdh,
00062         const PX_ChangeRecord * pcr, fl_ContainerLayout* * psfh);
00063 
00064     virtual bool change(fl_ContainerLayout* sfh, const PX_ChangeRecord * pcr);
00065 
00066     virtual bool insertStrux(fl_ContainerLayout* sfh,
00067                 const PX_ChangeRecord * pcr,
00068                 pf_Frag_Strux* sdh,
00069                 PL_ListenerId lid,
00070                 void (* pfnBindHandles)(pf_Frag_Strux* sdhNew,
00071                             PL_ListenerId lid,
00072                             fl_ContainerLayout* sfhNew));
00073 
00074     virtual bool signal(UT_uint32 iSignal);
00075 
00076     void finished();
00077 
00078 private:
00079 
00080     void _openSpan(PT_AttrPropIndex api);
00081     void _closeSpan();
00082 
00083     void _openBlock(PT_AttrPropIndex api);
00084     void _closeBlock();
00085 
00086     void _openSection(PT_AttrPropIndex api, bool recursiveCall = false);
00087     void _closeSection(bool recursiveCall = false);
00088 
00089     void _openField(const PX_ChangeRecord_Object* pcro, PT_AttrPropIndex api);
00090     void _closeField();
00091 
00092     void _openTable(PT_AttrPropIndex api, bool recursiveCall = false);
00093     void _closeTable(bool recursiveCall = false);
00094 
00095     void _openCell(PT_AttrPropIndex api, bool recursiveCall = false);
00096     void _closeCell(bool recursiveCall = false);
00097 
00098     void _openFootnote(PT_AttrPropIndex api);
00099     void _closeFootnote();
00100 
00101     void _openEndnote(PT_AttrPropIndex api);
00102     void _closeEndnote();
00103 
00104     void _openAnnotation(PT_AttrPropIndex api, const std::string& defaultName );
00105     void _closeAnnotation();
00106     void _endAnnotation(PT_AttrPropIndex api);
00107 
00108     void _openFrame(PT_AttrPropIndex api);
00109     void _closeFrame();
00110 
00111     void _openTOC(PT_AttrPropIndex api);
00112     void _closeTOC();
00113 
00114     void _openBookmark(PT_AttrPropIndex api);
00115     void _closeBookmark(PT_AttrPropIndex api);
00116     void _closeBookmark(UT_UTF8String &sBookmarkName);
00117 
00118     void _openHyperlink(PT_AttrPropIndex api);
00119     void _closeHyperlink();
00120 
00121     void _openRDFAnchor(PT_AttrPropIndex api);
00122     void _closeRDFAnchor(PT_AttrPropIndex api);
00123 
00124     void _insertInlinedImage(PT_AttrPropIndex api);
00125 
00126     void _insertEmbeddedImage(PT_AttrPropIndex api);
00127 
00128     void _insertMath(PT_AttrPropIndex api);
00129 
00130     void _outputData(const UT_UCSChar* pData, UT_uint32 length);
00131     void _appendSpaces(UT_UTF8String* sBuf, UT_uint32 count);
00132 
00133     const gchar* _getObjectKey(const PT_AttrPropIndex& api,
00134                                   const gchar* key);
00135 
00136     void _handleListenerImplAction();
00137 
00139     // Abi processing vars
00140 
00141     fd_Field* m_pCurrentField;
00142     UT_UTF8String m_currentFieldType;
00143     UT_UTF8String m_bookmarkName;
00144     PT_AttrPropIndex    m_apiLastSpan;
00145 
00146     bool m_bInSpan;
00147     bool m_bInBlock;
00148     bool m_bInBookmark;
00149     bool m_bInHyperlink;
00150     bool m_bInSection;
00151     bool m_bInAnnotation;
00152     bool m_bPendingAnnotationEnd;
00153     std::string m_currentAnnotationName;
00154 
00155     UT_sint32 m_iInTable;
00156     UT_sint32 m_iInCell;
00157 
00158     PD_Document* m_pDocument;
00159 
00161     // Listener implementation vars
00162 
00163     class StackCell {
00164     public:
00165         StackCell() {m_pListenerImpl=NULL; m_deleteWhenPop=false;}
00166         StackCell(ODe_AbiDocListenerImpl* pListenerImpl, bool deleteWhenPop) {
00167             m_deleteWhenPop = deleteWhenPop;
00168             m_pListenerImpl = pListenerImpl;
00169         }
00170         // Work around the "return 0" issue of the UT_GenericVector::getNhItem()
00171         StackCell(UT_uint32 /*i*/)
00172             {
00173                 m_pListenerImpl=NULL;
00174                 m_deleteWhenPop=false;
00175             }
00176 
00177         StackCell& operator=(const StackCell& sc) {
00178             this->m_deleteWhenPop = sc.m_deleteWhenPop;
00179             this->m_pListenerImpl = sc.m_pListenerImpl;
00180 
00181             return *this;
00182         }
00183 
00184         bool m_deleteWhenPop;
00185         ODe_AbiDocListenerImpl* m_pListenerImpl;
00186     };
00187 
00188     UT_GenericVector <ODe_AbiDocListener::StackCell> m_implStack;
00189 
00190     ODe_AbiDocListenerImpl* m_pCurrentImpl;
00191     bool m_deleteCurrentWhenPop;
00192 
00193     ODe_ListenerAction m_listenerImplAction;
00194 };
00195 
00196 #endif //_ODE_ABIDOCLISTENER_H_

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1