WPXPageSpan.h
Go to the documentation of this file.
00001 /* libwpd
00002  * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
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://libwpd.sourceforge.net
00021  */
00022 
00023 /* "This product is not manufactured, approved, or supported by 
00024  * Corel Corporation or Corel Corporation Limited."
00025  */
00026 
00027 #ifndef WPXPAGE_H
00028 #define WPXPAGE_H
00029 #include "WPXFileStructure.h"
00030 #include <vector>
00031 #include "WPXTable.h"
00032 #include "libwpd_internal.h"
00033 #include "WPXSubDocument.h"
00034 
00035 // intermediate page representation class: for internal use only (by the high-level content/styles listeners). should not be exported.
00036 
00037 class WPXHeaderFooter
00038 {
00039 public:
00040         WPXHeaderFooter(const WPXHeaderFooterType headerFooterType, const WPXHeaderFooterOccurence occurence, 
00041                         const uint8_t internalType, const WPXSubDocument * subDocument, WPXTableList tableList);
00042         WPXHeaderFooter(const WPXHeaderFooterType headerFooterType, const WPXHeaderFooterOccurence occurence, 
00043                         const uint8_t internalType, const WPXSubDocument * subDocument);
00044         WPXHeaderFooter(const WPXHeaderFooter &headerFooter);
00045         ~WPXHeaderFooter();
00046         WPXHeaderFooter& operator=(const WPXHeaderFooter &headerFooter);
00047         WPXHeaderFooterType getType() const { return m_type; }
00048         WPXHeaderFooterOccurence getOccurence() const { return m_occurence; }
00049         uint8_t getInternalType() const { return m_internalType; }
00050         const WPXSubDocument * getSubDocument() const { return m_subDocument; }
00051         WPXTableList getTableList() const { return m_tableList; }
00052 
00053 private:
00054         WPXHeaderFooterType m_type;
00055         WPXHeaderFooterOccurence m_occurence;
00056         uint8_t m_internalType; // for suppression
00057         const WPXSubDocument * m_subDocument; // for the actual text
00058         WPXTableList m_tableList;
00059 };
00060 
00061 class WPXPageSpan
00062 {
00063 public:
00064         WPXPageSpan();
00065         WPXPageSpan(const WPXPageSpan &page, double paragraphMarginLeft, double paragraphMarginRight);
00066         WPXPageSpan(const WPXPageSpan &page);
00067         virtual ~WPXPageSpan();
00068 
00069         bool getPageNumberSuppression() const { return m_isPageNumberSuppressed; }
00070         bool getHeaderFooterSuppression(const uint8_t headerFooterType) const { if (headerFooterType <= WPX_FOOTER_B) return m_isHeaderFooterSuppressed[headerFooterType]; return false; }
00071         double getFormLength() const { return m_formLength; }
00072         double getFormWidth() const { return m_formWidth; }
00073         WPXFormOrientation getFormOrientation() const { return m_formOrientation; }
00074         double getMarginLeft() const { return m_marginLeft; }
00075         double getMarginRight() const { return m_marginRight; }
00076         double getMarginTop() const { return m_marginTop; }
00077         double getMarginBottom() const { return m_marginBottom; }
00078         WPXPageNumberPosition getPageNumberPosition() const { return m_pageNumberPosition; }
00079         bool getPageNumberOverriden() const { return m_isPageNumberOverridden; }
00080         int getPageNumberOverride() const { return m_pageNumberOverride; }
00081         WPXNumberingType getPageNumberingType() const { return m_pageNumberingType; }
00082         double getPageNumberingFontSize() const { return m_pageNumberingFontSize; }
00083         WPXString getPageNumberingFontName() const { return m_pageNumberingFontName; }
00084         int getPageSpan() const { return m_pageSpan; }
00085         const std::vector<WPXHeaderFooter> & getHeaderFooterList() const { return m_headerFooterList; }
00086 
00087         void setHeaderFooter(const WPXHeaderFooterType type, const uint8_t headerFooterType, const WPXHeaderFooterOccurence occurence, 
00088                              const WPXSubDocument * subDocument, WPXTableList tableList);
00089         void setPageNumberSuppression(const bool suppress) { m_isPageNumberSuppressed = suppress; }
00090         void setHeadFooterSuppression(const uint8_t headerFooterType, const bool suppress) { m_isHeaderFooterSuppressed[headerFooterType] = suppress; }
00091         void setFormLength(const double formLength) { m_formLength = formLength; }
00092         void setFormWidth(const double formWidth) { m_formWidth = formWidth; }
00093         void setFormOrientation(const WPXFormOrientation formOrientation) { m_formOrientation = formOrientation; }
00094         void setMarginLeft(const double marginLeft) { m_marginLeft = marginLeft; }
00095         void setMarginRight(const double marginRight) { m_marginRight = marginRight; }
00096         void setMarginTop(const double marginTop) { m_marginTop = marginTop; }
00097         void setMarginBottom(const double marginBottom) { m_marginBottom = marginBottom; }
00098         void setPageNumberPosition(const WPXPageNumberPosition pageNumberPosition) { m_pageNumberPosition = pageNumberPosition; }
00099         void setPageNumber(const int pageNumberOverride) { m_pageNumberOverride = pageNumberOverride; m_isPageNumberOverridden = true; } 
00100         void setPageNumberingType(const WPXNumberingType pageNumberingType) { m_pageNumberingType = pageNumberingType; }
00101         void setPageNumberingFontSize(const double pageNumberingFontSize) { m_pageNumberingFontSize = pageNumberingFontSize; }
00102         void setPageNumberingFontName(const WPXString &pageNumberingFontName) { m_pageNumberingFontName = pageNumberingFontName; }
00103         void setPageSpan(const int pageSpan) { m_pageSpan = pageSpan; }
00104         
00105 protected:
00106         void _removeHeaderFooter(WPXHeaderFooterType type, WPXHeaderFooterOccurence occurence);
00107         bool _containsHeaderFooter(WPXHeaderFooterType type, WPXHeaderFooterOccurence occurence);
00108 
00109 private:
00110         bool m_isHeaderFooterSuppressed[WPX_NUM_HEADER_FOOTER_TYPES];
00111         bool m_isPageNumberSuppressed;
00112         double m_formLength, m_formWidth;
00113         WPXFormOrientation m_formOrientation;
00114         double m_marginLeft, m_marginRight;
00115         double m_marginTop, m_marginBottom;
00116         WPXPageNumberPosition m_pageNumberPosition;
00117         bool m_isPageNumberOverridden;
00118         int m_pageNumberOverride;
00119         WPXNumberingType m_pageNumberingType;
00120         WPXString m_pageNumberingFontName;
00121         double m_pageNumberingFontSize;
00122         std::vector<WPXHeaderFooter> m_headerFooterList;
00123 
00124         int m_pageSpan;
00125 };
00126 
00127 bool operator==(const WPXPageSpan &, const WPXPageSpan &);
00128 #endif /* WPXPAGE_H */