00001 /* AbiSource Program Utilities 00002 * 00003 * Copyright (C) 2002 Dom Lachowicz <cinamod@hotmail.com> 00004 * Copyright (C) 2005 Daniel d'Andrada T. de Carvalho 00005 * <daniel.carvalho@indt.org.br> 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 _ODI_STYLE_PAGELAYOUT_H_ 00024 #define _ODI_STYLE_PAGELAYOUT_H_ 00025 00026 // Internal includes 00027 #include "ODi_ListenerState.h" 00028 00029 // AbiWord includes 00030 #include <ut_string_class.h> 00031 00032 // Internal classes 00033 class ODi_Abi_Data; 00034 00035 // AbiWord classes 00036 class PD_Document; 00037 00038 00042 class ODi_Style_PageLayout : public ODi_ListenerState { 00043 public: 00044 ODi_Style_PageLayout(ODi_ElementStack& rElementStack, ODi_Abi_Data& rAbiData) : 00045 ODi_ListenerState("StylePageLayout", rElementStack), 00046 m_rAbiData(rAbiData) {} 00047 00048 virtual ~ODi_Style_PageLayout() {} 00049 00050 void startElement(const gchar* pName, const gchar** ppAtts, 00051 ODi_ListenerStateAction& rAction); 00052 00053 void endElement(const gchar* pName, ODi_ListenerStateAction& rAction); 00054 00055 void charData (const gchar* /*pBuffer*/, int /*length*/) {} 00056 00057 void definePageSizeTag(PD_Document* pDocument) const; 00058 00059 // Returns the value to be used on every <section> tag of the AbiWord 00060 // document. 00061 const std::string getSectionProps(bool hasHeader, bool hasFooter) const; 00062 00063 const std::string getMarginLeft() const { 00064 return m_marginLeft; 00065 } 00066 00067 const std::string getMarginRight() const { 00068 return m_marginRight; 00069 } 00070 00071 inline const std::string& getSectionDataID() const {return m_sectionDataID;} 00072 00073 inline const std::string& getName() const {return m_name;} 00074 00075 private: 00076 00077 void _parseHeaderFooterProperties(const gchar** ppAtts); 00078 void _parsePageLayoutProperties(const gchar** ppAtts); 00079 void _parseBackgroundImage(const gchar** ppAtts); 00080 std::string _buildSectionPropsString(bool hasHeader, bool hasFooter) const; 00081 void _buildSectionDataIDString(); 00082 00083 ODi_Abi_Data& m_rAbiData; 00084 00085 std::string m_name; 00086 00088 // <style:page-layout-properties> 00089 std::string m_pageWidth; // fo:page-width 00090 std::string m_pageHeight; // fo:page-height 00091 std::string m_printOrientation; // style:print-orientation 00092 std::string m_marginLeft; // fo:margin-left 00093 std::string m_marginRight; // fo:margin-right 00094 std::string m_marginTop; // fo:margin-top 00095 std::string m_marginBottom; // fo:margin-bottom 00096 std::string m_backgroundColor; // fo:background-color 00097 00099 // <style:columns> 00100 std::string m_columnCount; // fo:column-count 00101 std::string m_columnGap; // fo:column-gap 00102 00104 // <style:column-sep> 00105 std::string m_columnLine; // style:style or style:width 00106 00108 // <style:header-style> 00109 std::string m_headerHeight; // svg:height 00110 std::string m_headerMarginBottom; // fo:margin-bottom 00111 00113 // <style:footer-style> 00114 std::string m_footerHeight; // svg:height 00115 std::string m_footerMarginTop; // fo:margin-top 00116 00118 // <style:background-image> 00119 std::string m_backgroundImage; // xlink:href 00120 00121 // The strux-image-dataid attribute for the section 00122 std::string m_sectionDataID; 00123 }; 00124 00125 #endif //_ODI_STYLE_PAGELAYOUT_H_