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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 } | 410 } |
411 return pArray->GetElementValue(subindex); | 411 return pArray->GetElementValue(subindex); |
412 } | 412 } |
413 CFX_ByteString CPDF_StructElementImpl::GetName( | 413 CFX_ByteString CPDF_StructElementImpl::GetName( |
414 const CFX_ByteStringC& owner, | 414 const CFX_ByteStringC& owner, |
415 const CFX_ByteStringC& name, | 415 const CFX_ByteStringC& name, |
416 const CFX_ByteStringC& default_value, | 416 const CFX_ByteStringC& default_value, |
417 FX_BOOL bInheritable, | 417 FX_BOOL bInheritable, |
418 int subindex) { | 418 int subindex) { |
419 CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex); | 419 CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex); |
420 if (pAttr == NULL || pAttr->GetType() != PDFOBJ_NAME) { | 420 if (ToName(pAttr)) |
421 return default_value; | 421 return pAttr->GetString(); |
422 } | 422 return default_value; |
423 return pAttr->GetString(); | |
424 } | 423 } |
| 424 |
425 FX_ARGB CPDF_StructElementImpl::GetColor(const CFX_ByteStringC& owner, | 425 FX_ARGB CPDF_StructElementImpl::GetColor(const CFX_ByteStringC& owner, |
426 const CFX_ByteStringC& name, | 426 const CFX_ByteStringC& name, |
427 FX_ARGB default_value, | 427 FX_ARGB default_value, |
428 FX_BOOL bInheritable, | 428 FX_BOOL bInheritable, |
429 int subindex) { | 429 int subindex) { |
430 CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex); | 430 CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex); |
431 if (pAttr == NULL || pAttr->GetType() != PDFOBJ_ARRAY) { | 431 if (pAttr == NULL || pAttr->GetType() != PDFOBJ_ARRAY) { |
432 return default_value; | 432 return default_value; |
433 } | 433 } |
434 CPDF_Array* pArray = (CPDF_Array*)pAttr; | 434 CPDF_Array* pArray = (CPDF_Array*)pAttr; |
(...skipping 10 matching lines...) Expand all Loading... |
445 return ToNumber(pAttr) ? pAttr->GetNumber() : default_value; | 445 return ToNumber(pAttr) ? pAttr->GetNumber() : default_value; |
446 } | 446 } |
447 int CPDF_StructElementImpl::GetInteger(const CFX_ByteStringC& owner, | 447 int CPDF_StructElementImpl::GetInteger(const CFX_ByteStringC& owner, |
448 const CFX_ByteStringC& name, | 448 const CFX_ByteStringC& name, |
449 int default_value, | 449 int default_value, |
450 FX_BOOL bInheritable, | 450 FX_BOOL bInheritable, |
451 int subindex) { | 451 int subindex) { |
452 CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex); | 452 CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex); |
453 return ToNumber(pAttr) ? pAttr->GetInteger() : default_value; | 453 return ToNumber(pAttr) ? pAttr->GetInteger() : default_value; |
454 } | 454 } |
OLD | NEW |