| 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 "core/include/fpdfdoc/fpdf_doc.h" | 7 #include "core/include/fpdfdoc/fpdf_doc.h" |
| 8 | 8 |
| 9 CPDF_LinkList::CPDF_LinkList() { | 9 CPDF_LinkList::CPDF_LinkList() { |
| 10 } | 10 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 if (z_order) | 50 if (z_order) |
| 51 *z_order = annot_index; | 51 *z_order = annot_index; |
| 52 return link; | 52 return link; |
| 53 } | 53 } |
| 54 return CPDF_Link(); | 54 return CPDF_Link(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void CPDF_LinkList::LoadPageLinks(CPDF_Page* pPage, | 57 void CPDF_LinkList::LoadPageLinks(CPDF_Page* pPage, |
| 58 std::vector<CPDF_Dictionary*>* pList) { | 58 std::vector<CPDF_Dictionary*>* pList) { |
| 59 CPDF_Array* pAnnotList = pPage->m_pFormDict->GetArray("Annots"); | 59 CPDF_Array* pAnnotList = pPage->m_pFormDict->GetArrayBy("Annots"); |
| 60 if (!pAnnotList) | 60 if (!pAnnotList) |
| 61 return; | 61 return; |
| 62 | 62 |
| 63 for (FX_DWORD i = 0; i < pAnnotList->GetCount(); ++i) { | 63 for (FX_DWORD i = 0; i < pAnnotList->GetCount(); ++i) { |
| 64 CPDF_Dictionary* pAnnot = pAnnotList->GetDict(i); | 64 CPDF_Dictionary* pAnnot = pAnnotList->GetDictAt(i); |
| 65 bool add_link = (pAnnot && pAnnot->GetString("Subtype") == "Link"); | 65 bool add_link = (pAnnot && pAnnot->GetStringBy("Subtype") == "Link"); |
| 66 // Add non-links as nullptrs to preserve z-order. | 66 // Add non-links as nullptrs to preserve z-order. |
| 67 pList->push_back(add_link ? pAnnot : nullptr); | 67 pList->push_back(add_link ? pAnnot : nullptr); |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 CPDF_Rect CPDF_Link::GetRect() { | 71 CPDF_Rect CPDF_Link::GetRect() { |
| 72 return m_pDict->GetRect("Rect"); | 72 return m_pDict->GetRectBy("Rect"); |
| 73 } | 73 } |
| 74 CPDF_Dest CPDF_Link::GetDest(CPDF_Document* pDoc) { | 74 CPDF_Dest CPDF_Link::GetDest(CPDF_Document* pDoc) { |
| 75 CPDF_Object* pDest = m_pDict->GetElementValue("Dest"); | 75 CPDF_Object* pDest = m_pDict->GetElementValue("Dest"); |
| 76 if (!pDest) | 76 if (!pDest) |
| 77 return CPDF_Dest(); | 77 return CPDF_Dest(); |
| 78 | 78 |
| 79 if (pDest->IsString() || pDest->IsName()) { | 79 if (pDest->IsString() || pDest->IsName()) { |
| 80 CPDF_NameTree name_tree(pDoc, "Dests"); | 80 CPDF_NameTree name_tree(pDoc, "Dests"); |
| 81 CFX_ByteStringC name = pDest->GetString(); | 81 CFX_ByteStringC name = pDest->GetString(); |
| 82 return CPDF_Dest(name_tree.LookupNamedDest(pDoc, name)); | 82 return CPDF_Dest(name_tree.LookupNamedDest(pDoc, name)); |
| 83 } | 83 } |
| 84 if (CPDF_Array* pArray = pDest->AsArray()) | 84 if (CPDF_Array* pArray = pDest->AsArray()) |
| 85 return CPDF_Dest(pArray); | 85 return CPDF_Dest(pArray); |
| 86 return CPDF_Dest(); | 86 return CPDF_Dest(); |
| 87 } | 87 } |
| 88 CPDF_Action CPDF_Link::GetAction() { | 88 CPDF_Action CPDF_Link::GetAction() { |
| 89 return CPDF_Action(m_pDict->GetDict("A")); | 89 return CPDF_Action(m_pDict->GetDictBy("A")); |
| 90 } | 90 } |
| OLD | NEW |