jaepark | 611adb8 | 2016-08-17 11:34:36 -0700 | [diff] [blame] | 1 | // Copyright 2016 PDFium Authors. All rights reserved. |
| 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_INCLUDE_CBA_ANNOTITERATOR_H_ |
| 8 | #define FPDFSDK_INCLUDE_CBA_ANNOTITERATOR_H_ |
| 9 | |
| 10 | #include <vector> |
| 11 | |
dsinclair | 1727aee | 2016-09-29 13:12:56 -0700 | [diff] [blame] | 12 | #include "core/fpdfdoc/cpdf_annot.h" |
dsinclair | a52ab74 | 2016-09-29 13:59:29 -0700 | [diff] [blame^] | 13 | #include "core/fxcrt/fx_coordinates.h" |
| 14 | #include "core/fxcrt/fx_string.h" |
jaepark | 611adb8 | 2016-08-17 11:34:36 -0700 | [diff] [blame] | 15 | |
| 16 | class CPDFSDK_Annot; |
| 17 | class CPDFSDK_PageView; |
| 18 | |
| 19 | class CBA_AnnotIterator { |
| 20 | public: |
| 21 | enum TabOrder { STRUCTURE = 0, ROW, COLUMN }; |
| 22 | |
| 23 | CBA_AnnotIterator(CPDFSDK_PageView* pPageView, |
jaepark | 956553e | 2016-08-31 06:49:27 -0700 | [diff] [blame] | 24 | CPDF_Annot::Subtype nAnnotSubtype); |
jaepark | 611adb8 | 2016-08-17 11:34:36 -0700 | [diff] [blame] | 25 | ~CBA_AnnotIterator(); |
| 26 | |
| 27 | CPDFSDK_Annot* GetFirstAnnot(); |
| 28 | CPDFSDK_Annot* GetLastAnnot(); |
| 29 | CPDFSDK_Annot* GetNextAnnot(CPDFSDK_Annot* pAnnot); |
| 30 | CPDFSDK_Annot* GetPrevAnnot(CPDFSDK_Annot* pAnnot); |
| 31 | |
| 32 | private: |
| 33 | void GenerateResults(); |
| 34 | static CFX_FloatRect GetAnnotRect(const CPDFSDK_Annot* pAnnot); |
| 35 | |
| 36 | // Function signature compatible with std::sort(). |
| 37 | static bool CompareByLeftAscending(const CPDFSDK_Annot* p1, |
| 38 | const CPDFSDK_Annot* p2); |
| 39 | static bool CompareByTopDescending(const CPDFSDK_Annot* p1, |
| 40 | const CPDFSDK_Annot* p2); |
| 41 | |
| 42 | TabOrder m_eTabOrder; |
| 43 | CPDFSDK_PageView* m_pPageView; |
jaepark | 956553e | 2016-08-31 06:49:27 -0700 | [diff] [blame] | 44 | CPDF_Annot::Subtype m_nAnnotSubtype; |
jaepark | 611adb8 | 2016-08-17 11:34:36 -0700 | [diff] [blame] | 45 | std::vector<CPDFSDK_Annot*> m_Annots; |
| 46 | }; |
| 47 | |
| 48 | #endif // FPDFSDK_INCLUDE_CBA_ANNOTITERATOR_H_ |