OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "fpdfsdk/javascript/app.h" | 7 #include "fpdfsdk/javascript/app.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 CJS_PropValue& vp, | 250 CJS_PropValue& vp, |
251 CFX_WideString& sError) { | 251 CFX_WideString& sError) { |
252 if (vp.IsSetting()) { | 252 if (vp.IsSetting()) { |
253 bool bVP; | 253 bool bVP; |
254 vp >> bVP; | 254 vp >> bVP; |
255 m_bCalculate = (FX_BOOL)bVP; | 255 m_bCalculate = (FX_BOOL)bVP; |
256 | 256 |
257 CJS_Context* pContext = (CJS_Context*)cc; | 257 CJS_Context* pContext = (CJS_Context*)cc; |
258 CPDFSDK_FormFillEnvironment* pEnv = pContext->GetReaderEnv(); | 258 CPDFSDK_FormFillEnvironment* pEnv = pContext->GetReaderEnv(); |
259 if (CPDFSDK_Document* pDoc = pEnv->GetSDKDocument()) | 259 if (CPDFSDK_Document* pDoc = pEnv->GetSDKDocument()) |
260 pDoc->GetInterForm()->EnableCalculate((FX_BOOL)m_bCalculate); | 260 pDoc->GetEnv()->GetInterForm()->EnableCalculate((FX_BOOL)m_bCalculate); |
261 } else { | 261 } else { |
262 vp << (bool)m_bCalculate; | 262 vp << (bool)m_bCalculate; |
263 } | 263 } |
264 return TRUE; | 264 return TRUE; |
265 } | 265 } |
266 | 266 |
267 FX_BOOL app::formsVersion(IJS_Context* cc, | 267 FX_BOOL app::formsVersion(IJS_Context* cc, |
268 CJS_PropValue& vp, | 268 CJS_PropValue& vp, |
269 CFX_WideString& sError) { | 269 CFX_WideString& sError) { |
270 if (vp.IsGetting()) { | 270 if (vp.IsGetting()) { |
(...skipping 27 matching lines...) Expand all Loading... |
298 } | 298 } |
299 | 299 |
300 FX_BOOL app::viewerVersion(IJS_Context* cc, | 300 FX_BOOL app::viewerVersion(IJS_Context* cc, |
301 CJS_PropValue& vp, | 301 CJS_PropValue& vp, |
302 CFX_WideString& sError) { | 302 CFX_WideString& sError) { |
303 if (!vp.IsGetting()) | 303 if (!vp.IsGetting()) |
304 return FALSE; | 304 return FALSE; |
305 #ifdef PDF_ENABLE_XFA | 305 #ifdef PDF_ENABLE_XFA |
306 CJS_Context* pContext = (CJS_Context*)cc; | 306 CJS_Context* pContext = (CJS_Context*)cc; |
307 CPDFSDK_Document* pCurDoc = pContext->GetReaderDocument(); | 307 CPDFSDK_Document* pCurDoc = pContext->GetReaderDocument(); |
308 CPDFXFA_Document* pDoc = pCurDoc->GetXFADocument(); | 308 CPDFXFA_Document* pDoc = pCurDoc->GetEnv()->GetXFADocument(); |
309 if (pDoc->GetDocType() == 1 || pDoc->GetDocType() == 2) { | 309 if (pDoc->GetDocType() == 1 || pDoc->GetDocType() == 2) { |
310 vp << JS_NUM_VIEWERVERSION_XFA; | 310 vp << JS_NUM_VIEWERVERSION_XFA; |
311 return TRUE; | 311 return TRUE; |
312 } | 312 } |
313 #endif // PDF_ENABLE_XFA | 313 #endif // PDF_ENABLE_XFA |
314 vp << JS_NUM_VIEWERVERSION; | 314 vp << JS_NUM_VIEWERVERSION; |
315 return TRUE; | 315 return TRUE; |
316 } | 316 } |
317 | 317 |
318 FX_BOOL app::platform(IJS_Context* cc, | 318 FX_BOOL app::platform(IJS_Context* cc, |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 FX_BOOL app::media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { | 813 FX_BOOL app::media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { |
814 return FALSE; | 814 return FALSE; |
815 } | 815 } |
816 | 816 |
817 FX_BOOL app::execDialog(IJS_Context* cc, | 817 FX_BOOL app::execDialog(IJS_Context* cc, |
818 const std::vector<CJS_Value>& params, | 818 const std::vector<CJS_Value>& params, |
819 CJS_Value& vRet, | 819 CJS_Value& vRet, |
820 CFX_WideString& sError) { | 820 CFX_WideString& sError) { |
821 return TRUE; | 821 return TRUE; |
822 } | 822 } |
OLD | NEW |