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