Remove rendundant ../include from paths of files in include/ directory
[pdfium.git] / fpdfsdk / include / formfiller / FFL_IFormFiller.h
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4  
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #ifndef _FFL_IFORMFILLER_H_
8 #define _FFL_IFORMFILLER_H_
9
10 #include "FormFiller.h"
11 class CFFL_FormFiller;
12 class CFFL_PrivateData;
13
14 #define CFFL_Widget2Filler              CFX_MapPtrTemplate<CPDFSDK_Annot*, CFFL_FormFiller*>
15
16 // #define IsALTpressed()                       (GetKeyState(VK_MENU) < 0)
17 // #define IsCTRLpressed()                      (GetKeyState(VK_CONTROL) < 0)
18 // #define IsSHIFTpressed()             (GetKeyState(VK_SHIFT)&0x8000)
19 // #define IsINSERTpressed()            (GetKeyState(VK_INSERT) & 0x01) 
20 // #define VK_SHIFT          0x10
21 // #define VK_CONTROL        0x11
22 // #define VK_MENU           0x12
23 // #define VK_RETURN         0x0D
24 // #define VK_SPACE          0x20
25 // #define VK_ESCAPE         0x1B
26
27
28
29 class CFFL_IFormFiller :/* public IBA_AnnotFiller, */public IPWL_Filler_Notify//, 
30 //      public IUndo_EventHandler, public IClipboard_Handler
31 {
32 public:
33         CFFL_IFormFiller(CPDFDoc_Environment* pApp);
34         virtual ~CFFL_IFormFiller();
35
36         virtual FX_BOOL                         Annot_HitTest(CPDFSDK_PageView* pPageView,CPDFSDK_Annot* pAnnot, CPDF_Point point);
37         virtual FX_RECT                         GetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
38         virtual void                            OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, 
39                                                                         CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
40                                                                         /*const CRect& rcWindow,*/ FX_DWORD dwFlags);
41
42
43         virtual void                            OnCreate(CPDFSDK_Annot* pAnnot);
44         virtual void                            OnLoad(CPDFSDK_Annot* pAnnot);
45         virtual void                            OnDelete(CPDFSDK_Annot* pAnnot);
46
47         virtual void                            OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlag);
48         virtual void                            OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlag);
49
50         virtual FX_BOOL                         OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
51         virtual FX_BOOL                         OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
52         virtual FX_BOOL                         OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
53         virtual FX_BOOL                         OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
54         virtual FX_BOOL                         OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, short zDelta, const CPDF_Point& point);
55         virtual FX_BOOL                         OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
56         virtual FX_BOOL                         OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
57         virtual FX_BOOL                         OnRButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
58
59         virtual FX_BOOL                         OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags);
60         virtual FX_BOOL                         OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
61
62         virtual void                            OnDeSelected(CPDFSDK_Annot* pAnnot);
63         virtual void                            OnSelected(CPDFSDK_Annot* pAnnot);
64
65         virtual FX_BOOL                         OnSetFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag);
66         virtual FX_BOOL                         OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag);
67
68 public:
69         virtual void                            QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMin,FX_FLOAT fPopupMax, FX_INT32 & nRet, FX_FLOAT & fPopupRet);
70         virtual void                            OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_INT32 nKeyCode,
71                                                                                 CFX_WideString & strChange, const CFX_WideString& strChangeEx, 
72                                                                                 int nSelStart, int nSelEnd,
73                                                                                 FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit, FX_DWORD nFlag);
74         virtual void                            OnAfterKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_BOOL & bExit, FX_DWORD nFlag) ;
75
76         virtual void                            OnSetWindowRect(void* pPrivateData, const CPDF_Rect & rcWindow);
77         virtual void                            OnKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_INT32 nKeyCode, CFX_WideString & strChange, 
78                                                                         const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit);
79
80 public:
81         virtual void                            BeforeUndo(CPDFSDK_Document* pDocument);
82         virtual void                            BeforeRedo(CPDFSDK_Document* pDocument);
83         virtual void                            AfterUndo(CPDFSDK_Document* pDocument);
84         virtual void                            AfterRedo(CPDFSDK_Document* pDocument);
85
86 public:
87         virtual FX_BOOL                         CanCopy(CPDFSDK_Document* pDocument); 
88         virtual FX_BOOL                         CanCut(CPDFSDK_Document* pDocument); 
89         virtual FX_BOOL                         CanPaste(CPDFSDK_Document* pDocument); 
90
91         virtual void                            DoCopy(CPDFSDK_Document* pDocument); 
92         virtual void                            DoCut(CPDFSDK_Document* pDocument); 
93         virtual void                            DoPaste(CPDFSDK_Document* pDocument); 
94
95 public:
96         CFFL_FormFiller*                        GetFormFiller(CPDFSDK_Annot* pAnnot, FX_BOOL bRegister);
97         void                                            RemoveFormFiller(CPDFSDK_Annot* pAnnot);
98
99         static FX_BOOL                          IsVisible(CPDFSDK_Widget* pWidget);
100         static FX_BOOL                          IsReadOnly(CPDFSDK_Widget* pWidget);
101         static FX_BOOL                          IsFillingAllowed(CPDFSDK_Widget* pWidget);
102         static FX_BOOL                          IsValidAnnot(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot);
103
104         void                                            OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag);
105         void                                            OnValidate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag);
106
107         void                                            OnCalculate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bExit, FX_DWORD nFlag);
108         void                                            OnFormat(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bExit, FX_DWORD nFlag);
109         void                                            OnButtonUp(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bReset, FX_BOOL& bExit,FX_UINT nFlag);
110 //      static LRESULT CALLBACK         FFL_WndProc(
111 //                                                                        int code,       // hook code
112 //                                                                        WPARAM wParam,  // virtual-key code
113 //                                                                        LPARAM lParam   // keystroke-message information
114 //                                                                              );
115 //      static MSG                                      GetLastMessage();
116         static int                                      GetCommitKey();
117         static FX_BOOL                          GetKeyDown();
118
119
120 public:
121 //      static MSG                                      g_Msg;
122 //      static HHOOK                            m_hookSheet;
123
124 private:
125         void                                            UnRegisterFormFiller(CPDFSDK_Annot* pAnnot);
126         void                                            SetFocusAnnotTab(CPDFSDK_Annot* pWidget, FX_BOOL bSameField, FX_BOOL bNext);
127
128 private:
129         CPDFDoc_Environment*                            m_pApp;
130         CFFL_Widget2Filler                      m_Maps;
131         FX_BOOL                                         m_bNotifying;
132 };
133
134 class CFFL_PrivateData
135 {
136 public:
137         CPDFSDK_Widget*                 pWidget;
138         CPDFSDK_PageView*       pPageView;
139         int                                     nWidgetAge;
140         int                                     nValueAge;
141 };
142
143 #endif //_FFL_IFORMFILLER_H_
144