Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _ODI_TEXTCONTENT_LISTENERSTATE_H_
00026 #define _ODI_TEXTCONTENT_LISTENERSTATE_H_
00027
00028 #include "ut_compiler.h"
00029
00030 #include <string>
00031 #include <map>
00032 #include <set>
00033
00034
00035 #include "../../common/xp/ODc_util.h"
00036 #include "ODi_ListenerState.h"
00037
00038
00039 #include <ut_types.h>
00040 #include <ut_stack.h>
00041
00042
00043 ABI_W_NO_CONST_QUAL
00044 #include <gsf/gsf.h>
00045 ABI_W_POP
00046
00047
00048 class ODi_Office_Styles;
00049 class ODi_Style_List;
00050 class ODi_TableOfContent_ListenerState;
00051 class ODi_Abi_Data;
00052
00053
00054 class PD_Document;
00055 class pf_Frag_Strux;
00056
00057 #include <list>
00058
00059 #include "pp_Property.h"
00060
00083 class ODi_TextContent_ListenerState : public ODi_ListenerState {
00084
00085 public:
00086
00087 ODi_TextContent_ListenerState (
00088 PD_Document* pDocument,
00089 ODi_Office_Styles* pStyles,
00090 ODi_ElementStack& rElementStack,
00091 ODi_Abi_Data & rAbiData);
00092
00093 virtual ~ODi_TextContent_ListenerState();
00094
00095 void startElement (const gchar* pName, const gchar** ppAtts,
00096 ODi_ListenerStateAction& rAction);
00097
00098 void endElement (const gchar* pName, ODi_ListenerStateAction& rAction);
00099
00100 void charData (const gchar* pBuffer, int length);
00101
00102 private:
00103
00104 void _insertBookmark (const gchar * name, const gchar * type, const gchar* xmlid = 0 );
00105 void _flush ();
00106 void _startParagraphElement (const gchar* pName,
00107 const gchar** ppParagraphAtts,
00108 ODi_ListenerStateAction& rAction);
00109 void _endParagraphElement (const gchar* pName,
00110 ODi_ListenerStateAction& rAction);
00111 bool _pushInlineFmt(const PP_PropertyVector & ppAtts);
00112 void _popInlineFmt(void);
00113 void _insureInBlock(const PP_PropertyVector & atts);
00114 void _insureInSection(const std::string* pMasterPageName = NULL);
00115 void _openAbiSection(const std::string& rProps,
00116 const std::string* pMasterPageName = NULL);
00117 void _defineAbiTOCHeadingStyles();
00118 void _flushPendingParagraphBreak();
00119 void _insertAnnotation(void);
00120
00121 PD_Document* m_pAbiDocument;
00122 ODi_Office_Styles* m_pStyles;
00123
00124 bool m_bAcceptingText;
00125 bool m_bOpenedBlock;
00126
00127 bool m_inAbiSection;
00128 bool m_openedFirstAbiSection;
00129 bool m_bPendingSection;
00130 std::string m_currentPageMarginLeft;
00131 std::string m_currentPageMarginRight;
00132
00133
00134
00135
00136
00137
00138
00139 std::string m_pendingParagraphBreak;
00140
00141 enum ODi_CurrentODSection {
00142
00143 ODI_SECTION_NONE,
00144
00145
00146
00147 ODI_SECTION_MAPPED,
00148
00149
00150
00151 ODI_SECTION_IGNORED,
00152
00153
00154 ODI_SECTION_UNDEFINED
00155 } m_currentODSection;
00156
00157 PP_PropertyVector m_vecInlineFmt;
00158 UT_NumberStack m_stackFmtStartIndex;
00159
00160 UT_sint8 m_elementParsingLevel;
00161
00162
00163
00164 UT_UCS4String m_charData;
00165
00172
00173 UT_GenericVector<pf_Frag_Strux*> m_tablesOfContent;
00174 UT_GenericVector<std::string*> m_tablesOfContentProps;
00175
00176
00177 std::map<std::string, std::string> m_headingStyles;
00178 ODi_TableOfContent_ListenerState* m_pCurrentTOCParser;
00179
00180
00181
00182 bool m_bOnContentStream;
00183
00184
00185 ODi_Style_List* m_pCurrentListStyle;
00186 UT_uint8 m_listLevel;
00187 bool m_alreadyDefinedAbiParagraphForList;
00188
00189
00190 bool m_bPendingNoteCitation;
00191 bool m_pendingNoteAnchorInsertion;
00192 std::string m_currentNoteId;
00193 std::string m_noteCitation;
00194
00195
00196 bool m_bPendingAnnotation;
00197 bool m_bPendingAnnotationAuthor;
00198 bool m_bPendingAnnotationDate;
00199 UT_uint32 m_iAnnotation;
00200 std::string m_sAnnotationAuthor;
00201 std::string m_sAnnotationDate;
00202 std::string m_sAnnotationName;
00203 std::string m_sAnnotationXMLID;
00204 std::set< std::string > m_openAnnotationNames;
00205
00206
00207 std::list< std::string > xmlidStackForTextMeta;
00208 std::map< std::string, std::string > xmlidMapForBookmarks;
00209
00210
00211 bool m_bPageReferencePending;
00212 UT_sint32 m_iPageNum;
00213 double m_dXpos;
00214 double m_dYpos;
00215 std::string m_sProps;
00216 ODi_Abi_Data& m_rAbiData;
00217 bool m_bPendingTextbox;
00218 bool m_bHeadingList;
00219 UT_sint32 m_prevLevel;
00220 bool m_bContentWritten;
00221
00222 UT_uint32 m_columnsCount;
00223 UT_uint32 m_columnIndex;
00224 };
00225
00226 #endif //_ODI_TEXTCONTENT_LISTENERSTATE_H_