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 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 m_pDict(pDict), | 201 m_pDict(pDict), |
202 m_Type(pDict->GetStringBy("S")) { | 202 m_Type(pDict->GetStringBy("S")) { |
203 if (pTree->m_pRoleMap) { | 203 if (pTree->m_pRoleMap) { |
204 CFX_ByteString mapped = pTree->m_pRoleMap->GetStringBy(m_Type); | 204 CFX_ByteString mapped = pTree->m_pRoleMap->GetStringBy(m_Type); |
205 if (!mapped.IsEmpty()) | 205 if (!mapped.IsEmpty()) |
206 m_Type = mapped; | 206 m_Type = mapped; |
207 } | 207 } |
208 LoadKids(pDict); | 208 LoadKids(pDict); |
209 } | 209 } |
210 | 210 |
| 211 IPDF_StructTree* CPDF_StructElementImpl::GetTree() const { |
| 212 return m_pTree; |
| 213 } |
| 214 |
| 215 const CFX_ByteString& CPDF_StructElementImpl::GetType() const { |
| 216 return m_Type; |
| 217 } |
| 218 |
| 219 IPDF_StructElement* CPDF_StructElementImpl::GetParent() const { |
| 220 return m_pParent; |
| 221 } |
| 222 |
| 223 CPDF_Dictionary* CPDF_StructElementImpl::GetDict() const { |
| 224 return m_pDict; |
| 225 } |
| 226 |
| 227 int CPDF_StructElementImpl::CountKids() const { |
| 228 return pdfium::CollectionSize<int>(m_Kids); |
| 229 } |
| 230 |
| 231 const CPDF_StructKid& CPDF_StructElementImpl::GetKid(int index) const { |
| 232 return m_Kids[index]; |
| 233 } |
| 234 |
211 CPDF_StructElementImpl::~CPDF_StructElementImpl() { | 235 CPDF_StructElementImpl::~CPDF_StructElementImpl() { |
212 for (CPDF_StructKid& kid : m_Kids) { | 236 for (CPDF_StructKid& kid : m_Kids) { |
213 if (kid.m_Type == CPDF_StructKid::Element && kid.m_Element.m_pElement) | 237 if (kid.m_Type == CPDF_StructKid::Element && kid.m_Element.m_pElement) |
214 static_cast<CPDF_StructElementImpl*>(kid.m_Element.m_pElement)->Release(); | 238 static_cast<CPDF_StructElementImpl*>(kid.m_Element.m_pElement)->Release(); |
215 } | 239 } |
216 } | 240 } |
217 | 241 |
218 CPDF_StructElementImpl* CPDF_StructElementImpl::Retain() { | 242 CPDF_StructElementImpl* CPDF_StructElementImpl::Retain() { |
219 m_RefCount++; | 243 m_RefCount++; |
220 return this; | 244 return this; |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 return ToNumber(pAttr) ? pAttr->GetNumber() : default_value; | 450 return ToNumber(pAttr) ? pAttr->GetNumber() : default_value; |
427 } | 451 } |
428 int CPDF_StructElementImpl::GetInteger(const CFX_ByteStringC& owner, | 452 int CPDF_StructElementImpl::GetInteger(const CFX_ByteStringC& owner, |
429 const CFX_ByteStringC& name, | 453 const CFX_ByteStringC& name, |
430 int default_value, | 454 int default_value, |
431 FX_BOOL bInheritable, | 455 FX_BOOL bInheritable, |
432 int subindex) { | 456 int subindex) { |
433 CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex); | 457 CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex); |
434 return ToNumber(pAttr) ? pAttr->GetInteger() : default_value; | 458 return ToNumber(pAttr) ? pAttr->GetInteger() : default_value; |
435 } | 459 } |
OLD | NEW |