WPSPageSpan.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
00002 /* libwps
00003  * Copyright (C) 2002 William Lachance (william.lachance@sympatico.ca)
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://libwps.sourceforge.net
00022  */
00023 
00024 /*
00025  * This file is in sync with CVS
00026  * /libwpd2/src/lib/WPXPageSpan.h 1.21
00027  */
00028 
00029 #ifndef WPSPAGE_H
00030 #define WPSPAGE_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         libwps::HeaderFooterType getType() const
00042         {
00043                 return m_type;
00044         }
00045         libwps::HeaderFooterOccurence getOccurence() const
00046         {
00047                 return m_occurence;
00048         }
00049         uint8_t getInternalType() const
00050         {
00051                 return m_internalType;
00052         }
00053 
00054 private:
00055         libwps::HeaderFooterType m_type;
00056         libwps::HeaderFooterOccurence m_occurence;
00057         uint8_t m_internalType; // for suppression
00058 };
00059 
00060 class WPSPageSpan
00061 {
00062 public:
00063         enum HeaderFooterInternalType { HEADER_A=0, HEADER_B, FOOTER_A, FOOTER_B, NUM_HEADER_FOOTER_TYPES= FOOTER_B+1 };
00064 
00065         WPSPageSpan();
00066         WPSPageSpan(const WPSPageSpan &page);
00067         virtual ~WPSPageSpan();
00068 
00069         bool getHeaderFooterSuppression(const uint8_t headerFooterType) const
00070         {
00071                 if (headerFooterType <= FOOTER_B) return m_isHeaderFooterSuppressed[headerFooterType];
00072                 return false;
00073         }
00074         float getFormLength() const
00075         {
00076                 return m_formLength;
00077         }
00078         float getFormWidth() const
00079         {
00080                 return m_formWidth;
00081         }
00082         libwps::FormOrientation getFormOrientation() const
00083         {
00084                 return m_formOrientation;
00085         }
00086         float getMarginLeft() const
00087         {
00088                 return m_marginLeft;
00089         }
00090         float getMarginRight() const
00091         {
00092                 return m_marginRight;
00093         }
00094         float getMarginTop() const
00095         {
00096                 return m_marginTop;
00097         }
00098         float getMarginBottom() const
00099         {
00100                 return m_marginBottom;
00101         }
00102         int getPageSpan() const
00103         {
00104                 return m_pageSpan;
00105         }
00106         const std::vector<WPSHeaderFooter> & getHeaderFooterList() const
00107         {
00108                 return m_headerFooterList;
00109         }
00110 
00111         void setHeadFooterSuppression(const uint8_t headerFooterType, const bool suppress)
00112         {
00113                 m_isHeaderFooterSuppressed[headerFooterType] = suppress;
00114         }
00115         void setFormLength(const float formLength)
00116         {
00117                 m_formLength = formLength;
00118         }
00119         void setFormWidth(const float formWidth)
00120         {
00121                 m_formWidth = formWidth;
00122         }
00123         void setFormOrientation(const libwps::FormOrientation formOrientation)
00124         {
00125                 m_formOrientation = formOrientation;
00126         }
00127         void setMarginLeft(const float marginLeft)
00128         {
00129                 m_marginLeft = marginLeft;
00130         }
00131         void setMarginRight(const float marginRight)
00132         {
00133                 m_marginRight = marginRight;
00134         }
00135         void setMarginTop(const float marginTop)
00136         {
00137                 m_marginTop = marginTop;
00138         }
00139         void setMarginBottom(const float marginBottom)
00140         {
00141                 m_marginBottom = marginBottom;
00142         }
00143         void setPageSpan(const int pageSpan)
00144         {
00145                 m_pageSpan = pageSpan;
00146         }
00147 
00148         void makeConsistent(int startingPageNumber);
00149 
00150 protected:
00151         void _removeHeaderFooter(libwps::HeaderFooterType type, libwps::HeaderFooterOccurence occurence);
00152 
00153 private:
00154         bool m_isHeaderFooterSuppressed[NUM_HEADER_FOOTER_TYPES];
00155         float m_formLength, m_formWidth;
00156         libwps::FormOrientation m_formOrientation;
00157         float m_marginLeft, m_marginRight;
00158         float m_marginTop, m_marginBottom;
00159         std::vector<WPSHeaderFooter> m_headerFooterList;
00160 
00161         int m_pageSpan;
00162 };
00163 
00164 bool operator==(const WPSPageSpan &, const WPSPageSpan &);
00165 #endif /* WPSPAGE_H */
00166 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */