WPXPageSpan.h Source File documentation

WPXPageSpan.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* libwpd
3 * Version: MPL 2.0 / LGPLv2.1+
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * Major Contributor(s):
10 * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
11 * Copyright (C) 2002 Marc Maurer (uwog@uwog.net)
12 * Copyright (C) 2006 Fridrich Strba (fridrich.strba@bluewin.ch)
13 *
14 * For minor contributions see the git repository.
15 *
16 * Alternatively, the contents of this file may be used under the terms
17 * of the GNU Lesser General Public License Version 2.1 or later
18 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
19 * applicable instead of those above.
20 *
21 * For further information visit http://libwpd.sourceforge.net
22 */
23
24 /* "This product is not manufactured, approved, or supported by
25 * Corel Corporation or Corel Corporation Limited."
26 */
27
28 #ifndef WPXPAGE_H
29 #define WPXPAGE_H
30
31 #include <memory>
32 #include <vector>
33
34 #include "WPXFileStructure.h"
35 #include "WPXHeaderFooter.h"
36 #include "WPXSubDocument.h"
37 #include "WPXTable.h"
38 #include "libwpd_internal.h"
39
40 // intermediate page representation class: for internal use only (by the high-level content/styles listeners). should not be exported.
41
42 class WPXPageSpan
43 {
44 public:
45 WPXPageSpan();
46 WPXPageSpan(const WPXPageSpan &page, double paragraphMarginLeft, double paragraphMarginRight);
47 virtual ~WPXPageSpan();
48
49 bool getPageNumberSuppression() const
50 {
51 return m_isPageNumberSuppressed;
52 }
53 bool getHeaderFooterSuppression(const unsigned char headerFooterType) const
54 {
55 if (headerFooterType <= WPX_FOOTER_B) return m_isHeaderFooterSuppressed[headerFooterType];
56 return false;
57 }
58 double getFormLength() const
59 {
60 return m_formLength;
61 }
62 double getFormWidth() const
63 {
64 return m_formWidth;
65 }
66 WPXFormOrientation getFormOrientation() const
67 {
68 return m_formOrientation;
69 }
70 double getMarginLeft() const
71 {
72 return m_marginLeft;
73 }
74 double getMarginRight() const
75 {
76 return m_marginRight;
77 }
78 double getMarginTop() const
79 {
80 return m_marginTop;
81 }
82 double getMarginBottom() const
83 {
84 return m_marginBottom;
85 }
86 WPXPageNumberPosition getPageNumberPosition() const
87 {
88 return m_pageNumberPosition;
89 }
90 bool getPageNumberOverriden() const
91 {
92 return m_isPageNumberOverridden;
93 }
94 int getPageNumberOverride() const
95 {
96 return m_pageNumberOverride;
97 }
98 WPXNumberingType getPageNumberingType() const
99 {
100 return m_pageNumberingType;
101 }
102 double getPageNumberingFontSize() const
103 {
104 return m_pageNumberingFontSize;
105 }
106 librevenge::RVNGString getPageNumberingFontName() const
107 {
108 return m_pageNumberingFontName;
109 }
110 int getPageSpan() const
111 {
112 return m_pageSpan;
113 }
114 const std::vector<WPXHeaderFooter> &getHeaderFooterList() const
115 {
116 return m_headerFooterList;
117 }
118
119 void setHeaderFooter(const WPXHeaderFooterType type, const unsigned char headerFooterType, const WPXHeaderFooterOccurrence occurrence,
120 const std::shared_ptr<WPXSubDocument> &subDocument, WPXTableList tableList);
121 void setPageNumberSuppression(const bool suppress)
122 {
123 m_isPageNumberSuppressed = suppress;
124 }
125 void setHeadFooterSuppression(const unsigned char headerFooterType, const bool suppress)
126 {
127 m_isHeaderFooterSuppressed[headerFooterType] = suppress;
128 }
129 void setFormLength(const double formLength)
130 {
131 m_formLength = formLength;
132 }
133 void setFormWidth(const double formWidth)
134 {
135 m_formWidth = formWidth;
136 }
137 void setFormOrientation(const WPXFormOrientation formOrientation)
138 {
139 m_formOrientation = formOrientation;
140 }
141 void setMarginLeft(const double marginLeft)
142 {
143 m_marginLeft = marginLeft;
144 }
145 void setMarginRight(const double marginRight)
146 {
147 m_marginRight = marginRight;
148 }
149 void setMarginTop(const double marginTop)
150 {
151 m_marginTop = marginTop;
152 }
153 void setMarginBottom(const double marginBottom)
154 {
155 m_marginBottom = marginBottom;
156 }
157 void setPageNumberPosition(const WPXPageNumberPosition pageNumberPosition)
158 {
159 m_pageNumberPosition = pageNumberPosition;
160 }
161 void setPageNumber(const int pageNumberOverride)
162 {
163 m_pageNumberOverride = pageNumberOverride;
164 m_isPageNumberOverridden = true;
165 }
166 void setPageNumberingType(const WPXNumberingType pageNumberingType)
167 {
168 m_pageNumberingType = pageNumberingType;
169 }
170 void setPageNumberingFontSize(const double pageNumberingFontSize)
171 {
172 m_pageNumberingFontSize = pageNumberingFontSize;
173 }
174 void setPageNumberingFontName(const librevenge::RVNGString &pageNumberingFontName)
175 {
176 m_pageNumberingFontName = pageNumberingFontName;
177 }
178 void setPageSpan(const int pageSpan)
179 {
180 m_pageSpan = pageSpan;
181 }
182
183 protected:
184 void _removeHeaderFooter(WPXHeaderFooterType type, WPXHeaderFooterOccurrence occurrence);
185 bool _containsHeaderFooter(WPXHeaderFooterType type, WPXHeaderFooterOccurrence occurrence);
186
187 private:
188 bool m_isHeaderFooterSuppressed[WPX_NUM_HEADER_FOOTER_TYPES];
189 bool m_isPageNumberSuppressed;
190 double m_formLength, m_formWidth;
191 WPXFormOrientation m_formOrientation;
192 double m_marginLeft, m_marginRight;
193 double m_marginTop, m_marginBottom;
194 WPXPageNumberPosition m_pageNumberPosition;
195 bool m_isPageNumberOverridden;
196 int m_pageNumberOverride;
197 WPXNumberingType m_pageNumberingType;
198 librevenge::RVNGString m_pageNumberingFontName;
199 double m_pageNumberingFontSize;
200 std::vector<WPXHeaderFooter> m_headerFooterList;
201
202 int m_pageSpan;
203 };
204
205 bool operator==(const WPXPageSpan &, const WPXPageSpan &);
206 #endif /* WPXPAGE_H */
207 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WPXPageSpan::setPageNumberSuppression
void setPageNumberSuppression(const bool suppress)
Definition: WPXPageSpan.h:121
WPXSubDocument.h
WPXPageSpan.h
PAGENUMBER_POSITION_NONE
@ PAGENUMBER_POSITION_NONE
Definition: libwpd_internal.h:97
WPX_NUM_HEADER_FOOTER_TYPES
#define WPX_NUM_HEADER_FOOTER_TYPES
Definition: WPXFileStructure.h:41
WPXPageSpan::setMarginBottom
void setMarginBottom(const double marginBottom)
Definition: WPXPageSpan.h:153
WPX_DEFAULT_PAGE_MARGIN_BOTTOM
const double WPX_DEFAULT_PAGE_MARGIN_BOTTOM
Definition: WPXPageSpan.cpp:32
WPXPageSpan::setPageSpan
void setPageSpan(const int pageSpan)
Definition: WPXPageSpan.h:178
DUMMY_INTERNAL_HEADER_FOOTER
const unsigned char DUMMY_INTERNAL_HEADER_FOOTER
Definition: WPXPageSpan.cpp:34
WPXPageSpan::getPageNumberOverride
int getPageNumberOverride() const
Definition: WPXPageSpan.h:94
NEVER
@ NEVER
Definition: libwpd_internal.h:96
WPXPageSpan::WPXPageSpan
WPXPageSpan()
Definition: WPXPageSpan.cpp:36
WPXPageSpan::m_marginTop
double m_marginTop
Definition: WPXPageSpan.h:193
WPXPageSpan::m_marginBottom
double m_marginBottom
Definition: WPXPageSpan.h:193
WPXPageNumberPosition
WPXPageNumberPosition
Definition: libwpd_internal.h:97
WPXPageSpan::getPageNumberOverriden
bool getPageNumberOverriden() const
Definition: WPXPageSpan.h:90
WPXPageSpan::_removeHeaderFooter
void _removeHeaderFooter(WPXHeaderFooterType type, WPXHeaderFooterOccurrence occurrence)
Definition: WPXPageSpan.cpp:132
WPXFormOrientation
WPXFormOrientation
Definition: libwpd_internal.h:105
WPXPageSpan::m_pageSpan
int m_pageSpan
Definition: WPXPageSpan.h:202
WPXTable.h
WPXPageSpan::setPageNumberPosition
void setPageNumberPosition(const WPXPageNumberPosition pageNumberPosition)
Definition: WPXPageSpan.h:157
WPXPageSpan::m_pageNumberOverride
int m_pageNumberOverride
Definition: WPXPageSpan.h:196
WPD_DEBUG_MSG
#define WPD_DEBUG_MSG(M)
Definition: libwpd_internal.h:50
WPXPageSpan::getPageNumberingFontName
librevenge::RVNGString getPageNumberingFontName() const
Definition: WPXPageSpan.h:106
WPXHeaderFooter::getType
WPXHeaderFooterType getType() const
Definition: WPXHeaderFooter.h:44
WPXHeaderFooter::getSubDocument
const std::shared_ptr< WPXSubDocument > & getSubDocument() const
Definition: WPXHeaderFooter.h:56
WPXPageSpan::getPageSpan
int getPageSpan() const
Definition: WPXPageSpan.h:110
WPXPageSpan::m_formWidth
double m_formWidth
Definition: WPXPageSpan.h:190
operator==
bool operator==(const WPXHeaderFooter &headerFooter1, const WPXHeaderFooter &headerFooter2)
Definition: WPXPageSpan.cpp:156
WPXPageSpan::setMarginRight
void setMarginRight(const double marginRight)
Definition: WPXPageSpan.h:145
WPXPageSpan::m_headerFooterList
std::vector< WPXHeaderFooter > m_headerFooterList
Definition: WPXPageSpan.h:200
WPXHeaderFooter::getInternalType
unsigned char getInternalType() const
Definition: WPXHeaderFooter.h:52
WPXPageSpan::m_pageNumberingType
WPXNumberingType m_pageNumberingType
Definition: WPXPageSpan.h:197
WPXPageSpan::setPageNumberingFontName
void setPageNumberingFontName(const librevenge::RVNGString &pageNumberingFontName)
Definition: WPXPageSpan.h:174
libwpd_internal.h
WPXPageSpan::setHeaderFooter
void setHeaderFooter(const WPXHeaderFooterType type, const unsigned char headerFooterType, const WPXHeaderFooterOccurrence occurrence, const std::shared_ptr< WPXSubDocument > &subDocument, WPXTableList tableList)
Definition: WPXPageSpan.cpp:87
ALL
@ ALL
Definition: libwpd_internal.h:96
WPXPageSpan::getMarginRight
double getMarginRight() const
Definition: WPXPageSpan.h:74
WPXPageSpan::setMarginLeft
void setMarginLeft(const double marginLeft)
Definition: WPXPageSpan.h:141
WPXPageSpan::setPageNumberingFontSize
void setPageNumberingFontSize(const double pageNumberingFontSize)
Definition: WPXPageSpan.h:170
PORTRAIT
@ PORTRAIT
Definition: libwpd_internal.h:105
operator==
bool operator==(const WPXPageSpan &, const WPXPageSpan &)
Definition: WPXPageSpan.cpp:164
WPXPageSpan::m_isHeaderFooterSuppressed
bool m_isHeaderFooterSuppressed[WPX_NUM_HEADER_FOOTER_TYPES]
Definition: WPXPageSpan.h:188
WPXPageSpan::m_marginLeft
double m_marginLeft
Definition: WPXPageSpan.h:192
ARABIC
@ ARABIC
Definition: libwpd_internal.h:92
WPXPageSpan::getPageNumberingType
WPXNumberingType getPageNumberingType() const
Definition: WPXPageSpan.h:98
WPXPageSpan::getPageNumberSuppression
bool getPageNumberSuppression() const
Definition: WPXPageSpan.h:49
WPXPageSpan::setFormWidth
void setFormWidth(const double formWidth)
Definition: WPXPageSpan.h:133
WPXPageSpan::getMarginBottom
double getMarginBottom() const
Definition: WPXPageSpan.h:82
WPXPageSpan::getPageNumberingFontSize
double getPageNumberingFontSize() const
Definition: WPXPageSpan.h:102
WPX_FOOTER_B
#define WPX_FOOTER_B
Definition: WPXFileStructure.h:45
EVEN
@ EVEN
Definition: libwpd_internal.h:96
WPXTableList
Definition: WPXTableList.h:36
WPXPageSpan::m_isPageNumberOverridden
bool m_isPageNumberOverridden
Definition: WPXPageSpan.h:195
WPXPageSpan::m_pageNumberingFontSize
double m_pageNumberingFontSize
Definition: WPXPageSpan.h:199
WPXHeaderFooter.h
WPXHeaderFooter::getOccurrence
WPXHeaderFooterOccurrence getOccurrence() const
Definition: WPXHeaderFooter.h:48
WPXPageSpan::getPageNumberPosition
WPXPageNumberPosition getPageNumberPosition() const
Definition: WPXPageSpan.h:86
WPXPageSpan::setMarginTop
void setMarginTop(const double marginTop)
Definition: WPXPageSpan.h:149
WPXPageSpan
Definition: WPXPageSpan.h:43
WPXPageSpan::_containsHeaderFooter
bool _containsHeaderFooter(WPXHeaderFooterType type, WPXHeaderFooterOccurrence occurrence)
Definition: WPXPageSpan.cpp:145
WPXPageSpan::m_formLength
double m_formLength
Definition: WPXPageSpan.h:190
WPXPageSpan::m_isPageNumberSuppressed
bool m_isPageNumberSuppressed
Definition: WPXPageSpan.h:189
WPXPageSpan::getFormLength
double getFormLength() const
Definition: WPXPageSpan.h:58
WPXPageSpan::getHeaderFooterList
const std::vector< WPXHeaderFooter > & getHeaderFooterList() const
Definition: WPXPageSpan.h:114
ODD
@ ODD
Definition: libwpd_internal.h:96
WPXFileStructure.h
WPXPageSpan::m_pageNumberingFontName
librevenge::RVNGString m_pageNumberingFontName
Definition: WPXPageSpan.h:198
WPXPageSpan::setFormLength
void setFormLength(const double formLength)
Definition: WPXPageSpan.h:129
WPXNumberingType
WPXNumberingType
Definition: libwpd_internal.h:92
WPXPageSpan::m_formOrientation
WPXFormOrientation m_formOrientation
Definition: WPXPageSpan.h:191
WPXPageSpan::setPageNumberingType
void setPageNumberingType(const WPXNumberingType pageNumberingType)
Definition: WPXPageSpan.h:166
WPXPageSpan::getFormWidth
double getFormWidth() const
Definition: WPXPageSpan.h:62
WPXPageSpan::getHeaderFooterSuppression
bool getHeaderFooterSuppression(const unsigned char headerFooterType) const
Definition: WPXPageSpan.h:53
WPXPageSpan::getFormOrientation
WPXFormOrientation getFormOrientation() const
Definition: WPXPageSpan.h:66
WPXPageSpan::~WPXPageSpan
virtual ~WPXPageSpan()
Definition: WPXPageSpan.cpp:82
WPX_DEFAULT_PAGE_MARGIN_TOP
const double WPX_DEFAULT_PAGE_MARGIN_TOP
Definition: WPXPageSpan.cpp:31
WPXHeaderFooterOccurrence
WPXHeaderFooterOccurrence
Definition: libwpd_internal.h:96
WPXPageSpan::m_marginRight
double m_marginRight
Definition: WPXPageSpan.h:192
WPXPageSpan::m_pageNumberPosition
WPXPageNumberPosition m_pageNumberPosition
Definition: WPXPageSpan.h:194
WPXPageSpan::getMarginLeft
double getMarginLeft() const
Definition: WPXPageSpan.h:70
WPXHeaderFooter
Definition: WPXHeaderFooter.h:38
WPXPageSpan::setPageNumber
void setPageNumber(const int pageNumberOverride)
Definition: WPXPageSpan.h:161
WPXPageSpan::setFormOrientation
void setFormOrientation(const WPXFormOrientation formOrientation)
Definition: WPXPageSpan.h:137
WPXPageSpan::getMarginTop
double getMarginTop() const
Definition: WPXPageSpan.h:78
WPXHeaderFooterType
WPXHeaderFooterType
Definition: libwpd_internal.h:94
WPXPageSpan::setHeadFooterSuppression
void setHeadFooterSuppression(const unsigned char headerFooterType, const bool suppress)
Definition: WPXPageSpan.h:125