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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 } | 241 } |
242 FX_BOOL SetMeasure(XFA_ATTRIBUTE eAttr, | 242 FX_BOOL SetMeasure(XFA_ATTRIBUTE eAttr, |
243 CXFA_Measurement mValue, | 243 CXFA_Measurement mValue, |
244 bool bNotify = false); | 244 bool bNotify = false); |
245 FX_BOOL TryMeasure(XFA_ATTRIBUTE eAttr, | 245 FX_BOOL TryMeasure(XFA_ATTRIBUTE eAttr, |
246 CXFA_Measurement& mValue, | 246 CXFA_Measurement& mValue, |
247 FX_BOOL bUseDefault = TRUE) const; | 247 FX_BOOL bUseDefault = TRUE) const; |
248 CXFA_Measurement GetMeasure(XFA_ATTRIBUTE eAttr) const; | 248 CXFA_Measurement GetMeasure(XFA_ATTRIBUTE eAttr) const; |
249 FX_BOOL SetObject(XFA_ATTRIBUTE eAttr, | 249 FX_BOOL SetObject(XFA_ATTRIBUTE eAttr, |
250 void* pData, | 250 void* pData, |
251 XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = NULL); | 251 XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = nullptr); |
252 FX_BOOL TryObject(XFA_ATTRIBUTE eAttr, void*& pData); | 252 FX_BOOL TryObject(XFA_ATTRIBUTE eAttr, void*& pData); |
253 void* GetObject(XFA_ATTRIBUTE eAttr) { | 253 void* GetObject(XFA_ATTRIBUTE eAttr) { |
254 void* pData; | 254 void* pData; |
255 return TryObject(eAttr, pData) ? pData : NULL; | 255 return TryObject(eAttr, pData) ? pData : nullptr; |
256 } | 256 } |
257 FX_BOOL SetUserData(void* pKey, | 257 FX_BOOL SetUserData(void* pKey, |
258 void* pData, | 258 void* pData, |
259 XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = NULL); | 259 XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = nullptr); |
260 FX_BOOL TryUserData(void* pKey, void*& pData, FX_BOOL bProtoAlso = FALSE); | 260 FX_BOOL TryUserData(void* pKey, void*& pData, FX_BOOL bProtoAlso = FALSE); |
261 void* GetUserData(void* pKey, FX_BOOL bProtoAlso = FALSE) { | 261 void* GetUserData(void* pKey, FX_BOOL bProtoAlso = FALSE) { |
262 void* pData; | 262 void* pData; |
263 return TryUserData(pKey, pData, bProtoAlso) ? pData : NULL; | 263 return TryUserData(pKey, pData, bProtoAlso) ? pData : nullptr; |
264 } | 264 } |
265 CXFA_Node* GetProperty(int32_t index, | 265 CXFA_Node* GetProperty(int32_t index, |
266 XFA_ELEMENT eProperty, | 266 XFA_ELEMENT eProperty, |
267 FX_BOOL bCreateProperty = TRUE); | 267 FX_BOOL bCreateProperty = TRUE); |
268 int32_t CountChildren(XFA_ELEMENT eElement, FX_BOOL bOnlyChild = FALSE); | 268 int32_t CountChildren(XFA_ELEMENT eElement, FX_BOOL bOnlyChild = FALSE); |
269 CXFA_Node* GetChild(int32_t index, | 269 CXFA_Node* GetChild(int32_t index, |
270 XFA_ELEMENT eElement, | 270 XFA_ELEMENT eElement, |
271 FX_BOOL bOnlyChild = FALSE); | 271 FX_BOOL bOnlyChild = FALSE); |
272 int32_t InsertChild(int32_t index, CXFA_Node* pNode); | 272 int32_t InsertChild(int32_t index, CXFA_Node* pNode); |
273 FX_BOOL InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode = NULL); | 273 FX_BOOL InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode = nullptr); |
274 FX_BOOL RemoveChild(CXFA_Node* pNode, bool bNotify = true); | 274 FX_BOOL RemoveChild(CXFA_Node* pNode, bool bNotify = true); |
275 CXFA_Node* Clone(FX_BOOL bRecursive); | 275 CXFA_Node* Clone(FX_BOOL bRecursive); |
276 CXFA_Node* GetNodeItem(XFA_NODEITEM eItem) const; | 276 CXFA_Node* GetNodeItem(XFA_NODEITEM eItem) const; |
277 CXFA_Node* GetNodeItem(XFA_NODEITEM eItem, XFA_OBJECTTYPE eType) const; | 277 CXFA_Node* GetNodeItem(XFA_NODEITEM eItem, XFA_OBJECTTYPE eType) const; |
278 int32_t GetNodeList(CXFA_NodeArray& nodes, | 278 int32_t GetNodeList(CXFA_NodeArray& nodes, |
279 uint32_t dwTypeFilter = XFA_NODEFILTER_Children | | 279 uint32_t dwTypeFilter = XFA_NODEFILTER_Children | |
280 XFA_NODEFILTER_Properties, | 280 XFA_NODEFILTER_Properties, |
281 XFA_ELEMENT eElementFilter = XFA_ELEMENT_UNKNOWN, | 281 XFA_ELEMENT eElementFilter = XFA_ELEMENT_UNKNOWN, |
282 int32_t iLevel = 1); | 282 int32_t iLevel = 1); |
283 CXFA_Node* CreateSamePacketNode(XFA_ELEMENT eElement, | 283 CXFA_Node* CreateSamePacketNode(XFA_ELEMENT eElement, |
(...skipping 22 matching lines...) Expand all Loading... |
306 int32_t GetNodeSameClassIndex() const; | 306 int32_t GetNodeSameClassIndex() const; |
307 void GetSOMExpression(CFX_WideString& wsSOMExpression); | 307 void GetSOMExpression(CFX_WideString& wsSOMExpression); |
308 CXFA_Node* GetInstanceMgrOfSubform(); | 308 CXFA_Node* GetInstanceMgrOfSubform(); |
309 | 309 |
310 CXFA_Node* GetOccurNode(); | 310 CXFA_Node* GetOccurNode(); |
311 void Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments); | 311 void Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments); |
312 void Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments); | 312 void Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments); |
313 void Script_Som_ResolveNodeList(CFXJSE_Value* pValue, | 313 void Script_Som_ResolveNodeList(CFXJSE_Value* pValue, |
314 CFX_WideString wsExpression, | 314 CFX_WideString wsExpression, |
315 uint32_t dwFlag, | 315 uint32_t dwFlag, |
316 CXFA_Node* refNode = NULL); | 316 CXFA_Node* refNode = nullptr); |
317 void Script_TreeClass_All(CFXJSE_Value* pValue, | 317 void Script_TreeClass_All(CFXJSE_Value* pValue, |
318 FX_BOOL bSetting, | 318 FX_BOOL bSetting, |
319 XFA_ATTRIBUTE eAttribute); | 319 XFA_ATTRIBUTE eAttribute); |
320 void Script_TreeClass_Nodes(CFXJSE_Value* pValue, | 320 void Script_TreeClass_Nodes(CFXJSE_Value* pValue, |
321 FX_BOOL bSetting, | 321 FX_BOOL bSetting, |
322 XFA_ATTRIBUTE eAttribute); | 322 XFA_ATTRIBUTE eAttribute); |
323 void Script_TreeClass_ClassAll(CFXJSE_Value* pValue, | 323 void Script_TreeClass_ClassAll(CFXJSE_Value* pValue, |
324 FX_BOOL bSetting, | 324 FX_BOOL bSetting, |
325 XFA_ATTRIBUTE eAttribute); | 325 XFA_ATTRIBUTE eAttribute); |
326 void Script_TreeClass_Parent(CFXJSE_Value* pValue, | 326 void Script_TreeClass_Parent(CFXJSE_Value* pValue, |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 bool bNotify = true, | 614 bool bNotify = true, |
615 FX_BOOL bScriptModify = FALSE, | 615 FX_BOOL bScriptModify = FALSE, |
616 FX_BOOL bSyncData = TRUE); | 616 FX_BOOL bSyncData = TRUE); |
617 CFX_WideString GetScriptContent(FX_BOOL bScriptModify = FALSE); | 617 CFX_WideString GetScriptContent(FX_BOOL bScriptModify = FALSE); |
618 XFA_MAPMODULEDATA* CreateMapModuleData(); | 618 XFA_MAPMODULEDATA* CreateMapModuleData(); |
619 XFA_MAPMODULEDATA* GetMapModuleData() const; | 619 XFA_MAPMODULEDATA* GetMapModuleData() const; |
620 void SetMapModuleValue(void* pKey, void* pValue); | 620 void SetMapModuleValue(void* pKey, void* pValue); |
621 FX_BOOL GetMapModuleValue(void* pKey, void*& pValue); | 621 FX_BOOL GetMapModuleValue(void* pKey, void*& pValue); |
622 void SetMapModuleString(void* pKey, const CFX_WideStringC& wsValue); | 622 void SetMapModuleString(void* pKey, const CFX_WideStringC& wsValue); |
623 FX_BOOL GetMapModuleString(void* pKey, CFX_WideStringC& wsValue); | 623 FX_BOOL GetMapModuleString(void* pKey, CFX_WideStringC& wsValue); |
624 void SetMapModuleBuffer(void* pKey, | 624 void SetMapModuleBuffer( |
625 void* pValue, | 625 void* pKey, |
626 int32_t iBytes, | 626 void* pValue, |
627 XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = NULL); | 627 int32_t iBytes, |
| 628 XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = nullptr); |
628 FX_BOOL GetMapModuleBuffer(void* pKey, | 629 FX_BOOL GetMapModuleBuffer(void* pKey, |
629 void*& pValue, | 630 void*& pValue, |
630 int32_t& iBytes, | 631 int32_t& iBytes, |
631 FX_BOOL bProtoAlso = TRUE) const; | 632 FX_BOOL bProtoAlso = TRUE) const; |
632 FX_BOOL HasMapModuleKey(void* pKey, FX_BOOL bProtoAlso = FALSE); | 633 FX_BOOL HasMapModuleKey(void* pKey, FX_BOOL bProtoAlso = FALSE); |
633 void RemoveMapModuleKey(void* pKey = NULL); | 634 void RemoveMapModuleKey(void* pKey = nullptr); |
634 void MergeAllData(void* pDstModule, FX_BOOL bUseSrcAttr = TRUE); | 635 void MergeAllData(void* pDstModule, FX_BOOL bUseSrcAttr = TRUE); |
635 void MoveBufferMapData(CXFA_Node* pDstModule, void* pKey); | 636 void MoveBufferMapData(CXFA_Node* pDstModule, void* pKey); |
636 void MoveBufferMapData(CXFA_Node* pSrcModule, | 637 void MoveBufferMapData(CXFA_Node* pSrcModule, |
637 CXFA_Node* pDstModule, | 638 CXFA_Node* pDstModule, |
638 void* pKey, | 639 void* pKey, |
639 FX_BOOL bRecursive = FALSE); | 640 FX_BOOL bRecursive = FALSE); |
640 | 641 |
641 CXFA_Node* m_pNext; | 642 CXFA_Node* m_pNext; |
642 CXFA_Node* m_pChild; | 643 CXFA_Node* m_pChild; |
643 CXFA_Node* m_pLastChild; | 644 CXFA_Node* m_pLastChild; |
(...skipping 16 matching lines...) Expand all Loading... |
660 uint32_t GetScriptObjHash() { return m_uScriptHash; } | 661 uint32_t GetScriptObjHash() { return m_uScriptHash; } |
661 | 662 |
662 protected: | 663 protected: |
663 XFA_ELEMENT m_eNodeClass; | 664 XFA_ELEMENT m_eNodeClass; |
664 uint32_t m_uScriptHash; | 665 uint32_t m_uScriptHash; |
665 }; | 666 }; |
666 class CXFA_ThisProxy : public CXFA_Object { | 667 class CXFA_ThisProxy : public CXFA_Object { |
667 public: | 668 public: |
668 CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode) | 669 CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode) |
669 : CXFA_Object(pThisNode->GetDocument(), XFA_OBJECTTYPE_VariablesThis), | 670 : CXFA_Object(pThisNode->GetDocument(), XFA_OBJECTTYPE_VariablesThis), |
670 m_pThisNode(NULL), | 671 m_pThisNode(nullptr), |
671 m_pScriptNode(NULL) { | 672 m_pScriptNode(nullptr) { |
672 m_pThisNode = pThisNode; | 673 m_pThisNode = pThisNode; |
673 m_pScriptNode = pScriptNode; | 674 m_pScriptNode = pScriptNode; |
674 } | 675 } |
675 ~CXFA_ThisProxy() override {} | 676 ~CXFA_ThisProxy() override {} |
676 CXFA_Node* GetThisNode() { return m_pThisNode; } | 677 CXFA_Node* GetThisNode() { return m_pThisNode; } |
677 CXFA_Node* GetScriptNode() { return m_pScriptNode; } | 678 CXFA_Node* GetScriptNode() { return m_pScriptNode; } |
678 | 679 |
679 private: | 680 private: |
680 CXFA_Node* m_pThisNode; | 681 CXFA_Node* m_pThisNode; |
681 CXFA_Node* m_pScriptNode; | 682 CXFA_Node* m_pScriptNode; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 virtual FX_BOOL Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode); | 725 virtual FX_BOOL Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode); |
725 virtual FX_BOOL Remove(CXFA_Node* pNode); | 726 virtual FX_BOOL Remove(CXFA_Node* pNode); |
726 virtual CXFA_Node* Item(int32_t iIndex); | 727 virtual CXFA_Node* Item(int32_t iIndex); |
727 | 728 |
728 protected: | 729 protected: |
729 CXFA_Node* m_pAttachNode; | 730 CXFA_Node* m_pAttachNode; |
730 }; | 731 }; |
731 class CXFA_TraverseStrategy_XFAContainerNode { | 732 class CXFA_TraverseStrategy_XFAContainerNode { |
732 public: | 733 public: |
733 static CXFA_Node* GetFirstChild(CXFA_Node* pTemplateNode, | 734 static CXFA_Node* GetFirstChild(CXFA_Node* pTemplateNode, |
734 void* pUserData = NULL) { | 735 void* pUserData = nullptr) { |
735 return pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild, | 736 return pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild, |
736 XFA_OBJECTTYPE_ContainerNode); | 737 XFA_OBJECTTYPE_ContainerNode); |
737 } | 738 } |
738 static CXFA_Node* GetNextSibling(CXFA_Node* pTemplateNode, | 739 static CXFA_Node* GetNextSibling(CXFA_Node* pTemplateNode, |
739 void* pUserData = NULL) { | 740 void* pUserData = nullptr) { |
740 return pTemplateNode->GetNodeItem(XFA_NODEITEM_NextSibling, | 741 return pTemplateNode->GetNodeItem(XFA_NODEITEM_NextSibling, |
741 XFA_OBJECTTYPE_ContainerNode); | 742 XFA_OBJECTTYPE_ContainerNode); |
742 } | 743 } |
743 static CXFA_Node* GetParent(CXFA_Node* pTemplateNode, | 744 static CXFA_Node* GetParent(CXFA_Node* pTemplateNode, |
744 void* pUserData = NULL) { | 745 void* pUserData = nullptr) { |
745 return pTemplateNode->GetNodeItem(XFA_NODEITEM_Parent, | 746 return pTemplateNode->GetNodeItem(XFA_NODEITEM_Parent, |
746 XFA_OBJECTTYPE_ContainerNode); | 747 XFA_OBJECTTYPE_ContainerNode); |
747 } | 748 } |
748 }; | 749 }; |
749 typedef CXFA_NodeIteratorTemplate<CXFA_Node, | 750 typedef CXFA_NodeIteratorTemplate<CXFA_Node, |
750 CXFA_TraverseStrategy_XFAContainerNode> | 751 CXFA_TraverseStrategy_XFAContainerNode> |
751 CXFA_ContainerIterator; | 752 CXFA_ContainerIterator; |
752 class CXFA_TraverseStrategy_XFANode { | 753 class CXFA_TraverseStrategy_XFANode { |
753 public: | 754 public: |
754 static inline CXFA_Node* GetFirstChild(CXFA_Node* pTemplateNode) { | 755 static inline CXFA_Node* GetFirstChild(CXFA_Node* pTemplateNode) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 | 788 |
788 inline CXFA_Node* ToNode(CXFA_Object* pObj) { | 789 inline CXFA_Node* ToNode(CXFA_Object* pObj) { |
789 return pObj ? pObj->AsNode() : nullptr; | 790 return pObj ? pObj->AsNode() : nullptr; |
790 } | 791 } |
791 | 792 |
792 inline const CXFA_Node* ToNode(const CXFA_Object* pObj) { | 793 inline const CXFA_Node* ToNode(const CXFA_Object* pObj) { |
793 return pObj ? pObj->AsNode() : nullptr; | 794 return pObj ? pObj->AsNode() : nullptr; |
794 } | 795 } |
795 | 796 |
796 #endif // XFA_FXFA_PARSER_XFA_OBJECT_H_ | 797 #endif // XFA_FXFA_PARSER_XFA_OBJECT_H_ |
OLD | NEW |