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 #include "../../public/fpdfview.h" | 8 #include "../../public/fpdfview.h" |
9 #include "../../third_party/base/nonstd_unique_ptr.h" | 9 #include "../../third_party/base/nonstd_unique_ptr.h" |
10 #include "../include/fsdk_define.h" | 10 #include "../include/fsdk_define.h" |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 } | 649 } |
650 } | 650 } |
651 | 651 |
652 DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page, | 652 DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page, |
653 FPDF_FORMHANDLE hHandle, | 653 FPDF_FORMHANDLE hHandle, |
654 int aaType) { | 654 int aaType) { |
655 if (!hHandle || !page) | 655 if (!hHandle || !page) |
656 return; | 656 return; |
657 CPDFSDK_Document* pSDKDoc = ((CPDFDoc_Environment*)hHandle)->GetSDKDocument(); | 657 CPDFSDK_Document* pSDKDoc = ((CPDFDoc_Environment*)hHandle)->GetSDKDocument(); |
658 CPDFXFA_Page* pPage = (CPDFXFA_Page*)page; | 658 CPDFXFA_Page* pPage = (CPDFXFA_Page*)page; |
659 CPDFSDK_PageView* pPageView = pSDKDoc->GetPageView(pPage, FALSE); | 659 CPDF_Page* pPDFPage = pPage->GetPDFPage(); |
660 if (pPageView) { | 660 if (!pPDFPage) |
| 661 return; |
| 662 if (pSDKDoc->GetPageView(pPage, FALSE)) { |
661 CPDFDoc_Environment* pEnv = pSDKDoc->GetEnv(); | 663 CPDFDoc_Environment* pEnv = pSDKDoc->GetEnv(); |
662 CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); | 664 CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); |
663 CPDF_Dictionary* pPageDict = pPage->GetPDFPage()->m_pFormDict; | 665 CPDF_Dictionary* pPageDict = pPDFPage->m_pFormDict; |
664 CPDF_AAction aa = pPageDict->GetDict(FX_BSTRC("AA")); | 666 CPDF_AAction aa = pPageDict->GetDict(FX_BSTRC("AA")); |
665 | |
666 FX_BOOL bExistOAAction = FALSE; | |
667 FX_BOOL bExistCAAction = FALSE; | |
668 if (FPDFPAGE_AACTION_OPEN == aaType) { | 667 if (FPDFPAGE_AACTION_OPEN == aaType) { |
669 bExistOAAction = aa.ActionExist(CPDF_AAction::OpenPage); | 668 if (aa.ActionExist(CPDF_AAction::OpenPage)) { |
670 if (bExistOAAction) { | |
671 CPDF_Action action = aa.GetAction(CPDF_AAction::OpenPage); | 669 CPDF_Action action = aa.GetAction(CPDF_AAction::OpenPage); |
672 pActionHandler->DoAction_Page(action, CPDF_AAction::OpenPage, pSDKDoc); | 670 pActionHandler->DoAction_Page(action, CPDF_AAction::OpenPage, pSDKDoc); |
673 } | 671 } |
674 } else { | 672 } else { |
675 bExistCAAction = aa.ActionExist(CPDF_AAction::ClosePage); | 673 if (aa.ActionExist(CPDF_AAction::ClosePage)) { |
676 if (bExistCAAction) { | |
677 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); | 674 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); |
678 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc); | 675 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc); |
679 } | 676 } |
680 } | 677 } |
681 } | 678 } |
682 } | 679 } |
OLD | NEW |