cpdfsdk_xfawidgethandler.h revision 33357cad1fd1321a2b38d2963e2585f27ce980a2
1// 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
7#ifndef FPDFSDK_CPDFSDK_XFAWIDGETHANDLER_H_
8#define FPDFSDK_CPDFSDK_XFAWIDGETHANDLER_H_
9
10#include "core/fxcrt/fx_basic.h"
11#include "core/fxcrt/fx_coordinates.h"
12#include "fpdfsdk/ipdfsdk_annothandler.h"
13
14class CFX_Matrix;
15class CFX_RenderDevice;
16class CPDF_Annot;
17class CPDFSDK_FormFillEnvironment;
18class CPDFSDK_Annot;
19class CPDFSDK_PageView;
20class CXFA_FFWidget;
21class CXFA_FFWidgetHandler;
22
23class CPDFSDK_XFAWidgetHandler : public IPDFSDK_AnnotHandler {
24 public:
25  explicit CPDFSDK_XFAWidgetHandler(CPDFSDK_FormFillEnvironment* pApp);
26  ~CPDFSDK_XFAWidgetHandler() override;
27
28  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;
33  CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView,
34                            CPDFSDK_Annot* pAnnot) override;
35  bool HitTest(CPDFSDK_PageView* pPageView,
36               CPDFSDK_Annot* pAnnot,
37               const CFX_PointF& point) override;
38  void OnDraw(CPDFSDK_PageView* pPageView,
39              CPDFSDK_Annot* pAnnot,
40              CFX_RenderDevice* pDevice,
41              CFX_Matrix* pUser2Device,
42              bool bDrawAnnots) override;
43  void OnLoad(CPDFSDK_Annot* pAnnot) override;
44  void OnMouseEnter(CPDFSDK_PageView* pPageView,
45                    CPDFSDK_Annot::ObservedPtr* pAnnot,
46                    uint32_t nFlag) override;
47  void OnMouseExit(CPDFSDK_PageView* pPageView,
48                   CPDFSDK_Annot::ObservedPtr* pAnnot,
49                   uint32_t nFlag) override;
50  bool OnLButtonDown(CPDFSDK_PageView* pPageView,
51                     CPDFSDK_Annot::ObservedPtr* pAnnot,
52                     uint32_t nFlags,
53                     const CFX_PointF& point) override;
54  bool OnLButtonUp(CPDFSDK_PageView* pPageView,
55                   CPDFSDK_Annot::ObservedPtr* pAnnot,
56                   uint32_t nFlags,
57                   const CFX_PointF& point) override;
58  bool OnLButtonDblClk(CPDFSDK_PageView* pPageView,
59                       CPDFSDK_Annot::ObservedPtr* pAnnot,
60                       uint32_t nFlags,
61                       const CFX_PointF& point) override;
62  bool OnMouseMove(CPDFSDK_PageView* pPageView,
63                   CPDFSDK_Annot::ObservedPtr* pAnnot,
64                   uint32_t nFlags,
65                   const CFX_PointF& point) override;
66  bool OnMouseWheel(CPDFSDK_PageView* pPageView,
67                    CPDFSDK_Annot::ObservedPtr* pAnnot,
68                    uint32_t nFlags,
69                    short zDelta,
70                    const CFX_PointF& point) override;
71  bool OnRButtonDown(CPDFSDK_PageView* pPageView,
72                     CPDFSDK_Annot::ObservedPtr* pAnnot,
73                     uint32_t nFlags,
74                     const CFX_PointF& point) override;
75  bool OnRButtonUp(CPDFSDK_PageView* pPageView,
76                   CPDFSDK_Annot::ObservedPtr* pAnnot,
77                   uint32_t nFlags,
78                   const CFX_PointF& point) override;
79  bool OnRButtonDblClk(CPDFSDK_PageView* pPageView,
80                       CPDFSDK_Annot::ObservedPtr* pAnnot,
81                       uint32_t nFlags,
82                       const CFX_PointF& point) override;
83  bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override;
84  bool OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override;
85  bool OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override;
86  bool OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) override;
87  bool OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) override;
88  bool OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot,
89                         CPDFSDK_Annot::ObservedPtr* pNewAnnot) override;
90
91 private:
92  CXFA_FFWidgetHandler* GetXFAWidgetHandler(CPDFSDK_Annot* pAnnot);
93  uint32_t GetFWLFlags(uint32_t dwFlag);
94
95  CPDFSDK_FormFillEnvironment* m_pFormFillEnv;
96};
97
98#endif  // FPDFSDK_CPDFSDK_XFAWIDGETHANDLER_H_
99