| OLD | NEW |
| (Empty) |
| 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 FPDFSDK_INCLUDE_FORMFILLER_FFL_IFORMFILLER_H_ | |
| 8 #define FPDFSDK_INCLUDE_FORMFILLER_FFL_IFORMFILLER_H_ | |
| 9 | |
| 10 #include <map> | |
| 11 | |
| 12 #include "fpdfsdk/include/fsdk_define.h" | |
| 13 #include "fpdfsdk/include/pdfwindow/PWL_Edit.h" | |
| 14 | |
| 15 class CFFL_FormFiller; | |
| 16 class CPDFDoc_Environment; | |
| 17 class CPDFSDK_Annot; | |
| 18 class CPDFSDK_PageView; | |
| 19 class CPDFSDK_Widget; | |
| 20 | |
| 21 class CFFL_IFormFiller : public IPWL_Filler_Notify { | |
| 22 public: | |
| 23 explicit CFFL_IFormFiller(CPDFDoc_Environment* pApp); | |
| 24 ~CFFL_IFormFiller() override; | |
| 25 | |
| 26 virtual FX_BOOL Annot_HitTest(CPDFSDK_PageView* pPageView, | |
| 27 CPDFSDK_Annot* pAnnot, | |
| 28 CFX_FloatPoint point); | |
| 29 virtual FX_RECT GetViewBBox(CPDFSDK_PageView* pPageView, | |
| 30 CPDFSDK_Annot* pAnnot); | |
| 31 virtual void OnDraw(CPDFSDK_PageView* pPageView, | |
| 32 CPDFSDK_Annot* pAnnot, | |
| 33 CFX_RenderDevice* pDevice, | |
| 34 CFX_Matrix* pUser2Device, | |
| 35 FX_DWORD dwFlags); | |
| 36 | |
| 37 virtual void OnCreate(CPDFSDK_Annot* pAnnot); | |
| 38 virtual void OnLoad(CPDFSDK_Annot* pAnnot); | |
| 39 virtual void OnDelete(CPDFSDK_Annot* pAnnot); | |
| 40 | |
| 41 virtual void OnMouseEnter(CPDFSDK_PageView* pPageView, | |
| 42 CPDFSDK_Annot* pAnnot, | |
| 43 FX_UINT nFlag); | |
| 44 virtual void OnMouseExit(CPDFSDK_PageView* pPageView, | |
| 45 CPDFSDK_Annot* pAnnot, | |
| 46 FX_UINT nFlag); | |
| 47 | |
| 48 virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView, | |
| 49 CPDFSDK_Annot* pAnnot, | |
| 50 FX_UINT nFlags, | |
| 51 const CFX_FloatPoint& point); | |
| 52 virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView, | |
| 53 CPDFSDK_Annot* pAnnot, | |
| 54 FX_UINT nFlags, | |
| 55 const CFX_FloatPoint& point); | |
| 56 virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView, | |
| 57 CPDFSDK_Annot* pAnnot, | |
| 58 FX_UINT nFlags, | |
| 59 const CFX_FloatPoint& point); | |
| 60 virtual FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView, | |
| 61 CPDFSDK_Annot* pAnnot, | |
| 62 FX_UINT nFlags, | |
| 63 const CFX_FloatPoint& point); | |
| 64 virtual FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView, | |
| 65 CPDFSDK_Annot* pAnnot, | |
| 66 FX_UINT nFlags, | |
| 67 short zDelta, | |
| 68 const CFX_FloatPoint& point); | |
| 69 virtual FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView, | |
| 70 CPDFSDK_Annot* pAnnot, | |
| 71 FX_UINT nFlags, | |
| 72 const CFX_FloatPoint& point); | |
| 73 virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView, | |
| 74 CPDFSDK_Annot* pAnnot, | |
| 75 FX_UINT nFlags, | |
| 76 const CFX_FloatPoint& point); | |
| 77 | |
| 78 virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, | |
| 79 FX_UINT nKeyCode, | |
| 80 FX_UINT nFlags); | |
| 81 virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags); | |
| 82 | |
| 83 virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag); | |
| 84 virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag); | |
| 85 | |
| 86 CFFL_FormFiller* GetFormFiller(CPDFSDK_Annot* pAnnot, FX_BOOL bRegister); | |
| 87 void RemoveFormFiller(CPDFSDK_Annot* pAnnot); | |
| 88 | |
| 89 static FX_BOOL IsVisible(CPDFSDK_Widget* pWidget); | |
| 90 static FX_BOOL IsReadOnly(CPDFSDK_Widget* pWidget); | |
| 91 static FX_BOOL IsFillingAllowed(CPDFSDK_Widget* pWidget); | |
| 92 static FX_BOOL IsValidAnnot(CPDFSDK_PageView* pPageView, | |
| 93 CPDFSDK_Annot* pAnnot); | |
| 94 | |
| 95 void OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, | |
| 96 CPDFSDK_PageView* pPageView, | |
| 97 FX_BOOL& bRC, | |
| 98 FX_BOOL& bExit, | |
| 99 FX_DWORD nFlag); | |
| 100 void OnValidate(CPDFSDK_Widget* pWidget, | |
| 101 CPDFSDK_PageView* pPageView, | |
| 102 FX_BOOL& bRC, | |
| 103 FX_BOOL& bExit, | |
| 104 FX_DWORD nFlag); | |
| 105 | |
| 106 void OnCalculate(CPDFSDK_Widget* pWidget, | |
| 107 CPDFSDK_PageView* pPageView, | |
| 108 FX_BOOL& bExit, | |
| 109 FX_DWORD nFlag); | |
| 110 void OnFormat(CPDFSDK_Widget* pWidget, | |
| 111 CPDFSDK_PageView* pPageView, | |
| 112 FX_BOOL& bExit, | |
| 113 FX_DWORD nFlag); | |
| 114 void OnButtonUp(CPDFSDK_Widget* pWidget, | |
| 115 CPDFSDK_PageView* pPageView, | |
| 116 FX_BOOL& bReset, | |
| 117 FX_BOOL& bExit, | |
| 118 FX_UINT nFlag); | |
| 119 #ifdef PDF_ENABLE_XFA | |
| 120 void OnClick(CPDFSDK_Widget* pWidget, | |
| 121 CPDFSDK_PageView* pPageView, | |
| 122 FX_BOOL& bReset, | |
| 123 FX_BOOL& bExit, | |
| 124 FX_UINT nFlag); | |
| 125 void OnFull(CPDFSDK_Widget* pWidget, | |
| 126 CPDFSDK_PageView* pPageView, | |
| 127 FX_BOOL& bReset, | |
| 128 FX_BOOL& bExit, | |
| 129 FX_UINT nFlag); | |
| 130 void OnPreOpen(CPDFSDK_Widget* pWidget, | |
| 131 CPDFSDK_PageView* pPageView, | |
| 132 FX_BOOL& bReset, | |
| 133 FX_BOOL& bExit, | |
| 134 FX_UINT nFlag); | |
| 135 void OnPostOpen(CPDFSDK_Widget* pWidget, | |
| 136 CPDFSDK_PageView* pPageView, | |
| 137 FX_BOOL& bReset, | |
| 138 FX_BOOL& bExit, | |
| 139 FX_UINT nFlag); | |
| 140 #endif // PDF_ENABLE_XFA | |
| 141 | |
| 142 private: | |
| 143 using CFFL_Widget2Filler = std::map<CPDFSDK_Annot*, CFFL_FormFiller*>; | |
| 144 | |
| 145 // IPWL_Filler_Notify: | |
| 146 void QueryWherePopup(void* pPrivateData, | |
| 147 FX_FLOAT fPopupMin, | |
| 148 FX_FLOAT fPopupMax, | |
| 149 int32_t& nRet, | |
| 150 FX_FLOAT& fPopupRet) override; | |
| 151 void OnBeforeKeyStroke(void* pPrivateData, | |
| 152 CFX_WideString& strChange, | |
| 153 const CFX_WideString& strChangeEx, | |
| 154 int nSelStart, | |
| 155 int nSelEnd, | |
| 156 FX_BOOL bKeyDown, | |
| 157 FX_BOOL& bRC, | |
| 158 FX_BOOL& bExit, | |
| 159 FX_DWORD nFlag) override; | |
| 160 #ifdef PDF_ENABLE_XFA | |
| 161 void OnPopupPreOpen(void* pPrivateData, | |
| 162 FX_BOOL& bExit, | |
| 163 FX_DWORD nFlag) override; | |
| 164 void OnPopupPostOpen(void* pPrivateData, | |
| 165 FX_BOOL& bExit, | |
| 166 FX_DWORD nFlag) override; | |
| 167 void SetFocusAnnotTab(CPDFSDK_Annot* pWidget, | |
| 168 FX_BOOL bSameField, | |
| 169 FX_BOOL bNext); | |
| 170 #endif // PDF_ENABLE_XFA | |
| 171 void UnRegisterFormFiller(CPDFSDK_Annot* pAnnot); | |
| 172 | |
| 173 CPDFDoc_Environment* m_pApp; | |
| 174 CFFL_Widget2Filler m_Maps; | |
| 175 FX_BOOL m_bNotifying; | |
| 176 }; | |
| 177 | |
| 178 class CFFL_PrivateData { | |
| 179 public: | |
| 180 CPDFSDK_Widget* pWidget; | |
| 181 CPDFSDK_PageView* pPageView; | |
| 182 int nWidgetAge; | |
| 183 int nValueAge; | |
| 184 }; | |
| 185 | |
| 186 #endif // FPDFSDK_INCLUDE_FORMFILLER_FFL_IFORMFILLER_H_ | |
| OLD | NEW |