| 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_FORMFILLER_H_ | |
| 8 #define FPDFSDK_INCLUDE_FORMFILLER_FFL_FORMFILLER_H_ | |
| 9 | |
| 10 #include <map> | |
| 11 | |
| 12 #include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h" | |
| 13 #include "fpdfsdk/include/formfiller/FFL_IFormFiller.h" | |
| 14 #include "fpdfsdk/include/fsdk_baseform.h" | |
| 15 | |
| 16 class CPDFDoc_Environment; | |
| 17 class CPDFSDK_Annot; | |
| 18 class CPDFSDK_PageView; | |
| 19 class CPDFSDK_Widget; | |
| 20 | |
| 21 class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler { | |
| 22 public: | |
| 23 CFFL_FormFiller(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot); | |
| 24 ~CFFL_FormFiller() override; | |
| 25 | |
| 26 virtual FX_RECT GetViewBBox(CPDFSDK_PageView* pPageView, | |
| 27 CPDFSDK_Annot* pAnnot); | |
| 28 virtual void OnDraw(CPDFSDK_PageView* pPageView, | |
| 29 CPDFSDK_Annot* pAnnot, | |
| 30 CFX_RenderDevice* pDevice, | |
| 31 CFX_Matrix* pUser2Device, | |
| 32 FX_DWORD dwFlags); | |
| 33 virtual void OnDrawDeactive(CPDFSDK_PageView* pPageView, | |
| 34 CPDFSDK_Annot* pAnnot, | |
| 35 CFX_RenderDevice* pDevice, | |
| 36 CFX_Matrix* pUser2Device, | |
| 37 FX_DWORD dwFlags); | |
| 38 | |
| 39 virtual void OnCreate(CPDFSDK_Annot* pAnnot); | |
| 40 virtual void OnLoad(CPDFSDK_Annot* pAnnot); | |
| 41 virtual void OnDelete(CPDFSDK_Annot* pAnnot); | |
| 42 | |
| 43 virtual void OnMouseEnter(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot); | |
| 44 virtual void OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot); | |
| 45 | |
| 46 virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView, | |
| 47 CPDFSDK_Annot* pAnnot, | |
| 48 FX_UINT nFlags, | |
| 49 const CFX_FloatPoint& point); | |
| 50 virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView, | |
| 51 CPDFSDK_Annot* pAnnot, | |
| 52 FX_UINT nFlags, | |
| 53 const CFX_FloatPoint& point); | |
| 54 virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView, | |
| 55 CPDFSDK_Annot* pAnnot, | |
| 56 FX_UINT nFlags, | |
| 57 const CFX_FloatPoint& point); | |
| 58 virtual FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView, | |
| 59 CPDFSDK_Annot* pAnnot, | |
| 60 FX_UINT nFlags, | |
| 61 const CFX_FloatPoint& point); | |
| 62 virtual FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView, | |
| 63 CPDFSDK_Annot* pAnnot, | |
| 64 FX_UINT nFlags, | |
| 65 short zDelta, | |
| 66 const CFX_FloatPoint& point); | |
| 67 virtual FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView, | |
| 68 CPDFSDK_Annot* pAnnot, | |
| 69 FX_UINT nFlags, | |
| 70 const CFX_FloatPoint& point); | |
| 71 virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView, | |
| 72 CPDFSDK_Annot* pAnnot, | |
| 73 FX_UINT nFlags, | |
| 74 const CFX_FloatPoint& point); | |
| 75 | |
| 76 virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, | |
| 77 FX_UINT nKeyCode, | |
| 78 FX_UINT nFlags); | |
| 79 virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags); | |
| 80 | |
| 81 void SetFocusForAnnot(CPDFSDK_Annot* pAnnot, FX_UINT nFlag); | |
| 82 void KillFocusForAnnot(CPDFSDK_Annot* pAnnot, FX_UINT nFlag); | |
| 83 | |
| 84 // CPWL_TimerHandler | |
| 85 void TimerProc() override; | |
| 86 IFX_SystemHandler* GetSystemHandler() const override; | |
| 87 | |
| 88 // IPWL_Provider | |
| 89 CFX_Matrix GetWindowMatrix(void* pAttachedData) override; | |
| 90 CFX_WideString LoadPopupMenuString(int nIndex) override; | |
| 91 | |
| 92 virtual void GetActionData(CPDFSDK_PageView* pPageView, | |
| 93 CPDF_AAction::AActionType type, | |
| 94 PDFSDK_FieldAction& fa); | |
| 95 virtual void SetActionData(CPDFSDK_PageView* pPageView, | |
| 96 CPDF_AAction::AActionType type, | |
| 97 const PDFSDK_FieldAction& fa); | |
| 98 virtual FX_BOOL IsActionDataChanged(CPDF_AAction::AActionType type, | |
| 99 const PDFSDK_FieldAction& faOld, | |
| 100 const PDFSDK_FieldAction& faNew); | |
| 101 | |
| 102 virtual void SaveState(CPDFSDK_PageView* pPageView); | |
| 103 virtual void RestoreState(CPDFSDK_PageView* pPageView); | |
| 104 | |
| 105 virtual CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView, | |
| 106 FX_BOOL bRestoreValue); | |
| 107 | |
| 108 CFX_Matrix GetCurMatrix(); | |
| 109 | |
| 110 CFX_FloatRect FFLtoPWL(const CFX_FloatRect& rect); | |
| 111 CFX_FloatRect PWLtoFFL(const CFX_FloatRect& rect); | |
| 112 CFX_FloatPoint FFLtoPWL(const CFX_FloatPoint& point); | |
| 113 CFX_FloatPoint PWLtoFFL(const CFX_FloatPoint& point); | |
| 114 | |
| 115 CFX_FloatPoint WndtoPWL(CPDFSDK_PageView* pPageView, | |
| 116 const CFX_FloatPoint& pt); | |
| 117 CFX_FloatRect FFLtoWnd(CPDFSDK_PageView* pPageView, | |
| 118 const CFX_FloatRect& rect); | |
| 119 | |
| 120 void SetWindowRect(CPDFSDK_PageView* pPageView, | |
| 121 const CFX_FloatRect& rcWindow); | |
| 122 CFX_FloatRect GetWindowRect(CPDFSDK_PageView* pPageView); | |
| 123 | |
| 124 FX_BOOL CommitData(CPDFSDK_PageView* pPageView, FX_UINT nFlag); | |
| 125 virtual FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView); | |
| 126 virtual void SaveData(CPDFSDK_PageView* pPageView); | |
| 127 | |
| 128 #ifdef PDF_ENABLE_XFA | |
| 129 virtual FX_BOOL IsFieldFull(CPDFSDK_PageView* pPageView); | |
| 130 #endif // PDF_ENABLE_XFA | |
| 131 | |
| 132 CPWL_Wnd* GetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bNew); | |
| 133 void DestroyPDFWindow(CPDFSDK_PageView* pPageView); | |
| 134 void EscapeFiller(CPDFSDK_PageView* pPageView, FX_BOOL bDestroyPDFWindow); | |
| 135 | |
| 136 virtual PWL_CREATEPARAM GetCreateParam(); | |
| 137 virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, | |
| 138 CPDFSDK_PageView* pPageView) = 0; | |
| 139 virtual CFX_FloatRect GetFocusBox(CPDFSDK_PageView* pPageView); | |
| 140 | |
| 141 FX_BOOL IsValid() const; | |
| 142 CFX_FloatRect GetPDFWindowRect() const; | |
| 143 | |
| 144 CPDFSDK_PageView* GetCurPageView(); | |
| 145 void SetChangeMark(); | |
| 146 | |
| 147 virtual void InvalidateRect(double left, | |
| 148 double top, | |
| 149 double right, | |
| 150 double bottom); | |
| 151 CPDFDoc_Environment* GetApp() { return m_pApp; } | |
| 152 CPDFSDK_Annot* GetSDKAnnot() { return m_pAnnot; } | |
| 153 | |
| 154 protected: | |
| 155 using CFFL_PageView2PDFWindow = std::map<CPDFSDK_PageView*, CPWL_Wnd*>; | |
| 156 | |
| 157 CPDFDoc_Environment* m_pApp; | |
| 158 CPDFSDK_Widget* m_pWidget; | |
| 159 CPDFSDK_Annot* m_pAnnot; | |
| 160 | |
| 161 FX_BOOL m_bValid; | |
| 162 CFFL_PageView2PDFWindow m_Maps; | |
| 163 CFX_FloatPoint m_ptOldPos; | |
| 164 }; | |
| 165 | |
| 166 class CFFL_Button : public CFFL_FormFiller { | |
| 167 public: | |
| 168 CFFL_Button(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget); | |
| 169 ~CFFL_Button() override; | |
| 170 | |
| 171 // CFFL_FormFiller | |
| 172 void OnMouseEnter(CPDFSDK_PageView* pPageView, | |
| 173 CPDFSDK_Annot* pAnnot) override; | |
| 174 void OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) override; | |
| 175 FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView, | |
| 176 CPDFSDK_Annot* pAnnot, | |
| 177 FX_UINT nFlags, | |
| 178 const CFX_FloatPoint& point) override; | |
| 179 FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView, | |
| 180 CPDFSDK_Annot* pAnnot, | |
| 181 FX_UINT nFlags, | |
| 182 const CFX_FloatPoint& point) override; | |
| 183 FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView, | |
| 184 CPDFSDK_Annot* pAnnot, | |
| 185 FX_UINT nFlags, | |
| 186 const CFX_FloatPoint& point) override; | |
| 187 void OnDraw(CPDFSDK_PageView* pPageView, | |
| 188 CPDFSDK_Annot* pAnnot, | |
| 189 CFX_RenderDevice* pDevice, | |
| 190 CFX_Matrix* pUser2Device, | |
| 191 FX_DWORD dwFlags) override; | |
| 192 void OnDrawDeactive(CPDFSDK_PageView* pPageView, | |
| 193 CPDFSDK_Annot* pAnnot, | |
| 194 CFX_RenderDevice* pDevice, | |
| 195 CFX_Matrix* pUser2Device, | |
| 196 FX_DWORD dwFlags) override; | |
| 197 | |
| 198 protected: | |
| 199 FX_BOOL m_bMouseIn; | |
| 200 FX_BOOL m_bMouseDown; | |
| 201 }; | |
| 202 | |
| 203 #endif // FPDFSDK_INCLUDE_FORMFILLER_FFL_FORMFILLER_H_ | |
| OLD | NEW |