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 <memory> | 7 #include <memory> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "core/include/fpdfdoc/fpdf_doc.h" | 10 #include "core/include/fpdfdoc/fpdf_doc.h" |
11 | 11 |
12 CPDF_Bookmark CPDF_BookmarkTree::GetFirstChild( | 12 CPDF_Bookmark CPDF_BookmarkTree::GetFirstChild( |
13 const CPDF_Bookmark& parent) const { | 13 const CPDF_Bookmark& parent) const { |
14 if (!parent.m_pDict) { | 14 if (!parent.m_pDict) { |
15 CPDF_Dictionary* pRoot = m_pDocument->GetRoot()->GetDict("Outlines"); | 15 CPDF_Dictionary* pRoot = m_pDocument->GetRoot()->GetDictBy("Outlines"); |
16 if (!pRoot) { | 16 if (!pRoot) { |
17 return CPDF_Bookmark(); | 17 return CPDF_Bookmark(); |
18 } | 18 } |
19 return CPDF_Bookmark(pRoot->GetDict("First")); | 19 return CPDF_Bookmark(pRoot->GetDictBy("First")); |
20 } | 20 } |
21 return CPDF_Bookmark(parent.m_pDict->GetDict("First")); | 21 return CPDF_Bookmark(parent.m_pDict->GetDictBy("First")); |
22 } | 22 } |
23 CPDF_Bookmark CPDF_BookmarkTree::GetNextSibling( | 23 CPDF_Bookmark CPDF_BookmarkTree::GetNextSibling( |
24 const CPDF_Bookmark& bookmark) const { | 24 const CPDF_Bookmark& bookmark) const { |
25 if (!bookmark.m_pDict) { | 25 if (!bookmark.m_pDict) { |
26 return CPDF_Bookmark(); | 26 return CPDF_Bookmark(); |
27 } | 27 } |
28 CPDF_Dictionary* pNext = bookmark.m_pDict->GetDict("Next"); | 28 CPDF_Dictionary* pNext = bookmark.m_pDict->GetDictBy("Next"); |
29 return pNext == bookmark.m_pDict ? CPDF_Bookmark() : CPDF_Bookmark(pNext); | 29 return pNext == bookmark.m_pDict ? CPDF_Bookmark() : CPDF_Bookmark(pNext); |
30 } | 30 } |
31 FX_DWORD CPDF_Bookmark::GetColorRef() const { | 31 FX_DWORD CPDF_Bookmark::GetColorRef() const { |
32 if (!m_pDict) { | 32 if (!m_pDict) { |
33 return 0; | 33 return 0; |
34 } | 34 } |
35 CPDF_Array* pColor = m_pDict->GetArray("C"); | 35 CPDF_Array* pColor = m_pDict->GetArrayBy("C"); |
36 if (!pColor) { | 36 if (!pColor) { |
37 return FXSYS_RGB(0, 0, 0); | 37 return FXSYS_RGB(0, 0, 0); |
38 } | 38 } |
39 int r = FXSYS_round(pColor->GetNumber(0) * 255); | 39 int r = FXSYS_round(pColor->GetNumberAt(0) * 255); |
40 int g = FXSYS_round(pColor->GetNumber(1) * 255); | 40 int g = FXSYS_round(pColor->GetNumberAt(1) * 255); |
41 int b = FXSYS_round(pColor->GetNumber(2) * 255); | 41 int b = FXSYS_round(pColor->GetNumberAt(2) * 255); |
42 return FXSYS_RGB(r, g, b); | 42 return FXSYS_RGB(r, g, b); |
43 } | 43 } |
44 FX_DWORD CPDF_Bookmark::GetFontStyle() const { | 44 FX_DWORD CPDF_Bookmark::GetFontStyle() const { |
45 if (!m_pDict) { | 45 if (!m_pDict) { |
46 return 0; | 46 return 0; |
47 } | 47 } |
48 return m_pDict->GetInteger("F"); | 48 return m_pDict->GetIntegerBy("F"); |
49 } | 49 } |
50 CFX_WideString CPDF_Bookmark::GetTitle() const { | 50 CFX_WideString CPDF_Bookmark::GetTitle() const { |
51 if (!m_pDict) { | 51 if (!m_pDict) { |
52 return CFX_WideString(); | 52 return CFX_WideString(); |
53 } | 53 } |
54 CPDF_String* pString = ToString(m_pDict->GetElementValue("Title")); | 54 CPDF_String* pString = ToString(m_pDict->GetElementValue("Title")); |
55 if (!pString) | 55 if (!pString) |
56 return CFX_WideString(); | 56 return CFX_WideString(); |
57 | 57 |
58 CFX_WideString title = pString->GetUnicodeText(); | 58 CFX_WideString title = pString->GetUnicodeText(); |
(...skipping 21 matching lines...) Expand all Loading... |
80 return CPDF_Dest(name_tree.LookupNamedDest(pDocument, name)); | 80 return CPDF_Dest(name_tree.LookupNamedDest(pDocument, name)); |
81 } | 81 } |
82 if (CPDF_Array* pArray = pDest->AsArray()) | 82 if (CPDF_Array* pArray = pDest->AsArray()) |
83 return CPDF_Dest(pArray); | 83 return CPDF_Dest(pArray); |
84 return CPDF_Dest(); | 84 return CPDF_Dest(); |
85 } | 85 } |
86 CPDF_Action CPDF_Bookmark::GetAction() const { | 86 CPDF_Action CPDF_Bookmark::GetAction() const { |
87 if (!m_pDict) { | 87 if (!m_pDict) { |
88 return CPDF_Action(); | 88 return CPDF_Action(); |
89 } | 89 } |
90 return CPDF_Action(m_pDict->GetDict("A")); | 90 return CPDF_Action(m_pDict->GetDictBy("A")); |
91 } | 91 } |
OLD | NEW |