blob: 0918a126c1ce3fc158f18e5df3385bca4feab0fa [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
dsinclaira52ab742016-09-29 13:59:29 -070010#include "core/fxcrt/fx_basic.h"
11#include "core/fxcrt/fx_coordinates.h"
dsinclair114e46a2016-09-29 17:18:21 -070012#include "fpdfsdk/ipdfsdk_annothandler.h"
jaepark98e10192016-08-15 10:51:11 -070013
dsinclairb94d7c92016-09-21 12:07:00 -070014class CFFL_InteractiveFormFiller;
jaepark98e10192016-08-15 10:51:11 -070015class CFX_Matrix;
16class CFX_RenderDevice;
17class CPDF_Annot;
jaepark98e10192016-08-15 10:51:11 -070018class CPDFSDK_Annot;
dsinclair735606d2016-10-05 15:47:02 -070019class CPDFSDK_FormFillEnvironment;
jaepark98e10192016-08-15 10:51:11 -070020class CPDFSDK_PageView;
21
22#ifdef PDF_ENABLE_XFA
23class CXFA_FFWidget;
24#endif // PDF_ENABLE_XFA
25
jaepark8c541822016-08-30 13:43:05 -070026class CPDFSDK_WidgetHandler : public IPDFSDK_AnnotHandler {
jaepark98e10192016-08-15 10:51:11 -070027 public:
dsinclair735606d2016-10-05 15:47:02 -070028 explicit CPDFSDK_WidgetHandler(CPDFSDK_FormFillEnvironment* pApp);
jaepark8c541822016-08-30 13:43:05 -070029 ~CPDFSDK_WidgetHandler() override;
jaepark98e10192016-08-15 10:51:11 -070030
jaepark98e10192016-08-15 10:51:11 -070031 FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) override;
32 CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) override;
33#ifdef PDF_ENABLE_XFA
34 CPDFSDK_Annot* NewAnnot(CXFA_FFWidget* hWidget,
35 CPDFSDK_PageView* pPage) override;
36#endif // PDF_ENABLE_XFA
37 void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override;
jaepark98e10192016-08-15 10:51:11 -070038 CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView,
39 CPDFSDK_Annot* pAnnot) override;
40 FX_BOOL HitTest(CPDFSDK_PageView* pPageView,
41 CPDFSDK_Annot* pAnnot,
42 const CFX_FloatPoint& point) override;
43 void OnDraw(CPDFSDK_PageView* pPageView,
44 CPDFSDK_Annot* pAnnot,
45 CFX_RenderDevice* pDevice,
jaepark75f84a52016-09-09 15:39:09 -070046 CFX_Matrix* pUser2Device,
47 bool bDrawAnnots) override;
jaepark98e10192016-08-15 10:51:11 -070048 void OnLoad(CPDFSDK_Annot* pAnnot) override;
tsepezf8074ce2016-09-27 14:29:57 -070049
jaepark98e10192016-08-15 10:51:11 -070050 void OnMouseEnter(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070051 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070052 uint32_t nFlag) override;
53 void OnMouseExit(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070054 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070055 uint32_t nFlag) override;
56 FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070057 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070058 uint32_t nFlags,
59 const CFX_FloatPoint& point) override;
60 FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070061 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070062 uint32_t nFlags,
63 const CFX_FloatPoint& point) override;
64 FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070065 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070066 uint32_t nFlags,
67 const CFX_FloatPoint& point) override;
68 FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070069 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070070 uint32_t nFlags,
71 const CFX_FloatPoint& point) override;
72 FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070073 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070074 uint32_t nFlags,
75 short zDelta,
76 const CFX_FloatPoint& point) override;
77 FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070078 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070079 uint32_t nFlags,
80 const CFX_FloatPoint& point) override;
81 FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070082 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070083 uint32_t nFlags,
84 const CFX_FloatPoint& point) override;
85 FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070086 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070087 uint32_t nFlags,
88 const CFX_FloatPoint& point) override;
89 FX_BOOL OnChar(CPDFSDK_Annot* pAnnot,
90 uint32_t nChar,
91 uint32_t nFlags) override;
92 FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override;
93 FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override;
tsepezf8074ce2016-09-27 14:29:57 -070094 FX_BOOL OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
95 uint32_t nFlag) override;
96 FX_BOOL OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
97 uint32_t nFlag) override;
jaepark98e10192016-08-15 10:51:11 -070098#ifdef PDF_ENABLE_XFA
tsepezf8074ce2016-09-27 14:29:57 -070099 FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot,
100 CPDFSDK_Annot::ObservedPtr* pNewAnnot) override;
jaepark98e10192016-08-15 10:51:11 -0700101#endif // PDF_ENABLE_XFA
102
dsinclairb94d7c92016-09-21 12:07:00 -0700103 void SetFormFiller(CFFL_InteractiveFormFiller* pFiller) {
104 m_pFormFiller = pFiller;
105 }
106 CFFL_InteractiveFormFiller* GetFormFiller() { return m_pFormFiller; }
jaepark98e10192016-08-15 10:51:11 -0700107
108 private:
dsinclair8779fa82016-10-12 12:05:44 -0700109 CPDFSDK_FormFillEnvironment* m_pFormFillEnv;
dsinclairb94d7c92016-09-21 12:07:00 -0700110 CFFL_InteractiveFormFiller* m_pFormFiller;
jaepark98e10192016-08-15 10:51:11 -0700111};
112
dsinclair114e46a2016-09-29 17:18:21 -0700113#endif // FPDFSDK_CPDFSDK_WIDGETHANDLER_H_