- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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 #include "WPXFileStructure.h"
31 #include <vector>
32 #include "WPXTable.h"
33 #include "libwpd_internal.h"
34 #include "WPXSubDocument.h"
35
36 // intermediate page representation class: for internal use only (by the high-level content/styles listeners). should not be exported.
37
38 class WPXHeaderFooter
39 {
40 public:
41 WPXHeaderFooter(const WPXHeaderFooterType headerFooterType, const WPXHeaderFooterOccurrence occurrence,
42 const unsigned char internalType, const WPXSubDocument *subDocument, WPXTableList tableList);
43 WPXHeaderFooter(const WPXHeaderFooterType headerFooterType, const WPXHeaderFooterOccurrence occurrence,
44 const unsigned char internalType, const WPXSubDocument *subDocument);
45 WPXHeaderFooter(const WPXHeaderFooter &headerFooter);
46 ~WPXHeaderFooter();
47 WPXHeaderFooter &operator=(const WPXHeaderFooter &headerFooter);
48 WPXHeaderFooterType getType() const
49 {
50 return m_type;
51 }
52 WPXHeaderFooterOccurrence getOccurrence() const
53 {
54 return m_occurrence;
55 }
56 unsigned char getInternalType() const
57 {
58 return m_internalType;
59 }
60 const WPXSubDocument *getSubDocument() const
61 {
62 return m_subDocument;
63 }
64 WPXTableList getTableList() const
65 {
66 return m_tableList;
67 }
68
69 private:
70 WPXHeaderFooterType m_type;
71 WPXHeaderFooterOccurrence m_occurrence;
72 unsigned char m_internalType; // for suppression
73 const WPXSubDocument *m_subDocument; // for the actual text
74 WPXTableList m_tableList;
75 };
76
77 class WPXPageSpan
78 {
79 public:
80 WPXPageSpan();
81 WPXPageSpan(const WPXPageSpan &page, double paragraphMarginLeft, double paragraphMarginRight);
82 virtual ~WPXPageSpan();
83
84 bool getPageNumberSuppression() const
85 {
86 return m_isPageNumberSuppressed;
87 }
88 bool getHeaderFooterSuppression(const unsigned char headerFooterType) const
89 {
90 if (headerFooterType <= WPX_FOOTER_B) return m_isHeaderFooterSuppressed[headerFooterType];
91 return false;
92 }
93 double getFormLength() const
94 {
95 return m_formLength;
96 }
97 double getFormWidth() const
98 {
99 return m_formWidth;
100 }
101 WPXFormOrientation getFormOrientation() const
102 {
103 return m_formOrientation;
104 }
105 double getMarginLeft() const
106 {
107 return m_marginLeft;
108 }
109 double getMarginRight() const
110 {
111 return m_marginRight;
112 }
113 double getMarginTop() const
114 {
115 return m_marginTop;
116 }
117 double getMarginBottom() const
118 {
119 return m_marginBottom;
120 }
121 WPXPageNumberPosition getPageNumberPosition() const
122 {
123 return m_pageNumberPosition;
124 }
125 bool getPageNumberOverriden() const
126 {
127 return m_isPageNumberOverridden;
128 }
129 int getPageNumberOverride() const
130 {
131 return m_pageNumberOverride;
132 }
133 WPXNumberingType getPageNumberingType() const
134 {
135 return m_pageNumberingType;
136 }
137 double getPageNumberingFontSize() const
138 {
139 return m_pageNumberingFontSize;
140 }
141 librevenge::RVNGString getPageNumberingFontName() const
142 {
143 return m_pageNumberingFontName;
144 }
145 int getPageSpan() const
146 {
147 return m_pageSpan;
148 }
149 const std::vector<WPXHeaderFooter> &getHeaderFooterList() const
150 {
151 return m_headerFooterList;
152 }
153
154 void setHeaderFooter(const WPXHeaderFooterType type, const unsigned char headerFooterType, const WPXHeaderFooterOccurrence occurrence,
155 const WPXSubDocument *subDocument, WPXTableList tableList);
156 void setPageNumberSuppression(const bool suppress)
157 {
158 m_isPageNumberSuppressed = suppress;
159 }
160 void setHeadFooterSuppression(const unsigned char headerFooterType, const bool suppress)
161 {
162 m_isHeaderFooterSuppressed[headerFooterType] = suppress;
163 }
164 void setFormLength(const double formLength)
165 {
166 m_formLength = formLength;
167 }
168 void setFormWidth(const double formWidth)
169 {
170 m_formWidth = formWidth;
171 }
172 void setFormOrientation(const WPXFormOrientation formOrientation)
173 {
174 m_formOrientation = formOrientation;
175 }
176 void setMarginLeft(const double marginLeft)
177 {
178 m_marginLeft = marginLeft;
179 }
180 void setMarginRight(const double marginRight)
181 {
182 m_marginRight = marginRight;
183 }
184 void setMarginTop(const double marginTop)
185 {
186 m_marginTop = marginTop;
187 }
188 void setMarginBottom(const double marginBottom)
189 {
190 m_marginBottom = marginBottom;
191 }
192 void setPageNumberPosition(const WPXPageNumberPosition pageNumberPosition)
193 {
194 m_pageNumberPosition = pageNumberPosition;
195 }
196 void setPageNumber(const int pageNumberOverride)
197 {
198 m_pageNumberOverride = pageNumberOverride;
199 m_isPageNumberOverridden = true;
200 }
201 void setPageNumberingType(const WPXNumberingType pageNumberingType)
202 {
203 m_pageNumberingType = pageNumberingType;
204 }
205 void setPageNumberingFontSize(const double pageNumberingFontSize)
206 {
207 m_pageNumberingFontSize = pageNumberingFontSize;
208 }
209 void setPageNumberingFontName(const librevenge::RVNGString &pageNumberingFontName)
210 {
211 m_pageNumberingFontName = pageNumberingFontName;
212 }
213 void setPageSpan(const int pageSpan)
214 {
215 m_pageSpan = pageSpan;
216 }
217
218 protected:
219 void _removeHeaderFooter(WPXHeaderFooterType type, WPXHeaderFooterOccurrence occurrence);
220 bool _containsHeaderFooter(WPXHeaderFooterType type, WPXHeaderFooterOccurrence occurrence);
221
222 private:
223 bool m_isHeaderFooterSuppressed[WPX_NUM_HEADER_FOOTER_TYPES];
224 bool m_isPageNumberSuppressed;
225 double m_formLength, m_formWidth;
226 WPXFormOrientation m_formOrientation;
227 double m_marginLeft, m_marginRight;
228 double m_marginTop, m_marginBottom;
229 WPXPageNumberPosition m_pageNumberPosition;
230 bool m_isPageNumberOverridden;
231 int m_pageNumberOverride;
232 WPXNumberingType m_pageNumberingType;
233 librevenge::RVNGString m_pageNumberingFontName;
234 double m_pageNumberingFontSize;
235 std::vector<WPXHeaderFooter> m_headerFooterList;
236
237 int m_pageSpan;
238 };
239
240 bool operator==(const WPXPageSpan &, const WPXPageSpan &);
241 #endif /* WPXPAGE_H */
242 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WPXNumberingType
WPXNumberingType
Definition: libwpd_internal.h:92
WPXPageSpan::setPageNumberSuppression
void setPageNumberSuppression(const bool suppress)
Definition: WPXPageSpan.h:156
WPXPageSpan::setFormOrientation
void setFormOrientation(const WPXFormOrientation formOrientation)
Definition: WPXPageSpan.h:172
WPXPageSpan::setPageSpan
void setPageSpan(const int pageSpan)
Definition: WPXPageSpan.h:213
WPXHeaderFooter::m_occurrence
WPXHeaderFooterOccurrence m_occurrence
Definition: WPXPageSpan.h:71
WPXPageSpan::setPageNumberingType
void setPageNumberingType(const WPXNumberingType pageNumberingType)
Definition: WPXPageSpan.h:201
WPXPageSpan::setPageNumberPosition
void setPageNumberPosition(const WPXPageNumberPosition pageNumberPosition)
Definition: WPXPageSpan.h:192
WPXPageSpan::m_headerFooterList
std::vector< WPXHeaderFooter > m_headerFooterList
Definition: WPXPageSpan.h:235
WPXPageSpan::m_pageNumberPosition
WPXPageNumberPosition m_pageNumberPosition
Definition: WPXPageSpan.h:229
WPXPageSpan::m_marginRight
double m_marginRight
Definition: WPXPageSpan.h:227
WPXPageSpan::getMarginLeft
double getMarginLeft() const
Definition: WPXPageSpan.h:105
operator==
bool operator==(const WPXPageSpan &, const WPXPageSpan &)
Definition: WPXPageSpan.cpp:214
WPXPageSpan::WPXPageSpan
WPXPageSpan()
Definition: WPXPageSpan.cpp:86
WPXPageSpan::setHeaderFooter
void setHeaderFooter(const WPXHeaderFooterType type, const unsigned char headerFooterType, const WPXHeaderFooterOccurrence occurrence, const WPXSubDocument *subDocument, WPXTableList tableList)
Definition: WPXPageSpan.cpp:137
WPXHeaderFooter::WPXHeaderFooter
WPXHeaderFooter(const WPXHeaderFooterType headerFooterType, const WPXHeaderFooterOccurrence occurrence, const unsigned char internalType, const WPXSubDocument *subDocument, WPXTableList tableList)
Definition: WPXPageSpan.cpp:39
WPXTable.h
WPXPageSpan::_removeHeaderFooter
void _removeHeaderFooter(WPXHeaderFooterType type, WPXHeaderFooterOccurrence occurrence)
Definition: WPXPageSpan.cpp:182
WPXPageSpan::setPageNumber
void setPageNumber(const int pageNumberOverride)
Definition: WPXPageSpan.h:196
WPXPageSpan::m_pageNumberOverride
int m_pageNumberOverride
Definition: WPXPageSpan.h:231
WPXHeaderFooter::getSubDocument
const WPXSubDocument * getSubDocument() const
Definition: WPXPageSpan.h:60
WPXPageSpan::getFormWidth
double getFormWidth() const
Definition: WPXPageSpan.h:97
WPXPageSpan::m_formWidth
double m_formWidth
Definition: WPXPageSpan.h:225
WPXSubDocument.h
WPXPageSpan::m_pageSpan
int m_pageSpan
Definition: WPXPageSpan.h:237
WPXHeaderFooterOccurrence
WPXHeaderFooterOccurrence
Definition: libwpd_internal.h:96
WPXPageSpan::setPageNumberingFontName
void setPageNumberingFontName(const librevenge::RVNGString &pageNumberingFontName)
Definition: WPXPageSpan.h:209
WPXPageSpan::getMarginRight
double getMarginRight() const
Definition: WPXPageSpan.h:109
WPXHeaderFooter::m_internalType
unsigned char m_internalType
Definition: WPXPageSpan.h:72
libwpd_internal.h
WPXPageSpan::getFormOrientation
WPXFormOrientation getFormOrientation() const
Definition: WPXPageSpan.h:101
WPXPageSpan::getPageNumberingFontName
librevenge::RVNGString getPageNumberingFontName() const
Definition: WPXPageSpan.h:141
WPXPageSpan::getPageNumberOverride
int getPageNumberOverride() const
Definition: WPXPageSpan.h:129
WPXTableList
Definition: WPXTable.h:81
WPXPageSpan::setFormWidth
void setFormWidth(const double formWidth)
Definition: WPXPageSpan.h:168
WPXPageSpan::setMarginRight
void setMarginRight(const double marginRight)
Definition: WPXPageSpan.h:180
WPXHeaderFooter::getType
WPXHeaderFooterType getType() const
Definition: WPXPageSpan.h:48
WPXHeaderFooter::~WPXHeaderFooter
~WPXHeaderFooter()
Definition: WPXPageSpan.cpp:81
WPXPageSpan::setPageNumberingFontSize
void setPageNumberingFontSize(const double pageNumberingFontSize)
Definition: WPXPageSpan.h:205
WPXPageSpan::setMarginLeft
void setMarginLeft(const double marginLeft)
Definition: WPXPageSpan.h:176
WPXHeaderFooter::getOccurrence
WPXHeaderFooterOccurrence getOccurrence() const
Definition: WPXPageSpan.h:52
WPXPageSpan::getFormLength
double getFormLength() const
Definition: WPXPageSpan.h:93
WPXPageSpan::m_pageNumberingType
WPXNumberingType m_pageNumberingType
Definition: WPXPageSpan.h:232
WPXPageSpan::getHeaderFooterSuppression
bool getHeaderFooterSuppression(const unsigned char headerFooterType) const
Definition: WPXPageSpan.h:88
WPXHeaderFooter::m_tableList
WPXTableList m_tableList
Definition: WPXPageSpan.h:74
WPXFormOrientation
WPXFormOrientation
Definition: libwpd_internal.h:105
WPXPageSpan::m_pageNumberingFontSize
double m_pageNumberingFontSize
Definition: WPXPageSpan.h:234
WPXSubDocument
Definition: WPXSubDocument.h:34
WPXPageSpan::m_isHeaderFooterSuppressed
bool m_isHeaderFooterSuppressed[WPX_NUM_HEADER_FOOTER_TYPES]
Definition: WPXPageSpan.h:223
WPXPageSpan::getMarginTop
double getMarginTop() const
Definition: WPXPageSpan.h:113
WPXHeaderFooter::m_subDocument
const WPXSubDocument * m_subDocument
Definition: WPXPageSpan.h:73
WPXPageSpan::m_marginLeft
double m_marginLeft
Definition: WPXPageSpan.h:227
WPXPageSpan::setFormLength
void setFormLength(const double formLength)
Definition: WPXPageSpan.h:164
WPXPageSpan::getHeaderFooterList
const std::vector< WPXHeaderFooter > & getHeaderFooterList() const
Definition: WPXPageSpan.h:149
WPXPageSpan::getPageNumberPosition
WPXPageNumberPosition getPageNumberPosition() const
Definition: WPXPageSpan.h:121
WPXPageSpan::~WPXPageSpan
virtual ~WPXPageSpan()
Definition: WPXPageSpan.cpp:132
WPXPageSpan::m_pageNumberingFontName
librevenge::RVNGString m_pageNumberingFontName
Definition: WPXPageSpan.h:233
WPXPageSpan::m_isPageNumberOverridden
bool m_isPageNumberOverridden
Definition: WPXPageSpan.h:230
WPXPageSpan::getPageNumberingType
WPXNumberingType getPageNumberingType() const
Definition: WPXPageSpan.h:133
WPXPageSpan
Definition: WPXPageSpan.h:77
WPXHeaderFooter::getInternalType
unsigned char getInternalType() const
Definition: WPXPageSpan.h:56
WPXPageSpan::m_isPageNumberSuppressed
bool m_isPageNumberSuppressed
Definition: WPXPageSpan.h:224
WPXPageSpan::getMarginBottom
double getMarginBottom() const
Definition: WPXPageSpan.h:117
WPXPageNumberPosition
WPXPageNumberPosition
Definition: libwpd_internal.h:97
WPXPageSpan::getPageNumberSuppression
bool getPageNumberSuppression() const
Definition: WPXPageSpan.h:84
WPXHeaderFooter::getTableList
WPXTableList getTableList() const
Definition: WPXPageSpan.h:64
WPXPageSpan::m_formOrientation
WPXFormOrientation m_formOrientation
Definition: WPXPageSpan.h:226
WPXPageSpan::setMarginTop
void setMarginTop(const double marginTop)
Definition: WPXPageSpan.h:184
WPXPageSpan::m_formLength
double m_formLength
Definition: WPXPageSpan.h:225
WPX_FOOTER_B
#define WPX_FOOTER_B
Definition: WPXFileStructure.h:45
WPXPageSpan::setMarginBottom
void setMarginBottom(const double marginBottom)
Definition: WPXPageSpan.h:188
WPXFileStructure.h
WPXPageSpan::setHeadFooterSuppression
void setHeadFooterSuppression(const unsigned char headerFooterType, const bool suppress)
Definition: WPXPageSpan.h:160
WPXHeaderFooter::operator=
WPXHeaderFooter & operator=(const WPXHeaderFooter &headerFooter)
Definition: WPXPageSpan.cpp:68
WPXHeaderFooter
Definition: WPXPageSpan.h:38
WPXPageSpan::_containsHeaderFooter
bool _containsHeaderFooter(WPXHeaderFooterType type, WPXHeaderFooterOccurrence occurrence)
Definition: WPXPageSpan.cpp:195
WPXPageSpan::getPageNumberingFontSize
double getPageNumberingFontSize() const
Definition: WPXPageSpan.h:137
WPXHeaderFooterType
WPXHeaderFooterType
Definition: libwpd_internal.h:94
WPXPageSpan::m_marginBottom
double m_marginBottom
Definition: WPXPageSpan.h:228
WPXPageSpan::getPageSpan
int getPageSpan() const
Definition: WPXPageSpan.h:145
WPXPageSpan::m_marginTop
double m_marginTop
Definition: WPXPageSpan.h:228
WPXHeaderFooter::m_type
WPXHeaderFooterType m_type
Definition: WPXPageSpan.h:70
WPXPageSpan::getPageNumberOverriden
bool getPageNumberOverriden() const
Definition: WPXPageSpan.h:125
WPX_NUM_HEADER_FOOTER_TYPES
#define WPX_NUM_HEADER_FOOTER_TYPES
Definition: WPXFileStructure.h:41