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