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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 } | 186 } |
187 | 187 |
188 CFX_WideString CPDF_Action::GetJavaScript() const { | 188 CFX_WideString CPDF_Action::GetJavaScript() const { |
189 CFX_WideString csJS; | 189 CFX_WideString csJS; |
190 if (!m_pDict) { | 190 if (!m_pDict) { |
191 return csJS; | 191 return csJS; |
192 } | 192 } |
193 CPDF_Object* pJS = m_pDict->GetDirectObjectBy("JS"); | 193 CPDF_Object* pJS = m_pDict->GetDirectObjectBy("JS"); |
194 return pJS ? pJS->GetUnicodeText() : csJS; | 194 return pJS ? pJS->GetUnicodeText() : csJS; |
195 } | 195 } |
196 CPDF_Dictionary* CPDF_Action::GetAnnot() const { | 196 |
197 if (!m_pDict) { | |
198 return nullptr; | |
199 } | |
200 CFX_ByteString csType = m_pDict->GetStringBy("S"); | |
201 if (csType == "Rendition") { | |
202 return m_pDict->GetDictBy("AN"); | |
203 } | |
204 if (csType == "Movie") { | |
205 return m_pDict->GetDictBy("Annotation"); | |
206 } | |
207 return nullptr; | |
208 } | |
209 int32_t CPDF_Action::GetOperationType() const { | |
210 if (!m_pDict) { | |
211 return 0; | |
212 } | |
213 CFX_ByteString csType = m_pDict->GetStringBy("S"); | |
214 if (csType == "Rendition") { | |
215 return m_pDict->GetIntegerBy("OP"); | |
216 } | |
217 if (csType == "Movie") { | |
218 CFX_ByteString csOP = m_pDict->GetStringBy("Operation"); | |
219 if (csOP == "Play") { | |
220 return 0; | |
221 } | |
222 if (csOP == "Stop") { | |
223 return 1; | |
224 } | |
225 if (csOP == "Pause") { | |
226 return 2; | |
227 } | |
228 if (csOP == "Resume") { | |
229 return 3; | |
230 } | |
231 } | |
232 return 0; | |
233 } | |
234 size_t CPDF_Action::GetSubActionsCount() const { | 197 size_t CPDF_Action::GetSubActionsCount() const { |
235 if (!m_pDict || !m_pDict->KeyExist("Next")) | 198 if (!m_pDict || !m_pDict->KeyExist("Next")) |
236 return 0; | 199 return 0; |
237 | 200 |
238 CPDF_Object* pNext = m_pDict->GetDirectObjectBy("Next"); | 201 CPDF_Object* pNext = m_pDict->GetDirectObjectBy("Next"); |
239 if (!pNext) | 202 if (!pNext) |
240 return 0; | 203 return 0; |
241 if (pNext->IsDictionary()) | 204 if (pNext->IsDictionary()) |
242 return 1; | 205 return 1; |
243 if (CPDF_Array* pArray = pNext->AsArray()) | 206 if (CPDF_Array* pArray = pNext->AsArray()) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 if (!ToDictionary(pAction)) { | 256 if (!ToDictionary(pAction)) { |
294 return CPDF_Action(); | 257 return CPDF_Action(); |
295 } | 258 } |
296 return CPDF_Action(pAction->GetDict()); | 259 return CPDF_Action(pAction->GetDict()); |
297 } | 260 } |
298 int CPDF_DocJSActions::FindJSAction(const CFX_ByteString& csName) const { | 261 int CPDF_DocJSActions::FindJSAction(const CFX_ByteString& csName) const { |
299 ASSERT(m_pDocument); | 262 ASSERT(m_pDocument); |
300 CPDF_NameTree name_tree(m_pDocument, "JavaScript"); | 263 CPDF_NameTree name_tree(m_pDocument, "JavaScript"); |
301 return name_tree.GetIndex(csName); | 264 return name_tree.GetIndex(csName); |
302 } | 265 } |
OLD | NEW |