diff options
Diffstat (limited to 'fpdfsdk/src/javascript/app.cpp')
-rw-r--r-- | fpdfsdk/src/javascript/app.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/fpdfsdk/src/javascript/app.cpp b/fpdfsdk/src/javascript/app.cpp index c3acbe6a25..3a971cf146 100644 --- a/fpdfsdk/src/javascript/app.cpp +++ b/fpdfsdk/src/javascript/app.cpp @@ -48,6 +48,9 @@ CJS_Timer* TimerObj::GetTimer() const { #define JS_STR_PLATFORM L"WIN" #define JS_STR_LANGUANGE L"ENU" #define JS_NUM_VIEWERVERSION 8 +#ifdef PDF_ENABLE_XFA +#define JS_NUM_VIEWERVERSION_XFA 11 +#endif // PDF_ENABLE_XFA #define JS_NUM_FORMSVERSION 7 BEGIN_JS_STATIC_CONST(CJS_App) @@ -197,6 +200,15 @@ FX_BOOL app::viewerVersion(IJS_Context* cc, CFX_WideString& sError) { if (!vp.IsGetting()) return FALSE; +#ifdef PDF_ENABLE_XFA + CJS_Context* pContext = (CJS_Context*)cc; + CPDFSDK_Document* pCurDoc = pContext->GetReaderDocument(); + CPDFXFA_Document* pDoc = pCurDoc->GetXFADocument(); + if (pDoc->GetDocType() == 1 || pDoc->GetDocType() == 2) { + vp << JS_NUM_VIEWERVERSION_XFA; + return TRUE; + } +#endif // PDF_ENABLE_XFA vp << JS_NUM_VIEWERVERSION; return TRUE; } @@ -206,6 +218,17 @@ FX_BOOL app::platform(IJS_Context* cc, CFX_WideString& sError) { if (!vp.IsGetting()) return FALSE; +#ifdef PDF_ENABLE_XFA + CPDFDoc_Environment* pEnv = + static_cast<CJS_Context*>(cc)->GetJSRuntime()->GetReaderApp(); + if (!pEnv) + return FALSE; + CFX_WideString platfrom = pEnv->FFI_GetPlatform(); + if (!platfrom.IsEmpty()) { + vp << platfrom; + return TRUE; + } +#endif vp << JS_STR_PLATFORM; return TRUE; } @@ -215,6 +238,17 @@ FX_BOOL app::language(IJS_Context* cc, CFX_WideString& sError) { if (!vp.IsGetting()) return FALSE; +#ifdef PDF_ENABLE_XFA + CPDFDoc_Environment* pEnv = + static_cast<CJS_Context*>(cc)->GetJSRuntime()->GetReaderApp(); + if (!pEnv) + return FALSE; + CFX_WideString language = pEnv->FFI_GetLanguage(); + if (!language.IsEmpty()) { + vp << language; + return TRUE; + } +#endif vp << JS_STR_LANGUANGE; return TRUE; } |