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_coordinates.h" |
Dan Sinclair | aee0db0 | 2017-09-21 16:53:58 -0400 | [diff] [blame] | 11 | #include "core/fxcrt/unowned_ptr.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; |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 35 | WideString GetSelectedText(CPDFSDK_Annot* pAnnot) override; |
| 36 | void ReplaceSelection(CPDFSDK_Annot* pAnnot, const WideString& text) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 37 | bool HitTest(CPDFSDK_PageView* pPageView, |
| 38 | CPDFSDK_Annot* pAnnot, |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 39 | const CFX_PointF& point) override; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 40 | void OnDraw(CPDFSDK_PageView* pPageView, |
| 41 | CPDFSDK_Annot* pAnnot, |
| 42 | CFX_RenderDevice* pDevice, |
jaepark | 75f84a5 | 2016-09-09 15:39:09 -0700 | [diff] [blame] | 43 | CFX_Matrix* pUser2Device, |
| 44 | bool bDrawAnnots) override; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 45 | void OnLoad(CPDFSDK_Annot* pAnnot) override; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 46 | void OnMouseEnter(CPDFSDK_PageView* pPageView, |
tsepez | f8074ce | 2016-09-27 14:29:57 -0700 | [diff] [blame] | 47 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 48 | uint32_t nFlag) override; |
| 49 | void OnMouseExit(CPDFSDK_PageView* pPageView, |
tsepez | f8074ce | 2016-09-27 14:29:57 -0700 | [diff] [blame] | 50 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 51 | uint32_t nFlag) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 52 | bool OnLButtonDown(CPDFSDK_PageView* pPageView, |
| 53 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 54 | uint32_t nFlags, |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 55 | const CFX_PointF& point) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 56 | bool OnLButtonUp(CPDFSDK_PageView* pPageView, |
| 57 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 58 | uint32_t nFlags, |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 59 | const CFX_PointF& point) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 60 | bool OnLButtonDblClk(CPDFSDK_PageView* pPageView, |
tsepez | f8074ce | 2016-09-27 14:29:57 -0700 | [diff] [blame] | 61 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 62 | uint32_t nFlags, |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 63 | const CFX_PointF& point) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 64 | bool OnMouseMove(CPDFSDK_PageView* pPageView, |
| 65 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 66 | uint32_t nFlags, |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 67 | const CFX_PointF& point) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 68 | bool OnMouseWheel(CPDFSDK_PageView* pPageView, |
| 69 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 70 | uint32_t nFlags, |
| 71 | short zDelta, |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 72 | const CFX_PointF& point) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 73 | bool OnRButtonDown(CPDFSDK_PageView* pPageView, |
| 74 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 75 | uint32_t nFlags, |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 76 | const CFX_PointF& point) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 77 | bool OnRButtonUp(CPDFSDK_PageView* pPageView, |
| 78 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 79 | uint32_t nFlags, |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 80 | const CFX_PointF& point) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 81 | bool OnRButtonDblClk(CPDFSDK_PageView* pPageView, |
| 82 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 83 | uint32_t nFlags, |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 84 | const CFX_PointF& point) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 85 | bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override; |
| 86 | bool OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; |
| 87 | bool OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; |
| 88 | bool OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) override; |
| 89 | bool OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) override; |
| 90 | bool OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot, |
| 91 | CPDFSDK_Annot::ObservedPtr* pNewAnnot) override; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 92 | |
| 93 | private: |
| 94 | CXFA_FFWidgetHandler* GetXFAWidgetHandler(CPDFSDK_Annot* pAnnot); |
| 95 | uint32_t GetFWLFlags(uint32_t dwFlag); |
| 96 | |
Dan Sinclair | aee0db0 | 2017-09-21 16:53:58 -0400 | [diff] [blame] | 97 | UnownedPtr<CPDFSDK_FormFillEnvironment> const m_pFormFillEnv; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 98 | }; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 99 | |
dsinclair | 114e46a | 2016-09-29 17:18:21 -0700 | [diff] [blame] | 100 | #endif // FPDFSDK_CPDFSDK_XFAWIDGETHANDLER_H_ |