• 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., 59 Temple Place - Suite 330, Boston, MA
00020  * 02111-1307, 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 
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 

Generated on Sun May 27 2012 for AbiWord by  doxygen 1.7.1