• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_IPDFSDK_ANNOTHANDLER_H_
8 #define FPDFSDK_IPDFSDK_ANNOTHANDLER_H_
9 
10 #include <memory>
11 
12 #include "core/fxcrt/fx_coordinates.h"
13 #include "fpdfsdk/cpdfsdk_annot.h"
14 
15 class CFX_Matrix;
16 class CFX_RenderDevice;
17 class CPDF_Annot;
18 class CPDFSDK_FormFillEnvironment;
19 class CPDFSDK_PageView;
20 
21 class IPDFSDK_AnnotHandler {
22  public:
23   virtual ~IPDFSDK_AnnotHandler() = default;
24 
25   virtual void SetFormFillEnvironment(
26       CPDFSDK_FormFillEnvironment* pFormFillEnv) = 0;
27   virtual bool CanAnswer(CPDFSDK_Annot* pAnnot) = 0;
28   virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot,
29                                   CPDFSDK_PageView* pPage) = 0;
30   virtual void ReleaseAnnot(std::unique_ptr<CPDFSDK_Annot> pAnnot) = 0;
31   virtual CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView,
32                                     CPDFSDK_Annot* pAnnot) = 0;
33   virtual WideString GetText(CPDFSDK_Annot* pAnnot) = 0;
34   virtual WideString GetSelectedText(CPDFSDK_Annot* pAnnot) = 0;
35   virtual void ReplaceSelection(CPDFSDK_Annot* pAnnot,
36                                 const WideString& text) = 0;
37   virtual bool CanUndo(CPDFSDK_Annot* pAnnot) = 0;
38   virtual bool CanRedo(CPDFSDK_Annot* pAnnot) = 0;
39   virtual bool Undo(CPDFSDK_Annot* pAnnot) = 0;
40   virtual bool Redo(CPDFSDK_Annot* pAnnot) = 0;
41   virtual bool HitTest(CPDFSDK_PageView* pPageView,
42                        CPDFSDK_Annot* pAnnot,
43                        const CFX_PointF& point) = 0;
44   virtual void OnDraw(CPDFSDK_PageView* pPageView,
45                       CPDFSDK_Annot* pAnnot,
46                       CFX_RenderDevice* pDevice,
47                       const CFX_Matrix& mtUser2Device,
48                       bool bDrawAnnots) = 0;
49   virtual void OnLoad(CPDFSDK_Annot* pAnnot) = 0;
50   virtual void OnMouseEnter(CPDFSDK_PageView* pPageView,
51                             ObservedPtr<CPDFSDK_Annot>* pAnnot,
52                             uint32_t nFlag) = 0;
53   virtual void OnMouseExit(CPDFSDK_PageView* pPageView,
54                            ObservedPtr<CPDFSDK_Annot>* pAnnot,
55                            uint32_t nFlag) = 0;
56   virtual bool OnLButtonDown(CPDFSDK_PageView* pPageView,
57                              ObservedPtr<CPDFSDK_Annot>* pAnnot,
58                              uint32_t nFlags,
59                              const CFX_PointF& point) = 0;
60   virtual bool OnLButtonUp(CPDFSDK_PageView* pPageView,
61                            ObservedPtr<CPDFSDK_Annot>* pAnnot,
62                            uint32_t nFlags,
63                            const CFX_PointF& point) = 0;
64   virtual bool OnLButtonDblClk(CPDFSDK_PageView* pPageView,
65                                ObservedPtr<CPDFSDK_Annot>* pAnnot,
66                                uint32_t nFlags,
67                                const CFX_PointF& point) = 0;
68   virtual bool OnMouseMove(CPDFSDK_PageView* pPageView,
69                            ObservedPtr<CPDFSDK_Annot>* pAnnot,
70                            uint32_t nFlags,
71                            const CFX_PointF& point) = 0;
72   virtual bool OnMouseWheel(CPDFSDK_PageView* pPageView,
73                             ObservedPtr<CPDFSDK_Annot>* pAnnot,
74                             uint32_t nFlags,
75                             short zDelta,
76                             const CFX_PointF& point) = 0;
77   virtual bool OnRButtonDown(CPDFSDK_PageView* pPageView,
78                              ObservedPtr<CPDFSDK_Annot>* pAnnot,
79                              uint32_t nFlags,
80                              const CFX_PointF& point) = 0;
81   virtual bool OnRButtonUp(CPDFSDK_PageView* pPageView,
82                            ObservedPtr<CPDFSDK_Annot>* pAnnot,
83                            uint32_t nFlags,
84                            const CFX_PointF& point) = 0;
85   virtual bool OnRButtonDblClk(CPDFSDK_PageView* pPageView,
86                                ObservedPtr<CPDFSDK_Annot>* pAnnot,
87                                uint32_t nFlags,
88                                const CFX_PointF& point) = 0;
89   virtual bool OnChar(CPDFSDK_Annot* pAnnot,
90                       uint32_t nChar,
91                       uint32_t nFlags) = 0;
92   virtual bool OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) = 0;
93   virtual bool OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) = 0;
94   virtual bool OnSetFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
95                           uint32_t nFlag) = 0;
96   virtual bool OnKillFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
97                            uint32_t nFlag) = 0;
98   virtual bool SetIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot,
99                                 int index,
100                                 bool selected) = 0;
101   virtual bool IsIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot,
102                                int index) = 0;
103 };
104 
105 #endif  // FPDFSDK_IPDFSDK_ANNOTHANDLER_H_
106