jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 1 | // Copyright 2016 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 | |
dsinclair | 114e46a | 2016-09-29 17:18:21 -0700 | [diff] [blame] | 7 | #ifndef FPDFSDK_CPDFSDK_XFAWIDGETHANDLER_H_ |
| 8 | #define FPDFSDK_CPDFSDK_XFAWIDGETHANDLER_H_ |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 9 | |
dsinclair | a52ab74 | 2016-09-29 13:59:29 -0700 | [diff] [blame] | 10 | #include "core/fxcrt/fx_basic.h" |
| 11 | #include "core/fxcrt/fx_coordinates.h" |
dsinclair | 114e46a | 2016-09-29 17:18:21 -0700 | [diff] [blame] | 12 | #include "fpdfsdk/ipdfsdk_annothandler.h" |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 13 | |
| 14 | class CFX_Matrix; |
| 15 | class CFX_RenderDevice; |
| 16 | class CPDF_Annot; |
dsinclair | 735606d | 2016-10-05 15:47:02 -0700 | [diff] [blame] | 17 | class CPDFSDK_FormFillEnvironment; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 18 | class CPDFSDK_Annot; |
| 19 | class CPDFSDK_PageView; |
| 20 | class CXFA_FFWidget; |
| 21 | class CXFA_FFWidgetHandler; |
| 22 | |
jaepark | 8c54182 | 2016-08-30 13:43:05 -0700 | [diff] [blame] | 23 | class CPDFSDK_XFAWidgetHandler : public IPDFSDK_AnnotHandler { |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 24 | public: |
dsinclair | 735606d | 2016-10-05 15:47:02 -0700 | [diff] [blame] | 25 | explicit CPDFSDK_XFAWidgetHandler(CPDFSDK_FormFillEnvironment* pApp); |
jaepark | 8c54182 | 2016-08-30 13:43:05 -0700 | [diff] [blame] | 26 | ~CPDFSDK_XFAWidgetHandler() override; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 27 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 28 | bool CanAnswer(CPDFSDK_Annot* pAnnot) override; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 29 | CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) override; |
| 30 | CPDFSDK_Annot* NewAnnot(CXFA_FFWidget* pAnnot, |
| 31 | CPDFSDK_PageView* pPage) override; |
| 32 | void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 33 | CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView, |
| 34 | CPDFSDK_Annot* pAnnot) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 35 | bool HitTest(CPDFSDK_PageView* pPageView, |
| 36 | CPDFSDK_Annot* pAnnot, |
dsinclair | 92a32db | 2017-02-14 14:58:49 +0000 | [diff] [blame] | 37 | const CFX_FloatPoint& point) override; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 38 | void OnDraw(CPDFSDK_PageView* pPageView, |
| 39 | CPDFSDK_Annot* pAnnot, |
| 40 | CFX_RenderDevice* pDevice, |
jaepark | 75f84a5 | 2016-09-09 15:39:09 -0700 | [diff] [blame] | 41 | CFX_Matrix* pUser2Device, |
| 42 | bool bDrawAnnots) override; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 43 | void OnLoad(CPDFSDK_Annot* pAnnot) override; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 44 | void OnMouseEnter(CPDFSDK_PageView* pPageView, |
tsepez | f8074ce | 2016-09-27 14:29:57 -0700 | [diff] [blame] | 45 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 46 | uint32_t nFlag) override; |
| 47 | void OnMouseExit(CPDFSDK_PageView* pPageView, |
tsepez | f8074ce | 2016-09-27 14:29:57 -0700 | [diff] [blame] | 48 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 49 | uint32_t nFlag) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 50 | bool OnLButtonDown(CPDFSDK_PageView* pPageView, |
| 51 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 52 | uint32_t nFlags, |
dsinclair | 92a32db | 2017-02-14 14:58:49 +0000 | [diff] [blame] | 53 | const CFX_FloatPoint& point) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 54 | bool OnLButtonUp(CPDFSDK_PageView* pPageView, |
| 55 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 56 | uint32_t nFlags, |
dsinclair | 92a32db | 2017-02-14 14:58:49 +0000 | [diff] [blame] | 57 | const CFX_FloatPoint& point) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 58 | bool OnLButtonDblClk(CPDFSDK_PageView* pPageView, |
tsepez | f8074ce | 2016-09-27 14:29:57 -0700 | [diff] [blame] | 59 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 60 | uint32_t nFlags, |
dsinclair | 92a32db | 2017-02-14 14:58:49 +0000 | [diff] [blame] | 61 | const CFX_FloatPoint& point) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 62 | bool OnMouseMove(CPDFSDK_PageView* pPageView, |
| 63 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 64 | uint32_t nFlags, |
dsinclair | 92a32db | 2017-02-14 14:58:49 +0000 | [diff] [blame] | 65 | const CFX_FloatPoint& point) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 66 | bool OnMouseWheel(CPDFSDK_PageView* pPageView, |
| 67 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 68 | uint32_t nFlags, |
| 69 | short zDelta, |
dsinclair | 92a32db | 2017-02-14 14:58:49 +0000 | [diff] [blame] | 70 | const CFX_FloatPoint& point) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 71 | bool OnRButtonDown(CPDFSDK_PageView* pPageView, |
| 72 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 73 | uint32_t nFlags, |
dsinclair | 92a32db | 2017-02-14 14:58:49 +0000 | [diff] [blame] | 74 | const CFX_FloatPoint& point) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 75 | bool OnRButtonUp(CPDFSDK_PageView* pPageView, |
| 76 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 77 | uint32_t nFlags, |
dsinclair | 92a32db | 2017-02-14 14:58:49 +0000 | [diff] [blame] | 78 | const CFX_FloatPoint& point) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 79 | bool OnRButtonDblClk(CPDFSDK_PageView* pPageView, |
| 80 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 81 | uint32_t nFlags, |
dsinclair | 92a32db | 2017-02-14 14:58:49 +0000 | [diff] [blame] | 82 | const CFX_FloatPoint& point) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 83 | bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override; |
| 84 | bool OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; |
| 85 | bool OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; |
| 86 | bool OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) override; |
| 87 | bool OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) override; |
| 88 | bool OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot, |
| 89 | CPDFSDK_Annot::ObservedPtr* pNewAnnot) override; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 90 | |
| 91 | private: |
| 92 | CXFA_FFWidgetHandler* GetXFAWidgetHandler(CPDFSDK_Annot* pAnnot); |
| 93 | uint32_t GetFWLFlags(uint32_t dwFlag); |
| 94 | |
dsinclair | 8779fa8 | 2016-10-12 12:05:44 -0700 | [diff] [blame] | 95 | CPDFSDK_FormFillEnvironment* m_pFormFillEnv; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 96 | }; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 97 | |
dsinclair | 114e46a | 2016-09-29 17:18:21 -0700 | [diff] [blame] | 98 | #endif // FPDFSDK_CPDFSDK_XFAWIDGETHANDLER_H_ |