| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef FPDFSDK_INCLUDE_FSDK_ANNOTHANDLER_H_ | 7 #ifndef FPDFSDK_INCLUDE_FSDK_ANNOTHANDLER_H_ |
| 8 #define FPDFSDK_INCLUDE_FSDK_ANNOTHANDLER_H_ | 8 #define FPDFSDK_INCLUDE_FSDK_ANNOTHANDLER_H_ |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "core/fxcrt/include/fx_basic.h" | 13 #include "core/fxcrt/include/fx_basic.h" |
| 14 #include "core/fxcrt/include/fx_coordinates.h" | 14 #include "core/fxcrt/include/fx_coordinates.h" |
| 15 | 15 |
| 16 #ifdef PDF_ENABLE_XFA | 16 #ifdef PDF_ENABLE_XFA |
| 17 #include "xfa/fxfa/include/fxfa.h" | |
| 18 #include "xfa/fxfa/include/xfa_ffdocview.h" | |
| 19 #include "xfa/fxfa/include/xfa_ffpageview.h" | |
| 20 #include "xfa/fxfa/include/xfa_ffwidgethandler.h" | |
| 21 | |
| 22 #define FSDK_XFAWIDGET_TYPENAME "XFAWidget" | 17 #define FSDK_XFAWIDGET_TYPENAME "XFAWidget" |
| 23 #endif // PDF_ENABLE_XFA | 18 #endif // PDF_ENABLE_XFA |
| 24 | 19 |
| 25 class CFFL_IFormFiller; | 20 class CFFL_IFormFiller; |
| 26 class CFX_RenderDevice; | 21 class CFX_RenderDevice; |
| 27 class CPDFDoc_Environment; | 22 class CPDFDoc_Environment; |
| 28 class CPDFSDK_Annot; | 23 class CPDFSDK_Annot; |
| 29 class CPDFSDK_PageView; | 24 class CPDFSDK_PageView; |
| 30 class CPDF_Annot; | 25 class CPDF_Annot; |
| 31 class CFX_Matrix; | 26 class CFX_Matrix; |
| 32 class CFX_FloatPoint; | 27 class CFX_FloatPoint; |
| 28 #ifdef PDF_ENABLE_XFA |
| 29 class CXFA_FFWidget; |
| 30 class CXFA_FFWidgetHandler; |
| 31 #endif // PDF_ENABLE_XFA |
| 33 | 32 |
| 34 class IPDFSDK_AnnotHandler { | 33 class IPDFSDK_AnnotHandler { |
| 35 public: | 34 public: |
| 36 virtual ~IPDFSDK_AnnotHandler() {} | 35 virtual ~IPDFSDK_AnnotHandler() {} |
| 37 | 36 |
| 38 virtual CFX_ByteString GetType() = 0; | 37 virtual CFX_ByteString GetType() = 0; |
| 39 | |
| 40 virtual CFX_ByteString GetName() = 0; | 38 virtual CFX_ByteString GetName() = 0; |
| 41 | |
| 42 virtual FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) = 0; | 39 virtual FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) = 0; |
| 43 | |
| 44 virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, | 40 virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, |
| 45 CPDFSDK_PageView* pPage) = 0; | 41 CPDFSDK_PageView* pPage) = 0; |
| 46 | 42 |
| 47 #ifdef PDF_ENABLE_XFA | 43 #ifdef PDF_ENABLE_XFA |
| 48 virtual CPDFSDK_Annot* NewAnnot(CXFA_FFWidget* hWidget, | 44 virtual CPDFSDK_Annot* NewAnnot(CXFA_FFWidget* hWidget, |
| 49 CPDFSDK_PageView* pPage) = 0; | 45 CPDFSDK_PageView* pPage) = 0; |
| 50 #endif // PDF_ENABLE_XFA | 46 #endif // PDF_ENABLE_XFA |
| 51 | 47 |
| 52 virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot) = 0; | 48 virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot) = 0; |
| 53 | |
| 54 virtual void DeleteAnnot(CPDFSDK_Annot* pAnnot) = 0; | 49 virtual void DeleteAnnot(CPDFSDK_Annot* pAnnot) = 0; |
| 55 | |
| 56 virtual CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView, | 50 virtual CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView, |
| 57 CPDFSDK_Annot* pAnnot) = 0; | 51 CPDFSDK_Annot* pAnnot) = 0; |
| 58 | |
| 59 virtual FX_BOOL HitTest(CPDFSDK_PageView* pPageView, | 52 virtual FX_BOOL HitTest(CPDFSDK_PageView* pPageView, |
| 60 CPDFSDK_Annot* pAnnot, | 53 CPDFSDK_Annot* pAnnot, |
| 61 const CFX_FloatPoint& point) = 0; | 54 const CFX_FloatPoint& point) = 0; |
| 62 | |
| 63 virtual void OnDraw(CPDFSDK_PageView* pPageView, | 55 virtual void OnDraw(CPDFSDK_PageView* pPageView, |
| 64 CPDFSDK_Annot* pAnnot, | 56 CPDFSDK_Annot* pAnnot, |
| 65 CFX_RenderDevice* pDevice, | 57 CFX_RenderDevice* pDevice, |
| 66 CFX_Matrix* pUser2Device, | 58 CFX_Matrix* pUser2Device, |
| 67 uint32_t dwFlags) = 0; | 59 uint32_t dwFlags) = 0; |
| 68 | |
| 69 virtual void OnDrawSleep(CPDFSDK_PageView* pPageView, | 60 virtual void OnDrawSleep(CPDFSDK_PageView* pPageView, |
| 70 CPDFSDK_Annot* pAnnot, | 61 CPDFSDK_Annot* pAnnot, |
| 71 CFX_RenderDevice* pDevice, | 62 CFX_RenderDevice* pDevice, |
| 72 CFX_Matrix* pUser2Device, | 63 CFX_Matrix* pUser2Device, |
| 73 const CFX_FloatRect& rcWindow, | 64 const CFX_FloatRect& rcWindow, |
| 74 uint32_t dwFlags) = 0; | 65 uint32_t dwFlags) = 0; |
| 75 | 66 |
| 76 virtual void OnCreate(CPDFSDK_Annot* pAnnot) = 0; | 67 virtual void OnCreate(CPDFSDK_Annot* pAnnot) = 0; |
| 77 | |
| 78 virtual void OnLoad(CPDFSDK_Annot* pAnnot) = 0; | 68 virtual void OnLoad(CPDFSDK_Annot* pAnnot) = 0; |
| 79 | |
| 80 virtual void OnDelete(CPDFSDK_Annot* pAnnot) = 0; | 69 virtual void OnDelete(CPDFSDK_Annot* pAnnot) = 0; |
| 81 | |
| 82 virtual void OnRelease(CPDFSDK_Annot* pAnnot) = 0; | 70 virtual void OnRelease(CPDFSDK_Annot* pAnnot) = 0; |
| 83 | |
| 84 virtual void OnMouseEnter(CPDFSDK_PageView* pPageView, | 71 virtual void OnMouseEnter(CPDFSDK_PageView* pPageView, |
| 85 CPDFSDK_Annot* pAnnot, | 72 CPDFSDK_Annot* pAnnot, |
| 86 uint32_t nFlag) = 0; | 73 uint32_t nFlag) = 0; |
| 87 virtual void OnMouseExit(CPDFSDK_PageView* pPageView, | 74 virtual void OnMouseExit(CPDFSDK_PageView* pPageView, |
| 88 CPDFSDK_Annot* pAnnot, | 75 CPDFSDK_Annot* pAnnot, |
| 89 uint32_t nFlag) = 0; | 76 uint32_t nFlag) = 0; |
| 90 | |
| 91 virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView, | 77 virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView, |
| 92 CPDFSDK_Annot* pAnnot, | 78 CPDFSDK_Annot* pAnnot, |
| 93 uint32_t nFlags, | 79 uint32_t nFlags, |
| 94 const CFX_FloatPoint& point) = 0; | 80 const CFX_FloatPoint& point) = 0; |
| 95 virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView, | 81 virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView, |
| 96 CPDFSDK_Annot* pAnnot, | 82 CPDFSDK_Annot* pAnnot, |
| 97 uint32_t nFlags, | 83 uint32_t nFlags, |
| 98 const CFX_FloatPoint& point) = 0; | 84 const CFX_FloatPoint& point) = 0; |
| 99 virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView, | 85 virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView, |
| 100 CPDFSDK_Annot* pAnnot, | 86 CPDFSDK_Annot* pAnnot, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 114 uint32_t nFlags, | 100 uint32_t nFlags, |
| 115 const CFX_FloatPoint& point) = 0; | 101 const CFX_FloatPoint& point) = 0; |
| 116 virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView, | 102 virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView, |
| 117 CPDFSDK_Annot* pAnnot, | 103 CPDFSDK_Annot* pAnnot, |
| 118 uint32_t nFlags, | 104 uint32_t nFlags, |
| 119 const CFX_FloatPoint& point) = 0; | 105 const CFX_FloatPoint& point) = 0; |
| 120 virtual FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView, | 106 virtual FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView, |
| 121 CPDFSDK_Annot* pAnnot, | 107 CPDFSDK_Annot* pAnnot, |
| 122 uint32_t nFlags, | 108 uint32_t nFlags, |
| 123 const CFX_FloatPoint& point) = 0; | 109 const CFX_FloatPoint& point) = 0; |
| 124 // by wjm. | |
| 125 virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, | 110 virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, |
| 126 uint32_t nChar, | 111 uint32_t nChar, |
| 127 uint32_t nFlags) = 0; | 112 uint32_t nFlags) = 0; |
| 128 virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) = 0; | 113 virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) = 0; |
| 129 virtual FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) = 0; | 114 virtual FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) = 0; |
| 130 | |
| 131 virtual void OnDeSelected(CPDFSDK_Annot* pAnnot) = 0; | 115 virtual void OnDeSelected(CPDFSDK_Annot* pAnnot) = 0; |
| 132 virtual void OnSelected(CPDFSDK_Annot* pAnnot) = 0; | 116 virtual void OnSelected(CPDFSDK_Annot* pAnnot) = 0; |
| 133 | |
| 134 virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag) = 0; | 117 virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag) = 0; |
| 135 virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag) = 0; | 118 virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag) = 0; |
| 136 #ifdef PDF_ENABLE_XFA | 119 #ifdef PDF_ENABLE_XFA |
| 137 virtual FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, | 120 virtual FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, |
| 138 CPDFSDK_Annot* pNewAnnot) = 0; | 121 CPDFSDK_Annot* pNewAnnot) = 0; |
| 139 #endif // PDF_ENABLE_XFA | 122 #endif // PDF_ENABLE_XFA |
| 140 }; | 123 }; |
| 141 | 124 |
| 142 class CPDFSDK_BFAnnotHandler : public IPDFSDK_AnnotHandler { | 125 class CPDFSDK_BFAnnotHandler : public IPDFSDK_AnnotHandler { |
| 143 public: | 126 public: |
| 144 explicit CPDFSDK_BFAnnotHandler(CPDFDoc_Environment* pApp) | 127 explicit CPDFSDK_BFAnnotHandler(CPDFDoc_Environment* pApp); |
| 145 : m_pApp(pApp), m_pFormFiller(nullptr) {} | 128 ~CPDFSDK_BFAnnotHandler() override; |
| 146 ~CPDFSDK_BFAnnotHandler() override {} | |
| 147 | 129 |
| 148 // IPDFSDK_AnnotHandler | 130 // IPDFSDK_AnnotHandler |
| 149 CFX_ByteString GetType() override { return CFX_ByteString("Widget"); } | 131 CFX_ByteString GetType() override; |
| 150 CFX_ByteString GetName() override { return CFX_ByteString("WidgetHandler"); } | 132 CFX_ByteString GetName() override; |
| 151 FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) override; | 133 FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) override; |
| 152 CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) override; | 134 CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) override; |
| 153 #ifdef PDF_ENABLE_XFA | 135 #ifdef PDF_ENABLE_XFA |
| 154 CPDFSDK_Annot* NewAnnot(CXFA_FFWidget* hWidget, | 136 CPDFSDK_Annot* NewAnnot(CXFA_FFWidget* hWidget, |
| 155 CPDFSDK_PageView* pPage) override; | 137 CPDFSDK_PageView* pPage) override; |
| 156 #endif // PDF_ENABLE_XFA | 138 #endif // PDF_ENABLE_XFA |
| 157 void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override; | 139 void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override; |
| 158 void DeleteAnnot(CPDFSDK_Annot* pAnnot) override {} | 140 void DeleteAnnot(CPDFSDK_Annot* pAnnot) override; |
| 159 CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView, | 141 CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView, |
| 160 CPDFSDK_Annot* pAnnot) override; | 142 CPDFSDK_Annot* pAnnot) override; |
| 161 FX_BOOL HitTest(CPDFSDK_PageView* pPageView, | 143 FX_BOOL HitTest(CPDFSDK_PageView* pPageView, |
| 162 CPDFSDK_Annot* pAnnot, | 144 CPDFSDK_Annot* pAnnot, |
| 163 const CFX_FloatPoint& point) override; | 145 const CFX_FloatPoint& point) override; |
| 164 void OnDraw(CPDFSDK_PageView* pPageView, | 146 void OnDraw(CPDFSDK_PageView* pPageView, |
| 165 CPDFSDK_Annot* pAnnot, | 147 CPDFSDK_Annot* pAnnot, |
| 166 CFX_RenderDevice* pDevice, | 148 CFX_RenderDevice* pDevice, |
| 167 CFX_Matrix* pUser2Device, | 149 CFX_Matrix* pUser2Device, |
| 168 uint32_t dwFlags) override; | 150 uint32_t dwFlags) override; |
| 169 void OnDrawSleep(CPDFSDK_PageView* pPageView, | 151 void OnDrawSleep(CPDFSDK_PageView* pPageView, |
| 170 CPDFSDK_Annot* pAnnot, | 152 CPDFSDK_Annot* pAnnot, |
| 171 CFX_RenderDevice* pDevice, | 153 CFX_RenderDevice* pDevice, |
| 172 CFX_Matrix* pUser2Device, | 154 CFX_Matrix* pUser2Device, |
| 173 const CFX_FloatRect& rcWindow, | 155 const CFX_FloatRect& rcWindow, |
| 174 uint32_t dwFlags) override {} | 156 uint32_t dwFlags) override; |
| 175 void OnCreate(CPDFSDK_Annot* pAnnot) override; | 157 void OnCreate(CPDFSDK_Annot* pAnnot) override; |
| 176 void OnLoad(CPDFSDK_Annot* pAnnot) override; | 158 void OnLoad(CPDFSDK_Annot* pAnnot) override; |
| 177 void OnDelete(CPDFSDK_Annot* pAnnot) override {} | 159 void OnDelete(CPDFSDK_Annot* pAnnot) override; |
| 178 void OnRelease(CPDFSDK_Annot* pAnnot) override {} | 160 void OnRelease(CPDFSDK_Annot* pAnnot) override; |
| 179 void OnMouseEnter(CPDFSDK_PageView* pPageView, | 161 void OnMouseEnter(CPDFSDK_PageView* pPageView, |
| 180 CPDFSDK_Annot* pAnnot, | 162 CPDFSDK_Annot* pAnnot, |
| 181 uint32_t nFlag) override; | 163 uint32_t nFlag) override; |
| 182 void OnMouseExit(CPDFSDK_PageView* pPageView, | 164 void OnMouseExit(CPDFSDK_PageView* pPageView, |
| 183 CPDFSDK_Annot* pAnnot, | 165 CPDFSDK_Annot* pAnnot, |
| 184 uint32_t nFlag) override; | 166 uint32_t nFlag) override; |
| 185 FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView, | 167 FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView, |
| 186 CPDFSDK_Annot* pAnnot, | 168 CPDFSDK_Annot* pAnnot, |
| 187 uint32_t nFlags, | 169 uint32_t nFlags, |
| 188 const CFX_FloatPoint& point) override; | 170 const CFX_FloatPoint& point) override; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 207 CPDFSDK_Annot* pAnnot, | 189 CPDFSDK_Annot* pAnnot, |
| 208 uint32_t nFlags, | 190 uint32_t nFlags, |
| 209 const CFX_FloatPoint& point) override; | 191 const CFX_FloatPoint& point) override; |
| 210 FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView, | 192 FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView, |
| 211 CPDFSDK_Annot* pAnnot, | 193 CPDFSDK_Annot* pAnnot, |
| 212 uint32_t nFlags, | 194 uint32_t nFlags, |
| 213 const CFX_FloatPoint& point) override; | 195 const CFX_FloatPoint& point) override; |
| 214 FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView, | 196 FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView, |
| 215 CPDFSDK_Annot* pAnnot, | 197 CPDFSDK_Annot* pAnnot, |
| 216 uint32_t nFlags, | 198 uint32_t nFlags, |
| 217 const CFX_FloatPoint& point) override { | 199 const CFX_FloatPoint& point) override; |
| 218 return FALSE; | |
| 219 } | |
| 220 FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, | 200 FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, |
| 221 uint32_t nChar, | 201 uint32_t nChar, |
| 222 uint32_t nFlags) override; | 202 uint32_t nFlags) override; |
| 223 FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; | 203 FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; |
| 224 FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; | 204 FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; |
| 225 void OnDeSelected(CPDFSDK_Annot* pAnnot) override {} | 205 void OnDeSelected(CPDFSDK_Annot* pAnnot) override {} |
| 226 void OnSelected(CPDFSDK_Annot* pAnnot) override {} | 206 void OnSelected(CPDFSDK_Annot* pAnnot) override {} |
| 227 FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag) override; | 207 FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag) override; |
| 228 FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag) override; | 208 FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag) override; |
| 229 #ifdef PDF_ENABLE_XFA | 209 #ifdef PDF_ENABLE_XFA |
| 230 FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, | 210 FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, |
| 231 CPDFSDK_Annot* pNewAnnot) override { | 211 CPDFSDK_Annot* pNewAnnot) override; |
| 232 return TRUE; | |
| 233 } | |
| 234 #endif // PDF_ENABLE_XFA | 212 #endif // PDF_ENABLE_XFA |
| 235 | 213 |
| 236 void SetFormFiller(CFFL_IFormFiller* pFiller) { m_pFormFiller = pFiller; } | 214 void SetFormFiller(CFFL_IFormFiller* pFiller) { m_pFormFiller = pFiller; } |
| 237 CFFL_IFormFiller* GetFormFiller() { return m_pFormFiller; } | 215 CFFL_IFormFiller* GetFormFiller() { return m_pFormFiller; } |
| 238 | 216 |
| 239 private: | 217 private: |
| 240 CPDFDoc_Environment* m_pApp; | 218 CPDFDoc_Environment* m_pApp; |
| 241 CFFL_IFormFiller* m_pFormFiller; | 219 CFFL_IFormFiller* m_pFormFiller; |
| 242 }; | 220 }; |
| 243 | 221 |
| 244 #ifdef PDF_ENABLE_XFA | 222 #ifdef PDF_ENABLE_XFA |
| 245 class CPDFSDK_XFAAnnotHandler : public IPDFSDK_AnnotHandler { | 223 class CPDFSDK_XFAAnnotHandler : public IPDFSDK_AnnotHandler { |
| 246 public: | 224 public: |
| 247 explicit CPDFSDK_XFAAnnotHandler(CPDFDoc_Environment* pApp); | 225 explicit CPDFSDK_XFAAnnotHandler(CPDFDoc_Environment* pApp); |
| 248 ~CPDFSDK_XFAAnnotHandler() {} | 226 ~CPDFSDK_XFAAnnotHandler() override; |
| 249 | 227 |
| 250 public: | 228 // IPDFSDK_AnnotHandler |
| 251 virtual CFX_ByteString GetType() { return FSDK_XFAWIDGET_TYPENAME; } | 229 CFX_ByteString GetType() override; |
| 252 | 230 CFX_ByteString GetName() override; |
| 253 virtual CFX_ByteString GetName() { return "XFAWidgetHandler"; } | 231 FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) override; |
| 254 | 232 CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) override; |
| 255 virtual FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot); | 233 CPDFSDK_Annot* NewAnnot(CXFA_FFWidget* pAnnot, |
| 256 | 234 CPDFSDK_PageView* pPage) override; |
| 257 virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) { | 235 void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override; |
| 258 return nullptr; | 236 void DeleteAnnot(CPDFSDK_Annot* pAnnot) override; |
| 259 } | 237 CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView, |
| 260 | 238 CPDFSDK_Annot* pAnnot) override; |
| 261 virtual CPDFSDK_Annot* NewAnnot(CXFA_FFWidget* pAnnot, | 239 FX_BOOL HitTest(CPDFSDK_PageView* pPageView, |
| 262 CPDFSDK_PageView* pPage); | 240 CPDFSDK_Annot* pAnnot, |
| 263 | 241 const CFX_FloatPoint& point) override; |
| 264 virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot); | 242 void OnDraw(CPDFSDK_PageView* pPageView, |
| 265 | 243 CPDFSDK_Annot* pAnnot, |
| 266 virtual void DeleteAnnot(CPDFSDK_Annot* pAnnot) {} | 244 CFX_RenderDevice* pDevice, |
| 267 | 245 CFX_Matrix* pUser2Device, |
| 268 virtual CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView, | 246 uint32_t dwFlags) override; |
| 269 CPDFSDK_Annot* pAnnot); | 247 void OnDrawSleep(CPDFSDK_PageView* pPageView, |
| 270 | 248 CPDFSDK_Annot* pAnnot, |
| 271 virtual FX_BOOL HitTest(CPDFSDK_PageView* pPageView, | 249 CFX_RenderDevice* pDevice, |
| 250 CFX_Matrix* pUser2Device, |
| 251 const CFX_FloatRect& rcWindow, |
| 252 uint32_t dwFlags) override; |
| 253 void OnCreate(CPDFSDK_Annot* pAnnot) override; |
| 254 void OnLoad(CPDFSDK_Annot* pAnnot) override; |
| 255 void OnDelete(CPDFSDK_Annot* pAnnot) override; |
| 256 void OnRelease(CPDFSDK_Annot* pAnnot) override; |
| 257 void OnMouseEnter(CPDFSDK_PageView* pPageView, |
| 258 CPDFSDK_Annot* pAnnot, |
| 259 uint32_t nFlag) override; |
| 260 void OnMouseExit(CPDFSDK_PageView* pPageView, |
| 261 CPDFSDK_Annot* pAnnot, |
| 262 uint32_t nFlag) override; |
| 263 FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView, |
| 264 CPDFSDK_Annot* pAnnot, |
| 265 uint32_t nFlags, |
| 266 const CFX_FloatPoint& point) override; |
| 267 FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView, |
| 268 CPDFSDK_Annot* pAnnot, |
| 269 uint32_t nFlags, |
| 270 const CFX_FloatPoint& point) override; |
| 271 FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView, |
| 272 CPDFSDK_Annot* pAnnot, | 272 CPDFSDK_Annot* pAnnot, |
| 273 const CFX_FloatPoint& point); | 273 uint32_t nFlags, |
| 274 | 274 const CFX_FloatPoint& point) override; |
| 275 virtual void OnDraw(CPDFSDK_PageView* pPageView, | 275 FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView, |
| 276 CPDFSDK_Annot* pAnnot, | 276 CPDFSDK_Annot* pAnnot, |
| 277 CFX_RenderDevice* pDevice, | 277 uint32_t nFlags, |
| 278 CFX_Matrix* pUser2Device, | 278 const CFX_FloatPoint& point) override; |
| 279 uint32_t dwFlags); | 279 FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView, |
| 280 | 280 CPDFSDK_Annot* pAnnot, |
| 281 virtual void OnDrawSleep(CPDFSDK_PageView* pPageView, | 281 uint32_t nFlags, |
| 282 CPDFSDK_Annot* pAnnot, | 282 short zDelta, |
| 283 CFX_RenderDevice* pDevice, | 283 const CFX_FloatPoint& point) override; |
| 284 CFX_Matrix* pUser2Device, | 284 FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView, |
| 285 const CFX_FloatRect& rcWindow, | 285 CPDFSDK_Annot* pAnnot, |
| 286 uint32_t dwFlags) {} | 286 uint32_t nFlags, |
| 287 | 287 const CFX_FloatPoint& point) override; |
| 288 virtual void OnCreate(CPDFSDK_Annot* pAnnot) {} | 288 FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView, |
| 289 | 289 CPDFSDK_Annot* pAnnot, |
| 290 virtual void OnLoad(CPDFSDK_Annot* pAnnot) {} | 290 uint32_t nFlags, |
| 291 | 291 const CFX_FloatPoint& point) override; |
| 292 virtual void OnDelete(CPDFSDK_Annot* pAnnot) {} | 292 FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView, |
| 293 | 293 CPDFSDK_Annot* pAnnot, |
| 294 virtual void OnRelease(CPDFSDK_Annot* pAnnot) {} | 294 uint32_t nFlags, |
| 295 | 295 const CFX_FloatPoint& point) override; |
| 296 virtual void OnMouseEnter(CPDFSDK_PageView* pPageView, | 296 FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, |
| 297 CPDFSDK_Annot* pAnnot, | 297 uint32_t nChar, |
| 298 uint32_t nFlag); | 298 uint32_t nFlags) override; |
| 299 virtual void OnMouseExit(CPDFSDK_PageView* pPageView, | 299 FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; |
| 300 CPDFSDK_Annot* pAnnot, | 300 FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; |
| 301 uint32_t nFlag); | 301 void OnDeSelected(CPDFSDK_Annot* pAnnot) override; |
| 302 | 302 void OnSelected(CPDFSDK_Annot* pAnnot) override; |
| 303 virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView, | 303 FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag) override; |
| 304 CPDFSDK_Annot* pAnnot, | 304 FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag) override; |
| 305 uint32_t nFlags, | 305 FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, |
| 306 const CFX_FloatPoint& point); | 306 CPDFSDK_Annot* pNewAnnot) override; |
| 307 virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView, | |
| 308 CPDFSDK_Annot* pAnnot, | |
| 309 uint32_t nFlags, | |
| 310 const CFX_FloatPoint& point); | |
| 311 virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView, | |
| 312 CPDFSDK_Annot* pAnnot, | |
| 313 uint32_t nFlags, | |
| 314 const CFX_FloatPoint& point); | |
| 315 virtual FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView, | |
| 316 CPDFSDK_Annot* pAnnot, | |
| 317 uint32_t nFlags, | |
| 318 const CFX_FloatPoint& point); | |
| 319 virtual FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView, | |
| 320 CPDFSDK_Annot* pAnnot, | |
| 321 uint32_t nFlags, | |
| 322 short zDelta, | |
| 323 const CFX_FloatPoint& point); | |
| 324 virtual FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView, | |
| 325 CPDFSDK_Annot* pAnnot, | |
| 326 uint32_t nFlags, | |
| 327 const CFX_FloatPoint& point); | |
| 328 virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView, | |
| 329 CPDFSDK_Annot* pAnnot, | |
| 330 uint32_t nFlags, | |
| 331 const CFX_FloatPoint& point); | |
| 332 virtual FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView, | |
| 333 CPDFSDK_Annot* pAnnot, | |
| 334 uint32_t nFlags, | |
| 335 const CFX_FloatPoint& point); | |
| 336 // by wjm. | |
| 337 virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, | |
| 338 uint32_t nChar, | |
| 339 uint32_t nFlags); | |
| 340 virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag); | |
| 341 virtual FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag); | |
| 342 | |
| 343 virtual void OnDeSelected(CPDFSDK_Annot* pAnnot) {} | |
| 344 virtual void OnSelected(CPDFSDK_Annot* pAnnot) {} | |
| 345 | |
| 346 virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag); | |
| 347 virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag); | |
| 348 virtual FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, | |
| 349 CPDFSDK_Annot* pNewAnnot); | |
| 350 | 307 |
| 351 private: | 308 private: |
| 352 CXFA_FFWidgetHandler* GetXFAWidgetHandler(CPDFSDK_Annot* pAnnot); | 309 CXFA_FFWidgetHandler* GetXFAWidgetHandler(CPDFSDK_Annot* pAnnot); |
| 353 uint32_t GetFWLFlags(uint32_t dwFlag); | 310 uint32_t GetFWLFlags(uint32_t dwFlag); |
| 354 | 311 |
| 355 private: | 312 private: |
| 356 CPDFDoc_Environment* m_pApp; | 313 CPDFDoc_Environment* m_pApp; |
| 357 }; | 314 }; |
| 358 #endif // PDF_ENABLE_XFA | 315 #endif // PDF_ENABLE_XFA |
| 359 | 316 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 private: | 424 private: |
| 468 CPDFSDK_Annot* NextAnnot(); | 425 CPDFSDK_Annot* NextAnnot(); |
| 469 CPDFSDK_Annot* PrevAnnot(); | 426 CPDFSDK_Annot* PrevAnnot(); |
| 470 | 427 |
| 471 std::vector<CPDFSDK_Annot*> m_iteratorAnnotList; | 428 std::vector<CPDFSDK_Annot*> m_iteratorAnnotList; |
| 472 const bool m_bReverse; | 429 const bool m_bReverse; |
| 473 size_t m_pos; | 430 size_t m_pos; |
| 474 }; | 431 }; |
| 475 | 432 |
| 476 #endif // FPDFSDK_INCLUDE_FSDK_ANNOTHANDLER_H_ | 433 #endif // FPDFSDK_INCLUDE_FSDK_ANNOTHANDLER_H_ |
| OLD | NEW |