blob: 636d161feae2ef78510b62e17ec07927ebbc7a55 [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
tsepez4cf55152016-11-02 14:37:54 -070027 virtual bool CanAnswer(CPDFSDK_Annot* pAnnot) = 0;
jaepark98e10192016-08-15 10:51:11 -070028 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;
jaepark98e10192016-08-15 10:51:11 -070037 virtual CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView,
38 CPDFSDK_Annot* pAnnot) = 0;
tsepez4cf55152016-11-02 14:37:54 -070039 virtual bool HitTest(CPDFSDK_PageView* pPageView,
40 CPDFSDK_Annot* pAnnot,
Dan Sinclairf528eee2017-02-14 11:52:07 -050041 const CFX_PointF& point) = 0;
jaepark98e10192016-08-15 10:51:11 -070042 virtual void OnDraw(CPDFSDK_PageView* pPageView,
43 CPDFSDK_Annot* pAnnot,
44 CFX_RenderDevice* pDevice,
jaepark75f84a52016-09-09 15:39:09 -070045 CFX_Matrix* pUser2Device,
46 bool bDrawAnnots) = 0;
jaepark98e10192016-08-15 10:51:11 -070047 virtual void OnLoad(CPDFSDK_Annot* pAnnot) = 0;
tsepezf8074ce2016-09-27 14:29:57 -070048
jaepark98e10192016-08-15 10:51:11 -070049 virtual void OnMouseEnter(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070050 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070051 uint32_t nFlag) = 0;
52 virtual void OnMouseExit(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070053 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070054 uint32_t nFlag) = 0;
tsepez4cf55152016-11-02 14:37:54 -070055 virtual bool OnLButtonDown(CPDFSDK_PageView* pPageView,
56 CPDFSDK_Annot::ObservedPtr* pAnnot,
57 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -050058 const CFX_PointF& point) = 0;
tsepez4cf55152016-11-02 14:37:54 -070059 virtual bool OnLButtonUp(CPDFSDK_PageView* pPageView,
60 CPDFSDK_Annot::ObservedPtr* pAnnot,
61 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -050062 const CFX_PointF& point) = 0;
tsepez4cf55152016-11-02 14:37:54 -070063 virtual bool OnLButtonDblClk(CPDFSDK_PageView* pPageView,
tsepezf8074ce2016-09-27 14:29:57 -070064 CPDFSDK_Annot::ObservedPtr* pAnnot,
jaepark98e10192016-08-15 10:51:11 -070065 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -050066 const CFX_PointF& point) = 0;
tsepez4cf55152016-11-02 14:37:54 -070067 virtual bool OnMouseMove(CPDFSDK_PageView* pPageView,
68 CPDFSDK_Annot::ObservedPtr* pAnnot,
69 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -050070 const CFX_PointF& point) = 0;
tsepez4cf55152016-11-02 14:37:54 -070071 virtual bool OnMouseWheel(CPDFSDK_PageView* pPageView,
72 CPDFSDK_Annot::ObservedPtr* pAnnot,
73 uint32_t nFlags,
74 short zDelta,
Dan Sinclairf528eee2017-02-14 11:52:07 -050075 const CFX_PointF& point) = 0;
tsepez4cf55152016-11-02 14:37:54 -070076 virtual bool OnRButtonDown(CPDFSDK_PageView* pPageView,
77 CPDFSDK_Annot::ObservedPtr* pAnnot,
78 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -050079 const CFX_PointF& point) = 0;
tsepez4cf55152016-11-02 14:37:54 -070080 virtual bool OnRButtonUp(CPDFSDK_PageView* pPageView,
81 CPDFSDK_Annot::ObservedPtr* pAnnot,
82 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -050083 const CFX_PointF& point) = 0;
tsepez4cf55152016-11-02 14:37:54 -070084 virtual bool OnRButtonDblClk(CPDFSDK_PageView* pPageView,
85 CPDFSDK_Annot::ObservedPtr* pAnnot,
86 uint32_t nFlags,
Dan Sinclairf528eee2017-02-14 11:52:07 -050087 const CFX_PointF& point) = 0;
tsepez4cf55152016-11-02 14:37:54 -070088 virtual bool OnChar(CPDFSDK_Annot* pAnnot,
89 uint32_t nChar,
90 uint32_t nFlags) = 0;
91 virtual bool OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) = 0;
92 virtual bool OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) = 0;
93 virtual bool OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
94 uint32_t nFlag) = 0;
95 virtual bool OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
96 uint32_t nFlag) = 0;
jaepark98e10192016-08-15 10:51:11 -070097#ifdef PDF_ENABLE_XFA
tsepez4cf55152016-11-02 14:37:54 -070098 virtual bool OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot,
99 CPDFSDK_Annot::ObservedPtr* pNewAnnot) = 0;
jaepark98e10192016-08-15 10:51:11 -0700100#endif // PDF_ENABLE_XFA
101};
102
dsinclair114e46a2016-09-29 17:18:21 -0700103#endif // FPDFSDK_IPDFSDK_ANNOTHANDLER_H_