OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef CORE_SRC_FPDFDOC_TAGGED_INT_H_ | 7 #ifndef CORE_SRC_FPDFDOC_TAGGED_INT_H_ |
8 #define CORE_SRC_FPDFDOC_TAGGED_INT_H_ | 8 #define CORE_SRC_FPDFDOC_TAGGED_INT_H_ |
9 | 9 |
10 #include "../../include/fpdfdoc/fpdf_tagged.h" | 10 #include "../../include/fpdfdoc/fpdf_tagged.h" |
11 | 11 |
12 class CPDF_StructElementImpl; | 12 class CPDF_StructElementImpl; |
13 class CPDF_StructTreeImpl : public CPDF_StructTree | 13 class CPDF_StructTreeImpl : public CPDF_StructTree { |
14 { | 14 public: |
15 public: | 15 CPDF_StructTreeImpl(const CPDF_Document* pDoc); |
16 CPDF_StructTreeImpl(const CPDF_Document* pDoc); | 16 ~CPDF_StructTreeImpl(); |
17 ~CPDF_StructTreeImpl(); | 17 int CountTopElements() const { return m_Kids.GetSize(); } |
18 int»» » CountTopElements() const | 18 CPDF_StructElement* GetTopElement(int i) const { |
19 { | 19 return (CPDF_StructElement*)m_Kids.GetAt(i); |
20 return m_Kids.GetSize(); | 20 } |
21 } | 21 void LoadDocTree(); |
22 CPDF_StructElement*»GetTopElement(int i) const | 22 void LoadPageTree(const CPDF_Dictionary* pPageDict); |
23 { | 23 CPDF_StructElementImpl* AddPageNode(CPDF_Dictionary* pElement, |
24 return (CPDF_StructElement*)m_Kids.GetAt(i); | 24 CFX_MapPtrToPtr& map, |
25 } | 25 int nLevel = 0); |
26 void» » LoadDocTree(); | 26 FX_BOOL AddTopLevelNode(CPDF_Dictionary* pDict, |
27 void» » LoadPageTree(const CPDF_Dictionary* pPageDict); | 27 CPDF_StructElementImpl* pElement); |
28 CPDF_StructElementImpl* AddPageNode(CPDF_Dictionary* pElement, CFX_MapPtrToP
tr& map, int nLevel = 0); | 28 |
29 FX_BOOL» » AddTopLevelNode(CPDF_Dictionary* pDict, CPDF_StructEleme
ntImpl* pElement); | 29 protected: |
30 protected: | 30 const CPDF_Dictionary* m_pTreeRoot; |
31 const CPDF_Dictionary*» m_pTreeRoot; | 31 const CPDF_Dictionary* m_pRoleMap; |
32 const CPDF_Dictionary*» m_pRoleMap; | 32 const CPDF_Dictionary* m_pPage; |
33 const CPDF_Dictionary*» m_pPage; | 33 CFX_ArrayTemplate<CPDF_StructElementImpl*> m_Kids; |
34 CFX_ArrayTemplate<CPDF_StructElementImpl*>» m_Kids; | 34 friend class CPDF_StructElementImpl; |
35 friend class CPDF_StructElementImpl; | |
36 }; | 35 }; |
37 class CPDF_StructElementImpl final : public CPDF_StructElement | 36 class CPDF_StructElementImpl final : public CPDF_StructElement { |
38 { | 37 public: |
39 public: | 38 CPDF_StructElementImpl(CPDF_StructTreeImpl* pTree, |
40 CPDF_StructElementImpl(CPDF_StructTreeImpl* pTree, CPDF_StructElementImpl* p
Parent, CPDF_Dictionary* pDict); | 39 CPDF_StructElementImpl* pParent, |
41 CPDF_StructTree*» » GetTree() const | 40 CPDF_Dictionary* pDict); |
42 { | 41 CPDF_StructTree* GetTree() const { return m_pTree; } |
43 return m_pTree; | 42 const CFX_ByteString& GetType() const { return m_Type; } |
44 } | 43 CPDF_StructElement* GetParent() const { return m_pParent; } |
45 const CFX_ByteString&» GetType() const | 44 CPDF_Dictionary* GetDict() const { return m_pDict; } |
46 { | 45 int CountKids() const { return m_Kids.GetSize(); } |
47 return m_Type; | 46 const CPDF_StructKid& GetKid(int index) const { |
48 } | 47 return m_Kids.GetData()[index]; |
49 CPDF_StructElement*»» GetParent() const | 48 } |
50 { | 49 CFX_PtrArray* GetObjectArray() { return &m_ObjectArray; } |
51 return m_pParent; | |
52 } | |
53 CPDF_Dictionary *» » GetDict() const | |
54 { | |
55 return m_pDict; | |
56 } | |
57 int»» » » » » CountKids() const | |
58 { | |
59 return m_Kids.GetSize(); | |
60 } | |
61 const CPDF_StructKid&» GetKid(int index) const | |
62 { | |
63 return m_Kids.GetData()[index]; | |
64 } | |
65 CFX_PtrArray*» » » GetObjectArray() | |
66 { | |
67 return &m_ObjectArray; | |
68 } | |
69 | 50 |
70 CPDF_Object*» » » GetAttr(const CFX_ByteStringC& owner, co
nst CFX_ByteStringC& name, FX_BOOL bInheritable = FALSE, FX_FLOAT fLevel = 0.0F)
; | 51 CPDF_Object* GetAttr(const CFX_ByteStringC& owner, |
| 52 const CFX_ByteStringC& name, |
| 53 FX_BOOL bInheritable = FALSE, |
| 54 FX_FLOAT fLevel = 0.0F); |
71 | 55 |
72 CFX_ByteString» » » GetName(const CFX_ByteStringC& owner, co
nst CFX_ByteStringC& name, const CFX_ByteStringC& default_value, FX_BOOL bInheri
table = FALSE, int subindex = -1); | 56 CFX_ByteString GetName(const CFX_ByteStringC& owner, |
73 FX_ARGB» » » » » GetColor(const CFX_ByteStringC&
owner, const CFX_ByteStringC& name, FX_ARGB default_value, FX_BOOL bInheritable
= FALSE, int subindex = -1); | 57 const CFX_ByteStringC& name, |
74 FX_FLOAT» » » » GetNumber(const CFX_ByteStringC& owner,
const CFX_ByteStringC& name, FX_FLOAT default_value, FX_BOOL bInheritable = FALS
E, int subindex = -1); | 58 const CFX_ByteStringC& default_value, |
75 int»» » » » » GetInteger(const CFX_ByteStringC
& owner, const CFX_ByteStringC& name, int default_value, FX_BOOL bInheritable =
FALSE, int subindex = -1); | 59 FX_BOOL bInheritable = FALSE, |
76 CFX_PtrArray» » » m_ObjectArray; | 60 int subindex = -1); |
77 void» » » » » LoadKids(CPDF_Dictionary* pDict)
; | 61 FX_ARGB GetColor(const CFX_ByteStringC& owner, |
78 void» » » » » LoadKid(FX_DWORD PageObjNum, CPD
F_Object* pObj, CPDF_StructKid* pKid); | 62 const CFX_ByteStringC& name, |
79 CPDF_Object*» » » GetAttr(const CFX_ByteStringC& owner, co
nst CFX_ByteStringC& name, FX_BOOL bInheritable, int subindex); | 63 FX_ARGB default_value, |
80 CPDF_StructElementImpl*» Retain(); | 64 FX_BOOL bInheritable = FALSE, |
81 void» » » » » Release(); | 65 int subindex = -1); |
82 protected: | 66 FX_FLOAT GetNumber(const CFX_ByteStringC& owner, |
83 ~CPDF_StructElementImpl(); | 67 const CFX_ByteStringC& name, |
| 68 FX_FLOAT default_value, |
| 69 FX_BOOL bInheritable = FALSE, |
| 70 int subindex = -1); |
| 71 int GetInteger(const CFX_ByteStringC& owner, |
| 72 const CFX_ByteStringC& name, |
| 73 int default_value, |
| 74 FX_BOOL bInheritable = FALSE, |
| 75 int subindex = -1); |
| 76 CFX_PtrArray m_ObjectArray; |
| 77 void LoadKids(CPDF_Dictionary* pDict); |
| 78 void LoadKid(FX_DWORD PageObjNum, CPDF_Object* pObj, CPDF_StructKid* pKid); |
| 79 CPDF_Object* GetAttr(const CFX_ByteStringC& owner, |
| 80 const CFX_ByteStringC& name, |
| 81 FX_BOOL bInheritable, |
| 82 int subindex); |
| 83 CPDF_StructElementImpl* Retain(); |
| 84 void Release(); |
84 | 85 |
85 CPDF_StructTreeImpl*» m_pTree; | 86 protected: |
86 CFX_ByteString» » » m_Type; | 87 ~CPDF_StructElementImpl(); |
87 CPDF_StructElementImpl*» m_pParent; | |
88 CPDF_Dictionary*» » m_pDict; | |
89 CFX_ArrayTemplate<CPDF_StructKid>» m_Kids; | |
90 int»» » m_RefCount; | |
91 | 88 |
92 friend class CPDF_StructTreeImpl; | 89 CPDF_StructTreeImpl* m_pTree; |
| 90 CFX_ByteString m_Type; |
| 91 CPDF_StructElementImpl* m_pParent; |
| 92 CPDF_Dictionary* m_pDict; |
| 93 CFX_ArrayTemplate<CPDF_StructKid> m_Kids; |
| 94 int m_RefCount; |
| 95 |
| 96 friend class CPDF_StructTreeImpl; |
93 }; | 97 }; |
94 | 98 |
95 #endif // CORE_SRC_FPDFDOC_TAGGED_INT_H_ | 99 #endif // CORE_SRC_FPDFDOC_TAGGED_INT_H_ |
OLD | NEW |