blob: e0dccbe68562f9f0c15cd2dd9caafede09b3356f [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_coordinates.h"
Dan Sinclairaee0db02017-09-21 16:53:58 -040011#include "core/fxcrt/unowned_ptr.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
tsepez4cf55152016-11-02 14:37:54 -070028 bool CanAnswer(CPDFSDK_Annot* pAnnot) override;
jaepark98e10192016-08-15 10:51:11 -070029 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;
Ryan Harrison275e2602017-09-18 14:23:18 -040035 WideString GetSelectedText(CPDFSDK_Annot* pAnnot) override;
36 void ReplaceSelection(CPDFSDK_Annot* pAnnot, const WideString& text) override;
tsepez4cf55152016-11-02 14:37:54 -070037 bool HitTest(CPDFSDK_PageView* pPageView,
38 CPDFSDK_Annot* pAnnot,
Dan Sinclairf528eee2017-02-14 11:52:07 -050039 const CFX_PointF& point) override;
jaepark98e10192016-08-15 10:51:11 -070040 void OnDraw(CPDFSDK_PageView* pPageView,
41 CPDFSDK_Annot* pAnnot,
42 CFX_RenderDevice* pDevice,
jaepark75f84a52016-09-09 15:39:09 -070043 CFX_Matrix* pUser2Device,
44 bool bDrawAnnots) override;
jaepark98e10192016-08-15 10:51:11 -070045 void OnLoad(CPDFSDK_Annot* pAnnot) override;
jaepark98e10192016-08-15 10:51:11 -070046 void OnMouseEnter(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070047 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070048 uint32_t nFlag) override;
49 void OnMouseExit(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070050 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070051 uint32_t nFlag) override;
tsepez4cf55152016-11-02 14:37:54 -070052 bool OnLButtonDown(CPDFSDK_PageView* pPageView,
53 CPDFSDK_Annot::ObservedPtr* pAnnot,
54 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -050055 const CFX_PointF& point) override;
tsepez4cf55152016-11-02 14:37:54 -070056 bool OnLButtonUp(CPDFSDK_PageView* pPageView,
57 CPDFSDK_Annot::ObservedPtr* pAnnot,
58 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -050059 const CFX_PointF& point) override;
tsepez4cf55152016-11-02 14:37:54 -070060 bool OnLButtonDblClk(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070061 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070062 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -050063 const CFX_PointF& point) override;
tsepez4cf55152016-11-02 14:37:54 -070064 bool OnMouseMove(CPDFSDK_PageView* pPageView,
65 CPDFSDK_Annot::ObservedPtr* pAnnot,
66 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -050067 const CFX_PointF& point) override;
tsepez4cf55152016-11-02 14:37:54 -070068 bool OnMouseWheel(CPDFSDK_PageView* pPageView,
69 CPDFSDK_Annot::ObservedPtr* pAnnot,
70 uint32_t nFlags,
71 short zDelta,
Dan Sinclairf528eee2017-02-14 11:52:07 -050072 const CFX_PointF& point) override;
tsepez4cf55152016-11-02 14:37:54 -070073 bool OnRButtonDown(CPDFSDK_PageView* pPageView,
74 CPDFSDK_Annot::ObservedPtr* pAnnot,
75 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -050076 const CFX_PointF& point) override;
tsepez4cf55152016-11-02 14:37:54 -070077 bool OnRButtonUp(CPDFSDK_PageView* pPageView,
78 CPDFSDK_Annot::ObservedPtr* pAnnot,
79 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -050080 const CFX_PointF& point) override;
tsepez4cf55152016-11-02 14:37:54 -070081 bool OnRButtonDblClk(CPDFSDK_PageView* pPageView,
82 CPDFSDK_Annot::ObservedPtr* pAnnot,
83 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -050084 const CFX_PointF& point) override;
tsepez4cf55152016-11-02 14:37:54 -070085 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;
jaepark98e10192016-08-15 10:51:11 -070092
93 private:
94 CXFA_FFWidgetHandler* GetXFAWidgetHandler(CPDFSDK_Annot* pAnnot);
95 uint32_t GetFWLFlags(uint32_t dwFlag);
96
Dan Sinclairaee0db02017-09-21 16:53:58 -040097 UnownedPtr<CPDFSDK_FormFillEnvironment> const m_pFormFillEnv;
jaepark98e10192016-08-15 10:51:11 -070098};
jaepark98e10192016-08-15 10:51:11 -070099
dsinclair114e46a2016-09-29 17:18:21 -0700100#endif // FPDFSDK_CPDFSDK_XFAWIDGETHANDLER_H_