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_OBJECT_H_ | 7 #ifndef XFA_FXFA_PARSER_XFA_OBJECT_H_ |
8 #define XFA_FXFA_PARSER_XFA_OBJECT_H_ | 8 #define XFA_FXFA_PARSER_XFA_OBJECT_H_ |
9 | 9 |
10 #include "xfa/fde/xml/fde_xml.h" | 10 #include "xfa/fde/xml/fde_xml.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 XFA_NODEFLAG_NeedsInitApp = 0x00400, | 34 XFA_NODEFLAG_NeedsInitApp = 0x00400, |
35 XFA_NODEFLAG_BindFormItems = 0x00800, | 35 XFA_NODEFLAG_BindFormItems = 0x00800, |
36 XFA_NODEFLAG_UserInteractive = 0x01000, | 36 XFA_NODEFLAG_UserInteractive = 0x01000, |
37 XFA_NODEFLAG_SkipDataBinding = 0x02000, | 37 XFA_NODEFLAG_SkipDataBinding = 0x02000, |
38 XFA_NODEFLAG_OwnXMLNode = 0x04000, | 38 XFA_NODEFLAG_OwnXMLNode = 0x04000, |
39 XFA_NODEFLAG_UnusedNode = 0x08000, | 39 XFA_NODEFLAG_UnusedNode = 0x08000, |
40 XFA_NODEFLAG_LayoutGeneratedNode = 0x10000, | 40 XFA_NODEFLAG_LayoutGeneratedNode = 0x10000, |
41 }; | 41 }; |
42 class CXFA_Object { | 42 class CXFA_Object { |
43 public: | 43 public: |
44 CXFA_Object(CXFA_Document* pDocument, FX_DWORD uFlags); | 44 CXFA_Object(CXFA_Document* pDocument, uint32_t uFlags); |
45 CXFA_Document* GetDocument() const { return m_pDocument; } | 45 CXFA_Document* GetDocument() const { return m_pDocument; } |
46 FX_DWORD GetFlag() const { return m_uFlags; } | 46 uint32_t GetFlag() const { return m_uFlags; } |
47 XFA_OBJECTTYPE GetObjectType() const { | 47 XFA_OBJECTTYPE GetObjectType() const { |
48 return (XFA_OBJECTTYPE)(m_uFlags & XFA_OBJECTTYPEMASK); | 48 return (XFA_OBJECTTYPE)(m_uFlags & XFA_OBJECTTYPEMASK); |
49 } | 49 } |
50 | 50 |
51 FX_BOOL IsNode() const { | 51 FX_BOOL IsNode() const { |
52 return (m_uFlags & XFA_OBJECTTYPEMASK) >= XFA_OBJECTTYPE_Node; | 52 return (m_uFlags & XFA_OBJECTTYPEMASK) >= XFA_OBJECTTYPE_Node; |
53 } | 53 } |
54 FX_BOOL IsOrdinaryObject() const { | 54 FX_BOOL IsOrdinaryObject() const { |
55 return (m_uFlags & XFA_OBJECTTYPEMASK) == XFA_OBJECTTYPE_OrdinaryObject; | 55 return (m_uFlags & XFA_OBJECTTYPEMASK) == XFA_OBJECTTYPE_OrdinaryObject; |
56 } | 56 } |
(...skipping 21 matching lines...) Expand all Loading... |
78 XFA_ELEMENT GetClassID() const; | 78 XFA_ELEMENT GetClassID() const; |
79 void GetClassName(CFX_WideStringC& wsName) const; | 79 void GetClassName(CFX_WideStringC& wsName) const; |
80 uint32_t GetClassHashCode() const; | 80 uint32_t GetClassHashCode() const; |
81 void Script_ObjectClass_ClassName(FXJSE_HVALUE hValue, | 81 void Script_ObjectClass_ClassName(FXJSE_HVALUE hValue, |
82 FX_BOOL bSetting, | 82 FX_BOOL bSetting, |
83 XFA_ATTRIBUTE eAttribute); | 83 XFA_ATTRIBUTE eAttribute); |
84 void ThrowScriptErrorMessage(int32_t iStringID, ...); | 84 void ThrowScriptErrorMessage(int32_t iStringID, ...); |
85 | 85 |
86 protected: | 86 protected: |
87 CXFA_Document* const m_pDocument; | 87 CXFA_Document* const m_pDocument; |
88 FX_DWORD m_uFlags; | 88 uint32_t m_uFlags; |
89 }; | 89 }; |
90 | 90 |
91 #define XFA_NODEFILTER_Children 0x01 | 91 #define XFA_NODEFILTER_Children 0x01 |
92 #define XFA_NODEFILTER_Properties 0x02 | 92 #define XFA_NODEFILTER_Properties 0x02 |
93 #define XFA_NODEFILTER_OneOfProperty 0x04 | 93 #define XFA_NODEFILTER_OneOfProperty 0x04 |
94 #define XFA_CLONEFLAG_Content 0x01 | 94 #define XFA_CLONEFLAG_Content 0x01 |
95 enum XFA_NODEITEM { | 95 enum XFA_NODEITEM { |
96 XFA_NODEITEM_Parent, | 96 XFA_NODEITEM_Parent, |
97 XFA_NODEITEM_FirstChild, | 97 XFA_NODEITEM_FirstChild, |
98 XFA_NODEITEM_NextSibling, | 98 XFA_NODEITEM_NextSibling, |
(...skipping 25 matching lines...) Expand all Loading... |
124 CFX_MapPtrToPtr m_ValueMap; | 124 CFX_MapPtrToPtr m_ValueMap; |
125 CFX_MapPtrTemplate<void*, XFA_MAPDATABLOCK*> m_BufferMap; | 125 CFX_MapPtrTemplate<void*, XFA_MAPDATABLOCK*> m_BufferMap; |
126 }; | 126 }; |
127 | 127 |
128 #define XFA_CalcRefCount (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'R') | 128 #define XFA_CalcRefCount (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'R') |
129 #define XFA_CalcData (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'C') | 129 #define XFA_CalcData (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'C') |
130 #define XFA_LAYOUTITEMKEY (void*)(uintptr_t) FXBSTR_ID('L', 'Y', 'I', 'M') | 130 #define XFA_LAYOUTITEMKEY (void*)(uintptr_t) FXBSTR_ID('L', 'Y', 'I', 'M') |
131 class CXFA_Node : public CXFA_Object { | 131 class CXFA_Node : public CXFA_Object { |
132 public: | 132 public: |
133 XFA_ELEMENT GetClassID() const { return (XFA_ELEMENT)m_eNodeClass; } | 133 XFA_ELEMENT GetClassID() const { return (XFA_ELEMENT)m_eNodeClass; } |
134 FX_DWORD GetPacketID() const { return m_ePacket; } | 134 uint32_t GetPacketID() const { return m_ePacket; } |
135 FX_BOOL HasFlag(FX_DWORD dwFlag) const; | 135 FX_BOOL HasFlag(uint32_t dwFlag) const; |
136 void SetFlag(FX_DWORD dwFlag, FX_BOOL bOn = TRUE, FX_BOOL bNotify = TRUE); | 136 void SetFlag(uint32_t dwFlag, FX_BOOL bOn = TRUE, FX_BOOL bNotify = TRUE); |
137 FX_BOOL IsAttributeInXML(); | 137 FX_BOOL IsAttributeInXML(); |
138 FX_BOOL IsFormContainer() { | 138 FX_BOOL IsFormContainer() { |
139 return m_ePacket == XFA_XDPPACKET_Form && IsContainerNode(); | 139 return m_ePacket == XFA_XDPPACKET_Form && IsContainerNode(); |
140 } | 140 } |
141 void SetXMLMappingNode(IFDE_XMLNode* pXMLNode) { m_pXMLNode = pXMLNode; } | 141 void SetXMLMappingNode(IFDE_XMLNode* pXMLNode) { m_pXMLNode = pXMLNode; } |
142 IFDE_XMLNode* GetXMLMappingNode() const { return m_pXMLNode; } | 142 IFDE_XMLNode* GetXMLMappingNode() const { return m_pXMLNode; } |
143 IFDE_XMLNode* CreateXMLMappingNode(); | 143 IFDE_XMLNode* CreateXMLMappingNode(); |
144 FX_BOOL IsNeedSavingXMLNode(); | 144 FX_BOOL IsNeedSavingXMLNode(); |
145 FX_DWORD GetNameHash() const { return m_dwNameHash; } | 145 uint32_t GetNameHash() const { return m_dwNameHash; } |
146 bool IsUnnamed() const { return m_dwNameHash == 0; } | 146 bool IsUnnamed() const { return m_dwNameHash == 0; } |
147 CXFA_Node* GetModelNode(); | 147 CXFA_Node* GetModelNode(); |
148 void UpdateNameHash(); | 148 void UpdateNameHash(); |
149 FX_BOOL HasAttribute(XFA_ATTRIBUTE eAttr, FX_BOOL bCanInherit = FALSE); | 149 FX_BOOL HasAttribute(XFA_ATTRIBUTE eAttr, FX_BOOL bCanInherit = FALSE); |
150 FX_BOOL SetAttribute(XFA_ATTRIBUTE eAttr, | 150 FX_BOOL SetAttribute(XFA_ATTRIBUTE eAttr, |
151 const CFX_WideStringC& wsValue, | 151 const CFX_WideStringC& wsValue, |
152 FX_BOOL bNotify = FALSE); | 152 FX_BOOL bNotify = FALSE); |
153 FX_BOOL GetAttribute(XFA_ATTRIBUTE eAttr, | 153 FX_BOOL GetAttribute(XFA_ATTRIBUTE eAttr, |
154 CFX_WideString& wsValue, | 154 CFX_WideString& wsValue, |
155 FX_BOOL bUseDefault = TRUE); | 155 FX_BOOL bUseDefault = TRUE); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 CXFA_Node* GetChild(int32_t index, | 261 CXFA_Node* GetChild(int32_t index, |
262 XFA_ELEMENT eElement, | 262 XFA_ELEMENT eElement, |
263 FX_BOOL bOnlyChild = FALSE); | 263 FX_BOOL bOnlyChild = FALSE); |
264 int32_t InsertChild(int32_t index, CXFA_Node* pNode); | 264 int32_t InsertChild(int32_t index, CXFA_Node* pNode); |
265 FX_BOOL InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode = NULL); | 265 FX_BOOL InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode = NULL); |
266 FX_BOOL RemoveChild(CXFA_Node* pNode, FX_BOOL bNotify = TRUE); | 266 FX_BOOL RemoveChild(CXFA_Node* pNode, FX_BOOL bNotify = TRUE); |
267 CXFA_Node* Clone(FX_BOOL bRecursive); | 267 CXFA_Node* Clone(FX_BOOL bRecursive); |
268 CXFA_Node* GetNodeItem(XFA_NODEITEM eItem) const; | 268 CXFA_Node* GetNodeItem(XFA_NODEITEM eItem) const; |
269 CXFA_Node* GetNodeItem(XFA_NODEITEM eItem, XFA_OBJECTTYPE eType) const; | 269 CXFA_Node* GetNodeItem(XFA_NODEITEM eItem, XFA_OBJECTTYPE eType) const; |
270 int32_t GetNodeList(CXFA_NodeArray& nodes, | 270 int32_t GetNodeList(CXFA_NodeArray& nodes, |
271 FX_DWORD dwTypeFilter = XFA_NODEFILTER_Children | | 271 uint32_t dwTypeFilter = XFA_NODEFILTER_Children | |
272 XFA_NODEFILTER_Properties, | 272 XFA_NODEFILTER_Properties, |
273 XFA_ELEMENT eElementFilter = XFA_ELEMENT_UNKNOWN, | 273 XFA_ELEMENT eElementFilter = XFA_ELEMENT_UNKNOWN, |
274 int32_t iLevel = 1); | 274 int32_t iLevel = 1); |
275 CXFA_Node* CreateSamePacketNode(XFA_ELEMENT eElement, | 275 CXFA_Node* CreateSamePacketNode(XFA_ELEMENT eElement, |
276 FX_DWORD dwFlags = XFA_NODEFLAG_Initialized); | 276 uint32_t dwFlags = XFA_NODEFLAG_Initialized); |
277 CXFA_Node* CloneTemplateToForm(FX_BOOL bRecursive); | 277 CXFA_Node* CloneTemplateToForm(FX_BOOL bRecursive); |
278 CXFA_Node* GetTemplateNode() const; | 278 CXFA_Node* GetTemplateNode() const; |
279 void SetTemplateNode(CXFA_Node* pTemplateNode); | 279 void SetTemplateNode(CXFA_Node* pTemplateNode); |
280 CXFA_Node* GetDataDescriptionNode(); | 280 CXFA_Node* GetDataDescriptionNode(); |
281 void SetDataDescriptionNode(CXFA_Node* pDataDescriptionNode); | 281 void SetDataDescriptionNode(CXFA_Node* pDataDescriptionNode); |
282 CXFA_Node* GetBindData(); | 282 CXFA_Node* GetBindData(); |
283 int32_t GetBindItems(CXFA_NodeArray& formItems); | 283 int32_t GetBindItems(CXFA_NodeArray& formItems); |
284 int32_t AddBindItem(CXFA_Node* pFormNode); | 284 int32_t AddBindItem(CXFA_Node* pFormNode); |
285 int32_t RemoveBindItem(CXFA_Node* pFormNode); | 285 int32_t RemoveBindItem(CXFA_Node* pFormNode); |
286 FX_BOOL HasBindItem(); | 286 FX_BOOL HasBindItem(); |
287 CXFA_WidgetData* GetWidgetData(); | 287 CXFA_WidgetData* GetWidgetData(); |
288 CXFA_WidgetData* GetContainerWidgetData(); | 288 CXFA_WidgetData* GetContainerWidgetData(); |
289 FX_BOOL GetLocaleName(CFX_WideString& wsLocaleName); | 289 FX_BOOL GetLocaleName(CFX_WideString& wsLocaleName); |
290 XFA_ATTRIBUTEENUM GetIntact(); | 290 XFA_ATTRIBUTEENUM GetIntact(); |
291 CXFA_Node* GetFirstChildByName(const CFX_WideStringC& wsNodeName) const; | 291 CXFA_Node* GetFirstChildByName(const CFX_WideStringC& wsNodeName) const; |
292 CXFA_Node* GetFirstChildByName(FX_DWORD dwNodeNameHash) const; | 292 CXFA_Node* GetFirstChildByName(uint32_t dwNodeNameHash) const; |
293 CXFA_Node* GetFirstChildByClass(XFA_ELEMENT eNodeClass) const; | 293 CXFA_Node* GetFirstChildByClass(XFA_ELEMENT eNodeClass) const; |
294 CXFA_Node* GetNextSameNameSibling(FX_DWORD dwNodeNameHash) const; | 294 CXFA_Node* GetNextSameNameSibling(uint32_t dwNodeNameHash) const; |
295 CXFA_Node* GetNextSameNameSibling(const CFX_WideStringC& wsNodeName) const; | 295 CXFA_Node* GetNextSameNameSibling(const CFX_WideStringC& wsNodeName) const; |
296 CXFA_Node* GetNextSameClassSibling(XFA_ELEMENT eNodeClass) const; | 296 CXFA_Node* GetNextSameClassSibling(XFA_ELEMENT eNodeClass) const; |
297 int32_t GetNodeSameNameIndex() const; | 297 int32_t GetNodeSameNameIndex() const; |
298 int32_t GetNodeSameClassIndex() const; | 298 int32_t GetNodeSameClassIndex() const; |
299 void GetSOMExpression(CFX_WideString& wsSOMExpression); | 299 void GetSOMExpression(CFX_WideString& wsSOMExpression); |
300 CXFA_Node* GetInstanceMgrOfSubform(); | 300 CXFA_Node* GetInstanceMgrOfSubform(); |
301 | 301 |
302 CXFA_Node* GetOccurNode(); | 302 CXFA_Node* GetOccurNode(); |
303 void Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments); | 303 void Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments); |
304 void Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments); | 304 void Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments); |
305 void Script_Som_ResolveNodeList(FXJSE_HVALUE hValue, | 305 void Script_Som_ResolveNodeList(FXJSE_HVALUE hValue, |
306 CFX_WideString wsExpression, | 306 CFX_WideString wsExpression, |
307 FX_DWORD dwFlag, | 307 uint32_t dwFlag, |
308 CXFA_Node* refNode = NULL); | 308 CXFA_Node* refNode = NULL); |
309 void Script_TreeClass_All(FXJSE_HVALUE hValue, | 309 void Script_TreeClass_All(FXJSE_HVALUE hValue, |
310 FX_BOOL bSetting, | 310 FX_BOOL bSetting, |
311 XFA_ATTRIBUTE eAttribute); | 311 XFA_ATTRIBUTE eAttribute); |
312 void Script_TreeClass_Nodes(FXJSE_HVALUE hValue, | 312 void Script_TreeClass_Nodes(FXJSE_HVALUE hValue, |
313 FX_BOOL bSetting, | 313 FX_BOOL bSetting, |
314 XFA_ATTRIBUTE eAttribute); | 314 XFA_ATTRIBUTE eAttribute); |
315 void Script_TreeClass_ClassAll(FXJSE_HVALUE hValue, | 315 void Script_TreeClass_ClassAll(FXJSE_HVALUE hValue, |
316 FX_BOOL bSetting, | 316 FX_BOOL bSetting, |
317 XFA_ATTRIBUTE eAttribute); | 317 XFA_ATTRIBUTE eAttribute); |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 void* pKey, | 634 void* pKey, |
635 FX_BOOL bRecursive = FALSE); | 635 FX_BOOL bRecursive = FALSE); |
636 | 636 |
637 CXFA_Node* m_pNext; | 637 CXFA_Node* m_pNext; |
638 CXFA_Node* m_pChild; | 638 CXFA_Node* m_pChild; |
639 CXFA_Node* m_pLastChild; | 639 CXFA_Node* m_pLastChild; |
640 CXFA_Node* m_pParent; | 640 CXFA_Node* m_pParent; |
641 IFDE_XMLNode* m_pXMLNode; | 641 IFDE_XMLNode* m_pXMLNode; |
642 XFA_ELEMENT m_eNodeClass; | 642 XFA_ELEMENT m_eNodeClass; |
643 uint16_t m_ePacket; | 643 uint16_t m_ePacket; |
644 FX_DWORD m_dwNameHash; | 644 uint32_t m_dwNameHash; |
645 CXFA_Node* m_pAuxNode; | 645 CXFA_Node* m_pAuxNode; |
646 XFA_MAPMODULEDATA* m_pMapModuleData; | 646 XFA_MAPMODULEDATA* m_pMapModuleData; |
647 }; | 647 }; |
648 class CXFA_OrdinaryObject : public CXFA_Object { | 648 class CXFA_OrdinaryObject : public CXFA_Object { |
649 public: | 649 public: |
650 CXFA_OrdinaryObject(CXFA_Document* pDocument, XFA_ELEMENT eElement) | 650 CXFA_OrdinaryObject(CXFA_Document* pDocument, XFA_ELEMENT eElement) |
651 : CXFA_Object(pDocument, XFA_OBJECTTYPE_OrdinaryObject), | 651 : CXFA_Object(pDocument, XFA_OBJECTTYPE_OrdinaryObject), |
652 m_uScriptHash(0) { | 652 m_uScriptHash(0) { |
653 m_eNodeClass = eElement; | 653 m_eNodeClass = eElement; |
654 } | 654 } |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 return pObj ? pObj->AsNode() : nullptr; | 795 return pObj ? pObj->AsNode() : nullptr; |
796 } | 796 } |
797 inline const CXFA_OrdinaryObject* ToOrdinaryObject(const CXFA_Object* pObj) { | 797 inline const CXFA_OrdinaryObject* ToOrdinaryObject(const CXFA_Object* pObj) { |
798 return pObj ? pObj->AsOrdinaryObject() : nullptr; | 798 return pObj ? pObj->AsOrdinaryObject() : nullptr; |
799 } | 799 } |
800 inline const CXFA_NodeList* ToNodeList(const CXFA_Object* pObj) { | 800 inline const CXFA_NodeList* ToNodeList(const CXFA_Object* pObj) { |
801 return pObj ? pObj->AsNodeList() : nullptr; | 801 return pObj ? pObj->AsNodeList() : nullptr; |
802 } | 802 } |
803 | 803 |
804 #endif // XFA_FXFA_PARSER_XFA_OBJECT_H_ | 804 #endif // XFA_FXFA_PARSER_XFA_OBJECT_H_ |
OLD | NEW |