diff options
Diffstat (limited to 'fpdfsdk/javascript')
-rw-r--r-- | fpdfsdk/javascript/Document.cpp | 12 | ||||
-rw-r--r-- | fpdfsdk/javascript/Field.cpp | 6 | ||||
-rw-r--r-- | fpdfsdk/javascript/JS_GlobalData.cpp | 3 | ||||
-rw-r--r-- | fpdfsdk/javascript/JS_GlobalData.h | 4 | ||||
-rw-r--r-- | fpdfsdk/javascript/JS_Object.h | 2 | ||||
-rw-r--r-- | fpdfsdk/javascript/JS_Runtime_Stub.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/javascript/PublicMethods.cpp | 4 | ||||
-rw-r--r-- | fpdfsdk/javascript/app.cpp | 29 | ||||
-rw-r--r-- | fpdfsdk/javascript/cjs_context.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/javascript/cjs_context.h | 4 | ||||
-rw-r--r-- | fpdfsdk/javascript/cjs_runtime.cpp | 6 | ||||
-rw-r--r-- | fpdfsdk/javascript/cjs_runtime.h | 6 | ||||
-rw-r--r-- | fpdfsdk/javascript/global.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/javascript/global.h | 4 | ||||
-rw-r--r-- | fpdfsdk/javascript/ijs_runtime.h | 4 |
15 files changed, 46 insertions, 44 deletions
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 <vector> #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<CJS_Context*>(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<CJS_Context*>(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<CJS_Value>& 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<CJS_Value>& 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 <algorithm> -#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<std::unique_ptr<CJS_Context>> 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<CFX_ByteString, JSGlobalData*> 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; |