1 // Copyright 2014 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.
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
7 #ifndef _FPDF_TAGGED_INT_H_
8 #define _FPDF_TAGGED_INT_H_
9 class CPDF_StructTreeImpl;
10 class CPDF_StructElementImpl;
11 class CPDF_StructTreeImpl : public CPDF_StructTree
14 CPDF_StructTreeImpl(const CPDF_Document* pDoc);
15 ~CPDF_StructTreeImpl();
16 int CountTopElements() const
18 return m_Kids.GetSize();
20 CPDF_StructElement* GetTopElement(int i) const
22 return (CPDF_StructElement*)m_Kids.GetAt(i);
25 void LoadPageTree(const CPDF_Dictionary* pPageDict);
26 CPDF_StructElementImpl* AddPageNode(CPDF_Dictionary* pElement, CFX_MapPtrToPtr& map, int nLevel = 0);
27 FX_BOOL AddTopLevelNode(CPDF_Dictionary* pDict, CPDF_StructElementImpl* pElement);
29 const CPDF_Dictionary* m_pTreeRoot;
30 const CPDF_Dictionary* m_pRoleMap;
31 const CPDF_Dictionary* m_pPage;
32 CFX_ArrayTemplate<CPDF_StructElementImpl*> m_Kids;
33 friend class CPDF_StructElementImpl;
35 class CPDF_StructElementImpl FX_FINAL : public CPDF_StructElement
38 CPDF_StructElementImpl(CPDF_StructTreeImpl* pTree, CPDF_StructElementImpl* pParent, CPDF_Dictionary* pDict);
39 ~CPDF_StructElementImpl();
40 CPDF_StructTree* GetTree() const
44 const CFX_ByteString& GetType() const
48 CPDF_StructElement* GetParent() const
52 CPDF_Dictionary * GetDict() const
58 return m_Kids.GetSize();
60 const CPDF_StructKid& GetKid(int index) const
62 return m_Kids.GetData()[index];
64 CFX_PtrArray* GetObjectArray()
66 return &m_ObjectArray;
69 CPDF_Object* GetAttr(FX_BSTR owner, FX_BSTR name, FX_BOOL bInheritable = FALSE, FX_FLOAT fLevel = 0.0F);
71 CFX_ByteString GetName(FX_BSTR owner, FX_BSTR name, FX_BSTR default_value, FX_BOOL bInheritable = FALSE, int subindex = -1);
72 FX_ARGB GetColor(FX_BSTR owner, FX_BSTR name, FX_ARGB default_value, FX_BOOL bInheritable = FALSE, int subindex = -1);
73 FX_FLOAT GetNumber(FX_BSTR owner, FX_BSTR name, FX_FLOAT default_value, FX_BOOL bInheritable = FALSE, int subindex = -1);
74 int GetInteger(FX_BSTR owner, FX_BSTR name, int default_value, FX_BOOL bInheritable = FALSE, int subindex = -1);
75 CFX_PtrArray m_ObjectArray;
76 void LoadKids(CPDF_Dictionary* pDict);
77 void LoadKid(FX_DWORD PageObjNum, CPDF_Object* pObj, CPDF_StructKid* pKid);
78 CPDF_Object* GetAttr(FX_BSTR owner, FX_BSTR name, FX_BOOL bInheritable, int subindex);
79 CPDF_StructElementImpl* Retain();
82 CPDF_StructTreeImpl* m_pTree;
83 CFX_ByteString m_Type;
84 CPDF_StructElementImpl* m_pParent;
85 CPDF_Dictionary* m_pDict;
86 CFX_ArrayTemplate<CPDF_StructKid> m_Kids;
89 friend class CPDF_StructTreeImpl;