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_coordinates.h" |
dsinclair | 114e46a | 2016-09-29 17:18:21 -0700 | [diff] [blame] | 11 | #include "fpdfsdk/cpdfsdk_annot.h" |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 12 | |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 13 | class CFX_Matrix; |
| 14 | class CFX_RenderDevice; |
| 15 | class CPDF_Annot; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 16 | class CPDFSDK_PageView; |
| 17 | |
| 18 | #ifdef PDF_ENABLE_XFA |
| 19 | class CXFA_FFWidget; |
| 20 | #endif // PDF_ENABLE_XFA |
| 21 | |
| 22 | class IPDFSDK_AnnotHandler { |
| 23 | public: |
| 24 | virtual ~IPDFSDK_AnnotHandler() {} |
| 25 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 26 | virtual bool CanAnswer(CPDFSDK_Annot* pAnnot) = 0; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 27 | virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, |
| 28 | CPDFSDK_PageView* pPage) = 0; |
| 29 | |
| 30 | #ifdef PDF_ENABLE_XFA |
| 31 | virtual CPDFSDK_Annot* NewAnnot(CXFA_FFWidget* hWidget, |
| 32 | CPDFSDK_PageView* pPage) = 0; |
| 33 | #endif // PDF_ENABLE_XFA |
| 34 | |
| 35 | virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot) = 0; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 36 | virtual CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView, |
| 37 | CPDFSDK_Annot* pAnnot) = 0; |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 38 | virtual WideString GetSelectedText(CPDFSDK_Annot* pAnnot) = 0; |
Diana Gage | ab39097 | 2017-07-28 17:07:39 -0700 | [diff] [blame] | 39 | virtual void ReplaceSelection(CPDFSDK_Annot* pAnnot, |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 40 | const WideString& text) = 0; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 41 | virtual bool HitTest(CPDFSDK_PageView* pPageView, |
| 42 | CPDFSDK_Annot* pAnnot, |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 43 | const CFX_PointF& point) = 0; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 44 | virtual void OnDraw(CPDFSDK_PageView* pPageView, |
| 45 | CPDFSDK_Annot* pAnnot, |
| 46 | CFX_RenderDevice* pDevice, |
jaepark | 75f84a5 | 2016-09-09 15:39:09 -0700 | [diff] [blame] | 47 | CFX_Matrix* pUser2Device, |
| 48 | bool bDrawAnnots) = 0; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 49 | virtual void OnLoad(CPDFSDK_Annot* pAnnot) = 0; |
tsepez | f8074ce | 2016-09-27 14:29:57 -0700 | [diff] [blame] | 50 | |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 51 | virtual void OnMouseEnter(CPDFSDK_PageView* pPageView, |
tsepez | f8074ce | 2016-09-27 14:29:57 -0700 | [diff] [blame] | 52 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 53 | uint32_t nFlag) = 0; |
| 54 | virtual void OnMouseExit(CPDFSDK_PageView* pPageView, |
tsepez | f8074ce | 2016-09-27 14:29:57 -0700 | [diff] [blame] | 55 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 56 | uint32_t nFlag) = 0; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 57 | virtual bool OnLButtonDown(CPDFSDK_PageView* pPageView, |
| 58 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 59 | uint32_t nFlags, |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 60 | const CFX_PointF& point) = 0; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 61 | virtual bool OnLButtonUp(CPDFSDK_PageView* pPageView, |
| 62 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 63 | uint32_t nFlags, |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 64 | const CFX_PointF& point) = 0; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 65 | virtual bool OnLButtonDblClk(CPDFSDK_PageView* pPageView, |
tsepez | f8074ce | 2016-09-27 14:29:57 -0700 | [diff] [blame] | 66 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 67 | uint32_t nFlags, |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 68 | const CFX_PointF& point) = 0; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 69 | virtual bool OnMouseMove(CPDFSDK_PageView* pPageView, |
| 70 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 71 | uint32_t nFlags, |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 72 | const CFX_PointF& point) = 0; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 73 | virtual bool OnMouseWheel(CPDFSDK_PageView* pPageView, |
| 74 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 75 | uint32_t nFlags, |
| 76 | short zDelta, |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 77 | const CFX_PointF& point) = 0; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 78 | virtual bool OnRButtonDown(CPDFSDK_PageView* pPageView, |
| 79 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 80 | uint32_t nFlags, |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 81 | const CFX_PointF& point) = 0; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 82 | virtual bool OnRButtonUp(CPDFSDK_PageView* pPageView, |
| 83 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 84 | uint32_t nFlags, |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 85 | const CFX_PointF& point) = 0; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 86 | virtual bool OnRButtonDblClk(CPDFSDK_PageView* pPageView, |
| 87 | CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 88 | uint32_t nFlags, |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 89 | const CFX_PointF& point) = 0; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 90 | virtual bool OnChar(CPDFSDK_Annot* pAnnot, |
| 91 | uint32_t nChar, |
| 92 | uint32_t nFlags) = 0; |
| 93 | virtual bool OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) = 0; |
| 94 | virtual bool OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) = 0; |
| 95 | virtual bool OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 96 | uint32_t nFlag) = 0; |
| 97 | virtual bool OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 98 | uint32_t nFlag) = 0; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 99 | #ifdef PDF_ENABLE_XFA |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 100 | virtual bool OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot, |
| 101 | CPDFSDK_Annot::ObservedPtr* pNewAnnot) = 0; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 102 | #endif // PDF_ENABLE_XFA |
| 103 | }; |
| 104 | |
dsinclair | 114e46a | 2016-09-29 17:18:21 -0700 | [diff] [blame] | 105 | #endif // FPDFSDK_IPDFSDK_ANNOTHANDLER_H_ |