| 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 #include <vector> | 10 #include <vector> |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 int aaType) { | 688 int aaType) { |
| 689 CPDFSDK_Document* pSDKDoc = CPDFSDK_Document::FromFPDFFormHandle(hHandle); | 689 CPDFSDK_Document* pSDKDoc = CPDFSDK_Document::FromFPDFFormHandle(hHandle); |
| 690 if (!pSDKDoc) | 690 if (!pSDKDoc) |
| 691 return; | 691 return; |
| 692 | 692 |
| 693 CPDF_Document* pDoc = pSDKDoc->GetPDFDocument(); | 693 CPDF_Document* pDoc = pSDKDoc->GetPDFDocument(); |
| 694 CPDF_Dictionary* pDic = pDoc->GetRoot(); | 694 CPDF_Dictionary* pDic = pDoc->GetRoot(); |
| 695 if (!pDic) | 695 if (!pDic) |
| 696 return; | 696 return; |
| 697 | 697 |
| 698 CPDF_AAction aa = pDic->GetDictBy("AA"); | 698 CPDF_AAction aa(pDic->GetDictBy("AA")); |
| 699 if (aa.ActionExist((CPDF_AAction::AActionType)aaType)) { | 699 if (aa.ActionExist((CPDF_AAction::AActionType)aaType)) { |
| 700 CPDF_Action action = aa.GetAction((CPDF_AAction::AActionType)aaType); | 700 CPDF_Action action = aa.GetAction((CPDF_AAction::AActionType)aaType); |
| 701 CPDFSDK_ActionHandler* pActionHandler = | 701 CPDFSDK_ActionHandler* pActionHandler = |
| 702 ((CPDFDoc_Environment*)hHandle)->GetActionHander(); | 702 ((CPDFDoc_Environment*)hHandle)->GetActionHander(); |
| 703 pActionHandler->DoAction_Document(action, (CPDF_AAction::AActionType)aaType, | 703 pActionHandler->DoAction_Document(action, (CPDF_AAction::AActionType)aaType, |
| 704 pSDKDoc); | 704 pSDKDoc); |
| 705 } | 705 } |
| 706 } | 706 } |
| 707 | 707 |
| 708 DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page, | 708 DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page, |
| 709 FPDF_FORMHANDLE hHandle, | 709 FPDF_FORMHANDLE hHandle, |
| 710 int aaType) { | 710 int aaType) { |
| 711 if (!hHandle) | 711 if (!hHandle) |
| 712 return; | 712 return; |
| 713 CPDFSDK_Document* pSDKDoc = ((CPDFDoc_Environment*)hHandle)->GetSDKDocument(); | 713 CPDFSDK_Document* pSDKDoc = ((CPDFDoc_Environment*)hHandle)->GetSDKDocument(); |
| 714 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); | 714 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); |
| 715 CPDF_Page* pPDFPage = CPDFPageFromFPDFPage(page); | 715 CPDF_Page* pPDFPage = CPDFPageFromFPDFPage(page); |
| 716 if (!pPDFPage) | 716 if (!pPDFPage) |
| 717 return; | 717 return; |
| 718 if (pSDKDoc->GetPageView(pPage, FALSE)) { | 718 if (pSDKDoc->GetPageView(pPage, FALSE)) { |
| 719 CPDFDoc_Environment* pEnv = pSDKDoc->GetEnv(); | 719 CPDFDoc_Environment* pEnv = pSDKDoc->GetEnv(); |
| 720 CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); | 720 CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); |
| 721 CPDF_Dictionary* pPageDict = pPDFPage->m_pFormDict; | 721 CPDF_Dictionary* pPageDict = pPDFPage->m_pFormDict; |
| 722 CPDF_AAction aa = pPageDict->GetDictBy("AA"); | 722 CPDF_AAction aa(pPageDict->GetDictBy("AA")); |
| 723 if (FPDFPAGE_AACTION_OPEN == aaType) { | 723 if (FPDFPAGE_AACTION_OPEN == aaType) { |
| 724 if (aa.ActionExist(CPDF_AAction::OpenPage)) { | 724 if (aa.ActionExist(CPDF_AAction::OpenPage)) { |
| 725 CPDF_Action action = aa.GetAction(CPDF_AAction::OpenPage); | 725 CPDF_Action action = aa.GetAction(CPDF_AAction::OpenPage); |
| 726 pActionHandler->DoAction_Page(action, CPDF_AAction::OpenPage, pSDKDoc); | 726 pActionHandler->DoAction_Page(action, CPDF_AAction::OpenPage, pSDKDoc); |
| 727 } | 727 } |
| 728 } else { | 728 } else { |
| 729 if (aa.ActionExist(CPDF_AAction::ClosePage)) { | 729 if (aa.ActionExist(CPDF_AAction::ClosePage)) { |
| 730 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); | 730 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); |
| 731 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc); | 731 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc); |
| 732 } | 732 } |
| 733 } | 733 } |
| 734 } | 734 } |
| 735 } | 735 } |
| OLD | NEW |