WPSPageSpan.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* libwps
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 (william.lachance@sympatico.ca)
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://libwps.sourceforge.net
22 */
23
24 #ifndef WPSPAGESPAN_H
25 #define WPSPAGESPAN_H
26 #include <vector>
27 #include "libwps_internal.h"
28
29 class WKSContentListener;
30 class WPSContentListener;
31
32 namespace WPSPageSpanInternal
33 {
34 class HeaderFooter;
35 typedef std::shared_ptr<HeaderFooter> HeaderFooterPtr;
36 }
37
38 class WPSPageSpan
39 {
40 public:
41 enum FormOrientation { PORTRAIT, LANDSCAPE };
42
43 enum HeaderFooterType { HEADER, FOOTER };
44 enum HeaderFooterOccurrence { ODD, EVEN, ALL, FIRST, NEVER };
45
46 enum PageNumberPosition { None = 0, TopLeft, TopCenter, TopRight, TopLeftAndRight, TopInsideLeftAndRight,
47 BottomLeft, BottomCenter, BottomRight, BottomLeftAndRight, BottomInsideLeftAndRight
48 };
49 public:
51 WPSPageSpan();
52 WPSPageSpan(WPSPageSpan const &)=default;
53 WPSPageSpan &operator=(WPSPageSpan const &)=default;
55 ~WPSPageSpan();
56
57 double getFormLength() const
58 {
59 return m_formLength;
60 }
61 double getFormWidth() const
62 {
63 return m_formWidth;
64 }
65 FormOrientation getFormOrientation() const
66 {
67 return m_formOrientation;
68 }
69 double getMarginLeft() const
70 {
71 return m_marginLeft;
72 }
73 double getMarginRight() const
74 {
75 return m_marginRight;
76 }
77 double getMarginTop() const
78 {
79 return m_marginTop;
80 }
81 double getMarginBottom() const
82 {
83 return m_marginBottom;
84 }
85 PageNumberPosition getPageNumberPosition() const
86 {
87 return m_pageNumberPosition;
88 }
89 int getPageNumber() const
90 {
91 return m_pageNumber;
92 }
93 libwps::NumberingType getPageNumberingType() const
94 {
95 return m_pageNumberingType;
96 }
97 double getPageNumberingFontSize() const
98 {
99 return m_pageNumberingFontSize;
100 }
101 librevenge::RVNGString getPageNumberingFontName() const
102 {
103 return m_pageNumberingFontName;
104 }
105 int getPageSpan() const
106 {
107 return m_pageSpan;
108 }
109 const std::vector<WPSPageSpanInternal::HeaderFooterPtr> &getHeaderFooterList() const
110 {
111 return m_headerFooterList;
112 }
113
114 void setHeaderFooter(const HeaderFooterType type, const HeaderFooterOccurrence occurrence,
115 WPSSubDocumentPtr &subDocument);
116 void setFormLength(const double formLength)
117 {
118 m_formLength = formLength;
119 }
120 void setFormWidth(const double formWidth)
121 {
122 m_formWidth = formWidth;
123 }
124 void setFormOrientation(const FormOrientation formOrientation)
125 {
126 m_formOrientation = formOrientation;
127 }
128 void setMarginLeft(const double marginLeft)
129 {
130 m_marginLeft = marginLeft;
131 }
132 void setMarginRight(const double marginRight)
133 {
134 m_marginRight = marginRight;
135 }
136 void setMarginTop(const double marginTop)
137 {
138 m_marginTop = marginTop;
139 }
140 void setMarginBottom(const double marginBottom)
141 {
142 m_marginBottom = marginBottom;
143 }
144 void setPageNumberPosition(const PageNumberPosition pageNumberPosition)
145 {
146 m_pageNumberPosition = pageNumberPosition;
147 }
148 void setPageNumber(const int pageNumber)
149 {
150 m_pageNumber = pageNumber;
151 }
152 void setPageNumberingType(const libwps::NumberingType pageNumberingType)
153 {
154 m_pageNumberingType = pageNumberingType;
155 }
156 void setPageNumberingFontSize(const double pageNumberingFontSize)
157 {
158 m_pageNumberingFontSize = pageNumberingFontSize;
159 }
160 void setPageNumberingFontName(const librevenge::RVNGString &pageNumberingFontName)
161 {
162 m_pageNumberingFontName = pageNumberingFontName;
163 }
164 void setPageSpan(const int pageSpan)
165 {
166 m_pageSpan = pageSpan;
167 }
168
169 bool operator==(std::shared_ptr<WPSPageSpan> const &pageSpan) const;
170 bool operator!=(std::shared_ptr<WPSPageSpan> const &pageSpan) const
171 {
172 return !operator==(pageSpan);
173 }
174
175 // interface with the listeners
176 void getPageProperty(librevenge::RVNGPropertyList &pList) const;
177 void sendHeaderFooters(WPSContentListener *listener, librevenge::RVNGTextInterface *documentInterface);
178 void sendHeaderFooters(WKSContentListener *listener, librevenge::RVNGSpreadsheetInterface *documentInterface);
179
180 protected:
181
182 int _getHeaderFooterPosition(HeaderFooterType type, HeaderFooterOccurrence occurrence);
183 void _setHeaderFooter(HeaderFooterType type, HeaderFooterOccurrence occurrence, WPSSubDocumentPtr &doc);
184 void _removeHeaderFooter(HeaderFooterType type, HeaderFooterOccurrence occurrence);
185 bool _containsHeaderFooter(HeaderFooterType type, HeaderFooterOccurrence occurrence);
186
187 void _insertPageNumberParagraph(librevenge::RVNGTextInterface *documentInterface);
188 private:
189 double m_formLength, m_formWidth;
190 FormOrientation m_formOrientation;
191 double m_marginLeft, m_marginRight;
192 double m_marginTop, m_marginBottom;
193 PageNumberPosition m_pageNumberPosition;
194 int m_pageNumber;
195 libwps::NumberingType m_pageNumberingType;
196 librevenge::RVNGString m_pageNumberingFontName;
197 double m_pageNumberingFontSize;
198 std::vector<WPSPageSpanInternal::HeaderFooterPtr> m_headerFooterList;
199
200 int m_pageSpan;
201 };
202
203 #endif
204 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WPSPageSpan::~WPSPageSpan
~WPSPageSpan()
destructor
Definition: WPSPageSpan.cpp:107
WPSPageSpan::operator!=
bool operator!=(std::shared_ptr< WPSPageSpan > const &pageSpan) const
Definition: WPSPageSpan.h:170
WPSPageSpan::m_formLength
double m_formLength
Definition: WPSPageSpan.h:189
WPSPageSpan::getPageNumber
int getPageNumber() const
Definition: WPSPageSpan.h:89
WPSPageSpan::getPageNumberingType
libwps::NumberingType getPageNumberingType() const
Definition: WPSPageSpan.h:93
WPSPageSpan::BottomLeft
Definition: WPSPageSpan.h:47
WPSPageSpan::TopLeft
Definition: WPSPageSpan.h:46
WPSPageSpan::getMarginLeft
double getMarginLeft() const
Definition: WPSPageSpan.h:69
WPSPageSpan::setMarginRight
void setMarginRight(const double marginRight)
Definition: WPSPageSpan.h:132
WPSPageSpan::PORTRAIT
Definition: WPSPageSpan.h:41
WPSPageSpan::WPSPageSpan
WPSPageSpan()
constructor
Definition: WPSPageSpan.cpp:89
WPSPageSpan::PageNumberPosition
PageNumberPosition
Definition: WPSPageSpan.h:46
WPSPageSpan::m_pageNumber
int m_pageNumber
Definition: WPSPageSpan.h:194
WPSPageSpan::m_pageNumberingFontSize
double m_pageNumberingFontSize
Definition: WPSPageSpan.h:197
WPSPageSpan::NEVER
Definition: WPSPageSpan.h:44
WPSPageSpan::FOOTER
Definition: WPSPageSpan.h:43
WPSSubDocumentPtr
std::shared_ptr< WPSSubDocument > WPSSubDocumentPtr
shared pointer to WPSSubDocument
Definition: libwps_internal.h:111
WPSContentListener
Definition: WPSContentListener.h:44
WPSPageSpan::None
Definition: WPSPageSpan.h:46
WPSPageSpan::setPageNumberingFontSize
void setPageNumberingFontSize(const double pageNumberingFontSize)
Definition: WPSPageSpan.h:156
WPSPageSpan::getPageNumberingFontSize
double getPageNumberingFontSize() const
Definition: WPSPageSpan.h:97
WPSPageSpan::setPageNumberingType
void setPageNumberingType(const libwps::NumberingType pageNumberingType)
Definition: WPSPageSpan.h:152
WPSPageSpan::getHeaderFooterList
const std::vector< WPSPageSpanInternal::HeaderFooterPtr > & getHeaderFooterList() const
Definition: WPSPageSpan.h:109
WPSPageSpan::setFormWidth
void setFormWidth(const double formWidth)
Definition: WPSPageSpan.h:120
WPSPageSpan::HEADER
Definition: WPSPageSpan.h:43
WPSPageSpan::setPageNumberPosition
void setPageNumberPosition(const PageNumberPosition pageNumberPosition)
Definition: WPSPageSpan.h:144
libwps_internal.h
WPSPageSpan::m_headerFooterList
std::vector< WPSPageSpanInternal::HeaderFooterPtr > m_headerFooterList
Definition: WPSPageSpan.h:198
WPSPageSpan::getPageProperty
void getPageProperty(librevenge::RVNGPropertyList &pList) const
Definition: WPSPageSpan.cpp:282
WPSPageSpanInternal::HeaderFooter
Definition: WPSPageSpan.cpp:36
WPSPageSpan::getFormWidth
double getFormWidth() const
Definition: WPSPageSpan.h:61
WPSPageSpan::ALL
Definition: WPSPageSpan.h:44
WPSPageSpan::BottomRight
Definition: WPSPageSpan.h:47
WPSPageSpan::m_marginLeft
double m_marginLeft
Definition: WPSPageSpan.h:191
WPSPageSpan::setHeaderFooter
void setHeaderFooter(const HeaderFooterType type, const HeaderFooterOccurrence occurrence, WPSSubDocumentPtr &subDocument)
Definition: WPSPageSpan.cpp:111
WPSPageSpan::setPageNumber
void setPageNumber(const int pageNumber)
Definition: WPSPageSpan.h:148
WPSPageSpan::FormOrientation
FormOrientation
Definition: WPSPageSpan.h:41
WPSPageSpan::m_pageNumberPosition
PageNumberPosition m_pageNumberPosition
Definition: WPSPageSpan.h:193
WPSPageSpan::setMarginBottom
void setMarginBottom(const double marginBottom)
Definition: WPSPageSpan.h:140
WPSPageSpan::m_pageNumberingFontName
librevenge::RVNGString m_pageNumberingFontName
Definition: WPSPageSpan.h:196
WPSPageSpan::_getHeaderFooterPosition
int _getHeaderFooterPosition(HeaderFooterType type, HeaderFooterOccurrence occurrence)
Definition: WPSPageSpan.cpp:431
WPSPageSpan::setMarginTop
void setMarginTop(const double marginTop)
Definition: WPSPageSpan.h:136
WPSPageSpan::FIRST
Definition: WPSPageSpan.h:44
WPSPageSpan::getMarginRight
double getMarginRight() const
Definition: WPSPageSpan.h:73
WPSPageSpan::m_pageSpan
int m_pageSpan
Definition: WPSPageSpan.h:200
WPSPageSpan::_containsHeaderFooter
bool _containsHeaderFooter(HeaderFooterType type, HeaderFooterOccurrence occurrence)
Definition: WPSPageSpan.cpp:423
WPSPageSpan::BottomLeftAndRight
Definition: WPSPageSpan.h:47
libwps::NumberingType
NumberingType
Definition: libwps_internal.h:246
WPSPageSpan::HeaderFooterOccurrence
HeaderFooterOccurrence
Definition: WPSPageSpan.h:44
WPSPageSpan::setFormOrientation
void setFormOrientation(const FormOrientation formOrientation)
Definition: WPSPageSpan.h:124
WPSPageSpanInternal::HeaderFooterPtr
std::shared_ptr< HeaderFooter > HeaderFooterPtr
Definition: WPSPageSpan.h:34
WPSPageSpan::setPageNumberingFontName
void setPageNumberingFontName(const librevenge::RVNGString &pageNumberingFontName)
Definition: WPSPageSpan.h:160
WPSPageSpan::BottomCenter
Definition: WPSPageSpan.h:47
WPSPageSpan::operator=
WPSPageSpan & operator=(WPSPageSpan const &)=default
WPSPageSpan::getMarginBottom
double getMarginBottom() const
Definition: WPSPageSpan.h:81
WPSPageSpan::HeaderFooterType
HeaderFooterType
Definition: WPSPageSpan.h:43
WPSPageSpan::TopCenter
Definition: WPSPageSpan.h:46
WPSPageSpan::EVEN
Definition: WPSPageSpan.h:44
WPSPageSpan::m_marginRight
double m_marginRight
Definition: WPSPageSpan.h:191
WPSPageSpan::TopInsideLeftAndRight
Definition: WPSPageSpan.h:46
WPSPageSpan::TopLeftAndRight
Definition: WPSPageSpan.h:46
WPSPageSpan::getPageSpan
int getPageSpan() const
Definition: WPSPageSpan.h:105
WPSPageSpan::getMarginTop
double getMarginTop() const
Definition: WPSPageSpan.h:77
WPSPageSpan::_insertPageNumberParagraph
void _insertPageNumberParagraph(librevenge::RVNGTextInterface *documentInterface)
Definition: WPSPageSpan.cpp:358
WPSPageSpan::setMarginLeft
void setMarginLeft(const double marginLeft)
Definition: WPSPageSpan.h:128
WPSPageSpan::setFormLength
void setFormLength(const double formLength)
Definition: WPSPageSpan.h:116
WPSPageSpan::getPageNumberingFontName
librevenge::RVNGString getPageNumberingFontName() const
Definition: WPSPageSpan.h:101
WPSPageSpan
Definition: WPSPageSpan.h:38
WPSPageSpan::getPageNumberPosition
PageNumberPosition getPageNumberPosition() const
Definition: WPSPageSpan.h:85
WPSPageSpan::TopRight
Definition: WPSPageSpan.h:46
WPSPageSpan::_setHeaderFooter
void _setHeaderFooter(HeaderFooterType type, HeaderFooterOccurrence occurrence, WPSSubDocumentPtr &doc)
Definition: WPSPageSpan.cpp:407
WPSPageSpan::getFormOrientation
FormOrientation getFormOrientation() const
Definition: WPSPageSpan.h:65
WPSPageSpan::operator==
bool operator==(std::shared_ptr< WPSPageSpan > const &pageSpan) const
Definition: WPSPageSpan.cpp:299
WPSPageSpan::sendHeaderFooters
void sendHeaderFooters(WPSContentListener *listener, librevenge::RVNGTextInterface *documentInterface)
Definition: WPSPageSpan.cpp:155
WPSPageSpan::m_formWidth
double m_formWidth
Definition: WPSPageSpan.h:189
WPSPageSpan::m_marginTop
double m_marginTop
Definition: WPSPageSpan.h:192
WPSPageSpan::LANDSCAPE
Definition: WPSPageSpan.h:41
WPSPageSpan::BottomInsideLeftAndRight
Definition: WPSPageSpan.h:47
WPSPageSpan::_removeHeaderFooter
void _removeHeaderFooter(HeaderFooterType type, HeaderFooterOccurrence occurrence)
Definition: WPSPageSpan.cpp:416
WPSPageSpanInternal
Definition: WPSPageSpan.cpp:33
WPSPageSpan::m_formOrientation
FormOrientation m_formOrientation
Definition: WPSPageSpan.h:190
WKSContentListener
Definition: WKSContentListener.h:53
WPSPageSpan::m_marginBottom
double m_marginBottom
Definition: WPSPageSpan.h:192
WPSPageSpan::getFormLength
double getFormLength() const
Definition: WPSPageSpan.h:57
WPSPageSpan::m_pageNumberingType
libwps::NumberingType m_pageNumberingType
Definition: WPSPageSpan.h:195
WPSPageSpan::ODD
Definition: WPSPageSpan.h:44
WPSPageSpan::setPageSpan
void setPageSpan(const int pageSpan)
Definition: WPSPageSpan.h:164