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 #ifndef XFA_FXFA_FM2JS_XFA_FM2JSCONTEXT_H_ | 7 #ifndef XFA_FXFA_FM2JS_XFA_FM2JSCONTEXT_H_ |
8 #define XFA_FXFA_FM2JS_XFA_FM2JSCONTEXT_H_ | 8 #define XFA_FXFA_FM2JS_XFA_FM2JSCONTEXT_H_ |
9 | 9 |
10 #include "xfa/fxfa/parser/xfa_script.h" | 10 #include "xfa/fxfa/parser/xfa_script.h" |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 | 424 |
425 static std::unique_ptr<CFXJSE_Value> GetSimpleValue(CFXJSE_Value* pThis, | 425 static std::unique_ptr<CFXJSE_Value> GetSimpleValue(CFXJSE_Value* pThis, |
426 CFXJSE_Arguments& args, | 426 CFXJSE_Arguments& args, |
427 uint32_t index); | 427 uint32_t index); |
428 static FX_BOOL ValueIsNull(CFXJSE_Value* pThis, CFXJSE_Value* pValue); | 428 static FX_BOOL ValueIsNull(CFXJSE_Value* pThis, CFXJSE_Value* pValue); |
429 static int32_t ValueToInteger(CFXJSE_Value* pThis, CFXJSE_Value* pValue); | 429 static int32_t ValueToInteger(CFXJSE_Value* pThis, CFXJSE_Value* pValue); |
430 static FX_FLOAT ValueToFloat(CFXJSE_Value* pThis, CFXJSE_Value* pValue); | 430 static FX_FLOAT ValueToFloat(CFXJSE_Value* pThis, CFXJSE_Value* pValue); |
431 static FX_DOUBLE ValueToDouble(CFXJSE_Value* pThis, CFXJSE_Value* pValue); | 431 static FX_DOUBLE ValueToDouble(CFXJSE_Value* pThis, CFXJSE_Value* pValue); |
432 static void ValueToUTF8String(CFXJSE_Value* pValue, | 432 static void ValueToUTF8String(CFXJSE_Value* pValue, |
433 CFX_ByteString& outputValue); | 433 CFX_ByteString& outputValue); |
| 434 static double ExtractDouble(CFXJSE_Value* pThis, |
| 435 CFXJSE_Value* src, |
| 436 bool* ret); |
434 | 437 |
435 static int32_t Translate(const CFX_WideStringC& wsFormcalc, | 438 static int32_t Translate(const CFX_WideStringC& wsFormcalc, |
436 CFX_WideTextBuf& wsJavascript, | 439 CFX_WideTextBuf& wsJavascript, |
437 CFX_WideString& wsError); | 440 CFX_WideString& wsError); |
438 | 441 |
439 CXFA_FM2JSContext(v8::Isolate* pScriptIsolate, | 442 CXFA_FM2JSContext(v8::Isolate* pScriptIsolate, |
440 CFXJSE_Context* pScriptContext, | 443 CFXJSE_Context* pScriptContext, |
441 CXFA_Document* pDoc); | 444 CXFA_Document* pDoc); |
442 ~CXFA_FM2JSContext(); | 445 ~CXFA_FM2JSContext(); |
443 | 446 |
444 void GlobalPropertyGetter(CFXJSE_Value* pValue); | 447 void GlobalPropertyGetter(CFXJSE_Value* pValue); |
445 | 448 |
446 private: | 449 private: |
447 v8::Isolate* GetScriptRuntime() const { return m_pIsolate; } | 450 v8::Isolate* GetScriptRuntime() const { return m_pIsolate; } |
448 CXFA_Document* GetDocument() const { return m_pDocument; } | 451 CXFA_Document* GetDocument() const { return m_pDocument; } |
449 void ThrowScriptErrorMessage(int32_t iStringID, ...); | 452 void ThrowScriptErrorMessage(int32_t iStringID, ...); |
450 | 453 |
451 v8::Isolate* m_pIsolate; | 454 v8::Isolate* m_pIsolate; |
452 CFXJSE_Class* m_pFMClass; | 455 CFXJSE_Class* m_pFMClass; |
453 std::unique_ptr<CFXJSE_Value> m_pValue; | 456 std::unique_ptr<CFXJSE_Value> m_pValue; |
454 CXFA_Document* const m_pDocument; | 457 CXFA_Document* const m_pDocument; |
455 }; | 458 }; |
456 | 459 |
457 #endif // XFA_FXFA_FM2JS_XFA_FM2JSCONTEXT_H_ | 460 #endif // XFA_FXFA_FM2JS_XFA_FM2JSCONTEXT_H_ |
OLD | NEW |