Foxit PDF SDK

fs_headerfooter.h
浏览该文件的文档.
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:
44 explicit PageNumberRange(int32 start_number, int32 end_number, foxit::common::Range::Filter filter)
45 : start_number(start_number)
46 , end_number(end_number)
47 , filter(filter) {}
48
50 PageNumberRange()
51 : start_number(-1)
52 , end_number(-1)
53 , filter(foxit::common::Range::e_All) {}
54
60 PageNumberRange(const PageNumberRange& page_range)
61 : start_number(page_range.start_number)
62 , end_number(page_range.end_number)
63 , filter(page_range.filter) {}
64
72 PageNumberRange& operator=(const PageNumberRange& page_range) {
73 start_number = page_range.start_number;
74 end_number = page_range.end_number;
75 filter = page_range.filter;
76 return *this;
77 }
78
88 void Set(int32 start_number, int32 end_number, foxit::common::Range::Filter filter) {
89 this->start_number = start_number;
90 this->end_number = end_number;
91 this->filter = filter;
92 }
93
95 int32 start_number;
97 int32 end_number;
101 foxit::common::Range::Filter filter;
102 };
103
110 class HeaderFooterContent FS_FINAL : public Object {
111 public:
122 explicit HeaderFooterContent(const WString& header_left_content, const WString& header_center_content,
123 const WString& header_right_content, const WString& footer_left_content,
124 const WString& footer_center_content, const WString& footer_right_content)
125 : header_left_content(header_left_content)
126 , header_center_content(header_center_content)
127 , header_right_content(header_right_content)
128 , footer_left_content(footer_left_content)
129 , footer_center_content(footer_center_content)
130 , footer_right_content(footer_right_content) {}
131
133 HeaderFooterContent() {}
134
140 HeaderFooterContent(const HeaderFooterContent& other)
141 : header_left_content(other.header_left_content)
142 , header_center_content(other.header_center_content)
143 , header_right_content(other.header_right_content)
144 , footer_left_content(other.footer_left_content)
145 , footer_center_content(other.footer_center_content)
146 , footer_right_content(other.footer_right_content) {}
147
155 HeaderFooterContent& operator=(const HeaderFooterContent& other) {
156 header_left_content = other.header_left_content;
157 header_center_content = other.header_center_content;
158 header_right_content = other.header_right_content;
159 footer_left_content = other.footer_left_content;
160 footer_center_content = other.footer_center_content;
161 footer_right_content = other.footer_right_content;
162 return *this;
163 }
164
177 void Set(const WString& header_left_content, const WString& header_center_content,
178 const WString& header_right_content, const WString& footer_left_content,
179 const WString& footer_center_content, const WString& footer_right_content) {
180 this->header_left_content = header_left_content;
181 this->header_center_content = header_center_content;
182 this->header_right_content = header_right_content;
183 this->footer_left_content = footer_left_content;
184 this->footer_center_content = footer_center_content;
185 this->footer_right_content = footer_right_content;
186 }
187
189 WString header_left_content;
191 WString header_center_content;
193 WString header_right_content;
195 WString footer_left_content;
197 WString footer_center_content;
199 WString footer_right_content;
200 };
201
203 class HeaderFooter FS_FINAL : public Object {
204 public:
226 explicit HeaderFooter(const common::Font& font, float text_size, RGB text_color, const PageNumberRange& page_range, RectF page_margin,
227 bool has_text_shrinked, bool has_fixedsize_for_print, int start_page_number,
228 const HeaderFooterContent& content, bool is_to_embed_font, bool is_underline)
229 : font(font)
230 , text_size(text_size)
231 , text_color(text_color)
232 , page_range(page_range)
233 , page_margin(page_margin)
234 , has_text_shrinked(has_text_shrinked)
235 , has_fixedsize_for_print(has_fixedsize_for_print)
236 , start_page_number(start_page_number)
237 , content(content)
238 , is_to_embed_font(is_to_embed_font)
239 , is_underline(is_underline)
240 , is_replace_font(true) {}
241
243 HeaderFooter()
244 : text_size(0)
245 , text_color(0)
246 , has_text_shrinked(false)
247 , has_fixedsize_for_print(false)
248 , start_page_number(0)
249 , is_to_embed_font(false)
250 , is_underline(false)
251 , is_replace_font(true) {
252 page_margin = RectF(72.0, 36.0, 72.0, 36.0);
253 }
259 HeaderFooter(const HeaderFooter& other)
260 : font(other.font)
261 , text_size(other.text_size)
262 , text_color(other.text_color)
263 , page_range(other.page_range)
264 , page_margin(other.page_margin)
265 , has_text_shrinked(other.has_text_shrinked)
266 , has_fixedsize_for_print(other.has_fixedsize_for_print)
267 , start_page_number(other.start_page_number)
268 , content(other.content)
269 , is_to_embed_font(other.is_to_embed_font)
270 , is_underline(other.is_underline)
271 , is_replace_font(other.is_replace_font) {}
272
280 HeaderFooter& operator=(const HeaderFooter& other) {
281 font = other.font;
282 text_size = other.text_size;
283 text_color = other.text_color;
284 page_range = other.page_range;
285 page_margin = other.page_margin;
286 has_text_shrinked = other.has_text_shrinked;
287 has_fixedsize_for_print = other.has_fixedsize_for_print;
288 start_page_number = other.start_page_number;
289 content = other.content;
290 is_to_embed_font = other.is_to_embed_font;
291 is_underline = other.is_underline;
292 is_replace_font = other.is_replace_font;
293 return *this;
294 }
295
318 void Set(const common::Font& font, float text_size, RGB text_color, const PageNumberRange& page_range, RectF page_margin,
319 bool has_text_shrinked, bool has_fixedsize_for_print, int start_page_number,
320 const HeaderFooterContent& content, bool is_to_embed_font, bool is_underline) {
321 this->font = font;
322 this->text_size = text_size;
323 this->text_color = text_color;
324 this->page_range = page_range;
325 this->page_margin = page_margin;
326 this->has_text_shrinked = has_text_shrinked;
327 this->has_fixedsize_for_print = has_fixedsize_for_print;
328 this->start_page_number = start_page_number;
329 this->content = content;
330 this->is_to_embed_font = is_to_embed_font;
331 this->is_underline = is_underline;
332 this->is_replace_font = true;
333 }
334
341 common::Font font;
342
344 float text_size;
345
347 RGB text_color;
348
354 PageNumberRange page_range;
355
368 RectF page_margin;
369
371 bool has_text_shrinked;
372
374 bool has_fixedsize_for_print;
375
382 int start_page_number;
383
385 HeaderFooterContent content;
386
388 bool is_to_embed_font;
389
391 bool is_underline;
392
394 bool is_replace_font;
395 };
396
401 class HeaderFooterContentGenerator FS_FINAL : public Base {
402 public:
408 typedef enum _DateFormatType {
410 e_DateFormatMSlashD = 0,
412 e_DateFormatMSlashDSlashYY = 1,
414 e_DateFormatMSlashDSlashYYYY = 2,
416 e_DateFormatMMSlashDDSlashYY = 3,
418 e_DateFormatMMSlashDDSlashYYYY = 4,
420 e_DateFormatDSlashMSlashYY = 5,
422 e_DateFormatDSlashMSlashYYYY = 6,
424 e_DateFormatDDSlashMMSlashYY = 7,
426 e_DateFormatDDSlashMMSlashYYYY = 8,
428 e_DateFormatMMSlashYY = 9,
430 e_DateFormatMMSlashYYYY = 10,
432 e_DateFormatMDotDDotYY = 11,
434 e_DateFormatMDotDDotYYYY = 12,
436 e_DateFormatMMDotDDDotYY = 13,
438 e_DateFormatMMDotDDDotYYYY = 14,
440 e_DateFormatMMDotYY = 15,
442 e_DateFormatDDotMDotYYYY = 16,
444 e_DateFormatDDDotMMDotYY = 17,
446 e_DateFormatDDDotMMDotYYYY = 18,
448 e_DateFormatYYHyphenMMHyphenDD = 19,
450 e_DateFormatYYYYHyphenMMHyphenDD = 20
451 } DateFormatType;
452
458 typedef enum _PageNumberFormat {
460 e_PageNumberFormatDefault = 0,
462 e_PageNumberFormatNumberOfCount = 1,
464 e_PageNumberFormatNumberSlashCount = 2,
466 e_PageNumberFormatPageNumber = 3,
468 e_PageNumberFormatPageNumberOfCount = 4
469 } PageNumberFormat;
470
471
472 // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
473 explicit HeaderFooterContentGenerator(FS_HANDLE handle);
474
476 HeaderFooterContentGenerator();
477
479 ~HeaderFooterContentGenerator();
480
486 HeaderFooterContentGenerator(const HeaderFooterContentGenerator& other);
487
495 HeaderFooterContentGenerator& operator=(const HeaderFooterContentGenerator& other);
496
504 bool operator==(const HeaderFooterContentGenerator& other) const;
505
513 bool operator!=(const HeaderFooterContentGenerator& other) const;
514
522 bool IsEmpty() const;
523
537 void AddDate(DateFormatType format_type);
538
552 void AddPageNumber(PageNumberFormat format_type);
553
561 void AddString(const WString& new_string);
562
570 void Clear();
571
577 WString GenerateContent();
578 };
579 #endif
foxit::Object
CFX_Object Object
对象类型。
Definition: fs_basictypes.h:220
foxit::RGB
uint32 RGB
RGB 颜色类型，24 位，((b) | ((g) << 8) | ((r) << 16)))
Definition: fs_basictypes.h:211
foxit::common::Range::Filter
Filter
范围过滤器枚举。
Definition: fs_common.h:1371
foxit::WString
CFX_WideString WString
宽字符串。
Definition: fs_basictypes.h:222
operator==
bool operator==(const char *str1, const CFX_ByteString &str2)
检查两个字节字符串是否相等。
Definition: fs_basictypes.h:128
foxit::RectF
CFX_FloatRect RectF
矩形，浮点型。
Definition: fs_basictypes.h:489
foxit::FS_HANDLE
void * FS_HANDLE
句柄类型。
Definition: fs_basictypes.h:213
fs_common.h
通用定义和类的头文件。
foxit::int32
FX_INT32 int32
有符号 32 位整数。
Definition: fs_basictypes.h:193
foxit
Foxit命名空间。
Definition: fs_taggedpdf.h:27
operator!=
bool operator!=(const char *str1, const CFX_ByteString &str2)
检查两个字节字符串是否不相等。
Definition: fs_basictypes.h:140