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

Side by Side Diff: xfa/src/fxfa/parser/xfa_object.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
« no previous file with comments | « xfa/src/fxfa/parser/xfa_localevalue.cpp ('k') | xfa/src/fxfa/parser/xfa_object_imp.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_OBJECT_H_
8 #define XFA_SRC_FXFA_PARSER_XFA_OBJECT_H_
9
10 #include "xfa/src/fde/xml/fde_xml.h"
11 #include "xfa/src/fxfa/parser/xfa_utils.h"
12
13 class CXFA_Document;
14 class CXFA_Node;
15 class CXFA_NodeList;
16 class CXFA_OrdinaryObject;
17
18 enum XFA_OBJECTTYPE {
19 XFA_OBJECTTYPE_OrdinaryObject = 0x0,
20 XFA_OBJECTTYPE_OrdinaryList = 0x1,
21 XFA_OBJECTTYPE_NodeList = 0x2,
22 XFA_OBJECTTYPE_Node = 0x4,
23 XFA_OBJECTTYPE_NodeC = 0x5,
24 XFA_OBJECTTYPE_NodeV = 0x6,
25 XFA_OBJECTTYPE_ModelNode = 0x8,
26 XFA_OBJECTTYPE_TextNode = 0x9,
27 XFA_OBJECTTYPE_ContainerNode = 0xA,
28 XFA_OBJECTTYPE_ContentNode = 0xB,
29 XFA_OBJECTTYPE_VariablesThis = 0xC,
30 XFA_OBJECTTYPEMASK = 0xF,
31 XFA_NODEFLAG_Initialized = 0x00020,
32 XFA_NODEFLAG_HasRemoved = 0x00200,
33 XFA_NODEFLAG_NeedsInitApp = 0x00400,
34 XFA_NODEFLAG_BindFormItems = 0x00800,
35 XFA_NODEFLAG_UserInteractive = 0x01000,
36 XFA_NODEFLAG_SkipDataBinding = 0x02000,
37 XFA_NODEFLAG_OwnXMLNode = 0x04000,
38 XFA_NODEFLAG_UnusedNode = 0x08000,
39 XFA_NODEFLAG_LayoutGeneratedNode = 0x10000,
40 };
41 class CXFA_Object {
42 public:
43 CXFA_Object(CXFA_Document* pDocument, FX_DWORD uFlags);
44 CXFA_Document* GetDocument() const { return m_pDocument; }
45 FX_DWORD GetFlag() const { return m_uFlags; }
46 XFA_OBJECTTYPE GetObjectType() const {
47 return (XFA_OBJECTTYPE)(m_uFlags & XFA_OBJECTTYPEMASK);
48 }
49
50 FX_BOOL IsNode() const {
51 return (m_uFlags & XFA_OBJECTTYPEMASK) >= XFA_OBJECTTYPE_Node;
52 }
53 FX_BOOL IsOrdinaryObject() const {
54 return (m_uFlags & XFA_OBJECTTYPEMASK) == XFA_OBJECTTYPE_OrdinaryObject;
55 }
56 FX_BOOL IsNodeList() const {
57 return (m_uFlags & XFA_OBJECTTYPEMASK) == XFA_OBJECTTYPE_NodeList;
58 }
59 FX_BOOL IsOrdinaryList() const {
60 return (m_uFlags & XFA_OBJECTTYPEMASK) == XFA_OBJECTTYPE_OrdinaryList;
61 }
62 FX_BOOL IsContentNode() const {
63 return (m_uFlags & XFA_OBJECTTYPEMASK) == XFA_OBJECTTYPE_ContentNode;
64 }
65 FX_BOOL IsContainerNode() const {
66 return (m_uFlags & XFA_OBJECTTYPEMASK) == XFA_OBJECTTYPE_ContainerNode;
67 }
68
69 CXFA_Node* AsNode();
70 CXFA_OrdinaryObject* AsOrdinaryObject();
71 CXFA_NodeList* AsNodeList();
72
73 const CXFA_Node* AsNode() const;
74 const CXFA_OrdinaryObject* AsOrdinaryObject() const;
75 const CXFA_NodeList* AsNodeList() const;
76
77 XFA_ELEMENT GetClassID() const;
78 void GetClassName(CFX_WideStringC& wsName) const;
79 uint32_t GetClassHashCode() const;
80 void Script_ObjectClass_ClassName(FXJSE_HVALUE hValue,
81 FX_BOOL bSetting,
82 XFA_ATTRIBUTE eAttribute);
83 void ThrowScriptErrorMessage(int32_t iStringID, ...);
84
85 protected:
86 CXFA_Document* const m_pDocument;
87 FX_DWORD m_uFlags;
88 };
89
90 #define XFA_NODEFILTER_Children 0x01
91 #define XFA_NODEFILTER_Properties 0x02
92 #define XFA_NODEFILTER_OneOfProperty 0x04
93 #define XFA_CLONEFLAG_Content 0x01
94 enum XFA_NODEITEM {
95 XFA_NODEITEM_Parent,
96 XFA_NODEITEM_FirstChild,
97 XFA_NODEITEM_NextSibling,
98 XFA_NODEITEM_PrevSibling,
99 };
100 enum XFA_SOM_MESSAGETYPE {
101 XFA_SOM_ValidationMessage,
102 XFA_SOM_FormatMessage,
103 XFA_SOM_MandatoryMessage
104 };
105
106 typedef CFX_ArrayTemplate<CXFA_Node*> CXFA_NodeArray;
107 typedef CFX_StackTemplate<CXFA_Node*> CXFA_NodeStack;
108 typedef CXFA_PtrSetTemplate<CXFA_Node*> CXFA_NodeSet;
109 typedef void (*PD_CALLBACK_DUPLICATEDATA)(void*& pData);
110
111 struct XFA_MAPDATABLOCKCALLBACKINFO {
112 PD_CALLBACK_FREEDATA pFree;
113 PD_CALLBACK_DUPLICATEDATA pCopy;
114 };
115
116 struct XFA_MAPDATABLOCK {
117 uint8_t* GetData() const { return (uint8_t*)this + sizeof(XFA_MAPDATABLOCK); }
118 XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo;
119 int32_t iBytes;
120 };
121
122 struct XFA_MAPMODULEDATA {
123 CFX_MapPtrToPtr m_ValueMap;
124 CFX_MapPtrTemplate<void*, XFA_MAPDATABLOCK*> m_BufferMap;
125 };
126
127 #define XFA_CalcRefCount (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'R')
128 #define XFA_CalcData (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'C')
129 #define XFA_LAYOUTITEMKEY (void*)(uintptr_t) FXBSTR_ID('L', 'Y', 'I', 'M')
130 class CXFA_Node : public CXFA_Object {
131 public:
132 XFA_ELEMENT GetClassID() const { return (XFA_ELEMENT)m_eNodeClass; }
133 FX_DWORD GetPacketID() const { return m_ePacket; }
134 FX_BOOL HasFlag(FX_DWORD dwFlag) const;
135 void SetFlag(FX_DWORD dwFlag, FX_BOOL bOn = TRUE, FX_BOOL bNotify = TRUE);
136 FX_BOOL IsAttributeInXML();
137 FX_BOOL IsFormContainer() {
138 return m_ePacket == XFA_XDPPACKET_Form && IsContainerNode();
139 }
140 void SetXMLMappingNode(IFDE_XMLNode* pXMLNode) { m_pXMLNode = pXMLNode; }
141 IFDE_XMLNode* GetXMLMappingNode() const { return m_pXMLNode; }
142 IFDE_XMLNode* CreateXMLMappingNode();
143 FX_BOOL IsNeedSavingXMLNode();
144 FX_DWORD GetNameHash() const { return m_dwNameHash; }
145 bool IsUnnamed() const { return m_dwNameHash == 0; }
146 CXFA_Node* GetModelNode();
147 void UpdateNameHash();
148 FX_BOOL HasAttribute(XFA_ATTRIBUTE eAttr, FX_BOOL bCanInherit = FALSE);
149 FX_BOOL SetAttribute(XFA_ATTRIBUTE eAttr,
150 const CFX_WideStringC& wsValue,
151 FX_BOOL bNotify = FALSE);
152 FX_BOOL GetAttribute(XFA_ATTRIBUTE eAttr,
153 CFX_WideString& wsValue,
154 FX_BOOL bUseDefault = TRUE);
155 FX_BOOL SetAttribute(const CFX_WideStringC& wsAttr,
156 const CFX_WideStringC& wsValue,
157 FX_BOOL bNotify = FALSE);
158 FX_BOOL GetAttribute(const CFX_WideStringC& wsAttr,
159 CFX_WideString& wsValue,
160 FX_BOOL bUseDefault = TRUE);
161 FX_BOOL RemoveAttribute(const CFX_WideStringC& wsAttr);
162 FX_BOOL SetContent(const CFX_WideString& wsContent,
163 const CFX_WideString& wsXMLValue,
164 FX_BOOL bNotify = FALSE,
165 FX_BOOL bScriptModify = FALSE,
166 FX_BOOL bSyncData = TRUE);
167 FX_BOOL TryContent(CFX_WideString& wsContent,
168 FX_BOOL bScriptModify = FALSE,
169 FX_BOOL bProto = TRUE);
170 CFX_WideString GetContent();
171
172 FX_BOOL TryNamespace(CFX_WideString& wsNamespace);
173
174 FX_BOOL SetBoolean(XFA_ATTRIBUTE eAttr,
175 FX_BOOL bValue,
176 FX_BOOL bNotify = FALSE) {
177 return SetValue(eAttr, XFA_ATTRIBUTETYPE_Boolean, (void*)(uintptr_t)bValue,
178 bNotify);
179 }
180 FX_BOOL TryBoolean(XFA_ATTRIBUTE eAttr,
181 FX_BOOL& bValue,
182 FX_BOOL bUseDefault = TRUE);
183 FX_BOOL GetBoolean(XFA_ATTRIBUTE eAttr) {
184 FX_BOOL bValue;
185 return TryBoolean(eAttr, bValue, TRUE) ? bValue : FALSE;
186 }
187 FX_BOOL SetInteger(XFA_ATTRIBUTE eAttr,
188 int32_t iValue,
189 FX_BOOL bNotify = FALSE) {
190 return SetValue(eAttr, XFA_ATTRIBUTETYPE_Integer, (void*)(uintptr_t)iValue,
191 bNotify);
192 }
193 FX_BOOL TryInteger(XFA_ATTRIBUTE eAttr,
194 int32_t& iValue,
195 FX_BOOL bUseDefault = TRUE);
196 int32_t GetInteger(XFA_ATTRIBUTE eAttr) {
197 int32_t iValue;
198 return TryInteger(eAttr, iValue, TRUE) ? iValue : 0;
199 }
200 FX_BOOL SetEnum(XFA_ATTRIBUTE eAttr,
201 XFA_ATTRIBUTEENUM eValue,
202 FX_BOOL bNotify = FALSE) {
203 return SetValue(eAttr, XFA_ATTRIBUTETYPE_Enum, (void*)(uintptr_t)eValue,
204 bNotify);
205 }
206 FX_BOOL TryEnum(XFA_ATTRIBUTE eAttr,
207 XFA_ATTRIBUTEENUM& eValue,
208 FX_BOOL bUseDefault = TRUE);
209 XFA_ATTRIBUTEENUM GetEnum(XFA_ATTRIBUTE eAttr) {
210 XFA_ATTRIBUTEENUM eValue;
211 return TryEnum(eAttr, eValue, TRUE) ? eValue : XFA_ATTRIBUTEENUM_Unknown;
212 }
213 FX_BOOL SetCData(XFA_ATTRIBUTE eAttr,
214 const CFX_WideString& wsValue,
215 FX_BOOL bNotify = FALSE,
216 FX_BOOL bScriptModify = FALSE);
217 FX_BOOL SetAttributeValue(const CFX_WideString& wsValue,
218 const CFX_WideString& wsXMLValue,
219 FX_BOOL bNotify = FALSE,
220 FX_BOOL bScriptModify = FALSE);
221 FX_BOOL TryCData(XFA_ATTRIBUTE eAttr,
222 CFX_WideString& wsValue,
223 FX_BOOL bUseDefault = TRUE,
224 FX_BOOL bProto = TRUE);
225 FX_BOOL TryCData(XFA_ATTRIBUTE eAttr,
226 CFX_WideStringC& wsValue,
227 FX_BOOL bUseDefault = TRUE,
228 FX_BOOL bProto = TRUE);
229 CFX_WideStringC GetCData(XFA_ATTRIBUTE eAttr) {
230 CFX_WideStringC wsValue;
231 return TryCData(eAttr, wsValue) ? wsValue : CFX_WideStringC();
232 }
233 FX_BOOL SetMeasure(XFA_ATTRIBUTE eAttr,
234 CXFA_Measurement mValue,
235 FX_BOOL bNotify = FALSE);
236 FX_BOOL TryMeasure(XFA_ATTRIBUTE eAttr,
237 CXFA_Measurement& mValue,
238 FX_BOOL bUseDefault = TRUE) const;
239 CXFA_Measurement GetMeasure(XFA_ATTRIBUTE eAttr) const;
240 FX_BOOL SetObject(XFA_ATTRIBUTE eAttr,
241 void* pData,
242 XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = NULL);
243 FX_BOOL TryObject(XFA_ATTRIBUTE eAttr, void*& pData);
244 void* GetObject(XFA_ATTRIBUTE eAttr) {
245 void* pData;
246 return TryObject(eAttr, pData) ? pData : NULL;
247 }
248 FX_BOOL SetUserData(void* pKey,
249 void* pData,
250 XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = NULL);
251 FX_BOOL TryUserData(void* pKey, void*& pData, FX_BOOL bProtoAlso = FALSE);
252 void* GetUserData(void* pKey, FX_BOOL bProtoAlso = FALSE) {
253 void* pData;
254 return TryUserData(pKey, pData, bProtoAlso) ? pData : NULL;
255 }
256 CXFA_Node* GetProperty(int32_t index,
257 XFA_ELEMENT eProperty,
258 FX_BOOL bCreateProperty = TRUE);
259 int32_t CountChildren(XFA_ELEMENT eElement, FX_BOOL bOnlyChild = FALSE);
260 CXFA_Node* GetChild(int32_t index,
261 XFA_ELEMENT eElement,
262 FX_BOOL bOnlyChild = FALSE);
263 int32_t InsertChild(int32_t index, CXFA_Node* pNode);
264 FX_BOOL InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode = NULL);
265 FX_BOOL RemoveChild(CXFA_Node* pNode, FX_BOOL bNotify = TRUE);
266 CXFA_Node* Clone(FX_BOOL bRecursive);
267 CXFA_Node* GetNodeItem(XFA_NODEITEM eItem) const;
268 CXFA_Node* GetNodeItem(XFA_NODEITEM eItem, XFA_OBJECTTYPE eType) const;
269 int32_t GetNodeList(CXFA_NodeArray& nodes,
270 FX_DWORD dwTypeFilter = XFA_NODEFILTER_Children |
271 XFA_NODEFILTER_Properties,
272 XFA_ELEMENT eElementFilter = XFA_ELEMENT_UNKNOWN,
273 int32_t iLevel = 1);
274 CXFA_Node* CreateSamePacketNode(XFA_ELEMENT eElement,
275 FX_DWORD dwFlags = XFA_NODEFLAG_Initialized);
276 CXFA_Node* CloneTemplateToForm(FX_BOOL bRecursive);
277 CXFA_Node* GetTemplateNode() const;
278 void SetTemplateNode(CXFA_Node* pTemplateNode);
279 CXFA_Node* GetDataDescriptionNode();
280 void SetDataDescriptionNode(CXFA_Node* pDataDescriptionNode);
281 CXFA_Node* GetBindData();
282 int32_t GetBindItems(CXFA_NodeArray& formItems);
283 int32_t AddBindItem(CXFA_Node* pFormNode);
284 int32_t RemoveBindItem(CXFA_Node* pFormNode);
285 FX_BOOL HasBindItem();
286 CXFA_WidgetData* GetWidgetData();
287 CXFA_WidgetData* GetContainerWidgetData();
288 FX_BOOL GetLocaleName(CFX_WideString& wsLocaleName);
289 XFA_ATTRIBUTEENUM GetIntact();
290 CXFA_Node* GetFirstChildByName(const CFX_WideStringC& wsNodeName) const;
291 CXFA_Node* GetFirstChildByName(FX_DWORD dwNodeNameHash) const;
292 CXFA_Node* GetFirstChildByClass(XFA_ELEMENT eNodeClass) const;
293 CXFA_Node* GetNextSameNameSibling(FX_DWORD dwNodeNameHash) const;
294 CXFA_Node* GetNextSameNameSibling(const CFX_WideStringC& wsNodeName) const;
295 CXFA_Node* GetNextSameClassSibling(XFA_ELEMENT eNodeClass) const;
296 int32_t GetNodeSameNameIndex() const;
297 int32_t GetNodeSameClassIndex() const;
298 void GetSOMExpression(CFX_WideString& wsSOMExpression);
299 CXFA_Node* GetInstanceMgrOfSubform();
300
301 CXFA_Node* GetOccurNode();
302 void Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments);
303 void Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments);
304 void Script_Som_ResolveNodeList(FXJSE_HVALUE hValue,
305 CFX_WideString wsExpression,
306 FX_DWORD dwFlag,
307 CXFA_Node* refNode = NULL);
308 void Script_TreeClass_All(FXJSE_HVALUE hValue,
309 FX_BOOL bSetting,
310 XFA_ATTRIBUTE eAttribute);
311 void Script_TreeClass_Nodes(FXJSE_HVALUE hValue,
312 FX_BOOL bSetting,
313 XFA_ATTRIBUTE eAttribute);
314 void Script_TreeClass_ClassAll(FXJSE_HVALUE hValue,
315 FX_BOOL bSetting,
316 XFA_ATTRIBUTE eAttribute);
317 void Script_TreeClass_Parent(FXJSE_HVALUE hValue,
318 FX_BOOL bSetting,
319 XFA_ATTRIBUTE eAttribute);
320 void Script_TreeClass_Index(FXJSE_HVALUE hValue,
321 FX_BOOL bSetting,
322 XFA_ATTRIBUTE eAttribute);
323 void Script_TreeClass_ClassIndex(FXJSE_HVALUE hValue,
324 FX_BOOL bSetting,
325 XFA_ATTRIBUTE eAttribute);
326 void Script_TreeClass_SomExpression(FXJSE_HVALUE hValue,
327 FX_BOOL bSetting,
328 XFA_ATTRIBUTE eAttribute);
329 void Script_NodeClass_ApplyXSL(CFXJSE_Arguments* pArguments);
330 void Script_NodeClass_AssignNode(CFXJSE_Arguments* pArguments);
331 void Script_NodeClass_Clone(CFXJSE_Arguments* pArguments);
332 void Script_NodeClass_GetAttribute(CFXJSE_Arguments* pArguments);
333 void Script_NodeClass_GetElement(CFXJSE_Arguments* pArguments);
334 void Script_NodeClass_IsPropertySpecified(CFXJSE_Arguments* pArguments);
335 void Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments);
336 void Script_NodeClass_SaveFilteredXML(CFXJSE_Arguments* pArguments);
337 void Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments);
338 void Script_NodeClass_SetAttribute(CFXJSE_Arguments* pArguments);
339 void Script_NodeClass_SetElement(CFXJSE_Arguments* pArguments);
340 void Script_NodeClass_Ns(FXJSE_HVALUE hValue,
341 FX_BOOL bSetting,
342 XFA_ATTRIBUTE eAttribute);
343 void Script_NodeClass_Model(FXJSE_HVALUE hValue,
344 FX_BOOL bSetting,
345 XFA_ATTRIBUTE eAttribute);
346 void Script_NodeClass_IsContainer(FXJSE_HVALUE hValue,
347 FX_BOOL bSetting,
348 XFA_ATTRIBUTE eAttribute);
349 void Script_NodeClass_IsNull(FXJSE_HVALUE hValue,
350 FX_BOOL bSetting,
351 XFA_ATTRIBUTE eAttribute);
352 void Script_NodeClass_OneOfChild(FXJSE_HVALUE hValue,
353 FX_BOOL bSetting,
354 XFA_ATTRIBUTE eAttribute);
355 void Script_ContainerClass_GetDelta(CFXJSE_Arguments* pArguments);
356 void Script_ContainerClass_GetDeltas(CFXJSE_Arguments* pArguments);
357 void Script_ModelClass_ClearErrorList(CFXJSE_Arguments* pArguments);
358 void Script_ModelClass_CreateNode(CFXJSE_Arguments* pArguments);
359 void Script_ModelClass_IsCompatibleNS(CFXJSE_Arguments* pArguments);
360 void Script_ModelClass_Context(FXJSE_HVALUE hValue,
361 FX_BOOL bSetting,
362 XFA_ATTRIBUTE eAttribute);
363 void Script_ModelClass_AliasNode(FXJSE_HVALUE hValue,
364 FX_BOOL bSetting,
365 XFA_ATTRIBUTE eAttribute);
366 void Script_WsdlConnection_Execute(CFXJSE_Arguments* pArguments);
367 void Script_Delta_Restore(CFXJSE_Arguments* pArguments);
368 void Script_Delta_CurrentValue(FXJSE_HVALUE hValue,
369 FX_BOOL bSetting,
370 XFA_ATTRIBUTE eAttribute);
371 void Script_Delta_SavedValue(FXJSE_HVALUE hValue,
372 FX_BOOL bSetting,
373 XFA_ATTRIBUTE eAttribute);
374 void Script_Delta_Target(FXJSE_HVALUE hValue,
375 FX_BOOL bSetting,
376 XFA_ATTRIBUTE eAttribute);
377 void Script_Attribute_SendAttributeChangeMessage(void* eAttribute,
378 void* eValue,
379 FX_BOOL bScriptModify);
380 void Script_Attribute_Integer(FXJSE_HVALUE hValue,
381 FX_BOOL bSetting,
382 XFA_ATTRIBUTE eAttribute);
383 void Script_Attribute_IntegerRead(FXJSE_HVALUE hValue,
384 FX_BOOL bSetting,
385 XFA_ATTRIBUTE eAttribute);
386 void Script_Attribute_BOOL(FXJSE_HVALUE hValue,
387 FX_BOOL bSetting,
388 XFA_ATTRIBUTE eAttribute);
389 void Script_Attribute_BOOLRead(FXJSE_HVALUE hValue,
390 FX_BOOL bSetting,
391 XFA_ATTRIBUTE eAttribute);
392 void Script_Attribute_String(FXJSE_HVALUE hValue,
393 FX_BOOL bSetting,
394 XFA_ATTRIBUTE eAttribute);
395 void Script_Attribute_StringRead(FXJSE_HVALUE hValue,
396 FX_BOOL bSetting,
397 XFA_ATTRIBUTE eAttribute);
398 void Script_Som_ValidationMessage(FXJSE_HVALUE hValue,
399 FX_BOOL bSetting,
400 XFA_ATTRIBUTE eAttribute);
401 void Script_Field_Length(FXJSE_HVALUE hValue,
402 FX_BOOL bSetting,
403 XFA_ATTRIBUTE eAttribute);
404 void Script_Som_DefaultValue(FXJSE_HVALUE hValue,
405 FX_BOOL bSetting,
406 XFA_ATTRIBUTE eAttribute);
407 void Script_Som_DefaultValue_Read(FXJSE_HVALUE hValue,
408 FX_BOOL bSetting,
409 XFA_ATTRIBUTE eAttribute);
410 void Script_Boolean_Value(FXJSE_HVALUE hValue,
411 FX_BOOL bSetting,
412 XFA_ATTRIBUTE eAttribute);
413 void Script_Som_Message(FXJSE_HVALUE hValue,
414 FX_BOOL bSetting,
415 XFA_SOM_MESSAGETYPE iMessageType);
416 void Script_Som_BorderColor(FXJSE_HVALUE hValue,
417 FX_BOOL bSetting,
418 XFA_ATTRIBUTE eAttribute);
419 void Script_Som_BorderWidth(FXJSE_HVALUE hValue,
420 FX_BOOL bSetting,
421 XFA_ATTRIBUTE eAttribute);
422 void Script_Som_FillColor(FXJSE_HVALUE hValue,
423 FX_BOOL bSetting,
424 XFA_ATTRIBUTE eAttribute);
425 void Script_Som_DataNode(FXJSE_HVALUE hValue,
426 FX_BOOL bSetting,
427 XFA_ATTRIBUTE eAttribute);
428 void Script_Som_FontColor(FXJSE_HVALUE hValue,
429 FX_BOOL bSetting,
430 XFA_ATTRIBUTE eAttribute);
431 void Script_Som_Mandatory(FXJSE_HVALUE hValue,
432 FX_BOOL bSetting,
433 XFA_ATTRIBUTE eAttribute);
434 void Script_Som_MandatoryMessage(FXJSE_HVALUE hValue,
435 FX_BOOL bSetting,
436 XFA_ATTRIBUTE eAttribute);
437 void Script_Som_InstanceIndex(FXJSE_HVALUE hValue,
438 FX_BOOL bSetting,
439 XFA_ATTRIBUTE eAttribute);
440 void Script_Draw_DefaultValue(FXJSE_HVALUE hValue,
441 FX_BOOL bSetting,
442 XFA_ATTRIBUTE eAttribute);
443 void Script_Field_DefaultValue(FXJSE_HVALUE hValue,
444 FX_BOOL bSetting,
445 XFA_ATTRIBUTE eAttribute);
446 void Script_Field_EditValue(FXJSE_HVALUE hValue,
447 FX_BOOL bSetting,
448 XFA_ATTRIBUTE eAttribute);
449 void Script_Field_FormatMessage(FXJSE_HVALUE hValue,
450 FX_BOOL bSetting,
451 XFA_ATTRIBUTE eAttribute);
452 void Script_Field_FormattedValue(FXJSE_HVALUE hValue,
453 FX_BOOL bSetting,
454 XFA_ATTRIBUTE eAttribute);
455 void Script_Field_ParentSubform(FXJSE_HVALUE hValue,
456 FX_BOOL bSetting,
457 XFA_ATTRIBUTE eAttribute);
458 void Script_Field_SelectedIndex(FXJSE_HVALUE hValue,
459 FX_BOOL bSetting,
460 XFA_ATTRIBUTE eAttribute);
461 void Script_Field_ClearItems(CFXJSE_Arguments* pArguments);
462 void Script_Field_ExecEvent(CFXJSE_Arguments* pArguments);
463 void Script_Field_ExecInitialize(CFXJSE_Arguments* pArguments);
464 void Script_Field_DeleteItem(CFXJSE_Arguments* pArguments);
465 void Script_Field_GetSaveItem(CFXJSE_Arguments* pArguments);
466 void Script_Field_BoundItem(CFXJSE_Arguments* pArguments);
467 void Script_Field_GetItemState(CFXJSE_Arguments* pArguments);
468 void Script_Field_ExecCalculate(CFXJSE_Arguments* pArguments);
469 void Script_Field_SetItems(CFXJSE_Arguments* pArguments);
470 void Script_Field_GetDisplayItem(CFXJSE_Arguments* pArguments);
471 void Script_Field_SetItemState(CFXJSE_Arguments* pArguments);
472 void Script_Field_AddItem(CFXJSE_Arguments* pArguments);
473 void Script_Field_ExecValidate(CFXJSE_Arguments* pArguments);
474 void Script_ExclGroup_DefaultAndRawValue(FXJSE_HVALUE hValue,
475 FX_BOOL bSetting,
476 XFA_ATTRIBUTE eAttribute);
477 void Script_ExclGroup_ErrorText(FXJSE_HVALUE hValue,
478 FX_BOOL bSetting,
479 XFA_ATTRIBUTE eAttribute);
480 void Script_ExclGroup_Transient(FXJSE_HVALUE hValue,
481 FX_BOOL bSetting,
482 XFA_ATTRIBUTE eAttribute);
483 void Script_ExclGroup_ExecEvent(CFXJSE_Arguments* pArguments);
484 void Script_ExclGroup_SelectedMember(CFXJSE_Arguments* pArguments);
485 void Script_ExclGroup_ExecInitialize(CFXJSE_Arguments* pArguments);
486 void Script_ExclGroup_ExecCalculate(CFXJSE_Arguments* pArguments);
487 void Script_ExclGroup_ExecValidate(CFXJSE_Arguments* pArguments);
488 void Script_Subform_InstanceManager(FXJSE_HVALUE hValue,
489 FX_BOOL bSetting,
490 XFA_ATTRIBUTE eAttribute);
491 void Script_Subform_Locale(FXJSE_HVALUE hValue,
492 FX_BOOL bSetting,
493 XFA_ATTRIBUTE eAttribute);
494 void Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments);
495 void Script_Subform_ExecInitialize(CFXJSE_Arguments* pArguments);
496 void Script_Subform_ExecCalculate(CFXJSE_Arguments* pArguments);
497 void Script_Subform_ExecValidate(CFXJSE_Arguments* pArguments);
498 void Script_Subform_GetInvalidObjects(CFXJSE_Arguments* pArguments);
499
500 int32_t Subform_and_SubformSet_InstanceIndex();
501 void Script_Template_FormNodes(CFXJSE_Arguments* pArguments);
502 void Script_Template_Remerge(CFXJSE_Arguments* pArguments);
503 void Script_Template_ExecInitialize(CFXJSE_Arguments* pArguments);
504 void Script_Template_CreateNode(CFXJSE_Arguments* pArguments);
505 void Script_Template_Recalculate(CFXJSE_Arguments* pArguments);
506 void Script_Template_ExecCalculate(CFXJSE_Arguments* pArguments);
507 void Script_Template_ExecValidate(CFXJSE_Arguments* pArguments);
508 void Script_Manifest_Evaluate(CFXJSE_Arguments* pArguments);
509 void Script_InstanceManager_Count(FXJSE_HVALUE hValue,
510 FX_BOOL bSetting,
511 XFA_ATTRIBUTE eAttribute);
512 void Script_InstanceManager_Max(FXJSE_HVALUE hValue,
513 FX_BOOL bSetting,
514 XFA_ATTRIBUTE eAttribute);
515 void Script_InstanceManager_Min(FXJSE_HVALUE hValue,
516 FX_BOOL bSetting,
517 XFA_ATTRIBUTE eAttribute);
518 void Script_InstanceManager_MoveInstance(CFXJSE_Arguments* pArguments);
519 void Script_InstanceManager_RemoveInstance(CFXJSE_Arguments* pArguments);
520 void Script_InstanceManager_SetInstances(CFXJSE_Arguments* pArguments);
521 void Script_InstanceManager_AddInstance(CFXJSE_Arguments* pArguments);
522 void Script_InstanceManager_InsertInstance(CFXJSE_Arguments* pArguments);
523 int32_t InstanceManager_SetInstances(int32_t iCount);
524 int32_t InstanceManager_MoveInstance(int32_t iTo, int32_t iFrom);
525 void Script_Occur_Max(FXJSE_HVALUE hValue,
526 FX_BOOL bSetting,
527 XFA_ATTRIBUTE eAttribute);
528 void Script_Occur_Min(FXJSE_HVALUE hValue,
529 FX_BOOL bSetting,
530 XFA_ATTRIBUTE eAttribute);
531 void Script_Desc_Metadata(CFXJSE_Arguments* pArguments);
532 void Script_Form_FormNodes(CFXJSE_Arguments* pArguments);
533 void Script_Form_Remerge(CFXJSE_Arguments* pArguments);
534 void Script_Form_ExecInitialize(CFXJSE_Arguments* pArguments);
535 void Script_Form_Recalculate(CFXJSE_Arguments* pArguments);
536 void Script_Form_ExecCalculate(CFXJSE_Arguments* pArguments);
537 void Script_Form_ExecValidate(CFXJSE_Arguments* pArguments);
538 void Script_Form_Checksum(FXJSE_HVALUE hValue,
539 FX_BOOL bSetting,
540 XFA_ATTRIBUTE eAttribute);
541 void Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments);
542 void Script_Packet_SetAttribute(CFXJSE_Arguments* pArguments);
543 void Script_Packet_RemoveAttribute(CFXJSE_Arguments* pArguments);
544 void Script_Packet_Content(FXJSE_HVALUE hValue,
545 FX_BOOL bSetting,
546 XFA_ATTRIBUTE eAttribute);
547 void Script_Source_Next(CFXJSE_Arguments* pArguments);
548 void Script_Source_CancelBatch(CFXJSE_Arguments* pArguments);
549 void Script_Source_First(CFXJSE_Arguments* pArguments);
550 void Script_Source_UpdateBatch(CFXJSE_Arguments* pArguments);
551 void Script_Source_Previous(CFXJSE_Arguments* pArguments);
552 void Script_Source_IsBOF(CFXJSE_Arguments* pArguments);
553 void Script_Source_IsEOF(CFXJSE_Arguments* pArguments);
554 void Script_Source_Cancel(CFXJSE_Arguments* pArguments);
555 void Script_Source_Update(CFXJSE_Arguments* pArguments);
556 void Script_Source_Open(CFXJSE_Arguments* pArguments);
557 void Script_Source_Delete(CFXJSE_Arguments* pArguments);
558 void Script_Source_AddNew(CFXJSE_Arguments* pArguments);
559 void Script_Source_Requery(CFXJSE_Arguments* pArguments);
560 void Script_Source_Resync(CFXJSE_Arguments* pArguments);
561 void Script_Source_Close(CFXJSE_Arguments* pArguments);
562 void Script_Source_Last(CFXJSE_Arguments* pArguments);
563 void Script_Source_HasDataChanged(CFXJSE_Arguments* pArguments);
564 void Script_Source_Db(FXJSE_HVALUE hValue,
565 FX_BOOL bSetting,
566 XFA_ATTRIBUTE eAttribute);
567 void Script_Xfa_This(FXJSE_HVALUE hValue,
568 FX_BOOL bSetting,
569 XFA_ATTRIBUTE eAttribute);
570 void Script_Handler_Version(FXJSE_HVALUE hValue,
571 FX_BOOL bSetting,
572 XFA_ATTRIBUTE eAttribute);
573 void Script_SubmitFormat_Mode(FXJSE_HVALUE hValue,
574 FX_BOOL bSetting,
575 XFA_ATTRIBUTE eAttribute);
576 void Script_Extras_Type(FXJSE_HVALUE hValue,
577 FX_BOOL bSetting,
578 XFA_ATTRIBUTE eAttribute);
579 void Script_Encrypt_Format(FXJSE_HVALUE hValue,
580 FX_BOOL bSetting,
581 XFA_ATTRIBUTE eAttribute);
582 void Script_Script_Stateless(FXJSE_HVALUE hValue,
583 FX_BOOL bSetting,
584 XFA_ATTRIBUTE eAttribute);
585
586 protected:
587 CXFA_Node(CXFA_Document* pDoc, FX_WORD ePacket, XFA_ELEMENT eElement);
588 ~CXFA_Node();
589 friend class CXFA_Document;
590 CXFA_Node* Deprecated_GetPrevSibling();
591 FX_BOOL SetValue(XFA_ATTRIBUTE eAttr,
592 XFA_ATTRIBUTETYPE eType,
593 void* pValue,
594 FX_BOOL bNotify);
595 FX_BOOL GetValue(XFA_ATTRIBUTE eAttr,
596 XFA_ATTRIBUTETYPE eType,
597 FX_BOOL bUseDefault,
598 void*& pValue);
599 void OnRemoved(CXFA_Node* pParent, CXFA_Node* pRemoved, FX_BOOL bNotify);
600 void OnChanging(XFA_ATTRIBUTE eAttr, void* pNewValue, FX_BOOL bNotify);
601 void OnChanged(XFA_ATTRIBUTE eAttr,
602 void* pNewValue,
603 FX_BOOL bNotify,
604 FX_BOOL bScriptModify = FALSE);
605 int32_t execSingleEventByName(const CFX_WideStringC& wsEventName,
606 XFA_ELEMENT eElementType);
607 FX_BOOL SetScriptContent(const CFX_WideString& wsContent,
608 const CFX_WideString& wsXMLValue,
609 FX_BOOL bNotify = TRUE,
610 FX_BOOL bScriptModify = FALSE,
611 FX_BOOL bSyncData = TRUE);
612 CFX_WideString GetScriptContent(FX_BOOL bScriptModify = FALSE);
613 XFA_MAPMODULEDATA* CreateMapModuleData();
614 XFA_MAPMODULEDATA* GetMapModuleData() const;
615 void SetMapModuleValue(void* pKey, void* pValue);
616 FX_BOOL GetMapModuleValue(void* pKey, void*& pValue);
617 void SetMapModuleString(void* pKey, const CFX_WideStringC& wsValue);
618 FX_BOOL GetMapModuleString(void* pKey, CFX_WideStringC& wsValue);
619 void SetMapModuleBuffer(void* pKey,
620 void* pValue,
621 int32_t iBytes,
622 XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = NULL);
623 FX_BOOL GetMapModuleBuffer(void* pKey,
624 void*& pValue,
625 int32_t& iBytes,
626 FX_BOOL bProtoAlso = TRUE) const;
627 FX_BOOL HasMapModuleKey(void* pKey, FX_BOOL bProtoAlso = FALSE);
628 void RemoveMapModuleKey(void* pKey = NULL);
629 void MergeAllData(void* pDstModule, FX_BOOL bUseSrcAttr = TRUE);
630 void MoveBufferMapData(CXFA_Node* pDstModule, void* pKey);
631 void MoveBufferMapData(CXFA_Node* pSrcModule,
632 CXFA_Node* pDstModule,
633 void* pKey,
634 FX_BOOL bRecursive = FALSE);
635
636 CXFA_Node* m_pNext;
637 CXFA_Node* m_pChild;
638 CXFA_Node* m_pLastChild;
639 CXFA_Node* m_pParent;
640 IFDE_XMLNode* m_pXMLNode;
641 XFA_ELEMENT m_eNodeClass;
642 FX_WORD m_ePacket;
643 FX_DWORD m_dwNameHash;
644 CXFA_Node* m_pAuxNode;
645 XFA_MAPMODULEDATA* m_pMapModuleData;
646 };
647 class CXFA_OrdinaryObject : public CXFA_Object {
648 public:
649 CXFA_OrdinaryObject(CXFA_Document* pDocument, XFA_ELEMENT eElement)
650 : CXFA_Object(pDocument, XFA_OBJECTTYPE_OrdinaryObject),
651 m_uScriptHash(0) {
652 m_eNodeClass = eElement;
653 }
654 XFA_ELEMENT GetClassID() const { return (XFA_ELEMENT)m_eNodeClass; }
655 uint32_t GetScriptObjHash() { return m_uScriptHash; }
656
657 protected:
658 XFA_ELEMENT m_eNodeClass;
659 uint32_t m_uScriptHash;
660 };
661 class CXFA_ThisProxy : public CXFA_Object {
662 public:
663 CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode)
664 : CXFA_Object(pThisNode->GetDocument(), XFA_OBJECTTYPE_VariablesThis),
665 m_pThisNode(NULL),
666 m_pScriptNode(NULL) {
667 m_pThisNode = pThisNode;
668 m_pScriptNode = pScriptNode;
669 }
670 virtual ~CXFA_ThisProxy() {}
671 CXFA_Node* GetThisNode() { return m_pThisNode; }
672 CXFA_Node* GetScriptNode() { return m_pScriptNode; }
673
674 private:
675 CXFA_Node* m_pThisNode;
676 CXFA_Node* m_pScriptNode;
677 };
678 class CXFA_NodeList : public CXFA_Object {
679 public:
680 explicit CXFA_NodeList(CXFA_Document* pDocument);
681 virtual ~CXFA_NodeList() {}
682 XFA_ELEMENT GetClassID() const { return XFA_ELEMENT_NodeList; }
683 CXFA_Node* NamedItem(const CFX_WideStringC& wsName);
684 virtual int32_t GetLength() = 0;
685 virtual FX_BOOL Append(CXFA_Node* pNode) = 0;
686 virtual FX_BOOL Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) = 0;
687 virtual FX_BOOL Remove(CXFA_Node* pNode) = 0;
688 virtual CXFA_Node* Item(int32_t iIndex) = 0;
689
690 void Script_ListClass_Append(CFXJSE_Arguments* pArguments);
691 void Script_ListClass_Insert(CFXJSE_Arguments* pArguments);
692 void Script_ListClass_Remove(CFXJSE_Arguments* pArguments);
693 void Script_ListClass_Item(CFXJSE_Arguments* pArguments);
694
695 void Script_TreelistClass_NamedItem(CFXJSE_Arguments* pArguments);
696 void Script_ListClass_Length(FXJSE_HVALUE hValue,
697 FX_BOOL bSetting,
698 XFA_ATTRIBUTE eAttribute);
699 };
700 class CXFA_ArrayNodeList : public CXFA_NodeList {
701 public:
702 explicit CXFA_ArrayNodeList(CXFA_Document* pDocument);
703 void SetArrayNodeList(const CXFA_NodeArray& srcArray);
704 virtual int32_t GetLength();
705 virtual FX_BOOL Append(CXFA_Node* pNode);
706 virtual FX_BOOL Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode);
707 virtual FX_BOOL Remove(CXFA_Node* pNode);
708 virtual CXFA_Node* Item(int32_t iIndex);
709
710 protected:
711 CXFA_NodeArray m_array;
712 };
713 class CXFA_AttachNodeList : public CXFA_NodeList {
714 public:
715 CXFA_AttachNodeList(CXFA_Document* pDocument, CXFA_Node* pAttachNode);
716
717 virtual int32_t GetLength();
718 virtual FX_BOOL Append(CXFA_Node* pNode);
719 virtual FX_BOOL Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode);
720 virtual FX_BOOL Remove(CXFA_Node* pNode);
721 virtual CXFA_Node* Item(int32_t iIndex);
722
723 protected:
724 CXFA_Node* m_pAttachNode;
725 };
726 class CXFA_TraverseStrategy_XFAContainerNode {
727 public:
728 static CXFA_Node* GetFirstChild(CXFA_Node* pTemplateNode,
729 void* pUserData = NULL) {
730 return pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild,
731 XFA_OBJECTTYPE_ContainerNode);
732 }
733 static CXFA_Node* GetNextSibling(CXFA_Node* pTemplateNode,
734 void* pUserData = NULL) {
735 return pTemplateNode->GetNodeItem(XFA_NODEITEM_NextSibling,
736 XFA_OBJECTTYPE_ContainerNode);
737 }
738 static CXFA_Node* GetParent(CXFA_Node* pTemplateNode,
739 void* pUserData = NULL) {
740 return pTemplateNode->GetNodeItem(XFA_NODEITEM_Parent,
741 XFA_OBJECTTYPE_ContainerNode);
742 }
743 };
744 typedef CXFA_NodeIteratorTemplate<CXFA_Node,
745 CXFA_TraverseStrategy_XFAContainerNode>
746 CXFA_ContainerIterator;
747 class CXFA_TraverseStrategy_XFANode {
748 public:
749 static inline CXFA_Node* GetFirstChild(CXFA_Node* pTemplateNode) {
750 return pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild);
751 }
752 static inline CXFA_Node* GetNextSibling(CXFA_Node* pTemplateNode) {
753 return pTemplateNode->GetNodeItem(XFA_NODEITEM_NextSibling);
754 }
755 static inline CXFA_Node* GetParent(CXFA_Node* pTemplateNode) {
756 return pTemplateNode->GetNodeItem(XFA_NODEITEM_Parent);
757 }
758 };
759 typedef CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode>
760 CXFA_NodeIterator;
761
762 inline CXFA_Node* CXFA_Object::AsNode() {
763 return IsNode() ? static_cast<CXFA_Node*>(this) : nullptr;
764 }
765 inline CXFA_OrdinaryObject* CXFA_Object::AsOrdinaryObject() {
766 return IsOrdinaryObject() ? static_cast<CXFA_OrdinaryObject*>(this) : nullptr;
767 }
768 inline CXFA_NodeList* CXFA_Object::AsNodeList() {
769 return IsNodeList() ? static_cast<CXFA_NodeList*>(this) : nullptr;
770 }
771
772 inline const CXFA_Node* CXFA_Object::AsNode() const {
773 return IsNode() ? static_cast<const CXFA_Node*>(this) : nullptr;
774 }
775 inline const CXFA_OrdinaryObject* CXFA_Object::AsOrdinaryObject() const {
776 return IsOrdinaryObject() ? static_cast<const CXFA_OrdinaryObject*>(this)
777 : nullptr;
778 }
779 inline const CXFA_NodeList* CXFA_Object::AsNodeList() const {
780 return IsNodeList() ? static_cast<const CXFA_NodeList*>(this) : nullptr;
781 }
782
783 inline CXFA_Node* ToNode(CXFA_Object* pObj) {
784 return pObj ? pObj->AsNode() : nullptr;
785 }
786 inline CXFA_OrdinaryObject* ToOrdinaryObject(CXFA_Object* pObj) {
787 return pObj ? pObj->AsOrdinaryObject() : nullptr;
788 }
789 inline CXFA_NodeList* ToNodeList(CXFA_Object* pObj) {
790 return pObj ? pObj->AsNodeList() : nullptr;
791 }
792
793 inline const CXFA_Node* ToNode(const CXFA_Object* pObj) {
794 return pObj ? pObj->AsNode() : nullptr;
795 }
796 inline const CXFA_OrdinaryObject* ToOrdinaryObject(const CXFA_Object* pObj) {
797 return pObj ? pObj->AsOrdinaryObject() : nullptr;
798 }
799 inline const CXFA_NodeList* ToNodeList(const CXFA_Object* pObj) {
800 return pObj ? pObj->AsNodeList() : nullptr;
801 }
802
803 #endif // XFA_SRC_FXFA_PARSER_XFA_OBJECT_H_
OLDNEW
« no previous file with comments | « xfa/src/fxfa/parser/xfa_localevalue.cpp ('k') | xfa/src/fxfa/parser/xfa_object_imp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698