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  * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
00004  * Copyright (C) 2002 Marc Maurer (uwog@uwog.net)
00005  * Copyright (C) 2006 Fridrich Strba (fridrich.strba@bluewin.ch)
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Library General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2 of the License, or (at your option) any later version.
00011  *
00012  * This library 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 GNU
00015  * Library General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Library General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
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 WPXHeaderFooterOccurence occurence,
00042                         const uint8_t internalType, const WPXSubDocument *subDocument, WPXTableList tableList);
00043         WPXHeaderFooter(const WPXHeaderFooterType headerFooterType, const WPXHeaderFooterOccurence occurence,
00044                         const uint8_t 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         WPXHeaderFooterOccurence getOccurence() const
00053         {
00054                 return m_occurence;
00055         }
00056         uint8_t 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         WPXHeaderFooterOccurence m_occurence;
00072         uint8_t 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         WPXPageSpan(const WPXPageSpan &page);
00083         virtual ~WPXPageSpan();
00084 
00085         bool getPageNumberSuppression() const
00086         {
00087                 return m_isPageNumberSuppressed;
00088         }
00089         bool getHeaderFooterSuppression(const uint8_t headerFooterType) const
00090         {
00091                 if (headerFooterType <= WPX_FOOTER_B) return m_isHeaderFooterSuppressed[headerFooterType];
00092                 return false;
00093         }
00094         double getFormLength() const
00095         {
00096                 return m_formLength;
00097         }
00098         double getFormWidth() const
00099         {
00100                 return m_formWidth;
00101         }
00102         WPXFormOrientation getFormOrientation() const
00103         {
00104                 return m_formOrientation;
00105         }
00106         double getMarginLeft() const
00107         {
00108                 return m_marginLeft;
00109         }
00110         double getMarginRight() const
00111         {
00112                 return m_marginRight;
00113         }
00114         double getMarginTop() const
00115         {
00116                 return m_marginTop;
00117         }
00118         double getMarginBottom() const
00119         {
00120                 return m_marginBottom;
00121         }
00122         WPXPageNumberPosition getPageNumberPosition() const
00123         {
00124                 return m_pageNumberPosition;
00125         }
00126         bool getPageNumberOverriden() const
00127         {
00128                 return m_isPageNumberOverridden;
00129         }
00130         int getPageNumberOverride() const
00131         {
00132                 return m_pageNumberOverride;
00133         }
00134         WPXNumberingType getPageNumberingType() const
00135         {
00136                 return m_pageNumberingType;
00137         }
00138         double getPageNumberingFontSize() const
00139         {
00140                 return m_pageNumberingFontSize;
00141         }
00142         WPXString getPageNumberingFontName() const
00143         {
00144                 return m_pageNumberingFontName;
00145         }
00146         int getPageSpan() const
00147         {
00148                 return m_pageSpan;
00149         }
00150         const std::vector<WPXHeaderFooter> & getHeaderFooterList() const
00151         {
00152                 return m_headerFooterList;
00153         }
00154 
00155         void setHeaderFooter(const WPXHeaderFooterType type, const uint8_t headerFooterType, const WPXHeaderFooterOccurence occurence,
00156                              const WPXSubDocument *subDocument, WPXTableList tableList);
00157         void setPageNumberSuppression(const bool suppress)
00158         {
00159                 m_isPageNumberSuppressed = suppress;
00160         }
00161         void setHeadFooterSuppression(const uint8_t headerFooterType, const bool suppress)
00162         {
00163                 m_isHeaderFooterSuppressed[headerFooterType] = suppress;
00164         }
00165         void setFormLength(const double formLength)
00166         {
00167                 m_formLength = formLength;
00168         }
00169         void setFormWidth(const double formWidth)
00170         {
00171                 m_formWidth = formWidth;
00172         }
00173         void setFormOrientation(const WPXFormOrientation formOrientation)
00174         {
00175                 m_formOrientation = formOrientation;
00176         }
00177         void setMarginLeft(const double marginLeft)
00178         {
00179                 m_marginLeft = marginLeft;
00180         }
00181         void setMarginRight(const double marginRight)
00182         {
00183                 m_marginRight = marginRight;
00184         }
00185         void setMarginTop(const double marginTop)
00186         {
00187                 m_marginTop = marginTop;
00188         }
00189         void setMarginBottom(const double marginBottom)
00190         {
00191                 m_marginBottom = marginBottom;
00192         }
00193         void setPageNumberPosition(const WPXPageNumberPosition pageNumberPosition)
00194         {
00195                 m_pageNumberPosition = pageNumberPosition;
00196         }
00197         void setPageNumber(const int pageNumberOverride)
00198         {
00199                 m_pageNumberOverride = pageNumberOverride;
00200                 m_isPageNumberOverridden = true;
00201         }
00202         void setPageNumberingType(const WPXNumberingType pageNumberingType)
00203         {
00204                 m_pageNumberingType = pageNumberingType;
00205         }
00206         void setPageNumberingFontSize(const double pageNumberingFontSize)
00207         {
00208                 m_pageNumberingFontSize = pageNumberingFontSize;
00209         }
00210         void setPageNumberingFontName(const WPXString &pageNumberingFontName)
00211         {
00212                 m_pageNumberingFontName = pageNumberingFontName;
00213         }
00214         void setPageSpan(const int pageSpan)
00215         {
00216                 m_pageSpan = pageSpan;
00217         }
00218 
00219 protected:
00220         void _removeHeaderFooter(WPXHeaderFooterType type, WPXHeaderFooterOccurence occurence);
00221         bool _containsHeaderFooter(WPXHeaderFooterType type, WPXHeaderFooterOccurence occurence);
00222 
00223 private:
00224         bool m_isHeaderFooterSuppressed[WPX_NUM_HEADER_FOOTER_TYPES];
00225         bool m_isPageNumberSuppressed;
00226         double m_formLength, m_formWidth;
00227         WPXFormOrientation m_formOrientation;
00228         double m_marginLeft, m_marginRight;
00229         double m_marginTop, m_marginBottom;
00230         WPXPageNumberPosition m_pageNumberPosition;
00231         bool m_isPageNumberOverridden;
00232         int m_pageNumberOverride;
00233         WPXNumberingType m_pageNumberingType;
00234         WPXString m_pageNumberingFontName;
00235         double m_pageNumberingFontSize;
00236         std::vector<WPXHeaderFooter> m_headerFooterList;
00237 
00238         int m_pageSpan;
00239 };
00240 
00241 bool operator==(const WPXPageSpan &, const WPXPageSpan &);
00242 #endif /* WPXPAGE_H */
00243 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */