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