jaepark | 35512aa | 2016-08-29 17:15:08 -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_CPDFSDK_BAANNOTHANDLER_H_ |
| 8 | #define FPDFSDK_CPDFSDK_BAANNOTHANDLER_H_ |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 9 | |
Tom Sepez | 0f35a9e | 2019-04-23 00:32:37 +0000 | [diff] [blame] | 10 | #include <memory> |
| 11 | |
dsinclair | a52ab74 | 2016-09-29 13:59:29 -0700 | [diff] [blame] | 12 | #include "core/fxcrt/fx_coordinates.h" |
dsinclair | 114e46a | 2016-09-29 17:18:21 -0700 | [diff] [blame] | 13 | #include "fpdfsdk/ipdfsdk_annothandler.h" |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 14 | |
dsinclair | b94d7c9 | 2016-09-21 12:07:00 -0700 | [diff] [blame] | 15 | class CFFL_InteractiveFormFiller; |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 16 | class CFX_Matrix; |
| 17 | class CFX_RenderDevice; |
| 18 | class CPDF_Annot; |
dsinclair | 735606d | 2016-10-05 15:47:02 -0700 | [diff] [blame] | 19 | class CPDFSDK_FormFillEnvironment; |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 20 | class CPDFSDK_Annot; |
| 21 | class CPDFSDK_PageView; |
| 22 | |
Tom Sepez | 5586545 | 2018-08-27 20:18:04 +0000 | [diff] [blame] | 23 | class CPDFSDK_BAAnnotHandler final : public IPDFSDK_AnnotHandler { |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 24 | public: |
| 25 | CPDFSDK_BAAnnotHandler(); |
| 26 | ~CPDFSDK_BAAnnotHandler() override; |
| 27 | |
Tom Sepez | 4935770 | 2019-08-19 17:17:18 +0000 | [diff] [blame] | 28 | // IPDFSDK_AnnotHandler: |
| 29 | void SetFormFillEnvironment( |
| 30 | CPDFSDK_FormFillEnvironment* pFormFillEnv) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 31 | bool CanAnswer(CPDFSDK_Annot* pAnnot) override; |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 32 | CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) override; |
Tom Sepez | 0f35a9e | 2019-04-23 00:32:37 +0000 | [diff] [blame] | 33 | void ReleaseAnnot(std::unique_ptr<CPDFSDK_Annot> pAnnot) override; |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 34 | CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView, |
| 35 | CPDFSDK_Annot* pAnnot) override; |
Lei Zhang | a4c7ac4 | 2018-04-17 15:12:58 +0000 | [diff] [blame] | 36 | WideString GetText(CPDFSDK_Annot* pAnnot) override; |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 37 | WideString GetSelectedText(CPDFSDK_Annot* pAnnot) override; |
| 38 | void ReplaceSelection(CPDFSDK_Annot* pAnnot, const WideString& text) override; |
Lei Zhang | ee96772 | 2018-04-19 20:55:54 +0000 | [diff] [blame] | 39 | bool CanUndo(CPDFSDK_Annot* pAnnot) override; |
| 40 | bool CanRedo(CPDFSDK_Annot* pAnnot) override; |
| 41 | bool Undo(CPDFSDK_Annot* pAnnot) override; |
| 42 | bool Redo(CPDFSDK_Annot* pAnnot) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 43 | bool HitTest(CPDFSDK_PageView* pPageView, |
| 44 | CPDFSDK_Annot* pAnnot, |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 45 | const CFX_PointF& point) override; |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 46 | void OnDraw(CPDFSDK_PageView* pPageView, |
| 47 | CPDFSDK_Annot* pAnnot, |
| 48 | CFX_RenderDevice* pDevice, |
Lei Zhang | 09ee087 | 2018-10-09 19:13:55 +0000 | [diff] [blame] | 49 | const CFX_Matrix& mtUser2Device, |
jaepark | 75f84a5 | 2016-09-09 15:39:09 -0700 | [diff] [blame] | 50 | bool bDrawAnnots) override; |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 51 | void OnLoad(CPDFSDK_Annot* pAnnot) override; |
tsepez | f8074ce | 2016-09-27 14:29:57 -0700 | [diff] [blame] | 52 | |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 53 | void OnMouseEnter(CPDFSDK_PageView* pPageView, |
Tom Sepez | d8ae8f8 | 2019-06-12 17:58:33 +0000 | [diff] [blame] | 54 | ObservedPtr<CPDFSDK_Annot>* pAnnot, |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 55 | uint32_t nFlag) override; |
| 56 | void OnMouseExit(CPDFSDK_PageView* pPageView, |
Tom Sepez | d8ae8f8 | 2019-06-12 17:58:33 +0000 | [diff] [blame] | 57 | ObservedPtr<CPDFSDK_Annot>* pAnnot, |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 58 | uint32_t nFlag) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 59 | bool OnLButtonDown(CPDFSDK_PageView* pPageView, |
Tom Sepez | d8ae8f8 | 2019-06-12 17:58:33 +0000 | [diff] [blame] | 60 | ObservedPtr<CPDFSDK_Annot>* pAnnot, |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 61 | uint32_t nFlags, |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 62 | const CFX_PointF& point) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 63 | bool OnLButtonUp(CPDFSDK_PageView* pPageView, |
Tom Sepez | d8ae8f8 | 2019-06-12 17:58:33 +0000 | [diff] [blame] | 64 | ObservedPtr<CPDFSDK_Annot>* pAnnot, |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 65 | uint32_t nFlags, |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 66 | const CFX_PointF& point) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 67 | bool OnLButtonDblClk(CPDFSDK_PageView* pPageView, |
Tom Sepez | d8ae8f8 | 2019-06-12 17:58:33 +0000 | [diff] [blame] | 68 | ObservedPtr<CPDFSDK_Annot>* pAnnot, |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 69 | uint32_t nFlags, |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 70 | const CFX_PointF& point) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 71 | bool OnMouseMove(CPDFSDK_PageView* pPageView, |
Tom Sepez | d8ae8f8 | 2019-06-12 17:58:33 +0000 | [diff] [blame] | 72 | ObservedPtr<CPDFSDK_Annot>* pAnnot, |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 73 | uint32_t nFlags, |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 74 | const CFX_PointF& point) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 75 | bool OnMouseWheel(CPDFSDK_PageView* pPageView, |
Tom Sepez | d8ae8f8 | 2019-06-12 17:58:33 +0000 | [diff] [blame] | 76 | ObservedPtr<CPDFSDK_Annot>* pAnnot, |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 77 | uint32_t nFlags, |
| 78 | short zDelta, |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 79 | const CFX_PointF& point) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 80 | bool OnRButtonDown(CPDFSDK_PageView* pPageView, |
Tom Sepez | d8ae8f8 | 2019-06-12 17:58:33 +0000 | [diff] [blame] | 81 | ObservedPtr<CPDFSDK_Annot>* pAnnot, |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 82 | uint32_t nFlags, |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 83 | const CFX_PointF& point) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 84 | bool OnRButtonUp(CPDFSDK_PageView* pPageView, |
Tom Sepez | d8ae8f8 | 2019-06-12 17:58:33 +0000 | [diff] [blame] | 85 | ObservedPtr<CPDFSDK_Annot>* pAnnot, |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 86 | uint32_t nFlags, |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 87 | const CFX_PointF& point) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 88 | bool OnRButtonDblClk(CPDFSDK_PageView* pPageView, |
Tom Sepez | d8ae8f8 | 2019-06-12 17:58:33 +0000 | [diff] [blame] | 89 | ObservedPtr<CPDFSDK_Annot>* pAnnot, |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 90 | uint32_t nFlags, |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 91 | const CFX_PointF& point) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 92 | bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override; |
| 93 | bool OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; |
| 94 | bool OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; |
Tom Sepez | d8ae8f8 | 2019-06-12 17:58:33 +0000 | [diff] [blame] | 95 | bool OnSetFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlag) override; |
| 96 | bool OnKillFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlag) override; |
| 97 | bool SetIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot, |
rycsmith | a5230e2 | 2019-02-21 17:33:03 +0000 | [diff] [blame] | 98 | int index, |
| 99 | bool selected) override; |
Tom Sepez | d8ae8f8 | 2019-06-12 17:58:33 +0000 | [diff] [blame] | 100 | bool IsIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot, int index) override; |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 101 | }; |
| 102 | |
dsinclair | 114e46a | 2016-09-29 17:18:21 -0700 | [diff] [blame] | 103 | #endif // FPDFSDK_CPDFSDK_BAANNOTHANDLER_H_ |