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