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

OXML_Document.h

Go to the documentation of this file.
00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */
00002 
00003 /* AbiSource
00004  *
00005  * Copyright (C) 2007 Philippe Milot <PhilMilot@gmail.com>
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00020  * 02110-1301 USA.
00021  */
00022 
00023 #ifndef _OXML_DOCUMENT_H_
00024 #define _OXML_DOCUMENT_H_
00025 
00026 // Internal includes
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 // AbiWord includes
00035 #include <ut_types.h>
00036 #include <pd_Document.h>
00037 #include <ie_exp_OpenXML.h>
00038 
00039 // External includes
00040 #include <string>
00041 
00042 /* \class OXML_Document
00043  * This class represents the data model representation of the OpenXML document.
00044  * Since there is only one document to be imported / exported at a time, this is
00045  * enforced by the use of the Singleton pattern.
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 

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1