diff options
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/cpdfsdk_annotiterator.cpp | 23 | ||||
-rw-r--r-- | fpdfsdk/cpdfsdk_annotiterator.h | 6 |
2 files changed, 16 insertions, 13 deletions
diff --git a/fpdfsdk/cpdfsdk_annotiterator.cpp b/fpdfsdk/cpdfsdk_annotiterator.cpp index 0dcb5bd917..d85dbe46eb 100644 --- a/fpdfsdk/cpdfsdk_annotiterator.cpp +++ b/fpdfsdk/cpdfsdk_annotiterator.cpp @@ -26,20 +26,23 @@ bool CompareByTopDescending(const CPDFSDK_Annot* p1, const CPDFSDK_Annot* p2) { return GetAnnotRect(p1).top > GetAnnotRect(p2).top; } +CPDFSDK_AnnotIterator::TabOrder GetTabOrder(CPDFSDK_PageView* pPageView) { + CPDF_Page* pPDFPage = pPageView->GetPDFPage(); + ByteString sTabs = pPDFPage->GetDict()->GetStringFor("Tabs"); + if (sTabs == "R") + return CPDFSDK_AnnotIterator::ROW; + if (sTabs == "C") + return CPDFSDK_AnnotIterator::COLUMN; + return CPDFSDK_AnnotIterator::STRUCTURE; +} + } // namespace CPDFSDK_AnnotIterator::CPDFSDK_AnnotIterator(CPDFSDK_PageView* pPageView, CPDF_Annot::Subtype nAnnotSubtype) - : m_eTabOrder(STRUCTURE), - m_pPageView(pPageView), - m_nAnnotSubtype(nAnnotSubtype) { - CPDF_Page* pPDFPage = m_pPageView->GetPDFPage(); - ByteString sTabs = pPDFPage->GetDict()->GetStringFor("Tabs"); - if (sTabs == "R") - m_eTabOrder = ROW; - else if (sTabs == "C") - m_eTabOrder = COLUMN; - + : m_pPageView(pPageView), + m_nAnnotSubtype(nAnnotSubtype), + m_eTabOrder(GetTabOrder(pPageView)) { GenerateResults(); } diff --git a/fpdfsdk/cpdfsdk_annotiterator.h b/fpdfsdk/cpdfsdk_annotiterator.h index 723550edc5..fd7cbdc6b1 100644 --- a/fpdfsdk/cpdfsdk_annotiterator.h +++ b/fpdfsdk/cpdfsdk_annotiterator.h @@ -19,7 +19,7 @@ class CPDFSDK_PageView; class CPDFSDK_AnnotIterator { public: - enum TabOrder { STRUCTURE = 0, ROW, COLUMN }; + enum TabOrder : uint8_t { STRUCTURE = 0, ROW, COLUMN }; CPDFSDK_AnnotIterator(CPDFSDK_PageView* pPageView, CPDF_Annot::Subtype nAnnotSubtype); @@ -37,9 +37,9 @@ class CPDFSDK_AnnotIterator { void AddSelectedToAnnots(std::vector<CPDFSDK_Annot*>* sa, std::vector<size_t>* aSelect); - TabOrder m_eTabOrder; - UnownedPtr<CPDFSDK_PageView> m_pPageView; + UnownedPtr<CPDFSDK_PageView> const m_pPageView; CPDF_Annot::Subtype m_nAnnotSubtype; + const TabOrder m_eTabOrder; std::vector<CPDFSDK_Annot*> m_Annots; }; |