blob: 84da0c4054244ed478a2540a5bffebe31a1e4a39 [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_IPDFSDK_ANNOTHANDLER_H_
8#define FPDFSDK_IPDFSDK_ANNOTHANDLER_H_
jaepark98e10192016-08-15 10:51:11 -07009
dsinclaira52ab742016-09-29 13:59:29 -070010#include "core/fxcrt/fx_basic.h"
11#include "core/fxcrt/fx_coordinates.h"
dsinclair114e46a2016-09-29 17:18:21 -070012#include "fpdfsdk/cpdfsdk_annot.h"
jaepark98e10192016-08-15 10:51:11 -070013
jaepark98e10192016-08-15 10:51:11 -070014class CFX_Matrix;
15class CFX_RenderDevice;
16class CPDF_Annot;
jaepark98e10192016-08-15 10:51:11 -070017class CPDFSDK_PageView;
18
19#ifdef PDF_ENABLE_XFA
20class CXFA_FFWidget;
21#endif // PDF_ENABLE_XFA
22
23class IPDFSDK_AnnotHandler {
24 public:
25 virtual ~IPDFSDK_AnnotHandler() {}
26
jaepark98e10192016-08-15 10:51:11 -070027 virtual FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) = 0;
28 virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot,
29 CPDFSDK_PageView* pPage) = 0;
30
31#ifdef PDF_ENABLE_XFA
32 virtual CPDFSDK_Annot* NewAnnot(CXFA_FFWidget* hWidget,
33 CPDFSDK_PageView* pPage) = 0;
34#endif // PDF_ENABLE_XFA
35
36 virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot) = 0;
37 virtual void DeleteAnnot(CPDFSDK_Annot* pAnnot) = 0;
38 virtual CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView,
39 CPDFSDK_Annot* pAnnot) = 0;
40 virtual FX_BOOL HitTest(CPDFSDK_PageView* pPageView,
41 CPDFSDK_Annot* pAnnot,
42 const CFX_FloatPoint& point) = 0;
43 virtual void OnDraw(CPDFSDK_PageView* pPageView,
44 CPDFSDK_Annot* pAnnot,
45 CFX_RenderDevice* pDevice,
jaepark75f84a52016-09-09 15:39:09 -070046 CFX_Matrix* pUser2Device,
47 bool bDrawAnnots) = 0;
jaepark98e10192016-08-15 10:51:11 -070048 virtual void OnCreate(CPDFSDK_Annot* pAnnot) = 0;
49 virtual void OnLoad(CPDFSDK_Annot* pAnnot) = 0;
50 virtual void OnDelete(CPDFSDK_Annot* pAnnot) = 0;
51 virtual void OnRelease(CPDFSDK_Annot* pAnnot) = 0;
tsepezf8074ce2016-09-27 14:29:57 -070052
jaepark98e10192016-08-15 10:51:11 -070053 virtual void OnMouseEnter(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070054 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070055 uint32_t nFlag) = 0;
56 virtual void OnMouseExit(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070057 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070058 uint32_t nFlag) = 0;
59 virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070060 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070061 uint32_t nFlags,
62 const CFX_FloatPoint& point) = 0;
63 virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070064 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070065 uint32_t nFlags,
66 const CFX_FloatPoint& point) = 0;
67 virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070068 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070069 uint32_t nFlags,
70 const CFX_FloatPoint& point) = 0;
71 virtual FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070072 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070073 uint32_t nFlags,
74 const CFX_FloatPoint& point) = 0;
75 virtual FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070076 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070077 uint32_t nFlags,
78 short zDelta,
79 const CFX_FloatPoint& point) = 0;
80 virtual FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070081 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070082 uint32_t nFlags,
83 const CFX_FloatPoint& point) = 0;
84 virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070085 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070086 uint32_t nFlags,
87 const CFX_FloatPoint& point) = 0;
88 virtual FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070089 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070090 uint32_t nFlags,
91 const CFX_FloatPoint& point) = 0;
92 virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot,
93 uint32_t nChar,
94 uint32_t nFlags) = 0;
95 virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) = 0;
96 virtual FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) = 0;
97 virtual void OnDeSelected(CPDFSDK_Annot* pAnnot) = 0;
98 virtual void OnSelected(CPDFSDK_Annot* pAnnot) = 0;
tsepezf8074ce2016-09-27 14:29:57 -070099 virtual FX_BOOL OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
100 uint32_t nFlag) = 0;
101 virtual FX_BOOL OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
102 uint32_t nFlag) = 0;
jaepark98e10192016-08-15 10:51:11 -0700103#ifdef PDF_ENABLE_XFA
tsepezf8074ce2016-09-27 14:29:57 -0700104 virtual FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot,
105 CPDFSDK_Annot::ObservedPtr* pNewAnnot) = 0;
jaepark98e10192016-08-15 10:51:11 -0700106#endif // PDF_ENABLE_XFA
107};
108
dsinclair114e46a2016-09-29 17:18:21 -0700109#endif // FPDFSDK_IPDFSDK_ANNOTHANDLER_H_