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_PARSER_XFA_SCRIPT_IMP_H_ | 7 #ifndef XFA_FXFA_PARSER_XFA_SCRIPT_IMP_H_ |
8 #define XFA_FXFA_PARSER_XFA_SCRIPT_IMP_H_ | 8 #define XFA_FXFA_PARSER_XFA_SCRIPT_IMP_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 | 11 |
12 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" | 12 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" |
13 #include "xfa/fxfa/parser/xfa_document.h" | 13 #include "xfa/fxfa/parser/xfa_document.h" |
14 #include "xfa/fxfa/parser/xfa_script.h" | 14 #include "xfa/fxfa/parser/xfa_script.h" |
15 #include "xfa/fxjse/cfxjse_arguments.h" | 15 #include "xfa/fxjse/cfxjse_arguments.h" |
16 | 16 |
17 #define XFA_RESOLVENODE_TagName 0x0002 | 17 #define XFA_RESOLVENODE_TagName 0x0002 |
18 | 18 |
19 class CXFA_ResolveProcessor; | 19 class CXFA_ResolveProcessor; |
20 | 20 |
21 class CXFA_ScriptContext : public IXFA_ScriptContext { | 21 class CXFA_ScriptContext { |
22 public: | 22 public: |
23 explicit CXFA_ScriptContext(CXFA_Document* pDocument); | 23 explicit CXFA_ScriptContext(CXFA_Document* pDocument); |
24 ~CXFA_ScriptContext(); | 24 ~CXFA_ScriptContext(); |
25 | 25 |
26 virtual void Release(); | 26 void Release(); |
27 virtual void Initialize(FXJSE_HRUNTIME hRuntime); | 27 void Initialize(FXJSE_HRUNTIME hRuntime); |
28 virtual void SetEventParam(CXFA_EventParam param) { m_eventParam = param; } | 28 void SetEventParam(CXFA_EventParam param) { m_eventParam = param; } |
29 virtual CXFA_EventParam* GetEventParam() { return &m_eventParam; } | 29 CXFA_EventParam* GetEventParam() { return &m_eventParam; } |
30 virtual FX_BOOL RunScript(XFA_SCRIPTLANGTYPE eScriptType, | 30 FX_BOOL RunScript(XFA_SCRIPTLANGTYPE eScriptType, |
31 const CFX_WideStringC& wsScript, | 31 const CFX_WideStringC& wsScript, |
32 FXJSE_HVALUE hRetValue, | 32 FXJSE_HVALUE hRetValue, |
33 CXFA_Object* pThisObject = NULL); | 33 CXFA_Object* pThisObject = NULL); |
34 | 34 |
35 virtual int32_t ResolveObjects(CXFA_Object* refNode, | 35 int32_t ResolveObjects(CXFA_Object* refNode, |
36 const CFX_WideStringC& wsExpression, | 36 const CFX_WideStringC& wsExpression, |
37 XFA_RESOLVENODE_RS& resolveNodeRS, | 37 XFA_RESOLVENODE_RS& resolveNodeRS, |
38 uint32_t dwStyles = XFA_RESOLVENODE_Children, | 38 uint32_t dwStyles = XFA_RESOLVENODE_Children, |
39 CXFA_Node* bindNode = NULL); | 39 CXFA_Node* bindNode = NULL); |
40 virtual FXJSE_HVALUE GetJSValueFromMap(CXFA_Object* pObject); | 40 FXJSE_HVALUE GetJSValueFromMap(CXFA_Object* pObject); |
41 virtual void CacheList(CXFA_NodeList* pList) { m_CacheListArray.Add(pList); } | 41 void CacheList(CXFA_NodeList* pList) { m_CacheListArray.Add(pList); } |
42 virtual CXFA_Object* GetThisObject() const { return m_pThisObject; } | 42 CXFA_Object* GetThisObject() const { return m_pThisObject; } |
43 virtual FXJSE_HRUNTIME GetRuntime() const { return m_hJsRuntime; } | 43 FXJSE_HRUNTIME GetRuntime() const { return m_hJsRuntime; } |
44 | 44 |
45 virtual int32_t GetIndexByName(CXFA_Node* refNode); | 45 int32_t GetIndexByName(CXFA_Node* refNode); |
46 virtual int32_t GetIndexByClassName(CXFA_Node* refNode); | 46 int32_t GetIndexByClassName(CXFA_Node* refNode); |
47 virtual void GetSomExpression(CXFA_Node* refNode, | 47 void GetSomExpression(CXFA_Node* refNode, CFX_WideString& wsExpression); |
48 CFX_WideString& wsExpression); | |
49 | 48 |
50 virtual void SetNodesOfRunScript(CXFA_NodeArray* pArray); | 49 void SetNodesOfRunScript(CXFA_NodeArray* pArray); |
51 virtual void AddNodesOfRunScript(const CXFA_NodeArray& nodes); | 50 void AddNodesOfRunScript(const CXFA_NodeArray& nodes); |
52 virtual void AddNodesOfRunScript(CXFA_Node* pNode); | 51 void AddNodesOfRunScript(CXFA_Node* pNode); |
53 virtual FXJSE_HCLASS GetJseNormalClass(); | 52 FXJSE_HCLASS GetJseNormalClass(); |
54 | 53 |
55 virtual void SetRunAtType(XFA_ATTRIBUTEENUM eRunAt) { m_eRunAtType = eRunAt; } | 54 void SetRunAtType(XFA_ATTRIBUTEENUM eRunAt) { m_eRunAtType = eRunAt; } |
56 virtual FX_BOOL IsRunAtClient() { | 55 FX_BOOL IsRunAtClient() { return m_eRunAtType != XFA_ATTRIBUTEENUM_Server; } |
57 return m_eRunAtType != XFA_ATTRIBUTEENUM_Server; | |
58 } | |
59 FX_BOOL QueryNodeByFlag(CXFA_Node* refNode, | 56 FX_BOOL QueryNodeByFlag(CXFA_Node* refNode, |
60 const CFX_WideStringC& propname, | 57 const CFX_WideStringC& propname, |
61 FXJSE_HVALUE hValue, | 58 FXJSE_HVALUE hValue, |
62 uint32_t dwFlag, | 59 uint32_t dwFlag, |
63 FX_BOOL bSetting); | 60 FX_BOOL bSetting); |
64 FX_BOOL QueryVariableHValue(CXFA_Node* pScriptNode, | 61 FX_BOOL QueryVariableHValue(CXFA_Node* pScriptNode, |
65 const CFX_ByteStringC& szPropName, | 62 const CFX_ByteStringC& szPropName, |
66 FXJSE_HVALUE hValue, | 63 FXJSE_HVALUE hValue, |
67 FX_BOOL bGetter); | 64 FX_BOOL bGetter); |
68 FX_BOOL QueryBuiltinHValue(const CFX_ByteStringC& szPropName, | 65 FX_BOOL QueryBuiltinHValue(const CFX_ByteStringC& szPropName, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 CFX_PtrArray m_CacheListArray; | 116 CFX_PtrArray m_CacheListArray; |
120 CXFA_NodeArray* m_pScriptNodeArray; | 117 CXFA_NodeArray* m_pScriptNodeArray; |
121 CXFA_ResolveProcessor* m_pResolveProcessor; | 118 CXFA_ResolveProcessor* m_pResolveProcessor; |
122 XFA_HFM2JSCONTEXT m_hFM2JSContext; | 119 XFA_HFM2JSCONTEXT m_hFM2JSContext; |
123 CXFA_Object* m_pThisObject; | 120 CXFA_Object* m_pThisObject; |
124 uint32_t m_dwBuiltInInFlags; | 121 uint32_t m_dwBuiltInInFlags; |
125 XFA_ATTRIBUTEENUM m_eRunAtType; | 122 XFA_ATTRIBUTEENUM m_eRunAtType; |
126 }; | 123 }; |
127 | 124 |
128 #endif // XFA_FXFA_PARSER_XFA_SCRIPT_IMP_H_ | 125 #endif // XFA_FXFA_PARSER_XFA_SCRIPT_IMP_H_ |
OLD | NEW |