Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: xfa/src/fxfa/parser/xfa_script.h

Issue 1803723002: Move xfa/src up to xfa/. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #ifndef XFA_SRC_FXFA_PARSER_XFA_SCRIPT_H_
8 #define XFA_SRC_FXFA_PARSER_XFA_SCRIPT_H_
9
10 #include "xfa/include/fxfa/fxfa.h"
11 #include "xfa/include/fxfa/fxfa_objectacc.h"
12
13 #define XFA_RESOLVENODE_Children 0x0001
14 #define XFA_RESOLVENODE_Attributes 0x0004
15 #define XFA_RESOLVENODE_Properties 0x0008
16 #define XFA_RESOLVENODE_Siblings 0x0020
17 #define XFA_RESOLVENODE_Parent 0x0040
18 #define XFA_RESOLVENODE_AnyChild 0x0080
19 #define XFA_RESOLVENODE_ALL 0x0100
20 #define XFA_RESOLVENODE_CreateNode 0x0400
21 #define XFA_RESOLVENODE_Bind 0x0800
22 #define XFA_RESOLVENODE_BindNew 0x1000
23
24 enum XFA_SCRIPTLANGTYPE {
25 XFA_SCRIPTLANGTYPE_Formcalc = XFA_SCRIPTTYPE_Formcalc,
26 XFA_SCRIPTLANGTYPE_Javascript = XFA_SCRIPTTYPE_Javascript,
27 XFA_SCRIPTLANGTYPE_Unkown = XFA_SCRIPTTYPE_Unkown,
28 };
29
30 enum XFA_RESOVENODE_RSTYPE {
31 XFA_RESOVENODE_RSTYPE_Nodes,
32 XFA_RESOVENODE_RSTYPE_Attribute,
33 XFA_RESOLVENODE_RSTYPE_CreateNodeOne,
34 XFA_RESOLVENODE_RSTYPE_CreateNodeAll,
35 XFA_RESOLVENODE_RSTYPE_CreateNodeMidAll,
36 XFA_RESOVENODE_RSTYPE_ExistNodes,
37 };
38
39 class CXFA_HVALUEArray : public CFX_ArrayTemplate<FXJSE_HVALUE> {
40 public:
41 CXFA_HVALUEArray(FXJSE_HRUNTIME hRunTime) : m_hRunTime(hRunTime) {}
42 ~CXFA_HVALUEArray() {
43 for (int32_t i = 0; i < GetSize(); i++) {
44 FXJSE_Value_Release(GetAt(i));
45 }
46 }
47 void GetAttributeObject(CXFA_ObjArray& objArray) {
48 for (int32_t i = 0; i < GetSize(); i++) {
49 CXFA_Object* pObject = (CXFA_Object*)FXJSE_Value_ToObject(GetAt(i), NULL);
50 objArray.Add(pObject);
51 }
52 }
53 FXJSE_HRUNTIME m_hRunTime;
54 };
55
56 struct XFA_RESOLVENODE_RS {
57 XFA_RESOLVENODE_RS()
58 : dwFlags(XFA_RESOVENODE_RSTYPE_Nodes), pScriptAttribute(NULL) {}
59 ~XFA_RESOLVENODE_RS() { nodes.RemoveAll(); }
60 int32_t GetAttributeResult(CXFA_HVALUEArray& hValueArray) const {
61 if (pScriptAttribute && pScriptAttribute->eValueType == XFA_SCRIPT_Object) {
62 FXJSE_HRUNTIME hRunTime = hValueArray.m_hRunTime;
63 for (int32_t i = 0; i < nodes.GetSize(); i++) {
64 FXJSE_HVALUE hValue = FXJSE_Value_Create(hRunTime);
65 (nodes[i]->*(pScriptAttribute->lpfnCallback))(
66 hValue, FALSE, (XFA_ATTRIBUTE)pScriptAttribute->eAttribute);
67 hValueArray.Add(hValue);
68 }
69 }
70 return hValueArray.GetSize();
71 }
72
73 CXFA_ObjArray nodes;
74 XFA_RESOVENODE_RSTYPE dwFlags;
75 const XFA_SCRIPTATTRIBUTEINFO* pScriptAttribute;
76 };
77
78 struct XFA_JSBUILTININFO {
79 uint32_t uUnicodeHash;
80 const FX_CHAR* pName;
81 };
82
83 const XFA_JSBUILTININFO* XFA_GetJSBuiltinByHash(uint32_t uHashCode);
84
85 class IXFA_ScriptContext {
86 public:
87 virtual ~IXFA_ScriptContext() {}
88 virtual void Release() = 0;
89 virtual void Initialize(FXJSE_HRUNTIME hRuntime) = 0;
90
91 virtual void SetEventParam(CXFA_EventParam param) = 0;
92 virtual CXFA_EventParam* GetEventParam() = 0;
93 virtual FX_BOOL RunScript(XFA_SCRIPTLANGTYPE eScriptType,
94 const CFX_WideStringC& wsScript,
95 FXJSE_HVALUE hRetValue,
96 CXFA_Object* pThisObject = NULL) = 0;
97 virtual int32_t ResolveObjects(CXFA_Object* refNode,
98 const CFX_WideStringC& wsExpression,
99 XFA_RESOLVENODE_RS& resolveNodeRS,
100 FX_DWORD dwStyles = XFA_RESOLVENODE_Children,
101 CXFA_Node* bindNode = NULL) = 0;
102 virtual FXJSE_HVALUE GetJSValueFromMap(CXFA_Object* pObject) = 0;
103 virtual void CacheList(CXFA_NodeList* pList) = 0;
104 virtual CXFA_Object* GetThisObject() const = 0;
105 virtual FXJSE_HRUNTIME GetRuntime() const = 0;
106 virtual int32_t GetIndexByName(CXFA_Node* refNode) = 0;
107 virtual int32_t GetIndexByClassName(CXFA_Node* refNode) = 0;
108 virtual void GetSomExpression(CXFA_Node* refNode,
109 CFX_WideString& wsExpression) = 0;
110
111 virtual void SetNodesOfRunScript(CXFA_NodeArray* pArray) = 0;
112 virtual void AddNodesOfRunScript(const CXFA_NodeArray& nodes) = 0;
113 virtual void AddNodesOfRunScript(CXFA_Node* pNode) = 0;
114 virtual FXJSE_HCLASS GetJseNormalClass() = 0;
115 virtual XFA_SCRIPTLANGTYPE GetType() = 0;
116 virtual void SetRunAtType(XFA_ATTRIBUTEENUM eRunAt) = 0;
117 virtual FX_BOOL IsRunAtClient() = 0;
118 };
119 IXFA_ScriptContext* XFA_ScriptContext_Create(CXFA_Document* pDocument);
120
121 #endif // XFA_SRC_FXFA_PARSER_XFA_SCRIPT_H_
OLDNEW
« no previous file with comments | « xfa/src/fxfa/parser/xfa_parser_imp_embeddertest.cpp ('k') | xfa/src/fxfa/parser/xfa_script_datawindow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698