Foxit PDF SDK
fs_formfiller.h
Go to the documentation of this file.
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 
127  virtual bool SetTimerCallback(int elapse, TimerCallback* timer, int* out_timer_id) = 0;
128 
137  virtual bool KillTimer(int timer_id) = 0;
138 
151  virtual void FocusGotOnControl(const Control& control, const char* value) = 0;
152 
165  virtual void FocusLostFromControl(const Control& control, const char* value) = 0;
166 
174  virtual void* CreatePopupMenu() = 0;
175 
188  virtual bool AppendPopupMenuItem(const void* h_popup_menu, PopupMenuItem popup_menu_item, const wchar_t* default_string) = 0;
189 
202  virtual bool EnablePopupMenuItem(const void* h_popup_menu, PopupMenuItem popup_menu_item, bool is_enabled) = 0;
203 
214  virtual bool ShowPopupMenu(const void* h_popup_menu, const PointF& point) = 0;
215 
225  virtual void DestroyPopupMenu(const void* h_popup_menu) = 0;
226 
236  virtual void SetClipboardText(const wchar_t* text) = 0;
237 
245  virtual WString GetClipboardText() = 0;
246 
257  virtual void ReportInvalidValue(const wchar_t* form_field_name, const wchar_t* invalid_value) = 0;
258  protected:
260 };
261 
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 
493  explicit Filler(const Form& form, FillerAssistCallback* assist);
494 
496  ~Filler();
497 
503  Filler(const Filler& other);
511  Filler& operator = (const Filler& other);
512 
520  bool operator == (const Filler& other) const;
528  bool operator != (const Filler& other) const;
529 
537  bool IsEmpty() const;
538 
555  void Render(const PDFPage& page, const Matrix& matrix,const common::Renderer& renderer);
556 
567  bool OnLButtonDown(const PDFPage& page, const PointF& point, uint32 flags);
568 
579  bool OnLButtonUp(const PDFPage& page, const PointF& point, uint32 flags);
580 
591  bool OnLButtonDoubleClick(const PDFPage& page, const PointF& point, uint32 flags);
592 
603  bool OnMouseMove(const PDFPage& page, const PointF& point, uint32 flags);
604 
616  bool OnMouseEnter(const PDFPage& page, const PointF& point, uint32 flags);
617 
629  bool OnMouseHover(const PDFPage& page, const PointF& point, uint32 flags);
630 
642  bool OnMouseLeave(const PDFPage& page, const PointF& point, uint32 flags);
643 
657  bool OnMouseWheel(const PDFPage& page, const PointF& point, int32 delta, uint32 flags);
658 
670  bool OnRButtonDown(const PDFPage& page, const PointF& point, uint32 flags);
671 
683  bool OnRButtonUp(const PDFPage& page, const PointF& point, uint32 flags);
684 
696  bool OnRButtonDoubleClick(const PDFPage& page, const PointF& point, uint32 flags);
697 
709  bool OnWheelButtonDown(const PDFPage& page, const PointF& point, uint32 flags);
710 
722  bool OnWheelButtonUp(const PDFPage& page, const PointF& point, uint32 flags);
723 
735  bool OnWheelButtonDoubleClick(const PDFPage& page, const PointF& point, uint32 flags);
736 
748  bool OnKeyDown(uint32 key_code, uint32 flags);
749 
761  bool OnKeyUp(uint32 key_code, uint32 flags);
762 
772  bool OnChar(uint32 char_code, uint32 flags);
773 
782  bool SetFocus(const Control& control);
783 
789  bool KillFocus();
790 
803  void HighlightFormFields(bool is_highlight);
804 
821  void HighlightFormFields(bool is_highlight, bool is_sign_highlight);
822 
833  void SetHighlightColor(ARGB color);
834 
845  void ShowOverflowIndicator(bool is_show_overflow_indicator);
846 
852  bool OnCut();
853 
859  bool OnCopy();
860 
866  bool OnPaste();
867 
873  bool OnSelectAll();
874 
880  bool OnDelete();
881  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
882  explicit Filler(FS_HANDLE handle = NULL);
883 };
884 } // namespace interform
885 } // namespace pdf
886 } // namespace foxit
887 #endif // FS_FORMFILLER_H_
888 
bool OnLButtonDown(const PDFPage &page, const PointF &point, uint32 flags)
Call this function when left mouse button is down.
bool OnRButtonDoubleClick(const PDFPage &page, const PointF &point, uint32 flags)
(Reserved, unsupported yet) Call this function when right mouse button is double clicked.
X key.
Definition: fs_formfiller.h:392
Filler & operator=(const Filler &other)
Assign operator.
bool OnRButtonUp(const PDFPage &page, const PointF &point, uint32 flags)
Call this function when right mouse button is up.
Z key.
Definition: fs_formfiller.h:396
virtual void DestroyPopupMenu(const void *h_popup_menu)=0
A callback function which is triggered when need to destroy popup menu.
F10 key.
Definition: fs_formfiller.h:448
void ShowOverflowIndicator(bool is_show_overflow_indicator)
Decide whether to show the overflow indicator when the text in text field overflow.
No popup menu item.
Definition: fs_formfiller.h:74
bool OnPaste()
Call this function when the popup menu item "Paste" is down.
bool OnMouseMove(const PDFPage &page, const PointF &point, uint32 flags)
Call this function when mouse moves.
F12 key.
Definition: fs_formfiller.h:452
Q key.
Definition: fs_formfiller.h:378
Event flag: the right button of the mouse is down.
Definition: fs_formfiller.h:478
F key.
Definition: fs_formfiller.h:356
Popup menu item: "Cut".
Definition: fs_formfiller.h:76
Print key.
Definition: fs_formfiller.h:316
virtual void * CreatePopupMenu()=0
A callback function which is triggered when need to create a popup menu.
bool OnCut()
Call this function when the popup menu item "Cut" is down.
PopupMenuItem
Enumeration for popup menu item.
Definition: fs_formfiller.h:72
virtual bool EnablePopupMenuItem(const void *h_popup_menu, PopupMenuItem popup_menu_item, bool is_enabled)=0
A callback function which is triggered when need to enable specified popup menu item in popup menu.
virtual void SetClipboardText(const wchar_t *text)=0
A callback function which is triggered when need to set clipboard text.
3 key in the numeric keypad.
Definition: fs_formfiller.h:404
Event flag: meta key.
Definition: fs_formfiller.h:468
Definition: fs_formfiller.h:271
Page Down key.
Definition: fs_formfiller.h:302
Left arrow key.
Definition: fs_formfiller.h:308
bool IsEmpty() const
Check whether current object is empty or not.
bool OnWheelButtonDoubleClick(const PDFPage &page, const PointF &point, uint32 flags)
(Reserved, unsupported yet) Call this function when mouse wheel button is double clicked.
Definition: fx_coordinates.h:30
6 key.
Definition: fs_formfiller.h:338
F6 key.
Definition: fs_formfiller.h:440
I key.
Definition: fs_formfiller.h:362
Event flag: "Alt" key.
Definition: fs_formfiller.h:466
void SetHighlightColor(ARGB color)
Set the highlight color used for highlighting form fields.
A key.
Definition: fs_formfiller.h:346
EventFlags
Enumeration for key event flags.
Definition: fs_formfiller.h:460
ESC key.
Definition: fs_formfiller.h:296
5 key.
Definition: fs_formfiller.h:336
Backspace key.
Definition: fs_formfiller.h:282
WIDE STRING CLASS.
Definition: fx_string.h:1452
2 key.
Definition: fs_formfiller.h:330
virtual bool KillTimer(int timer_id)=0
A callback function used to kill the timer event by timer identifier.
3 key.
Definition: fs_formfiller.h:332
V key.
Definition: fs_formfiller.h:388
virtual void Refresh(const PDFPage &page, const RectF *rect)=0
A callback function used to refresh the specified area on a specified page.
Help key.
Definition: fs_formfiller.h:324
F3 key.
Definition: fs_formfiller.h:434
bool OnDelete()
Call this function when the popup menu item "Delete" is down.
W key.
Definition: fs_formfiller.h:390
Definition: fs_formfiller.h:65
Definition: fs_pdfform.h:687
7 key in the numeric keypad.
Definition: fs_formfiller.h:412
4 key in the numeric keypad.
Definition: fs_formfiller.h:406
F8 key.
Definition: fs_formfiller.h:444
Delete key.
Definition: fs_formfiller.h:322
Definition: fs_pdfform.h:1239
bool operator !=(const Filler &other) const
Not equal operator.
C key.
Definition: fs_formfiller.h:350
Print Screen key.
Definition: fs_formfiller.h:318
8 key.
Definition: fs_formfiller.h:342
1 key in the numeric keypad.
Definition: fs_formfiller.h:400
E key.
Definition: fs_formfiller.h:354
virtual void ReportInvalidValue(const wchar_t *form_field_name, const wchar_t *invalid_value)=0
A callback function which is triggered when user entered an invalid value.
Filler(const Form &form, FillerAssistCallback *assist)
Constructor.
bool SetFocus(const Control &control)
Set focus on a form control.
F7 key.
Definition: fs_formfiller.h:442
VirtualKeyCode
Enumeration for virtual key code.
Definition: fs_formfiller.h:278
U key.
Definition: fs_formfiller.h:386
virtual void OnTimer(int timer)=0
A callback function used as a timer on every time interval.
Definition: fs_render.h:70
Popup menu item: "Paste".
Definition: fs_formfiller.h:80
Minus key in the numeric keypad.
Definition: fs_formfiller.h:424
Slash key in the numeric keypad.
Definition: fs_formfiller.h:428
uint32 ARGB
ARGB color type, 32 bits, ((b) | ((g) << 8) | ((r) << 16)) | ((a) << 24)
Definition: fs_basictypes.h:210
Insert key.
Definition: fs_formfiller.h:320
bool OnLButtonUp(const PDFPage &page, const PointF &point, uint32 flags)
Call this function when left mouse button is up.
B key.
Definition: fs_formfiller.h:348
bool OnLButtonDoubleClick(const PDFPage &page, const PointF &point, uint32 flags)
Call this function when left mouse button is double clicked.
9 key in the numeric keypad.
Definition: fs_formfiller.h:416
Popup menu item: "Delete".
Definition: fs_formfiller.h:82
Event flag: key pad.
Definition: fs_formfiller.h:470
Menu key.
Definition: fs_formfiller.h:292
bool OnMouseLeave(const PDFPage &page, const PointF &point, uint32 flags)
(Reserved, unsupported yet) Call this function when mouse leaves somewhere.
bool OnMouseEnter(const PDFPage &page, const PointF &point, uint32 flags)
(Reserved, unsupported yet) Call this function when mouse enters somewhere.
bool OnKeyDown(uint32 key_code, uint32 flags)
Call this function when key on the keyboard is down.
bool OnKeyUp(uint32 key_code, uint32 flags)
Call this function when key on the keyboard is up.
virtual bool ShowPopupMenu(const void *h_popup_menu, const PointF &point)=0
A callback function which is triggered when need to show popup menu.
1 key.
Definition: fs_formfiller.h:328
P key.
Definition: fs_formfiller.h:376
bool OnChar(uint32 char_code, uint32 flags)
Call this function when a character code is about to be inputted to a form field.
F5 key.
Definition: fs_formfiller.h:438
Shift key.
Definition: fs_formfiller.h:288
4 key.
Definition: fs_formfiller.h:334
virtual bool AppendPopupMenuItem(const void *h_popup_menu, PopupMenuItem popup_menu_item, const wchar_t *default_string)=0
A callback function which is triggered when need to append popup menu item to popup menu.
Popup menu item: "Select All".
Definition: fs_formfiller.h:84
F9 key.
Definition: fs_formfiller.h:446
bool OnCopy()
Call this function when the popup menu item "Copy" is down.
2 key in the numeric keypad.
Definition: fs_formfiller.h:402
K key.
Definition: fs_formfiller.h:366
virtual void Release()=0
A callback function used to release current callback object itself.
Popup menu item: "Copy".
Definition: fs_formfiller.h:78
Y key.
Definition: fs_formfiller.h:394
7 key.
Definition: fs_formfiller.h:340
Ctrl key.
Definition: fs_formfiller.h:290
F1 key.
Definition: fs_formfiller.h:430
0 key.
Definition: fs_formfiller.h:326
F2 key.
Definition: fs_formfiller.h:432
T key.
Definition: fs_formfiller.h:384
bool operator==(const Filler &other) const
Equal operator.
FX_UINT32 uint32
32-bit unsigned integer.
Definition: fs_basictypes.h:196
bool OnRButtonDown(const PDFPage &page, const PointF &point, uint32 flags)
Call this function when right mouse button is down.
5 key in the numeric keypad.
Definition: fs_formfiller.h:408
Definition: fs_pdfpage.h:411
Page Up key.
Definition: fs_formfiller.h:300
void * FS_HANDLE
Handle type.
Definition: fs_basictypes.h:214
Header file for common definitions and classes.
Event flag: the left button of the mouse is down.
Definition: fs_formfiller.h:474
Home key.
Definition: fs_formfiller.h:306
Event flag: the command key.
Definition: fs_formfiller.h:480
6 key in the numeric keypad.
Definition: fs_formfiller.h:410
8 key in the numeric keypad.
Definition: fs_formfiller.h:414
Tab key.
Definition: fs_formfiller.h:284
void Render(const PDFPage &page, const Matrix &matrix, const common::Renderer &renderer)
Draw the currently focused form control on the page.
FX_INT32 int32
32-bit signed integer.
Definition: fs_basictypes.h:194
Definition: fs_basictypes.h:407
bool OnWheelButtonUp(const PDFPage &page, const PointF &point, uint32 flags)
(Reserved, unsupported yet) Call this function when mouse wheel button is up.
Plus key in the numeric keypad.
Definition: fs_formfiller.h:420
H key.
Definition: fs_formfiller.h:360
bool OnSelectAll()
Call this function when the popup menu item "Select All" is down.
R key.
Definition: fs_formfiller.h:380
void HighlightFormFields(bool is_highlight)
Decide whether to highlight form fields (including signature fields) or not.
N key.
Definition: fs_formfiller.h:372
L key.
Definition: fs_formfiller.h:368
Definition: fs_formfiller.h:46
Foxit namespace.
Definition: fs_taggedpdf.h:27
Dot key in the numeric keypad.
Definition: fs_formfiller.h:426
F4 key.
Definition: fs_formfiller.h:436
F11 key.
Definition: fs_formfiller.h:450
Down arrow key.
Definition: fs_formfiller.h:314
Pause Break key.
Definition: fs_formfiller.h:294
M key.
Definition: fs_formfiller.h:370
virtual void FocusGotOnControl(const Control &control, const char *value)=0
A callback function which is triggered when the focus is set to a form control.
Right arrow key.
Definition: fs_formfiller.h:312
virtual WString GetClipboardText()=0
A callback function which is triggered when need to get the text on clipboard.
Enter key.
Definition: fs_formfiller.h:286
Event flag: "Shift" key.
Definition: fs_formfiller.h:462
G key.
Definition: fs_formfiller.h:358
#define NULL
The null-pointer value.
Definition: fx_system.h:780
virtual void FocusLostFromControl(const Control &control, const char *value)=0
A callback function which is triggered when the focus is lost from a form control.
Definition: fx_coordinates.h:1076
bool OnWheelButtonDown(const PDFPage &page, const PointF &point, uint32 flags)
(Reserved, unsupported yet) Call this function when mouse wheel button is down.
0 key in the numeric keypad.
Definition: fs_formfiller.h:398
Event flag: auto repeat.
Definition: fs_formfiller.h:472
virtual bool SetTimerCallback(int elapse, TimerCallback *timer, int *out_timer_id)=0
A callback function used to set a system timer.
Space key.
Definition: fs_formfiller.h:298
An unknown key.
Definition: fs_formfiller.h:280
Header file for rendering related definitions and classes.
virtual int GetVersion()
Get the version of derived implementation, for compatibility reason.
Definition: fs_formfiller.h:99
J key.
Definition: fs_formfiller.h:364
Event flag: "Ctrl" key.
Definition: fs_formfiller.h:464
Multiply key in the numeric keypad.
Definition: fs_formfiller.h:418
Up arrow key.
Definition: fs_formfiller.h:310
S key.
Definition: fs_formfiller.h:382
End key.
Definition: fs_formfiller.h:304
Event flag: the middle button of the mouse is down.
Definition: fs_formfiller.h:476
O key.
Definition: fs_formfiller.h:374
bool KillFocus()
Kill focus from form.
Enter key in the numeric keypad.
Definition: fs_formfiller.h:422
D key.
Definition: fs_formfiller.h:352
bool OnMouseWheel(const PDFPage &page, const PointF &point, int32 delta, uint32 flags)
(Reserved, unsupported yet) Call this function when mouse wheel moves.
9 key.
Definition: fs_formfiller.h:344
Definition: fx_coordinates.h:771
bool OnMouseHover(const PDFPage &page, const PointF &point, uint32 flags)
(Reserved, unsupported yet) Call this function when mouse hovers somewhere.