Foxit PDF SDK
fs_formfiller.h
浏览该文件的文档.
1 
15 #ifndef FS_FORMFILLER_H_
16 #define FS_FORMFILLER_H_
17 
18 #include "common/fs_common.h"
19 #include "common/fs_render.h"
20 //#include "pdf/fs_pdfpage.h"
21 //#include "pdf/fs_pdfpage.h"
22 
28 namespace foxit {
32 namespace pdf {
33  class PDFPage;
37 namespace interform {
38 // forward declaration
39 class Form;
40 class Control;
41 
47  public:
55  virtual void OnTimer(int timer) = 0;
56 
57  protected:
58  ~TimerCallback() {}
59 };
60 
66  public:
72  typedef enum _PopupMenuItem {
85  } PopupMenuItem;
86 
92  virtual void Release() = 0;
93 
99  virtual int GetVersion() {return 1;}
100 
110  virtual void Refresh(const PDFPage& page, const RectF* rect) = 0;
111 
126  virtual bool SetTimerCallback(int elapse, TimerCallback* timer, int* out_timer_id) = 0;
127 
136  virtual bool KillTimer(int timer_id) = 0;
137 
150  virtual void FocusGotOnControl(const Control& control, const char* value) = 0;
151 
164  virtual void FocusLostFromControl(const Control& control, const char* value) = 0;
165 
173  virtual void* CreatePopupMenu() = 0;
174 
188  virtual bool AppendPopupMenuItem(const void* h_popup_menu, PopupMenuItem popup_menu_item, const wchar_t* default_string) = 0;
189 
203  virtual bool EnablePopupMenuItem(const void* h_popup_menu, PopupMenuItem popup_menu_item, bool is_enabled) = 0;
204 
215  virtual bool ShowPopupMenu(const void* h_popup_menu, const PointF& point) = 0;
216 
226  virtual void DestroyPopupMenu(const void* h_popup_menu) = 0;
227 
237  virtual void SetClipboardText(const wchar_t* text) = 0;
238 
246  virtual WString GetClipboardText() = 0;
247 
258  virtual void ReportInvalidValue(const wchar_t* form_field_name, const wchar_t* invalid_value) = 0;
259  protected:
261 };
262 
271 class Filler FS_FINAL : public Base {
272  public:
278  typedef enum _VirtualKeyCode {
282  e_VkeyBack = 0x08,
284  e_VkeyTab = 0x09,
286  e_VkeyReturn = 0x0D,
288  e_VkeyShift = 0x10,
292  e_VkeyMenu = 0x12,
294  e_VkeyPause = 0x13,
296  e_VkeyEscape = 0x1B,
298  e_VkeySpace = 0x20,
300  e_VkeyPrior = 0x21,
302  e_VkeyNext = 0x22,
304  e_VkeyEnd = 0x23,
306  e_VkeyHome = 0x24,
308  e_VkeyLeft = 0x25,
310  e_VkeyUp = 0x26,
312  e_VkeyRight = 0x27,
314  e_VkeyDown = 0x28,
316  e_VkeyPrint = 0x2A,
320  e_VkeyInsert = 0x2D,
322  e_VkeyDelete = 0x2E,
324  e_VkeyHelp = 0x2F,
326  e_Vkey0 = 0x30,
328  e_Vkey1 = 0x31,
330  e_Vkey2 = 0x32,
332  e_Vkey3 = 0x33,
334  e_Vkey4 = 0x34,
336  e_Vkey5 = 0x35,
338  e_Vkey6 = 0x36,
340  e_Vkey7 = 0x37,
342  e_Vkey8 = 0x38,
344  e_Vkey9 = 0x39,
346  e_VkeyA = 0x41,
348  e_VkeyB = 0x42,
350  e_VkeyC = 0x43,
352  e_VkeyD = 0x44,
354  e_VkeyE = 0x45,
356  e_VkeyF = 0x46,
358  e_VkeyG = 0x47,
360  e_VkeyH = 0x48,
362  e_VkeyI = 0x49,
364  e_VkeyJ = 0x4A,
366  e_VkeyK = 0x4B,
368  e_VkeyL = 0x4C,
370  e_VkeyM = 0x4D,
372  e_VkeyN = 0x4E,
374  e_VkeyO = 0x4F,
376  e_VkeyP = 0x50,
378  e_VkeyQ = 0x51,
380  e_VkeyR = 0x52,
382  e_VkeyS = 0x53,
384  e_VkeyT = 0x54,
386  e_VkeyU = 0x55,
388  e_VkeyV = 0x56,
390  e_VkeyW = 0x57,
392  e_VkeyX = 0x58,
394  e_VkeyY = 0x59,
396  e_VkeyZ = 0x5A,
420  e_VkeyAdd = 0x6B,
428  e_VkeyDivide = 0x6F,
430  e_VkeyF1 = 0x70,
432  e_VkeyF2 = 0x71,
434  e_VkeyF3 = 0x72,
436  e_VkeyF4 = 0x73,
438  e_VkeyF5 = 0x74,
440  e_VkeyF6 = 0x75,
442  e_VkeyF7 = 0x76,
444  e_VkeyF8 = 0x77,
446  e_VkeyF9 = 0x78,
448  e_VkeyF10 = 0x79,
450  e_VkeyF11 = 0x7A,
452  e_VkeyF12 = 0x7B
453  } VirtualKeyCode;
454 
460  typedef enum _EventFlags {
481  } EventFlags;
482 
483 
492  explicit Filler(const Form& form, FillerAssistCallback* assist);
493 
495  ~Filler();
496 
502  Filler(const Filler& other);
510  Filler& operator = (const Filler& other);
511 
519  bool operator == (const Filler& other) const;
527  bool operator != (const Filler& other) const;
528 
536  bool IsEmpty() const;
537 
553  void Render(const PDFPage& page, const Matrix& matrix,const common::Renderer& renderer);
554 
565  bool OnLButtonDown(const PDFPage& page, const PointF& point, uint32 flags);
566 
577  bool OnLButtonUp(const PDFPage& page, const PointF& point, uint32 flags);
578 
589  bool OnLButtonDoubleClick(const PDFPage& page, const PointF& point, uint32 flags);
590 
601  bool OnMouseMove(const PDFPage& page, const PointF& point, uint32 flags);
602 
614  bool OnMouseEnter(const PDFPage& page, const PointF& point, uint32 flags);
615 
627  bool OnMouseHover(const PDFPage& page, const PointF& point, uint32 flags);
628 
640  bool OnMouseLeave(const PDFPage& page, const PointF& point, uint32 flags);
641 
655  bool OnMouseWheel(const PDFPage& page, const PointF& point, int32 delta, uint32 flags);
656 
668  bool OnRButtonDown(const PDFPage& page, const PointF& point, uint32 flags);
669 
681  bool OnRButtonUp(const PDFPage& page, const PointF& point, uint32 flags);
682 
694  bool OnRButtonDoubleClick(const PDFPage& page, const PointF& point, uint32 flags);
695 
707  bool OnWheelButtonDown(const PDFPage& page, const PointF& point, uint32 flags);
708 
720  bool OnWheelButtonUp(const PDFPage& page, const PointF& point, uint32 flags);
721 
733  bool OnWheelButtonDoubleClick(const PDFPage& page, const PointF& point, uint32 flags);
734 
746  bool OnKeyDown(uint32 key_code, uint32 flags);
747 
759  bool OnKeyUp(uint32 key_code, uint32 flags);
760 
770  bool OnChar(uint32 char_code, uint32 flags);
771 
780  bool SetFocus(const Control& control);
781 
787  bool KillFocus();
788 
800  void HighlightFormFields(bool is_highlight);
801 
818  void HighlightFormFields(bool is_highlight, bool is_sign_highlight);
819 
829  void SetHighlightColor(ARGB color);
830 
841  void ShowOverflowIndicator(bool is_show_overflow_indicator);
842 
848  bool OnCut();
849 
855  bool OnCopy();
856 
862  bool OnPaste();
863 
869  bool OnSelectAll();
870 
876  bool OnDelete();
877 
887 
888  // 强烈建议用户不要使用此方法;否则可能出现未知情况。
889  explicit Filler(FS_HANDLE handle = NULL);
890 };
891 } // namespace interform
892 } // namespace pdf
893 } // namespace foxit
894 #endif // FS_FORMFILLER_H_
895 
bool OnLButtonDown(const PDFPage &page, const PointF &point, uint32 flags)
当鼠标左键按下时调用此函数。
bool OnRButtonDoubleClick(const PDFPage &page, const PointF &point, uint32 flags)
(保留,尚未支持)当鼠标右键双击时调用此函数。
X键。
Definition: fs_formfiller.h:392
Filler & operator=(const Filler &other)
赋值操作符。
bool OnRButtonUp(const PDFPage &page, const PointF &point, uint32 flags)
当鼠标右键抬起时调用此函数。
Z键。
Definition: fs_formfiller.h:396
virtual void DestroyPopupMenu(const void *h_popup_menu)=0
当需要销毁弹出菜单时触发的回调函数。
F10键。
Definition: fs_formfiller.h:448
void ShowOverflowIndicator(bool is_show_overflow_indicator)
决定当文本字段中的文本溢出时是否显示溢出指示器。
无弹出菜单项。
Definition: fs_formfiller.h:74
bool OnPaste()
当弹出菜单项"粘贴"按下时调用此函数。
bool OnMouseMove(const PDFPage &page, const PointF &point, uint32 flags)
当鼠标移动时调用此函数。
F12键。
Definition: fs_formfiller.h:452
Q键。
Definition: fs_formfiller.h:378
事件标志:鼠标右键按下。
Definition: fs_formfiller.h:478
F键。
Definition: fs_formfiller.h:356
弹出菜单项:"剪切"。
Definition: fs_formfiller.h:76
Print键。
Definition: fs_formfiller.h:316
virtual void * CreatePopupMenu()=0
当需要创建弹出菜单时触发的回调函数。
bool OnCut()
当弹出菜单项"剪切"按下时调用此函数。
PopupMenuItem
弹出菜单项的枚举。
Definition: fs_formfiller.h:72
virtual bool EnablePopupMenuItem(const void *h_popup_menu, PopupMenuItem popup_menu_item, bool is_enabled)=0
当需要启用弹出菜单中指定弹出菜单项时触发的回调函数。
virtual void SetClipboardText(const wchar_t *text)=0
当需要设置剪贴板文本时触发的回调函数。
数字键盘中的3键。
Definition: fs_formfiller.h:404
事件标志:元键。
Definition: fs_formfiller.h:468
Definition: fs_formfiller.h:271
Page Down键。
Definition: fs_formfiller.h:302
左箭头键。
Definition: fs_formfiller.h:308
bool IsEmpty() const
检查当前对象是否为空。
bool OnWheelButtonDoubleClick(const PDFPage &page, const PointF &point, uint32 flags)
(保留,尚未支持)当鼠标滚轮按钮双击时调用此函数。
Definition: fx_coordinates.h:30
6键。
Definition: fs_formfiller.h:338
F6键。
Definition: fs_formfiller.h:440
I键。
Definition: fs_formfiller.h:362
事件标志:"Alt"键。
Definition: fs_formfiller.h:466
void SetHighlightColor(ARGB color)
设置用于高亮显示表单字段的高亮颜色。
A键。
Definition: fs_formfiller.h:346
EventFlags
键事件标志的枚举。
Definition: fs_formfiller.h:460
ESC键。
Definition: fs_formfiller.h:296
5键。
Definition: fs_formfiller.h:336
退格键。
Definition: fs_formfiller.h:282
宽字符串类
Definition: fx_string.h:1457
2键。
Definition: fs_formfiller.h:330
virtual bool KillTimer(int timer_id)=0
用于通过计时器标识符销毁计时器事件的回调函数。
3键。
Definition: fs_formfiller.h:332
V键。
Definition: fs_formfiller.h:388
virtual void Refresh(const PDFPage &page, const RectF *rect)=0
用于刷新指定页面上指定区域的回调函数。
Help键。
Definition: fs_formfiller.h:324
F3键。
Definition: fs_formfiller.h:434
bool OnDelete()
当弹出菜单项"删除"按下时调用此函数。
W键。
Definition: fs_formfiller.h:390
Definition: fs_formfiller.h:65
Definition: fs_pdfform.h:675
数字键盘中的7键。
Definition: fs_formfiller.h:412
数字键盘中的4键。
Definition: fs_formfiller.h:406
F8键。
Definition: fs_formfiller.h:444
Delete键。
Definition: fs_formfiller.h:322
Definition: fs_pdfform.h:1217
bool operator !=(const Filler &other) const
不等操作符。
C键。
Definition: fs_formfiller.h:350
Print Screen键。
Definition: fs_formfiller.h:318
8键。
Definition: fs_formfiller.h:342
数字键盘中的1键。
Definition: fs_formfiller.h:400
E键。
Definition: fs_formfiller.h:354
virtual void ReportInvalidValue(const wchar_t *form_field_name, const wchar_t *invalid_value)=0
当用户输入无效值时触发的回调函数。
Filler(const Form &form, FillerAssistCallback *assist)
构造函数。
bool SetFocus(const Control &control)
将焦点设置到表单控件上。
F7键。
Definition: fs_formfiller.h:442
VirtualKeyCode
虚拟键码的枚举。
Definition: fs_formfiller.h:278
U键。
Definition: fs_formfiller.h:386
virtual void OnTimer(int timer)=0
用作每个时间间隔上的计时器的回调函数。
Definition: fs_render.h:197
弹出菜单项:"粘贴"。
Definition: fs_formfiller.h:80
数字键盘中的减号键。
Definition: fs_formfiller.h:424
数字键盘中的斜杠键。
Definition: fs_formfiller.h:428
uint32 ARGB
ARGB 颜色类型,32 位,((b) | ((g) << 8) | ((r) << 16)) | ((a) << 24)
Definition: fs_basictypes.h:210
Insert键。
Definition: fs_formfiller.h:320
bool OnLButtonUp(const PDFPage &page, const PointF &point, uint32 flags)
当鼠标左键抬起时调用此函数。
B键。
Definition: fs_formfiller.h:348
bool OnLButtonDoubleClick(const PDFPage &page, const PointF &point, uint32 flags)
当鼠标左键双击时调用此函数。
数字键盘中的9键。
Definition: fs_formfiller.h:416
弹出菜单项:"删除"。
Definition: fs_formfiller.h:82
事件标志:键盘。
Definition: fs_formfiller.h:470
菜单键。
Definition: fs_formfiller.h:292
bool OnMouseLeave(const PDFPage &page, const PointF &point, uint32 flags)
(保留,尚未支持)当鼠标离开某处时调用此函数。
bool OnMouseEnter(const PDFPage &page, const PointF &point, uint32 flags)
(保留,尚未支持)当鼠标进入某处时调用此函数。
bool OnKeyDown(uint32 key_code, uint32 flags)
当键盘上的键按下时调用此函数。
bool OnKeyUp(uint32 key_code, uint32 flags)
当键盘上的键抬起时调用此函数。
virtual bool ShowPopupMenu(const void *h_popup_menu, const PointF &point)=0
当需要显示弹出菜单时触发的回调函数。
1键。
Definition: fs_formfiller.h:328
P键。
Definition: fs_formfiller.h:376
bool OnChar(uint32 char_code, uint32 flags)
当字符代码即将输入到表单字段时调用此函数。
F5键。
Definition: fs_formfiller.h:438
Shift键。
Definition: fs_formfiller.h:288
4键。
Definition: fs_formfiller.h:334
virtual bool AppendPopupMenuItem(const void *h_popup_menu, PopupMenuItem popup_menu_item, const wchar_t *default_string)=0
当需要向弹出菜单追加弹出菜单项时触发的回调函数。
弹出菜单项:"全选"。
Definition: fs_formfiller.h:84
F9键。
Definition: fs_formfiller.h:446
bool OnCopy()
当弹出菜单项"复制"按下时调用此函数。
数字键盘中的2键。
Definition: fs_formfiller.h:402
K键。
Definition: fs_formfiller.h:366
virtual void Release()=0
用于释放当前回调对象本身的回调函数。
弹出菜单项:"复制"。
Definition: fs_formfiller.h:78
Y键。
Definition: fs_formfiller.h:394
7键。
Definition: fs_formfiller.h:340
Ctrl键。
Definition: fs_formfiller.h:290
F1键。
Definition: fs_formfiller.h:430
0键。
Definition: fs_formfiller.h:326
F2键。
Definition: fs_formfiller.h:432
T键。
Definition: fs_formfiller.h:384
bool operator==(const Filler &other) const
相等操作符。
FX_UINT32 uint32
无符号 32 位整数。
Definition: fs_basictypes.h:196
bool OnRButtonDown(const PDFPage &page, const PointF &point, uint32 flags)
当鼠标右键按下时调用此函数。
数字键盘中的5键。
Definition: fs_formfiller.h:408
Definition: fs_pdfpage.h:421
Page Up键。
Definition: fs_formfiller.h:300
void * FS_HANDLE
句柄类型。
Definition: fs_basictypes.h:214
通用定义和类的头文件。
事件标志:鼠标左键按下。
Definition: fs_formfiller.h:474
Home键。
Definition: fs_formfiller.h:306
事件标志:命令键。
Definition: fs_formfiller.h:480
数字键盘中的6键。
Definition: fs_formfiller.h:410
数字键盘中的8键。
Definition: fs_formfiller.h:414
Tab键。
Definition: fs_formfiller.h:284
void Render(const PDFPage &page, const Matrix &matrix, const common::Renderer &renderer)
在页面上绘制当前获得焦点的表单控件。
FX_INT32 int32
有符号 32 位整数。
Definition: fs_basictypes.h:194
Definition: fs_basictypes.h:449
bool OnWheelButtonUp(const PDFPage &page, const PointF &point, uint32 flags)
(保留,尚未支持)当鼠标滚轮按钮抬起时调用此函数。
数字键盘中的加号键。
Definition: fs_formfiller.h:420
H键。
Definition: fs_formfiller.h:360
bool OnSelectAll()
当弹出菜单项"全选"按下时调用此函数。
R键。
Definition: fs_formfiller.h:380
void HighlightFormFields(bool is_highlight)
决定是否高亮显示表单字段(包括签名字段)。
N键。
Definition: fs_formfiller.h:372
L键。
Definition: fs_formfiller.h:368
Definition: fs_formfiller.h:46
Foxit命名空间。
Definition: fs_taggedpdf.h:27
数字键盘中的小数点键。
Definition: fs_formfiller.h:426
F4键。
Definition: fs_formfiller.h:436
F11键。
Definition: fs_formfiller.h:450
下箭头键。
Definition: fs_formfiller.h:314
Pause Break键。
Definition: fs_formfiller.h:294
M键。
Definition: fs_formfiller.h:370
virtual void FocusGotOnControl(const Control &control, const char *value)=0
当焦点设置到表单控件时触发的回调函数。
右箭头键。
Definition: fs_formfiller.h:312
virtual WString GetClipboardText()=0
当需要获取剪贴板上的文本时触发的回调函数。
回车键。
Definition: fs_formfiller.h:286
事件标志:"Shift"键。
Definition: fs_formfiller.h:462
G键。
Definition: fs_formfiller.h:358
#define NULL
空指针值。
Definition: fx_system.h:792
virtual void FocusLostFromControl(const Control &control, const char *value)=0
当焦点从表单控件丢失时触发的回调函数。
Definition: fx_coordinates.h:1076
bool OnWheelButtonDown(const PDFPage &page, const PointF &point, uint32 flags)
(保留,尚未支持)当鼠标滚轮按钮按下时调用此函数。
数字键盘中的0键。
Definition: fs_formfiller.h:398
事件标志:自动重复。
Definition: fs_formfiller.h:472
virtual bool SetTimerCallback(int elapse, TimerCallback *timer, int *out_timer_id)=0
用于设置系统计时器的回调函数。
空格键。
Definition: fs_formfiller.h:298
未知键。
Definition: fs_formfiller.h:280
PointF GetEditingTextCaretPosition(Matrix matrix)
当文本字段或组合框处于编辑状态时获取文本光标位置。
Header file for rendering related definitions and classes.
virtual int GetVersion()
获取派生实现的版本,用于兼容性原因。
Definition: fs_formfiller.h:99
J键。
Definition: fs_formfiller.h:364
事件标志:"Ctrl"键。
Definition: fs_formfiller.h:464
数字键盘中的乘号键。
Definition: fs_formfiller.h:418
上箭头键。
Definition: fs_formfiller.h:310
S键。
Definition: fs_formfiller.h:382
End键。
Definition: fs_formfiller.h:304
事件标志:鼠标中键按下。
Definition: fs_formfiller.h:476
O键。
Definition: fs_formfiller.h:374
bool KillFocus()
从表单中移除焦点。
数字键盘中的回车键。
Definition: fs_formfiller.h:422
D键。
Definition: fs_formfiller.h:352
bool OnMouseWheel(const PDFPage &page, const PointF &point, int32 delta, uint32 flags)
(保留,尚未支持)当鼠标滚轮移动时调用此函数。
9键。
Definition: fs_formfiller.h:344
Definition: fx_coordinates.h:771
bool OnMouseHover(const PDFPage &page, const PointF &point, uint32 flags)
(保留,尚未支持)当鼠标悬停在某处时调用此函数。