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 <unordered_set> | 10 #include <unordered_set> |
(...skipping 30 matching lines...) Expand all Loading... |
41 XFA_NodeFlag_SkipDataBinding = 1 << 5, | 41 XFA_NodeFlag_SkipDataBinding = 1 << 5, |
42 XFA_NodeFlag_OwnXMLNode = 1 << 6, | 42 XFA_NodeFlag_OwnXMLNode = 1 << 6, |
43 XFA_NodeFlag_UnusedNode = 1 << 7, | 43 XFA_NodeFlag_UnusedNode = 1 << 7, |
44 XFA_NodeFlag_LayoutGeneratedNode = 1 << 8 | 44 XFA_NodeFlag_LayoutGeneratedNode = 1 << 8 |
45 }; | 45 }; |
46 | 46 |
47 class CXFA_Object : public CFXJSE_HostObject { | 47 class CXFA_Object : public CFXJSE_HostObject { |
48 public: | 48 public: |
49 CXFA_Object(CXFA_Document* pDocument, | 49 CXFA_Object(CXFA_Document* pDocument, |
50 XFA_ObjectType objectType, | 50 XFA_ObjectType objectType, |
51 XFA_Element elementType); | 51 XFA_Element eType); |
52 ~CXFA_Object() override; | 52 ~CXFA_Object() override; |
53 | 53 |
54 CXFA_Document* GetDocument() const { return m_pDocument; } | 54 CXFA_Document* GetDocument() const { return m_pDocument; } |
55 XFA_ObjectType GetObjectType() const { return m_objectType; } | 55 XFA_ObjectType GetObjectType() const { return m_objectType; } |
56 | 56 |
57 bool IsNode() const { | 57 bool IsNode() const { |
58 return m_objectType == XFA_ObjectType::Node || | 58 return m_objectType == XFA_ObjectType::Node || |
59 m_objectType == XFA_ObjectType::NodeC || | 59 m_objectType == XFA_ObjectType::NodeC || |
60 m_objectType == XFA_ObjectType::NodeV || | 60 m_objectType == XFA_ObjectType::NodeV || |
61 m_objectType == XFA_ObjectType::ModelNode || | 61 m_objectType == XFA_ObjectType::ModelNode || |
(...skipping 24 matching lines...) Expand all Loading... |
86 XFA_Element GetElementType() const; | 86 XFA_Element GetElementType() const; |
87 void GetClassName(CFX_WideStringC& wsName) const; | 87 void GetClassName(CFX_WideStringC& wsName) const; |
88 uint32_t GetClassHashCode() const; | 88 uint32_t GetClassHashCode() const; |
89 void Script_ObjectClass_ClassName(CFXJSE_Value* pValue, | 89 void Script_ObjectClass_ClassName(CFXJSE_Value* pValue, |
90 FX_BOOL bSetting, | 90 FX_BOOL bSetting, |
91 XFA_ATTRIBUTE eAttribute); | 91 XFA_ATTRIBUTE eAttribute); |
92 void ThrowException(int32_t iStringID, ...); | 92 void ThrowException(int32_t iStringID, ...); |
93 | 93 |
94 protected: | 94 protected: |
95 CXFA_Document* const m_pDocument; | 95 CXFA_Document* const m_pDocument; |
96 XFA_ObjectType m_objectType; | 96 const XFA_ObjectType m_objectType; |
97 XFA_Element m_elementType; | 97 const XFA_Element m_elementType; |
98 }; | 98 }; |
99 using CXFA_ObjArray = CFX_ArrayTemplate<CXFA_Object*>; | 99 using CXFA_ObjArray = CFX_ArrayTemplate<CXFA_Object*>; |
100 | 100 |
101 #define XFA_NODEFILTER_Children 0x01 | 101 #define XFA_NODEFILTER_Children 0x01 |
102 #define XFA_NODEFILTER_Properties 0x02 | 102 #define XFA_NODEFILTER_Properties 0x02 |
103 #define XFA_NODEFILTER_OneOfProperty 0x04 | 103 #define XFA_NODEFILTER_OneOfProperty 0x04 |
104 #define XFA_CLONEFLAG_Content 0x01 | 104 #define XFA_CLONEFLAG_Content 0x01 |
105 enum XFA_NODEITEM { | 105 enum XFA_NODEITEM { |
106 XFA_NODEITEM_Parent, | 106 XFA_NODEITEM_Parent, |
107 XFA_NODEITEM_FirstChild, | 107 XFA_NODEITEM_FirstChild, |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 } | 278 } |
279 FX_BOOL SetUserData(void* pKey, | 279 FX_BOOL SetUserData(void* pKey, |
280 void* pData, | 280 void* pData, |
281 XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = NULL); | 281 XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = NULL); |
282 FX_BOOL TryUserData(void* pKey, void*& pData, FX_BOOL bProtoAlso = FALSE); | 282 FX_BOOL TryUserData(void* pKey, void*& pData, FX_BOOL bProtoAlso = FALSE); |
283 void* GetUserData(void* pKey, FX_BOOL bProtoAlso = FALSE) { | 283 void* GetUserData(void* pKey, FX_BOOL bProtoAlso = FALSE) { |
284 void* pData; | 284 void* pData; |
285 return TryUserData(pKey, pData, bProtoAlso) ? pData : NULL; | 285 return TryUserData(pKey, pData, bProtoAlso) ? pData : NULL; |
286 } | 286 } |
287 CXFA_Node* GetProperty(int32_t index, | 287 CXFA_Node* GetProperty(int32_t index, |
288 XFA_Element eProperty, | 288 XFA_Element eType, |
289 FX_BOOL bCreateProperty = TRUE); | 289 FX_BOOL bCreateProperty = TRUE); |
290 int32_t CountChildren(XFA_Element eElement, FX_BOOL bOnlyChild = FALSE); | 290 int32_t CountChildren(XFA_Element eType, FX_BOOL bOnlyChild = FALSE); |
291 CXFA_Node* GetChild(int32_t index, | 291 CXFA_Node* GetChild(int32_t index, |
292 XFA_Element eElement, | 292 XFA_Element eType, |
293 FX_BOOL bOnlyChild = FALSE); | 293 FX_BOOL bOnlyChild = FALSE); |
294 int32_t InsertChild(int32_t index, CXFA_Node* pNode); | 294 int32_t InsertChild(int32_t index, CXFA_Node* pNode); |
295 FX_BOOL InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode = NULL); | 295 FX_BOOL InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode = NULL); |
296 FX_BOOL RemoveChild(CXFA_Node* pNode, bool bNotify = true); | 296 FX_BOOL RemoveChild(CXFA_Node* pNode, bool bNotify = true); |
297 CXFA_Node* Clone(FX_BOOL bRecursive); | 297 CXFA_Node* Clone(FX_BOOL bRecursive); |
298 CXFA_Node* GetNodeItem(XFA_NODEITEM eItem) const; | 298 CXFA_Node* GetNodeItem(XFA_NODEITEM eItem) const; |
299 CXFA_Node* GetNodeItem(XFA_NODEITEM eItem, XFA_ObjectType eType) const; | 299 CXFA_Node* GetNodeItem(XFA_NODEITEM eItem, XFA_ObjectType eType) const; |
300 int32_t GetNodeList(CXFA_NodeArray& nodes, | 300 int32_t GetNodeList(CXFA_NodeArray& nodes, |
301 uint32_t dwTypeFilter = XFA_NODEFILTER_Children | | 301 uint32_t dwTypeFilter = XFA_NODEFILTER_Children | |
302 XFA_NODEFILTER_Properties, | 302 XFA_NODEFILTER_Properties, |
303 XFA_Element eElementFilter = XFA_Element::Unknown, | 303 XFA_Element eTypeFilter = XFA_Element::Unknown, |
304 int32_t iLevel = 1); | 304 int32_t iLevel = 1); |
305 CXFA_Node* CreateSamePacketNode(XFA_Element eElement, | 305 CXFA_Node* CreateSamePacketNode(XFA_Element eType, |
306 uint32_t dwFlags = XFA_NodeFlag_Initialized); | 306 uint32_t dwFlags = XFA_NodeFlag_Initialized); |
307 CXFA_Node* CloneTemplateToForm(FX_BOOL bRecursive); | 307 CXFA_Node* CloneTemplateToForm(FX_BOOL bRecursive); |
308 CXFA_Node* GetTemplateNode() const; | 308 CXFA_Node* GetTemplateNode() const; |
309 void SetTemplateNode(CXFA_Node* pTemplateNode); | 309 void SetTemplateNode(CXFA_Node* pTemplateNode); |
310 CXFA_Node* GetDataDescriptionNode(); | 310 CXFA_Node* GetDataDescriptionNode(); |
311 void SetDataDescriptionNode(CXFA_Node* pDataDescriptionNode); | 311 void SetDataDescriptionNode(CXFA_Node* pDataDescriptionNode); |
312 CXFA_Node* GetBindData(); | 312 CXFA_Node* GetBindData(); |
313 int32_t GetBindItems(CXFA_NodeArray& formItems); | 313 int32_t GetBindItems(CXFA_NodeArray& formItems); |
314 int32_t AddBindItem(CXFA_Node* pFormNode); | 314 int32_t AddBindItem(CXFA_Node* pFormNode); |
315 int32_t RemoveBindItem(CXFA_Node* pFormNode); | 315 int32_t RemoveBindItem(CXFA_Node* pFormNode); |
316 FX_BOOL HasBindItem(); | 316 FX_BOOL HasBindItem(); |
317 CXFA_WidgetData* GetWidgetData(); | 317 CXFA_WidgetData* GetWidgetData(); |
318 CXFA_WidgetData* GetContainerWidgetData(); | 318 CXFA_WidgetData* GetContainerWidgetData(); |
319 FX_BOOL GetLocaleName(CFX_WideString& wsLocaleName); | 319 FX_BOOL GetLocaleName(CFX_WideString& wsLocaleName); |
320 XFA_ATTRIBUTEENUM GetIntact(); | 320 XFA_ATTRIBUTEENUM GetIntact(); |
321 CXFA_Node* GetFirstChildByName(const CFX_WideStringC& wsNodeName) const; | 321 CXFA_Node* GetFirstChildByName(const CFX_WideStringC& wsNodeName) const; |
322 CXFA_Node* GetFirstChildByName(uint32_t dwNodeNameHash) const; | 322 CXFA_Node* GetFirstChildByName(uint32_t dwNodeNameHash) const; |
323 CXFA_Node* GetFirstChildByClass(XFA_Element eNodeClass) const; | 323 CXFA_Node* GetFirstChildByClass(XFA_Element eType) const; |
324 CXFA_Node* GetNextSameNameSibling(uint32_t dwNodeNameHash) const; | 324 CXFA_Node* GetNextSameNameSibling(uint32_t dwNodeNameHash) const; |
325 CXFA_Node* GetNextSameNameSibling(const CFX_WideStringC& wsNodeName) const; | 325 CXFA_Node* GetNextSameNameSibling(const CFX_WideStringC& wsNodeName) const; |
326 CXFA_Node* GetNextSameClassSibling(XFA_Element eNodeClass) const; | 326 CXFA_Node* GetNextSameClassSibling(XFA_Element eType) const; |
327 int32_t GetNodeSameNameIndex() const; | 327 int32_t GetNodeSameNameIndex() const; |
328 int32_t GetNodeSameClassIndex() const; | 328 int32_t GetNodeSameClassIndex() const; |
329 void GetSOMExpression(CFX_WideString& wsSOMExpression); | 329 void GetSOMExpression(CFX_WideString& wsSOMExpression); |
330 CXFA_Node* GetInstanceMgrOfSubform(); | 330 CXFA_Node* GetInstanceMgrOfSubform(); |
331 | 331 |
332 CXFA_Node* GetOccurNode(); | 332 CXFA_Node* GetOccurNode(); |
333 void Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments); | 333 void Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments); |
334 void Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments); | 334 void Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments); |
335 void Script_Som_ResolveNodeList(CFXJSE_Value* pValue, | 335 void Script_Som_ResolveNodeList(CFXJSE_Value* pValue, |
336 CFX_WideString wsExpression, | 336 CFX_WideString wsExpression, |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 void Script_Encrypt_Format(CFXJSE_Value* pValue, | 609 void Script_Encrypt_Format(CFXJSE_Value* pValue, |
610 FX_BOOL bSetting, | 610 FX_BOOL bSetting, |
611 XFA_ATTRIBUTE eAttribute); | 611 XFA_ATTRIBUTE eAttribute); |
612 void Script_Script_Stateless(CFXJSE_Value* pValue, | 612 void Script_Script_Stateless(CFXJSE_Value* pValue, |
613 FX_BOOL bSetting, | 613 FX_BOOL bSetting, |
614 XFA_ATTRIBUTE eAttribute); | 614 XFA_ATTRIBUTE eAttribute); |
615 | 615 |
616 protected: | 616 protected: |
617 friend class CXFA_Document; | 617 friend class CXFA_Document; |
618 | 618 |
619 CXFA_Node(CXFA_Document* pDoc, uint16_t ePacket, XFA_Element eElement); | 619 CXFA_Node(CXFA_Document* pDoc, uint16_t ePacket, XFA_Element eType); |
620 ~CXFA_Node() override; | 620 ~CXFA_Node() override; |
621 | 621 |
622 bool HasFlag(XFA_NodeFlag dwFlag) const; | 622 bool HasFlag(XFA_NodeFlag dwFlag) const; |
623 CXFA_Node* Deprecated_GetPrevSibling(); | 623 CXFA_Node* Deprecated_GetPrevSibling(); |
624 FX_BOOL SetValue(XFA_ATTRIBUTE eAttr, | 624 FX_BOOL SetValue(XFA_ATTRIBUTE eAttr, |
625 XFA_ATTRIBUTETYPE eType, | 625 XFA_ATTRIBUTETYPE eType, |
626 void* pValue, | 626 void* pValue, |
627 bool bNotify); | 627 bool bNotify); |
628 FX_BOOL GetValue(XFA_ATTRIBUTE eAttr, | 628 FX_BOOL GetValue(XFA_ATTRIBUTE eAttr, |
629 XFA_ATTRIBUTETYPE eType, | 629 XFA_ATTRIBUTETYPE eType, |
630 FX_BOOL bUseDefault, | 630 FX_BOOL bUseDefault, |
631 void*& pValue); | 631 void*& pValue); |
632 void OnRemoved(bool bNotify); | 632 void OnRemoved(bool bNotify); |
633 void OnChanging(XFA_ATTRIBUTE eAttr, bool bNotify); | 633 void OnChanging(XFA_ATTRIBUTE eAttr, bool bNotify); |
634 void OnChanged(XFA_ATTRIBUTE eAttr, bool bNotify, FX_BOOL bScriptModify); | 634 void OnChanged(XFA_ATTRIBUTE eAttr, bool bNotify, FX_BOOL bScriptModify); |
635 int32_t execSingleEventByName(const CFX_WideStringC& wsEventName, | 635 int32_t execSingleEventByName(const CFX_WideStringC& wsEventName, |
636 XFA_Element eElementType); | 636 XFA_Element eType); |
637 FX_BOOL SetScriptContent(const CFX_WideString& wsContent, | 637 FX_BOOL SetScriptContent(const CFX_WideString& wsContent, |
638 const CFX_WideString& wsXMLValue, | 638 const CFX_WideString& wsXMLValue, |
639 bool bNotify = true, | 639 bool bNotify = true, |
640 FX_BOOL bScriptModify = FALSE, | 640 FX_BOOL bScriptModify = FALSE, |
641 FX_BOOL bSyncData = TRUE); | 641 FX_BOOL bSyncData = TRUE); |
642 CFX_WideString GetScriptContent(FX_BOOL bScriptModify = FALSE); | 642 CFX_WideString GetScriptContent(FX_BOOL bScriptModify = FALSE); |
643 XFA_MAPMODULEDATA* CreateMapModuleData(); | 643 XFA_MAPMODULEDATA* CreateMapModuleData(); |
644 XFA_MAPMODULEDATA* GetMapModuleData() const; | 644 XFA_MAPMODULEDATA* GetMapModuleData() const; |
645 void SetMapModuleValue(void* pKey, void* pValue); | 645 void SetMapModuleValue(void* pKey, void* pValue); |
646 FX_BOOL GetMapModuleValue(void* pKey, void*& pValue); | 646 FX_BOOL GetMapModuleValue(void* pKey, void*& pValue); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 | 797 |
798 inline CXFA_Node* ToNode(CXFA_Object* pObj) { | 798 inline CXFA_Node* ToNode(CXFA_Object* pObj) { |
799 return pObj ? pObj->AsNode() : nullptr; | 799 return pObj ? pObj->AsNode() : nullptr; |
800 } | 800 } |
801 | 801 |
802 inline const CXFA_Node* ToNode(const CXFA_Object* pObj) { | 802 inline const CXFA_Node* ToNode(const CXFA_Object* pObj) { |
803 return pObj ? pObj->AsNode() : nullptr; | 803 return pObj ? pObj->AsNode() : nullptr; |
804 } | 804 } |
805 | 805 |
806 #endif // XFA_FXFA_PARSER_XFA_OBJECT_H_ | 806 #endif // XFA_FXFA_PARSER_XFA_OBJECT_H_ |
OLD | NEW |