| 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 "public/fpdf_formfill.h" | 7 #include "public/fpdf_formfill.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 int aaType) { | 305 int aaType) { |
| 306 CPDFSDK_Document* pSDKDoc = FormHandleToSDKDoc(hHandle); | 306 CPDFSDK_Document* pSDKDoc = FormHandleToSDKDoc(hHandle); |
| 307 if (!pSDKDoc) | 307 if (!pSDKDoc) |
| 308 return; | 308 return; |
| 309 | 309 |
| 310 CPDF_Document* pDoc = pSDKDoc->GetPDFDocument(); | 310 CPDF_Document* pDoc = pSDKDoc->GetPDFDocument(); |
| 311 CPDF_Dictionary* pDic = pDoc->GetRoot(); | 311 CPDF_Dictionary* pDic = pDoc->GetRoot(); |
| 312 if (!pDic) | 312 if (!pDic) |
| 313 return; | 313 return; |
| 314 | 314 |
| 315 CPDF_AAction aa = pDic->GetDict("AA"); | 315 CPDF_AAction aa = pDic->GetDictBy("AA"); |
| 316 if (aa.ActionExist((CPDF_AAction::AActionType)aaType)) { | 316 if (aa.ActionExist((CPDF_AAction::AActionType)aaType)) { |
| 317 CPDF_Action action = aa.GetAction((CPDF_AAction::AActionType)aaType); | 317 CPDF_Action action = aa.GetAction((CPDF_AAction::AActionType)aaType); |
| 318 CPDFSDK_ActionHandler* pActionHandler = | 318 CPDFSDK_ActionHandler* pActionHandler = |
| 319 ((CPDFDoc_Environment*)hHandle)->GetActionHander(); | 319 ((CPDFDoc_Environment*)hHandle)->GetActionHander(); |
| 320 pActionHandler->DoAction_Document(action, (CPDF_AAction::AActionType)aaType, | 320 pActionHandler->DoAction_Document(action, (CPDF_AAction::AActionType)aaType, |
| 321 pSDKDoc); | 321 pSDKDoc); |
| 322 } | 322 } |
| 323 } | 323 } |
| 324 | 324 |
| 325 DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page, | 325 DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page, |
| 326 FPDF_FORMHANDLE hHandle, | 326 FPDF_FORMHANDLE hHandle, |
| 327 int aaType) { | 327 int aaType) { |
| 328 if (!hHandle) | 328 if (!hHandle) |
| 329 return; | 329 return; |
| 330 CPDFSDK_Document* pSDKDoc = ((CPDFDoc_Environment*)hHandle)->GetSDKDocument(); | 330 CPDFSDK_Document* pSDKDoc = ((CPDFDoc_Environment*)hHandle)->GetSDKDocument(); |
| 331 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); | 331 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); |
| 332 CPDF_Page* pPDFPage = CPDFPageFromFPDFPage(page); | 332 CPDF_Page* pPDFPage = CPDFPageFromFPDFPage(page); |
| 333 if (!pPDFPage) | 333 if (!pPDFPage) |
| 334 return; | 334 return; |
| 335 if (pSDKDoc->GetPageView(pPage, FALSE)) { | 335 if (pSDKDoc->GetPageView(pPage, FALSE)) { |
| 336 CPDFDoc_Environment* pEnv = pSDKDoc->GetEnv(); | 336 CPDFDoc_Environment* pEnv = pSDKDoc->GetEnv(); |
| 337 CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); | 337 CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); |
| 338 CPDF_Dictionary* pPageDict = pPDFPage->m_pFormDict; | 338 CPDF_Dictionary* pPageDict = pPDFPage->m_pFormDict; |
| 339 CPDF_AAction aa = pPageDict->GetDict("AA"); | 339 CPDF_AAction aa = pPageDict->GetDictBy("AA"); |
| 340 if (FPDFPAGE_AACTION_OPEN == aaType) { | 340 if (FPDFPAGE_AACTION_OPEN == aaType) { |
| 341 if (aa.ActionExist(CPDF_AAction::OpenPage)) { | 341 if (aa.ActionExist(CPDF_AAction::OpenPage)) { |
| 342 CPDF_Action action = aa.GetAction(CPDF_AAction::OpenPage); | 342 CPDF_Action action = aa.GetAction(CPDF_AAction::OpenPage); |
| 343 pActionHandler->DoAction_Page(action, CPDF_AAction::OpenPage, pSDKDoc); | 343 pActionHandler->DoAction_Page(action, CPDF_AAction::OpenPage, pSDKDoc); |
| 344 } | 344 } |
| 345 } else { | 345 } else { |
| 346 if (aa.ActionExist(CPDF_AAction::ClosePage)) { | 346 if (aa.ActionExist(CPDF_AAction::ClosePage)) { |
| 347 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); | 347 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); |
| 348 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc); | 348 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc); |
| 349 } | 349 } |
| 350 } | 350 } |
| 351 } | 351 } |
| 352 } | 352 } |
| OLD | NEW |