- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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