| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
| 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 csURI = m_pDict->GetStringBy("URI"); | 93 csURI = m_pDict->GetStringBy("URI"); |
| 94 CPDF_Dictionary* pRoot = pDoc->GetRoot(); | 94 CPDF_Dictionary* pRoot = pDoc->GetRoot(); |
| 95 CPDF_Dictionary* pURI = pRoot->GetDictBy("URI"); | 95 CPDF_Dictionary* pURI = pRoot->GetDictBy("URI"); |
| 96 if (pURI) { | 96 if (pURI) { |
| 97 if (csURI.Find(":", 0) < 1) { | 97 if (csURI.Find(":", 0) < 1) { |
| 98 csURI = pURI->GetStringBy("Base") + csURI; | 98 csURI = pURI->GetStringBy("Base") + csURI; |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 return csURI; | 101 return csURI; |
| 102 } | 102 } |
| 103 FX_DWORD CPDF_ActionFields::GetFieldsCount() const { | 103 uint32_t CPDF_ActionFields::GetFieldsCount() const { |
| 104 if (!m_pAction) { | 104 if (!m_pAction) { |
| 105 return 0; | 105 return 0; |
| 106 } | 106 } |
| 107 CPDF_Dictionary* pDict = m_pAction->GetDict(); | 107 CPDF_Dictionary* pDict = m_pAction->GetDict(); |
| 108 if (!pDict) { | 108 if (!pDict) { |
| 109 return 0; | 109 return 0; |
| 110 } | 110 } |
| 111 CFX_ByteString csType = pDict->GetStringBy("S"); | 111 CFX_ByteString csType = pDict->GetStringBy("S"); |
| 112 CPDF_Object* pFields = NULL; | 112 CPDF_Object* pFields = NULL; |
| 113 if (csType == "Hide") { | 113 if (csType == "Hide") { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 140 if (csType == "Hide") | 140 if (csType == "Hide") |
| 141 pFields = pDict->GetElementValue("T"); | 141 pFields = pDict->GetElementValue("T"); |
| 142 else | 142 else |
| 143 pFields = pDict->GetArrayBy("Fields"); | 143 pFields = pDict->GetArrayBy("Fields"); |
| 144 if (!pFields) | 144 if (!pFields) |
| 145 return fields; | 145 return fields; |
| 146 | 146 |
| 147 if (pFields->IsDictionary() || pFields->IsString()) { | 147 if (pFields->IsDictionary() || pFields->IsString()) { |
| 148 fields.push_back(pFields); | 148 fields.push_back(pFields); |
| 149 } else if (CPDF_Array* pArray = pFields->AsArray()) { | 149 } else if (CPDF_Array* pArray = pFields->AsArray()) { |
| 150 FX_DWORD iCount = pArray->GetCount(); | 150 uint32_t iCount = pArray->GetCount(); |
| 151 for (FX_DWORD i = 0; i < iCount; ++i) { | 151 for (uint32_t i = 0; i < iCount; ++i) { |
| 152 CPDF_Object* pObj = pArray->GetElementValue(i); | 152 CPDF_Object* pObj = pArray->GetElementValue(i); |
| 153 if (pObj) { | 153 if (pObj) { |
| 154 fields.push_back(pObj); | 154 fields.push_back(pObj); |
| 155 } | 155 } |
| 156 } | 156 } |
| 157 } | 157 } |
| 158 return fields; | 158 return fields; |
| 159 } | 159 } |
| 160 | 160 |
| 161 CPDF_Object* CPDF_ActionFields::GetField(FX_DWORD iIndex) const { | 161 CPDF_Object* CPDF_ActionFields::GetField(uint32_t iIndex) const { |
| 162 if (!m_pAction) { | 162 if (!m_pAction) { |
| 163 return NULL; | 163 return NULL; |
| 164 } | 164 } |
| 165 CPDF_Dictionary* pDict = m_pAction->GetDict(); | 165 CPDF_Dictionary* pDict = m_pAction->GetDict(); |
| 166 if (!pDict) { | 166 if (!pDict) { |
| 167 return NULL; | 167 return NULL; |
| 168 } | 168 } |
| 169 CFX_ByteString csType = pDict->GetStringBy("S"); | 169 CFX_ByteString csType = pDict->GetStringBy("S"); |
| 170 CPDF_Object* pFields = NULL; | 170 CPDF_Object* pFields = NULL; |
| 171 if (csType == "Hide") { | 171 if (csType == "Hide") { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 } | 225 } |
| 226 if (csOP == "Pause") { | 226 if (csOP == "Pause") { |
| 227 return 2; | 227 return 2; |
| 228 } | 228 } |
| 229 if (csOP == "Resume") { | 229 if (csOP == "Resume") { |
| 230 return 3; | 230 return 3; |
| 231 } | 231 } |
| 232 } | 232 } |
| 233 return 0; | 233 return 0; |
| 234 } | 234 } |
| 235 FX_DWORD CPDF_Action::GetSubActionsCount() const { | 235 uint32_t CPDF_Action::GetSubActionsCount() const { |
| 236 if (!m_pDict || !m_pDict->KeyExist("Next")) | 236 if (!m_pDict || !m_pDict->KeyExist("Next")) |
| 237 return 0; | 237 return 0; |
| 238 | 238 |
| 239 CPDF_Object* pNext = m_pDict->GetElementValue("Next"); | 239 CPDF_Object* pNext = m_pDict->GetElementValue("Next"); |
| 240 if (!pNext) | 240 if (!pNext) |
| 241 return 0; | 241 return 0; |
| 242 if (pNext->IsDictionary()) | 242 if (pNext->IsDictionary()) |
| 243 return 1; | 243 return 1; |
| 244 if (CPDF_Array* pArray = pNext->AsArray()) | 244 if (CPDF_Array* pArray = pNext->AsArray()) |
| 245 return pArray->GetCount(); | 245 return pArray->GetCount(); |
| 246 return 0; | 246 return 0; |
| 247 } | 247 } |
| 248 CPDF_Action CPDF_Action::GetSubAction(FX_DWORD iIndex) const { | 248 CPDF_Action CPDF_Action::GetSubAction(uint32_t iIndex) const { |
| 249 if (!m_pDict || !m_pDict->KeyExist("Next")) { | 249 if (!m_pDict || !m_pDict->KeyExist("Next")) { |
| 250 return CPDF_Action(); | 250 return CPDF_Action(); |
| 251 } | 251 } |
| 252 CPDF_Object* pNext = m_pDict->GetElementValue("Next"); | 252 CPDF_Object* pNext = m_pDict->GetElementValue("Next"); |
| 253 if (CPDF_Dictionary* pDict = ToDictionary(pNext)) { | 253 if (CPDF_Dictionary* pDict = ToDictionary(pNext)) { |
| 254 if (iIndex == 0) | 254 if (iIndex == 0) |
| 255 return CPDF_Action(pDict); | 255 return CPDF_Action(pDict); |
| 256 } else if (CPDF_Array* pArray = ToArray(pNext)) { | 256 } else if (CPDF_Array* pArray = ToArray(pNext)) { |
| 257 return CPDF_Action(pArray->GetDictAt(iIndex)); | 257 return CPDF_Action(pArray->GetDictAt(iIndex)); |
| 258 } | 258 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 if (!ToDictionary(pAction)) { | 294 if (!ToDictionary(pAction)) { |
| 295 return CPDF_Action(); | 295 return CPDF_Action(); |
| 296 } | 296 } |
| 297 return CPDF_Action(pAction->GetDict()); | 297 return CPDF_Action(pAction->GetDict()); |
| 298 } | 298 } |
| 299 int CPDF_DocJSActions::FindJSAction(const CFX_ByteString& csName) const { | 299 int CPDF_DocJSActions::FindJSAction(const CFX_ByteString& csName) const { |
| 300 ASSERT(m_pDocument); | 300 ASSERT(m_pDocument); |
| 301 CPDF_NameTree name_tree(m_pDocument, "JavaScript"); | 301 CPDF_NameTree name_tree(m_pDocument, "JavaScript"); |
| 302 return name_tree.GetIndex(csName); | 302 return name_tree.GetIndex(csName); |
| 303 } | 303 } |
| OLD | NEW |