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         const WPXHeaderFooterType getType() const { return m_type; }
00047         const WPXHeaderFooterOccurence getOccurence() const { return m_occurence; }
00048         const uint8_t getInternalType() const { return m_internalType; }
00049         const WPXSubDocument * getSubDocument() const { return m_subDocument; }
00050         WPXTableList getTableList() const { return m_tableList; }
00051 
00052 private:
00053         WPXHeaderFooterType m_type;
00054         WPXHeaderFooterOccurence m_occurence;
00055         uint8_t m_internalType; // for suppression
00056         const WPXSubDocument * m_subDocument; // for the actual text
00057         WPXTableList m_tableList;
00058 };
00059 
00060 class WPXPageSpan
00061 {
00062 public:
00063         WPXPageSpan();
00064         WPXPageSpan(const WPXPageSpan &page, float paragraphMarginLeft, float paragraphMarginRight);
00065         WPXPageSpan(const WPXPageSpan &page);
00066         virtual ~WPXPageSpan();
00067 
00068         const bool getHeaderFooterSuppression(const uint8_t headerFooterType) const { if (headerFooterType <= WPX_FOOTER_B) return m_isHeaderFooterSuppressed[headerFooterType]; return false; }
00069         const float getFormLength() const { return m_formLength; }
00070         const float getFormWidth() const { return m_formWidth; }
00071         const WPXFormOrientation getFormOrientation() const { return m_formOrientation; }
00072         const float getMarginLeft() const { return m_marginLeft; }
00073         const float getMarginRight() const { return m_marginRight; }
00074         const float getMarginTop() const { return m_marginTop; }
00075         const float getMarginBottom() const { return m_marginBottom; }
00076         const int getPageSpan() const { return m_pageSpan; }
00077         const std::vector<WPXHeaderFooter> & getHeaderFooterList() const { return m_headerFooterList; }
00078 
00079         void setHeaderFooter(const WPXHeaderFooterType type, const uint8_t headerFooterType, const WPXHeaderFooterOccurence occurence, 
00080                              const WPXSubDocument * subDocument, WPXTableList tableList);
00081         void setHeadFooterSuppression(const uint8_t headerFooterType, const bool suppress) { m_isHeaderFooterSuppressed[headerFooterType] = suppress; }
00082         void setFormLength(const float formLength) { m_formLength = formLength; }
00083         void setFormWidth(const float formWidth) { m_formWidth = formWidth; }
00084         void setFormOrientation(const WPXFormOrientation formOrientation) { m_formOrientation = formOrientation; }
00085         void setMarginLeft(const float marginLeft) { m_marginLeft = marginLeft; }
00086         void setMarginRight(const float marginRight) { m_marginRight = marginRight; }
00087         void setMarginTop(const float marginTop) { m_marginTop = marginTop; }
00088         void setMarginBottom(const float marginBottom) { m_marginBottom = marginBottom; }
00089         void setPageSpan(const int pageSpan) { m_pageSpan = pageSpan; }
00090         
00091         void makeConsistent(int startingPageNumber);
00092         
00093 protected:
00094         void _removeHeaderFooter(WPXHeaderFooterType type, WPXHeaderFooterOccurence occurence);
00095         bool _containsHeaderFooter(WPXHeaderFooterType type, WPXHeaderFooterOccurence occurence);
00096 
00097 private:
00098         bool m_isHeaderFooterSuppressed[WPX_NUM_HEADER_FOOTER_TYPES];
00099         float m_formLength, m_formWidth;
00100         WPXFormOrientation m_formOrientation;
00101         float m_marginLeft, m_marginRight;
00102         float m_marginTop, m_marginBottom;
00103         std::vector<WPXHeaderFooter> m_headerFooterList;
00104 
00105         int m_pageSpan;
00106 };
00107 
00108 bool operator==(const WPXPageSpan &, const WPXPageSpan &);
00109 #endif /* WPXPAGE_H */

Generated on Fri Mar 16 15:37:13 2007 for libwpd by doxygen 1.5.1