WPXPageSpan.h

Go to the documentation of this file.
00001 /* libwpd
00002  * Copyright (C) 2002 William Lachance (william.lachance@sympatico.ca)
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 "libwpd.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         const WPXHeaderFooterType getType() const { return m_type; }
00048         const WPXHeaderFooterOccurence getOccurence() const { return m_occurence; }
00049         const 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, float paragraphMarginLeft, float paragraphMarginRight);
00066         WPXPageSpan(const WPXPageSpan &page);
00067         virtual ~WPXPageSpan();
00068 
00069         const bool getHeaderFooterSuppression(const uint8_t headerFooterType) const { if (headerFooterType <= WPX_FOOTER_B) return m_isHeaderFooterSuppressed[headerFooterType]; return false; }
00070         const float getFormLength() const { return m_formLength; }
00071         const float getFormWidth() const { return m_formWidth; }
00072         const WPXFormOrientation getFormOrientation() const { return m_formOrientation; }
00073         const float getMarginLeft() const { return m_marginLeft; }
00074         const float getMarginRight() const { return m_marginRight; }
00075         const float getMarginTop() const { return m_marginTop; }
00076         const float getMarginBottom() const { return m_marginBottom; }
00077         const int getPageSpan() const { return m_pageSpan; }
00078         const std::vector<WPXHeaderFooter> & getHeaderFooterList() const { return m_headerFooterList; }
00079 
00080         void setHeaderFooter(const WPXHeaderFooterType type, const uint8_t headerFooterType, const WPXHeaderFooterOccurence occurence, 
00081                              const WPXSubDocument * subDocument, WPXTableList tableList);
00082         void setHeadFooterSuppression(const uint8_t headerFooterType, const bool suppress) { m_isHeaderFooterSuppressed[headerFooterType] = suppress; }
00083         void setFormLength(const float formLength) { m_formLength = formLength; }
00084         void setFormWidth(const float formWidth) { m_formWidth = formWidth; }
00085         void setFormOrientation(const WPXFormOrientation formOrientation) { m_formOrientation = formOrientation; }
00086         void setMarginLeft(const float marginLeft) { m_marginLeft = marginLeft; }
00087         void setMarginRight(const float marginRight) { m_marginRight = marginRight; }
00088         void setMarginTop(const float marginTop) { m_marginTop = marginTop; }
00089         void setMarginBottom(const float marginBottom) { m_marginBottom = marginBottom; }
00090         void setPageSpan(const int pageSpan) { m_pageSpan = pageSpan; }
00091         
00092         void makeConsistent(int startingPageNumber);
00093         
00094 protected:
00095         void _removeHeaderFooter(WPXHeaderFooterType type, WPXHeaderFooterOccurence occurence);
00096         bool _containsHeaderFooter(WPXHeaderFooterType type, WPXHeaderFooterOccurence occurence);
00097 
00098 private:
00099         bool m_isHeaderFooterSuppressed[WPX_NUM_HEADER_FOOTER_TYPES];
00100         float m_formLength, m_formWidth;
00101         WPXFormOrientation m_formOrientation;
00102         float m_marginLeft, m_marginRight;
00103         float m_marginTop, m_marginBottom;
00104         std::vector<WPXHeaderFooter> m_headerFooterList;
00105 
00106         int m_pageSpan;
00107 };
00108 
00109 bool operator==(const WPXPageSpan &, const WPXPageSpan &);
00110 #endif /* WPXPAGE_H */

Generated on Wed Jul 26 19:23:24 2006 for libwpd by doxygen 1.4.7