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/fpdfdoc/fpdf_doc.h" | 7 #include "../../include/fpdfdoc/fpdf_doc.h" |
8 CPDF_Dest CPDF_Action::GetDest(CPDF_Document* pDoc) const { | 8 CPDF_Dest CPDF_Action::GetDest(CPDF_Document* pDoc) const { |
9 if (!m_pDict) { | 9 if (!m_pDict) { |
10 return CPDF_Dest(); | 10 return CPDF_Dest(); |
11 } | 11 } |
12 CFX_ByteString type = m_pDict->GetString("S"); | 12 CFX_ByteString type = m_pDict->GetString("S"); |
13 if (type != "GoTo" && type != "GoToR") { | 13 if (type != "GoTo" && type != "GoToR") { |
14 return CPDF_Dest(); | 14 return CPDF_Dest(); |
15 } | 15 } |
16 CPDF_Object* pDest = m_pDict->GetElementValue("D"); | 16 CPDF_Object* pDest = m_pDict->GetElementValue("D"); |
17 if (!pDest) { | 17 if (!pDest) { |
18 return CPDF_Dest(); | 18 return CPDF_Dest(); |
19 } | 19 } |
20 if (pDest->IsString() || pDest->GetType() == PDFOBJ_NAME) { | 20 if (pDest->IsString() || pDest->IsName()) { |
21 CPDF_NameTree name_tree(pDoc, FX_BSTRC("Dests")); | 21 CPDF_NameTree name_tree(pDoc, FX_BSTRC("Dests")); |
22 CFX_ByteStringC name = pDest->GetString(); | 22 CFX_ByteStringC name = pDest->GetString(); |
23 return CPDF_Dest(name_tree.LookupNamedDest(pDoc, name)); | 23 return CPDF_Dest(name_tree.LookupNamedDest(pDoc, name)); |
24 } | 24 } |
25 if (pDest->GetType() == PDFOBJ_ARRAY) { | 25 if (pDest->GetType() == PDFOBJ_ARRAY) { |
26 return CPDF_Dest((CPDF_Array*)pDest); | 26 return CPDF_Dest((CPDF_Array*)pDest); |
27 } | 27 } |
28 return CPDF_Dest(); | 28 return CPDF_Dest(); |
29 } | 29 } |
30 const FX_CHAR* g_sATypes[] = { | 30 const FX_CHAR* g_sATypes[] = { |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 if (!ToDictionary(pAction)) { | 323 if (!ToDictionary(pAction)) { |
324 return CPDF_Action(); | 324 return CPDF_Action(); |
325 } | 325 } |
326 return CPDF_Action(pAction->GetDict()); | 326 return CPDF_Action(pAction->GetDict()); |
327 } | 327 } |
328 int CPDF_DocJSActions::FindJSAction(const CFX_ByteString& csName) const { | 328 int CPDF_DocJSActions::FindJSAction(const CFX_ByteString& csName) const { |
329 ASSERT(m_pDocument != NULL); | 329 ASSERT(m_pDocument != NULL); |
330 CPDF_NameTree name_tree(m_pDocument, FX_BSTRC("JavaScript")); | 330 CPDF_NameTree name_tree(m_pDocument, FX_BSTRC("JavaScript")); |
331 return name_tree.GetIndex(csName); | 331 return name_tree.GetIndex(csName); |
332 } | 332 } |
OLD | NEW |