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

ODi_Style_MasterPage.h

Go to the documentation of this file.
00001 /* AbiSource Program Utilities
00002  *
00003  * Copyright (C) 2005 Daniel d'Andrada T. de Carvalho
00004  * <daniel.carvalho@indt.org.br>
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00019  * 02110-1301 USA.
00020  */
00021 
00022 
00023 #ifndef _ODI_STYLE_MASTERPAGE_H_
00024 #define _ODI_STYLE_MASTERPAGE_H_
00025 
00026 // Internal includes
00027 #include "ODi_ListenerState.h"
00028 #include "ODi_Style_PageLayout.h"
00029 
00030 // AbiWord includes
00031 #include <ut_string_class.h>
00032 
00033 // AbiWord classes
00034 class PD_Document;
00035 
00039 class ODi_Style_MasterPage : public ODi_ListenerState {
00040 
00041 public:
00042 
00043     ODi_Style_MasterPage(PD_Document* pDocument, ODi_ElementStack& rElementStack);
00044     virtual ~ODi_Style_MasterPage() {}
00045 
00046     void startElement(const gchar* pName, const gchar** ppAtts,
00047                       ODi_ListenerStateAction& rAction);
00048 
00049     void endElement(const gchar* pName, ODi_ListenerStateAction& rAction);
00050 
00051     void charData (const gchar* /*pBuffer*/, int /*length*/) {}
00052 
00053 
00054     inline const std::string& getLayoutName() const {return m_layoutName;}
00055 
00056     inline void setLayoutStylePointer(ODi_Style_PageLayout* pPageLayoutStyle) {
00057         m_pPageLayoutStyle = pPageLayoutStyle;
00058     }
00059 
00060     inline void definePageSizeTag(PD_Document* pDocument) const {
00061         m_pPageLayoutStyle->definePageSizeTag(pDocument);
00062     }
00063 
00064     inline const std::string getSectionProps() const {
00065         return m_pPageLayoutStyle->getSectionProps(
00066             !m_AW_headerSectionID.empty() || !m_AW_evenHeaderSectionID.empty(),
00067             !m_AW_footerSectionID.empty() || !m_AW_evenFooterSectionID.empty());
00068     }
00069 
00070     inline const std::string& getSectionDataID() const {
00071         return m_pPageLayoutStyle->getSectionDataID();
00072     }
00073 
00074     inline const std::string& getName() const {return m_name;}
00075 
00076     inline const std::string& getPageLayoutName() const {return m_layoutName;}
00077 
00078     inline const ODi_Style_PageLayout* getPageLayout() const {
00079         return m_pPageLayoutStyle;
00080     }
00081 
00082 
00083     const std::string& getAWHeaderSectionID() const {return m_AW_headerSectionID;}
00084     const std::string& getAWFooterSectionID() const {return m_AW_footerSectionID;}
00085     const std::string& getAWEvenHeaderSectionID() const {return m_AW_evenHeaderSectionID;}
00086     const std::string& getAWEvenFooterSectionID() const {return m_AW_evenFooterSectionID;}
00087 
00088 private:
00089     PD_Document* m_pAbiDocument;
00090 
00091     ODi_Style_PageLayout* m_pPageLayoutStyle;
00092 
00093     std::string m_name;
00094     std::string m_layoutName;
00095 
00096     // The AbiWord header section id
00097     std::string m_AW_headerSectionID;
00098 
00099     // The AbiWord even header section id
00100     std::string m_AW_evenHeaderSectionID;
00101 
00102     // The AbiWord footer section id
00103     std::string m_AW_footerSectionID;
00104 
00105     // The AbiWord even footer section id
00106     std::string m_AW_evenFooterSectionID;
00107 
00108     // The parsing uses a two-pass approach:
00109     //
00110     // - On the first pass, master page attributes are gathered.
00111     // - On the second pass, headers and footers contents are parsed, being
00112     //   translated into abi sections.
00113     //
00114     // The second pass is postponed because headers and footers sections, on
00115     // AbiWord, must appear after the text sections that uses then. So,
00116     // they must be parsed after <office:text>, which contains the entire
00117     // document content.
00118     enum ODI_ParsingState {
00119         ODI_FIRST_PASS,
00120         ODI_SECOND_PASS,
00121         ODI_POSTPONING,
00122         ODI_POSTPONED_SECOND_PASS
00123         } m_parsingState;
00124 };
00125 
00126 #endif //_ODI_STYLE_MASTERPAGE_H_

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1