blob: fdbcbcc7eef554025ca26e2a77b57c694abd49f9 [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_XFAWIDGETHANDLER_H_
8#define FPDFSDK_CPDFSDK_XFAWIDGETHANDLER_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
14class CFX_Matrix;
15class CFX_RenderDevice;
16class CPDF_Annot;
dsinclair735606d2016-10-05 15:47:02 -070017class CPDFSDK_FormFillEnvironment;
jaepark98e10192016-08-15 10:51:11 -070018class CPDFSDK_Annot;
19class CPDFSDK_PageView;
20class CXFA_FFWidget;
21class CXFA_FFWidgetHandler;
22
jaepark8c541822016-08-30 13:43:05 -070023class CPDFSDK_XFAWidgetHandler : public IPDFSDK_AnnotHandler {
jaepark98e10192016-08-15 10:51:11 -070024 public:
dsinclair735606d2016-10-05 15:47:02 -070025 explicit CPDFSDK_XFAWidgetHandler(CPDFSDK_FormFillEnvironment* pApp);
jaepark8c541822016-08-30 13:43:05 -070026 ~CPDFSDK_XFAWidgetHandler() override;
jaepark98e10192016-08-15 10:51:11 -070027
jaepark98e10192016-08-15 10:51:11 -070028 FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) override;
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;
jaepark98e10192016-08-15 10:51:11 -070033 CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView,
34 CPDFSDK_Annot* pAnnot) override;
35 FX_BOOL HitTest(CPDFSDK_PageView* pPageView,
36 CPDFSDK_Annot* pAnnot,
37 const CFX_FloatPoint& point) override;
38 void OnDraw(CPDFSDK_PageView* pPageView,
39 CPDFSDK_Annot* pAnnot,
40 CFX_RenderDevice* pDevice,
jaepark75f84a52016-09-09 15:39:09 -070041 CFX_Matrix* pUser2Device,
42 bool bDrawAnnots) override;
jaepark98e10192016-08-15 10:51:11 -070043 void OnLoad(CPDFSDK_Annot* pAnnot) override;
jaepark98e10192016-08-15 10:51:11 -070044 void OnMouseEnter(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070045 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070046 uint32_t nFlag) override;
47 void OnMouseExit(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070048 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070049 uint32_t nFlag) override;
50 FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070051 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070052 uint32_t nFlags,
53 const CFX_FloatPoint& point) override;
54 FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070055 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070056 uint32_t nFlags,
57 const CFX_FloatPoint& point) override;
58 FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070059 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070060 uint32_t nFlags,
61 const CFX_FloatPoint& point) override;
62 FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070063 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070064 uint32_t nFlags,
65 const CFX_FloatPoint& point) override;
66 FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070067 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070068 uint32_t nFlags,
69 short zDelta,
70 const CFX_FloatPoint& point) override;
71 FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070072 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070073 uint32_t nFlags,
74 const CFX_FloatPoint& point) override;
75 FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070076 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070077 uint32_t nFlags,
78 const CFX_FloatPoint& point) override;
79 FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070080 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070081 uint32_t nFlags,
82 const CFX_FloatPoint& point) override;
83 FX_BOOL OnChar(CPDFSDK_Annot* pAnnot,
84 uint32_t nChar,
85 uint32_t nFlags) override;
86 FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override;
87 FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override;
tsepezf8074ce2016-09-27 14:29:57 -070088 FX_BOOL OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
89 uint32_t nFlag) override;
90 FX_BOOL OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
91 uint32_t nFlag) override;
92 FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot,
93 CPDFSDK_Annot::ObservedPtr* pNewAnnot) override;
jaepark98e10192016-08-15 10:51:11 -070094
95 private:
96 CXFA_FFWidgetHandler* GetXFAWidgetHandler(CPDFSDK_Annot* pAnnot);
97 uint32_t GetFWLFlags(uint32_t dwFlag);
98
dsinclair8779fa82016-10-12 12:05:44 -070099 CPDFSDK_FormFillEnvironment* m_pFormFillEnv;
jaepark98e10192016-08-15 10:51:11 -0700100};
jaepark98e10192016-08-15 10:51:11 -0700101
dsinclair114e46a2016-09-29 17:18:21 -0700102#endif // FPDFSDK_CPDFSDK_XFAWIDGETHANDLER_H_