jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 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 | |
dsinclair | 114e46a | 2016-09-29 17:18:21 -0700 | [diff] [blame^] | 7 | #ifndef FPDFSDK_IPDFSDK_ANNOTHANDLER_H_ |
| 8 | #define FPDFSDK_IPDFSDK_ANNOTHANDLER_H_ |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 9 | |
dsinclair | a52ab74 | 2016-09-29 13:59:29 -0700 | [diff] [blame] | 10 | #include "core/fxcrt/fx_basic.h" |
| 11 | #include "core/fxcrt/fx_coordinates.h" |
dsinclair | 114e46a | 2016-09-29 17:18:21 -0700 | [diff] [blame^] | 12 | #include "fpdfsdk/cpdfsdk_annot.h" |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 13 | |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 14 | class CFX_Matrix; |
| 15 | class CFX_RenderDevice; |
| 16 | class CPDF_Annot; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 17 | class CPDFSDK_PageView; |
| 18 | |
| 19 | #ifdef PDF_ENABLE_XFA |
| 20 | class CXFA_FFWidget; |
| 21 | #endif // PDF_ENABLE_XFA |
| 22 | |
| 23 | class IPDFSDK_AnnotHandler { |
| 24 | public: |
| 25 | virtual ~IPDFSDK_AnnotHandler() {} |
| 26 | |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 27 | 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, |
jaepark | 75f84a5 | 2016-09-09 15:39:09 -0700 | [diff] [blame] | 46 | CFX_Matrix* pUser2Device, |
| 47 | bool bDrawAnnots) = 0; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 48 | 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; |
tsepez | f8074ce | 2016-09-27 14:29:57 -0700 | [diff] [blame] | 52 | |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 53 | virtual void OnMouseEnter(CPDFSDK_PageView* pPageView, |
tsepez | f8074ce | 2016-09-27 14:29:57 -0700 | [diff] [blame] | 54 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 55 | uint32_t nFlag) = 0; |
| 56 | virtual void OnMouseExit(CPDFSDK_PageView* pPageView, |
tsepez | f8074ce | 2016-09-27 14:29:57 -0700 | [diff] [blame] | 57 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 58 | uint32_t nFlag) = 0; |
| 59 | virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView, |
tsepez | f8074ce | 2016-09-27 14:29:57 -0700 | [diff] [blame] | 60 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 61 | uint32_t nFlags, |
| 62 | const CFX_FloatPoint& point) = 0; |
| 63 | virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView, |
tsepez | f8074ce | 2016-09-27 14:29:57 -0700 | [diff] [blame] | 64 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 65 | uint32_t nFlags, |
| 66 | const CFX_FloatPoint& point) = 0; |
| 67 | virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView, |
tsepez | f8074ce | 2016-09-27 14:29:57 -0700 | [diff] [blame] | 68 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 69 | uint32_t nFlags, |
| 70 | const CFX_FloatPoint& point) = 0; |
| 71 | virtual FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView, |
tsepez | f8074ce | 2016-09-27 14:29:57 -0700 | [diff] [blame] | 72 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 73 | uint32_t nFlags, |
| 74 | const CFX_FloatPoint& point) = 0; |
| 75 | virtual FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView, |
tsepez | f8074ce | 2016-09-27 14:29:57 -0700 | [diff] [blame] | 76 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 77 | uint32_t nFlags, |
| 78 | short zDelta, |
| 79 | const CFX_FloatPoint& point) = 0; |
| 80 | virtual FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView, |
tsepez | f8074ce | 2016-09-27 14:29:57 -0700 | [diff] [blame] | 81 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 82 | uint32_t nFlags, |
| 83 | const CFX_FloatPoint& point) = 0; |
| 84 | virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView, |
tsepez | f8074ce | 2016-09-27 14:29:57 -0700 | [diff] [blame] | 85 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 86 | uint32_t nFlags, |
| 87 | const CFX_FloatPoint& point) = 0; |
| 88 | virtual FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView, |
tsepez | f8074ce | 2016-09-27 14:29:57 -0700 | [diff] [blame] | 89 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 90 | 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; |
tsepez | f8074ce | 2016-09-27 14:29:57 -0700 | [diff] [blame] | 99 | 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; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 103 | #ifdef PDF_ENABLE_XFA |
tsepez | f8074ce | 2016-09-27 14:29:57 -0700 | [diff] [blame] | 104 | virtual FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot, |
| 105 | CPDFSDK_Annot::ObservedPtr* pNewAnnot) = 0; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 106 | #endif // PDF_ENABLE_XFA |
| 107 | }; |
| 108 | |
dsinclair | 114e46a | 2016-09-29 17:18:21 -0700 | [diff] [blame^] | 109 | #endif // FPDFSDK_IPDFSDK_ANNOTHANDLER_H_ |