| 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 27 matching lines...) Expand all Loading... |
| 38 XFA_NODEFLAG_UserInteractive = 0x01000, | 38 XFA_NODEFLAG_UserInteractive = 0x01000, |
| 39 XFA_NODEFLAG_SkipDataBinding = 0x02000, | 39 XFA_NODEFLAG_SkipDataBinding = 0x02000, |
| 40 XFA_NODEFLAG_OwnXMLNode = 0x04000, | 40 XFA_NODEFLAG_OwnXMLNode = 0x04000, |
| 41 XFA_NODEFLAG_UnusedNode = 0x08000, | 41 XFA_NODEFLAG_UnusedNode = 0x08000, |
| 42 XFA_NODEFLAG_LayoutGeneratedNode = 0x10000, | 42 XFA_NODEFLAG_LayoutGeneratedNode = 0x10000, |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 class CXFA_Object : public CFXJSE_HostObject { | 45 class CXFA_Object : public CFXJSE_HostObject { |
| 46 public: | 46 public: |
| 47 CXFA_Object(CXFA_Document* pDocument, uint32_t uFlags); | 47 CXFA_Object(CXFA_Document* pDocument, uint32_t uFlags); |
| 48 virtual ~CXFA_Object() {} | 48 ~CXFA_Object() override; |
| 49 | 49 |
| 50 CXFA_Document* GetDocument() const { return m_pDocument; } | 50 CXFA_Document* GetDocument() const { return m_pDocument; } |
| 51 uint32_t GetFlag() const { return m_uFlags; } | 51 uint32_t GetFlag() const { return m_uFlags; } |
| 52 XFA_OBJECTTYPE GetObjectType() const { | 52 XFA_OBJECTTYPE GetObjectType() const { |
| 53 return (XFA_OBJECTTYPE)(m_uFlags & XFA_OBJECTTYPEMASK); | 53 return (XFA_OBJECTTYPE)(m_uFlags & XFA_OBJECTTYPEMASK); |
| 54 } | 54 } |
| 55 | 55 |
| 56 bool IsNode() const { | 56 bool IsNode() const { |
| 57 return (m_uFlags & XFA_OBJECTTYPEMASK) >= XFA_OBJECTTYPE_Node; | 57 return (m_uFlags & XFA_OBJECTTYPEMASK) >= XFA_OBJECTTYPE_Node; |
| 58 } | 58 } |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 PD_CALLBACK_DUPLICATEDATA pCopy; | 120 PD_CALLBACK_DUPLICATEDATA pCopy; |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 struct XFA_MAPDATABLOCK { | 123 struct XFA_MAPDATABLOCK { |
| 124 uint8_t* GetData() const { return (uint8_t*)this + sizeof(XFA_MAPDATABLOCK); } | 124 uint8_t* GetData() const { return (uint8_t*)this + sizeof(XFA_MAPDATABLOCK); } |
| 125 XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo; | 125 XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo; |
| 126 int32_t iBytes; | 126 int32_t iBytes; |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 struct XFA_MAPMODULEDATA { | 129 struct XFA_MAPMODULEDATA { |
| 130 XFA_MAPMODULEDATA(); |
| 131 ~XFA_MAPMODULEDATA(); |
| 132 |
| 130 CFX_MapPtrToPtr m_ValueMap; | 133 CFX_MapPtrToPtr m_ValueMap; |
| 131 CFX_MapPtrTemplate<void*, XFA_MAPDATABLOCK*> m_BufferMap; | 134 CFX_MapPtrTemplate<void*, XFA_MAPDATABLOCK*> m_BufferMap; |
| 132 }; | 135 }; |
| 133 | 136 |
| 134 #define XFA_CalcRefCount (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'R') | 137 #define XFA_CalcRefCount (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'R') |
| 135 #define XFA_CalcData (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'C') | 138 #define XFA_CalcData (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'C') |
| 136 #define XFA_LAYOUTITEMKEY (void*)(uintptr_t) FXBSTR_ID('L', 'Y', 'I', 'M') | 139 #define XFA_LAYOUTITEMKEY (void*)(uintptr_t) FXBSTR_ID('L', 'Y', 'I', 'M') |
| 140 |
| 137 class CXFA_Node : public CXFA_Object { | 141 class CXFA_Node : public CXFA_Object { |
| 138 public: | 142 public: |
| 139 XFA_ELEMENT GetClassID() const { return (XFA_ELEMENT)m_eNodeClass; } | 143 XFA_ELEMENT GetClassID() const { return (XFA_ELEMENT)m_eNodeClass; } |
| 140 uint32_t GetPacketID() const { return m_ePacket; } | 144 uint32_t GetPacketID() const { return m_ePacket; } |
| 141 FX_BOOL HasFlag(uint32_t dwFlag) const; | 145 FX_BOOL HasFlag(uint32_t dwFlag) const; |
| 142 void SetFlag(uint32_t dwFlag, bool bNotify); | 146 void SetFlag(uint32_t dwFlag, bool bNotify); |
| 143 void ClearFlag(uint32_t dwFlag); | 147 void ClearFlag(uint32_t dwFlag); |
| 144 | 148 |
| 145 FX_BOOL IsAttributeInXML(); | 149 FX_BOOL IsAttributeInXML(); |
| 146 bool IsFormContainer() const { | 150 bool IsFormContainer() const { |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 CXFA_Node* m_pChild; | 646 CXFA_Node* m_pChild; |
| 643 CXFA_Node* m_pLastChild; | 647 CXFA_Node* m_pLastChild; |
| 644 CXFA_Node* m_pParent; | 648 CXFA_Node* m_pParent; |
| 645 CFDE_XMLNode* m_pXMLNode; | 649 CFDE_XMLNode* m_pXMLNode; |
| 646 XFA_ELEMENT m_eNodeClass; | 650 XFA_ELEMENT m_eNodeClass; |
| 647 uint16_t m_ePacket; | 651 uint16_t m_ePacket; |
| 648 uint32_t m_dwNameHash; | 652 uint32_t m_dwNameHash; |
| 649 CXFA_Node* m_pAuxNode; | 653 CXFA_Node* m_pAuxNode; |
| 650 XFA_MAPMODULEDATA* m_pMapModuleData; | 654 XFA_MAPMODULEDATA* m_pMapModuleData; |
| 651 }; | 655 }; |
| 656 |
| 652 class CXFA_OrdinaryObject : public CXFA_Object { | 657 class CXFA_OrdinaryObject : public CXFA_Object { |
| 653 public: | 658 public: |
| 654 CXFA_OrdinaryObject(CXFA_Document* pDocument, XFA_ELEMENT eElement) | 659 CXFA_OrdinaryObject(CXFA_Document* pDocument, XFA_ELEMENT eElement); |
| 655 : CXFA_Object(pDocument, XFA_OBJECTTYPE_OrdinaryObject), | 660 ~CXFA_OrdinaryObject() override; |
| 656 m_uScriptHash(0) { | 661 |
| 657 m_eNodeClass = eElement; | 662 XFA_ELEMENT GetClassID() const; |
| 658 } | 663 uint32_t GetScriptObjHash() const; |
| 659 XFA_ELEMENT GetClassID() const { return (XFA_ELEMENT)m_eNodeClass; } | |
| 660 uint32_t GetScriptObjHash() { return m_uScriptHash; } | |
| 661 | 664 |
| 662 protected: | 665 protected: |
| 663 XFA_ELEMENT m_eNodeClass; | 666 XFA_ELEMENT m_eNodeClass; |
| 664 uint32_t m_uScriptHash; | 667 uint32_t m_uScriptHash; |
| 665 }; | 668 }; |
| 669 |
| 666 class CXFA_ThisProxy : public CXFA_Object { | 670 class CXFA_ThisProxy : public CXFA_Object { |
| 667 public: | 671 public: |
| 668 CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode) | 672 CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode); |
| 669 : CXFA_Object(pThisNode->GetDocument(), XFA_OBJECTTYPE_VariablesThis), | 673 ~CXFA_ThisProxy() override; |
| 670 m_pThisNode(NULL), | 674 |
| 671 m_pScriptNode(NULL) { | 675 CXFA_Node* GetThisNode() const; |
| 672 m_pThisNode = pThisNode; | 676 CXFA_Node* GetScriptNode() const; |
| 673 m_pScriptNode = pScriptNode; | |
| 674 } | |
| 675 ~CXFA_ThisProxy() override {} | |
| 676 CXFA_Node* GetThisNode() { return m_pThisNode; } | |
| 677 CXFA_Node* GetScriptNode() { return m_pScriptNode; } | |
| 678 | 677 |
| 679 private: | 678 private: |
| 680 CXFA_Node* m_pThisNode; | 679 CXFA_Node* m_pThisNode; |
| 681 CXFA_Node* m_pScriptNode; | 680 CXFA_Node* m_pScriptNode; |
| 682 }; | 681 }; |
| 682 |
| 683 class CXFA_NodeList : public CXFA_Object { | 683 class CXFA_NodeList : public CXFA_Object { |
| 684 public: | 684 public: |
| 685 explicit CXFA_NodeList(CXFA_Document* pDocument); | 685 explicit CXFA_NodeList(CXFA_Document* pDocument); |
| 686 virtual ~CXFA_NodeList() {} | 686 ~CXFA_NodeList() override; |
| 687 XFA_ELEMENT GetClassID() const { return XFA_ELEMENT_NodeList; } | 687 |
| 688 XFA_ELEMENT GetClassID() const; |
| 688 CXFA_Node* NamedItem(const CFX_WideStringC& wsName); | 689 CXFA_Node* NamedItem(const CFX_WideStringC& wsName); |
| 689 virtual int32_t GetLength() = 0; | 690 virtual int32_t GetLength() = 0; |
| 690 virtual FX_BOOL Append(CXFA_Node* pNode) = 0; | 691 virtual FX_BOOL Append(CXFA_Node* pNode) = 0; |
| 691 virtual FX_BOOL Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) = 0; | 692 virtual FX_BOOL Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) = 0; |
| 692 virtual FX_BOOL Remove(CXFA_Node* pNode) = 0; | 693 virtual FX_BOOL Remove(CXFA_Node* pNode) = 0; |
| 693 virtual CXFA_Node* Item(int32_t iIndex) = 0; | 694 virtual CXFA_Node* Item(int32_t iIndex) = 0; |
| 694 | 695 |
| 695 void Script_ListClass_Append(CFXJSE_Arguments* pArguments); | 696 void Script_ListClass_Append(CFXJSE_Arguments* pArguments); |
| 696 void Script_ListClass_Insert(CFXJSE_Arguments* pArguments); | 697 void Script_ListClass_Insert(CFXJSE_Arguments* pArguments); |
| 697 void Script_ListClass_Remove(CFXJSE_Arguments* pArguments); | 698 void Script_ListClass_Remove(CFXJSE_Arguments* pArguments); |
| 698 void Script_ListClass_Item(CFXJSE_Arguments* pArguments); | 699 void Script_ListClass_Item(CFXJSE_Arguments* pArguments); |
| 699 | 700 |
| 700 void Script_TreelistClass_NamedItem(CFXJSE_Arguments* pArguments); | 701 void Script_TreelistClass_NamedItem(CFXJSE_Arguments* pArguments); |
| 701 void Script_ListClass_Length(CFXJSE_Value* pValue, | 702 void Script_ListClass_Length(CFXJSE_Value* pValue, |
| 702 FX_BOOL bSetting, | 703 FX_BOOL bSetting, |
| 703 XFA_ATTRIBUTE eAttribute); | 704 XFA_ATTRIBUTE eAttribute); |
| 704 }; | 705 }; |
| 706 |
| 705 class CXFA_ArrayNodeList : public CXFA_NodeList { | 707 class CXFA_ArrayNodeList : public CXFA_NodeList { |
| 706 public: | 708 public: |
| 707 explicit CXFA_ArrayNodeList(CXFA_Document* pDocument); | 709 explicit CXFA_ArrayNodeList(CXFA_Document* pDocument); |
| 710 ~CXFA_ArrayNodeList() override; |
| 711 |
| 712 // From CXFA_NodeList. |
| 713 int32_t GetLength() override; |
| 714 FX_BOOL Append(CXFA_Node* pNode) override; |
| 715 FX_BOOL Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) override; |
| 716 FX_BOOL Remove(CXFA_Node* pNode) override; |
| 717 CXFA_Node* Item(int32_t iIndex) override; |
| 718 |
| 708 void SetArrayNodeList(const CXFA_NodeArray& srcArray); | 719 void SetArrayNodeList(const CXFA_NodeArray& srcArray); |
| 709 virtual int32_t GetLength(); | |
| 710 virtual FX_BOOL Append(CXFA_Node* pNode); | |
| 711 virtual FX_BOOL Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode); | |
| 712 virtual FX_BOOL Remove(CXFA_Node* pNode); | |
| 713 virtual CXFA_Node* Item(int32_t iIndex); | |
| 714 | 720 |
| 715 protected: | 721 protected: |
| 716 CXFA_NodeArray m_array; | 722 CXFA_NodeArray m_array; |
| 717 }; | 723 }; |
| 724 |
| 718 class CXFA_AttachNodeList : public CXFA_NodeList { | 725 class CXFA_AttachNodeList : public CXFA_NodeList { |
| 719 public: | 726 public: |
| 720 CXFA_AttachNodeList(CXFA_Document* pDocument, CXFA_Node* pAttachNode); | 727 CXFA_AttachNodeList(CXFA_Document* pDocument, CXFA_Node* pAttachNode); |
| 721 | 728 |
| 722 virtual int32_t GetLength(); | 729 // From CXFA_NodeList. |
| 723 virtual FX_BOOL Append(CXFA_Node* pNode); | 730 int32_t GetLength() override; |
| 724 virtual FX_BOOL Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode); | 731 FX_BOOL Append(CXFA_Node* pNode) override; |
| 725 virtual FX_BOOL Remove(CXFA_Node* pNode); | 732 FX_BOOL Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) override; |
| 726 virtual CXFA_Node* Item(int32_t iIndex); | 733 FX_BOOL Remove(CXFA_Node* pNode) override; |
| 734 CXFA_Node* Item(int32_t iIndex) override; |
| 727 | 735 |
| 728 protected: | 736 protected: |
| 729 CXFA_Node* m_pAttachNode; | 737 CXFA_Node* m_pAttachNode; |
| 730 }; | 738 }; |
| 731 class CXFA_TraverseStrategy_XFAContainerNode { | 739 class CXFA_TraverseStrategy_XFAContainerNode { |
| 732 public: | 740 public: |
| 733 static CXFA_Node* GetFirstChild(CXFA_Node* pTemplateNode, | 741 static CXFA_Node* GetFirstChild(CXFA_Node* pTemplateNode, |
| 734 void* pUserData = NULL) { | 742 void* pUserData = NULL) { |
| 735 return pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild, | 743 return pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild, |
| 736 XFA_OBJECTTYPE_ContainerNode); | 744 XFA_OBJECTTYPE_ContainerNode); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 | 795 |
| 788 inline CXFA_Node* ToNode(CXFA_Object* pObj) { | 796 inline CXFA_Node* ToNode(CXFA_Object* pObj) { |
| 789 return pObj ? pObj->AsNode() : nullptr; | 797 return pObj ? pObj->AsNode() : nullptr; |
| 790 } | 798 } |
| 791 | 799 |
| 792 inline const CXFA_Node* ToNode(const CXFA_Object* pObj) { | 800 inline const CXFA_Node* ToNode(const CXFA_Object* pObj) { |
| 793 return pObj ? pObj->AsNode() : nullptr; | 801 return pObj ? pObj->AsNode() : nullptr; |
| 794 } | 802 } |
| 795 | 803 |
| 796 #endif // XFA_FXFA_PARSER_XFA_OBJECT_H_ | 804 #endif // XFA_FXFA_PARSER_XFA_OBJECT_H_ |
| OLD | NEW |