WPXPageSpan.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
00002 /* libwpd
00003  * Version: MPL 2.0 / LGPLv2.1+
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  *
00009  * Major Contributor(s):
00010  * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
00011  * Copyright (C) 2002 Marc Maurer (uwog@uwog.net)
00012  * Copyright (C) 2006 Fridrich Strba (fridrich.strba@bluewin.ch)
00013  *
00014  * For minor contributions see the git repository.
00015  *
00016  * Alternatively, the contents of this file may be used under the terms
00017  * of the GNU Lesser General Public License Version 2.1 or later
00018  * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
00019  * applicable instead of those above.
00020  *
00021  * For further information visit http://libwpd.sourceforge.net
00022  */
00023 
00024 /* "This product is not manufactured, approved, or supported by
00025  * Corel Corporation or Corel Corporation Limited."
00026  */
00027 
00028 #ifndef WPXPAGE_H
00029 #define WPXPAGE_H
00030 #include "WPXFileStructure.h"
00031 #include <vector>
00032 #include "WPXTable.h"
00033 #include "libwpd_internal.h"
00034 #include "WPXSubDocument.h"
00035 
00036 // intermediate page representation class: for internal use only (by the high-level content/styles listeners). should not be exported.
00037 
00038 class WPXHeaderFooter
00039 {
00040 public:
00041         WPXHeaderFooter(const WPXHeaderFooterType headerFooterType, const WPXHeaderFooterOccurrence occurrence,
00042                         const unsigned char internalType, const WPXSubDocument *subDocument, WPXTableList tableList);
00043         WPXHeaderFooter(const WPXHeaderFooterType headerFooterType, const WPXHeaderFooterOccurrence occurrence,
00044                         const unsigned char internalType, const WPXSubDocument *subDocument);
00045         WPXHeaderFooter(const WPXHeaderFooter &headerFooter);
00046         ~WPXHeaderFooter();
00047         WPXHeaderFooter &operator=(const WPXHeaderFooter &headerFooter);
00048         WPXHeaderFooterType getType() const
00049         {
00050                 return m_type;
00051         }
00052         WPXHeaderFooterOccurrence getOccurrence() const
00053         {
00054                 return m_occurrence;
00055         }
00056         unsigned char getInternalType() const
00057         {
00058                 return m_internalType;
00059         }
00060         const WPXSubDocument *getSubDocument() const
00061         {
00062                 return m_subDocument;
00063         }
00064         WPXTableList getTableList() const
00065         {
00066                 return m_tableList;
00067         }
00068 
00069 private:
00070         WPXHeaderFooterType m_type;
00071         WPXHeaderFooterOccurrence m_occurrence;
00072         unsigned char m_internalType; // for suppression
00073         const WPXSubDocument *m_subDocument;  // for the actual text
00074         WPXTableList m_tableList;
00075 };
00076 
00077 class WPXPageSpan
00078 {
00079 public:
00080         WPXPageSpan();
00081         WPXPageSpan(const WPXPageSpan &page, double paragraphMarginLeft, double paragraphMarginRight);
00082         virtual ~WPXPageSpan();
00083 
00084         bool getPageNumberSuppression() const
00085         {
00086                 return m_isPageNumberSuppressed;
00087         }
00088         bool getHeaderFooterSuppression(const unsigned char headerFooterType) const
00089         {
00090                 if (headerFooterType <= WPX_FOOTER_B) return m_isHeaderFooterSuppressed[headerFooterType];
00091                 return false;
00092         }
00093         double getFormLength() const
00094         {
00095                 return m_formLength;
00096         }
00097         double getFormWidth() const
00098         {
00099                 return m_formWidth;
00100         }
00101         WPXFormOrientation getFormOrientation() const
00102         {
00103                 return m_formOrientation;
00104         }
00105         double getMarginLeft() const
00106         {
00107                 return m_marginLeft;
00108         }
00109         double getMarginRight() const
00110         {
00111                 return m_marginRight;
00112         }
00113         double getMarginTop() const
00114         {
00115                 return m_marginTop;
00116         }
00117         double getMarginBottom() const
00118         {
00119                 return m_marginBottom;
00120         }
00121         WPXPageNumberPosition getPageNumberPosition() const
00122         {
00123                 return m_pageNumberPosition;
00124         }
00125         bool getPageNumberOverriden() const
00126         {
00127                 return m_isPageNumberOverridden;
00128         }
00129         int getPageNumberOverride() const
00130         {
00131                 return m_pageNumberOverride;
00132         }
00133         WPXNumberingType getPageNumberingType() const
00134         {
00135                 return m_pageNumberingType;
00136         }
00137         double getPageNumberingFontSize() const
00138         {
00139                 return m_pageNumberingFontSize;
00140         }
00141         librevenge::RVNGString getPageNumberingFontName() const
00142         {
00143                 return m_pageNumberingFontName;
00144         }
00145         int getPageSpan() const
00146         {
00147                 return m_pageSpan;
00148         }
00149         const std::vector<WPXHeaderFooter> &getHeaderFooterList() const
00150         {
00151                 return m_headerFooterList;
00152         }
00153 
00154         void setHeaderFooter(const WPXHeaderFooterType type, const unsigned char headerFooterType, const WPXHeaderFooterOccurrence occurrence,
00155                              const WPXSubDocument *subDocument, WPXTableList tableList);
00156         void setPageNumberSuppression(const bool suppress)
00157         {
00158                 m_isPageNumberSuppressed = suppress;
00159         }
00160         void setHeadFooterSuppression(const unsigned char headerFooterType, const bool suppress)
00161         {
00162                 m_isHeaderFooterSuppressed[headerFooterType] = suppress;
00163         }
00164         void setFormLength(const double formLength)
00165         {
00166                 m_formLength = formLength;
00167         }
00168         void setFormWidth(const double formWidth)
00169         {
00170                 m_formWidth = formWidth;
00171         }
00172         void setFormOrientation(const WPXFormOrientation formOrientation)
00173         {
00174                 m_formOrientation = formOrientation;
00175         }
00176         void setMarginLeft(const double marginLeft)
00177         {
00178                 m_marginLeft = marginLeft;
00179         }
00180         void setMarginRight(const double marginRight)
00181         {
00182                 m_marginRight = marginRight;
00183         }
00184         void setMarginTop(const double marginTop)
00185         {
00186                 m_marginTop = marginTop;
00187         }
00188         void setMarginBottom(const double marginBottom)
00189         {
00190                 m_marginBottom = marginBottom;
00191         }
00192         void setPageNumberPosition(const WPXPageNumberPosition pageNumberPosition)
00193         {
00194                 m_pageNumberPosition = pageNumberPosition;
00195         }
00196         void setPageNumber(const int pageNumberOverride)
00197         {
00198                 m_pageNumberOverride = pageNumberOverride;
00199                 m_isPageNumberOverridden = true;
00200         }
00201         void setPageNumberingType(const WPXNumberingType pageNumberingType)
00202         {
00203                 m_pageNumberingType = pageNumberingType;
00204         }
00205         void setPageNumberingFontSize(const double pageNumberingFontSize)
00206         {
00207                 m_pageNumberingFontSize = pageNumberingFontSize;
00208         }
00209         void setPageNumberingFontName(const librevenge::RVNGString &pageNumberingFontName)
00210         {
00211                 m_pageNumberingFontName = pageNumberingFontName;
00212         }
00213         void setPageSpan(const int pageSpan)
00214         {
00215                 m_pageSpan = pageSpan;
00216         }
00217 
00218 protected:
00219         void _removeHeaderFooter(WPXHeaderFooterType type, WPXHeaderFooterOccurrence occurrence);
00220         bool _containsHeaderFooter(WPXHeaderFooterType type, WPXHeaderFooterOccurrence occurrence);
00221 
00222 private:
00223         bool m_isHeaderFooterSuppressed[WPX_NUM_HEADER_FOOTER_TYPES];
00224         bool m_isPageNumberSuppressed;
00225         double m_formLength, m_formWidth;
00226         WPXFormOrientation m_formOrientation;
00227         double m_marginLeft, m_marginRight;
00228         double m_marginTop, m_marginBottom;
00229         WPXPageNumberPosition m_pageNumberPosition;
00230         bool m_isPageNumberOverridden;
00231         int m_pageNumberOverride;
00232         WPXNumberingType m_pageNumberingType;
00233         librevenge::RVNGString m_pageNumberingFontName;
00234         double m_pageNumberingFontSize;
00235         std::vector<WPXHeaderFooter> m_headerFooterList;
00236 
00237         int m_pageSpan;
00238 };
00239 
00240 bool operator==(const WPXPageSpan &, const WPXPageSpan &);
00241 #endif /* WPXPAGE_H */
00242 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */