| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef FPDFSDK_FORMFILLER_CFFL_FORMFILLER_H_ | 7 #ifndef FPDFSDK_FORMFILLER_CFFL_FORMFILLER_H_ |
| 8 #define FPDFSDK_FORMFILLER_CFFL_FORMFILLER_H_ | 8 #define FPDFSDK_FORMFILLER_CFFL_FORMFILLER_H_ |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 | 11 |
| 12 #include "fpdfsdk/formfiller/cba_fontmap.h" | 12 #include "fpdfsdk/formfiller/cba_fontmap.h" |
| 13 #include "fpdfsdk/formfiller/cffl_iformfiller.h" | 13 #include "fpdfsdk/formfiller/cffl_iformfiller.h" |
| 14 #include "fpdfsdk/include/pdfsdk_fieldaction.h" | 14 #include "fpdfsdk/include/pdfsdk_fieldaction.h" |
| 15 | 15 |
| 16 class CPDFSDK_Annot; | 16 class CPDFSDK_Annot; |
| 17 class CPDFSDK_Environment; | 17 class CPDFSDK_Environment; |
| 18 class CPDFSDK_PageView; | 18 class CPDFSDK_PageView; |
| 19 class CPDFSDK_Widget; | 19 class CPDFSDK_Widget; |
| 20 | 20 |
| 21 class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler { | 21 class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler { |
| 22 public: | 22 public: |
| 23 CFFL_FormFiller(CPDFSDK_Environment* pApp, CPDFSDK_Annot* pAnnot); | 23 CFFL_FormFiller(CPDFSDK_Environment* pEnv, CPDFSDK_Annot* pAnnot); |
| 24 ~CFFL_FormFiller() override; | 24 ~CFFL_FormFiller() override; |
| 25 | 25 |
| 26 virtual FX_RECT GetViewBBox(CPDFSDK_PageView* pPageView, | 26 virtual FX_RECT GetViewBBox(CPDFSDK_PageView* pPageView, |
| 27 CPDFSDK_Annot* pAnnot); | 27 CPDFSDK_Annot* pAnnot); |
| 28 virtual void OnDraw(CPDFSDK_PageView* pPageView, | 28 virtual void OnDraw(CPDFSDK_PageView* pPageView, |
| 29 CPDFSDK_Annot* pAnnot, | 29 CPDFSDK_Annot* pAnnot, |
| 30 CFX_RenderDevice* pDevice, | 30 CFX_RenderDevice* pDevice, |
| 31 CFX_Matrix* pUser2Device); | 31 CFX_Matrix* pUser2Device); |
| 32 virtual void OnDrawDeactive(CPDFSDK_PageView* pPageView, | 32 virtual void OnDrawDeactive(CPDFSDK_PageView* pPageView, |
| 33 CPDFSDK_Annot* pAnnot, | 33 CPDFSDK_Annot* pAnnot, |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 FX_BOOL IsValid() const; | 141 FX_BOOL IsValid() const; |
| 142 CFX_FloatRect GetPDFWindowRect() const; | 142 CFX_FloatRect GetPDFWindowRect() const; |
| 143 | 143 |
| 144 CPDFSDK_PageView* GetCurPageView(bool renew); | 144 CPDFSDK_PageView* GetCurPageView(bool renew); |
| 145 void SetChangeMark(); | 145 void SetChangeMark(); |
| 146 | 146 |
| 147 virtual void InvalidateRect(double left, | 147 virtual void InvalidateRect(double left, |
| 148 double top, | 148 double top, |
| 149 double right, | 149 double right, |
| 150 double bottom); | 150 double bottom); |
| 151 CPDFSDK_Environment* GetApp() { return m_pApp; } | |
| 152 CPDFSDK_Annot* GetSDKAnnot() { return m_pAnnot; } | 151 CPDFSDK_Annot* GetSDKAnnot() { return m_pAnnot; } |
| 153 | 152 |
| 154 protected: | 153 protected: |
| 155 using CFFL_PageView2PDFWindow = std::map<CPDFSDK_PageView*, CPWL_Wnd*>; | 154 using CFFL_PageView2PDFWindow = std::map<CPDFSDK_PageView*, CPWL_Wnd*>; |
| 156 | 155 |
| 157 // If the inheriting widget has its own fontmap and a PWL_Edit widget that | 156 // If the inheriting widget has its own fontmap and a PWL_Edit widget that |
| 158 // access that fontmap then you have to call DestroyWindows before destroying | 157 // access that fontmap then you have to call DestroyWindows before destroying |
| 159 // the font map in order to not get a use-after-free. | 158 // the font map in order to not get a use-after-free. |
| 160 // | 159 // |
| 161 // The font map should be stored somewhere more appropriate so it will live | 160 // The font map should be stored somewhere more appropriate so it will live |
| 162 // until the PWL_Edit is done with it. pdfium:566 | 161 // until the PWL_Edit is done with it. pdfium:566 |
| 163 void DestroyWindows(); | 162 void DestroyWindows(); |
| 164 | 163 |
| 165 CPDFSDK_Environment* m_pApp; | 164 CPDFSDK_Environment* m_pEnv; |
| 166 CPDFSDK_Widget* m_pWidget; | 165 CPDFSDK_Widget* m_pWidget; |
| 167 CPDFSDK_Annot* m_pAnnot; | 166 CPDFSDK_Annot* m_pAnnot; |
| 168 | 167 |
| 169 FX_BOOL m_bValid; | 168 FX_BOOL m_bValid; |
| 170 CFFL_PageView2PDFWindow m_Maps; | 169 CFFL_PageView2PDFWindow m_Maps; |
| 171 CFX_FloatPoint m_ptOldPos; | 170 CFX_FloatPoint m_ptOldPos; |
| 172 }; | 171 }; |
| 173 | 172 |
| 174 class CFFL_Button : public CFFL_FormFiller { | 173 class CFFL_Button : public CFFL_FormFiller { |
| 175 public: | 174 public: |
| 176 CFFL_Button(CPDFSDK_Environment* pApp, CPDFSDK_Annot* pWidget); | 175 CFFL_Button(CPDFSDK_Environment* pEnv, CPDFSDK_Annot* pWidget); |
| 177 ~CFFL_Button() override; | 176 ~CFFL_Button() override; |
| 178 | 177 |
| 179 // CFFL_FormFiller | 178 // CFFL_FormFiller |
| 180 void OnMouseEnter(CPDFSDK_PageView* pPageView, | 179 void OnMouseEnter(CPDFSDK_PageView* pPageView, |
| 181 CPDFSDK_Annot* pAnnot) override; | 180 CPDFSDK_Annot* pAnnot) override; |
| 182 void OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) override; | 181 void OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) override; |
| 183 FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView, | 182 FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView, |
| 184 CPDFSDK_Annot* pAnnot, | 183 CPDFSDK_Annot* pAnnot, |
| 185 uint32_t nFlags, | 184 uint32_t nFlags, |
| 186 const CFX_FloatPoint& point) override; | 185 const CFX_FloatPoint& point) override; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 200 CPDFSDK_Annot* pAnnot, | 199 CPDFSDK_Annot* pAnnot, |
| 201 CFX_RenderDevice* pDevice, | 200 CFX_RenderDevice* pDevice, |
| 202 CFX_Matrix* pUser2Device) override; | 201 CFX_Matrix* pUser2Device) override; |
| 203 | 202 |
| 204 protected: | 203 protected: |
| 205 FX_BOOL m_bMouseIn; | 204 FX_BOOL m_bMouseIn; |
| 206 FX_BOOL m_bMouseDown; | 205 FX_BOOL m_bMouseDown; |
| 207 }; | 206 }; |
| 208 | 207 |
| 209 #endif // FPDFSDK_FORMFILLER_CFFL_FORMFILLER_H_ | 208 #endif // FPDFSDK_FORMFILLER_CFFL_FORMFILLER_H_ |
| OLD | NEW |