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 | |
| 7 | #ifndef FPDFSDK_INCLUDE_CPDFSDK_ANNOTHANDLERMGR_H_ |
| 8 | #define FPDFSDK_INCLUDE_CPDFSDK_ANNOTHANDLERMGR_H_ |
| 9 | |
| 10 | #include <map> |
| 11 | #include <memory> |
| 12 | |
jaepark | 956553e | 2016-08-31 06:49:27 -0700 | [diff] [blame] | 13 | #include "core/fpdfdoc/include/cpdf_annot.h" |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 14 | #include "core/fxcrt/include/fx_basic.h" |
| 15 | #include "core/fxcrt/include/fx_coordinates.h" |
| 16 | |
| 17 | class CFX_Matrix; |
| 18 | class CFX_RenderDevice; |
dsinclair | 79db609 | 2016-09-14 07:27:21 -0700 | [diff] [blame] | 19 | class CPDFSDK_Environment; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 20 | class CPDFSDK_Annot; |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 21 | class CPDFSDK_BAAnnotHandler; |
jaepark | 8c54182 | 2016-08-30 13:43:05 -0700 | [diff] [blame] | 22 | class CPDFSDK_WidgetHandler; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 23 | class CPDFSDK_PageView; |
| 24 | class IPDFSDK_AnnotHandler; |
| 25 | |
| 26 | #ifdef PDF_ENABLE_XFA |
jaepark | 8c54182 | 2016-08-30 13:43:05 -0700 | [diff] [blame] | 27 | class CPDFSDK_XFAWidgetHandler; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 28 | class CXFA_FFWidget; |
| 29 | #endif // PDF_ENABLE_XFA |
| 30 | |
| 31 | class CPDFSDK_AnnotHandlerMgr { |
| 32 | public: |
dsinclair | 79db609 | 2016-09-14 07:27:21 -0700 | [diff] [blame] | 33 | explicit CPDFSDK_AnnotHandlerMgr(CPDFSDK_Environment* pApp); |
tsepez | 9c33e89 | 2016-09-26 12:29:20 -0700 | [diff] [blame^] | 34 | ~CPDFSDK_AnnotHandlerMgr(); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 35 | |
tsepez | 9c33e89 | 2016-09-26 12:29:20 -0700 | [diff] [blame^] | 36 | CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 37 | #ifdef PDF_ENABLE_XFA |
tsepez | 9c33e89 | 2016-09-26 12:29:20 -0700 | [diff] [blame^] | 38 | CPDFSDK_Annot* NewAnnot(CXFA_FFWidget* pAnnot, CPDFSDK_PageView* pPageView); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 39 | #endif // PDF_ENABLE_XFA |
tsepez | 9c33e89 | 2016-09-26 12:29:20 -0700 | [diff] [blame^] | 40 | void ReleaseAnnot(CPDFSDK_Annot* pAnnot); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 41 | |
tsepez | 9c33e89 | 2016-09-26 12:29:20 -0700 | [diff] [blame^] | 42 | void Annot_OnCreate(CPDFSDK_Annot* pAnnot); |
| 43 | void Annot_OnLoad(CPDFSDK_Annot* pAnnot); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 44 | |
| 45 | IPDFSDK_AnnotHandler* GetAnnotHandler(CPDFSDK_Annot* pAnnot) const; |
tsepez | 9c33e89 | 2016-09-26 12:29:20 -0700 | [diff] [blame^] | 46 | void Annot_OnDraw(CPDFSDK_PageView* pPageView, |
| 47 | CPDFSDK_Annot* pAnnot, |
| 48 | CFX_RenderDevice* pDevice, |
| 49 | CFX_Matrix* pUser2Device, |
| 50 | bool bDrawAnnots); |
| 51 | |
| 52 | void Annot_OnMouseEnter(CPDFSDK_PageView* pPageView, |
| 53 | CPDFSDK_Annot* pAnnot, |
| 54 | uint32_t nFlags); |
| 55 | void Annot_OnMouseExit(CPDFSDK_PageView* pPageView, |
| 56 | CPDFSDK_Annot* pAnnot, |
| 57 | uint32_t nFlags); |
| 58 | FX_BOOL Annot_OnLButtonDown(CPDFSDK_PageView* pPageView, |
| 59 | CPDFSDK_Annot* pAnnot, |
| 60 | uint32_t nFlags, |
| 61 | const CFX_FloatPoint& point); |
| 62 | FX_BOOL Annot_OnLButtonUp(CPDFSDK_PageView* pPageView, |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 63 | CPDFSDK_Annot* pAnnot, |
tsepez | 9c33e89 | 2016-09-26 12:29:20 -0700 | [diff] [blame^] | 64 | uint32_t nFlags, |
| 65 | const CFX_FloatPoint& point); |
| 66 | FX_BOOL Annot_OnLButtonDblClk(CPDFSDK_PageView* pPageView, |
| 67 | CPDFSDK_Annot* pAnnot, |
| 68 | uint32_t nFlags, |
| 69 | const CFX_FloatPoint& point); |
| 70 | FX_BOOL Annot_OnMouseMove(CPDFSDK_PageView* pPageView, |
| 71 | CPDFSDK_Annot* pAnnot, |
| 72 | uint32_t nFlags, |
| 73 | const CFX_FloatPoint& point); |
| 74 | FX_BOOL Annot_OnMouseWheel(CPDFSDK_PageView* pPageView, |
| 75 | CPDFSDK_Annot* pAnnot, |
| 76 | uint32_t nFlags, |
| 77 | short zDelta, |
| 78 | const CFX_FloatPoint& point); |
| 79 | FX_BOOL Annot_OnRButtonDown(CPDFSDK_PageView* pPageView, |
| 80 | CPDFSDK_Annot* pAnnot, |
| 81 | uint32_t nFlags, |
| 82 | const CFX_FloatPoint& point); |
| 83 | FX_BOOL Annot_OnRButtonUp(CPDFSDK_PageView* pPageView, |
| 84 | CPDFSDK_Annot* pAnnot, |
| 85 | uint32_t nFlags, |
| 86 | const CFX_FloatPoint& point); |
| 87 | FX_BOOL Annot_OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags); |
| 88 | FX_BOOL Annot_OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag); |
| 89 | FX_BOOL Annot_OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 90 | |
tsepez | 9c33e89 | 2016-09-26 12:29:20 -0700 | [diff] [blame^] | 91 | FX_BOOL Annot_OnSetFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag); |
| 92 | FX_BOOL Annot_OnKillFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 93 | |
| 94 | #ifdef PDF_ENABLE_XFA |
tsepez | 9c33e89 | 2016-09-26 12:29:20 -0700 | [diff] [blame^] | 95 | FX_BOOL Annot_OnChangeFocus(CPDFSDK_Annot* pSetAnnot, |
| 96 | CPDFSDK_Annot* pKillAnnot); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 97 | #endif // PDF_ENABLE_XFA |
| 98 | |
tsepez | 9c33e89 | 2016-09-26 12:29:20 -0700 | [diff] [blame^] | 99 | CFX_FloatRect Annot_OnGetViewBBox(CPDFSDK_PageView* pPageView, |
| 100 | CPDFSDK_Annot* pAnnot); |
| 101 | FX_BOOL Annot_OnHitTest(CPDFSDK_PageView* pPageView, |
| 102 | CPDFSDK_Annot* pAnnot, |
| 103 | const CFX_FloatPoint& point); |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 104 | |
| 105 | private: |
jaepark | 956553e | 2016-08-31 06:49:27 -0700 | [diff] [blame] | 106 | IPDFSDK_AnnotHandler* GetAnnotHandler(CPDF_Annot::Subtype nSubtype) const; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 107 | CPDFSDK_Annot* GetNextAnnot(CPDFSDK_Annot* pSDKAnnot, FX_BOOL bNext); |
| 108 | |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 109 | std::unique_ptr<CPDFSDK_BAAnnotHandler> m_pBAAnnotHandler; |
jaepark | 8c54182 | 2016-08-30 13:43:05 -0700 | [diff] [blame] | 110 | std::unique_ptr<CPDFSDK_WidgetHandler> m_pWidgetHandler; |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 111 | #ifdef PDF_ENABLE_XFA |
jaepark | 8c54182 | 2016-08-30 13:43:05 -0700 | [diff] [blame] | 112 | std::unique_ptr<CPDFSDK_XFAWidgetHandler> m_pXFAWidgetHandler; |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 113 | #endif // PDF_ENABLE_XFA |
| 114 | |
dsinclair | 8e0638b | 2016-09-22 11:06:02 -0700 | [diff] [blame] | 115 | CPDFSDK_Environment* m_pEnv; |
jaepark | 98e1019 | 2016-08-15 10:51:11 -0700 | [diff] [blame] | 116 | }; |
| 117 | |
| 118 | #endif // FPDFSDK_INCLUDE_CPDFSDK_ANNOTHANDLERMGR_H_ |