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 #ifndef _OXML_DOCUMENT_H_
00024 #define _OXML_DOCUMENT_H_
00025
00026
00027 #include <OXML_Types.h>
00028 #include <OXML_ObjectWithAttrProp.h>
00029 #include "OXML_Section.h"
00030 #include "OXML_Style.h"
00031 #include "OXML_Theme.h"
00032 #include "OXML_FontManager.h"
00033
00034
00035 #include <ut_types.h>
00036 #include <pd_Document.h>
00037 #include <ie_exp_OpenXML.h>
00038
00039
00040 #include <string>
00041
00042
00043
00044
00045
00046
00047 class OXML_Document : public OXML_ObjectWithAttrProp
00048 {
00049 public:
00051 static OXML_Document* getNewInstance();
00053 static OXML_Document* getInstance();
00055 static void destroyInstance();
00057 static OXML_SharedSection getCurrentSection();
00058
00060 OXML_SharedStyle getStyleById(const std::string & id) const;
00062 OXML_SharedStyle getStyleByName(const std::string & name) const;
00063 UT_Error addStyle(const std::string & id, const std::string & name, const gchar ** attributes);
00064 UT_Error addStyle(const OXML_SharedStyle & obj);
00065 UT_Error clearStyles();
00066
00067 UT_Error addList(const OXML_SharedList& obj);
00068 UT_Error addImage(const OXML_SharedImage& obj);
00069 OXML_SharedList getListById(UT_uint32 id) const;
00070 OXML_SharedImage getImageById(const std::string & id) const;
00071
00073 OXML_SharedSection getFootnote(const std::string & id) const;
00074 UT_Error addFootnote(const OXML_SharedSection & obj);
00075 UT_Error clearFootnotes();
00076
00077 OXML_SharedSection getEndnote(const std::string & id) const;
00078 UT_Error addEndnote(const OXML_SharedSection & obj);
00079 UT_Error clearEndnotes();
00080
00082 OXML_SharedSection getHeader(const std::string & id) const;
00083 UT_Error addHeader(const OXML_SharedSection & obj);
00084 UT_Error clearHeaders();
00085
00086 bool isAllDefault(const bool & header) const;
00087 OXML_SharedSection getHdrFtrById(const bool & header, const std::string & id) const;
00088
00090 OXML_SharedSection getFooter(const std::string & id) const;
00091 UT_Error addFooter(const OXML_SharedSection & obj);
00092 UT_Error clearFooters();
00093
00095 OXML_SharedSection getLastSection() const;
00097 OXML_SharedSection getSection(const std::string & id) const;
00099 UT_Error appendSection(const OXML_SharedSection & obj);
00100 UT_Error clearSections();
00101
00102 OXML_SharedTheme getTheme();
00103 OXML_SharedFontManager getFontManager();
00104
00106
00109 UT_Error serialize(IE_Exp_OpenXML* exporter);
00111
00114 UT_Error addToPT(PD_Document * pDocument);
00115
00116 std::string getMappedNumberingId(const std::string & numId) const;
00117 bool setMappedNumberingId(const std::string & numId, const std::string & abstractNumId);
00118
00119 std::string getBookmarkName(const std::string & bookmarkId) const;
00120 std::string getBookmarkId(const std::string & bookmarkName) const;
00121 bool setBookmarkName(const std::string & bookmarkId, const std::string & bookmarkName);
00122
00123 void setPageWidth(const std::string & width);
00124 void setPageHeight(const std::string & height);
00125 void setPageOrientation(const std::string & orientation);
00126 void setPageMargins(const std::string & top, const std::string & left, const std::string & right, const std::string & bottom);
00127 void setColumns(const std::string & colNum, const std::string & colSep);
00128
00129 private:
00130 static OXML_Document* s_docInst;
00131 OXML_Document();
00132 virtual ~OXML_Document();
00133
00134 OXML_SectionVector m_sections;
00135
00136 OXML_SectionMap m_headers;
00137 OXML_SectionMap m_footers;
00138 OXML_SectionMap m_footnotes;
00139 OXML_SectionMap m_endnotes;
00140
00141 OXML_StyleMap m_styles_by_id;
00142 OXML_StyleMap m_styles_by_name;
00143
00144 OXML_SharedTheme m_theme;
00145 OXML_SharedFontManager m_fontManager;
00146
00147 OXML_ListMap m_lists_by_id;
00148 OXML_ImageMap m_images_by_id;
00149
00150 std::map<std::string, std::string> m_numberingMap;
00151 std::map<std::string, std::string> m_bookmarkMap;
00152
00153 std::string m_pageWidth;
00154 std::string m_pageHeight;
00155 std::string m_pageOrientation;
00156
00157 std::string m_pageMarginTop;
00158 std::string m_pageMarginLeft;
00159 std::string m_pageMarginRight;
00160 std::string m_pageMarginBottom;
00161
00162 std::string m_colNum;
00163 std::string m_colSep;
00164
00165 void _assignHdrFtrIds();
00166 UT_Error applyPageProps(PD_Document* pDocument);
00167 };
00168
00169 #endif //_OXML_DOCUMENT_H_
00170