| 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 "../../core/include/fxcrt/fx_basic.h" | 10 #include "../../core/include/fxcrt/fx_basic.h" |
| 11 | 11 |
| 12 #define FSDK_XFAWIDGET_TYPENAME "XFAWidget" | 12 #define FSDK_XFAWIDGET_TYPENAME "XFAWidget" |
| 13 | 13 |
| 14 class CFFL_IFormFiller; | 14 class CFFL_IFormFiller; |
| 15 class CFX_RenderDevice; | 15 class CFX_RenderDevice; |
| 16 class CPDFDoc_Environment; | 16 class CPDFDoc_Environment; |
| 17 class CPDFSDK_Annot; | 17 class CPDFSDK_Annot; |
| 18 class CPDFSDK_PageView; | 18 class CPDFSDK_PageView; |
| 19 class CPDF_Annot; | 19 class CPDF_Annot; |
| 20 class CPDF_Matrix; | 20 class CPDF_Matrix; |
| 21 class CPDF_Point; | 21 class CPDF_Point; |
| 22 class CPDF_Rect; | 22 class CPDF_Rect; |
| 23 | 23 |
| 24 class IPDFSDK_AnnotHandler { | 24 class IPDFSDK_AnnotHandler { |
| 25 public: | 25 public: |
| 26 virtual ~IPDFSDK_AnnotHandler(){}; | 26 virtual ~IPDFSDK_AnnotHandler() {} |
| 27 | 27 |
| 28 virtual CFX_ByteString GetType() = 0; | 28 virtual CFX_ByteString GetType() = 0; |
| 29 | 29 |
| 30 virtual CFX_ByteString GetName() = 0; | 30 virtual CFX_ByteString GetName() = 0; |
| 31 | 31 |
| 32 virtual FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) = 0; | 32 virtual FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) = 0; |
| 33 | 33 |
| 34 virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, | 34 virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, |
| 35 CPDFSDK_PageView* pPage) = 0; | 35 CPDFSDK_PageView* pPage) = 0; |
| 36 | 36 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0; | 122 virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0; |
| 123 virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0; | 123 virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0; |
| 124 virtual FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, | 124 virtual FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, |
| 125 CPDFSDK_Annot* pNewAnnot) = 0; | 125 CPDFSDK_Annot* pNewAnnot) = 0; |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 class CPDFSDK_BFAnnotHandler : public IPDFSDK_AnnotHandler { | 128 class CPDFSDK_BFAnnotHandler : public IPDFSDK_AnnotHandler { |
| 129 public: | 129 public: |
| 130 CPDFSDK_BFAnnotHandler(CPDFDoc_Environment* pApp) | 130 CPDFSDK_BFAnnotHandler(CPDFDoc_Environment* pApp) |
| 131 : m_pApp(pApp), m_pFormFiller(NULL) {} | 131 : m_pApp(pApp), m_pFormFiller(NULL) {} |
| 132 virtual ~CPDFSDK_BFAnnotHandler() {} | 132 ~CPDFSDK_BFAnnotHandler() override {} |
| 133 | 133 |
| 134 public: | 134 // IPDFSDK_AnnotHandler |
| 135 virtual CFX_ByteString GetType() { return CFX_ByteString("Widget"); } | 135 CFX_ByteString GetType() override { return CFX_ByteString("Widget"); } |
| 136 | 136 CFX_ByteString GetName() override { return CFX_ByteString("WidgetHandler"); } |
| 137 virtual CFX_ByteString GetName() { return CFX_ByteString("WidgetHandler"); } | 137 FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) override; |
| 138 | 138 CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) override; |
| 139 virtual FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot); | 139 CPDFSDK_Annot* NewAnnot(IXFA_Widget* hWidget, |
| 140 | 140 CPDFSDK_PageView* pPage) override; |
| 141 virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage); | 141 void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override; |
| 142 | 142 void DeleteAnnot(CPDFSDK_Annot* pAnnot) override {} |
| 143 virtual CPDFSDK_Annot* NewAnnot(IXFA_Widget* hWidget, | 143 CPDF_Rect GetViewBBox(CPDFSDK_PageView* pPageView, |
| 144 CPDFSDK_PageView* pPage); | 144 CPDFSDK_Annot* pAnnot) override; |
| 145 | 145 FX_BOOL HitTest(CPDFSDK_PageView* pPageView, |
| 146 virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot); | 146 CPDFSDK_Annot* pAnnot, |
| 147 | 147 const CPDF_Point& point) override; |
| 148 virtual void DeleteAnnot(CPDFSDK_Annot* pAnnot) {} | 148 void OnDraw(CPDFSDK_PageView* pPageView, |
| 149 | 149 CPDFSDK_Annot* pAnnot, |
| 150 virtual CPDF_Rect GetViewBBox(CPDFSDK_PageView* pPageView, | 150 CFX_RenderDevice* pDevice, |
| 151 CPDFSDK_Annot* pAnnot); | 151 CPDF_Matrix* pUser2Device, |
| 152 | 152 FX_DWORD dwFlags) override; |
| 153 virtual FX_BOOL HitTest(CPDFSDK_PageView* pPageView, | 153 void OnDrawSleep(CPDFSDK_PageView* pPageView, |
| 154 CPDFSDK_Annot* pAnnot, |
| 155 CFX_RenderDevice* pDevice, |
| 156 CPDF_Matrix* pUser2Device, |
| 157 const CPDF_Rect& rcWindow, |
| 158 FX_DWORD dwFlags) override {} |
| 159 void OnCreate(CPDFSDK_Annot* pAnnot) override; |
| 160 void OnLoad(CPDFSDK_Annot* pAnnot) override; |
| 161 void OnDelete(CPDFSDK_Annot* pAnnot) override {} |
| 162 void OnRelease(CPDFSDK_Annot* pAnnot) override {} |
| 163 void OnMouseEnter(CPDFSDK_PageView* pPageView, |
| 164 CPDFSDK_Annot* pAnnot, |
| 165 FX_DWORD nFlag) override; |
| 166 void OnMouseExit(CPDFSDK_PageView* pPageView, |
| 167 CPDFSDK_Annot* pAnnot, |
| 168 FX_DWORD nFlag) override; |
| 169 FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView, |
| 170 CPDFSDK_Annot* pAnnot, |
| 171 FX_DWORD nFlags, |
| 172 const CPDF_Point& point) override; |
| 173 FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView, |
| 174 CPDFSDK_Annot* pAnnot, |
| 175 FX_DWORD nFlags, |
| 176 const CPDF_Point& point) override; |
| 177 FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView, |
| 154 CPDFSDK_Annot* pAnnot, | 178 CPDFSDK_Annot* pAnnot, |
| 155 const CPDF_Point& point); | 179 FX_DWORD nFlags, |
| 156 | 180 const CPDF_Point& point) override; |
| 157 virtual void OnDraw(CPDFSDK_PageView* pPageView, | 181 FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView, |
| 158 CPDFSDK_Annot* pAnnot, | 182 CPDFSDK_Annot* pAnnot, |
| 159 CFX_RenderDevice* pDevice, | 183 FX_DWORD nFlags, |
| 160 CPDF_Matrix* pUser2Device, | 184 const CPDF_Point& point) override; |
| 161 FX_DWORD dwFlags); | 185 FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView, |
| 162 | 186 CPDFSDK_Annot* pAnnot, |
| 163 virtual void OnDrawSleep(CPDFSDK_PageView* pPageView, | 187 FX_DWORD nFlags, |
| 164 CPDFSDK_Annot* pAnnot, | 188 short zDelta, |
| 165 CFX_RenderDevice* pDevice, | 189 const CPDF_Point& point) override; |
| 166 CPDF_Matrix* pUser2Device, | 190 FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView, |
| 167 const CPDF_Rect& rcWindow, | 191 CPDFSDK_Annot* pAnnot, |
| 168 FX_DWORD dwFlags) {} | 192 FX_DWORD nFlags, |
| 169 | 193 const CPDF_Point& point) override; |
| 170 virtual void OnCreate(CPDFSDK_Annot* pAnnot); | 194 FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView, |
| 171 | 195 CPDFSDK_Annot* pAnnot, |
| 172 virtual void OnLoad(CPDFSDK_Annot* pAnnot); | 196 FX_DWORD nFlags, |
| 173 | 197 const CPDF_Point& point) override; |
| 174 virtual void OnDelete(CPDFSDK_Annot* pAnnot) {} | 198 FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView, |
| 175 | 199 CPDFSDK_Annot* pAnnot, |
| 176 virtual void OnRelease(CPDFSDK_Annot* pAnnot) {} | 200 FX_DWORD nFlags, |
| 177 | 201 const CPDF_Point& point) override { |
| 178 virtual void OnMouseEnter(CPDFSDK_PageView* pPageView, | |
| 179 CPDFSDK_Annot* pAnnot, | |
| 180 FX_DWORD nFlag); | |
| 181 virtual void OnMouseExit(CPDFSDK_PageView* pPageView, | |
| 182 CPDFSDK_Annot* pAnnot, | |
| 183 FX_DWORD nFlag); | |
| 184 | |
| 185 virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView, | |
| 186 CPDFSDK_Annot* pAnnot, | |
| 187 FX_DWORD nFlags, | |
| 188 const CPDF_Point& point); | |
| 189 virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView, | |
| 190 CPDFSDK_Annot* pAnnot, | |
| 191 FX_DWORD nFlags, | |
| 192 const CPDF_Point& point); | |
| 193 virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView, | |
| 194 CPDFSDK_Annot* pAnnot, | |
| 195 FX_DWORD nFlags, | |
| 196 const CPDF_Point& point); | |
| 197 virtual FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView, | |
| 198 CPDFSDK_Annot* pAnnot, | |
| 199 FX_DWORD nFlags, | |
| 200 const CPDF_Point& point); | |
| 201 virtual FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView, | |
| 202 CPDFSDK_Annot* pAnnot, | |
| 203 FX_DWORD nFlags, | |
| 204 short zDelta, | |
| 205 const CPDF_Point& point); | |
| 206 virtual FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView, | |
| 207 CPDFSDK_Annot* pAnnot, | |
| 208 FX_DWORD nFlags, | |
| 209 const CPDF_Point& point); | |
| 210 virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView, | |
| 211 CPDFSDK_Annot* pAnnot, | |
| 212 FX_DWORD nFlags, | |
| 213 const CPDF_Point& point); | |
| 214 virtual FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView, | |
| 215 CPDFSDK_Annot* pAnnot, | |
| 216 FX_DWORD nFlags, | |
| 217 const CPDF_Point& point) { | |
| 218 return FALSE; | 202 return FALSE; |
| 219 } | 203 } |
| 220 | 204 FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, |
| 221 // by wjm. | 205 FX_DWORD nChar, |
| 222 virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, | 206 FX_DWORD nFlags) override; |
| 223 FX_DWORD nChar, | 207 FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; |
| 224 FX_DWORD nFlags); | 208 FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; |
| 225 virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag); | 209 void OnDeSelected(CPDFSDK_Annot* pAnnot) override {} |
| 226 virtual FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag); | 210 void OnSelected(CPDFSDK_Annot* pAnnot) override {} |
| 227 | 211 FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) override; |
| 228 virtual void OnDeSelected(CPDFSDK_Annot* pAnnot) {} | 212 FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) override; |
| 229 virtual void OnSelected(CPDFSDK_Annot* pAnnot) {} | 213 FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, |
| 230 | 214 CPDFSDK_Annot* pNewAnnot) override { |
| 231 virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag); | |
| 232 virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag); | |
| 233 virtual FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, | |
| 234 CPDFSDK_Annot* pNewAnnot) { | |
| 235 return TRUE; | 215 return TRUE; |
| 236 } | 216 } |
| 237 | 217 |
| 238 void SetFormFiller(CFFL_IFormFiller* pFiller) { m_pFormFiller = pFiller; } | 218 void SetFormFiller(CFFL_IFormFiller* pFiller) { m_pFormFiller = pFiller; } |
| 239 CFFL_IFormFiller* GetFormFiller() { return m_pFormFiller; } | 219 CFFL_IFormFiller* GetFormFiller() { return m_pFormFiller; } |
| 240 | 220 |
| 241 private: | 221 private: |
| 242 CPDFDoc_Environment* m_pApp; | 222 CPDFDoc_Environment* m_pApp; |
| 243 CFFL_IFormFiller* m_pFormFiller; | 223 CFFL_IFormFiller* m_pFormFiller; |
| 244 }; | 224 }; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 FX_DWORD GetFWLFlags(FX_DWORD dwFlag); | 333 FX_DWORD GetFWLFlags(FX_DWORD dwFlag); |
| 354 | 334 |
| 355 private: | 335 private: |
| 356 CPDFDoc_Environment* m_pApp; | 336 CPDFDoc_Environment* m_pApp; |
| 357 }; | 337 }; |
| 358 | 338 |
| 359 #define CBA_AnnotHandlerArray CFX_ArrayTemplate<IPDFSDK_AnnotHandler*> | 339 #define CBA_AnnotHandlerArray CFX_ArrayTemplate<IPDFSDK_AnnotHandler*> |
| 360 class CPDFSDK_AnnotHandlerMgr { | 340 class CPDFSDK_AnnotHandlerMgr { |
| 361 public: | 341 public: |
| 362 // Destroy the handler | 342 // Destroy the handler |
| 363 CPDFSDK_AnnotHandlerMgr(CPDFDoc_Environment* pApp); | 343 explicit CPDFSDK_AnnotHandlerMgr(CPDFDoc_Environment* pApp); |
| 364 virtual ~CPDFSDK_AnnotHandlerMgr(); | 344 virtual ~CPDFSDK_AnnotHandlerMgr(); |
| 365 | 345 |
| 366 public: | 346 public: |
| 367 void RegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotHandler); | 347 void RegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotHandler); |
| 368 void UnRegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotHandler); | 348 void UnRegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotHandler); |
| 369 | 349 |
| 370 virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, | 350 virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, |
| 371 CPDFSDK_PageView* pPageView); | 351 CPDFSDK_PageView* pPageView); |
| 372 virtual CPDFSDK_Annot* NewAnnot(IXFA_Widget* pAnnot, | 352 virtual CPDFSDK_Annot* NewAnnot(IXFA_Widget* pAnnot, |
| 373 CPDFSDK_PageView* pPageView); | 353 CPDFSDK_PageView* pPageView); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 CPDFSDK_Annot* NextAnnot(int& index); | 459 CPDFSDK_Annot* NextAnnot(int& index); |
| 480 CPDFSDK_Annot* PrevAnnot(int& index); | 460 CPDFSDK_Annot* PrevAnnot(int& index); |
| 481 | 461 |
| 482 CFX_PtrArray m_pIteratorAnnotList; | 462 CFX_PtrArray m_pIteratorAnnotList; |
| 483 FX_BOOL m_bReverse; | 463 FX_BOOL m_bReverse; |
| 484 FX_BOOL m_bIgnoreTopmost; | 464 FX_BOOL m_bIgnoreTopmost; |
| 485 FX_BOOL m_bCircle; | 465 FX_BOOL m_bCircle; |
| 486 }; | 466 }; |
| 487 | 467 |
| 488 #endif // FPDFSDK_INCLUDE_FSDK_ANNOTHANDLER_H_ | 468 #endif // FPDFSDK_INCLUDE_FSDK_ANNOTHANDLER_H_ |
| OLD | NEW |