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/include/fxfa/fxfa.h" | 17 #include "xfa/include/fxfa/fxfa.h" |
| 18 #include "xfa/include/fxfa/xfa_ffdocview.h" |
| 19 #include "xfa/include/fxfa/xfa_ffpageview.h" |
| 20 #include "xfa/include/fxfa/xfa_ffwidgethandler.h" |
18 | 21 |
19 #define FSDK_XFAWIDGET_TYPENAME "XFAWidget" | 22 #define FSDK_XFAWIDGET_TYPENAME "XFAWidget" |
20 #endif // PDF_ENABLE_XFA | 23 #endif // PDF_ENABLE_XFA |
21 | 24 |
22 class CFFL_IFormFiller; | 25 class CFFL_IFormFiller; |
23 class CFX_RenderDevice; | 26 class CFX_RenderDevice; |
24 class CPDFDoc_Environment; | 27 class CPDFDoc_Environment; |
25 class CPDFSDK_Annot; | 28 class CPDFSDK_Annot; |
26 class CPDFSDK_PageView; | 29 class CPDFSDK_PageView; |
27 class CPDF_Annot; | 30 class CPDF_Annot; |
28 class CFX_Matrix; | 31 class CFX_Matrix; |
29 class CFX_FloatPoint; | 32 class CFX_FloatPoint; |
30 | 33 |
31 class IPDFSDK_AnnotHandler { | 34 class IPDFSDK_AnnotHandler { |
32 public: | 35 public: |
33 virtual ~IPDFSDK_AnnotHandler() {} | 36 virtual ~IPDFSDK_AnnotHandler() {} |
34 | 37 |
35 virtual CFX_ByteString GetType() = 0; | 38 virtual CFX_ByteString GetType() = 0; |
36 | 39 |
37 virtual CFX_ByteString GetName() = 0; | 40 virtual CFX_ByteString GetName() = 0; |
38 | 41 |
39 virtual FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) = 0; | 42 virtual FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) = 0; |
40 | 43 |
41 virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, | 44 virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, |
42 CPDFSDK_PageView* pPage) = 0; | 45 CPDFSDK_PageView* pPage) = 0; |
43 | 46 |
44 #ifdef PDF_ENABLE_XFA | 47 #ifdef PDF_ENABLE_XFA |
45 virtual CPDFSDK_Annot* NewAnnot(IXFA_Widget* hWidget, | 48 virtual CPDFSDK_Annot* NewAnnot(CXFA_FFWidget* hWidget, |
46 CPDFSDK_PageView* pPage) = 0; | 49 CPDFSDK_PageView* pPage) = 0; |
47 #endif // PDF_ENABLE_XFA | 50 #endif // PDF_ENABLE_XFA |
48 | 51 |
49 virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot) = 0; | 52 virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot) = 0; |
50 | 53 |
51 virtual void DeleteAnnot(CPDFSDK_Annot* pAnnot) = 0; | 54 virtual void DeleteAnnot(CPDFSDK_Annot* pAnnot) = 0; |
52 | 55 |
53 virtual CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView, | 56 virtual CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView, |
54 CPDFSDK_Annot* pAnnot) = 0; | 57 CPDFSDK_Annot* pAnnot) = 0; |
55 | 58 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 explicit CPDFSDK_BFAnnotHandler(CPDFDoc_Environment* pApp) | 144 explicit CPDFSDK_BFAnnotHandler(CPDFDoc_Environment* pApp) |
142 : m_pApp(pApp), m_pFormFiller(NULL) {} | 145 : m_pApp(pApp), m_pFormFiller(NULL) {} |
143 ~CPDFSDK_BFAnnotHandler() override {} | 146 ~CPDFSDK_BFAnnotHandler() override {} |
144 | 147 |
145 // IPDFSDK_AnnotHandler | 148 // IPDFSDK_AnnotHandler |
146 CFX_ByteString GetType() override { return CFX_ByteString("Widget"); } | 149 CFX_ByteString GetType() override { return CFX_ByteString("Widget"); } |
147 CFX_ByteString GetName() override { return CFX_ByteString("WidgetHandler"); } | 150 CFX_ByteString GetName() override { return CFX_ByteString("WidgetHandler"); } |
148 FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) override; | 151 FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) override; |
149 CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) override; | 152 CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) override; |
150 #ifdef PDF_ENABLE_XFA | 153 #ifdef PDF_ENABLE_XFA |
151 CPDFSDK_Annot* NewAnnot(IXFA_Widget* hWidget, | 154 CPDFSDK_Annot* NewAnnot(CXFA_FFWidget* hWidget, |
152 CPDFSDK_PageView* pPage) override; | 155 CPDFSDK_PageView* pPage) override; |
153 #endif // PDF_ENABLE_XFA | 156 #endif // PDF_ENABLE_XFA |
154 void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override; | 157 void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override; |
155 void DeleteAnnot(CPDFSDK_Annot* pAnnot) override {} | 158 void DeleteAnnot(CPDFSDK_Annot* pAnnot) override {} |
156 CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView, | 159 CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView, |
157 CPDFSDK_Annot* pAnnot) override; | 160 CPDFSDK_Annot* pAnnot) override; |
158 FX_BOOL HitTest(CPDFSDK_PageView* pPageView, | 161 FX_BOOL HitTest(CPDFSDK_PageView* pPageView, |
159 CPDFSDK_Annot* pAnnot, | 162 CPDFSDK_Annot* pAnnot, |
160 const CFX_FloatPoint& point) override; | 163 const CFX_FloatPoint& point) override; |
161 void OnDraw(CPDFSDK_PageView* pPageView, | 164 void OnDraw(CPDFSDK_PageView* pPageView, |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 virtual CFX_ByteString GetType() { return FSDK_XFAWIDGET_TYPENAME; } | 251 virtual CFX_ByteString GetType() { return FSDK_XFAWIDGET_TYPENAME; } |
249 | 252 |
250 virtual CFX_ByteString GetName() { return "XFAWidgetHandler"; } | 253 virtual CFX_ByteString GetName() { return "XFAWidgetHandler"; } |
251 | 254 |
252 virtual FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot); | 255 virtual FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot); |
253 | 256 |
254 virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) { | 257 virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) { |
255 return NULL; | 258 return NULL; |
256 } | 259 } |
257 | 260 |
258 virtual CPDFSDK_Annot* NewAnnot(IXFA_Widget* pAnnot, CPDFSDK_PageView* pPage); | 261 virtual CPDFSDK_Annot* NewAnnot(CXFA_FFWidget* pAnnot, |
| 262 CPDFSDK_PageView* pPage); |
259 | 263 |
260 virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot); | 264 virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot); |
261 | 265 |
262 virtual void DeleteAnnot(CPDFSDK_Annot* pAnnot) {} | 266 virtual void DeleteAnnot(CPDFSDK_Annot* pAnnot) {} |
263 | 267 |
264 virtual CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView, | 268 virtual CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView, |
265 CPDFSDK_Annot* pAnnot); | 269 CPDFSDK_Annot* pAnnot); |
266 | 270 |
267 virtual FX_BOOL HitTest(CPDFSDK_PageView* pPageView, | 271 virtual FX_BOOL HitTest(CPDFSDK_PageView* pPageView, |
268 CPDFSDK_Annot* pAnnot, | 272 CPDFSDK_Annot* pAnnot, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 | 342 |
339 virtual void OnDeSelected(CPDFSDK_Annot* pAnnot) {} | 343 virtual void OnDeSelected(CPDFSDK_Annot* pAnnot) {} |
340 virtual void OnSelected(CPDFSDK_Annot* pAnnot) {} | 344 virtual void OnSelected(CPDFSDK_Annot* pAnnot) {} |
341 | 345 |
342 virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag); | 346 virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag); |
343 virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag); | 347 virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag); |
344 virtual FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, | 348 virtual FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, |
345 CPDFSDK_Annot* pNewAnnot); | 349 CPDFSDK_Annot* pNewAnnot); |
346 | 350 |
347 private: | 351 private: |
348 IXFA_WidgetHandler* GetXFAWidgetHandler(CPDFSDK_Annot* pAnnot); | 352 CXFA_FFWidgetHandler* GetXFAWidgetHandler(CPDFSDK_Annot* pAnnot); |
349 uint32_t GetFWLFlags(uint32_t dwFlag); | 353 uint32_t GetFWLFlags(uint32_t dwFlag); |
350 | 354 |
351 private: | 355 private: |
352 CPDFDoc_Environment* m_pApp; | 356 CPDFDoc_Environment* m_pApp; |
353 }; | 357 }; |
354 #endif // PDF_ENABLE_XFA | 358 #endif // PDF_ENABLE_XFA |
355 | 359 |
356 #define CBA_AnnotHandlerArray CFX_ArrayTemplate<IPDFSDK_AnnotHandler*> | 360 #define CBA_AnnotHandlerArray CFX_ArrayTemplate<IPDFSDK_AnnotHandler*> |
357 class CPDFSDK_AnnotHandlerMgr { | 361 class CPDFSDK_AnnotHandlerMgr { |
358 public: | 362 public: |
359 // Destroy the handler | 363 // Destroy the handler |
360 explicit CPDFSDK_AnnotHandlerMgr(CPDFDoc_Environment* pApp); | 364 explicit CPDFSDK_AnnotHandlerMgr(CPDFDoc_Environment* pApp); |
361 virtual ~CPDFSDK_AnnotHandlerMgr(); | 365 virtual ~CPDFSDK_AnnotHandlerMgr(); |
362 | 366 |
363 public: | 367 public: |
364 void RegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotHandler); | 368 void RegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotHandler); |
365 void UnRegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotHandler); | 369 void UnRegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotHandler); |
366 | 370 |
367 virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, | 371 virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, |
368 CPDFSDK_PageView* pPageView); | 372 CPDFSDK_PageView* pPageView); |
369 #ifdef PDF_ENABLE_XFA | 373 #ifdef PDF_ENABLE_XFA |
370 virtual CPDFSDK_Annot* NewAnnot(IXFA_Widget* pAnnot, | 374 virtual CPDFSDK_Annot* NewAnnot(CXFA_FFWidget* pAnnot, |
371 CPDFSDK_PageView* pPageView); | 375 CPDFSDK_PageView* pPageView); |
372 #endif // PDF_ENABLE_XFA | 376 #endif // PDF_ENABLE_XFA |
373 virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot); | 377 virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot); |
374 | 378 |
375 virtual void Annot_OnCreate(CPDFSDK_Annot* pAnnot); | 379 virtual void Annot_OnCreate(CPDFSDK_Annot* pAnnot); |
376 virtual void Annot_OnLoad(CPDFSDK_Annot* pAnnot); | 380 virtual void Annot_OnLoad(CPDFSDK_Annot* pAnnot); |
377 | 381 |
378 public: | 382 public: |
379 IPDFSDK_AnnotHandler* GetAnnotHandler(CPDFSDK_Annot* pAnnot) const; | 383 IPDFSDK_AnnotHandler* GetAnnotHandler(CPDFSDK_Annot* pAnnot) const; |
380 virtual void Annot_OnDraw(CPDFSDK_PageView* pPageView, | 384 virtual void Annot_OnDraw(CPDFSDK_PageView* pPageView, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 private: | 467 private: |
464 CPDFSDK_Annot* NextAnnot(); | 468 CPDFSDK_Annot* NextAnnot(); |
465 CPDFSDK_Annot* PrevAnnot(); | 469 CPDFSDK_Annot* PrevAnnot(); |
466 | 470 |
467 std::vector<CPDFSDK_Annot*> m_iteratorAnnotList; | 471 std::vector<CPDFSDK_Annot*> m_iteratorAnnotList; |
468 const bool m_bReverse; | 472 const bool m_bReverse; |
469 size_t m_pos; | 473 size_t m_pos; |
470 }; | 474 }; |
471 | 475 |
472 #endif // FPDFSDK_INCLUDE_FSDK_ANNOTHANDLER_H_ | 476 #endif // FPDFSDK_INCLUDE_FSDK_ANNOTHANDLER_H_ |
OLD | NEW |