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 { | 9 { |
10 if (!m_pDict) { | 10 if (!m_pDict) { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 pFields = pDict->GetElementValue("T"); | 105 pFields = pDict->GetElementValue("T"); |
106 } else { | 106 } else { |
107 pFields = pDict->GetArray("Fields"); | 107 pFields = pDict->GetArray("Fields"); |
108 } | 108 } |
109 if (pFields == NULL) { | 109 if (pFields == NULL) { |
110 return 0; | 110 return 0; |
111 } | 111 } |
112 int iType = pFields->GetType(); | 112 int iType = pFields->GetType(); |
113 if (iType == PDFOBJ_DICTIONARY) { | 113 if (iType == PDFOBJ_DICTIONARY) { |
114 return 1; | 114 return 1; |
115 } else if (iType == PDFOBJ_STRING) { | 115 } |
| 116 if (iType == PDFOBJ_STRING) { |
116 return 1; | 117 return 1; |
117 } else if (iType == PDFOBJ_ARRAY) { | 118 } |
| 119 if (iType == PDFOBJ_ARRAY) { |
118 return ((CPDF_Array*)pFields)->GetCount(); | 120 return ((CPDF_Array*)pFields)->GetCount(); |
119 } | 121 } |
120 return 0; | 122 return 0; |
121 } | 123 } |
122 void CPDF_ActionFields::GetAllFields(CFX_PtrArray& fieldObjects) const | 124 void CPDF_ActionFields::GetAllFields(CFX_PtrArray& fieldObjects) const |
123 { | 125 { |
124 fieldObjects.RemoveAll(); | 126 fieldObjects.RemoveAll(); |
125 if (m_pAction == NULL) { | 127 if (m_pAction == NULL) { |
126 return; | 128 return; |
127 } | 129 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 return csJS; | 202 return csJS; |
201 } | 203 } |
202 CPDF_Object* pJS = m_pDict->GetElementValue("JS"); | 204 CPDF_Object* pJS = m_pDict->GetElementValue("JS"); |
203 if (pJS != NULL) { | 205 if (pJS != NULL) { |
204 return pJS->GetUnicodeText(); | 206 return pJS->GetUnicodeText(); |
205 } | 207 } |
206 return csJS; | 208 return csJS; |
207 } | 209 } |
208 CPDF_Dictionary* CPDF_Action::GetAnnot() const | 210 CPDF_Dictionary* CPDF_Action::GetAnnot() const |
209 { | 211 { |
210 if (m_pDict == NULL) { | 212 if (!m_pDict) { |
211 return NULL; | 213 return nullptr; |
212 } | 214 } |
213 CFX_ByteString csType = m_pDict->GetString("S"); | 215 CFX_ByteString csType = m_pDict->GetString("S"); |
214 if (csType == FX_BSTRC("Rendition")) { | 216 if (csType == FX_BSTRC("Rendition")) { |
215 return m_pDict->GetDict("AN"); | 217 return m_pDict->GetDict("AN"); |
216 } else if (csType == FX_BSTRC("Movie")) { | 218 } |
| 219 if (csType == FX_BSTRC("Movie")) { |
217 return m_pDict->GetDict("Annotation"); | 220 return m_pDict->GetDict("Annotation"); |
218 } | 221 } |
219 return NULL; | 222 return nullptr; |
220 } | 223 } |
221 int32_t CPDF_Action::GetOperationType() const | 224 int32_t CPDF_Action::GetOperationType() const |
222 { | 225 { |
223 if (m_pDict == NULL) { | 226 if (m_pDict == NULL) { |
224 return 0; | 227 return 0; |
225 } | 228 } |
226 CFX_ByteString csType = m_pDict->GetString("S"); | 229 CFX_ByteString csType = m_pDict->GetString("S"); |
227 if (csType == FX_BSTRC("Rendition")) { | 230 if (csType == FX_BSTRC("Rendition")) { |
228 return m_pDict->GetInteger("OP"); | 231 return m_pDict->GetInteger("OP"); |
229 } else if (csType == FX_BSTRC("Movie")) { | 232 } |
| 233 if (csType == FX_BSTRC("Movie")) { |
230 CFX_ByteString csOP = m_pDict->GetString("Operation"); | 234 CFX_ByteString csOP = m_pDict->GetString("Operation"); |
231 if (csOP == FX_BSTRC("Play")) { | 235 if (csOP == FX_BSTRC("Play")) { |
232 return 0; | 236 return 0; |
233 } else if (csOP == FX_BSTRC("Stop")) { | 237 } |
| 238 if (csOP == FX_BSTRC("Stop")) { |
234 return 1; | 239 return 1; |
235 } else if (csOP == FX_BSTRC("Pause")) { | 240 } |
| 241 if (csOP == FX_BSTRC("Pause")) { |
236 return 2; | 242 return 2; |
237 } else if (csOP == FX_BSTRC("Resume")) { | 243 } |
| 244 if (csOP == FX_BSTRC("Resume")) { |
238 return 3; | 245 return 3; |
239 } | 246 } |
240 } | 247 } |
241 return 0; | 248 return 0; |
242 } | 249 } |
243 FX_DWORD CPDF_Action::GetSubActionsCount() const | 250 FX_DWORD CPDF_Action::GetSubActionsCount() const |
244 { | 251 { |
245 if (m_pDict == NULL || !m_pDict->KeyExist("Next")) { | 252 if (m_pDict == NULL || !m_pDict->KeyExist("Next")) { |
246 return 0; | 253 return 0; |
247 } | 254 } |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 return CPDF_Action(); | 363 return CPDF_Action(); |
357 } | 364 } |
358 return CPDF_Action(pAction->GetDict()); | 365 return CPDF_Action(pAction->GetDict()); |
359 } | 366 } |
360 int CPDF_DocJSActions::FindJSAction(const CFX_ByteString& csName) const | 367 int CPDF_DocJSActions::FindJSAction(const CFX_ByteString& csName) const |
361 { | 368 { |
362 ASSERT(m_pDocument != NULL); | 369 ASSERT(m_pDocument != NULL); |
363 CPDF_NameTree name_tree(m_pDocument, FX_BSTRC("JavaScript")); | 370 CPDF_NameTree name_tree(m_pDocument, FX_BSTRC("JavaScript")); |
364 return name_tree.GetIndex(csName); | 371 return name_tree.GetIndex(csName); |
365 } | 372 } |
OLD | NEW |