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 "../../include/fpdfapi/fpdf_parser.h" | 7 #include "../../include/fpdfapi/fpdf_parser.h" |
8 #include "../../include/fpdfapi/fpdf_page.h" | 8 #include "../../include/fpdfapi/fpdf_page.h" |
9 #include "../../include/fpdfdoc/fpdf_tagged.h" | 9 #include "../../include/fpdfdoc/fpdf_tagged.h" |
10 #include "tagged_int.h" | 10 #include "tagged_int.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
210 } | 210 } |
211 } | 211 } |
212 return TRUE; | 212 return TRUE; |
213 } | 213 } |
214 CPDF_StructElementImpl::CPDF_StructElementImpl(CPDF_StructTreeImpl* pTree, CPDF_ StructElementImpl* pParent, CPDF_Dictionary* pDict) | 214 CPDF_StructElementImpl::CPDF_StructElementImpl(CPDF_StructTreeImpl* pTree, CPDF_ StructElementImpl* pParent, CPDF_Dictionary* pDict) |
215 : m_RefCount(0) | 215 : m_RefCount(0) |
216 { | 216 { |
217 m_pTree = pTree; | 217 m_pTree = pTree; |
218 m_pDict = pDict; | 218 m_pDict = pDict; |
219 m_Type = pDict->GetString(FX_BSTRC("S")); | 219 m_Type = pDict->GetString(FX_BSTRC("S")); |
220 CFX_ByteString mapped = pTree->m_pRoleMap->GetString(m_Type); | 220 if (pTree->m_pRoleMap != NULL) { |
Tom Sepez
2014/11/05 17:57:03
nit: != NULL is redundant. Just
if (pTree->m_p
olsen
2014/11/10 00:24:43
Done.
| |
221 if (!mapped.IsEmpty()) { | 221 CFX_ByteString mapped = pTree->m_pRoleMap->GetString(m_Type); |
222 m_Type = mapped; | 222 if (!mapped.IsEmpty()) { |
223 m_Type = mapped; | |
224 } | |
223 } | 225 } |
224 m_pParent = pParent; | 226 m_pParent = pParent; |
225 LoadKids(pDict); | 227 LoadKids(pDict); |
226 } | 228 } |
227 CPDF_StructElementImpl::~CPDF_StructElementImpl() | 229 CPDF_StructElementImpl::~CPDF_StructElementImpl() |
228 { | 230 { |
229 for (int i = 0; i < m_Kids.GetSize(); i ++) { | 231 for (int i = 0; i < m_Kids.GetSize(); i ++) { |
230 if (m_Kids[i].m_Type == CPDF_StructKid::Element && m_Kids[i].m_Element.m _pElement) { | 232 if (m_Kids[i].m_Type == CPDF_StructKid::Element && m_Kids[i].m_Element.m _pElement) { |
231 ((CPDF_StructElementImpl*)m_Kids[i].m_Element.m_pElement)->Release() ; | 233 ((CPDF_StructElementImpl*)m_Kids[i].m_Element.m_pElement)->Release() ; |
232 } | 234 } |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
442 return pAttr->GetNumber(); | 444 return pAttr->GetNumber(); |
443 } | 445 } |
444 int CPDF_StructElementImpl::GetInteger(FX_BSTR owner, FX_BSTR name, int defa ult_value, FX_BOOL bInheritable, int subindex) | 446 int CPDF_StructElementImpl::GetInteger(FX_BSTR owner, FX_BSTR name, int defa ult_value, FX_BOOL bInheritable, int subindex) |
445 { | 447 { |
446 CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex); | 448 CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex); |
447 if (pAttr == NULL || pAttr->GetType() != PDFOBJ_NUMBER) { | 449 if (pAttr == NULL || pAttr->GetType() != PDFOBJ_NUMBER) { |
448 return default_value; | 450 return default_value; |
449 } | 451 } |
450 return pAttr->GetInteger(); | 452 return pAttr->GetInteger(); |
451 } | 453 } |
OLD | NEW |