| 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 26 matching lines...) Expand all Loading... |
| 37 #endif // PDF_ENABLE_XFA | 37 #endif // PDF_ENABLE_XFA |
| 38 | 38 |
| 39 namespace { | 39 namespace { |
| 40 | 40 |
| 41 CPDFSDK_FormFillEnvironment* HandleToCPDFSDKEnvironment( | 41 CPDFSDK_FormFillEnvironment* HandleToCPDFSDKEnvironment( |
| 42 FPDF_FORMHANDLE handle) { | 42 FPDF_FORMHANDLE handle) { |
| 43 return static_cast<CPDFSDK_FormFillEnvironment*>(handle); | 43 return static_cast<CPDFSDK_FormFillEnvironment*>(handle); |
| 44 } | 44 } |
| 45 | 45 |
| 46 CPDFSDK_InterForm* FormHandleToInterForm(FPDF_FORMHANDLE hHandle) { | 46 CPDFSDK_InterForm* FormHandleToInterForm(FPDF_FORMHANDLE hHandle) { |
| 47 CPDFSDK_Document* pSDKDoc = CPDFSDK_Document::FromFPDFFormHandle(hHandle); | 47 CPDFSDK_FormFillEnvironment* pFormFillEnv = |
| 48 return pSDKDoc ? pSDKDoc->GetInterForm() : nullptr; | 48 HandleToCPDFSDKEnvironment(hHandle); |
| 49 return pFormFillEnv ? pFormFillEnv->GetSDKDocument()->GetInterForm() |
| 50 : nullptr; |
| 49 } | 51 } |
| 50 | 52 |
| 51 CPDFSDK_PageView* FormHandleToPageView(FPDF_FORMHANDLE hHandle, | 53 CPDFSDK_PageView* FormHandleToPageView(FPDF_FORMHANDLE hHandle, |
| 52 FPDF_PAGE page) { | 54 FPDF_PAGE page) { |
| 53 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); | 55 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); |
| 54 if (!pPage) | 56 if (!pPage) |
| 55 return nullptr; | 57 return nullptr; |
| 56 | 58 |
| 57 CPDFSDK_Document* pSDKDoc = CPDFSDK_Document::FromFPDFFormHandle(hHandle); | 59 CPDFSDK_FormFillEnvironment* pFormFillEnv = |
| 58 return pSDKDoc ? pSDKDoc->GetPageView(pPage, true) : nullptr; | 60 HandleToCPDFSDKEnvironment(hHandle); |
| 61 return pFormFillEnv ? pFormFillEnv->GetSDKDocument()->GetPageView(pPage, true) |
| 62 : nullptr; |
| 59 } | 63 } |
| 60 | 64 |
| 61 #ifdef PDF_ENABLE_XFA | 65 #ifdef PDF_ENABLE_XFA |
| 62 std::vector<CFX_ByteString>* FromFPDFStringHandle(FPDF_STRINGHANDLE handle) { | 66 std::vector<CFX_ByteString>* FromFPDFStringHandle(FPDF_STRINGHANDLE handle) { |
| 63 return reinterpret_cast<std::vector<CFX_ByteString>*>(handle); | 67 return reinterpret_cast<std::vector<CFX_ByteString>*>(handle); |
| 64 } | 68 } |
| 65 | 69 |
| 66 FPDF_STRINGHANDLE ToFPDFStringHandle(std::vector<CFX_ByteString>* strings) { | 70 FPDF_STRINGHANDLE ToFPDFStringHandle(std::vector<CFX_ByteString>* strings) { |
| 67 return reinterpret_cast<FPDF_STRINGHANDLE>(strings); | 71 return reinterpret_cast<FPDF_STRINGHANDLE>(strings); |
| 68 } | 72 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 85 if (!pPage) | 89 if (!pPage) |
| 86 return; | 90 return; |
| 87 | 91 |
| 88 #ifdef PDF_ENABLE_XFA | 92 #ifdef PDF_ENABLE_XFA |
| 89 CPDFXFA_Document* pDocument = pPage->GetDocument(); | 93 CPDFXFA_Document* pDocument = pPage->GetDocument(); |
| 90 if (!pDocument) | 94 if (!pDocument) |
| 91 return; | 95 return; |
| 92 CPDF_Document* pPDFDoc = pDocument->GetPDFDoc(); | 96 CPDF_Document* pPDFDoc = pDocument->GetPDFDoc(); |
| 93 if (!pPDFDoc) | 97 if (!pPDFDoc) |
| 94 return; | 98 return; |
| 95 CPDFSDK_FormFillEnvironment* pEnv = HandleToCPDFSDKEnvironment(hHandle); | 99 CPDFSDK_FormFillEnvironment* pFormFillEnv = |
| 96 CPDFSDK_Document* pFXDoc = pEnv->GetSDKDocument(); | 100 HandleToCPDFSDKEnvironment(hHandle); |
| 97 if (!pFXDoc) | 101 if (!pFormFillEnv) |
| 98 return; | 102 return; |
| 99 #endif // PDF_ENABLE_XFA | 103 #endif // PDF_ENABLE_XFA |
| 100 | 104 |
| 101 CFX_Matrix matrix; | 105 CFX_Matrix matrix; |
| 102 pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate); | 106 pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate); |
| 103 | 107 |
| 104 FX_RECT clip(start_x, start_y, start_x + size_x, start_y + size_y); | 108 FX_RECT clip(start_x, start_y, start_x + size_x, start_y + size_y); |
| 105 | 109 |
| 106 std::unique_ptr<CFX_FxgeDevice> pDevice(new CFX_FxgeDevice); | 110 std::unique_ptr<CFX_FxgeDevice> pDevice(new CFX_FxgeDevice); |
| 107 #ifdef _SKIA_SUPPORT_ | 111 #ifdef _SKIA_SUPPORT_ |
| (...skipping 13 matching lines...) Expand all Loading... |
| 121 if (flags & FPDF_GRAYSCALE) { | 125 if (flags & FPDF_GRAYSCALE) { |
| 122 options.m_ColorMode = RENDER_COLOR_GRAY; | 126 options.m_ColorMode = RENDER_COLOR_GRAY; |
| 123 options.m_ForeColor = 0; | 127 options.m_ForeColor = 0; |
| 124 options.m_BackColor = 0xffffff; | 128 options.m_BackColor = 0xffffff; |
| 125 } | 129 } |
| 126 options.m_AddFlags = flags >> 8; | 130 options.m_AddFlags = flags >> 8; |
| 127 options.m_bDrawAnnots = flags & FPDF_ANNOT; | 131 options.m_bDrawAnnots = flags & FPDF_ANNOT; |
| 128 | 132 |
| 129 #ifdef PDF_ENABLE_XFA | 133 #ifdef PDF_ENABLE_XFA |
| 130 options.m_pOCContext = new CPDF_OCContext(pPDFDoc, CPDF_OCContext::View); | 134 options.m_pOCContext = new CPDF_OCContext(pPDFDoc, CPDF_OCContext::View); |
| 131 if (CPDFSDK_PageView* pPageView = pFXDoc->GetPageView(pPage, true)) | 135 if (CPDFSDK_PageView* pPageView = |
| 136 pFormFillEnv->GetSDKDocument()->GetPageView(pPage, true)) |
| 132 pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options, clip); | 137 pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options, clip); |
| 133 #else // PDF_ENABLE_XFA | 138 #else // PDF_ENABLE_XFA |
| 134 options.m_pOCContext = | 139 options.m_pOCContext = |
| 135 new CPDF_OCContext(pPage->m_pDocument, CPDF_OCContext::View); | 140 new CPDF_OCContext(pPage->m_pDocument, CPDF_OCContext::View); |
| 136 if (CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, pPage)) | 141 if (CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, pPage)) |
| 137 pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options); | 142 pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options); |
| 138 #endif // PDF_ENABLE_XFA | 143 #endif // PDF_ENABLE_XFA |
| 139 | 144 |
| 140 pDevice->RestoreState(false); | 145 pDevice->RestoreState(false); |
| 141 delete options.m_pOCContext; | 146 delete options.m_pOCContext; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 return nullptr; | 250 return nullptr; |
| 246 | 251 |
| 247 #ifdef PDF_ENABLE_XFA | 252 #ifdef PDF_ENABLE_XFA |
| 248 // If the CPDFXFA_Document has a SDKDocument already then we've done this | 253 // If the CPDFXFA_Document has a SDKDocument already then we've done this |
| 249 // and can just return the old Env. Otherwise, we'll end up setting a new | 254 // and can just return the old Env. Otherwise, we'll end up setting a new |
| 250 // SDKDocument into the XFADocument and, that could get weird. | 255 // SDKDocument into the XFADocument and, that could get weird. |
| 251 if (pDocument->GetSDKDoc()) | 256 if (pDocument->GetSDKDoc()) |
| 252 return pDocument->GetSDKDoc()->GetEnv(); | 257 return pDocument->GetSDKDoc()->GetEnv(); |
| 253 #endif | 258 #endif |
| 254 | 259 |
| 255 CPDFSDK_FormFillEnvironment* pEnv = | 260 CPDFSDK_FormFillEnvironment* pFormFillEnv = |
| 256 new CPDFSDK_FormFillEnvironment(pDocument, formInfo); | 261 new CPDFSDK_FormFillEnvironment(pDocument, formInfo); |
| 257 | 262 |
| 258 #ifdef PDF_ENABLE_XFA | 263 #ifdef PDF_ENABLE_XFA |
| 259 pDocument->SetSDKDoc(pEnv->GetSDKDocument()); | 264 pDocument->SetSDKDoc(pFormFillEnv->GetSDKDocument()); |
| 260 CPDFXFA_App::GetInstance()->AddFormFillEnv(pEnv); | 265 CPDFXFA_App::GetInstance()->AddFormFillEnv(pFormFillEnv); |
| 261 #endif // PDF_ENABLE_XFA | 266 #endif // PDF_ENABLE_XFA |
| 262 | 267 |
| 263 return pEnv; | 268 return pFormFillEnv; |
| 264 } | 269 } |
| 265 | 270 |
| 266 DLLEXPORT void STDCALL | 271 DLLEXPORT void STDCALL |
| 267 FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle) { | 272 FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle) { |
| 268 if (!hHandle) | 273 if (!hHandle) |
| 269 return; | 274 return; |
| 270 | 275 |
| 271 CPDFSDK_FormFillEnvironment* pEnv = HandleToCPDFSDKEnvironment(hHandle); | 276 CPDFSDK_FormFillEnvironment* pFormFillEnv = |
| 277 HandleToCPDFSDKEnvironment(hHandle); |
| 272 | 278 |
| 273 #ifdef PDF_ENABLE_XFA | 279 #ifdef PDF_ENABLE_XFA |
| 274 CPDFXFA_App::GetInstance()->RemoveFormFillEnv(pEnv); | 280 CPDFXFA_App::GetInstance()->RemoveFormFillEnv(pFormFillEnv); |
| 275 | 281 |
| 276 // Reset the focused annotations and remove the SDK document from the | 282 // Reset the focused annotations and remove the SDK document from the |
| 277 // XFA document. | 283 // XFA document. |
| 278 if (CPDFSDK_Document* pSDKDoc = pEnv->GetSDKDocument()) { | 284 pFormFillEnv->GetSDKDocument()->ClearAllFocusedAnnots(); |
| 279 pSDKDoc->ClearAllFocusedAnnots(); | 285 // If the document was closed first, it's possible the XFA document |
| 280 // If the document was closed first, it's possible the XFA document | 286 // is now a nullptr. |
| 281 // is now a nullptr. | 287 if (pFormFillEnv->GetSDKDocument()->GetXFADocument()) |
| 282 if (pSDKDoc->GetXFADocument()) | 288 pFormFillEnv->GetSDKDocument()->GetXFADocument()->SetSDKDoc(nullptr); |
| 283 pSDKDoc->GetXFADocument()->SetSDKDoc(nullptr); | |
| 284 } | |
| 285 #endif // PDF_ENABLE_XFA | 289 #endif // PDF_ENABLE_XFA |
| 286 | 290 |
| 287 delete pEnv; | 291 delete pFormFillEnv; |
| 288 } | 292 } |
| 289 | 293 |
| 290 DLLEXPORT FPDF_BOOL STDCALL FORM_OnMouseMove(FPDF_FORMHANDLE hHandle, | 294 DLLEXPORT FPDF_BOOL STDCALL FORM_OnMouseMove(FPDF_FORMHANDLE hHandle, |
| 291 FPDF_PAGE page, | 295 FPDF_PAGE page, |
| 292 int modifier, | 296 int modifier, |
| 293 double page_x, | 297 double page_x, |
| 294 double page_y) { | 298 double page_y) { |
| 295 CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); | 299 CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); |
| 296 if (!pPageView) | 300 if (!pPageView) |
| 297 return FALSE; | 301 return FALSE; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 int nChar, | 385 int nChar, |
| 382 int modifier) { | 386 int modifier) { |
| 383 CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); | 387 CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); |
| 384 if (!pPageView) | 388 if (!pPageView) |
| 385 return FALSE; | 389 return FALSE; |
| 386 | 390 |
| 387 return pPageView->OnChar(nChar, modifier); | 391 return pPageView->OnChar(nChar, modifier); |
| 388 } | 392 } |
| 389 | 393 |
| 390 DLLEXPORT FPDF_BOOL STDCALL FORM_ForceToKillFocus(FPDF_FORMHANDLE hHandle) { | 394 DLLEXPORT FPDF_BOOL STDCALL FORM_ForceToKillFocus(FPDF_FORMHANDLE hHandle) { |
| 391 CPDFSDK_Document* pSDKDoc = CPDFSDK_Document::FromFPDFFormHandle(hHandle); | 395 CPDFSDK_FormFillEnvironment* pFormFillEnv = |
| 392 if (!pSDKDoc) | 396 HandleToCPDFSDKEnvironment(hHandle); |
| 397 if (!pFormFillEnv) |
| 393 return FALSE; | 398 return FALSE; |
| 394 | 399 return pFormFillEnv->GetSDKDocument()->KillFocusAnnot(0); |
| 395 return pSDKDoc->KillFocusAnnot(0); | |
| 396 } | 400 } |
| 397 | 401 |
| 398 DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle, | 402 DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle, |
| 399 FPDF_BITMAP bitmap, | 403 FPDF_BITMAP bitmap, |
| 400 FPDF_PAGE page, | 404 FPDF_PAGE page, |
| 401 int start_x, | 405 int start_x, |
| 402 int start_y, | 406 int start_y, |
| 403 int size_x, | 407 int size_x, |
| 404 int size_y, | 408 int size_y, |
| 405 int rotate, | 409 int rotate, |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 FPDF_FORMHANDLE hHandle) { | 659 FPDF_FORMHANDLE hHandle) { |
| 656 if (CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page)) | 660 if (CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page)) |
| 657 pPageView->SetValid(TRUE); | 661 pPageView->SetValid(TRUE); |
| 658 } | 662 } |
| 659 | 663 |
| 660 DLLEXPORT void STDCALL FORM_OnBeforeClosePage(FPDF_PAGE page, | 664 DLLEXPORT void STDCALL FORM_OnBeforeClosePage(FPDF_PAGE page, |
| 661 FPDF_FORMHANDLE hHandle) { | 665 FPDF_FORMHANDLE hHandle) { |
| 662 if (!hHandle) | 666 if (!hHandle) |
| 663 return; | 667 return; |
| 664 | 668 |
| 665 CPDFSDK_Document* pSDKDoc = | 669 CPDFSDK_FormFillEnvironment* pFormFillEnv = |
| 666 HandleToCPDFSDKEnvironment(hHandle)->GetSDKDocument(); | 670 HandleToCPDFSDKEnvironment(hHandle); |
| 667 if (!pSDKDoc) | 671 if (!pFormFillEnv) |
| 668 return; | 672 return; |
| 669 | 673 |
| 670 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); | 674 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); |
| 671 if (!pPage) | 675 if (!pPage) |
| 672 return; | 676 return; |
| 673 | 677 |
| 674 CPDFSDK_PageView* pPageView = pSDKDoc->GetPageView(pPage, false); | 678 CPDFSDK_PageView* pPageView = |
| 679 pFormFillEnv->GetSDKDocument()->GetPageView(pPage, false); |
| 675 if (pPageView) { | 680 if (pPageView) { |
| 676 pPageView->SetValid(FALSE); | 681 pPageView->SetValid(FALSE); |
| 677 // RemovePageView() takes care of the delete for us. | 682 // RemovePageView() takes care of the delete for us. |
| 678 pSDKDoc->RemovePageView(pPage); | 683 pFormFillEnv->GetSDKDocument()->RemovePageView(pPage); |
| 679 } | 684 } |
| 680 } | 685 } |
| 681 | 686 |
| 682 DLLEXPORT void STDCALL FORM_DoDocumentJSAction(FPDF_FORMHANDLE hHandle) { | 687 DLLEXPORT void STDCALL FORM_DoDocumentJSAction(FPDF_FORMHANDLE hHandle) { |
| 683 CPDFSDK_Document* pSDKDoc = CPDFSDK_Document::FromFPDFFormHandle(hHandle); | 688 CPDFSDK_FormFillEnvironment* pFormFillEnv = |
| 684 if (pSDKDoc && HandleToCPDFSDKEnvironment(hHandle)->IsJSInitiated()) | 689 HandleToCPDFSDKEnvironment(hHandle); |
| 685 pSDKDoc->ProcJavascriptFun(); | 690 if (pFormFillEnv && pFormFillEnv->IsJSInitiated()) |
| 691 pFormFillEnv->GetSDKDocument()->ProcJavascriptFun(); |
| 686 } | 692 } |
| 687 | 693 |
| 688 DLLEXPORT void STDCALL FORM_DoDocumentOpenAction(FPDF_FORMHANDLE hHandle) { | 694 DLLEXPORT void STDCALL FORM_DoDocumentOpenAction(FPDF_FORMHANDLE hHandle) { |
| 689 CPDFSDK_Document* pSDKDoc = CPDFSDK_Document::FromFPDFFormHandle(hHandle); | 695 CPDFSDK_FormFillEnvironment* pFormFillEnv = |
| 690 if (pSDKDoc && HandleToCPDFSDKEnvironment(hHandle)->IsJSInitiated()) | 696 HandleToCPDFSDKEnvironment(hHandle); |
| 691 pSDKDoc->ProcOpenAction(); | 697 if (pFormFillEnv && pFormFillEnv->IsJSInitiated()) |
| 698 pFormFillEnv->GetSDKDocument()->ProcOpenAction(); |
| 692 } | 699 } |
| 693 | 700 |
| 694 DLLEXPORT void STDCALL FORM_DoDocumentAAction(FPDF_FORMHANDLE hHandle, | 701 DLLEXPORT void STDCALL FORM_DoDocumentAAction(FPDF_FORMHANDLE hHandle, |
| 695 int aaType) { | 702 int aaType) { |
| 696 CPDFSDK_Document* pSDKDoc = CPDFSDK_Document::FromFPDFFormHandle(hHandle); | 703 CPDFSDK_FormFillEnvironment* pFormFillEnv = |
| 697 if (!pSDKDoc) | 704 HandleToCPDFSDKEnvironment(hHandle); |
| 705 if (!pFormFillEnv) |
| 698 return; | 706 return; |
| 699 | 707 |
| 700 CPDF_Document* pDoc = pSDKDoc->GetPDFDocument(); | 708 CPDF_Document* pDoc = pFormFillEnv->GetSDKDocument()->GetPDFDocument(); |
| 701 CPDF_Dictionary* pDic = pDoc->GetRoot(); | 709 CPDF_Dictionary* pDic = pDoc->GetRoot(); |
| 702 if (!pDic) | 710 if (!pDic) |
| 703 return; | 711 return; |
| 704 | 712 |
| 705 CPDF_AAction aa(pDic->GetDictFor("AA")); | 713 CPDF_AAction aa(pDic->GetDictFor("AA")); |
| 706 if (aa.ActionExist((CPDF_AAction::AActionType)aaType)) { | 714 if (aa.ActionExist((CPDF_AAction::AActionType)aaType)) { |
| 707 CPDF_Action action = aa.GetAction((CPDF_AAction::AActionType)aaType); | 715 CPDF_Action action = aa.GetAction((CPDF_AAction::AActionType)aaType); |
| 708 CPDFSDK_ActionHandler* pActionHandler = | 716 CPDFSDK_ActionHandler* pActionHandler = |
| 709 HandleToCPDFSDKEnvironment(hHandle)->GetActionHander(); | 717 HandleToCPDFSDKEnvironment(hHandle)->GetActionHander(); |
| 710 pActionHandler->DoAction_Document(action, (CPDF_AAction::AActionType)aaType, | 718 pActionHandler->DoAction_Document(action, (CPDF_AAction::AActionType)aaType, |
| 711 pSDKDoc->GetEnv()); | 719 pFormFillEnv); |
| 712 } | 720 } |
| 713 } | 721 } |
| 714 | 722 |
| 715 DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page, | 723 DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page, |
| 716 FPDF_FORMHANDLE hHandle, | 724 FPDF_FORMHANDLE hHandle, |
| 717 int aaType) { | 725 int aaType) { |
| 718 if (!hHandle) | 726 if (!hHandle) |
| 719 return; | 727 return; |
| 720 | 728 |
| 721 CPDFSDK_Document* pSDKDoc = CPDFSDK_Document::FromFPDFFormHandle(hHandle); | 729 CPDFSDK_FormFillEnvironment* pFormFillEnv = |
| 722 if (!pSDKDoc) | 730 HandleToCPDFSDKEnvironment(hHandle); |
| 731 if (!pFormFillEnv) |
| 723 return; | 732 return; |
| 724 | 733 |
| 725 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); | 734 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); |
| 726 CPDF_Page* pPDFPage = CPDFPageFromFPDFPage(page); | 735 CPDF_Page* pPDFPage = CPDFPageFromFPDFPage(page); |
| 727 if (!pPDFPage) | 736 if (!pPDFPage) |
| 728 return; | 737 return; |
| 729 | 738 |
| 730 if (!pSDKDoc->GetPageView(pPage, false)) | 739 if (!pFormFillEnv->GetSDKDocument()->GetPageView(pPage, false)) |
| 731 return; | 740 return; |
| 732 | 741 |
| 733 CPDFSDK_FormFillEnvironment* pEnv = pSDKDoc->GetEnv(); | 742 CPDFSDK_ActionHandler* pActionHandler = pFormFillEnv->GetActionHander(); |
| 734 CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); | |
| 735 CPDF_Dictionary* pPageDict = pPDFPage->m_pFormDict; | 743 CPDF_Dictionary* pPageDict = pPDFPage->m_pFormDict; |
| 736 CPDF_AAction aa(pPageDict->GetDictFor("AA")); | 744 CPDF_AAction aa(pPageDict->GetDictFor("AA")); |
| 737 if (FPDFPAGE_AACTION_OPEN == aaType) { | 745 if (FPDFPAGE_AACTION_OPEN == aaType) { |
| 738 if (aa.ActionExist(CPDF_AAction::OpenPage)) { | 746 if (aa.ActionExist(CPDF_AAction::OpenPage)) { |
| 739 CPDF_Action action = aa.GetAction(CPDF_AAction::OpenPage); | 747 CPDF_Action action = aa.GetAction(CPDF_AAction::OpenPage); |
| 740 pActionHandler->DoAction_Page(action, CPDF_AAction::OpenPage, pEnv); | 748 pActionHandler->DoAction_Page(action, CPDF_AAction::OpenPage, |
| 749 pFormFillEnv); |
| 741 } | 750 } |
| 742 } else { | 751 } else { |
| 743 if (aa.ActionExist(CPDF_AAction::ClosePage)) { | 752 if (aa.ActionExist(CPDF_AAction::ClosePage)) { |
| 744 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); | 753 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); |
| 745 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pEnv); | 754 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, |
| 755 pFormFillEnv); |
| 746 } | 756 } |
| 747 } | 757 } |
| 748 } | 758 } |
| OLD | NEW |