summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/tagged_int.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfdoc/tagged_int.h')
-rw-r--r--core/fpdfdoc/tagged_int.h65
1 files changed, 44 insertions, 21 deletions
diff --git a/core/fpdfdoc/tagged_int.h b/core/fpdfdoc/tagged_int.h
index 03f1c40ad6..6a24700502 100644
--- a/core/fpdfdoc/tagged_int.h
+++ b/core/fpdfdoc/tagged_int.h
@@ -15,39 +15,62 @@
#include "core/fxcrt/cfx_retain_ptr.h"
#include "third_party/base/stl_util.h"
-class CPDF_StructElementImpl;
+class CPDF_StructElement;
+
+struct CPDF_StructKid {
+ enum { Invalid, Element, PageContent, StreamContent, Object } m_Type;
+
+ union {
+ struct {
+ CPDF_StructElement* m_pElement;
+ CPDF_Dictionary* m_pDict;
+ } m_Element;
+ struct {
+ uint32_t m_PageObjNum;
+ uint32_t m_ContentId;
+ } m_PageContent;
+ struct {
+ uint32_t m_PageObjNum;
+ uint32_t m_ContentId;
+ uint32_t m_RefObjNum;
+ } m_StreamContent;
+ struct {
+ uint32_t m_PageObjNum;
+ uint32_t m_RefObjNum;
+ } m_Object;
+ };
+};
-class CPDF_StructTreeImpl final : public IPDF_StructTree {
+class CPDF_StructTree final : public IPDF_StructTree {
public:
- explicit CPDF_StructTreeImpl(const CPDF_Document* pDoc);
- ~CPDF_StructTreeImpl() override;
+ explicit CPDF_StructTree(const CPDF_Document* pDoc);
+ ~CPDF_StructTree() override;
// IPDF_StructTree:
int CountTopElements() const override;
IPDF_StructElement* GetTopElement(int i) const override;
void LoadPageTree(const CPDF_Dictionary* pPageDict);
- CPDF_StructElementImpl* AddPageNode(
+ CPDF_StructElement* AddPageNode(
CPDF_Dictionary* pElement,
- std::map<CPDF_Dictionary*, CPDF_StructElementImpl*>& map,
+ std::map<CPDF_Dictionary*, CPDF_StructElement*>& map,
int nLevel = 0);
- bool AddTopLevelNode(CPDF_Dictionary* pDict,
- CPDF_StructElementImpl* pElement);
+ bool AddTopLevelNode(CPDF_Dictionary* pDict, CPDF_StructElement* pElement);
protected:
const CPDF_Dictionary* const m_pTreeRoot;
const CPDF_Dictionary* const m_pRoleMap;
const CPDF_Dictionary* m_pPage;
- std::vector<CFX_RetainPtr<CPDF_StructElementImpl>> m_Kids;
+ std::vector<CFX_RetainPtr<CPDF_StructElement>> m_Kids;
- friend class CPDF_StructElementImpl;
+ friend class CPDF_StructElement;
};
-class CPDF_StructElementImpl final : public IPDF_StructElement {
+class CPDF_StructElement final : public IPDF_StructElement {
public:
- CPDF_StructElementImpl(CPDF_StructTreeImpl* pTree,
- CPDF_StructElementImpl* pParent,
- CPDF_Dictionary* pDict);
+ CPDF_StructElement(CPDF_StructTree* pTree,
+ CPDF_StructElement* pParent,
+ CPDF_Dictionary* pDict);
// IPDF_StructElement
IPDF_StructTree* GetTree() const override;
@@ -55,7 +78,7 @@ class CPDF_StructElementImpl final : public IPDF_StructElement {
IPDF_StructElement* GetParent() const override;
CPDF_Dictionary* GetDict() const override;
int CountKids() const override;
- const CPDF_StructKid& GetKid(int index) const override;
+ IPDF_StructElement* GetKidIfElement(int index) const override;
CPDF_Object* GetAttr(const CFX_ByteStringC& owner,
const CFX_ByteStringC& name,
bool bInheritable = false,
@@ -81,26 +104,26 @@ class CPDF_StructElementImpl final : public IPDF_StructElement {
bool bInheritable = false,
int subindex = -1) override;
+ std::vector<CPDF_StructKid>* GetKids() { return &m_Kids; }
void LoadKids(CPDF_Dictionary* pDict);
void LoadKid(uint32_t PageObjNum, CPDF_Object* pObj, CPDF_StructKid* pKid);
CPDF_Object* GetAttr(const CFX_ByteStringC& owner,
const CFX_ByteStringC& name,
bool bInheritable,
int subindex);
- CPDF_StructElementImpl* Retain();
+
+ CPDF_StructElement* Retain();
void Release();
protected:
- ~CPDF_StructElementImpl() override;
+ ~CPDF_StructElement() override;
int m_RefCount;
- CPDF_StructTreeImpl* const m_pTree;
- CPDF_StructElementImpl* const m_pParent;
+ CPDF_StructTree* const m_pTree;
+ CPDF_StructElement* const m_pParent;
CPDF_Dictionary* const m_pDict;
CFX_ByteString m_Type;
std::vector<CPDF_StructKid> m_Kids;
-
- friend class CPDF_StructTreeImpl;
};
#endif // CORE_FPDFDOC_TAGGED_INT_H_