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 #ifndef IE_EXP_DOCBOOK_H
00022 #define IE_EXP_DOCBOOK_H
00023
00024 #include "ie_exp.h"
00025 #include "pl_Listener.h"
00026 #include "pp_AttrProp.h"
00027 #include "ut_stack.h"
00028 #include "ie_Table.h"
00029
00030 class PD_Document;
00031 class s_DocBook_Listener;
00032
00033
00034
00035 class IE_Exp_DocBook_Sniffer : public IE_ExpSniffer
00036 {
00037 friend class IE_Exp;
00038
00039 public:
00040 IE_Exp_DocBook_Sniffer (const char * name);
00041 virtual ~IE_Exp_DocBook_Sniffer () {}
00042
00043 virtual bool recognizeSuffix (const char * szSuffix);
00044 virtual bool getDlgLabels (const char ** szDesc,
00045 const char ** szSuffixList,
00046 IEFileType * ft);
00047 virtual UT_Error constructExporter (PD_Document * pDocument,
00048 IE_Exp ** ppie);
00049 };
00050
00051
00052 class IE_Exp_DocBook : public IE_Exp
00053 {
00054 public:
00055 IE_Exp_DocBook(PD_Document * pDocument);
00056 virtual ~IE_Exp_DocBook();
00057
00058 void iwrite (const char *);
00059 void writeln (const char *);
00060 int indent (void);
00061 int unindent (void);
00062
00063 protected:
00064 virtual UT_Error _writeDocument(void);
00065 int s_align;
00066
00067 private:
00068 s_DocBook_Listener * m_pListener;
00069 };
00070
00071
00072 class s_DocBook_Listener : public PL_Listener
00073 {
00074 public:
00075 s_DocBook_Listener(PD_Document * pDocument,
00076 IE_Exp_DocBook * pie);
00077 virtual ~s_DocBook_Listener();
00078
00079 virtual bool populate(fl_ContainerLayout* sfh,
00080 const PX_ChangeRecord * pcr);
00081
00082 virtual bool populateStrux(pf_Frag_Strux* sdh,
00083 const PX_ChangeRecord * pcr,
00084 fl_ContainerLayout* * psfh);
00085
00086 virtual bool change(fl_ContainerLayout* sfh,
00087 const PX_ChangeRecord * pcr);
00088
00089 virtual bool insertStrux(fl_ContainerLayout* sfh,
00090 const PX_ChangeRecord * pcr,
00091 pf_Frag_Strux* sdh,
00092 PL_ListenerId lid,
00093 void (* pfnBindHandles)(pf_Frag_Strux* sdhNew,
00094 PL_ListenerId lid,
00095 fl_ContainerLayout* sfhNew));
00096
00097 virtual bool signal(UT_uint32 iSignal);
00098 virtual bool _initFile(void);
00099 virtual void _closeFile(void);
00100 protected:
00101
00102 void _tagClose(UT_uint32 tagID, const UT_UTF8String & content, bool newline=true, bool indent=true, bool decrease=true);
00103 void _tagOpen(UT_uint32 tagID, const UT_UTF8String & content, bool newline=true, bool indent=true, bool increase=true);
00104 void _tagOpenClose(const UT_UTF8String & content, bool suppress, bool newline=true, bool indent=true);
00105 UT_uint32 _tagTop(void);
00106 void _closeSection(int sub);
00107 void _closeSectionTitle(void);
00108 void _closeParagraph(void);
00109 void _closeSpan(void);
00110 void _closeList(void);
00111 void _closeChapter (void);
00112 void _closeChapterTitle (void);
00113 void _openParagraph(PT_AttrPropIndex api);
00114 void _openSection(PT_AttrPropIndex api, int, const UT_UTF8String & content);
00115 void _openSectionTitle(void);
00116 void _openSpan(PT_AttrPropIndex api);
00117 void _openChapter (PT_AttrPropIndex api);
00118 void _openChapterTitle (PT_AttrPropIndex api);
00119 void _openList(PT_AttrPropIndex api);
00120 void _openBlock (bool indent);
00121 void _openPlainBlock ();
00122 void _handleDocument(void);
00123 void _handleMetaData(void);
00124 void _handleRevisions(void);
00125 void _handleImage(PT_AttrPropIndex api);
00126 void _handlePositionedImage(PT_AttrPropIndex api);
00127 void _handleMath(PT_AttrPropIndex api);
00128 void _handleEmbedded(PT_AttrPropIndex api);
00129 void _handleField(const PX_ChangeRecord_Object * pcro, PT_AttrPropIndex api);
00130 void _handleTOC(PT_AttrPropIndex api);
00131 void _handleHyperlink(PT_AttrPropIndex api);
00132 void _handleBookmark(PT_AttrPropIndex api);
00133 void _handleHdrFtr(PT_AttrPropIndex api);
00134 void _handleFootnote(PT_AttrPropIndex api);
00135 void _openTable(PT_AttrPropIndex api);
00136 void _openNestedTable();
00137 void _openCell();
00138 void _openRow(void);
00139 void _closeNestedTable(void);
00140 void _closeTable(void);
00141 void _closeCell(void);
00142 void _closeRow(void);
00143 bool _decideIndent(void);
00144 bool _inFormattedSpan(void);
00145 bool _inSectionStrux(void);
00146
00147 void _outputData(const UT_UCSChar * p, UT_uint32 length);
00148 void _handleDataItems(void);
00149 void _convertFontSize(char* szDest, const char* pszFontSize);
00150 void _convertColor(char* szDest, const char* pszColor);
00151
00152 const UT_UTF8String _getProps(PT_AttrPropIndex api);
00153
00154 PD_Document * m_pDocument;
00155 IE_Exp_DocBook * m_pie;
00156 private:
00157
00158 bool m_bInParagraph;
00159 bool m_bInSection;
00160 bool m_bInSpan;
00161 bool m_bInChapter;
00162 bool m_bInTable;
00163 bool m_bInTitle;
00164 bool m_bInFrame;
00165 bool m_bInHdrFtr;
00166 bool m_bInNote;
00167 int m_iNestedTable;
00168 int m_iTableDepth;
00169 int m_iListDepth;
00170 int m_iPreviousListDepth;
00171 int m_iSectionDepth;
00172 int m_iLastClosed;
00173 UT_UTF8String m_sLastStyle;
00174 UT_UTF8String m_sParentStyle;
00175 const PP_AttrProp* m_pAP_Span;
00176
00177
00178
00179 UT_uint16 m_iBlockType;
00180 bool m_bWasSpace;
00181 bool m_bExternal;
00182
00183 UT_Stack m_utsListStack;
00184 UT_NumberStack m_utnsTagStack;
00185
00186 UT_Vector m_utvDataIDs;
00187 ie_Table mTableHelper;
00188 };
00189
00190 #endif