libwpd: WPXPageSpan.h Source File documentation

Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

# 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 (j.m.maurer@student.utwente.nl)
    00004  *
    00005  * This library is free software; you can redistribute it and/or
    00006  * modify it under the terms of the GNU Library General Public
    00007  * License as published by the Free Software Foundation; either
    00008  * version 2 of the License, or (at your option) any later version.
    00009  *
    00010  * This library is distributed in the hope that it will be useful,
    00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013  * Library General Public License for more details.
    00014  *
    00015  * You should have received a copy of the GNU Library General Public
    00016  * License along with this library; if not, write to the Free Software
    00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
    00018  *
    00019  * For further information visit http://libwpd.sourceforge.net
    00020  */
    00021
    00022 /* "This product is not manufactured, approved, or supported by
    00023  * Corel Corporation or Corel Corporation Limited."
    00024  */
    00025
    00026 #ifndef WPXPAGE_H
    00027 #define WPXPAGE_H
    00028 #include "libwpd.h"
    00029 #include "WP6FileStructure.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(WPXPageSpan &page, float paragraphMarginLeft=0.0f, float paragraphMarginRight=0.0f);
    00065         virtual ~WPXPageSpan();
    00066
    00067         const bool getHeaderFooterSuppression(const uint8_t headerFooterType) const { if (headerFooterType <= WP6_HEADER_FOOTER_GROUP_FOOTER_B) return m_isHeaderFooterSuppressed[headerFooterType]; return false; }
    00068         const float getFormLength() const { return m_formLength; }
    00069         const float getFormWidth() const { return m_formWidth; }
    00070         const WPXFormOrientation getFormOrientation() const { return m_formOrientation; }
    00071         const float getMarginLeft() const { return m_marginLeft; }
    00072         const float getMarginRight() const { return m_marginRight; }
    00073         const float getMarginTop() const { return m_marginTop; }
    00074         const float getMarginBottom() const { return m_marginBottom; }
    00075         const int getPageSpan() const { return m_pageSpan; }
    00076         const std::vector<WPXHeaderFooter> & getHeaderFooterList() const { return m_headerFooterList; }
    00077
    00078         void setHeaderFooter(const uint8_t headerFooterType, const uint8_t occurenceBits,
    00079                              const WPXSubDocument * subDocument, WPXTableList tableList);
    00080         void setHeadFooterSuppression(const uint8_t headerFooterType, const bool suppress) { m_isHeaderFooterSuppressed[headerFooterType] = suppress; }
    00081         void setFormLength(const float formLength) { m_formLength = formLength; }
    00082         void setFormWidth(const float formWidth) { m_formWidth = formWidth; }
    00083         void setFormOrientation(const WPXFormOrientation formOrientation) { m_formOrientation = formOrientation; }
    00084         void setMarginLeft(const float marginLeft) { m_marginLeft = marginLeft; }
    00085         void setMarginRight(const float marginRight) { m_marginRight = marginRight; }
    00086         void setMarginTop(const float marginTop) { m_marginTop = marginTop; }
    00087         void setMarginBottom(const float marginBottom) { m_marginBottom = marginBottom; }
    00088         void setPageSpan(const int pageSpan) { m_pageSpan = pageSpan; }
    00089
    00090         void makeConsistent(int startingPageNumber);
    00091 protected:
    00092         void _removeHeaderFooter(WPXHeaderFooterType type, WPXHeaderFooterOccurence occurence);
    00093         bool _containsHeaderFooter(WPXHeaderFooterType type, WPXHeaderFooterOccurence occurence);
    00094
    00095 private:
    00096         bool m_isHeaderFooterSuppressed[WP6_NUM_HEADER_FOOTER_TYPES];
    00097         float m_formLength, m_formWidth;
    00098         WPXFormOrientation m_formOrientation;
    00099         float m_marginLeft, m_marginRight;
    00100         float m_marginTop, m_marginBottom;
    00101         std::vector<WPXHeaderFooter> m_headerFooterList;
    00102
    00103         int m_pageSpan;
    00104 };
    00105
    00106 bool operator==(const WPXPageSpan &, const WPXPageSpan &);
    00107 #endif /* WPXPAGE_H */