blob: 2aea49b366bab59b8ee0f69f162a6c3223850142 [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
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
15class CFX_Matrix;
16class CFX_RenderDevice;
17class CPDF_Annot;
dsinclair735606d2016-10-05 15:47:02 -070018class CPDFSDK_FormFillEnvironment;
jaepark98e10192016-08-15 10:51:11 -070019class CPDFSDK_Annot;
20class CPDFSDK_PageView;
21class CXFA_FFWidget;
22class CXFA_FFWidgetHandler;
23
jaepark8c541822016-08-30 13:43:05 -070024class CPDFSDK_XFAWidgetHandler : public IPDFSDK_AnnotHandler {
jaepark98e10192016-08-15 10:51:11 -070025 public:
dsinclair735606d2016-10-05 15:47:02 -070026 explicit CPDFSDK_XFAWidgetHandler(CPDFSDK_FormFillEnvironment* pApp);
jaepark8c541822016-08-30 13:43:05 -070027 ~CPDFSDK_XFAWidgetHandler() override;
jaepark98e10192016-08-15 10:51:11 -070028
tsepez4cf55152016-11-02 14:37:54 -070029 bool CanAnswer(CPDFSDK_Annot* pAnnot) override;
jaepark98e10192016-08-15 10:51:11 -070030 CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) override;
31 CPDFSDK_Annot* NewAnnot(CXFA_FFWidget* pAnnot,
32 CPDFSDK_PageView* pPage) override;
33 void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override;
jaepark98e10192016-08-15 10:51:11 -070034 CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView,
35 CPDFSDK_Annot* pAnnot) override;
tsepez4cf55152016-11-02 14:37:54 -070036 bool HitTest(CPDFSDK_PageView* pPageView,
37 CPDFSDK_Annot* pAnnot,
Dan Sinclairf528eee2017-02-14 11:52:07 -050038 const CFX_PointF& point) override;
jaepark98e10192016-08-15 10:51:11 -070039 void OnDraw(CPDFSDK_PageView* pPageView,
40 CPDFSDK_Annot* pAnnot,
41 CFX_RenderDevice* pDevice,
jaepark75f84a52016-09-09 15:39:09 -070042 CFX_Matrix* pUser2Device,
43 bool bDrawAnnots) override;
jaepark98e10192016-08-15 10:51:11 -070044 void OnLoad(CPDFSDK_Annot* pAnnot) override;
jaepark98e10192016-08-15 10:51:11 -070045 void OnMouseEnter(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070046 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070047 uint32_t nFlag) override;
48 void OnMouseExit(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070049 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070050 uint32_t nFlag) override;
tsepez4cf55152016-11-02 14:37:54 -070051 bool OnLButtonDown(CPDFSDK_PageView* pPageView,
52 CPDFSDK_Annot::ObservedPtr* pAnnot,
53 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -050054 const CFX_PointF& point) override;
tsepez4cf55152016-11-02 14:37:54 -070055 bool OnLButtonUp(CPDFSDK_PageView* pPageView,
56 CPDFSDK_Annot::ObservedPtr* pAnnot,
57 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -050058 const CFX_PointF& point) override;
tsepez4cf55152016-11-02 14:37:54 -070059 bool OnLButtonDblClk(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070060 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070061 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -050062 const CFX_PointF& point) override;
tsepez4cf55152016-11-02 14:37:54 -070063 bool OnMouseMove(CPDFSDK_PageView* pPageView,
64 CPDFSDK_Annot::ObservedPtr* pAnnot,
65 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -050066 const CFX_PointF& point) override;
tsepez4cf55152016-11-02 14:37:54 -070067 bool OnMouseWheel(CPDFSDK_PageView* pPageView,
68 CPDFSDK_Annot::ObservedPtr* pAnnot,
69 uint32_t nFlags,
70 short zDelta,
Dan Sinclairf528eee2017-02-14 11:52:07 -050071 const CFX_PointF& point) override;
tsepez4cf55152016-11-02 14:37:54 -070072 bool OnRButtonDown(CPDFSDK_PageView* pPageView,
73 CPDFSDK_Annot::ObservedPtr* pAnnot,
74 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -050075 const CFX_PointF& point) override;
tsepez4cf55152016-11-02 14:37:54 -070076 bool OnRButtonUp(CPDFSDK_PageView* pPageView,
77 CPDFSDK_Annot::ObservedPtr* pAnnot,
78 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -050079 const CFX_PointF& point) override;
tsepez4cf55152016-11-02 14:37:54 -070080 bool OnRButtonDblClk(CPDFSDK_PageView* pPageView,
81 CPDFSDK_Annot::ObservedPtr* pAnnot,
82 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -050083 const CFX_PointF& point) override;
tsepez4cf55152016-11-02 14:37:54 -070084 bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override;
85 bool OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override;
86 bool OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override;
87 bool OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) override;
88 bool OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) override;
89 bool OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot,
90 CPDFSDK_Annot::ObservedPtr* pNewAnnot) override;
jaepark98e10192016-08-15 10:51:11 -070091
92 private:
93 CXFA_FFWidgetHandler* GetXFAWidgetHandler(CPDFSDK_Annot* pAnnot);
94 uint32_t GetFWLFlags(uint32_t dwFlag);
95
Tom Sepez940967d2017-05-18 12:32:20 -070096 CFX_UnownedPtr<CPDFSDK_FormFillEnvironment> const m_pFormFillEnv;
jaepark98e10192016-08-15 10:51:11 -070097};
jaepark98e10192016-08-15 10:51:11 -070098
dsinclair114e46a2016-09-29 17:18:21 -070099#endif // FPDFSDK_CPDFSDK_XFAWIDGETHANDLER_H_