blob: 4e8c9ef480a2d3fd51b234e42f8c8a8a3aa59377 [file] [log] [blame]
jaepark98e10192016-08-15 10:51:11 -07001// 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
dsinclair114e46a2016-09-29 17:18:21 -07007#ifndef FPDFSDK_CPDFSDK_WIDGETHANDLER_H_
8#define FPDFSDK_CPDFSDK_WIDGETHANDLER_H_
jaepark98e10192016-08-15 10:51:11 -07009
Tom Sepez940967d2017-05-18 12:32:20 -070010#include "core/fxcrt/cfx_unowned_ptr.h"
dsinclaira52ab742016-09-29 13:59:29 -070011#include "core/fxcrt/fx_basic.h"
12#include "core/fxcrt/fx_coordinates.h"
dsinclair114e46a2016-09-29 17:18:21 -070013#include "fpdfsdk/ipdfsdk_annothandler.h"
jaepark98e10192016-08-15 10:51:11 -070014
dsinclairb94d7c92016-09-21 12:07:00 -070015class CFFL_InteractiveFormFiller;
jaepark98e10192016-08-15 10:51:11 -070016class CFX_Matrix;
17class CFX_RenderDevice;
18class CPDF_Annot;
jaepark98e10192016-08-15 10:51:11 -070019class CPDFSDK_Annot;
dsinclair735606d2016-10-05 15:47:02 -070020class CPDFSDK_FormFillEnvironment;
jaepark98e10192016-08-15 10:51:11 -070021class CPDFSDK_PageView;
22
23#ifdef PDF_ENABLE_XFA
24class CXFA_FFWidget;
25#endif // PDF_ENABLE_XFA
26
jaepark8c541822016-08-30 13:43:05 -070027class CPDFSDK_WidgetHandler : public IPDFSDK_AnnotHandler {
jaepark98e10192016-08-15 10:51:11 -070028 public:
dsinclair735606d2016-10-05 15:47:02 -070029 explicit CPDFSDK_WidgetHandler(CPDFSDK_FormFillEnvironment* pApp);
jaepark8c541822016-08-30 13:43:05 -070030 ~CPDFSDK_WidgetHandler() override;
jaepark98e10192016-08-15 10:51:11 -070031
tsepez4cf55152016-11-02 14:37:54 -070032 bool CanAnswer(CPDFSDK_Annot* pAnnot) override;
jaepark98e10192016-08-15 10:51:11 -070033 CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) override;
34#ifdef PDF_ENABLE_XFA
35 CPDFSDK_Annot* NewAnnot(CXFA_FFWidget* hWidget,
36 CPDFSDK_PageView* pPage) override;
37#endif // PDF_ENABLE_XFA
38 void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override;
jaepark98e10192016-08-15 10:51:11 -070039 CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView,
40 CPDFSDK_Annot* pAnnot) override;
tsepez4cf55152016-11-02 14:37:54 -070041 bool HitTest(CPDFSDK_PageView* pPageView,
42 CPDFSDK_Annot* pAnnot,
Dan Sinclairf528eee2017-02-14 11:52:07 -050043 const CFX_PointF& point) override;
jaepark98e10192016-08-15 10:51:11 -070044 void OnDraw(CPDFSDK_PageView* pPageView,
45 CPDFSDK_Annot* pAnnot,
46 CFX_RenderDevice* pDevice,
jaepark75f84a52016-09-09 15:39:09 -070047 CFX_Matrix* pUser2Device,
48 bool bDrawAnnots) override;
jaepark98e10192016-08-15 10:51:11 -070049 void OnLoad(CPDFSDK_Annot* pAnnot) override;
tsepezf8074ce2016-09-27 14:29:57 -070050
jaepark98e10192016-08-15 10:51:11 -070051 void OnMouseEnter(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070052 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070053 uint32_t nFlag) override;
54 void OnMouseExit(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070055 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070056 uint32_t nFlag) override;
tsepez4cf55152016-11-02 14:37:54 -070057 bool OnLButtonDown(CPDFSDK_PageView* pPageView,
58 CPDFSDK_Annot::ObservedPtr* pAnnot,
59 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -050060 const CFX_PointF& point) override;
tsepez4cf55152016-11-02 14:37:54 -070061 bool OnLButtonUp(CPDFSDK_PageView* pPageView,
62 CPDFSDK_Annot::ObservedPtr* pAnnot,
63 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -050064 const CFX_PointF& point) override;
tsepez4cf55152016-11-02 14:37:54 -070065 bool OnLButtonDblClk(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070066 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070067 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -050068 const CFX_PointF& point) override;
tsepez4cf55152016-11-02 14:37:54 -070069 bool OnMouseMove(CPDFSDK_PageView* pPageView,
70 CPDFSDK_Annot::ObservedPtr* pAnnot,
71 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -050072 const CFX_PointF& point) override;
tsepez4cf55152016-11-02 14:37:54 -070073 bool OnMouseWheel(CPDFSDK_PageView* pPageView,
74 CPDFSDK_Annot::ObservedPtr* pAnnot,
75 uint32_t nFlags,
76 short zDelta,
Dan Sinclairf528eee2017-02-14 11:52:07 -050077 const CFX_PointF& point) override;
tsepez4cf55152016-11-02 14:37:54 -070078 bool OnRButtonDown(CPDFSDK_PageView* pPageView,
79 CPDFSDK_Annot::ObservedPtr* pAnnot,
80 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -050081 const CFX_PointF& point) override;
tsepez4cf55152016-11-02 14:37:54 -070082 bool OnRButtonUp(CPDFSDK_PageView* pPageView,
83 CPDFSDK_Annot::ObservedPtr* pAnnot,
84 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -050085 const CFX_PointF& point) override;
tsepez4cf55152016-11-02 14:37:54 -070086 bool OnRButtonDblClk(CPDFSDK_PageView* pPageView,
87 CPDFSDK_Annot::ObservedPtr* pAnnot,
88 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -050089 const CFX_PointF& point) override;
tsepez4cf55152016-11-02 14:37:54 -070090 bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override;
91 bool OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override;
92 bool OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override;
93 bool OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) override;
94 bool OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) override;
jaepark98e10192016-08-15 10:51:11 -070095#ifdef PDF_ENABLE_XFA
tsepez4cf55152016-11-02 14:37:54 -070096 bool OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot,
97 CPDFSDK_Annot::ObservedPtr* pNewAnnot) override;
jaepark98e10192016-08-15 10:51:11 -070098#endif // PDF_ENABLE_XFA
99
dsinclairb94d7c92016-09-21 12:07:00 -0700100 void SetFormFiller(CFFL_InteractiveFormFiller* pFiller) {
101 m_pFormFiller = pFiller;
102 }
Tom Sepezd0409af2017-05-25 15:53:57 -0700103 CFFL_InteractiveFormFiller* GetFormFiller() const {
104 return m_pFormFiller.Get();
105 }
jaepark98e10192016-08-15 10:51:11 -0700106
107 private:
Tom Sepez940967d2017-05-18 12:32:20 -0700108 CFX_UnownedPtr<CPDFSDK_FormFillEnvironment> const m_pFormFillEnv;
Tom Sepezd0409af2017-05-25 15:53:57 -0700109 CFX_UnownedPtr<CFFL_InteractiveFormFiller> m_pFormFiller;
jaepark98e10192016-08-15 10:51:11 -0700110};
111
dsinclair114e46a2016-09-29 17:18:21 -0700112#endif // FPDFSDK_CPDFSDK_WIDGETHANDLER_H_