WPSPageSpan.h Source File documentation

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