1 // Copyright 2016 The PDFium Authors 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_CPDFSDK_ANNOTITERATOR_H_ 8 #define FPDFSDK_CPDFSDK_ANNOTITERATOR_H_ 9 10 #include <vector> 11 12 #include "core/fpdfdoc/cpdf_annot.h" 13 #include "core/fxcrt/fx_coordinates.h" 14 #include "core/fxcrt/unowned_ptr.h" 15 16 class CPDFSDK_Annot; 17 class CPDFSDK_PageView; 18 19 class CPDFSDK_AnnotIterator { 20 public: 21 CPDFSDK_AnnotIterator( 22 CPDFSDK_PageView* pPageView, 23 const std::vector<CPDF_Annot::Subtype>& subtypes_to_iterate); 24 ~CPDFSDK_AnnotIterator(); 25 26 CPDFSDK_Annot* GetFirstAnnot(); 27 CPDFSDK_Annot* GetLastAnnot(); 28 CPDFSDK_Annot* GetNextAnnot(CPDFSDK_Annot* pAnnot); 29 CPDFSDK_Annot* GetPrevAnnot(CPDFSDK_Annot* pAnnot); 30 31 private: 32 enum TabOrder : uint8_t { kStructure = 0, kRow, kColumn }; 33 34 static TabOrder GetTabOrder(CPDFSDK_PageView* pPageView); 35 36 void GenerateResults(); 37 void CollectAnnots(std::vector<UnownedPtr<CPDFSDK_Annot>>* pArray); 38 CFX_FloatRect AddToAnnotsList(std::vector<UnownedPtr<CPDFSDK_Annot>>* sa, 39 size_t idx); 40 void AddSelectedToAnnots(std::vector<UnownedPtr<CPDFSDK_Annot>>* sa, 41 std::vector<size_t>* aSelect); 42 43 UnownedPtr<CPDFSDK_PageView> const m_pPageView; 44 const std::vector<CPDF_Annot::Subtype> m_subtypes; 45 const TabOrder m_eTabOrder; 46 std::vector<UnownedPtr<CPDFSDK_Annot>> m_Annots; 47 }; 48 49 #endif // FPDFSDK_CPDFSDK_ANNOTITERATOR_H_ 50