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
00072 OXML_SharedSection getFootnote(const std::string & id) const;
00073 UT_Error addFootnote(const OXML_SharedSection & obj);
00074 UT_Error clearFootnotes();
00075
00076 OXML_SharedSection getEndnote(const std::string & id) const;
00077 UT_Error addEndnote(const OXML_SharedSection & obj);
00078 UT_Error clearEndnotes();
00079
00081 OXML_SharedSection getHeader(const std::string & id) const;
00082 UT_Error addHeader(const OXML_SharedSection & obj);
00083 UT_Error clearHeaders();
00084
00086 OXML_SharedSection getFooter(const std::string & id) const;
00087 UT_Error addFooter(const OXML_SharedSection & obj);
00088 UT_Error clearFooters();
00089
00091 OXML_SharedSection getLastSection() const;
00093 OXML_SharedSection getSection(const std::string & id) const;
00095 UT_Error appendSection(const OXML_SharedSection & obj);
00096 UT_Error clearSections();
00097
00098 OXML_SharedTheme getTheme();
00099 OXML_SharedFontManager getFontManager();
00100
00102
00105 UT_Error serialize(IE_Exp_OpenXML* exporter);
00107
00110 UT_Error addToPT(PD_Document * pDocument);
00111
00112 std::string getMappedNumberingId(const std::string & numId) const;
00113 bool setMappedNumberingId(const std::string & numId, const std::string & abstractNumId);
00114
00115 std::string getBookmarkName(const std::string & bookmarkId) const;
00116 std::string getBookmarkId(const std::string & bookmarkName) const;
00117 bool setBookmarkName(const std::string & bookmarkId, const std::string & bookmarkName);
00118
00119 void setPageWidth(const std::string & width);
00120 void setPageHeight(const std::string & height);
00121 void setPageOrientation(const std::string & orientation);
00122 void setPageMargins(const std::string & top, const std::string & left, const std::string & right, const std::string & bottom);
00123 void setColumns(const std::string & colNum, const std::string & colSep);
00124
00125 private:
00126 static OXML_Document* s_docInst;
00127 OXML_Document();
00128 virtual ~OXML_Document();
00129
00130 OXML_SectionVector m_sections;
00131
00132 OXML_SectionMap m_headers;
00133 OXML_SectionMap m_footers;
00134 OXML_SectionMap m_footnotes;
00135 OXML_SectionMap m_endnotes;
00136
00137 OXML_StyleMap m_styles_by_id;
00138 OXML_StyleMap m_styles_by_name;
00139
00140 OXML_SharedTheme m_theme;
00141 OXML_SharedFontManager m_fontManager;
00142
00143 OXML_ListMap m_lists_by_id;
00144 OXML_ImageMap m_images_by_id;
00145
00146 std::map<std::string, std::string> m_numberingMap;
00147 std::map<std::string, std::string> m_bookmarkMap;
00148
00149 std::string m_pageWidth;
00150 std::string m_pageHeight;
00151 std::string m_pageOrientation;
00152
00153 std::string m_pageMarginTop;
00154 std::string m_pageMarginLeft;
00155 std::string m_pageMarginRight;
00156 std::string m_pageMarginBottom;
00157
00158 std::string m_colNum;
00159 std::string m_colSep;
00160
00161 void _assignHdrFtrIds();
00162 UT_Error applyPageProps(PD_Document* pDocument);
00163 };
00164
00165 #endif //_OXML_DOCUMENT_H_
00166