summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/cpdf_structtree.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfdoc/cpdf_structtree.h')
-rw-r--r--core/fpdfdoc/cpdf_structtree.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/core/fpdfdoc/cpdf_structtree.h b/core/fpdfdoc/cpdf_structtree.h
new file mode 100644
index 0000000000..20bf41e7ee
--- /dev/null
+++ b/core/fpdfdoc/cpdf_structtree.h
@@ -0,0 +1,51 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FPDFDOC_CPDF_STRUCTTREE_H_
+#define CORE_FPDFDOC_CPDF_STRUCTTREE_H_
+
+#include <map>
+#include <memory>
+#include <vector>
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+
+class CPDF_Dictionary;
+class CPDF_Document;
+class CPDF_StructElement;
+
+class CPDF_StructTree {
+ public:
+ static std::unique_ptr<CPDF_StructTree> LoadPage(
+ const CPDF_Document* pDoc,
+ const CPDF_Dictionary* pPageDict);
+
+ explicit CPDF_StructTree(const CPDF_Document* pDoc);
+ ~CPDF_StructTree();
+
+ int CountTopElements() const;
+ CPDF_StructElement* GetTopElement(int i) const;
+
+ void LoadPageTree(const CPDF_Dictionary* pPageDict);
+ CFX_RetainPtr<CPDF_StructElement> AddPageNode(
+ CPDF_Dictionary* pElement,
+ std::map<CPDF_Dictionary*, CFX_RetainPtr<CPDF_StructElement>>* map,
+ int nLevel = 0);
+ bool AddTopLevelNode(CPDF_Dictionary* pDict,
+ const CFX_RetainPtr<CPDF_StructElement>& pElement);
+
+ const CPDF_Dictionary* GetRoleMap() const { return m_pRoleMap; }
+ const CPDF_Dictionary* GetPage() const { return m_pPage; }
+ const CPDF_Dictionary* GetTreeRoot() const { return m_pTreeRoot; }
+
+ private:
+ const CPDF_Dictionary* const m_pTreeRoot;
+ const CPDF_Dictionary* const m_pRoleMap;
+ const CPDF_Dictionary* m_pPage;
+ std::vector<CFX_RetainPtr<CPDF_StructElement>> m_Kids;
+};
+
+#endif // CORE_FPDFDOC_CPDF_STRUCTTREE_H_