00001 /* libwps 00002 * Copyright (C) 2002 William Lachance (william.lachance@sympatico.ca) 00003 * Copyright (C) 2002 Marc Maurer (uwog@uwog.net) 00004 * Copyright (C) 2006 Fridrich Strba (fridrich.strba@bluewin.ch) 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * 00011 * This library 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 GNU 00014 * Library General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Library General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 00019 * 00020 * For further information visit http://libwps.sourceforge.net 00021 */ 00022 00023 /* 00024 * This file is in sync with CVS 00025 * /libwpd2/src/lib/WPXPageSpan.h 1.21 00026 */ 00027 00028 #ifndef WPSPAGE_H 00029 #define WPSPAGE_H 00030 #include "WPSFileStructure.h" 00031 #include <vector> 00032 #include "libwps_internal.h" 00033 00034 // intermediate page representation class: for internal use only (by the high-level content/styles listeners). should not be exported. 00035 00036 class WPSHeaderFooter 00037 { 00038 public: 00039 WPSHeaderFooter(const WPSHeaderFooter &headerFooter); 00040 ~WPSHeaderFooter(); 00041 WPSHeaderFooterType getType() const { return m_type; } 00042 WPSHeaderFooterOccurence getOccurence() const { return m_occurence; } 00043 uint8_t getInternalType() const { return m_internalType; } 00044 00045 private: 00046 WPSHeaderFooterType m_type; 00047 WPSHeaderFooterOccurence m_occurence; 00048 uint8_t m_internalType; // for suppression 00049 }; 00050 00051 class WPSPageSpan 00052 { 00053 public: 00054 WPSPageSpan(); 00055 WPSPageSpan(const WPSPageSpan &page); 00056 virtual ~WPSPageSpan(); 00057 00058 bool getHeaderFooterSuppression(const uint8_t headerFooterType) const { if (headerFooterType <= WPS_FOOTER_B) return m_isHeaderFooterSuppressed[headerFooterType]; return false; } 00059 float getFormLength() const { return m_formLength; } 00060 float getFormWidth() const { return m_formWidth; } 00061 WPSFormOrientation getFormOrientation() const { return m_formOrientation; } 00062 float getMarginLeft() const { return m_marginLeft; } 00063 float getMarginRight() const { return m_marginRight; } 00064 float getMarginTop() const { return m_marginTop; } 00065 float getMarginBottom() const { return m_marginBottom; } 00066 int getPageSpan() const { return m_pageSpan; } 00067 const std::vector<WPSHeaderFooter> & getHeaderFooterList() const { return m_headerFooterList; } 00068 00069 void setHeadFooterSuppression(const uint8_t headerFooterType, const bool suppress) { m_isHeaderFooterSuppressed[headerFooterType] = suppress; } 00070 void setFormLength(const float formLength) { m_formLength = formLength; } 00071 void setFormWidth(const float formWidth) { m_formWidth = formWidth; } 00072 void setFormOrientation(const WPSFormOrientation formOrientation) { m_formOrientation = formOrientation; } 00073 void setMarginLeft(const float marginLeft) { m_marginLeft = marginLeft; } 00074 void setMarginRight(const float marginRight) { m_marginRight = marginRight; } 00075 void setMarginTop(const float marginTop) { m_marginTop = marginTop; } 00076 void setMarginBottom(const float marginBottom) { m_marginBottom = marginBottom; } 00077 void setPageSpan(const int pageSpan) { m_pageSpan = pageSpan; } 00078 00079 void makeConsistent(int startingPageNumber); 00080 00081 protected: 00082 void _removeHeaderFooter(WPSHeaderFooterType type, WPSHeaderFooterOccurence occurence); 00083 00084 private: 00085 bool m_isHeaderFooterSuppressed[WPS_NUM_HEADER_FOOTER_TYPES]; 00086 float m_formLength, m_formWidth; 00087 WPSFormOrientation m_formOrientation; 00088 float m_marginLeft, m_marginRight; 00089 float m_marginTop, m_marginBottom; 00090 std::vector<WPSHeaderFooter> m_headerFooterList; 00091 00092 int m_pageSpan; 00093 }; 00094 00095 bool operator==(const WPSPageSpan &, const WPSPageSpan &); 00096 #endif /* WPSPAGE_H */