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 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 CPDF_Dictionary* pDic = pDoc->GetRoot(); | 701 CPDF_Dictionary* pDic = pDoc->GetRoot(); |
702 if (!pDic) | 702 if (!pDic) |
703 return; | 703 return; |
704 | 704 |
705 CPDF_AAction aa(pDic->GetDictFor("AA")); | 705 CPDF_AAction aa(pDic->GetDictFor("AA")); |
706 if (aa.ActionExist((CPDF_AAction::AActionType)aaType)) { | 706 if (aa.ActionExist((CPDF_AAction::AActionType)aaType)) { |
707 CPDF_Action action = aa.GetAction((CPDF_AAction::AActionType)aaType); | 707 CPDF_Action action = aa.GetAction((CPDF_AAction::AActionType)aaType); |
708 CPDFSDK_ActionHandler* pActionHandler = | 708 CPDFSDK_ActionHandler* pActionHandler = |
709 HandleToCPDFSDKEnvironment(hHandle)->GetActionHander(); | 709 HandleToCPDFSDKEnvironment(hHandle)->GetActionHander(); |
710 pActionHandler->DoAction_Document(action, (CPDF_AAction::AActionType)aaType, | 710 pActionHandler->DoAction_Document(action, (CPDF_AAction::AActionType)aaType, |
711 pSDKDoc); | 711 pSDKDoc->GetEnv()); |
712 } | 712 } |
713 } | 713 } |
714 | 714 |
715 DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page, | 715 DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page, |
716 FPDF_FORMHANDLE hHandle, | 716 FPDF_FORMHANDLE hHandle, |
717 int aaType) { | 717 int aaType) { |
718 if (!hHandle) | 718 if (!hHandle) |
719 return; | 719 return; |
720 | 720 |
721 CPDFSDK_Document* pSDKDoc = CPDFSDK_Document::FromFPDFFormHandle(hHandle); | 721 CPDFSDK_Document* pSDKDoc = CPDFSDK_Document::FromFPDFFormHandle(hHandle); |
722 if (!pSDKDoc) | 722 if (!pSDKDoc) |
723 return; | 723 return; |
724 | 724 |
725 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); | 725 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); |
726 CPDF_Page* pPDFPage = CPDFPageFromFPDFPage(page); | 726 CPDF_Page* pPDFPage = CPDFPageFromFPDFPage(page); |
727 if (!pPDFPage) | 727 if (!pPDFPage) |
728 return; | 728 return; |
729 | 729 |
730 if (!pSDKDoc->GetPageView(pPage, false)) | 730 if (!pSDKDoc->GetPageView(pPage, false)) |
731 return; | 731 return; |
732 | 732 |
733 CPDFSDK_FormFillEnvironment* pEnv = pSDKDoc->GetEnv(); | 733 CPDFSDK_FormFillEnvironment* pEnv = pSDKDoc->GetEnv(); |
734 CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); | 734 CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); |
735 CPDF_Dictionary* pPageDict = pPDFPage->m_pFormDict; | 735 CPDF_Dictionary* pPageDict = pPDFPage->m_pFormDict; |
736 CPDF_AAction aa(pPageDict->GetDictFor("AA")); | 736 CPDF_AAction aa(pPageDict->GetDictFor("AA")); |
737 if (FPDFPAGE_AACTION_OPEN == aaType) { | 737 if (FPDFPAGE_AACTION_OPEN == aaType) { |
738 if (aa.ActionExist(CPDF_AAction::OpenPage)) { | 738 if (aa.ActionExist(CPDF_AAction::OpenPage)) { |
739 CPDF_Action action = aa.GetAction(CPDF_AAction::OpenPage); | 739 CPDF_Action action = aa.GetAction(CPDF_AAction::OpenPage); |
740 pActionHandler->DoAction_Page(action, CPDF_AAction::OpenPage, pSDKDoc); | 740 pActionHandler->DoAction_Page(action, CPDF_AAction::OpenPage, pEnv); |
741 } | 741 } |
742 } else { | 742 } else { |
743 if (aa.ActionExist(CPDF_AAction::ClosePage)) { | 743 if (aa.ActionExist(CPDF_AAction::ClosePage)) { |
744 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); | 744 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); |
745 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc); | 745 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pEnv); |
746 } | 746 } |
747 } | 747 } |
748 } | 748 } |
OLD | NEW |