| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 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: |
| 50 |
|
| 51 |
WPSPageSpan(); |
| 52 |
WPSPageSpan(WPSPageSpan const &)=default; |
| 53 |
WPSPageSpan(WPSPageSpan &&)=default; |
| 54 |
WPSPageSpan &operator=(WPSPageSpan const &)=default; |
| 55 |
WPSPageSpan &operator=(WPSPageSpan &&)=default; |
| 56 |
|
| 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 |
|
| 178 |
void getPageProperty(librevenge::RVNGPropertyList &pList) const; |
| 179 |
void sendHeaderFooters(WPSContentListener *listener, librevenge::RVNGTextInterface *documentInterface); |
| 180 |
void sendHeaderFooters(WKSContentListener *listener, librevenge::RVNGSpreadsheetInterface *documentInterface); |
| 181 |
|
| 182 |
protected: |
| 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); |
| 190 |
private: |
| 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 |
|