From 735606d84b6898a51c61b17a2d286a13d964589a Mon Sep 17 00:00:00 2001 From: dsinclair Date: Wed, 5 Oct 2016 15:47:02 -0700 Subject: Rename CPDFSDK_Environment to CPDFSDK_FormfillEnvironment Rename CPDFSDK_Environment to make it explicit that this is part of the formfill system. Review-Url: https://codereview.chromium.org/2391313002 --- BUILD.gn | 4 +- fpdfsdk/cfx_systemhandler.cpp | 2 +- fpdfsdk/cfx_systemhandler.h | 7 +- fpdfsdk/cpdfsdk_annothandlermgr.cpp | 5 +- fpdfsdk/cpdfsdk_annothandlermgr.h | 6 +- fpdfsdk/cpdfsdk_baannothandler.h | 2 +- fpdfsdk/cpdfsdk_document.cpp | 7 +- fpdfsdk/cpdfsdk_document.h | 9 +- fpdfsdk/cpdfsdk_environment.cpp | 545 --------------------- fpdfsdk/cpdfsdk_environment.h | 174 ------- fpdfsdk/cpdfsdk_formfillenvironment.cpp | 554 ++++++++++++++++++++++ fpdfsdk/cpdfsdk_formfillenvironment.h | 175 +++++++ fpdfsdk/cpdfsdk_interform.cpp | 16 +- fpdfsdk/cpdfsdk_pageview.cpp | 36 +- fpdfsdk/cpdfsdk_widget.cpp | 14 +- fpdfsdk/cpdfsdk_widgethandler.cpp | 4 +- fpdfsdk/cpdfsdk_widgethandler.h | 6 +- fpdfsdk/cpdfsdk_xfawidgethandler.cpp | 5 +- fpdfsdk/cpdfsdk_xfawidgethandler.h | 6 +- fpdfsdk/formfiller/cffl_checkbox.cpp | 5 +- fpdfsdk/formfiller/cffl_checkbox.h | 2 +- fpdfsdk/formfiller/cffl_combobox.cpp | 5 +- fpdfsdk/formfiller/cffl_combobox.h | 2 +- fpdfsdk/formfiller/cffl_formfiller.cpp | 7 +- fpdfsdk/formfiller/cffl_formfiller.h | 8 +- fpdfsdk/formfiller/cffl_interactiveformfiller.cpp | 4 +- fpdfsdk/formfiller/cffl_interactiveformfiller.h | 6 +- fpdfsdk/formfiller/cffl_listbox.cpp | 5 +- fpdfsdk/formfiller/cffl_listbox.h | 2 +- fpdfsdk/formfiller/cffl_pushbutton.cpp | 2 +- fpdfsdk/formfiller/cffl_pushbutton.h | 2 +- fpdfsdk/formfiller/cffl_radiobutton.cpp | 4 +- fpdfsdk/formfiller/cffl_radiobutton.h | 2 +- fpdfsdk/formfiller/cffl_textfield.cpp | 5 +- fpdfsdk/formfiller/cffl_textfield.h | 2 +- fpdfsdk/fpdfformfill.cpp | 16 +- fpdfsdk/fpdfxfa/cpdfxfa_app.cpp | 26 +- fpdfsdk/fpdfxfa/cpdfxfa_app.h | 8 +- fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp | 30 +- fpdfsdk/fpdfxfa/cpdfxfa_document.cpp | 2 +- fpdfsdk/fpdfxfa/cpdfxfa_document.h | 2 +- fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.cpp | 2 +- fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h | 4 +- fpdfsdk/fsdk_actionhandler.cpp | 20 +- fpdfsdk/javascript/Document.cpp | 12 +- fpdfsdk/javascript/Field.cpp | 6 +- fpdfsdk/javascript/JS_GlobalData.cpp | 3 +- fpdfsdk/javascript/JS_GlobalData.h | 4 +- fpdfsdk/javascript/JS_Object.h | 2 +- fpdfsdk/javascript/JS_Runtime_Stub.cpp | 2 +- fpdfsdk/javascript/PublicMethods.cpp | 4 +- fpdfsdk/javascript/app.cpp | 29 +- fpdfsdk/javascript/cjs_context.cpp | 2 +- fpdfsdk/javascript/cjs_context.h | 4 +- fpdfsdk/javascript/cjs_runtime.cpp | 6 +- fpdfsdk/javascript/cjs_runtime.h | 6 +- fpdfsdk/javascript/global.cpp | 2 +- fpdfsdk/javascript/global.h | 4 +- fpdfsdk/javascript/ijs_runtime.h | 4 +- 59 files changed, 932 insertions(+), 908 deletions(-) delete mode 100644 fpdfsdk/cpdfsdk_environment.cpp delete mode 100644 fpdfsdk/cpdfsdk_environment.h create mode 100644 fpdfsdk/cpdfsdk_formfillenvironment.cpp create mode 100644 fpdfsdk/cpdfsdk_formfillenvironment.h diff --git a/BUILD.gn b/BUILD.gn index 57a0cfb9d4..b6b33f186b 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -80,8 +80,8 @@ static_library("pdfium") { "fpdfsdk/cpdfsdk_datetime.h", "fpdfsdk/cpdfsdk_document.cpp", "fpdfsdk/cpdfsdk_document.h", - "fpdfsdk/cpdfsdk_environment.cpp", - "fpdfsdk/cpdfsdk_environment.h", + "fpdfsdk/cpdfsdk_formfillenvironment.cpp", + "fpdfsdk/cpdfsdk_formfillenvironment.h", "fpdfsdk/cpdfsdk_interform.cpp", "fpdfsdk/cpdfsdk_interform.h", "fpdfsdk/cpdfsdk_pageview.cpp", diff --git a/fpdfsdk/cfx_systemhandler.cpp b/fpdfsdk/cfx_systemhandler.cpp index adcc5bee56..bfa80df126 100644 --- a/fpdfsdk/cfx_systemhandler.cpp +++ b/fpdfsdk/cfx_systemhandler.cpp @@ -14,7 +14,7 @@ #include "core/fxge/cfx_gemodule.h" #include "fpdfsdk/cpdfsdk_annot.h" #include "fpdfsdk/cpdfsdk_document.h" -#include "fpdfsdk/cpdfsdk_environment.h" +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_pageview.h" #include "fpdfsdk/cpdfsdk_widget.h" #include "fpdfsdk/formfiller/cffl_formfiller.h" diff --git a/fpdfsdk/cfx_systemhandler.h b/fpdfsdk/cfx_systemhandler.h index 53043904e6..9381d9e08c 100644 --- a/fpdfsdk/cfx_systemhandler.h +++ b/fpdfsdk/cfx_systemhandler.h @@ -44,12 +44,13 @@ struct FX_SYSTEMTIME { class CFFL_FormFiller; class CPDF_Document; class CPDF_Font; -class CPDFSDK_Environment; +class CPDFSDK_FormFillEnvironment; class CPDFSDK_Widget; class CFX_SystemHandler { public: - explicit CFX_SystemHandler(CPDFSDK_Environment* pEnv) : m_pEnv(pEnv) {} + explicit CFX_SystemHandler(CPDFSDK_FormFillEnvironment* pEnv) + : m_pEnv(pEnv) {} ~CFX_SystemHandler() {} void InvalidateRect(CPDFSDK_Widget* widget, FX_RECT rect); @@ -71,7 +72,7 @@ class CFX_SystemHandler { bool IsALTKeyDown(uint32_t nFlag) const; private: - CPDFSDK_Environment* const m_pEnv; + CPDFSDK_FormFillEnvironment* const m_pEnv; }; #endif // FPDFSDK_CFX_SYSTEMHANDLER_H_ diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.cpp b/fpdfsdk/cpdfsdk_annothandlermgr.cpp index 32ff8d635e..574efc1029 100644 --- a/fpdfsdk/cpdfsdk_annothandlermgr.cpp +++ b/fpdfsdk/cpdfsdk_annothandlermgr.cpp @@ -13,7 +13,7 @@ #include "fpdfsdk/cpdfsdk_baannothandler.h" #include "fpdfsdk/cpdfsdk_datetime.h" #include "fpdfsdk/cpdfsdk_document.h" -#include "fpdfsdk/cpdfsdk_environment.h" +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_pageview.h" #include "fpdfsdk/cpdfsdk_widgethandler.h" @@ -24,7 +24,8 @@ #include "xfa/fxfa/xfa_ffwidget.h" #endif // PDF_ENABLE_XFA -CPDFSDK_AnnotHandlerMgr::CPDFSDK_AnnotHandlerMgr(CPDFSDK_Environment* pEnv) +CPDFSDK_AnnotHandlerMgr::CPDFSDK_AnnotHandlerMgr( + CPDFSDK_FormFillEnvironment* pEnv) : m_pBAAnnotHandler(new CPDFSDK_BAAnnotHandler()), m_pWidgetHandler(new CPDFSDK_WidgetHandler(pEnv)), #ifdef PDF_ENABLE_XFA diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.h b/fpdfsdk/cpdfsdk_annothandlermgr.h index c87b91b22c..1bb63d62e8 100644 --- a/fpdfsdk/cpdfsdk_annothandlermgr.h +++ b/fpdfsdk/cpdfsdk_annothandlermgr.h @@ -17,7 +17,7 @@ class CFX_Matrix; class CFX_RenderDevice; -class CPDFSDK_Environment; +class CPDFSDK_FormFillEnvironment; class CPDFSDK_BAAnnotHandler; class CPDFSDK_WidgetHandler; class CPDFSDK_PageView; @@ -30,7 +30,7 @@ class CXFA_FFWidget; class CPDFSDK_AnnotHandlerMgr { public: - explicit CPDFSDK_AnnotHandlerMgr(CPDFSDK_Environment* pApp); + explicit CPDFSDK_AnnotHandlerMgr(CPDFSDK_FormFillEnvironment* pApp); ~CPDFSDK_AnnotHandlerMgr(); CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView); @@ -112,7 +112,7 @@ class CPDFSDK_AnnotHandlerMgr { std::unique_ptr m_pXFAWidgetHandler; #endif // PDF_ENABLE_XFA - CPDFSDK_Environment* m_pEnv; + CPDFSDK_FormFillEnvironment* m_pEnv; }; #endif // FPDFSDK_CPDFSDK_ANNOTHANDLERMGR_H_ diff --git a/fpdfsdk/cpdfsdk_baannothandler.h b/fpdfsdk/cpdfsdk_baannothandler.h index aca646f88e..70586f6fa5 100644 --- a/fpdfsdk/cpdfsdk_baannothandler.h +++ b/fpdfsdk/cpdfsdk_baannothandler.h @@ -15,7 +15,7 @@ class CFFL_InteractiveFormFiller; class CFX_Matrix; class CFX_RenderDevice; class CPDF_Annot; -class CPDFSDK_Environment; +class CPDFSDK_FormFillEnvironment; class CPDFSDK_Annot; class CPDFSDK_PageView; diff --git a/fpdfsdk/cpdfsdk_document.cpp b/fpdfsdk/cpdfsdk_document.cpp index a0febafd48..c597a1dab3 100644 --- a/fpdfsdk/cpdfsdk_document.cpp +++ b/fpdfsdk/cpdfsdk_document.cpp @@ -15,7 +15,7 @@ #include "core/fpdfdoc/cpdf_occontext.h" #include "fpdfsdk/cpdfsdk_annot.h" #include "fpdfsdk/cpdfsdk_annothandlermgr.h" -#include "fpdfsdk/cpdfsdk_environment.h" +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_interform.h" #include "fpdfsdk/cpdfsdk_pageview.h" #include "fpdfsdk/cpdfsdk_widget.h" @@ -25,12 +25,13 @@ // static CPDFSDK_Document* CPDFSDK_Document::FromFPDFFormHandle( FPDF_FORMHANDLE hHandle) { - CPDFSDK_Environment* pEnv = static_cast(hHandle); + CPDFSDK_FormFillEnvironment* pEnv = + static_cast(hHandle); return pEnv ? pEnv->GetSDKDocument() : nullptr; } CPDFSDK_Document::CPDFSDK_Document(UnderlyingDocumentType* pDoc, - CPDFSDK_Environment* pEnv) + CPDFSDK_FormFillEnvironment* pEnv) : m_pDoc(pDoc), m_pEnv(pEnv), m_bChangeMask(FALSE), diff --git a/fpdfsdk/cpdfsdk_document.h b/fpdfsdk/cpdfsdk_document.h index 561bfc198d..921a8df972 100644 --- a/fpdfsdk/cpdfsdk_document.h +++ b/fpdfsdk/cpdfsdk_document.h @@ -17,7 +17,7 @@ #include "public/fpdf_formfill.h" class CPDF_OCContext; -class CPDFSDK_Environment; +class CPDFSDK_FormFillEnvironment; class CPDFSDK_InterForm; class CPDFSDK_PageView; class IJS_Runtime; @@ -26,7 +26,8 @@ class CPDFSDK_Document : public CFX_Observable { public: static CPDFSDK_Document* FromFPDFFormHandle(FPDF_FORMHANDLE hHandle); - CPDFSDK_Document(UnderlyingDocumentType* pDoc, CPDFSDK_Environment* pEnv); + CPDFSDK_Document(UnderlyingDocumentType* pDoc, + CPDFSDK_FormFillEnvironment* pEnv); ~CPDFSDK_Document(); CPDFSDK_InterForm* GetInterForm(); @@ -89,7 +90,7 @@ class CPDFSDK_Document : public CFX_Observable { void ClearChangeMark() { m_bChangeMask = FALSE; } CFX_WideString GetPath(); UnderlyingPageType* GetPage(int nIndex); - CPDFSDK_Environment* GetEnv() { return m_pEnv; } + CPDFSDK_FormFillEnvironment* GetEnv() { return m_pEnv; } void ProcJavascriptFun(); FX_BOOL ProcOpenAction(); CPDF_OCContext* GetOCContext(); @@ -99,7 +100,7 @@ class CPDFSDK_Document : public CFX_Observable { UnderlyingDocumentType* m_pDoc; std::unique_ptr m_pInterForm; CPDFSDK_Annot::ObservedPtr m_pFocusAnnot; - CPDFSDK_Environment* m_pEnv; + CPDFSDK_FormFillEnvironment* m_pEnv; std::unique_ptr m_pOccontent; FX_BOOL m_bChangeMask; FX_BOOL m_bBeingDestroyed; diff --git a/fpdfsdk/cpdfsdk_environment.cpp b/fpdfsdk/cpdfsdk_environment.cpp deleted file mode 100644 index 1c84b8c194..0000000000 --- a/fpdfsdk/cpdfsdk_environment.cpp +++ /dev/null @@ -1,545 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "fpdfsdk/cpdfsdk_environment.h" - -#include - -#include "fpdfsdk/cpdfsdk_annothandlermgr.h" -#include "fpdfsdk/cpdfsdk_document.h" -#include "fpdfsdk/formfiller/cffl_interactiveformfiller.h" -#include "fpdfsdk/fsdk_actionhandler.h" -#include "fpdfsdk/javascript/ijs_runtime.h" -#include "third_party/base/ptr_util.h" - -#ifdef PDF_ENABLE_XFA -#include "fpdfsdk/fpdfxfa/cpdfxfa_app.h" -#endif // PDF_ENABLE_XFA - -namespace { - -// NOTE: |bsUTF16LE| must outlive the use of the result. Care must be taken -// since modifying the result would impact |bsUTF16LE|. -FPDF_WIDESTRING AsFPDFWideString(CFX_ByteString* bsUTF16LE) { - return reinterpret_cast( - bsUTF16LE->GetBuffer(bsUTF16LE->GetLength())); -} - -} // namespace - -CPDFSDK_Environment::CPDFSDK_Environment(UnderlyingDocumentType* pDoc, - FPDF_FORMFILLINFO* pFFinfo) - : m_pInfo(pFFinfo), - m_pSDKDoc(new CPDFSDK_Document(pDoc, this)), - m_pUnderlyingDoc(pDoc), - m_pSysHandler(new CFX_SystemHandler(this)) {} - -CPDFSDK_Environment::~CPDFSDK_Environment() { -#ifdef PDF_ENABLE_XFA - CPDFXFA_App* pProvider = CPDFXFA_App::GetInstance(); - if (pProvider->m_pEnvList.GetSize() == 0) - pProvider->SetJavaScriptInitialized(FALSE); -#endif // PDF_ENABLE_XFA - if (m_pInfo && m_pInfo->Release) - m_pInfo->Release(m_pInfo); -} - -int CPDFSDK_Environment::JS_appAlert(const FX_WCHAR* Msg, - const FX_WCHAR* Title, - uint32_t Type, - uint32_t Icon) { - if (!m_pInfo || !m_pInfo->m_pJsPlatform || - !m_pInfo->m_pJsPlatform->app_alert) { - return -1; - } - CFX_ByteString bsMsg = CFX_WideString(Msg).UTF16LE_Encode(); - CFX_ByteString bsTitle = CFX_WideString(Title).UTF16LE_Encode(); - return m_pInfo->m_pJsPlatform->app_alert( - m_pInfo->m_pJsPlatform, AsFPDFWideString(&bsMsg), - AsFPDFWideString(&bsTitle), Type, Icon); -} - -int CPDFSDK_Environment::JS_appResponse(const FX_WCHAR* Question, - const FX_WCHAR* Title, - const FX_WCHAR* Default, - const FX_WCHAR* cLabel, - FPDF_BOOL bPassword, - void* response, - int length) { - if (!m_pInfo || !m_pInfo->m_pJsPlatform || - !m_pInfo->m_pJsPlatform->app_response) { - return -1; - } - CFX_ByteString bsQuestion = CFX_WideString(Question).UTF16LE_Encode(); - CFX_ByteString bsTitle = CFX_WideString(Title).UTF16LE_Encode(); - CFX_ByteString bsDefault = CFX_WideString(Default).UTF16LE_Encode(); - CFX_ByteString bsLabel = CFX_WideString(cLabel).UTF16LE_Encode(); - return m_pInfo->m_pJsPlatform->app_response( - m_pInfo->m_pJsPlatform, AsFPDFWideString(&bsQuestion), - AsFPDFWideString(&bsTitle), AsFPDFWideString(&bsDefault), - AsFPDFWideString(&bsLabel), bPassword, response, length); -} - -void CPDFSDK_Environment::JS_appBeep(int nType) { - if (!m_pInfo || !m_pInfo->m_pJsPlatform || - !m_pInfo->m_pJsPlatform->app_beep) { - return; - } - m_pInfo->m_pJsPlatform->app_beep(m_pInfo->m_pJsPlatform, nType); -} - -CFX_WideString CPDFSDK_Environment::JS_fieldBrowse() { - if (!m_pInfo || !m_pInfo->m_pJsPlatform || - !m_pInfo->m_pJsPlatform->Field_browse) { - return CFX_WideString(); - } - const int nRequiredLen = - m_pInfo->m_pJsPlatform->Field_browse(m_pInfo->m_pJsPlatform, nullptr, 0); - if (nRequiredLen <= 0) - return CFX_WideString(); - - std::unique_ptr pBuff(new char[nRequiredLen]); - memset(pBuff.get(), 0, nRequiredLen); - const int nActualLen = m_pInfo->m_pJsPlatform->Field_browse( - m_pInfo->m_pJsPlatform, pBuff.get(), nRequiredLen); - if (nActualLen <= 0 || nActualLen > nRequiredLen) - return CFX_WideString(); - - return CFX_WideString::FromLocal(CFX_ByteStringC(pBuff.get(), nActualLen)); -} - -CFX_WideString CPDFSDK_Environment::JS_docGetFilePath() { - if (!m_pInfo || !m_pInfo->m_pJsPlatform || - !m_pInfo->m_pJsPlatform->Doc_getFilePath) { - return CFX_WideString(); - } - const int nRequiredLen = m_pInfo->m_pJsPlatform->Doc_getFilePath( - m_pInfo->m_pJsPlatform, nullptr, 0); - if (nRequiredLen <= 0) - return CFX_WideString(); - - std::unique_ptr pBuff(new char[nRequiredLen]); - memset(pBuff.get(), 0, nRequiredLen); - const int nActualLen = m_pInfo->m_pJsPlatform->Doc_getFilePath( - m_pInfo->m_pJsPlatform, pBuff.get(), nRequiredLen); - if (nActualLen <= 0 || nActualLen > nRequiredLen) - return CFX_WideString(); - - return CFX_WideString::FromLocal(CFX_ByteStringC(pBuff.get(), nActualLen)); -} - -void CPDFSDK_Environment::JS_docSubmitForm(void* formData, - int length, - const FX_WCHAR* URL) { - if (!m_pInfo || !m_pInfo->m_pJsPlatform || - !m_pInfo->m_pJsPlatform->Doc_submitForm) { - return; - } - CFX_ByteString bsDestination = CFX_WideString(URL).UTF16LE_Encode(); - m_pInfo->m_pJsPlatform->Doc_submitForm(m_pInfo->m_pJsPlatform, formData, - length, - AsFPDFWideString(&bsDestination)); -} - -void CPDFSDK_Environment::JS_docmailForm(void* mailData, - int length, - FPDF_BOOL bUI, - const FX_WCHAR* To, - const FX_WCHAR* Subject, - const FX_WCHAR* CC, - const FX_WCHAR* BCC, - const FX_WCHAR* Msg) { - if (!m_pInfo || !m_pInfo->m_pJsPlatform || - !m_pInfo->m_pJsPlatform->Doc_mail) { - return; - } - CFX_ByteString bsTo = CFX_WideString(To).UTF16LE_Encode(); - CFX_ByteString bsSubject = CFX_WideString(Subject).UTF16LE_Encode(); - CFX_ByteString bsCC = CFX_WideString(CC).UTF16LE_Encode(); - CFX_ByteString bsBcc = CFX_WideString(BCC).UTF16LE_Encode(); - CFX_ByteString bsMsg = CFX_WideString(Msg).UTF16LE_Encode(); - m_pInfo->m_pJsPlatform->Doc_mail( - m_pInfo->m_pJsPlatform, mailData, length, bUI, AsFPDFWideString(&bsTo), - AsFPDFWideString(&bsSubject), AsFPDFWideString(&bsCC), - AsFPDFWideString(&bsBcc), AsFPDFWideString(&bsMsg)); -} - -void CPDFSDK_Environment::JS_docprint(FPDF_BOOL bUI, - int nStart, - int nEnd, - FPDF_BOOL bSilent, - FPDF_BOOL bShrinkToFit, - FPDF_BOOL bPrintAsImage, - FPDF_BOOL bReverse, - FPDF_BOOL bAnnotations) { - if (!m_pInfo || !m_pInfo->m_pJsPlatform || - !m_pInfo->m_pJsPlatform->Doc_print) { - return; - } - m_pInfo->m_pJsPlatform->Doc_print(m_pInfo->m_pJsPlatform, bUI, nStart, nEnd, - bSilent, bShrinkToFit, bPrintAsImage, - bReverse, bAnnotations); -} - -void CPDFSDK_Environment::JS_docgotoPage(int nPageNum) { - if (!m_pInfo || !m_pInfo->m_pJsPlatform || - !m_pInfo->m_pJsPlatform->Doc_gotoPage) { - return; - } - m_pInfo->m_pJsPlatform->Doc_gotoPage(m_pInfo->m_pJsPlatform, nPageNum); -} - -IJS_Runtime* CPDFSDK_Environment::GetJSRuntime() { - if (!IsJSInitiated()) - return nullptr; - if (!m_pJSRuntime) - m_pJSRuntime.reset(IJS_Runtime::Create(this)); - return m_pJSRuntime.get(); -} - -CPDFSDK_AnnotHandlerMgr* CPDFSDK_Environment::GetAnnotHandlerMgr() { - if (!m_pAnnotHandlerMgr) - m_pAnnotHandlerMgr = pdfium::MakeUnique(this); - return m_pAnnotHandlerMgr.get(); -} - -CPDFSDK_ActionHandler* CPDFSDK_Environment::GetActionHander() { - if (!m_pActionHandler) - m_pActionHandler = pdfium::MakeUnique(); - return m_pActionHandler.get(); -} - -CFFL_InteractiveFormFiller* CPDFSDK_Environment::GetInteractiveFormFiller() { - if (!m_pFormFiller) - m_pFormFiller = pdfium::MakeUnique(this); - return m_pFormFiller.get(); -} - -void CPDFSDK_Environment::Invalidate(FPDF_PAGE page, - double left, - double top, - double right, - double bottom) { - if (m_pInfo && m_pInfo->FFI_Invalidate) - m_pInfo->FFI_Invalidate(m_pInfo, page, left, top, right, bottom); -} - -void CPDFSDK_Environment::OutputSelectedRect(FPDF_PAGE page, - double left, - double top, - double right, - double bottom) { - if (m_pInfo && m_pInfo->FFI_OutputSelectedRect) - m_pInfo->FFI_OutputSelectedRect(m_pInfo, page, left, top, right, bottom); -} - -void CPDFSDK_Environment::SetCursor(int nCursorType) { - if (m_pInfo && m_pInfo->FFI_SetCursor) - m_pInfo->FFI_SetCursor(m_pInfo, nCursorType); -} - -int CPDFSDK_Environment::SetTimer(int uElapse, TimerCallback lpTimerFunc) { - if (m_pInfo && m_pInfo->FFI_SetTimer) - return m_pInfo->FFI_SetTimer(m_pInfo, uElapse, lpTimerFunc); - return -1; -} - -void CPDFSDK_Environment::KillTimer(int nTimerID) { - if (m_pInfo && m_pInfo->FFI_KillTimer) - m_pInfo->FFI_KillTimer(m_pInfo, nTimerID); -} - -FX_SYSTEMTIME CPDFSDK_Environment::GetLocalTime() const { - FX_SYSTEMTIME fxtime; - if (!m_pInfo || !m_pInfo->FFI_GetLocalTime) - return fxtime; - - FPDF_SYSTEMTIME systime = m_pInfo->FFI_GetLocalTime(m_pInfo); - fxtime.wDay = systime.wDay; - fxtime.wDayOfWeek = systime.wDayOfWeek; - fxtime.wHour = systime.wHour; - fxtime.wMilliseconds = systime.wMilliseconds; - fxtime.wMinute = systime.wMinute; - fxtime.wMonth = systime.wMonth; - fxtime.wSecond = systime.wSecond; - fxtime.wYear = systime.wYear; - return fxtime; -} - -void CPDFSDK_Environment::OnChange() { - if (m_pInfo && m_pInfo->FFI_OnChange) - m_pInfo->FFI_OnChange(m_pInfo); -} - -FX_BOOL CPDFSDK_Environment::IsSHIFTKeyDown(uint32_t nFlag) const { - return (nFlag & FWL_EVENTFLAG_ShiftKey) != 0; -} - -FX_BOOL CPDFSDK_Environment::IsCTRLKeyDown(uint32_t nFlag) const { - return (nFlag & FWL_EVENTFLAG_ControlKey) != 0; -} - -FX_BOOL CPDFSDK_Environment::IsALTKeyDown(uint32_t nFlag) const { - return (nFlag & FWL_EVENTFLAG_AltKey) != 0; -} - -FPDF_PAGE CPDFSDK_Environment::GetPage(FPDF_DOCUMENT document, int nPageIndex) { - if (m_pInfo && m_pInfo->FFI_GetPage) - return m_pInfo->FFI_GetPage(m_pInfo, document, nPageIndex); - return nullptr; -} - -FPDF_PAGE CPDFSDK_Environment::GetCurrentPage(FPDF_DOCUMENT document) { - if (m_pInfo && m_pInfo->FFI_GetCurrentPage) - return m_pInfo->FFI_GetCurrentPage(m_pInfo, document); - return nullptr; -} - -void CPDFSDK_Environment::ExecuteNamedAction(const FX_CHAR* namedAction) { - if (m_pInfo && m_pInfo->FFI_ExecuteNamedAction) - m_pInfo->FFI_ExecuteNamedAction(m_pInfo, namedAction); -} - -void CPDFSDK_Environment::OnSetFieldInputFocus(FPDF_WIDESTRING focusText, - FPDF_DWORD nTextLen, - FX_BOOL bFocus) { - if (m_pInfo && m_pInfo->FFI_SetTextFieldFocus) - m_pInfo->FFI_SetTextFieldFocus(m_pInfo, focusText, nTextLen, bFocus); -} - -void CPDFSDK_Environment::DoURIAction(const FX_CHAR* bsURI) { - if (m_pInfo && m_pInfo->FFI_DoURIAction) - m_pInfo->FFI_DoURIAction(m_pInfo, bsURI); -} - -void CPDFSDK_Environment::DoGoToAction(int nPageIndex, - int zoomMode, - float* fPosArray, - int sizeOfArray) { - if (m_pInfo && m_pInfo->FFI_DoGoToAction) { - m_pInfo->FFI_DoGoToAction(m_pInfo, nPageIndex, zoomMode, fPosArray, - sizeOfArray); - } -} - -#ifdef PDF_ENABLE_XFA -void CPDFSDK_Environment::DisplayCaret(FPDF_PAGE page, - FPDF_BOOL bVisible, - double left, - double top, - double right, - double bottom) { - if (m_pInfo && m_pInfo->FFI_DisplayCaret) { - m_pInfo->FFI_DisplayCaret(m_pInfo, page, bVisible, left, top, right, - bottom); - } -} - -int CPDFSDK_Environment::GetCurrentPageIndex(FPDF_DOCUMENT document) { - if (!m_pInfo || !m_pInfo->FFI_GetCurrentPageIndex) - return -1; - return m_pInfo->FFI_GetCurrentPageIndex(m_pInfo, document); -} - -void CPDFSDK_Environment::SetCurrentPage(FPDF_DOCUMENT document, int iCurPage) { - if (m_pInfo && m_pInfo->FFI_SetCurrentPage) - m_pInfo->FFI_SetCurrentPage(m_pInfo, document, iCurPage); -} - -CFX_WideString CPDFSDK_Environment::GetPlatform() { - if (!m_pInfo || !m_pInfo->FFI_GetPlatform) - return L""; - - int nRequiredLen = m_pInfo->FFI_GetPlatform(m_pInfo, nullptr, 0); - if (nRequiredLen <= 0) - return L""; - - char* pbuff = new char[nRequiredLen]; - memset(pbuff, 0, nRequiredLen); - int nActualLen = m_pInfo->FFI_GetPlatform(m_pInfo, pbuff, nRequiredLen); - if (nActualLen <= 0 || nActualLen > nRequiredLen) { - delete[] pbuff; - return L""; - } - CFX_ByteString bsRet = CFX_ByteString(pbuff, nActualLen); - CFX_WideString wsRet = CFX_WideString::FromUTF16LE( - (unsigned short*)bsRet.GetBuffer(bsRet.GetLength()), - bsRet.GetLength() / sizeof(unsigned short)); - delete[] pbuff; - return wsRet; -} - -void CPDFSDK_Environment::GotoURL(FPDF_DOCUMENT document, - const CFX_WideStringC& wsURL) { - if (!m_pInfo || !m_pInfo->FFI_GotoURL) - return; - - CFX_ByteString bsTo = CFX_WideString(wsURL).UTF16LE_Encode(); - FPDF_WIDESTRING pTo = (FPDF_WIDESTRING)bsTo.GetBuffer(wsURL.GetLength()); - m_pInfo->FFI_GotoURL(m_pInfo, document, pTo); - bsTo.ReleaseBuffer(); -} - -void CPDFSDK_Environment::GetPageViewRect(FPDF_PAGE page, FS_RECTF& dstRect) { - if (!m_pInfo || !m_pInfo->FFI_GetPageViewRect) - return; - - double left; - double top; - double right; - double bottom; - m_pInfo->FFI_GetPageViewRect(m_pInfo, page, &left, &top, &right, &bottom); - - dstRect.left = static_cast(left); - dstRect.top = static_cast(top < bottom ? bottom : top); - dstRect.bottom = static_cast(top < bottom ? top : bottom); - dstRect.right = static_cast(right); -} - -FX_BOOL CPDFSDK_Environment::PopupMenu(FPDF_PAGE page, - FPDF_WIDGET hWidget, - int menuFlag, - CFX_PointF pt) { - if (!m_pInfo || !m_pInfo->FFI_PopupMenu) - return FALSE; - return m_pInfo->FFI_PopupMenu(m_pInfo, page, hWidget, menuFlag, pt.x, pt.y); -} - -void CPDFSDK_Environment::Alert(FPDF_WIDESTRING Msg, - FPDF_WIDESTRING Title, - int Type, - int Icon) { - if (m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->app_alert) { - m_pInfo->m_pJsPlatform->app_alert(m_pInfo->m_pJsPlatform, Msg, Title, Type, - Icon); - } -} - -void CPDFSDK_Environment::EmailTo(FPDF_FILEHANDLER* fileHandler, - FPDF_WIDESTRING pTo, - FPDF_WIDESTRING pSubject, - FPDF_WIDESTRING pCC, - FPDF_WIDESTRING pBcc, - FPDF_WIDESTRING pMsg) { - if (m_pInfo && m_pInfo->FFI_EmailTo) - m_pInfo->FFI_EmailTo(m_pInfo, fileHandler, pTo, pSubject, pCC, pBcc, pMsg); -} - -void CPDFSDK_Environment::UploadTo(FPDF_FILEHANDLER* fileHandler, - int fileFlag, - FPDF_WIDESTRING uploadTo) { - if (m_pInfo && m_pInfo->FFI_UploadTo) - m_pInfo->FFI_UploadTo(m_pInfo, fileHandler, fileFlag, uploadTo); -} - -FPDF_FILEHANDLER* CPDFSDK_Environment::OpenFile(int fileType, - FPDF_WIDESTRING wsURL, - const char* mode) { - if (m_pInfo && m_pInfo->FFI_OpenFile) - return m_pInfo->FFI_OpenFile(m_pInfo, fileType, wsURL, mode); - return nullptr; -} - -IFX_FileRead* CPDFSDK_Environment::DownloadFromURL(const FX_WCHAR* url) { - if (!m_pInfo || !m_pInfo->FFI_DownloadFromURL) - return nullptr; - - CFX_ByteString bstrURL = CFX_WideString(url).UTF16LE_Encode(); - FPDF_WIDESTRING wsURL = - (FPDF_WIDESTRING)bstrURL.GetBuffer(bstrURL.GetLength()); - - FPDF_LPFILEHANDLER fileHandler = m_pInfo->FFI_DownloadFromURL(m_pInfo, wsURL); - - return new CFPDF_FileStream(fileHandler); -} - -CFX_WideString CPDFSDK_Environment::PostRequestURL( - const FX_WCHAR* wsURL, - const FX_WCHAR* wsData, - const FX_WCHAR* wsContentType, - const FX_WCHAR* wsEncode, - const FX_WCHAR* wsHeader) { - if (!m_pInfo || !m_pInfo->FFI_PostRequestURL) - return L""; - - CFX_ByteString bsURL = CFX_WideString(wsURL).UTF16LE_Encode(); - FPDF_WIDESTRING URL = (FPDF_WIDESTRING)bsURL.GetBuffer(bsURL.GetLength()); - - CFX_ByteString bsData = CFX_WideString(wsData).UTF16LE_Encode(); - FPDF_WIDESTRING data = (FPDF_WIDESTRING)bsData.GetBuffer(bsData.GetLength()); - - CFX_ByteString bsContentType = CFX_WideString(wsContentType).UTF16LE_Encode(); - FPDF_WIDESTRING contentType = - (FPDF_WIDESTRING)bsContentType.GetBuffer(bsContentType.GetLength()); - - CFX_ByteString bsEncode = CFX_WideString(wsEncode).UTF16LE_Encode(); - FPDF_WIDESTRING encode = - (FPDF_WIDESTRING)bsEncode.GetBuffer(bsEncode.GetLength()); - - CFX_ByteString bsHeader = CFX_WideString(wsHeader).UTF16LE_Encode(); - FPDF_WIDESTRING header = - (FPDF_WIDESTRING)bsHeader.GetBuffer(bsHeader.GetLength()); - - FPDF_BSTR response; - FPDF_BStr_Init(&response); - m_pInfo->FFI_PostRequestURL(m_pInfo, URL, data, contentType, encode, header, - &response); - - CFX_WideString wsRet = CFX_WideString::FromUTF16LE( - (FPDF_WIDESTRING)response.str, response.len / sizeof(FPDF_WIDESTRING)); - FPDF_BStr_Clear(&response); - - return wsRet; -} - -FPDF_BOOL CPDFSDK_Environment::PutRequestURL(const FX_WCHAR* wsURL, - const FX_WCHAR* wsData, - const FX_WCHAR* wsEncode) { - if (!m_pInfo || !m_pInfo->FFI_PutRequestURL) - return FALSE; - - CFX_ByteString bsURL = CFX_WideString(wsURL).UTF16LE_Encode(); - FPDF_WIDESTRING URL = (FPDF_WIDESTRING)bsURL.GetBuffer(bsURL.GetLength()); - - CFX_ByteString bsData = CFX_WideString(wsData).UTF16LE_Encode(); - FPDF_WIDESTRING data = (FPDF_WIDESTRING)bsData.GetBuffer(bsData.GetLength()); - - CFX_ByteString bsEncode = CFX_WideString(wsEncode).UTF16LE_Encode(); - FPDF_WIDESTRING encode = - (FPDF_WIDESTRING)bsEncode.GetBuffer(bsEncode.GetLength()); - - return m_pInfo->FFI_PutRequestURL(m_pInfo, URL, data, encode); -} - -CFX_WideString CPDFSDK_Environment::GetLanguage() { - if (!m_pInfo || !m_pInfo->FFI_GetLanguage) - return L""; - - int nRequiredLen = m_pInfo->FFI_GetLanguage(m_pInfo, nullptr, 0); - if (nRequiredLen <= 0) - return L""; - - char* pbuff = new char[nRequiredLen]; - memset(pbuff, 0, nRequiredLen); - int nActualLen = m_pInfo->FFI_GetLanguage(m_pInfo, pbuff, nRequiredLen); - if (nActualLen <= 0 || nActualLen > nRequiredLen) { - delete[] pbuff; - return L""; - } - CFX_ByteString bsRet = CFX_ByteString(pbuff, nActualLen); - CFX_WideString wsRet = CFX_WideString::FromUTF16LE( - (FPDF_WIDESTRING)bsRet.GetBuffer(bsRet.GetLength()), - bsRet.GetLength() / sizeof(FPDF_WIDESTRING)); - delete[] pbuff; - return wsRet; -} - -void CPDFSDK_Environment::PageEvent(int iPageCount, - uint32_t dwEventType) const { - if (m_pInfo && m_pInfo->FFI_PageEvent) - m_pInfo->FFI_PageEvent(m_pInfo, iPageCount, dwEventType); -} -#endif // PDF_ENABLE_XFA diff --git a/fpdfsdk/cpdfsdk_environment.h b/fpdfsdk/cpdfsdk_environment.h deleted file mode 100644 index bed757c2ba..0000000000 --- a/fpdfsdk/cpdfsdk_environment.h +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef FPDFSDK_CPDFSDK_ENVIRONMENT_H_ -#define FPDFSDK_CPDFSDK_ENVIRONMENT_H_ - -#include - -#include "core/fpdfapi/page/cpdf_page.h" -#include "core/fpdfapi/parser/cpdf_document.h" -#include "core/fpdfdoc/cpdf_occontext.h" -#include "core/fxcrt/cfx_observable.h" -#include "fpdfsdk/cfx_systemhandler.h" -#include "fpdfsdk/fsdk_define.h" -#include "public/fpdf_formfill.h" -#include "public/fpdf_fwlevent.h" - -class CFFL_InteractiveFormFiller; -class CFX_SystemHandler; -class CPDFSDK_ActionHandler; -class CPDFSDK_AnnotHandlerMgr; -class CPDFSDK_Document; -class IJS_Runtime; - -class CPDFSDK_Environment final { - public: - CPDFSDK_Environment(UnderlyingDocumentType* pDoc, FPDF_FORMFILLINFO* pFFinfo); - ~CPDFSDK_Environment(); - - void Invalidate(FPDF_PAGE page, - double left, - double top, - double right, - double bottom); - void OutputSelectedRect(FPDF_PAGE page, - double left, - double top, - double right, - double bottom); - - void SetCursor(int nCursorType); - int SetTimer(int uElapse, TimerCallback lpTimerFunc); - void KillTimer(int nTimerID); - FX_SYSTEMTIME GetLocalTime() const; - - void OnChange(); - FX_BOOL IsSHIFTKeyDown(uint32_t nFlag) const; - FX_BOOL IsCTRLKeyDown(uint32_t nFlag) const; - FX_BOOL IsALTKeyDown(uint32_t nFlag) const; - - FPDF_PAGE GetPage(FPDF_DOCUMENT document, int nPageIndex); - FPDF_PAGE GetCurrentPage(FPDF_DOCUMENT document); - - void ExecuteNamedAction(const FX_CHAR* namedAction); - void OnSetFieldInputFocus(FPDF_WIDESTRING focusText, - FPDF_DWORD nTextLen, - FX_BOOL bFocus); - void DoURIAction(const FX_CHAR* bsURI); - void DoGoToAction(int nPageIndex, - int zoomMode, - float* fPosArray, - int sizeOfArray); - -#ifdef PDF_ENABLE_XFA - void DisplayCaret(FPDF_PAGE page, - FPDF_BOOL bVisible, - double left, - double top, - double right, - double bottom); - int GetCurrentPageIndex(FPDF_DOCUMENT document); - void SetCurrentPage(FPDF_DOCUMENT document, int iCurPage); - - // TODO(dsinclair): This should probably change to PDFium? - CFX_WideString FFI_GetAppName() const { return CFX_WideString(L"Acrobat"); } - - CFX_WideString GetPlatform(); - void GotoURL(FPDF_DOCUMENT document, const CFX_WideStringC& wsURL); - void GetPageViewRect(FPDF_PAGE page, FS_RECTF& dstRect); - FX_BOOL PopupMenu(FPDF_PAGE page, - FPDF_WIDGET hWidget, - int menuFlag, - CFX_PointF pt); - - void Alert(FPDF_WIDESTRING Msg, FPDF_WIDESTRING Title, int Type, int Icon); - void EmailTo(FPDF_FILEHANDLER* fileHandler, - FPDF_WIDESTRING pTo, - FPDF_WIDESTRING pSubject, - FPDF_WIDESTRING pCC, - FPDF_WIDESTRING pBcc, - FPDF_WIDESTRING pMsg); - void UploadTo(FPDF_FILEHANDLER* fileHandler, - int fileFlag, - FPDF_WIDESTRING uploadTo); - FPDF_FILEHANDLER* OpenFile(int fileType, - FPDF_WIDESTRING wsURL, - const char* mode); - IFX_FileRead* DownloadFromURL(const FX_WCHAR* url); - CFX_WideString PostRequestURL(const FX_WCHAR* wsURL, - const FX_WCHAR* wsData, - const FX_WCHAR* wsContentType, - const FX_WCHAR* wsEncode, - const FX_WCHAR* wsHeader); - FPDF_BOOL PutRequestURL(const FX_WCHAR* wsURL, - const FX_WCHAR* wsData, - const FX_WCHAR* wsEncode); - CFX_WideString GetLanguage(); - - void PageEvent(int iPageCount, uint32_t dwEventType) const; -#endif // PDF_ENABLE_XFA - - int JS_appAlert(const FX_WCHAR* Msg, - const FX_WCHAR* Title, - uint32_t Type, - uint32_t Icon); - int JS_appResponse(const FX_WCHAR* Question, - const FX_WCHAR* Title, - const FX_WCHAR* Default, - const FX_WCHAR* cLabel, - FPDF_BOOL bPassword, - void* response, - int length); - void JS_appBeep(int nType); - CFX_WideString JS_fieldBrowse(); - CFX_WideString JS_docGetFilePath(); - void JS_docSubmitForm(void* formData, int length, const FX_WCHAR* URL); - void JS_docmailForm(void* mailData, - int length, - FPDF_BOOL bUI, - const FX_WCHAR* To, - const FX_WCHAR* Subject, - const FX_WCHAR* CC, - const FX_WCHAR* BCC, - const FX_WCHAR* Msg); - void JS_docprint(FPDF_BOOL bUI, - int nStart, - int nEnd, - FPDF_BOOL bSilent, - FPDF_BOOL bShrinkToFit, - FPDF_BOOL bPrintAsImage, - FPDF_BOOL bReverse, - FPDF_BOOL bAnnotations); - void JS_docgotoPage(int nPageNum); - - FX_BOOL IsJSInitiated() const { return m_pInfo && m_pInfo->m_pJsPlatform; } - CPDFSDK_Document* GetSDKDocument() const { return m_pSDKDoc.get(); } - UnderlyingDocumentType* GetUnderlyingDocument() const { - return m_pUnderlyingDoc; - } - CFX_ByteString GetAppName() const { return ""; } - CFX_SystemHandler* GetSysHandler() const { return m_pSysHandler.get(); } - FPDF_FORMFILLINFO* GetFormFillInfo() const { return m_pInfo; } - - // Creates if not present. - CFFL_InteractiveFormFiller* GetInteractiveFormFiller(); - CPDFSDK_AnnotHandlerMgr* GetAnnotHandlerMgr(); // Creates if not present. - IJS_Runtime* GetJSRuntime(); // Creates if not present. - CPDFSDK_ActionHandler* GetActionHander(); // Creates if not present. - - private: - std::unique_ptr m_pAnnotHandlerMgr; - std::unique_ptr m_pActionHandler; - std::unique_ptr m_pJSRuntime; - FPDF_FORMFILLINFO* const m_pInfo; - std::unique_ptr m_pSDKDoc; - UnderlyingDocumentType* const m_pUnderlyingDoc; - std::unique_ptr m_pFormFiller; - std::unique_ptr m_pSysHandler; -}; - -#endif // FPDFSDK_CPDFSDK_ENVIRONMENT_H_ diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp new file mode 100644 index 0000000000..5b05d08128 --- /dev/null +++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp @@ -0,0 +1,554 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" + +#include + +#include "fpdfsdk/cpdfsdk_annothandlermgr.h" +#include "fpdfsdk/cpdfsdk_document.h" +#include "fpdfsdk/formfiller/cffl_interactiveformfiller.h" +#include "fpdfsdk/fsdk_actionhandler.h" +#include "fpdfsdk/javascript/ijs_runtime.h" +#include "third_party/base/ptr_util.h" + +#ifdef PDF_ENABLE_XFA +#include "fpdfsdk/fpdfxfa/cpdfxfa_app.h" +#endif // PDF_ENABLE_XFA + +namespace { + +// NOTE: |bsUTF16LE| must outlive the use of the result. Care must be taken +// since modifying the result would impact |bsUTF16LE|. +FPDF_WIDESTRING AsFPDFWideString(CFX_ByteString* bsUTF16LE) { + return reinterpret_cast( + bsUTF16LE->GetBuffer(bsUTF16LE->GetLength())); +} + +} // namespace + +CPDFSDK_FormFillEnvironment::CPDFSDK_FormFillEnvironment( + UnderlyingDocumentType* pDoc, + FPDF_FORMFILLINFO* pFFinfo) + : m_pInfo(pFFinfo), + m_pSDKDoc(new CPDFSDK_Document(pDoc, this)), + m_pUnderlyingDoc(pDoc), + m_pSysHandler(new CFX_SystemHandler(this)) {} + +CPDFSDK_FormFillEnvironment::~CPDFSDK_FormFillEnvironment() { +#ifdef PDF_ENABLE_XFA + CPDFXFA_App* pProvider = CPDFXFA_App::GetInstance(); + if (pProvider->m_pEnvList.GetSize() == 0) + pProvider->SetJavaScriptInitialized(FALSE); +#endif // PDF_ENABLE_XFA + if (m_pInfo && m_pInfo->Release) + m_pInfo->Release(m_pInfo); +} + +int CPDFSDK_FormFillEnvironment::JS_appAlert(const FX_WCHAR* Msg, + const FX_WCHAR* Title, + uint32_t Type, + uint32_t Icon) { + if (!m_pInfo || !m_pInfo->m_pJsPlatform || + !m_pInfo->m_pJsPlatform->app_alert) { + return -1; + } + CFX_ByteString bsMsg = CFX_WideString(Msg).UTF16LE_Encode(); + CFX_ByteString bsTitle = CFX_WideString(Title).UTF16LE_Encode(); + return m_pInfo->m_pJsPlatform->app_alert( + m_pInfo->m_pJsPlatform, AsFPDFWideString(&bsMsg), + AsFPDFWideString(&bsTitle), Type, Icon); +} + +int CPDFSDK_FormFillEnvironment::JS_appResponse(const FX_WCHAR* Question, + const FX_WCHAR* Title, + const FX_WCHAR* Default, + const FX_WCHAR* cLabel, + FPDF_BOOL bPassword, + void* response, + int length) { + if (!m_pInfo || !m_pInfo->m_pJsPlatform || + !m_pInfo->m_pJsPlatform->app_response) { + return -1; + } + CFX_ByteString bsQuestion = CFX_WideString(Question).UTF16LE_Encode(); + CFX_ByteString bsTitle = CFX_WideString(Title).UTF16LE_Encode(); + CFX_ByteString bsDefault = CFX_WideString(Default).UTF16LE_Encode(); + CFX_ByteString bsLabel = CFX_WideString(cLabel).UTF16LE_Encode(); + return m_pInfo->m_pJsPlatform->app_response( + m_pInfo->m_pJsPlatform, AsFPDFWideString(&bsQuestion), + AsFPDFWideString(&bsTitle), AsFPDFWideString(&bsDefault), + AsFPDFWideString(&bsLabel), bPassword, response, length); +} + +void CPDFSDK_FormFillEnvironment::JS_appBeep(int nType) { + if (!m_pInfo || !m_pInfo->m_pJsPlatform || + !m_pInfo->m_pJsPlatform->app_beep) { + return; + } + m_pInfo->m_pJsPlatform->app_beep(m_pInfo->m_pJsPlatform, nType); +} + +CFX_WideString CPDFSDK_FormFillEnvironment::JS_fieldBrowse() { + if (!m_pInfo || !m_pInfo->m_pJsPlatform || + !m_pInfo->m_pJsPlatform->Field_browse) { + return CFX_WideString(); + } + const int nRequiredLen = + m_pInfo->m_pJsPlatform->Field_browse(m_pInfo->m_pJsPlatform, nullptr, 0); + if (nRequiredLen <= 0) + return CFX_WideString(); + + std::unique_ptr pBuff(new char[nRequiredLen]); + memset(pBuff.get(), 0, nRequiredLen); + const int nActualLen = m_pInfo->m_pJsPlatform->Field_browse( + m_pInfo->m_pJsPlatform, pBuff.get(), nRequiredLen); + if (nActualLen <= 0 || nActualLen > nRequiredLen) + return CFX_WideString(); + + return CFX_WideString::FromLocal(CFX_ByteStringC(pBuff.get(), nActualLen)); +} + +CFX_WideString CPDFSDK_FormFillEnvironment::JS_docGetFilePath() { + if (!m_pInfo || !m_pInfo->m_pJsPlatform || + !m_pInfo->m_pJsPlatform->Doc_getFilePath) { + return CFX_WideString(); + } + const int nRequiredLen = m_pInfo->m_pJsPlatform->Doc_getFilePath( + m_pInfo->m_pJsPlatform, nullptr, 0); + if (nRequiredLen <= 0) + return CFX_WideString(); + + std::unique_ptr pBuff(new char[nRequiredLen]); + memset(pBuff.get(), 0, nRequiredLen); + const int nActualLen = m_pInfo->m_pJsPlatform->Doc_getFilePath( + m_pInfo->m_pJsPlatform, pBuff.get(), nRequiredLen); + if (nActualLen <= 0 || nActualLen > nRequiredLen) + return CFX_WideString(); + + return CFX_WideString::FromLocal(CFX_ByteStringC(pBuff.get(), nActualLen)); +} + +void CPDFSDK_FormFillEnvironment::JS_docSubmitForm(void* formData, + int length, + const FX_WCHAR* URL) { + if (!m_pInfo || !m_pInfo->m_pJsPlatform || + !m_pInfo->m_pJsPlatform->Doc_submitForm) { + return; + } + CFX_ByteString bsDestination = CFX_WideString(URL).UTF16LE_Encode(); + m_pInfo->m_pJsPlatform->Doc_submitForm(m_pInfo->m_pJsPlatform, formData, + length, + AsFPDFWideString(&bsDestination)); +} + +void CPDFSDK_FormFillEnvironment::JS_docmailForm(void* mailData, + int length, + FPDF_BOOL bUI, + const FX_WCHAR* To, + const FX_WCHAR* Subject, + const FX_WCHAR* CC, + const FX_WCHAR* BCC, + const FX_WCHAR* Msg) { + if (!m_pInfo || !m_pInfo->m_pJsPlatform || + !m_pInfo->m_pJsPlatform->Doc_mail) { + return; + } + CFX_ByteString bsTo = CFX_WideString(To).UTF16LE_Encode(); + CFX_ByteString bsSubject = CFX_WideString(Subject).UTF16LE_Encode(); + CFX_ByteString bsCC = CFX_WideString(CC).UTF16LE_Encode(); + CFX_ByteString bsBcc = CFX_WideString(BCC).UTF16LE_Encode(); + CFX_ByteString bsMsg = CFX_WideString(Msg).UTF16LE_Encode(); + m_pInfo->m_pJsPlatform->Doc_mail( + m_pInfo->m_pJsPlatform, mailData, length, bUI, AsFPDFWideString(&bsTo), + AsFPDFWideString(&bsSubject), AsFPDFWideString(&bsCC), + AsFPDFWideString(&bsBcc), AsFPDFWideString(&bsMsg)); +} + +void CPDFSDK_FormFillEnvironment::JS_docprint(FPDF_BOOL bUI, + int nStart, + int nEnd, + FPDF_BOOL bSilent, + FPDF_BOOL bShrinkToFit, + FPDF_BOOL bPrintAsImage, + FPDF_BOOL bReverse, + FPDF_BOOL bAnnotations) { + if (!m_pInfo || !m_pInfo->m_pJsPlatform || + !m_pInfo->m_pJsPlatform->Doc_print) { + return; + } + m_pInfo->m_pJsPlatform->Doc_print(m_pInfo->m_pJsPlatform, bUI, nStart, nEnd, + bSilent, bShrinkToFit, bPrintAsImage, + bReverse, bAnnotations); +} + +void CPDFSDK_FormFillEnvironment::JS_docgotoPage(int nPageNum) { + if (!m_pInfo || !m_pInfo->m_pJsPlatform || + !m_pInfo->m_pJsPlatform->Doc_gotoPage) { + return; + } + m_pInfo->m_pJsPlatform->Doc_gotoPage(m_pInfo->m_pJsPlatform, nPageNum); +} + +IJS_Runtime* CPDFSDK_FormFillEnvironment::GetJSRuntime() { + if (!IsJSInitiated()) + return nullptr; + if (!m_pJSRuntime) + m_pJSRuntime.reset(IJS_Runtime::Create(this)); + return m_pJSRuntime.get(); +} + +CPDFSDK_AnnotHandlerMgr* CPDFSDK_FormFillEnvironment::GetAnnotHandlerMgr() { + if (!m_pAnnotHandlerMgr) + m_pAnnotHandlerMgr = pdfium::MakeUnique(this); + return m_pAnnotHandlerMgr.get(); +} + +CPDFSDK_ActionHandler* CPDFSDK_FormFillEnvironment::GetActionHander() { + if (!m_pActionHandler) + m_pActionHandler = pdfium::MakeUnique(); + return m_pActionHandler.get(); +} + +CFFL_InteractiveFormFiller* +CPDFSDK_FormFillEnvironment::GetInteractiveFormFiller() { + if (!m_pFormFiller) + m_pFormFiller = pdfium::MakeUnique(this); + return m_pFormFiller.get(); +} + +void CPDFSDK_FormFillEnvironment::Invalidate(FPDF_PAGE page, + double left, + double top, + double right, + double bottom) { + if (m_pInfo && m_pInfo->FFI_Invalidate) + m_pInfo->FFI_Invalidate(m_pInfo, page, left, top, right, bottom); +} + +void CPDFSDK_FormFillEnvironment::OutputSelectedRect(FPDF_PAGE page, + double left, + double top, + double right, + double bottom) { + if (m_pInfo && m_pInfo->FFI_OutputSelectedRect) + m_pInfo->FFI_OutputSelectedRect(m_pInfo, page, left, top, right, bottom); +} + +void CPDFSDK_FormFillEnvironment::SetCursor(int nCursorType) { + if (m_pInfo && m_pInfo->FFI_SetCursor) + m_pInfo->FFI_SetCursor(m_pInfo, nCursorType); +} + +int CPDFSDK_FormFillEnvironment::SetTimer(int uElapse, + TimerCallback lpTimerFunc) { + if (m_pInfo && m_pInfo->FFI_SetTimer) + return m_pInfo->FFI_SetTimer(m_pInfo, uElapse, lpTimerFunc); + return -1; +} + +void CPDFSDK_FormFillEnvironment::KillTimer(int nTimerID) { + if (m_pInfo && m_pInfo->FFI_KillTimer) + m_pInfo->FFI_KillTimer(m_pInfo, nTimerID); +} + +FX_SYSTEMTIME CPDFSDK_FormFillEnvironment::GetLocalTime() const { + FX_SYSTEMTIME fxtime; + if (!m_pInfo || !m_pInfo->FFI_GetLocalTime) + return fxtime; + + FPDF_SYSTEMTIME systime = m_pInfo->FFI_GetLocalTime(m_pInfo); + fxtime.wDay = systime.wDay; + fxtime.wDayOfWeek = systime.wDayOfWeek; + fxtime.wHour = systime.wHour; + fxtime.wMilliseconds = systime.wMilliseconds; + fxtime.wMinute = systime.wMinute; + fxtime.wMonth = systime.wMonth; + fxtime.wSecond = systime.wSecond; + fxtime.wYear = systime.wYear; + return fxtime; +} + +void CPDFSDK_FormFillEnvironment::OnChange() { + if (m_pInfo && m_pInfo->FFI_OnChange) + m_pInfo->FFI_OnChange(m_pInfo); +} + +FX_BOOL CPDFSDK_FormFillEnvironment::IsSHIFTKeyDown(uint32_t nFlag) const { + return (nFlag & FWL_EVENTFLAG_ShiftKey) != 0; +} + +FX_BOOL CPDFSDK_FormFillEnvironment::IsCTRLKeyDown(uint32_t nFlag) const { + return (nFlag & FWL_EVENTFLAG_ControlKey) != 0; +} + +FX_BOOL CPDFSDK_FormFillEnvironment::IsALTKeyDown(uint32_t nFlag) const { + return (nFlag & FWL_EVENTFLAG_AltKey) != 0; +} + +FPDF_PAGE CPDFSDK_FormFillEnvironment::GetPage(FPDF_DOCUMENT document, + int nPageIndex) { + if (m_pInfo && m_pInfo->FFI_GetPage) + return m_pInfo->FFI_GetPage(m_pInfo, document, nPageIndex); + return nullptr; +} + +FPDF_PAGE CPDFSDK_FormFillEnvironment::GetCurrentPage(FPDF_DOCUMENT document) { + if (m_pInfo && m_pInfo->FFI_GetCurrentPage) + return m_pInfo->FFI_GetCurrentPage(m_pInfo, document); + return nullptr; +} + +void CPDFSDK_FormFillEnvironment::ExecuteNamedAction( + const FX_CHAR* namedAction) { + if (m_pInfo && m_pInfo->FFI_ExecuteNamedAction) + m_pInfo->FFI_ExecuteNamedAction(m_pInfo, namedAction); +} + +void CPDFSDK_FormFillEnvironment::OnSetFieldInputFocus( + FPDF_WIDESTRING focusText, + FPDF_DWORD nTextLen, + FX_BOOL bFocus) { + if (m_pInfo && m_pInfo->FFI_SetTextFieldFocus) + m_pInfo->FFI_SetTextFieldFocus(m_pInfo, focusText, nTextLen, bFocus); +} + +void CPDFSDK_FormFillEnvironment::DoURIAction(const FX_CHAR* bsURI) { + if (m_pInfo && m_pInfo->FFI_DoURIAction) + m_pInfo->FFI_DoURIAction(m_pInfo, bsURI); +} + +void CPDFSDK_FormFillEnvironment::DoGoToAction(int nPageIndex, + int zoomMode, + float* fPosArray, + int sizeOfArray) { + if (m_pInfo && m_pInfo->FFI_DoGoToAction) { + m_pInfo->FFI_DoGoToAction(m_pInfo, nPageIndex, zoomMode, fPosArray, + sizeOfArray); + } +} + +#ifdef PDF_ENABLE_XFA +void CPDFSDK_FormFillEnvironment::DisplayCaret(FPDF_PAGE page, + FPDF_BOOL bVisible, + double left, + double top, + double right, + double bottom) { + if (m_pInfo && m_pInfo->FFI_DisplayCaret) { + m_pInfo->FFI_DisplayCaret(m_pInfo, page, bVisible, left, top, right, + bottom); + } +} + +int CPDFSDK_FormFillEnvironment::GetCurrentPageIndex(FPDF_DOCUMENT document) { + if (!m_pInfo || !m_pInfo->FFI_GetCurrentPageIndex) + return -1; + return m_pInfo->FFI_GetCurrentPageIndex(m_pInfo, document); +} + +void CPDFSDK_FormFillEnvironment::SetCurrentPage(FPDF_DOCUMENT document, + int iCurPage) { + if (m_pInfo && m_pInfo->FFI_SetCurrentPage) + m_pInfo->FFI_SetCurrentPage(m_pInfo, document, iCurPage); +} + +CFX_WideString CPDFSDK_FormFillEnvironment::GetPlatform() { + if (!m_pInfo || !m_pInfo->FFI_GetPlatform) + return L""; + + int nRequiredLen = m_pInfo->FFI_GetPlatform(m_pInfo, nullptr, 0); + if (nRequiredLen <= 0) + return L""; + + char* pbuff = new char[nRequiredLen]; + memset(pbuff, 0, nRequiredLen); + int nActualLen = m_pInfo->FFI_GetPlatform(m_pInfo, pbuff, nRequiredLen); + if (nActualLen <= 0 || nActualLen > nRequiredLen) { + delete[] pbuff; + return L""; + } + CFX_ByteString bsRet = CFX_ByteString(pbuff, nActualLen); + CFX_WideString wsRet = CFX_WideString::FromUTF16LE( + (unsigned short*)bsRet.GetBuffer(bsRet.GetLength()), + bsRet.GetLength() / sizeof(unsigned short)); + delete[] pbuff; + return wsRet; +} + +void CPDFSDK_FormFillEnvironment::GotoURL(FPDF_DOCUMENT document, + const CFX_WideStringC& wsURL) { + if (!m_pInfo || !m_pInfo->FFI_GotoURL) + return; + + CFX_ByteString bsTo = CFX_WideString(wsURL).UTF16LE_Encode(); + FPDF_WIDESTRING pTo = (FPDF_WIDESTRING)bsTo.GetBuffer(wsURL.GetLength()); + m_pInfo->FFI_GotoURL(m_pInfo, document, pTo); + bsTo.ReleaseBuffer(); +} + +void CPDFSDK_FormFillEnvironment::GetPageViewRect(FPDF_PAGE page, + FS_RECTF& dstRect) { + if (!m_pInfo || !m_pInfo->FFI_GetPageViewRect) + return; + + double left; + double top; + double right; + double bottom; + m_pInfo->FFI_GetPageViewRect(m_pInfo, page, &left, &top, &right, &bottom); + + dstRect.left = static_cast(left); + dstRect.top = static_cast(top < bottom ? bottom : top); + dstRect.bottom = static_cast(top < bottom ? top : bottom); + dstRect.right = static_cast(right); +} + +FX_BOOL CPDFSDK_FormFillEnvironment::PopupMenu(FPDF_PAGE page, + FPDF_WIDGET hWidget, + int menuFlag, + CFX_PointF pt) { + if (!m_pInfo || !m_pInfo->FFI_PopupMenu) + return FALSE; + return m_pInfo->FFI_PopupMenu(m_pInfo, page, hWidget, menuFlag, pt.x, pt.y); +} + +void CPDFSDK_FormFillEnvironment::Alert(FPDF_WIDESTRING Msg, + FPDF_WIDESTRING Title, + int Type, + int Icon) { + if (m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->app_alert) { + m_pInfo->m_pJsPlatform->app_alert(m_pInfo->m_pJsPlatform, Msg, Title, Type, + Icon); + } +} + +void CPDFSDK_FormFillEnvironment::EmailTo(FPDF_FILEHANDLER* fileHandler, + FPDF_WIDESTRING pTo, + FPDF_WIDESTRING pSubject, + FPDF_WIDESTRING pCC, + FPDF_WIDESTRING pBcc, + FPDF_WIDESTRING pMsg) { + if (m_pInfo && m_pInfo->FFI_EmailTo) + m_pInfo->FFI_EmailTo(m_pInfo, fileHandler, pTo, pSubject, pCC, pBcc, pMsg); +} + +void CPDFSDK_FormFillEnvironment::UploadTo(FPDF_FILEHANDLER* fileHandler, + int fileFlag, + FPDF_WIDESTRING uploadTo) { + if (m_pInfo && m_pInfo->FFI_UploadTo) + m_pInfo->FFI_UploadTo(m_pInfo, fileHandler, fileFlag, uploadTo); +} + +FPDF_FILEHANDLER* CPDFSDK_FormFillEnvironment::OpenFile(int fileType, + FPDF_WIDESTRING wsURL, + const char* mode) { + if (m_pInfo && m_pInfo->FFI_OpenFile) + return m_pInfo->FFI_OpenFile(m_pInfo, fileType, wsURL, mode); + return nullptr; +} + +IFX_FileRead* CPDFSDK_FormFillEnvironment::DownloadFromURL( + const FX_WCHAR* url) { + if (!m_pInfo || !m_pInfo->FFI_DownloadFromURL) + return nullptr; + + CFX_ByteString bstrURL = CFX_WideString(url).UTF16LE_Encode(); + FPDF_WIDESTRING wsURL = + (FPDF_WIDESTRING)bstrURL.GetBuffer(bstrURL.GetLength()); + + FPDF_LPFILEHANDLER fileHandler = m_pInfo->FFI_DownloadFromURL(m_pInfo, wsURL); + + return new CFPDF_FileStream(fileHandler); +} + +CFX_WideString CPDFSDK_FormFillEnvironment::PostRequestURL( + const FX_WCHAR* wsURL, + const FX_WCHAR* wsData, + const FX_WCHAR* wsContentType, + const FX_WCHAR* wsEncode, + const FX_WCHAR* wsHeader) { + if (!m_pInfo || !m_pInfo->FFI_PostRequestURL) + return L""; + + CFX_ByteString bsURL = CFX_WideString(wsURL).UTF16LE_Encode(); + FPDF_WIDESTRING URL = (FPDF_WIDESTRING)bsURL.GetBuffer(bsURL.GetLength()); + + CFX_ByteString bsData = CFX_WideString(wsData).UTF16LE_Encode(); + FPDF_WIDESTRING data = (FPDF_WIDESTRING)bsData.GetBuffer(bsData.GetLength()); + + CFX_ByteString bsContentType = CFX_WideString(wsContentType).UTF16LE_Encode(); + FPDF_WIDESTRING contentType = + (FPDF_WIDESTRING)bsContentType.GetBuffer(bsContentType.GetLength()); + + CFX_ByteString bsEncode = CFX_WideString(wsEncode).UTF16LE_Encode(); + FPDF_WIDESTRING encode = + (FPDF_WIDESTRING)bsEncode.GetBuffer(bsEncode.GetLength()); + + CFX_ByteString bsHeader = CFX_WideString(wsHeader).UTF16LE_Encode(); + FPDF_WIDESTRING header = + (FPDF_WIDESTRING)bsHeader.GetBuffer(bsHeader.GetLength()); + + FPDF_BSTR response; + FPDF_BStr_Init(&response); + m_pInfo->FFI_PostRequestURL(m_pInfo, URL, data, contentType, encode, header, + &response); + + CFX_WideString wsRet = CFX_WideString::FromUTF16LE( + (FPDF_WIDESTRING)response.str, response.len / sizeof(FPDF_WIDESTRING)); + FPDF_BStr_Clear(&response); + + return wsRet; +} + +FPDF_BOOL CPDFSDK_FormFillEnvironment::PutRequestURL(const FX_WCHAR* wsURL, + const FX_WCHAR* wsData, + const FX_WCHAR* wsEncode) { + if (!m_pInfo || !m_pInfo->FFI_PutRequestURL) + return FALSE; + + CFX_ByteString bsURL = CFX_WideString(wsURL).UTF16LE_Encode(); + FPDF_WIDESTRING URL = (FPDF_WIDESTRING)bsURL.GetBuffer(bsURL.GetLength()); + + CFX_ByteString bsData = CFX_WideString(wsData).UTF16LE_Encode(); + FPDF_WIDESTRING data = (FPDF_WIDESTRING)bsData.GetBuffer(bsData.GetLength()); + + CFX_ByteString bsEncode = CFX_WideString(wsEncode).UTF16LE_Encode(); + FPDF_WIDESTRING encode = + (FPDF_WIDESTRING)bsEncode.GetBuffer(bsEncode.GetLength()); + + return m_pInfo->FFI_PutRequestURL(m_pInfo, URL, data, encode); +} + +CFX_WideString CPDFSDK_FormFillEnvironment::GetLanguage() { + if (!m_pInfo || !m_pInfo->FFI_GetLanguage) + return L""; + + int nRequiredLen = m_pInfo->FFI_GetLanguage(m_pInfo, nullptr, 0); + if (nRequiredLen <= 0) + return L""; + + char* pbuff = new char[nRequiredLen]; + memset(pbuff, 0, nRequiredLen); + int nActualLen = m_pInfo->FFI_GetLanguage(m_pInfo, pbuff, nRequiredLen); + if (nActualLen <= 0 || nActualLen > nRequiredLen) { + delete[] pbuff; + return L""; + } + CFX_ByteString bsRet = CFX_ByteString(pbuff, nActualLen); + CFX_WideString wsRet = CFX_WideString::FromUTF16LE( + (FPDF_WIDESTRING)bsRet.GetBuffer(bsRet.GetLength()), + bsRet.GetLength() / sizeof(FPDF_WIDESTRING)); + delete[] pbuff; + return wsRet; +} + +void CPDFSDK_FormFillEnvironment::PageEvent(int iPageCount, + uint32_t dwEventType) const { + if (m_pInfo && m_pInfo->FFI_PageEvent) + m_pInfo->FFI_PageEvent(m_pInfo, iPageCount, dwEventType); +} +#endif // PDF_ENABLE_XFA diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.h b/fpdfsdk/cpdfsdk_formfillenvironment.h new file mode 100644 index 0000000000..e92537eee1 --- /dev/null +++ b/fpdfsdk/cpdfsdk_formfillenvironment.h @@ -0,0 +1,175 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef FPDFSDK_CPDFSDK_FORMFILLENVIRONMENT_H_ +#define FPDFSDK_CPDFSDK_FORMFILLENVIRONMENT_H_ + +#include + +#include "core/fpdfapi/page/cpdf_page.h" +#include "core/fpdfapi/parser/cpdf_document.h" +#include "core/fpdfdoc/cpdf_occontext.h" +#include "core/fxcrt/cfx_observable.h" +#include "fpdfsdk/cfx_systemhandler.h" +#include "fpdfsdk/fsdk_define.h" +#include "public/fpdf_formfill.h" +#include "public/fpdf_fwlevent.h" + +class CFFL_InteractiveFormFiller; +class CFX_SystemHandler; +class CPDFSDK_ActionHandler; +class CPDFSDK_AnnotHandlerMgr; +class CPDFSDK_Document; +class IJS_Runtime; + +class CPDFSDK_FormFillEnvironment final { + public: + CPDFSDK_FormFillEnvironment(UnderlyingDocumentType* pDoc, + FPDF_FORMFILLINFO* pFFinfo); + ~CPDFSDK_FormFillEnvironment(); + + void Invalidate(FPDF_PAGE page, + double left, + double top, + double right, + double bottom); + void OutputSelectedRect(FPDF_PAGE page, + double left, + double top, + double right, + double bottom); + + void SetCursor(int nCursorType); + int SetTimer(int uElapse, TimerCallback lpTimerFunc); + void KillTimer(int nTimerID); + FX_SYSTEMTIME GetLocalTime() const; + + void OnChange(); + FX_BOOL IsSHIFTKeyDown(uint32_t nFlag) const; + FX_BOOL IsCTRLKeyDown(uint32_t nFlag) const; + FX_BOOL IsALTKeyDown(uint32_t nFlag) const; + + FPDF_PAGE GetPage(FPDF_DOCUMENT document, int nPageIndex); + FPDF_PAGE GetCurrentPage(FPDF_DOCUMENT document); + + void ExecuteNamedAction(const FX_CHAR* namedAction); + void OnSetFieldInputFocus(FPDF_WIDESTRING focusText, + FPDF_DWORD nTextLen, + FX_BOOL bFocus); + void DoURIAction(const FX_CHAR* bsURI); + void DoGoToAction(int nPageIndex, + int zoomMode, + float* fPosArray, + int sizeOfArray); + +#ifdef PDF_ENABLE_XFA + void DisplayCaret(FPDF_PAGE page, + FPDF_BOOL bVisible, + double left, + double top, + double right, + double bottom); + int GetCurrentPageIndex(FPDF_DOCUMENT document); + void SetCurrentPage(FPDF_DOCUMENT document, int iCurPage); + + // TODO(dsinclair): This should probably change to PDFium? + CFX_WideString FFI_GetAppName() const { return CFX_WideString(L"Acrobat"); } + + CFX_WideString GetPlatform(); + void GotoURL(FPDF_DOCUMENT document, const CFX_WideStringC& wsURL); + void GetPageViewRect(FPDF_PAGE page, FS_RECTF& dstRect); + FX_BOOL PopupMenu(FPDF_PAGE page, + FPDF_WIDGET hWidget, + int menuFlag, + CFX_PointF pt); + + void Alert(FPDF_WIDESTRING Msg, FPDF_WIDESTRING Title, int Type, int Icon); + void EmailTo(FPDF_FILEHANDLER* fileHandler, + FPDF_WIDESTRING pTo, + FPDF_WIDESTRING pSubject, + FPDF_WIDESTRING pCC, + FPDF_WIDESTRING pBcc, + FPDF_WIDESTRING pMsg); + void UploadTo(FPDF_FILEHANDLER* fileHandler, + int fileFlag, + FPDF_WIDESTRING uploadTo); + FPDF_FILEHANDLER* OpenFile(int fileType, + FPDF_WIDESTRING wsURL, + const char* mode); + IFX_FileRead* DownloadFromURL(const FX_WCHAR* url); + CFX_WideString PostRequestURL(const FX_WCHAR* wsURL, + const FX_WCHAR* wsData, + const FX_WCHAR* wsContentType, + const FX_WCHAR* wsEncode, + const FX_WCHAR* wsHeader); + FPDF_BOOL PutRequestURL(const FX_WCHAR* wsURL, + const FX_WCHAR* wsData, + const FX_WCHAR* wsEncode); + CFX_WideString GetLanguage(); + + void PageEvent(int iPageCount, uint32_t dwEventType) const; +#endif // PDF_ENABLE_XFA + + int JS_appAlert(const FX_WCHAR* Msg, + const FX_WCHAR* Title, + uint32_t Type, + uint32_t Icon); + int JS_appResponse(const FX_WCHAR* Question, + const FX_WCHAR* Title, + const FX_WCHAR* Default, + const FX_WCHAR* cLabel, + FPDF_BOOL bPassword, + void* response, + int length); + void JS_appBeep(int nType); + CFX_WideString JS_fieldBrowse(); + CFX_WideString JS_docGetFilePath(); + void JS_docSubmitForm(void* formData, int length, const FX_WCHAR* URL); + void JS_docmailForm(void* mailData, + int length, + FPDF_BOOL bUI, + const FX_WCHAR* To, + const FX_WCHAR* Subject, + const FX_WCHAR* CC, + const FX_WCHAR* BCC, + const FX_WCHAR* Msg); + void JS_docprint(FPDF_BOOL bUI, + int nStart, + int nEnd, + FPDF_BOOL bSilent, + FPDF_BOOL bShrinkToFit, + FPDF_BOOL bPrintAsImage, + FPDF_BOOL bReverse, + FPDF_BOOL bAnnotations); + void JS_docgotoPage(int nPageNum); + + FX_BOOL IsJSInitiated() const { return m_pInfo && m_pInfo->m_pJsPlatform; } + CPDFSDK_Document* GetSDKDocument() const { return m_pSDKDoc.get(); } + UnderlyingDocumentType* GetUnderlyingDocument() const { + return m_pUnderlyingDoc; + } + CFX_ByteString GetAppName() const { return ""; } + CFX_SystemHandler* GetSysHandler() const { return m_pSysHandler.get(); } + FPDF_FORMFILLINFO* GetFormFillInfo() const { return m_pInfo; } + + // Creates if not present. + CFFL_InteractiveFormFiller* GetInteractiveFormFiller(); + CPDFSDK_AnnotHandlerMgr* GetAnnotHandlerMgr(); // Creates if not present. + IJS_Runtime* GetJSRuntime(); // Creates if not present. + CPDFSDK_ActionHandler* GetActionHander(); // Creates if not present. + + private: + std::unique_ptr m_pAnnotHandlerMgr; + std::unique_ptr m_pActionHandler; + std::unique_ptr m_pJSRuntime; + FPDF_FORMFILLINFO* const m_pInfo; + std::unique_ptr m_pSDKDoc; + UnderlyingDocumentType* const m_pUnderlyingDoc; + std::unique_ptr m_pFormFiller; + std::unique_ptr m_pSysHandler; +}; + +#endif // FPDFSDK_CPDFSDK_FORMFILLENVIRONMENT_H_ diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp index a312ce944f..1ed2a6cee5 100644 --- a/fpdfsdk/cpdfsdk_interform.cpp +++ b/fpdfsdk/cpdfsdk_interform.cpp @@ -23,7 +23,7 @@ #include "fpdfsdk/cba_annotiterator.h" #include "fpdfsdk/cpdfsdk_annot.h" #include "fpdfsdk/cpdfsdk_document.h" -#include "fpdfsdk/cpdfsdk_environment.h" +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_pageview.h" #include "fpdfsdk/cpdfsdk_widget.h" #include "fpdfsdk/formfiller/cffl_formfiller.h" @@ -221,7 +221,7 @@ void CPDFSDK_InterForm::SynchronizeField(CPDF_FormField* pFormField, #endif // PDF_ENABLE_XFA void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) { - CPDFSDK_Environment* pEnv = m_pDocument->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetEnv(); ASSERT(pEnv); if (!pEnv->IsJSInitiated()) return; @@ -281,7 +281,7 @@ void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) { CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, FX_BOOL& bFormatted) { CFX_WideString sValue = pFormField->GetValue(); - CPDFSDK_Environment* pEnv = m_pDocument->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetEnv(); ASSERT(pEnv); if (!pEnv->IsJSInitiated()) { bFormatted = FALSE; @@ -342,7 +342,7 @@ void CPDFSDK_InterForm::UpdateField(CPDF_FormField* pFormField) { ASSERT(pFormCtrl); if (CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl, false)) { - CPDFSDK_Environment* pEnv = m_pDocument->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetEnv(); UnderlyingPageType* pPage = pWidget->GetUnderlyingPage(); CPDFSDK_PageView* pPageView = m_pDocument->GetPageView(pPage, false); FX_RECT rcBBox = @@ -364,7 +364,7 @@ FX_BOOL CPDFSDK_InterForm::OnKeyStrokeCommit(CPDF_FormField* pFormField, if (!action.GetDict()) return TRUE; - CPDFSDK_Environment* pEnv = m_pDocument->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetEnv(); CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); PDFSDK_FieldAction fa; fa.bModifier = pEnv->IsCTRLKeyDown(0); @@ -385,7 +385,7 @@ FX_BOOL CPDFSDK_InterForm::OnValidate(CPDF_FormField* pFormField, if (!action.GetDict()) return TRUE; - CPDFSDK_Environment* pEnv = m_pDocument->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetEnv(); CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); PDFSDK_FieldAction fa; fa.bModifier = pEnv->IsCTRLKeyDown(0); @@ -459,7 +459,7 @@ FX_BOOL CPDFSDK_InterForm::SubmitFields( const std::vector& fields, bool bIncludeOrExclude, bool bUrlEncoded) { - CPDFSDK_Environment* pEnv = m_pDocument->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetEnv(); CFX_ByteTextBuf textBuf; ExportFieldsToFDFTextBuf(fields, bIncludeOrExclude, textBuf); @@ -542,7 +542,7 @@ FX_BOOL CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, if (!m_pDocument || !m_pInterForm) return FALSE; - CPDFSDK_Environment* pEnv = m_pDocument->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetEnv(); CFX_WideString wsPDFFilePath = m_pDocument->GetPath(); CFDF_Document* pFDFDoc = m_pInterForm->ExportToFDF(wsPDFFilePath.AsStringC(), false); diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp index 7825701f15..c1424ece98 100644 --- a/fpdfsdk/cpdfsdk_pageview.cpp +++ b/fpdfsdk/cpdfsdk_pageview.cpp @@ -16,7 +16,7 @@ #include "fpdfsdk/cpdfsdk_annot.h" #include "fpdfsdk/cpdfsdk_annothandlermgr.h" #include "fpdfsdk/cpdfsdk_annotiterator.h" -#include "fpdfsdk/cpdfsdk_environment.h" +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_interform.h" #include "third_party/base/ptr_util.h" @@ -65,7 +65,7 @@ CPDFSDK_PageView::~CPDFSDK_PageView() { m_page->SetView(nullptr); #endif // PDF_ENABLE_XFA - CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); for (CPDFSDK_Annot* pAnnot : m_SDKAnnotArray) pAnnotHandlerMgr->ReleaseAnnot(pAnnot); @@ -88,7 +88,7 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice, CPDF_RenderOptions* pOptions) { #endif // PDF_ENABLE_XFA m_curMatrix = *pUser2Device; - CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); #ifdef PDF_ENABLE_XFA CPDFXFA_Page* pPage = GetPDFXFAPage(); @@ -135,7 +135,7 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice, CPDFSDK_Annot* CPDFSDK_PageView::GetFXAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY) { - CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); CPDFSDK_AnnotHandlerMgr* pAnnotMgr = pEnv->GetAnnotHandlerMgr(); CPDFSDK_AnnotIterator annotIterator(this, false); while (CPDFSDK_Annot* pSDKAnnot = annotIterator.Next()) { @@ -151,7 +151,7 @@ CPDFSDK_Annot* CPDFSDK_PageView::GetFXAnnotAtPoint(FX_FLOAT pageX, CPDFSDK_Annot* CPDFSDK_PageView::GetFXWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY) { - CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); CPDFSDK_AnnotHandlerMgr* pAnnotMgr = pEnv->GetAnnotHandlerMgr(); CPDFSDK_AnnotIterator annotIterator(this, false); while (CPDFSDK_Annot* pSDKAnnot = annotIterator.Next()) { @@ -180,7 +180,7 @@ CPDFSDK_Annot* CPDFSDK_PageView::AddAnnot(CXFA_FFWidget* pPDFAnnot) { if (pSDKAnnot) return pSDKAnnot; - CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); CPDFSDK_AnnotHandlerMgr* pAnnotHandler = pEnv->GetAnnotHandlerMgr(); pSDKAnnot = pAnnotHandler->NewAnnot(pPDFAnnot, this); if (!pSDKAnnot) @@ -200,7 +200,7 @@ FX_BOOL CPDFSDK_PageView::DeleteAnnot(CPDFSDK_Annot* pAnnot) { if (GetFocusAnnot() == pAnnot) m_pSDKDoc->KillFocusAnnot(0); - CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); CPDFSDK_AnnotHandlerMgr* pAnnotHandler = pEnv->GetAnnotHandlerMgr(); if (pAnnotHandler) pAnnotHandler->ReleaseAnnot(pAnnot); @@ -263,7 +263,7 @@ FX_BOOL CPDFSDK_PageView::OnLButtonDown(const CFX_FloatPoint& point, return FALSE; } - CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); if (!pAnnotHandlerMgr->Annot_OnLButtonDown(this, &pAnnot, nFlag, point)) return FALSE; @@ -282,7 +282,7 @@ FX_BOOL CPDFSDK_PageView::OnRButtonDown(const CFX_FloatPoint& point, if (!pAnnot) return FALSE; - CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); FX_BOOL ok = pAnnotHandlerMgr->Annot_OnRButtonDown(this, &pAnnot, nFlag, point); @@ -297,7 +297,7 @@ FX_BOOL CPDFSDK_PageView::OnRButtonDown(const CFX_FloatPoint& point, FX_BOOL CPDFSDK_PageView::OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { - CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); CPDFSDK_Annot::ObservedPtr pFXAnnot(GetFXWidgetAtPoint(point.x, point.y)); if (!pFXAnnot) @@ -312,7 +312,7 @@ FX_BOOL CPDFSDK_PageView::OnRButtonUp(const CFX_FloatPoint& point, FX_BOOL CPDFSDK_PageView::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { - CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); CPDFSDK_Annot::ObservedPtr pFXAnnot(GetFXWidgetAtPoint(point.x, point.y)); CPDFSDK_Annot::ObservedPtr pFocusAnnot(GetFocusAnnot()); @@ -326,7 +326,7 @@ FX_BOOL CPDFSDK_PageView::OnLButtonUp(const CFX_FloatPoint& point, } FX_BOOL CPDFSDK_PageView::OnMouseMove(const CFX_FloatPoint& point, int nFlag) { - CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); CPDFSDK_Annot::ObservedPtr pFXAnnot(GetFXAnnotAtPoint(point.x, point.y)); if (pFXAnnot) { @@ -365,7 +365,7 @@ FX_BOOL CPDFSDK_PageView::OnMouseWheel(double deltaX, if (!pAnnot) return FALSE; - CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); return pAnnotHandlerMgr->Annot_OnMouseWheel(this, &pAnnot, nFlag, (int)deltaY, point); @@ -373,7 +373,7 @@ FX_BOOL CPDFSDK_PageView::OnMouseWheel(double deltaX, FX_BOOL CPDFSDK_PageView::OnChar(int nChar, uint32_t nFlag) { if (CPDFSDK_Annot* pAnnot = GetFocusAnnot()) { - CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); return pAnnotHandlerMgr->Annot_OnChar(pAnnot, nChar, nFlag); } @@ -383,7 +383,7 @@ FX_BOOL CPDFSDK_PageView::OnChar(int nChar, uint32_t nFlag) { FX_BOOL CPDFSDK_PageView::OnKeyDown(int nKeyCode, int nFlag) { if (CPDFSDK_Annot* pAnnot = GetFocusAnnot()) { - CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); return pAnnotHandlerMgr->Annot_OnKeyDown(pAnnot, nKeyCode, nFlag); } @@ -395,7 +395,7 @@ FX_BOOL CPDFSDK_PageView::OnKeyUp(int nKeyCode, int nFlag) { } void CPDFSDK_PageView::LoadFXAnnots() { - CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); SetLock(TRUE); @@ -449,14 +449,14 @@ void CPDFSDK_PageView::LoadFXAnnots() { } void CPDFSDK_PageView::UpdateRects(const std::vector& rects) { - CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); for (const auto& rc : rects) pEnv->Invalidate(m_page, rc.left, rc.top, rc.right, rc.bottom); } void CPDFSDK_PageView::UpdateView(CPDFSDK_Annot* pAnnot) { CFX_FloatRect rcWindow = pAnnot->GetRect(); - CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); pEnv->Invalidate(m_page, rcWindow.left, rcWindow.top, rcWindow.right, rcWindow.bottom); } diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp index 13b412c5e5..94555b70c5 100644 --- a/fpdfsdk/cpdfsdk_widget.cpp +++ b/fpdfsdk/cpdfsdk_widget.cpp @@ -20,7 +20,7 @@ #include "core/fxge/cfx_pathdata.h" #include "core/fxge/cfx_renderdevice.h" #include "fpdfsdk/cpdfsdk_document.h" -#include "fpdfsdk/cpdfsdk_environment.h" +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_interform.h" #include "fpdfsdk/cpdfsdk_pageview.h" #include "fpdfsdk/formfiller/cba_fontmap.h" @@ -853,7 +853,7 @@ void CPDFSDK_Widget::DrawShadow(CFX_RenderDevice* pDevice, CFX_FloatRect rcDevice; ASSERT(m_pInterForm->GetDocument()); - CPDFSDK_Environment* pEnv = m_pInterForm->GetDocument()->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pInterForm->GetDocument()->GetEnv(); if (!pEnv) return; CFX_Matrix page2device; @@ -1000,7 +1000,7 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() { CPDF_IconFit iconFit = pControl->GetIconFit(); CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); - CPDFSDK_Environment* pEnv = pDoc->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = pDoc->GetEnv(); CBA_FontMap font_map(this, pEnv->GetSysHandler()); font_map.SetAPType("N"); @@ -1378,7 +1378,7 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(const CFX_WideString* sValue) { pEdit->EnableRefresh(FALSE); CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); - CPDFSDK_Environment* pEnv = pDoc->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = pDoc->GetEnv(); CBA_FontMap font_map(this, pEnv->GetSysHandler()); pEdit->SetFontMap(&font_map); @@ -1444,7 +1444,7 @@ void CPDFSDK_Widget::ResetAppearance_ListBox() { pEdit->EnableRefresh(FALSE); CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); - CPDFSDK_Environment* pEnv = pDoc->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = pDoc->GetEnv(); CBA_FontMap font_map(this, pEnv->GetSysHandler()); pEdit->SetFontMap(&font_map); @@ -1531,7 +1531,7 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const CFX_WideString* sValue) { pEdit->EnableRefresh(FALSE); CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); - CPDFSDK_Environment* pEnv = pDoc->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = pDoc->GetEnv(); CBA_FontMap font_map(this, pEnv->GetSysHandler()); pEdit->SetFontMap(&font_map); @@ -1847,7 +1847,7 @@ FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type, PDFSDK_FieldAction& data, CPDFSDK_PageView* pPageView) { CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); - CPDFSDK_Environment* pEnv = pDocument->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = pDocument->GetEnv(); #ifdef PDF_ENABLE_XFA CPDFXFA_Document* pDoc = pDocument->GetXFADocument(); diff --git a/fpdfsdk/cpdfsdk_widgethandler.cpp b/fpdfsdk/cpdfsdk_widgethandler.cpp index d54ea92833..8bae149448 100644 --- a/fpdfsdk/cpdfsdk_widgethandler.cpp +++ b/fpdfsdk/cpdfsdk_widgethandler.cpp @@ -14,7 +14,7 @@ #include "core/fpdfdoc/cpdf_interform.h" #include "fpdfsdk/cpdfsdk_annot.h" #include "fpdfsdk/cpdfsdk_document.h" -#include "fpdfsdk/cpdfsdk_environment.h" +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_interform.h" #include "fpdfsdk/cpdfsdk_pageview.h" #include "fpdfsdk/cpdfsdk_widget.h" @@ -24,7 +24,7 @@ #include "fpdfsdk/fpdfxfa/cpdfxfa_document.h" #endif // PDF_ENABLE_XFA -CPDFSDK_WidgetHandler::CPDFSDK_WidgetHandler(CPDFSDK_Environment* pEnv) +CPDFSDK_WidgetHandler::CPDFSDK_WidgetHandler(CPDFSDK_FormFillEnvironment* pEnv) : m_pEnv(pEnv), m_pFormFiller(nullptr) {} CPDFSDK_WidgetHandler::~CPDFSDK_WidgetHandler() {} diff --git a/fpdfsdk/cpdfsdk_widgethandler.h b/fpdfsdk/cpdfsdk_widgethandler.h index 35554a2b10..b2fa71daa5 100644 --- a/fpdfsdk/cpdfsdk_widgethandler.h +++ b/fpdfsdk/cpdfsdk_widgethandler.h @@ -16,7 +16,7 @@ class CFX_Matrix; class CFX_RenderDevice; class CPDF_Annot; class CPDFSDK_Annot; -class CPDFSDK_Environment; +class CPDFSDK_FormFillEnvironment; class CPDFSDK_PageView; #ifdef PDF_ENABLE_XFA @@ -25,7 +25,7 @@ class CXFA_FFWidget; class CPDFSDK_WidgetHandler : public IPDFSDK_AnnotHandler { public: - explicit CPDFSDK_WidgetHandler(CPDFSDK_Environment* pApp); + explicit CPDFSDK_WidgetHandler(CPDFSDK_FormFillEnvironment* pApp); ~CPDFSDK_WidgetHandler() override; FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) override; @@ -112,7 +112,7 @@ class CPDFSDK_WidgetHandler : public IPDFSDK_AnnotHandler { CFFL_InteractiveFormFiller* GetFormFiller() { return m_pFormFiller; } private: - CPDFSDK_Environment* m_pEnv; + CPDFSDK_FormFillEnvironment* m_pEnv; CFFL_InteractiveFormFiller* m_pFormFiller; }; diff --git a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp index 04486fcbdc..17d80cc544 100644 --- a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp +++ b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp @@ -9,7 +9,7 @@ #include "core/fpdfdoc/cpdf_interform.h" #include "fpdfsdk/cpdfsdk_annot.h" #include "fpdfsdk/cpdfsdk_document.h" -#include "fpdfsdk/cpdfsdk_environment.h" +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_interform.h" #include "fpdfsdk/cpdfsdk_pageview.h" #include "fpdfsdk/cpdfsdk_xfawidget.h" @@ -22,7 +22,8 @@ #include "xfa/fxfa/xfa_ffwidgethandler.h" #include "xfa/fxgraphics/cfx_graphics.h" -CPDFSDK_XFAWidgetHandler::CPDFSDK_XFAWidgetHandler(CPDFSDK_Environment* pEnv) +CPDFSDK_XFAWidgetHandler::CPDFSDK_XFAWidgetHandler( + CPDFSDK_FormFillEnvironment* pEnv) : m_pEnv(pEnv) {} CPDFSDK_XFAWidgetHandler::~CPDFSDK_XFAWidgetHandler() {} diff --git a/fpdfsdk/cpdfsdk_xfawidgethandler.h b/fpdfsdk/cpdfsdk_xfawidgethandler.h index d291cc5e45..5ec96188fc 100644 --- a/fpdfsdk/cpdfsdk_xfawidgethandler.h +++ b/fpdfsdk/cpdfsdk_xfawidgethandler.h @@ -14,7 +14,7 @@ class CFX_Matrix; class CFX_RenderDevice; class CPDF_Annot; -class CPDFSDK_Environment; +class CPDFSDK_FormFillEnvironment; class CPDFSDK_Annot; class CPDFSDK_PageView; class CXFA_FFWidget; @@ -22,7 +22,7 @@ class CXFA_FFWidgetHandler; class CPDFSDK_XFAWidgetHandler : public IPDFSDK_AnnotHandler { public: - explicit CPDFSDK_XFAWidgetHandler(CPDFSDK_Environment* pApp); + explicit CPDFSDK_XFAWidgetHandler(CPDFSDK_FormFillEnvironment* pApp); ~CPDFSDK_XFAWidgetHandler() override; FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) override; @@ -102,7 +102,7 @@ class CPDFSDK_XFAWidgetHandler : public IPDFSDK_AnnotHandler { CXFA_FFWidgetHandler* GetXFAWidgetHandler(CPDFSDK_Annot* pAnnot); uint32_t GetFWLFlags(uint32_t dwFlag); - CPDFSDK_Environment* m_pEnv; + CPDFSDK_FormFillEnvironment* m_pEnv; }; #endif // FPDFSDK_CPDFSDK_XFAWIDGETHANDLER_H_ diff --git a/fpdfsdk/formfiller/cffl_checkbox.cpp b/fpdfsdk/formfiller/cffl_checkbox.cpp index 27cf446990..64981f053c 100644 --- a/fpdfsdk/formfiller/cffl_checkbox.cpp +++ b/fpdfsdk/formfiller/cffl_checkbox.cpp @@ -6,13 +6,14 @@ #include "fpdfsdk/formfiller/cffl_checkbox.h" -#include "fpdfsdk/cpdfsdk_environment.h" +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_widget.h" #include "fpdfsdk/formfiller/cffl_formfiller.h" #include "fpdfsdk/pdfwindow/PWL_SpecialButton.h" #include "public/fpdf_fwlevent.h" -CFFL_CheckBox::CFFL_CheckBox(CPDFSDK_Environment* pApp, CPDFSDK_Widget* pWidget) +CFFL_CheckBox::CFFL_CheckBox(CPDFSDK_FormFillEnvironment* pApp, + CPDFSDK_Widget* pWidget) : CFFL_Button(pApp, pWidget) {} CFFL_CheckBox::~CFFL_CheckBox() {} diff --git a/fpdfsdk/formfiller/cffl_checkbox.h b/fpdfsdk/formfiller/cffl_checkbox.h index c82d3338ee..0c62d5741b 100644 --- a/fpdfsdk/formfiller/cffl_checkbox.h +++ b/fpdfsdk/formfiller/cffl_checkbox.h @@ -11,7 +11,7 @@ class CFFL_CheckBox : public CFFL_Button { public: - CFFL_CheckBox(CPDFSDK_Environment* pApp, CPDFSDK_Widget* pWidget); + CFFL_CheckBox(CPDFSDK_FormFillEnvironment* pApp, CPDFSDK_Widget* pWidget); ~CFFL_CheckBox() override; // CFFL_Button diff --git a/fpdfsdk/formfiller/cffl_combobox.cpp b/fpdfsdk/formfiller/cffl_combobox.cpp index fad090fe0c..a7dda07e3b 100644 --- a/fpdfsdk/formfiller/cffl_combobox.cpp +++ b/fpdfsdk/formfiller/cffl_combobox.cpp @@ -6,7 +6,7 @@ #include "fpdfsdk/formfiller/cffl_combobox.h" -#include "fpdfsdk/cpdfsdk_environment.h" +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_widget.h" #include "fpdfsdk/formfiller/cba_fontmap.h" #include "fpdfsdk/formfiller/cffl_formfiller.h" @@ -14,7 +14,8 @@ #include "fpdfsdk/fsdk_common.h" #include "fpdfsdk/pdfwindow/PWL_ComboBox.h" -CFFL_ComboBox::CFFL_ComboBox(CPDFSDK_Environment* pApp, CPDFSDK_Annot* pAnnot) +CFFL_ComboBox::CFFL_ComboBox(CPDFSDK_FormFillEnvironment* pApp, + CPDFSDK_Annot* pAnnot) : CFFL_FormFiller(pApp, pAnnot), m_pFontMap(nullptr) { m_State.nIndex = 0; m_State.nStart = 0; diff --git a/fpdfsdk/formfiller/cffl_combobox.h b/fpdfsdk/formfiller/cffl_combobox.h index acc61af0b1..6881038353 100644 --- a/fpdfsdk/formfiller/cffl_combobox.h +++ b/fpdfsdk/formfiller/cffl_combobox.h @@ -21,7 +21,7 @@ struct FFL_ComboBoxState { class CFFL_ComboBox : public CFFL_FormFiller, public IPWL_FocusHandler { public: - CFFL_ComboBox(CPDFSDK_Environment* pApp, CPDFSDK_Annot* pWidget); + CFFL_ComboBox(CPDFSDK_FormFillEnvironment* pApp, CPDFSDK_Annot* pWidget); ~CFFL_ComboBox() override; // CFFL_FormFiller: diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp index 858966c302..6369b45d7e 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.cpp +++ b/fpdfsdk/formfiller/cffl_formfiller.cpp @@ -9,7 +9,7 @@ #include "core/fpdfapi/page/cpdf_page.h" #include "core/fxge/cfx_renderdevice.h" #include "fpdfsdk/cpdfsdk_document.h" -#include "fpdfsdk/cpdfsdk_environment.h" +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_pageview.h" #include "fpdfsdk/cpdfsdk_widget.h" #include "fpdfsdk/formfiller/cba_fontmap.h" @@ -22,7 +22,7 @@ #define FFL_HINT_ELAPSE 800 -CFFL_FormFiller::CFFL_FormFiller(CPDFSDK_Environment* pEnv, +CFFL_FormFiller::CFFL_FormFiller(CPDFSDK_FormFillEnvironment* pEnv, CPDFSDK_Annot* pAnnot) : m_pEnv(pEnv), m_pAnnot(pAnnot), m_bValid(FALSE) { m_pWidget = static_cast(pAnnot); @@ -618,7 +618,8 @@ void CFFL_FormFiller::InvalidateRect(double left, m_pEnv->Invalidate(pPage, left, top, right, bottom); } -CFFL_Button::CFFL_Button(CPDFSDK_Environment* pApp, CPDFSDK_Annot* pWidget) +CFFL_Button::CFFL_Button(CPDFSDK_FormFillEnvironment* pApp, + CPDFSDK_Annot* pWidget) : CFFL_FormFiller(pApp, pWidget), m_bMouseIn(FALSE), m_bMouseDown(FALSE) {} CFFL_Button::~CFFL_Button() {} diff --git a/fpdfsdk/formfiller/cffl_formfiller.h b/fpdfsdk/formfiller/cffl_formfiller.h index 430717113d..cfce22fd12 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.h +++ b/fpdfsdk/formfiller/cffl_formfiller.h @@ -14,13 +14,13 @@ #include "fpdfsdk/pdfsdk_fieldaction.h" class CPDFSDK_Annot; -class CPDFSDK_Environment; +class CPDFSDK_FormFillEnvironment; class CPDFSDK_PageView; class CPDFSDK_Widget; class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler { public: - CFFL_FormFiller(CPDFSDK_Environment* pEnv, CPDFSDK_Annot* pAnnot); + CFFL_FormFiller(CPDFSDK_FormFillEnvironment* pEnv, CPDFSDK_Annot* pAnnot); ~CFFL_FormFiller() override; virtual FX_RECT GetViewBBox(CPDFSDK_PageView* pPageView, @@ -161,7 +161,7 @@ class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler { // until the PWL_Edit is done with it. pdfium:566 void DestroyWindows(); - CPDFSDK_Environment* m_pEnv; + CPDFSDK_FormFillEnvironment* m_pEnv; CPDFSDK_Widget* m_pWidget; CPDFSDK_Annot* m_pAnnot; @@ -172,7 +172,7 @@ class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler { class CFFL_Button : public CFFL_FormFiller { public: - CFFL_Button(CPDFSDK_Environment* pEnv, CPDFSDK_Annot* pWidget); + CFFL_Button(CPDFSDK_FormFillEnvironment* pEnv, CPDFSDK_Annot* pWidget); ~CFFL_Button() override; // CFFL_FormFiller diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp index b2789d7f90..12c55d37b3 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp @@ -12,7 +12,7 @@ #include "core/fxge/cfx_pathdata.h" #include "core/fxge/cfx_renderdevice.h" #include "fpdfsdk/cpdfsdk_document.h" -#include "fpdfsdk/cpdfsdk_environment.h" +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_interform.h" #include "fpdfsdk/cpdfsdk_pageview.h" #include "fpdfsdk/cpdfsdk_widget.h" @@ -28,7 +28,7 @@ #define FFL_MAXLISTBOXHEIGHT 140.0f CFFL_InteractiveFormFiller::CFFL_InteractiveFormFiller( - CPDFSDK_Environment* pEnv) + CPDFSDK_FormFillEnvironment* pEnv) : m_pEnv(pEnv), m_bNotifying(FALSE) {} CFFL_InteractiveFormFiller::~CFFL_InteractiveFormFiller() {} diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.h b/fpdfsdk/formfiller/cffl_interactiveformfiller.h index 9a303b48ea..58fafe032d 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.h +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.h @@ -15,13 +15,13 @@ #include "fpdfsdk/pdfwindow/PWL_Edit.h" class CFFL_FormFiller; -class CPDFSDK_Environment; +class CPDFSDK_FormFillEnvironment; class CPDFSDK_PageView; class CPDFSDK_Widget; class CFFL_InteractiveFormFiller : public IPWL_Filler_Notify { public: - explicit CFFL_InteractiveFormFiller(CPDFSDK_Environment* pEnv); + explicit CFFL_InteractiveFormFiller(CPDFSDK_FormFillEnvironment* pEnv); ~CFFL_InteractiveFormFiller() override; FX_BOOL Annot_HitTest(CPDFSDK_PageView* pPageView, @@ -167,7 +167,7 @@ class CFFL_InteractiveFormFiller : public IPWL_Filler_Notify { #endif // PDF_ENABLE_XFA void UnRegisterFormFiller(CPDFSDK_Annot* pAnnot); - CPDFSDK_Environment* const m_pEnv; + CPDFSDK_FormFillEnvironment* const m_pEnv; CFFL_Widget2Filler m_Maps; FX_BOOL m_bNotifying; }; diff --git a/fpdfsdk/formfiller/cffl_listbox.cpp b/fpdfsdk/formfiller/cffl_listbox.cpp index ab437d401e..e4ea65b846 100644 --- a/fpdfsdk/formfiller/cffl_listbox.cpp +++ b/fpdfsdk/formfiller/cffl_listbox.cpp @@ -6,7 +6,7 @@ #include "fpdfsdk/formfiller/cffl_listbox.h" -#include "fpdfsdk/cpdfsdk_environment.h" +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_widget.h" #include "fpdfsdk/formfiller/cba_fontmap.h" #include "fpdfsdk/formfiller/cffl_formfiller.h" @@ -17,7 +17,8 @@ #define FFL_DEFAULTLISTBOXFONTSIZE 12.0f -CFFL_ListBox::CFFL_ListBox(CPDFSDK_Environment* pApp, CPDFSDK_Annot* pWidget) +CFFL_ListBox::CFFL_ListBox(CPDFSDK_FormFillEnvironment* pApp, + CPDFSDK_Annot* pWidget) : CFFL_FormFiller(pApp, pWidget) {} CFFL_ListBox::~CFFL_ListBox() {} diff --git a/fpdfsdk/formfiller/cffl_listbox.h b/fpdfsdk/formfiller/cffl_listbox.h index 8d8ed0d5ab..12490b8053 100644 --- a/fpdfsdk/formfiller/cffl_listbox.h +++ b/fpdfsdk/formfiller/cffl_listbox.h @@ -16,7 +16,7 @@ class CBA_FontMap; class CFFL_ListBox : public CFFL_FormFiller { public: - CFFL_ListBox(CPDFSDK_Environment* pApp, CPDFSDK_Annot* pWidget); + CFFL_ListBox(CPDFSDK_FormFillEnvironment* pApp, CPDFSDK_Annot* pWidget); ~CFFL_ListBox() override; // CFFL_FormFiller diff --git a/fpdfsdk/formfiller/cffl_pushbutton.cpp b/fpdfsdk/formfiller/cffl_pushbutton.cpp index 4b147fbfb1..4fb7b09cc8 100644 --- a/fpdfsdk/formfiller/cffl_pushbutton.cpp +++ b/fpdfsdk/formfiller/cffl_pushbutton.cpp @@ -9,7 +9,7 @@ #include "fpdfsdk/formfiller/cffl_formfiller.h" #include "fpdfsdk/pdfwindow/PWL_SpecialButton.h" -CFFL_PushButton::CFFL_PushButton(CPDFSDK_Environment* pApp, +CFFL_PushButton::CFFL_PushButton(CPDFSDK_FormFillEnvironment* pApp, CPDFSDK_Annot* pAnnot) : CFFL_Button(pApp, pAnnot) {} diff --git a/fpdfsdk/formfiller/cffl_pushbutton.h b/fpdfsdk/formfiller/cffl_pushbutton.h index cac09047e6..9b0a7b30e3 100644 --- a/fpdfsdk/formfiller/cffl_pushbutton.h +++ b/fpdfsdk/formfiller/cffl_pushbutton.h @@ -11,7 +11,7 @@ class CFFL_PushButton : public CFFL_Button { public: - CFFL_PushButton(CPDFSDK_Environment* pApp, CPDFSDK_Annot* pAnnot); + CFFL_PushButton(CPDFSDK_FormFillEnvironment* pApp, CPDFSDK_Annot* pAnnot); ~CFFL_PushButton() override; // CFFL_Button diff --git a/fpdfsdk/formfiller/cffl_radiobutton.cpp b/fpdfsdk/formfiller/cffl_radiobutton.cpp index 394521217f..73fd18d2af 100644 --- a/fpdfsdk/formfiller/cffl_radiobutton.cpp +++ b/fpdfsdk/formfiller/cffl_radiobutton.cpp @@ -6,13 +6,13 @@ #include "fpdfsdk/formfiller/cffl_radiobutton.h" -#include "fpdfsdk/cpdfsdk_environment.h" +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_widget.h" #include "fpdfsdk/formfiller/cffl_formfiller.h" #include "fpdfsdk/pdfwindow/PWL_SpecialButton.h" #include "public/fpdf_fwlevent.h" -CFFL_RadioButton::CFFL_RadioButton(CPDFSDK_Environment* pApp, +CFFL_RadioButton::CFFL_RadioButton(CPDFSDK_FormFillEnvironment* pApp, CPDFSDK_Annot* pWidget) : CFFL_Button(pApp, pWidget) {} diff --git a/fpdfsdk/formfiller/cffl_radiobutton.h b/fpdfsdk/formfiller/cffl_radiobutton.h index 28dd412100..b3656b945c 100644 --- a/fpdfsdk/formfiller/cffl_radiobutton.h +++ b/fpdfsdk/formfiller/cffl_radiobutton.h @@ -11,7 +11,7 @@ class CFFL_RadioButton : public CFFL_Button { public: - CFFL_RadioButton(CPDFSDK_Environment* pApp, CPDFSDK_Annot* pAnnot); + CFFL_RadioButton(CPDFSDK_FormFillEnvironment* pApp, CPDFSDK_Annot* pAnnot); ~CFFL_RadioButton() override; // CFFL_Button diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp index ffb3785c36..a2612f17ef 100644 --- a/fpdfsdk/formfiller/cffl_textfield.cpp +++ b/fpdfsdk/formfiller/cffl_textfield.cpp @@ -6,13 +6,14 @@ #include "fpdfsdk/formfiller/cffl_textfield.h" -#include "fpdfsdk/cpdfsdk_environment.h" +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_widget.h" #include "fpdfsdk/formfiller/cba_fontmap.h" #include "fpdfsdk/fsdk_common.h" #include "third_party/base/ptr_util.h" -CFFL_TextField::CFFL_TextField(CPDFSDK_Environment* pApp, CPDFSDK_Annot* pAnnot) +CFFL_TextField::CFFL_TextField(CPDFSDK_FormFillEnvironment* pApp, + CPDFSDK_Annot* pAnnot) : CFFL_FormFiller(pApp, pAnnot) {} CFFL_TextField::~CFFL_TextField() { diff --git a/fpdfsdk/formfiller/cffl_textfield.h b/fpdfsdk/formfiller/cffl_textfield.h index 5c94b2e55d..74381e5e1c 100644 --- a/fpdfsdk/formfiller/cffl_textfield.h +++ b/fpdfsdk/formfiller/cffl_textfield.h @@ -27,7 +27,7 @@ struct FFL_TextFieldState { class CFFL_TextField : public CFFL_FormFiller, public IPWL_FocusHandler { public: - CFFL_TextField(CPDFSDK_Environment* pApp, CPDFSDK_Annot* pAnnot); + CFFL_TextField(CPDFSDK_FormFillEnvironment* pApp, CPDFSDK_Annot* pAnnot); ~CFFL_TextField() override; // CFFL_FormFiller: diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp index 904a3c867e..8be9d5f0b7 100644 --- a/fpdfsdk/fpdfformfill.cpp +++ b/fpdfsdk/fpdfformfill.cpp @@ -18,7 +18,7 @@ #include "core/fpdfdoc/cpdf_occontext.h" #include "core/fxge/cfx_fxgedevice.h" #include "fpdfsdk/cpdfsdk_document.h" -#include "fpdfsdk/cpdfsdk_environment.h" +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_interform.h" #include "fpdfsdk/cpdfsdk_pageview.h" #include "fpdfsdk/fsdk_actionhandler.h" @@ -38,8 +38,9 @@ namespace { -CPDFSDK_Environment* HandleToCPDFSDKEnvironment(FPDF_FORMHANDLE handle) { - return static_cast(handle); +CPDFSDK_FormFillEnvironment* HandleToCPDFSDKEnvironment( + FPDF_FORMHANDLE handle) { + return static_cast(handle); } CPDFSDK_InterForm* FormHandleToInterForm(FPDF_FORMHANDLE hHandle) { @@ -91,7 +92,7 @@ void FFLCommon(FPDF_FORMHANDLE hHandle, CPDF_Document* pPDFDoc = pDocument->GetPDFDoc(); if (!pPDFDoc) return; - CPDFSDK_Environment* pEnv = HandleToCPDFSDKEnvironment(hHandle); + CPDFSDK_FormFillEnvironment* pEnv = HandleToCPDFSDKEnvironment(hHandle); CPDFSDK_Document* pFXDoc = pEnv->GetSDKDocument(); if (!pFXDoc) return; @@ -251,7 +252,8 @@ FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document, return pDocument->GetSDKDoc()->GetEnv(); #endif - CPDFSDK_Environment* pEnv = new CPDFSDK_Environment(pDocument, formInfo); + CPDFSDK_FormFillEnvironment* pEnv = + new CPDFSDK_FormFillEnvironment(pDocument, formInfo); #ifdef PDF_ENABLE_XFA pDocument->SetSDKDoc(pEnv->GetSDKDocument()); @@ -266,7 +268,7 @@ FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle) { if (!hHandle) return; - CPDFSDK_Environment* pEnv = HandleToCPDFSDKEnvironment(hHandle); + CPDFSDK_FormFillEnvironment* pEnv = HandleToCPDFSDKEnvironment(hHandle); #ifdef PDF_ENABLE_XFA CPDFXFA_App::GetInstance()->RemoveFormFillEnv(pEnv); @@ -725,7 +727,7 @@ DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page, if (!pSDKDoc->GetPageView(pPage, false)) return; - CPDFSDK_Environment* pEnv = pSDKDoc->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = pSDKDoc->GetEnv(); CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); CPDF_Dictionary* pPageDict = pPDFPage->m_pFormDict; CPDF_AAction aa(pPageDict->GetDictFor("AA")); diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_app.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_app.cpp index 14450a10ab..d1a3bd0112 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_app.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_app.cpp @@ -8,7 +8,7 @@ #include -#include "fpdfsdk/cpdfsdk_environment.h" +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h" #include "fpdfsdk/fsdk_define.h" #include "third_party/base/ptr_util.h" @@ -64,7 +64,7 @@ FX_BOOL CPDFXFA_App::Initialize(v8::Isolate* pIsolate) { return TRUE; } -FX_BOOL CPDFXFA_App::AddFormFillEnv(CPDFSDK_Environment* pEnv) { +FX_BOOL CPDFXFA_App::AddFormFillEnv(CPDFSDK_FormFillEnvironment* pEnv) { if (!pEnv) return FALSE; @@ -72,7 +72,7 @@ FX_BOOL CPDFXFA_App::AddFormFillEnv(CPDFSDK_Environment* pEnv) { return TRUE; } -FX_BOOL CPDFXFA_App::RemoveFormFillEnv(CPDFSDK_Environment* pEnv) { +FX_BOOL CPDFXFA_App::RemoveFormFillEnv(CPDFSDK_FormFillEnvironment* pEnv) { if (!pEnv) return FALSE; @@ -90,7 +90,7 @@ void CPDFXFA_App::GetAppType(CFX_WideString& wsAppType) { } void CPDFXFA_App::GetAppName(CFX_WideString& wsName) { - CPDFSDK_Environment* pEnv = m_pEnvList.GetAt(0); + CPDFSDK_FormFillEnvironment* pEnv = m_pEnvList.GetAt(0); if (pEnv) { wsName = pEnv->FFI_GetAppName(); } @@ -101,13 +101,13 @@ void CPDFXFA_App::SetAppType(const CFX_WideStringC& wsAppType) { } void CPDFXFA_App::GetLanguage(CFX_WideString& wsLanguage) { - CPDFSDK_Environment* pEnv = m_pEnvList.GetAt(0); + CPDFSDK_FormFillEnvironment* pEnv = m_pEnvList.GetAt(0); if (pEnv) wsLanguage = pEnv->GetLanguage(); } void CPDFXFA_App::GetPlatform(CFX_WideString& wsPlatform) { - CPDFSDK_Environment* pEnv = m_pEnvList.GetAt(0); + CPDFSDK_FormFillEnvironment* pEnv = m_pEnvList.GetAt(0); if (pEnv) { wsPlatform = pEnv->GetPlatform(); } @@ -122,7 +122,7 @@ void CPDFXFA_App::GetVersion(CFX_WideString& wsVersion) { } void CPDFXFA_App::Beep(uint32_t dwType) { - CPDFSDK_Environment* pEnv = m_pEnvList.GetAt(0); + CPDFSDK_FormFillEnvironment* pEnv = m_pEnvList.GetAt(0); if (pEnv) { pEnv->JS_appBeep(dwType); } @@ -132,7 +132,7 @@ int32_t CPDFXFA_App::MsgBox(const CFX_WideString& wsMessage, const CFX_WideString& wsTitle, uint32_t dwIconType, uint32_t dwButtonType) { - CPDFSDK_Environment* pEnv = m_pEnvList.GetAt(0); + CPDFSDK_FormFillEnvironment* pEnv = m_pEnvList.GetAt(0); if (!pEnv) return -1; @@ -186,7 +186,7 @@ CFX_WideString CPDFXFA_App::Response(const CFX_WideString& wsQuestion, const CFX_WideString& wsDefaultAnswer, FX_BOOL bMark) { CFX_WideString wsAnswer; - CPDFSDK_Environment* pEnv = m_pEnvList.GetAt(0); + CPDFSDK_FormFillEnvironment* pEnv = m_pEnvList.GetAt(0); if (pEnv) { int nLength = 2048; char* pBuff = new char[nLength]; @@ -207,7 +207,7 @@ CFX_WideString CPDFXFA_App::Response(const CFX_WideString& wsQuestion, } IFX_FileRead* CPDFXFA_App::DownloadURL(const CFX_WideString& wsURL) { - CPDFSDK_Environment* pEnv = m_pEnvList.GetAt(0); + CPDFSDK_FormFillEnvironment* pEnv = m_pEnvList.GetAt(0); return pEnv ? pEnv->DownloadFromURL(wsURL.c_str()) : nullptr; } @@ -217,7 +217,7 @@ FX_BOOL CPDFXFA_App::PostRequestURL(const CFX_WideString& wsURL, const CFX_WideString& wsEncode, const CFX_WideString& wsHeader, CFX_WideString& wsResponse) { - CPDFSDK_Environment* pEnv = m_pEnvList.GetAt(0); + CPDFSDK_FormFillEnvironment* pEnv = m_pEnvList.GetAt(0); if (!pEnv) return FALSE; @@ -230,7 +230,7 @@ FX_BOOL CPDFXFA_App::PostRequestURL(const CFX_WideString& wsURL, FX_BOOL CPDFXFA_App::PutRequestURL(const CFX_WideString& wsURL, const CFX_WideString& wsData, const CFX_WideString& wsEncode) { - CPDFSDK_Environment* pEnv = m_pEnvList.GetAt(0); + CPDFSDK_FormFillEnvironment* pEnv = m_pEnvList.GetAt(0); return pEnv && pEnv->PutRequestURL(wsURL.c_str(), wsData.c_str(), wsEncode.c_str()); } @@ -334,7 +334,7 @@ void CPDFXFA_App::LoadString(int32_t iStringID, CFX_WideString& wsString) { IFWL_AdapterTimerMgr* CPDFXFA_App::GetTimerMgr() { CXFA_FWLAdapterTimerMgr* pAdapter = nullptr; - CPDFSDK_Environment* pEnv = m_pEnvList.GetAt(0); + CPDFSDK_FormFillEnvironment* pEnv = m_pEnvList.GetAt(0); if (pEnv) pAdapter = new CXFA_FWLAdapterTimerMgr(pEnv); return pAdapter; diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_app.h b/fpdfsdk/fpdfxfa/cpdfxfa_app.h index 3830dc4d4c..3d5256381c 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_app.h +++ b/fpdfsdk/fpdfxfa/cpdfxfa_app.h @@ -9,7 +9,7 @@ #include "xfa/fxfa/fxfa.h" -class CPDFSDK_Environment; +class CPDFSDK_FormFillEnvironment; class IFXJS_Runtime; class CPDFXFA_App : public IXFA_AppProvider { @@ -23,8 +23,8 @@ class CPDFXFA_App : public IXFA_AppProvider { FX_BOOL Initialize(v8::Isolate* pIsolate); CXFA_FFApp* GetXFAApp() { return m_pXFAApp.get(); } - FX_BOOL AddFormFillEnv(CPDFSDK_Environment* pEnv); - FX_BOOL RemoveFormFillEnv(CPDFSDK_Environment* pEnv); + FX_BOOL AddFormFillEnv(CPDFSDK_FormFillEnvironment* pEnv); + FX_BOOL RemoveFormFillEnv(CPDFSDK_FormFillEnvironment* pEnv); FX_BOOL IsJavaScriptInitialized() const { return m_bJavaScriptInitialized; } void SetJavaScriptInitialized(FX_BOOL bInitialized) { @@ -67,7 +67,7 @@ class CPDFXFA_App : public IXFA_AppProvider { void LoadString(int32_t iStringID, CFX_WideString& wsString) override; IFWL_AdapterTimerMgr* GetTimerMgr() override; - CFX_ArrayTemplate m_pEnvList; + CFX_ArrayTemplate m_pEnvList; protected: FX_BOOL m_bJavaScriptInitialized; diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp index fed5409624..6e8f6711cd 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp @@ -10,7 +10,7 @@ #include "core/fpdfapi/parser/cpdf_stream_acc.h" #include "core/fpdfapi/parser/cpdf_string.h" #include "fpdfsdk/cpdfsdk_document.h" -#include "fpdfsdk/cpdfsdk_environment.h" +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_interform.h" #include "fpdfsdk/cpdfsdk_pageview.h" #include "fpdfsdk/fpdfxfa/cpdfxfa_document.h" @@ -65,7 +65,7 @@ void CPDFXFA_DocEnvironment::InvalidateRect(CXFA_FFPageView* pPageView, if (!pPage) return; - CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); if (!pEnv) return; @@ -97,7 +97,7 @@ void CPDFXFA_DocEnvironment::DisplayCaret(CXFA_FFWidget* hWidget, if (!pPage) return; - CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); if (!pEnv) return; @@ -124,7 +124,7 @@ FX_BOOL CPDFXFA_DocEnvironment::GetPopupPos(CXFA_FFWidget* hWidget, CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc(); int nRotate = pWidgetAcc->GetRotate(); - CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); if (!pEnv) return FALSE; @@ -235,7 +235,7 @@ FX_BOOL CPDFXFA_DocEnvironment::PopupMenu(CXFA_FFWidget* hWidget, if (!pPage) return FALSE; - CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); if (!pEnv) return FALSE; @@ -262,7 +262,7 @@ void CPDFXFA_DocEnvironment::PageViewEvent(CXFA_FFPageView* pPageView, if (!pSDKDoc) return; - CPDFSDK_Environment* pEnv = pSDKDoc->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = pSDKDoc->GetEnv(); if (!pEnv) return; @@ -344,7 +344,7 @@ int32_t CPDFXFA_DocEnvironment::GetCurrentPage(CXFA_FFDoc* hDoc) { if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA) return -1; - CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); if (!pEnv) return -1; @@ -359,7 +359,7 @@ void CPDFXFA_DocEnvironment::SetCurrentPage(CXFA_FFDoc* hDoc, return; } - CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); if (!pEnv) return; pEnv->SetCurrentPage(this, iCurPage); @@ -414,7 +414,7 @@ void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc, m_pDocument->GetDocType() != DOCTYPE_STATIC_XFA) return; - CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); if (!pEnv) return; @@ -511,7 +511,7 @@ void CPDFXFA_DocEnvironment::GotoURL(CXFA_FFDoc* hDoc, if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA) return; - CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); if (!pEnv) return; @@ -568,7 +568,7 @@ void CPDFXFA_DocEnvironment::Print(CXFA_FFDoc* hDoc, if (hDoc != m_pDocument->GetXFADoc()) return; - CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); if (!pEnv || !pEnv->GetFormFillInfo() || !pEnv->GetFormFillInfo()->m_pJsPlatform || !pEnv->GetFormFillInfo()->m_pJsPlatform->Doc_print) { @@ -635,7 +635,7 @@ FX_BOOL CPDFXFA_DocEnvironment::OnBeforeNotifySubmit() { while (pWidgetAcc) { int fRet = pWidgetAcc->ProcessValidate(-1); if (fRet == XFA_EVENTERROR_Error) { - CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); if (!pEnv) return FALSE; @@ -697,7 +697,7 @@ FX_BOOL CPDFXFA_DocEnvironment::SubmitData(CXFA_FFDoc* hDoc, IFX_FileRead* CPDFXFA_DocEnvironment::OpenLinkedFile( CXFA_FFDoc* hDoc, const CFX_WideString& wsLink) { - CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); if (!pEnv) return FALSE; @@ -720,7 +720,7 @@ FX_BOOL CPDFXFA_DocEnvironment::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler, return FALSE; CFX_ByteString content; - CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); if (!pEnv) return FALSE; @@ -891,7 +891,7 @@ FX_BOOL CPDFXFA_DocEnvironment::MailToInfo(CFX_WideString& csURL, FX_BOOL CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc, CXFA_Submit submit) { - CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); if (!pEnv) return FALSE; diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_document.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_document.cpp index 121d060453..bd7f931c59 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_document.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_document.cpp @@ -8,7 +8,7 @@ #include "core/fpdfapi/parser/cpdf_document.h" #include "fpdfsdk/cpdfsdk_document.h" -#include "fpdfsdk/cpdfsdk_environment.h" +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_interform.h" #include "fpdfsdk/cpdfsdk_pageview.h" #include "fpdfsdk/fpdfxfa/cpdfxfa_app.h" diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_document.h b/fpdfsdk/fpdfxfa/cpdfxfa_document.h index fa415f917c..4118a31f6d 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_document.h +++ b/fpdfsdk/fpdfxfa/cpdfxfa_document.h @@ -13,7 +13,7 @@ #include "xfa/fxfa/xfa_ffdoc.h" class CPDFSDK_Document; -class CPDFSDK_Environment; +class CPDFSDK_FormFillEnvironment; class CPDFXFA_App; class CPDFXFA_Page; class CXFA_FFDocHandler; diff --git a/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.cpp b/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.cpp index b835fd4467..8d9356990b 100644 --- a/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.cpp +++ b/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.cpp @@ -8,7 +8,7 @@ #include -#include "fpdfsdk/cpdfsdk_environment.h" +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/fsdk_define.h" std::vector* CXFA_FWLAdapterTimerMgr::s_TimerArray = nullptr; diff --git a/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h b/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h index 958171d4ca..5c046b5bdd 100644 --- a/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h +++ b/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h @@ -21,7 +21,7 @@ struct CFWL_TimerInfo; class CXFA_FWLAdapterTimerMgr : public IFWL_AdapterTimerMgr { public: - CXFA_FWLAdapterTimerMgr(CPDFSDK_Environment* pEnv) : m_pEnv(pEnv) {} + CXFA_FWLAdapterTimerMgr(CPDFSDK_FormFillEnvironment* pEnv) : m_pEnv(pEnv) {} FWL_Error Start(IFWL_Timer* pTimer, uint32_t dwElapse, @@ -33,7 +33,7 @@ class CXFA_FWLAdapterTimerMgr : public IFWL_AdapterTimerMgr { static void TimerProc(int32_t idEvent); static std::vector* s_TimerArray; - CPDFSDK_Environment* const m_pEnv; + CPDFSDK_FormFillEnvironment* const m_pEnv; }; struct CFWL_TimerInfo : public IFWL_TimerInfo { diff --git a/fpdfsdk/fsdk_actionhandler.cpp b/fpdfsdk/fsdk_actionhandler.cpp index 85eb9d69f5..08a03edafe 100644 --- a/fpdfsdk/fsdk_actionhandler.cpp +++ b/fpdfsdk/fsdk_actionhandler.cpp @@ -12,7 +12,7 @@ #include "core/fpdfdoc/cpdf_formfield.h" #include "core/fpdfdoc/cpdf_interform.h" #include "fpdfsdk/cpdfsdk_document.h" -#include "fpdfsdk/cpdfsdk_environment.h" +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_interform.h" #include "fpdfsdk/fsdk_define.h" #include "fpdfsdk/javascript/ijs_context.h" @@ -46,7 +46,7 @@ FX_BOOL CPDFSDK_ActionHandler::DoAction_FieldJavaScript( CPDFSDK_Document* pDocument, CPDF_FormField* pFormField, PDFSDK_FieldAction& data) { - CPDFSDK_Environment* pEnv = pDocument->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = pDocument->GetEnv(); ASSERT(pEnv); if (pEnv->IsJSInitiated() && JsAction.GetType() == CPDF_Action::JavaScript) { CFX_WideString swJS = JsAction.GetJavaScript(); @@ -116,7 +116,7 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteDocumentOpenAction( visited->insert(pDict); - CPDFSDK_Environment* pEnv = pDocument->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = pDocument->GetEnv(); ASSERT(pEnv); if (action.GetType() == CPDF_Action::JavaScript) { if (pEnv->IsJSInitiated()) { @@ -148,7 +148,7 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteLinkAction( visited->insert(pDict); - CPDFSDK_Environment* pEnv = pDocument->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = pDocument->GetEnv(); ASSERT(pEnv); if (action.GetType() == CPDF_Action::JavaScript) { if (pEnv->IsJSInitiated()) { @@ -193,7 +193,7 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteDocumentPageAction( visited->insert(pDict); - CPDFSDK_Environment* pEnv = pDocument->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = pDocument->GetEnv(); ASSERT(pEnv); if (action.GetType() == CPDF_Action::JavaScript) { if (pEnv->IsJSInitiated()) { @@ -240,7 +240,7 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteFieldAction( visited->insert(pDict); - CPDFSDK_Environment* pEnv = pDocument->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = pDocument->GetEnv(); ASSERT(pEnv); if (action.GetType() == CPDF_Action::JavaScript) { if (pEnv->IsJSInitiated()) { @@ -277,7 +277,7 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteScreenAction( visited->insert(pDict); - CPDFSDK_Environment* pEnv = pDocument->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = pDocument->GetEnv(); ASSERT(pEnv); if (action.GetType() == CPDF_Action::JavaScript) { if (pEnv->IsJSInitiated()) { @@ -320,7 +320,7 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteBookMark( visited->insert(pDict); - CPDFSDK_Environment* pEnv = pDocument->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = pDocument->GetEnv(); ASSERT(pEnv); if (action.GetType() == CPDF_Action::JavaScript) { if (pEnv->IsJSInitiated()) { @@ -438,7 +438,7 @@ void CPDFSDK_ActionHandler::DoAction_GoTo(CPDFSDK_Document* pDocument, sizeOfAry = j; } - CPDFSDK_Environment* pApp = pDocument->GetEnv(); + CPDFSDK_FormFillEnvironment* pApp = pDocument->GetEnv(); pApp->DoGoToAction(nPageIndex, nFitType, pPosAry, sizeOfAry); delete[] pPosAry; } @@ -453,7 +453,7 @@ void CPDFSDK_ActionHandler::DoAction_URI(CPDFSDK_Document* pDocument, const CPDF_Action& action) { ASSERT(action.GetDict()); - CPDFSDK_Environment* pApp = pDocument->GetEnv(); + CPDFSDK_FormFillEnvironment* pApp = pDocument->GetEnv(); CFX_ByteString sURI = action.GetURI(pDocument->GetPDFDocument()); pApp->DoURIAction(sURI.c_str()); } diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp index c143edd88a..f5779aa438 100644 --- a/fpdfsdk/javascript/Document.cpp +++ b/fpdfsdk/javascript/Document.cpp @@ -18,7 +18,7 @@ #include "core/fpdfdoc/cpdf_nametree.h" #include "fpdfsdk/cpdfsdk_annotiterator.h" #include "fpdfsdk/cpdfsdk_document.h" -#include "fpdfsdk/cpdfsdk_environment.h" +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_interform.h" #include "fpdfsdk/cpdfsdk_pageview.h" #include "fpdfsdk/cpdfsdk_widget.h" @@ -225,7 +225,7 @@ FX_BOOL Document::pageNum(IJS_Context* cc, int iPageNum = 0; vp >> iPageNum; - CPDFSDK_Environment* pEnv = m_pDocument->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetEnv(); if (iPageNum >= 0 && iPageNum < iPageCount) { pEnv->JS_docgotoPage(iPageNum); } else if (iPageNum >= iPageCount) { @@ -408,7 +408,7 @@ FX_BOOL Document::mailForm(IJS_Context* cc, return FALSE; pRuntime->BeginBlock(); - CPDFSDK_Environment* pEnv = pContext->GetReaderEnv(); + CPDFSDK_FormFillEnvironment* pEnv = pContext->GetReaderEnv(); pEnv->JS_docmailForm(textBuf.GetBuffer(), textBuf.GetLength(), bUI, cTo.c_str(), cSubject.c_str(), cCc.c_str(), cBcc.c_str(), cMsg.c_str()); @@ -477,7 +477,7 @@ FX_BOOL Document::print(IJS_Context* cc, bAnnotations = params[7].ToBool(pRuntime); } - if (CPDFSDK_Environment* pEnv = m_pDocument->GetEnv()) { + if (CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetEnv()) { pEnv->JS_docprint(bUI, nStart, nEnd, bSilent, bShrinkToFit, bPrintAsImage, bReverse, bAnnotations); return TRUE; @@ -757,7 +757,7 @@ FX_BOOL Document::mailDoc(IJS_Context* cc, } pRuntime->BeginBlock(); - CPDFSDK_Environment* pEnv = pRuntime->GetReaderEnv(); + CPDFSDK_FormFillEnvironment* pEnv = pRuntime->GetReaderEnv(); pEnv->JS_docmailForm(nullptr, 0, bUI, cTo.c_str(), cSubject.c_str(), cCc.c_str(), cBcc.c_str(), cMsg.c_str()); pRuntime->EndBlock(); @@ -1696,7 +1696,7 @@ FX_BOOL Document::gotoNamedDest(IJS_Context* cc, } pRuntime->BeginBlock(); - CPDFSDK_Environment* pApp = m_pDocument->GetEnv(); + CPDFSDK_FormFillEnvironment* pApp = m_pDocument->GetEnv(); pApp->DoGoToAction(dest.GetPageIndex(pDocument), dest.GetZoomMode(), scrollPositionArray.get(), scrollPositionArraySize); pRuntime->EndBlock(); diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp index 241f5a1865..fa2ac70aa5 100644 --- a/fpdfsdk/javascript/Field.cpp +++ b/fpdfsdk/javascript/Field.cpp @@ -16,7 +16,7 @@ #include "core/fpdfapi/parser/cpdf_document.h" #include "core/fpdfdoc/cpdf_interform.h" #include "fpdfsdk/cpdfsdk_document.h" -#include "fpdfsdk/cpdfsdk_environment.h" +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_interform.h" #include "fpdfsdk/cpdfsdk_pageview.h" #include "fpdfsdk/cpdfsdk_widget.h" @@ -2835,7 +2835,7 @@ FX_BOOL Field::browseForFileToSubmit(IJS_Context* cc, return FALSE; CPDF_FormField* pFormField = FieldArray[0]; - CPDFSDK_Environment* pApp = m_pDocument->GetEnv(); + CPDFSDK_FormFillEnvironment* pApp = m_pDocument->GetEnv(); if ((pFormField->GetFieldFlags() & FIELDFLAG_FILESELECT) && (pFormField->GetFieldType() == FIELDTYPE_TEXTFIELD)) { CFX_WideString wsFileName = pApp->JS_fieldBrowse(); @@ -3202,7 +3202,7 @@ FX_BOOL Field::setFocus(IJS_Context* cc, if (nCount == 1) { pWidget = pInterForm->GetWidget(pFormField->GetControl(0), false); } else { - CPDFSDK_Environment* pEnv = m_pDocument->GetEnv(); + CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetEnv(); UnderlyingPageType* pPage = UnderlyingFromFPDFPage( pEnv->GetCurrentPage(m_pDocument->GetUnderlyingDocument())); if (!pPage) diff --git a/fpdfsdk/javascript/JS_GlobalData.cpp b/fpdfsdk/javascript/JS_GlobalData.cpp index c07fe24741..4e3782ec20 100644 --- a/fpdfsdk/javascript/JS_GlobalData.cpp +++ b/fpdfsdk/javascript/JS_GlobalData.cpp @@ -40,7 +40,8 @@ CJS_GlobalData* g_pInstance = nullptr; } // namespace // static -CJS_GlobalData* CJS_GlobalData::GetRetainedInstance(CPDFSDK_Environment* pApp) { +CJS_GlobalData* CJS_GlobalData::GetRetainedInstance( + CPDFSDK_FormFillEnvironment* pApp) { if (!g_pInstance) { g_pInstance = new CJS_GlobalData(); } diff --git a/fpdfsdk/javascript/JS_GlobalData.h b/fpdfsdk/javascript/JS_GlobalData.h index 38ab9256f9..7005134423 100644 --- a/fpdfsdk/javascript/JS_GlobalData.h +++ b/fpdfsdk/javascript/JS_GlobalData.h @@ -13,7 +13,7 @@ #include "core/fxcrt/fx_basic.h" #include "fpdfsdk/javascript/JS_KeyValue.h" -class CPDFSDK_Environment; +class CPDFSDK_FormFillEnvironment; class CJS_GlobalData_Element { public: @@ -26,7 +26,7 @@ class CJS_GlobalData_Element { class CJS_GlobalData { public: - static CJS_GlobalData* GetRetainedInstance(CPDFSDK_Environment* pApp); + static CJS_GlobalData* GetRetainedInstance(CPDFSDK_FormFillEnvironment* pApp); void Release(); void SetGlobalVariableNumber(const CFX_ByteString& propname, double dData); diff --git a/fpdfsdk/javascript/JS_Object.h b/fpdfsdk/javascript/JS_Object.h index 1f619181f3..c6491e27a0 100644 --- a/fpdfsdk/javascript/JS_Object.h +++ b/fpdfsdk/javascript/JS_Object.h @@ -16,7 +16,7 @@ class CJS_Context; class CJS_Object; -class CPDFSDK_Environment; +class CPDFSDK_FormFillEnvironment; class CJS_EmbedObj { public: diff --git a/fpdfsdk/javascript/JS_Runtime_Stub.cpp b/fpdfsdk/javascript/JS_Runtime_Stub.cpp index 8d8ac33474..ec52a8b6a0 100644 --- a/fpdfsdk/javascript/JS_Runtime_Stub.cpp +++ b/fpdfsdk/javascript/JS_Runtime_Stub.cpp @@ -164,6 +164,6 @@ void IJS_Runtime::Initialize(unsigned int slot, void* isolate) {} void IJS_Runtime::Destroy() {} // static -IJS_Runtime* IJS_Runtime::Create(CPDFSDK_Environment* pEnv) { +IJS_Runtime* IJS_Runtime::Create(CPDFSDK_FormFillEnvironment* pEnv) { return new CJS_RuntimeStub; } diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp index 106f27e870..3e2bc06f23 100644 --- a/fpdfsdk/javascript/PublicMethods.cpp +++ b/fpdfsdk/javascript/PublicMethods.cpp @@ -12,7 +12,7 @@ #include "core/fpdfdoc/cpdf_interform.h" #include "core/fxcrt/fx_ext.h" #include "fpdfsdk/cpdfsdk_document.h" -#include "fpdfsdk/cpdfsdk_environment.h" +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_interform.h" #include "fpdfsdk/javascript/Field.h" #include "fpdfsdk/javascript/JS_Define.h" @@ -80,7 +80,7 @@ CFX_WideString StrTrim(const CFX_WideString& pStr) { } void AlertIfPossible(CJS_Context* pContext, const FX_WCHAR* swMsg) { - CPDFSDK_Environment* pEnv = pContext->GetReaderEnv(); + CPDFSDK_FormFillEnvironment* pEnv = pContext->GetReaderEnv(); if (pEnv) pEnv->JS_appAlert(swMsg, nullptr, 0, 3); } diff --git a/fpdfsdk/javascript/app.cpp b/fpdfsdk/javascript/app.cpp index 55f976e522..d4f06af144 100644 --- a/fpdfsdk/javascript/app.cpp +++ b/fpdfsdk/javascript/app.cpp @@ -10,7 +10,7 @@ #include #include "fpdfsdk/cpdfsdk_document.h" -#include "fpdfsdk/cpdfsdk_environment.h" +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_interform.h" #include "fpdfsdk/javascript/Document.h" #include "fpdfsdk/javascript/JS_Define.h" @@ -25,7 +25,7 @@ class GlobalTimer { public: GlobalTimer(app* pObj, - CPDFSDK_Environment* pEnv, + CPDFSDK_FormFillEnvironment* pEnv, CJS_Runtime* pRuntime, int nType, const CFX_WideString& script, @@ -55,11 +55,11 @@ class GlobalTimer { const uint32_t m_dwTimeOut; const CFX_WideString m_swJScript; CJS_Runtime::ObservedPtr m_pRuntime; - CPDFSDK_Environment* const m_pEnv; + CPDFSDK_FormFillEnvironment* const m_pEnv; }; GlobalTimer::GlobalTimer(app* pObj, - CPDFSDK_Environment* pEnv, + CPDFSDK_FormFillEnvironment* pEnv, CJS_Runtime* pRuntime, int nType, const CFX_WideString& script, @@ -217,7 +217,7 @@ FX_BOOL app::activeDocs(IJS_Context* cc, return FALSE; CJS_Context* pContext = (CJS_Context*)cc; - CPDFSDK_Environment* pEnv = pContext->GetReaderEnv(); + CPDFSDK_FormFillEnvironment* pEnv = pContext->GetReaderEnv(); CJS_Runtime* pRuntime = pContext->GetJSRuntime(); CPDFSDK_Document* pCurDoc = pContext->GetReaderDocument(); CJS_Array aDocs; @@ -255,7 +255,7 @@ FX_BOOL app::calculate(IJS_Context* cc, m_bCalculate = (FX_BOOL)bVP; CJS_Context* pContext = (CJS_Context*)cc; - CPDFSDK_Environment* pEnv = pContext->GetReaderEnv(); + CPDFSDK_FormFillEnvironment* pEnv = pContext->GetReaderEnv(); if (CPDFSDK_Document* pDoc = pEnv->GetSDKDocument()) pDoc->GetInterForm()->EnableCalculate((FX_BOOL)m_bCalculate); } else { @@ -321,7 +321,7 @@ FX_BOOL app::platform(IJS_Context* cc, if (!vp.IsGetting()) return FALSE; #ifdef PDF_ENABLE_XFA - CPDFSDK_Environment* pEnv = + CPDFSDK_FormFillEnvironment* pEnv = static_cast(cc)->GetJSRuntime()->GetReaderEnv(); if (!pEnv) return FALSE; @@ -341,7 +341,7 @@ FX_BOOL app::language(IJS_Context* cc, if (!vp.IsGetting()) return FALSE; #ifdef PDF_ENABLE_XFA - CPDFSDK_Environment* pEnv = + CPDFSDK_FormFillEnvironment* pEnv = static_cast(cc)->GetJSRuntime()->GetReaderEnv(); if (!pEnv) return FALSE; @@ -358,7 +358,7 @@ FX_BOOL app::language(IJS_Context* cc, // creates a new fdf object that contains no data // comment: need reader support // note: -// CFDF_Document * CPDFSDK_Environment::NewFDF(); +// CFDF_Document * CPDFSDK_FormFillEnvironment::NewFDF(); FX_BOOL app::newFDF(IJS_Context* cc, const std::vector& params, CJS_Value& vRet, @@ -369,7 +369,8 @@ FX_BOOL app::newFDF(IJS_Context* cc, // comment:need reader support // note: as defined in js reference, the proto of this function's fourth // parmeters, how old an fdf document while do not show it. -// CFDF_Document * CPDFSDK_Environment::OpenFDF(string strPath,bool bUserConv); +// CFDF_Document * CPDFSDK_FormFillEnvironment::OpenFDF(string strPath,bool +// bUserConv); FX_BOOL app::openFDF(IJS_Context* cc, const std::vector& params, @@ -391,7 +392,7 @@ FX_BOOL app::alert(IJS_Context* cc, return FALSE; } - CPDFSDK_Environment* pEnv = pRuntime->GetReaderEnv(); + CPDFSDK_FormFillEnvironment* pEnv = pRuntime->GetReaderEnv(); if (!pEnv) { vRet = CJS_Value(pRuntime, 0); return TRUE; @@ -447,7 +448,7 @@ FX_BOOL app::beep(IJS_Context* cc, CFX_WideString& sError) { if (params.size() == 1) { CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); - CPDFSDK_Environment* pEnv = pRuntime->GetReaderEnv(); + CPDFSDK_FormFillEnvironment* pEnv = pRuntime->GetReaderEnv(); pEnv->JS_appBeep(params[0].ToInt(pRuntime)); return TRUE; } @@ -492,7 +493,7 @@ FX_BOOL app::setInterval(IJS_Context* cc, } uint32_t dwInterval = params.size() > 1 ? params[1].ToInt(pRuntime) : 1000; - CPDFSDK_Environment* pEnv = pRuntime->GetReaderEnv(); + CPDFSDK_FormFillEnvironment* pEnv = pRuntime->GetReaderEnv(); GlobalTimer* timerRef = new GlobalTimer(this, pEnv, pRuntime, 0, script, dwInterval, 0); @@ -526,7 +527,7 @@ FX_BOOL app::setTimeOut(IJS_Context* cc, } uint32_t dwTimeOut = params.size() > 1 ? params[1].ToInt(pRuntime) : 1000; - CPDFSDK_Environment* pEnv = pRuntime->GetReaderEnv(); + CPDFSDK_FormFillEnvironment* pEnv = pRuntime->GetReaderEnv(); GlobalTimer* timerRef = new GlobalTimer(this, pEnv, pRuntime, 1, script, dwTimeOut, dwTimeOut); diff --git a/fpdfsdk/javascript/cjs_context.cpp b/fpdfsdk/javascript/cjs_context.cpp index 3f13cd3dc1..89a8a34fd4 100644 --- a/fpdfsdk/javascript/cjs_context.cpp +++ b/fpdfsdk/javascript/cjs_context.cpp @@ -21,7 +21,7 @@ CPDFSDK_Document* CJS_Context::GetReaderDocument() { return m_pRuntime->GetReaderDocument(); } -CPDFSDK_Environment* CJS_Context::GetReaderEnv() { +CPDFSDK_FormFillEnvironment* CJS_Context::GetReaderEnv() { return m_pRuntime->GetReaderEnv(); } diff --git a/fpdfsdk/javascript/cjs_context.h b/fpdfsdk/javascript/cjs_context.h index ef65486269..74d4e661c3 100644 --- a/fpdfsdk/javascript/cjs_context.h +++ b/fpdfsdk/javascript/cjs_context.h @@ -15,7 +15,7 @@ class CJS_EventHandler; class CJS_Runtime; -class CPDFSDK_Environment; +class CPDFSDK_FormFillEnvironment; class CJS_Context : public IJS_Context { public: @@ -125,7 +125,7 @@ class CJS_Context : public IJS_Context { CJS_Runtime* GetJSRuntime() const { return m_pRuntime; } CJS_EventHandler* GetEventHandler() const { return m_pEventHandler.get(); } - CPDFSDK_Environment* GetReaderEnv(); + CPDFSDK_FormFillEnvironment* GetReaderEnv(); CPDFSDK_Document* GetReaderDocument(); private: diff --git a/fpdfsdk/javascript/cjs_runtime.cpp b/fpdfsdk/javascript/cjs_runtime.cpp index b10e5a6ed9..af70dd17cc 100644 --- a/fpdfsdk/javascript/cjs_runtime.cpp +++ b/fpdfsdk/javascript/cjs_runtime.cpp @@ -8,7 +8,7 @@ #include -#include "fpdfsdk/cpdfsdk_environment.h" +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/javascript/Annot.h" #include "fpdfsdk/javascript/Consts.h" #include "fpdfsdk/javascript/Document.h" @@ -47,7 +47,7 @@ void IJS_Runtime::Destroy() { } // static -IJS_Runtime* IJS_Runtime::Create(CPDFSDK_Environment* pEnv) { +IJS_Runtime* IJS_Runtime::Create(CPDFSDK_FormFillEnvironment* pEnv) { return new CJS_Runtime(pEnv); } @@ -63,7 +63,7 @@ CJS_Runtime* CJS_Runtime::CurrentRuntimeFromIsolate(v8::Isolate* pIsolate) { CFXJS_Engine::CurrentEngineFromIsolate(pIsolate)); } -CJS_Runtime::CJS_Runtime(CPDFSDK_Environment* pEnv) +CJS_Runtime::CJS_Runtime(CPDFSDK_FormFillEnvironment* pEnv) : m_pEnv(pEnv), m_pDocument(nullptr), m_bBlocking(false), diff --git a/fpdfsdk/javascript/cjs_runtime.h b/fpdfsdk/javascript/cjs_runtime.h index 3ad2e0fed5..2b075afa01 100644 --- a/fpdfsdk/javascript/cjs_runtime.h +++ b/fpdfsdk/javascript/cjs_runtime.h @@ -30,7 +30,7 @@ class CJS_Runtime : public IJS_Runtime, static CJS_Runtime* FromContext(const IJS_Context* cc); static CJS_Runtime* CurrentRuntimeFromIsolate(v8::Isolate* pIsolate); - explicit CJS_Runtime(CPDFSDK_Environment* pApp); + explicit CJS_Runtime(CPDFSDK_FormFillEnvironment* pApp); ~CJS_Runtime() override; // IJS_Runtime @@ -42,7 +42,7 @@ class CJS_Runtime : public IJS_Runtime, int ExecuteScript(const CFX_WideString& script, CFX_WideString* info) override; - CPDFSDK_Environment* GetReaderEnv() const { return m_pEnv; } + CPDFSDK_FormFillEnvironment* GetReaderEnv() const { return m_pEnv; } // Returns true if the event isn't already found in the set. bool AddEventToSet(const FieldEvent& event); @@ -63,7 +63,7 @@ class CJS_Runtime : public IJS_Runtime, void DefineJSObjects(); std::vector> m_ContextArray; - CPDFSDK_Environment* const m_pEnv; + CPDFSDK_FormFillEnvironment* const m_pEnv; CPDFSDK_Document* m_pDocument; bool m_bBlocking; bool m_isolateManaged; diff --git a/fpdfsdk/javascript/global.cpp b/fpdfsdk/javascript/global.cpp index 144b5ee42a..78da7038b8 100644 --- a/fpdfsdk/javascript/global.cpp +++ b/fpdfsdk/javascript/global.cpp @@ -56,7 +56,7 @@ JSGlobalAlternate::~JSGlobalAlternate() { m_pGlobalData->Release(); } -void JSGlobalAlternate::Initial(CPDFSDK_Environment* pEnv) { +void JSGlobalAlternate::Initial(CPDFSDK_FormFillEnvironment* pEnv) { m_pEnv = pEnv; m_pGlobalData = CJS_GlobalData::GetRetainedInstance(pEnv); UpdateGlobalPersistentVariables(); diff --git a/fpdfsdk/javascript/global.h b/fpdfsdk/javascript/global.h index 6a104be60f..6240fbfd4f 100644 --- a/fpdfsdk/javascript/global.h +++ b/fpdfsdk/javascript/global.h @@ -47,7 +47,7 @@ class JSGlobalAlternate : public CJS_EmbedObj { FX_BOOL DelProperty(IJS_Context* cc, const FX_WCHAR* propname, CFX_WideString& sError); - void Initial(CPDFSDK_Environment* pEnv); + void Initial(CPDFSDK_FormFillEnvironment* pEnv); private: void UpdateGlobalPersistentVariables(); @@ -68,7 +68,7 @@ class JSGlobalAlternate : public CJS_EmbedObj { std::map m_mapGlobal; CFX_WideString m_sFilePath; CJS_GlobalData* m_pGlobalData; - CPDFSDK_Environment* m_pEnv; + CPDFSDK_FormFillEnvironment* m_pEnv; }; class CJS_Global : public CJS_Object { diff --git a/fpdfsdk/javascript/ijs_runtime.h b/fpdfsdk/javascript/ijs_runtime.h index 0c2bd042c6..e656545b56 100644 --- a/fpdfsdk/javascript/ijs_runtime.h +++ b/fpdfsdk/javascript/ijs_runtime.h @@ -14,7 +14,7 @@ #include "fxjs/fxjse.h" #endif // PDF_ENABLE_XFA -class CPDFSDK_Environment; +class CPDFSDK_FormFillEnvironment; class CPDFSDK_Document; class IJS_Context; @@ -23,7 +23,7 @@ class IJS_Runtime { public: static void Initialize(unsigned int slot, void* isolate); static void Destroy(); - static IJS_Runtime* Create(CPDFSDK_Environment* pEnv); + static IJS_Runtime* Create(CPDFSDK_FormFillEnvironment* pEnv); virtual ~IJS_Runtime() {} virtual IJS_Context* NewContext() = 0; -- cgit v1.2.3