Foxit PDF SDK

fs_headerfooter.h
Go to the documentation of this file.
1
15 #ifndef FS_HEADERFOOTER_H_
16 #define FS_HEADERFOOTER_H_
17
18 #include "common/fs_common.h"
19
25 namespace foxit {
29 namespace pdf {
35 class PageNumberRange FS_FINAL : public Object {
36 public:
45 explicit PageNumberRange(int32 start_number, int32 end_number, foxit::common::Range::Filter filter)
46 : start_number(start_number)
47 , end_number(end_number)
48 , filter(filter) {}
49
51 PageNumberRange()
52 : start_number(-1)
53 , end_number(-1)
54 , filter(foxit::common::Range::e_All) {}
55
61 PageNumberRange(const PageNumberRange& page_range)
62 : start_number(page_range.start_number)
63 , end_number(page_range.end_number)
64 , filter(page_range.filter) {}
65
73 PageNumberRange& operator=(const PageNumberRange& page_range) {
74 start_number = page_range.start_number;
75 end_number = page_range.end_number;
76 filter = page_range.filter;
77 return *this;
78 }
79
90 void Set(int32 start_number, int32 end_number, foxit::common::Range::Filter filter) {
91 this->start_number = start_number;
92 this->end_number = end_number;
93 this->filter = filter;
94 }
95
97 int32 start_number;
99 int32 end_number;
104 foxit::common::Range::Filter filter;
105 };
106
113 class HeaderFooterContent FS_FINAL : public Object {
114 public:
125 explicit HeaderFooterContent(const WString& header_left_content, const WString& header_center_content,
126 const WString& header_right_content, const WString& footer_left_content,
127 const WString& footer_center_content, const WString& footer_right_content)
128 : header_left_content(header_left_content)
129 , header_center_content(header_center_content)
130 , header_right_content(header_right_content)
131 , footer_left_content(footer_left_content)
132 , footer_center_content(footer_center_content)
133 , footer_right_content(footer_right_content) {}
134
136 HeaderFooterContent() {}
137
143 HeaderFooterContent(const HeaderFooterContent& other)
144 : header_left_content(other.header_left_content)
145 , header_center_content(other.header_center_content)
146 , header_right_content(other.header_right_content)
147 , footer_left_content(other.footer_left_content)
148 , footer_center_content(other.footer_center_content)
149 , footer_right_content(other.footer_right_content) {}
150
158 HeaderFooterContent& operator=(const HeaderFooterContent& other) {
159 header_left_content = other.header_left_content;
160 header_center_content = other.header_center_content;
161 header_right_content = other.header_right_content;
162 footer_left_content = other.footer_left_content;
163 footer_center_content = other.footer_center_content;
164 footer_right_content = other.footer_right_content;
165 return *this;
166 }
167
180 void Set(const WString& header_left_content, const WString& header_center_content,
181 const WString& header_right_content, const WString& footer_left_content,
182 const WString& footer_center_content, const WString& footer_right_content) {
183 this->header_left_content = header_left_content;
184 this->header_center_content = header_center_content;
185 this->header_right_content = header_right_content;
186 this->footer_left_content = footer_left_content;
187 this->footer_center_content = footer_center_content;
188 this->footer_right_content = footer_right_content;
189 }
190
192 WString header_left_content;
194 WString header_center_content;
196 WString header_right_content;
198 WString footer_left_content;
200 WString footer_center_content;
202 WString footer_right_content;
203 };
204
206 class HeaderFooter FS_FINAL : public Object {
207 public:
229 explicit HeaderFooter(const common::Font& font, float text_size, RGB text_color, const PageNumberRange& page_range, RectF page_margin,
230 bool has_text_shrinked, bool has_fixedsize_for_print, int start_page_number,
231 const HeaderFooterContent& content, bool is_to_embed_font, bool is_underline)
232 : font(font)
233 , text_size(text_size)
234 , text_color(text_color)
235 , page_range(page_range)
236 , page_margin(page_margin)
237 , has_text_shrinked(has_text_shrinked)
238 , has_fixedsize_for_print(has_fixedsize_for_print)
239 , start_page_number(start_page_number)
240 , content(content)
241 , is_to_embed_font(is_to_embed_font)
242 , is_underline(is_underline)
243 , is_replace_font(true) {}
244
246 HeaderFooter()
247 : text_size(0)
248 , text_color(0)
249 , has_text_shrinked(false)
250 , has_fixedsize_for_print(false)
251 , start_page_number(0)
252 , is_to_embed_font(false)
253 , is_underline(false)
254 , is_replace_font(true) {
255 page_margin = RectF(72.0, 36.0, 72.0, 36.0);
256 }
257
263 HeaderFooter(const HeaderFooter& other)
264 : font(other.font)
265 , text_size(other.text_size)
266 , text_color(other.text_color)
267 , page_range(other.page_range)
268 , page_margin(other.page_margin)
269 , has_text_shrinked(other.has_text_shrinked)
270 , has_fixedsize_for_print(other.has_fixedsize_for_print)
271 , start_page_number(other.start_page_number)
272 , content(other.content)
273 , is_to_embed_font(other.is_to_embed_font)
274 , is_underline(other.is_underline)
275 , is_replace_font(other.is_replace_font) {}
276
284 HeaderFooter& operator=(const HeaderFooter& other) {
285 font = other.font;
286 text_size = other.text_size;
287 text_color = other.text_color;
288 page_range = other.page_range;
289 page_margin = other.page_margin;
290 has_text_shrinked = other.has_text_shrinked;
291 has_fixedsize_for_print = other.has_fixedsize_for_print;
292 start_page_number = other.start_page_number;
293 content = other.content;
294 is_to_embed_font = other.is_to_embed_font;
295 is_underline = other.is_underline;
296 is_replace_font = other.is_replace_font;
297 return *this;
298 }
299
323 void Set(const common::Font& font, float text_size, RGB text_color, const PageNumberRange& page_range, RectF page_margin,
324 bool has_text_shrinked, bool has_fixedsize_for_print, int start_page_number,
325 const HeaderFooterContent& content, bool is_to_embed_font, bool is_underline) {
326 this->font = font;
327 this->text_size = text_size;
328 this->text_color = text_color;
329 this->page_range = page_range;
330 this->page_margin = page_margin;
331 this->has_text_shrinked = has_text_shrinked;
332 this->has_fixedsize_for_print = has_fixedsize_for_print;
333 this->start_page_number = start_page_number;
334 this->content = content;
335 this->is_to_embed_font = is_to_embed_font;
336 this->is_underline = is_underline;
337 this->is_replace_font = true;
338 }
339
347 common::Font font;
348
350 float text_size;
351
353 RGB text_color;
354
361 PageNumberRange page_range;
362
379 RectF page_margin;
380
382 bool has_text_shrinked;
383
385 bool has_fixedsize_for_print;
386
394 int start_page_number;
395
397 HeaderFooterContent content;
398
400 bool is_to_embed_font;
401
403 bool is_underline;
404
406 bool is_replace_font;
407 };
408
413 class HeaderFooterContentGenerator FS_FINAL : public Base {
414 public:
420 typedef enum _DateFormatType {
422 e_DateFormatMSlashD = 0,
424 e_DateFormatMSlashDSlashYY = 1,
426 e_DateFormatMSlashDSlashYYYY = 2,
428 e_DateFormatMMSlashDDSlashYY = 3,
430 e_DateFormatMMSlashDDSlashYYYY = 4,
432 e_DateFormatDSlashMSlashYY = 5,
434 e_DateFormatDSlashMSlashYYYY = 6,
436 e_DateFormatDDSlashMMSlashYY = 7,
438 e_DateFormatDDSlashMMSlashYYYY = 8,
440 e_DateFormatMMSlashYY = 9,
442 e_DateFormatMMSlashYYYY = 10,
444 e_DateFormatMDotDDotYY = 11,
446 e_DateFormatMDotDDotYYYY = 12,
448 e_DateFormatMMDotDDDotYY = 13,
450 e_DateFormatMMDotDDDotYYYY = 14,
452 e_DateFormatMMDotYY = 15,
454 e_DateFormatDDotMDotYYYY = 16,
456 e_DateFormatDDDotMMDotYY = 17,
458 e_DateFormatDDDotMMDotYYYY = 18,
460 e_DateFormatYYHyphenMMHyphenDD = 19,
462 e_DateFormatYYYYHyphenMMHyphenDD = 20
463 } DateFormatType;
464
470 typedef enum _PageNumberFormat {
472 e_PageNumberFormatDefault = 0,
474 e_PageNumberFormatNumberOfCount = 1,
476 e_PageNumberFormatNumberSlashCount = 2,
478 e_PageNumberFormatPageNumber = 3,
480 e_PageNumberFormatPageNumberOfCount = 4
481 } PageNumberFormat;
482
483
484 // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
485 explicit HeaderFooterContentGenerator(FS_HANDLE handle);
486
488 HeaderFooterContentGenerator();
489
491 ~HeaderFooterContentGenerator();
492
498 HeaderFooterContentGenerator(const HeaderFooterContentGenerator& other);
499
507 HeaderFooterContentGenerator& operator=(const HeaderFooterContentGenerator& other);
508
516 bool operator==(const HeaderFooterContentGenerator& other) const;
517
525 bool operator!=(const HeaderFooterContentGenerator& other) const;
526
534 bool IsEmpty() const;
535
549 void AddDate(DateFormatType format_type);
550
564 void AddPageNumber(PageNumberFormat format_type);
565
573 void AddString(const WString& new_string);
574
582 void Clear();
583
589 WString GenerateContent();
590 };
591 } // namespace pdf
592 } // namespace foxit
593
594 #endif // FS_HEADERFOOTER_H_
foxit::pdf::PageNumberRange::PageNumberRange
PageNumberRange()
Constructor.
Definition: fs_headerfooter.h:51
foxit::pdf::HeaderFooterContentGenerator::operator=
HeaderFooterContentGenerator & operator=(const HeaderFooterContentGenerator &other)
Assign operator.
foxit::pdf::HeaderFooterContentGenerator::e_DateFormatMDotDDotYYYY
If this is used, "m.d.yyyy" would be used as the date format string.
Definition: fs_headerfooter.h:446
foxit::pdf::HeaderFooterContentGenerator::e_DateFormatMMSlashYYYY
If this is used, "mm/yyyy" would be used as the date format string.
Definition: fs_headerfooter.h:442
foxit::Object
CFX_Object Object
Object type.
Definition: fs_basictypes.h:220
foxit::pdf::HeaderFooterContentGenerator::e_DateFormatYYHyphenMMHyphenDD
If this is used, "yy-mm-dd" would be used as the date format string.
Definition: fs_headerfooter.h:460
foxit::pdf::HeaderFooterContentGenerator::~HeaderFooterContentGenerator
~HeaderFooterContentGenerator()
Destructor.
foxit::pdf::HeaderFooterContentGenerator::e_DateFormatYYYYHyphenMMHyphenDD
If this is used, "yyyy-mm-dd" would be used as the date format string.
Definition: fs_headerfooter.h:462
foxit::pdf::PageNumberRange::PageNumberRange
PageNumberRange(int32 start_number, int32 end_number, foxit::common::Range::Filter filter)
Constructor, with parameters.
Definition: fs_headerfooter.h:45
foxit::pdf::HeaderFooterContentGenerator::e_DateFormatMMDotDDDotYYYY
If this is used, "mm.dd.yyyy" would be used as the date format string.
Definition: fs_headerfooter.h:450
foxit::pdf::HeaderFooterContentGenerator::e_DateFormatMSlashDSlashYY
If this is used, "m/d/yy" would be used as the date format string.
Definition: fs_headerfooter.h:424
foxit::pdf::HeaderFooterContentGenerator::e_DateFormatMMSlashYY
If this is used, "mm/yy" would be used as the date format string.
Definition: fs_headerfooter.h:440
foxit::RGB
uint32 RGB
RGB color type, 24 bits, ((b) | ((g) << 8) | ((r) << 16)))
Definition: fs_basictypes.h:211
foxit::common::Range::Filter
Filter
Enumeration for range filter.
Definition: fs_common.h:1375
foxit::pdf::HeaderFooterContentGenerator::GenerateContent
WString GenerateContent()
Generate a final string which can be used as header-footer content.
foxit::pdf::HeaderFooterContentGenerator::e_PageNumberFormatDefault
If this is used, "1" would be used as the page number format string.
Definition: fs_headerfooter.h:472
foxit::pdf::HeaderFooterContentGenerator::operator==
bool operator==(const HeaderFooterContentGenerator &other) const
Equal operator.
foxit::pdf::HeaderFooterContentGenerator::DateFormatType
DateFormatType
Enumeration for date format type.
Definition: fs_headerfooter.h:420
foxit::pdf::HeaderFooterContent::HeaderFooterContent
HeaderFooterContent(const HeaderFooterContent &other)
Constructor, with another header-footer content object.
Definition: fs_headerfooter.h:143
foxit::pdf::PageNumberRange::end_number
int32 end_number
Page number of the end page in current range, starting from 1.
Definition: fs_headerfooter.h:99
CFX_WideString
WIDE STRING CLASS.
Definition: fx_string.h:1461
foxit::pdf::HeaderFooterContent::header_right_content
WString header_right_content
Content for right header.
Definition: fs_headerfooter.h:196
foxit::pdf::HeaderFooterContentGenerator::e_DateFormatMMSlashDDSlashYY
If this is used, "mm/dd/yy" would be used as the date format string.
Definition: fs_headerfooter.h:428
foxit::pdf::HeaderFooterContentGenerator::e_DateFormatDDSlashMMSlashYY
If this is used, "dd/mm/yy" would be used as the date format string.
Definition: fs_headerfooter.h:436
foxit::pdf::HeaderFooterContent::operator=
HeaderFooterContent & operator=(const HeaderFooterContent &other)
Assign operator.
Definition: fs_headerfooter.h:158
foxit::pdf::HeaderFooterContent::Set
void Set(const WString &header_left_content, const WString &header_center_content, const WString &header_right_content, const WString &footer_left_content, const WString &footer_center_content, const WString &footer_right_content)
Set value.
Definition: fs_headerfooter.h:180
foxit::pdf::HeaderFooterContentGenerator::e_DateFormatDSlashMSlashYY
If this is used, "d/m/yy" would be used as the date format string.
Definition: fs_headerfooter.h:432
foxit::pdf::PageNumberRange::Set
void Set(int32 start_number, int32 end_number, foxit::common::Range::Filter filter)
Set value.
Definition: fs_headerfooter.h:90
foxit::pdf::HeaderFooterContentGenerator::e_DateFormatMMSlashDDSlashYYYY
If this is used, "mm/dd/yyyy" would be used as the date format string.
Definition: fs_headerfooter.h:430
foxit::pdf::HeaderFooterContentGenerator::e_DateFormatMSlashDSlashYYYY
If this is used, "m/d/yyyy" would be used as the date format string.
Definition: fs_headerfooter.h:426
foxit::pdf::HeaderFooterContent::HeaderFooterContent
HeaderFooterContent()
Constructor.
Definition: fs_headerfooter.h:136
foxit::pdf::HeaderFooterContentGenerator::e_DateFormatDDotMDotYYYY
If this is used, "d.m.yyyy" would be used as the date format string.
Definition: fs_headerfooter.h:454
foxit::pdf::HeaderFooterContent::header_center_content
WString header_center_content
Content for center header.
Definition: fs_headerfooter.h:194
foxit::pdf::HeaderFooterContent::footer_center_content
WString footer_center_content
Content for center footer.
Definition: fs_headerfooter.h:200
foxit::pdf::HeaderFooterContentGenerator::e_PageNumberFormatNumberOfCount
If this is used, "1 of n" would be used as the page number format string.
Definition: fs_headerfooter.h:474
foxit::pdf::PageNumberRange::start_number
int32 start_number
Page number of the start page in current range, starting from 1.
Definition: fs_headerfooter.h:97
foxit::pdf::HeaderFooterContentGenerator::AddDate
void AddDate(DateFormatType format_type)
Add a format string for a specified date format type.
foxit::RectF
CFX_FloatRect RectF
Rectangle, in float.
Definition: fs_basictypes.h:475
foxit::pdf::PageNumberRange
Definition: fs_headerfooter.h:35
foxit::pdf::HeaderFooterContent::header_left_content
WString header_left_content
Content for left header.
Definition: fs_headerfooter.h:192
foxit::pdf::PageNumberRange::PageNumberRange
PageNumberRange(const PageNumberRange &page_range)
Constructor, with another page number range object.
Definition: fs_headerfooter.h:61
foxit::pdf::HeaderFooterContentGenerator::e_DateFormatMSlashD
If this is used, "m/d" would be used as the date format string.
Definition: fs_headerfooter.h:422
foxit::pdf::HeaderFooterContentGenerator::e_PageNumberFormatNumberSlashCount
If this is used, "1/n" would be used as the page number format string.
Definition: fs_headerfooter.h:476
foxit::pdf::HeaderFooterContentGenerator::e_DateFormatDDDotMMDotYY
If this is used, "dd.mm.yy" would be used as the date format string.
Definition: fs_headerfooter.h:456
foxit::pdf::HeaderFooterContentGenerator::e_DateFormatMMDotYY
If this is used, "mm.yy" would be used as the date format string.
Definition: fs_headerfooter.h:452
foxit::FS_HANDLE
void * FS_HANDLE
Handle type.
Definition: fs_basictypes.h:213
fs_common.h
Header file for common definitions and classes.
foxit::pdf::HeaderFooterContent::footer_left_content
WString footer_left_content
Content for left footer.
Definition: fs_headerfooter.h:198
foxit::pdf::HeaderFooterContentGenerator::PageNumberFormat
PageNumberFormat
Enumeration for page number format type.
Definition: fs_headerfooter.h:470
foxit::pdf::HeaderFooterContentGenerator::e_PageNumberFormatPageNumberOfCount
If this is used, "Page 1 of n" would be used as the page number format string.
Definition: fs_headerfooter.h:480
foxit::pdf::HeaderFooterContentGenerator::AddString
void AddString(const WString &new_string)
Add a string.
foxit::pdf::HeaderFooterContentGenerator::e_DateFormatMMDotDDDotYY
If this is used, "mm.dd.yy" would be used as the date format string.
Definition: fs_headerfooter.h:448
foxit::int32
FX_INT32 int32
32-bit signed integer.
Definition: fs_basictypes.h:193
foxit::Base
Definition: fs_basictypes.h:451
foxit::pdf::HeaderFooterContent
Definition: fs_headerfooter.h:113
foxit::pdf::HeaderFooterContentGenerator::e_DateFormatDDSlashMMSlashYYYY
If this is used, "dd/mm/yyyy" would be used as the date format string.
Definition: fs_headerfooter.h:438
foxit::pdf::HeaderFooterContentGenerator::Clear
void Clear()
Clear strings (including format strings) which have been added to current content generator.
foxit::pdf::HeaderFooterContentGenerator::AddPageNumber
void AddPageNumber(PageNumberFormat format_type)
Add a format string for a specified page number format type.
foxit::pdf::HeaderFooterContent::footer_right_content
WString footer_right_content
Content for right footer.
Definition: fs_headerfooter.h:202
foxit::pdf::HeaderFooterContentGenerator::e_DateFormatDSlashMSlashYYYY
If this is used, "d/m/yyyy" would be used as the date format string.
Definition: fs_headerfooter.h:434
foxit::common::Font
Definition: fs_common.h:1523
foxit::pdf::HeaderFooterContentGenerator::e_PageNumberFormatPageNumber
If this is used, "Page 1" would be used as the page number format string.
Definition: fs_headerfooter.h:478
foxit
Foxit namespace.
Definition: fs_pdf3d.h:26
foxit::pdf::HeaderFooterContent::HeaderFooterContent
HeaderFooterContent(const WString &header_left_content, const WString &header_center_content, const WString &header_right_content, const WString &footer_left_content, const WString &footer_center_content, const WString &footer_right_content)
Constructor, with parameters.
Definition: fs_headerfooter.h:125
foxit::pdf::PageNumberRange::filter
foxit::common::Range::Filter filter
Filter type to decide which page numbers of this range would be used. Please refer to values starting...
Definition: fs_headerfooter.h:104
foxit::pdf::HeaderFooterContentGenerator::HeaderFooterContentGenerator
HeaderFooterContentGenerator()
Constructor.
foxit::pdf::HeaderFooterContentGenerator::e_DateFormatDDDotMMDotYYYY
If this is used, "dd.mm.yyyy" would be used as the date format string.
Definition: fs_headerfooter.h:458
foxit::pdf::HeaderFooterContentGenerator
Definition: fs_headerfooter.h:413
foxit::pdf::PageNumberRange::operator=
PageNumberRange & operator=(const PageNumberRange &page_range)
Assign operator.
Definition: fs_headerfooter.h:73
foxit::pdf::HeaderFooterContentGenerator::IsEmpty
bool IsEmpty() const
Check whether current object is empty or not.
foxit::pdf::HeaderFooterContentGenerator::operator!=
bool operator!=(const HeaderFooterContentGenerator &other) const
Not equal operator.
foxit::pdf::HeaderFooterContentGenerator::e_DateFormatMDotDDotYY
If this is used, "m.d.yy" would be used as the date format string.
Definition: fs_headerfooter.h:444
CFX_FloatRect
Definition: fx_coordinates.h:771