Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: fpdfsdk/include/fsdk_annothandler.h

Issue 2166953005: Remove the use of handler array in CPDFSDK_AnnotHandlerMgr (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/fsdk_annothandler.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <memory>
11 #include <vector> 12 #include <vector>
12 13
13 #include "core/fxcrt/include/fx_basic.h" 14 #include "core/fxcrt/include/fx_basic.h"
14 #include "core/fxcrt/include/fx_coordinates.h" 15 #include "core/fxcrt/include/fx_coordinates.h"
15 16
16 #ifdef PDF_ENABLE_XFA 17 #ifdef PDF_ENABLE_XFA
17 #define FSDK_XFAWIDGET_TYPENAME "XFAWidget" 18 #define FSDK_XFAWIDGET_TYPENAME "XFAWidget"
18 #endif // PDF_ENABLE_XFA 19 #endif // PDF_ENABLE_XFA
19 20
20 class CFFL_IFormFiller; 21 class CFFL_IFormFiller;
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 308
308 private: 309 private:
309 CXFA_FFWidgetHandler* GetXFAWidgetHandler(CPDFSDK_Annot* pAnnot); 310 CXFA_FFWidgetHandler* GetXFAWidgetHandler(CPDFSDK_Annot* pAnnot);
310 uint32_t GetFWLFlags(uint32_t dwFlag); 311 uint32_t GetFWLFlags(uint32_t dwFlag);
311 312
312 private: 313 private:
313 CPDFDoc_Environment* m_pApp; 314 CPDFDoc_Environment* m_pApp;
314 }; 315 };
315 #endif // PDF_ENABLE_XFA 316 #endif // PDF_ENABLE_XFA
316 317
317 #define CBA_AnnotHandlerArray CFX_ArrayTemplate<IPDFSDK_AnnotHandler*>
318 class CPDFSDK_AnnotHandlerMgr { 318 class CPDFSDK_AnnotHandlerMgr {
319 public: 319 public:
320 // Destroy the handler 320 // Destroy the handler
321 explicit CPDFSDK_AnnotHandlerMgr(CPDFDoc_Environment* pApp); 321 explicit CPDFSDK_AnnotHandlerMgr(CPDFDoc_Environment* pApp);
322 virtual ~CPDFSDK_AnnotHandlerMgr(); 322 virtual ~CPDFSDK_AnnotHandlerMgr();
323 323
324 public: 324 public:
325 void RegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotHandler); 325 void RegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotHandler);
326 void UnRegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotHandler); 326 void UnRegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotHandler);
327 327
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 CPDFSDK_Annot* pAnnot); 402 CPDFSDK_Annot* pAnnot);
403 virtual FX_BOOL Annot_OnHitTest(CPDFSDK_PageView* pPageView, 403 virtual FX_BOOL Annot_OnHitTest(CPDFSDK_PageView* pPageView,
404 CPDFSDK_Annot* pAnnot, 404 CPDFSDK_Annot* pAnnot,
405 const CFX_FloatPoint& point); 405 const CFX_FloatPoint& point);
406 406
407 private: 407 private:
408 IPDFSDK_AnnotHandler* GetAnnotHandler(const CFX_ByteString& sType) const; 408 IPDFSDK_AnnotHandler* GetAnnotHandler(const CFX_ByteString& sType) const;
409 CPDFSDK_Annot* GetNextAnnot(CPDFSDK_Annot* pSDKAnnot, FX_BOOL bNext); 409 CPDFSDK_Annot* GetNextAnnot(CPDFSDK_Annot* pSDKAnnot, FX_BOOL bNext);
410 410
411 private: 411 private:
412 CBA_AnnotHandlerArray m_Handlers; 412 std::map<CFX_ByteString, std::unique_ptr<IPDFSDK_AnnotHandler>>
413 std::map<CFX_ByteString, IPDFSDK_AnnotHandler*> m_mapType2Handler; 413 m_mapType2Handler;
414 CPDFDoc_Environment* m_pApp; 414 CPDFDoc_Environment* m_pApp;
415 }; 415 };
416 416
417 class CPDFSDK_AnnotIterator { 417 class CPDFSDK_AnnotIterator {
418 public: 418 public:
419 CPDFSDK_AnnotIterator(CPDFSDK_PageView* pPageView, bool bReverse); 419 CPDFSDK_AnnotIterator(CPDFSDK_PageView* pPageView, bool bReverse);
420 ~CPDFSDK_AnnotIterator(); 420 ~CPDFSDK_AnnotIterator();
421 421
422 CPDFSDK_Annot* Next(); 422 CPDFSDK_Annot* Next();
423 423
424 private: 424 private:
425 CPDFSDK_Annot* NextAnnot(); 425 CPDFSDK_Annot* NextAnnot();
426 CPDFSDK_Annot* PrevAnnot(); 426 CPDFSDK_Annot* PrevAnnot();
427 427
428 std::vector<CPDFSDK_Annot*> m_iteratorAnnotList; 428 std::vector<CPDFSDK_Annot*> m_iteratorAnnotList;
429 const bool m_bReverse; 429 const bool m_bReverse;
430 size_t m_pos; 430 size_t m_pos;
431 }; 431 };
432 432
433 #endif // FPDFSDK_INCLUDE_FSDK_ANNOTHANDLER_H_ 433 #endif // FPDFSDK_INCLUDE_FSDK_ANNOTHANDLER_H_
OLDNEW
« no previous file with comments | « fpdfsdk/fsdk_annothandler.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698