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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 } | 263 } |
264 FX_BOOL SetMeasure(XFA_ATTRIBUTE eAttr, | 264 FX_BOOL SetMeasure(XFA_ATTRIBUTE eAttr, |
265 CXFA_Measurement mValue, | 265 CXFA_Measurement mValue, |
266 bool bNotify = false); | 266 bool bNotify = false); |
267 FX_BOOL TryMeasure(XFA_ATTRIBUTE eAttr, | 267 FX_BOOL TryMeasure(XFA_ATTRIBUTE eAttr, |
268 CXFA_Measurement& mValue, | 268 CXFA_Measurement& mValue, |
269 FX_BOOL bUseDefault = TRUE) const; | 269 FX_BOOL bUseDefault = TRUE) const; |
270 CXFA_Measurement GetMeasure(XFA_ATTRIBUTE eAttr) const; | 270 CXFA_Measurement GetMeasure(XFA_ATTRIBUTE eAttr) const; |
271 FX_BOOL SetObject(XFA_ATTRIBUTE eAttr, | 271 FX_BOOL SetObject(XFA_ATTRIBUTE eAttr, |
272 void* pData, | 272 void* pData, |
273 XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = NULL); | 273 XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = nullptr); |
274 FX_BOOL TryObject(XFA_ATTRIBUTE eAttr, void*& pData); | 274 FX_BOOL TryObject(XFA_ATTRIBUTE eAttr, void*& pData); |
275 void* GetObject(XFA_ATTRIBUTE eAttr) { | 275 void* GetObject(XFA_ATTRIBUTE eAttr) { |
276 void* pData; | 276 void* pData; |
277 return TryObject(eAttr, pData) ? pData : NULL; | 277 return TryObject(eAttr, pData) ? pData : nullptr; |
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 = nullptr); |
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 : nullptr; |
286 } | 286 } |
287 CXFA_Node* GetProperty(int32_t index, | 287 CXFA_Node* GetProperty(int32_t index, |
288 XFA_Element eType, | 288 XFA_Element eType, |
289 FX_BOOL bCreateProperty = TRUE); | 289 FX_BOOL bCreateProperty = TRUE); |
290 int32_t CountChildren(XFA_Element eType, 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 eType, | 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 = nullptr); |
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 eTypeFilter = 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 eType, | 305 CXFA_Node* CreateSamePacketNode(XFA_Element eType, |
(...skipping 22 matching lines...) Expand all Loading... |
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, |
337 uint32_t dwFlag, | 337 uint32_t dwFlag, |
338 CXFA_Node* refNode = NULL); | 338 CXFA_Node* refNode = nullptr); |
339 void Script_TreeClass_All(CFXJSE_Value* pValue, | 339 void Script_TreeClass_All(CFXJSE_Value* pValue, |
340 FX_BOOL bSetting, | 340 FX_BOOL bSetting, |
341 XFA_ATTRIBUTE eAttribute); | 341 XFA_ATTRIBUTE eAttribute); |
342 void Script_TreeClass_Nodes(CFXJSE_Value* pValue, | 342 void Script_TreeClass_Nodes(CFXJSE_Value* pValue, |
343 FX_BOOL bSetting, | 343 FX_BOOL bSetting, |
344 XFA_ATTRIBUTE eAttribute); | 344 XFA_ATTRIBUTE eAttribute); |
345 void Script_TreeClass_ClassAll(CFXJSE_Value* pValue, | 345 void Script_TreeClass_ClassAll(CFXJSE_Value* pValue, |
346 FX_BOOL bSetting, | 346 FX_BOOL bSetting, |
347 XFA_ATTRIBUTE eAttribute); | 347 XFA_ATTRIBUTE eAttribute); |
348 void Script_TreeClass_Parent(CFXJSE_Value* pValue, | 348 void Script_TreeClass_Parent(CFXJSE_Value* pValue, |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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); |
647 void SetMapModuleString(void* pKey, const CFX_WideStringC& wsValue); | 647 void SetMapModuleString(void* pKey, const CFX_WideStringC& wsValue); |
648 FX_BOOL GetMapModuleString(void* pKey, CFX_WideStringC& wsValue); | 648 FX_BOOL GetMapModuleString(void* pKey, CFX_WideStringC& wsValue); |
649 void SetMapModuleBuffer(void* pKey, | 649 void SetMapModuleBuffer( |
650 void* pValue, | 650 void* pKey, |
651 int32_t iBytes, | 651 void* pValue, |
652 XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = NULL); | 652 int32_t iBytes, |
| 653 XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = nullptr); |
653 FX_BOOL GetMapModuleBuffer(void* pKey, | 654 FX_BOOL GetMapModuleBuffer(void* pKey, |
654 void*& pValue, | 655 void*& pValue, |
655 int32_t& iBytes, | 656 int32_t& iBytes, |
656 FX_BOOL bProtoAlso = TRUE) const; | 657 FX_BOOL bProtoAlso = TRUE) const; |
657 FX_BOOL HasMapModuleKey(void* pKey, FX_BOOL bProtoAlso = FALSE); | 658 FX_BOOL HasMapModuleKey(void* pKey, FX_BOOL bProtoAlso = FALSE); |
658 void RemoveMapModuleKey(void* pKey = NULL); | 659 void RemoveMapModuleKey(void* pKey = nullptr); |
659 void MergeAllData(void* pDstModule, FX_BOOL bUseSrcAttr = TRUE); | 660 void MergeAllData(void* pDstModule, FX_BOOL bUseSrcAttr = TRUE); |
660 void MoveBufferMapData(CXFA_Node* pDstModule, void* pKey); | 661 void MoveBufferMapData(CXFA_Node* pDstModule, void* pKey); |
661 void MoveBufferMapData(CXFA_Node* pSrcModule, | 662 void MoveBufferMapData(CXFA_Node* pSrcModule, |
662 CXFA_Node* pDstModule, | 663 CXFA_Node* pDstModule, |
663 void* pKey, | 664 void* pKey, |
664 FX_BOOL bRecursive = FALSE); | 665 FX_BOOL bRecursive = FALSE); |
665 | 666 |
666 CXFA_Node* m_pNext; | 667 CXFA_Node* m_pNext; |
667 CXFA_Node* m_pChild; | 668 CXFA_Node* m_pChild; |
668 CXFA_Node* m_pLastChild; | 669 CXFA_Node* m_pLastChild; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 FX_BOOL Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) override; | 740 FX_BOOL Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) override; |
740 FX_BOOL Remove(CXFA_Node* pNode) override; | 741 FX_BOOL Remove(CXFA_Node* pNode) override; |
741 CXFA_Node* Item(int32_t iIndex) override; | 742 CXFA_Node* Item(int32_t iIndex) override; |
742 | 743 |
743 protected: | 744 protected: |
744 CXFA_Node* m_pAttachNode; | 745 CXFA_Node* m_pAttachNode; |
745 }; | 746 }; |
746 class CXFA_TraverseStrategy_XFAContainerNode { | 747 class CXFA_TraverseStrategy_XFAContainerNode { |
747 public: | 748 public: |
748 static CXFA_Node* GetFirstChild(CXFA_Node* pTemplateNode, | 749 static CXFA_Node* GetFirstChild(CXFA_Node* pTemplateNode, |
749 void* pUserData = NULL) { | 750 void* pUserData = nullptr) { |
750 return pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild, | 751 return pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild, |
751 XFA_ObjectType::ContainerNode); | 752 XFA_ObjectType::ContainerNode); |
752 } | 753 } |
753 static CXFA_Node* GetNextSibling(CXFA_Node* pTemplateNode, | 754 static CXFA_Node* GetNextSibling(CXFA_Node* pTemplateNode, |
754 void* pUserData = NULL) { | 755 void* pUserData = nullptr) { |
755 return pTemplateNode->GetNodeItem(XFA_NODEITEM_NextSibling, | 756 return pTemplateNode->GetNodeItem(XFA_NODEITEM_NextSibling, |
756 XFA_ObjectType::ContainerNode); | 757 XFA_ObjectType::ContainerNode); |
757 } | 758 } |
758 static CXFA_Node* GetParent(CXFA_Node* pTemplateNode, | 759 static CXFA_Node* GetParent(CXFA_Node* pTemplateNode, |
759 void* pUserData = NULL) { | 760 void* pUserData = nullptr) { |
760 return pTemplateNode->GetNodeItem(XFA_NODEITEM_Parent, | 761 return pTemplateNode->GetNodeItem(XFA_NODEITEM_Parent, |
761 XFA_ObjectType::ContainerNode); | 762 XFA_ObjectType::ContainerNode); |
762 } | 763 } |
763 }; | 764 }; |
764 typedef CXFA_NodeIteratorTemplate<CXFA_Node, | 765 typedef CXFA_NodeIteratorTemplate<CXFA_Node, |
765 CXFA_TraverseStrategy_XFAContainerNode> | 766 CXFA_TraverseStrategy_XFAContainerNode> |
766 CXFA_ContainerIterator; | 767 CXFA_ContainerIterator; |
767 class CXFA_TraverseStrategy_XFANode { | 768 class CXFA_TraverseStrategy_XFANode { |
768 public: | 769 public: |
769 static inline CXFA_Node* GetFirstChild(CXFA_Node* pTemplateNode) { | 770 static inline CXFA_Node* GetFirstChild(CXFA_Node* pTemplateNode) { |
(...skipping 27 matching lines...) Expand all Loading... |
797 | 798 |
798 inline CXFA_Node* ToNode(CXFA_Object* pObj) { | 799 inline CXFA_Node* ToNode(CXFA_Object* pObj) { |
799 return pObj ? pObj->AsNode() : nullptr; | 800 return pObj ? pObj->AsNode() : nullptr; |
800 } | 801 } |
801 | 802 |
802 inline const CXFA_Node* ToNode(const CXFA_Object* pObj) { | 803 inline const CXFA_Node* ToNode(const CXFA_Object* pObj) { |
803 return pObj ? pObj->AsNode() : nullptr; | 804 return pObj ? pObj->AsNode() : nullptr; |
804 } | 805 } |
805 | 806 |
806 #endif // XFA_FXFA_PARSER_XFA_OBJECT_H_ | 807 #endif // XFA_FXFA_PARSER_XFA_OBJECT_H_ |
OLD | NEW |