diff options
author | Tom Sepez <tsepez@chromium.org> | 2016-02-03 14:54:43 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2016-02-03 14:54:43 -0800 |
commit | bfe3059a66d7c3291be81f7faecafcee08160f6b (patch) | |
tree | 093a40a4cdc57e1fe1fd3a35dc16e4e072a5ae7a /xfa/src | |
parent | d6262c1d5a83baa59d7927c646f8d62febd594b0 (diff) | |
download | pdfium-bfe3059a66d7c3291be81f7faecafcee08160f6b.tar.xz |
Add CFXA_Object helper methods.
Mark some ctors explicit.
Rename GetXFANode to GetXFAObject to match its return type,
since it is cast to node in many places.
BUG=pdfium:384
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1662063002 .
Diffstat (limited to 'xfa/src')
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_ffdoc.cpp | 10 | ||||
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_ffdochandler.cpp | 2 | ||||
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_ffdocview.cpp | 14 | ||||
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp | 2 | ||||
-rw-r--r-- | xfa/src/fxfa/src/common/xfa_document.h | 4 | ||||
-rw-r--r-- | xfa/src/fxfa/src/common/xfa_object.h | 91 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp | 10 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_document_imp.cpp | 17 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_document_layout_imp.cpp | 2 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_document_serialize.cpp | 7 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp | 6 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_object_imp.cpp | 34 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_script_imp.cpp | 2 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_script_nodehelper.cpp | 2 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_script_resolveprocessor.cpp | 6 |
15 files changed, 133 insertions, 76 deletions
diff --git a/xfa/src/fxfa/src/app/xfa_ffdoc.cpp b/xfa/src/fxfa/src/app/xfa_ffdoc.cpp index 38901dde8a..012aa4c6a5 100644 --- a/xfa/src/fxfa/src/app/xfa_ffdoc.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffdoc.cpp @@ -100,7 +100,8 @@ void XFA_XPDPacket_MergeRootNode(CXFA_Node* pOriginRoot, CXFA_Node* pNewRoot) { int32_t CXFA_FFDoc::DoLoad(IFX_Pause* pPause) { int32_t iStatus = m_pDocument->GetParser()->DoParse(pPause); if (iStatus == XFA_PARSESTATUS_Done && !m_pPDFDoc) { - CXFA_Node* pPDFNode = (CXFA_Node*)m_pDocument->GetXFANode(XFA_HASHCODE_Pdf); + CXFA_Node* pPDFNode = + (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Pdf); if (!pPDFNode) { return XFA_PARSESTATUS_SyntaxErr; } @@ -159,7 +160,8 @@ int32_t CXFA_FFDoc::DoLoad(IFX_Pause* pPause) { void CXFA_FFDoc::StopLoad() { m_pApp->GetXFAFontMgr()->LoadDocFonts(this); m_dwDocType = XFA_DOCTYPE_Static; - CXFA_Node* pConfig = (CXFA_Node*)m_pDocument->GetXFANode(XFA_HASHCODE_Config); + CXFA_Node* pConfig = + (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Config); if (!pConfig) { return; } @@ -395,7 +397,7 @@ CFX_DIBitmap* CXFA_FFDoc::GetPDFNamedImage(const CFX_WideStringC& wsName, IFDE_XMLElement* CXFA_FFDoc::GetPackageData(const CFX_WideStringC& wsPackage) { FX_DWORD packetHash = FX_HashCode_String_GetW(wsPackage.GetPtr(), wsPackage.GetLength()); - CXFA_Object* pObject = m_pDocument->GetXFANode(packetHash); + CXFA_Object* pObject = m_pDocument->GetXFAObject(packetHash); CXFA_Node* pNode = (pObject && pObject->IsNode()) ? (CXFA_Node*)pObject : NULL; if (!pNode) { @@ -419,7 +421,7 @@ FX_BOOL CXFA_FFDoc::SavePackage(const CFX_WideStringC& wsPackage, if (packetHash == XFA_HASHCODE_Xfa) { pNode = m_pDocument->GetRoot(); } else { - CXFA_Object* pObject = m_pDocument->GetXFANode(packetHash); + CXFA_Object* pObject = m_pDocument->GetXFAObject(packetHash); pNode = (pObject && pObject->IsNode()) ? (CXFA_Node*)pObject : NULL; } FX_BOOL bFlags = FALSE; diff --git a/xfa/src/fxfa/src/app/xfa_ffdochandler.cpp b/xfa/src/fxfa/src/app/xfa_ffdochandler.cpp index c5f6ba6e62..2fac3449ad 100644 --- a/xfa/src/fxfa/src/app/xfa_ffdochandler.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffdochandler.cpp @@ -79,7 +79,7 @@ XFA_ATTRIBUTEENUM CXFA_FFDocHandler::GetRestoreState(IXFA_Doc* hDoc) { if (!pXFADoc) { return XFA_ATTRIBUTEENUM_Unknown; } - CXFA_Node* pForm = (CXFA_Node*)pXFADoc->GetXFANode(XFA_HASHCODE_Form); + CXFA_Node* pForm = (CXFA_Node*)pXFADoc->GetXFAObject(XFA_HASHCODE_Form); if (!pForm) { return XFA_ATTRIBUTEENUM_Unknown; } diff --git a/xfa/src/fxfa/src/app/xfa_ffdocview.cpp b/xfa/src/fxfa/src/app/xfa_ffdocview.cpp index 59d4a59f0d..e71820b92f 100644 --- a/xfa/src/fxfa/src/app/xfa_ffdocview.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffdocview.cpp @@ -80,7 +80,7 @@ int32_t CXFA_FFDocView::StartLayout(int32_t iStartPage) { return iStatus; } CXFA_Node* pRootItem = - (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFANode(XFA_HASHCODE_Form); + (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form); if (!pRootItem) { return iStatus; } @@ -102,7 +102,7 @@ int32_t CXFA_FFDocView::DoLayout(IFX_Pause* pPause) { } void CXFA_FFDocView::StopLayout() { CXFA_Node* pRootItem = - (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFANode(XFA_HASHCODE_Form); + (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form); if (!pRootItem) { return; } @@ -265,7 +265,7 @@ int32_t CXFA_FFDocView::ProcessWidgetEvent(CXFA_EventParam* pParam, if (pParam->m_eType == XFA_EVENT_Validate) { CFX_WideString wsValidateStr = FX_WSTRC(L"preSubmit"); CXFA_Node* pConfigItem = - (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFANode(XFA_HASHCODE_Config); + (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Config); if (pConfigItem) { CXFA_Node* pValidateNode = NULL; CXFA_Node* pAcrobatNode = pConfigItem->GetChild(0, XFA_ELEMENT_Acrobat); @@ -303,7 +303,7 @@ int32_t CXFA_FFDocView::ProcessWidgetEvent(CXFA_EventParam* pParam, CXFA_Node* pNode = pWidgetAcc ? pWidgetAcc->GetNode() : NULL; if (!pNode) { CXFA_Node* pRootItem = - (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFANode(XFA_HASHCODE_Form); + (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form); if (!pRootItem) { return XFA_EVENTERROR_Error; } @@ -635,7 +635,7 @@ void CXFA_FFDocView::AddIndexChangedSubform(CXFA_Node* pNode) { } void CXFA_FFDocView::RunDocClose() { CXFA_Node* pRootItem = - (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFANode(XFA_HASHCODE_Form); + (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form); if (!pRootItem) { return; } @@ -748,7 +748,7 @@ FX_BOOL CXFA_FFDocView::RunValidate() { } FX_BOOL CXFA_FFDocView::RunEventLayoutReady() { CXFA_Node* pRootItem = - (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFANode(XFA_HASHCODE_Form); + (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form); if (!pRootItem) { return FALSE; } @@ -835,7 +835,7 @@ void CXFA_FFDocView::SetChangeMark() { } CXFA_Node* CXFA_FFDocView::GetRootSubform() { CXFA_Node* pFormPacketNode = - (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFANode(XFA_HASHCODE_Form); + (CXFA_Node*)m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form); if (!pFormPacketNode) { return NULL; } diff --git a/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp b/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp index 553a43f8fb..8ce46516a6 100644 --- a/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp @@ -1704,7 +1704,7 @@ FX_BOOL CXFA_TextProvider::GetEmbbedObj(FX_BOOL bURI, } if (!pIDNode) { pIDNode = pDocument->GetNodeByID( - (CXFA_Node*)pDocument->GetXFANode(XFA_HASHCODE_Form), wsAttr); + (CXFA_Node*)pDocument->GetXFAObject(XFA_HASHCODE_Form), wsAttr); } if (pIDNode) { pEmbAcc = (CXFA_WidgetAcc*)pIDNode->GetWidgetData(); diff --git a/xfa/src/fxfa/src/common/xfa_document.h b/xfa/src/fxfa/src/common/xfa_document.h index 46ea4d19b0..e041514b19 100644 --- a/xfa/src/fxfa/src/common/xfa_document.h +++ b/xfa/src/fxfa/src/common/xfa_document.h @@ -141,8 +141,8 @@ class CXFA_Document : public IXFA_ObjFactory { IXFA_DocParser* GetParser() const { return m_pParser; } IXFA_Notify* GetNotify() const; void SetRoot(CXFA_Node* pNewRoot); - CXFA_Object* GetXFANode(const CFX_WideStringC& wsNodeName); - CXFA_Object* GetXFANode(FX_DWORD wsNodeNameHash); + CXFA_Object* GetXFAObject(const CFX_WideStringC& wsNodeName); + CXFA_Object* GetXFAObject(FX_DWORD wsNodeNameHash); void AddPurgeNode(CXFA_Node* pNode); FX_BOOL RemovePurgeNode(CXFA_Node* pNode); void PurgeNodes(); diff --git a/xfa/src/fxfa/src/common/xfa_object.h b/xfa/src/fxfa/src/common/xfa_object.h index 657dd359ac..b6bc340bf4 100644 --- a/xfa/src/fxfa/src/common/xfa_object.h +++ b/xfa/src/fxfa/src/common/xfa_object.h @@ -4,17 +4,18 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef _XFA_OBJECT_H_ -#define _XFA_OBJECT_H_ +#ifndef XFA_OBJECT_H_ +#define XFA_OBJECT_H_ + +class CXFA_ArrayNodeList; +class CXFA_AttachNodeList; class CXFA_Document; -class IXFA_ObjFactory; -class IXFA_Notify; -class CXFA_Object; -class CXFA_OrdinaryObject; class CXFA_Node; class CXFA_NodeList; -class CXFA_ArrayNodeList; -class CXFA_AttachNodeList; +class CXFA_OrdinaryObject; +class IXFA_Notify; +class IXFA_ObjFactory; + enum XFA_OBJECTTYPE { XFA_OBJECTTYPE_OrdinaryObject = 0x0, XFA_OBJECTTYPE_OrdinaryList = 0x1, @@ -41,21 +42,22 @@ enum XFA_OBJECTTYPE { class CXFA_Object { public: CXFA_Object(CXFA_Document* pDocument, FX_DWORD uFlags); - inline CXFA_Document* GetDocument() const { return m_pDocument; } - inline FX_DWORD GetFlag() const { return m_uFlags; } - inline XFA_OBJECTTYPE GetObjectType() const { + CXFA_Document* GetDocument() const { return m_pDocument; } + FX_DWORD GetFlag() const { return m_uFlags; } + XFA_OBJECTTYPE GetObjectType() const { return (XFA_OBJECTTYPE)(m_uFlags & XFA_OBJECTTYPEMASK); } - inline FX_BOOL IsNode() const { + + FX_BOOL IsNode() const { return (m_uFlags & XFA_OBJECTTYPEMASK) >= XFA_OBJECTTYPE_Node; } - inline FX_BOOL IsOrdinaryObject() const { + FX_BOOL IsOrdinaryObject() const { return (m_uFlags & XFA_OBJECTTYPEMASK) == XFA_OBJECTTYPE_OrdinaryObject; } - inline FX_BOOL IsNodeList() const { + FX_BOOL IsNodeList() const { return (m_uFlags & XFA_OBJECTTYPEMASK) == XFA_OBJECTTYPE_NodeList; } - inline FX_BOOL IsOrdinaryList() const { + FX_BOOL IsOrdinaryList() const { return (m_uFlags & XFA_OBJECTTYPEMASK) == XFA_OBJECTTYPE_OrdinaryList; } FX_BOOL IsContentNode() const { @@ -64,6 +66,15 @@ class CXFA_Object { FX_BOOL IsContainerNode() const { return (m_uFlags & XFA_OBJECTTYPEMASK) == XFA_OBJECTTYPE_ContainerNode; } + + CXFA_Node* AsNode(); + CXFA_OrdinaryObject* AsOrdinaryObject(); + CXFA_NodeList* AsNodeList(); + + const CXFA_Node* AsNode() const; + const CXFA_OrdinaryObject* AsOrdinaryObject() const; + const CXFA_NodeList* AsNodeList() const; + XFA_ELEMENT GetClassID() const; void GetClassName(CFX_WideStringC& wsName) const; uint32_t GetClassHashCode() const; @@ -73,7 +84,7 @@ class CXFA_Object { void ThrowScriptErrorMessage(int32_t iStringID, ...); protected: - CXFA_Document* m_pDocument; + CXFA_Document* const m_pDocument; FX_DWORD m_uFlags; }; #define XFA_NODEFILTER_Children 0x01 @@ -664,7 +675,7 @@ class CXFA_ThisProxy : public CXFA_Object { }; class CXFA_NodeList : public CXFA_Object { public: - CXFA_NodeList(CXFA_Document* pDocument); + explicit CXFA_NodeList(CXFA_Document* pDocument); virtual ~CXFA_NodeList() {} XFA_ELEMENT GetClassID() const { return XFA_ELEMENT_NodeList; } CXFA_Node* NamedItem(const CFX_WideStringC& wsName); @@ -686,7 +697,7 @@ class CXFA_NodeList : public CXFA_Object { }; class CXFA_ArrayNodeList : public CXFA_NodeList { public: - CXFA_ArrayNodeList(CXFA_Document* pDocument); + explicit CXFA_ArrayNodeList(CXFA_Document* pDocument); void SetArrayNodeList(const CXFA_NodeArray& srcArray); virtual int32_t GetLength(); virtual FX_BOOL Append(CXFA_Node* pNode); @@ -745,4 +756,46 @@ class CXFA_TraverseStrategy_XFANode { }; typedef CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> CXFA_NodeIterator; -#endif + +inline CXFA_Node* CXFA_Object::AsNode() { + return IsNode() ? static_cast<CXFA_Node*>(this) : nullptr; +} +inline CXFA_OrdinaryObject* CXFA_Object::AsOrdinaryObject() { + return IsOrdinaryObject() ? static_cast<CXFA_OrdinaryObject*>(this) : nullptr; +} +inline CXFA_NodeList* CXFA_Object::AsNodeList() { + return IsNodeList() ? static_cast<CXFA_NodeList*>(this) : nullptr; +} + +inline const CXFA_Node* CXFA_Object::AsNode() const { + return IsNode() ? static_cast<const CXFA_Node*>(this) : nullptr; +} +inline const CXFA_OrdinaryObject* CXFA_Object::AsOrdinaryObject() const { + return IsOrdinaryObject() ? static_cast<const CXFA_OrdinaryObject*>(this) + : nullptr; +} +inline const CXFA_NodeList* CXFA_Object::AsNodeList() const { + return IsNodeList() ? static_cast<const CXFA_NodeList*>(this) : nullptr; +} + +inline CXFA_Node* ToNode(CXFA_Object* pObj) { + return pObj ? pObj->AsNode() : nullptr; +} +inline CXFA_OrdinaryObject* ToOrdinaryObject(CXFA_Object* pObj) { + return pObj ? pObj->AsOrdinaryObject() : nullptr; +} +inline CXFA_NodeList* ToNodeList(CXFA_Object* pObj) { + return pObj ? pObj->AsNodeList() : nullptr; +} + +inline const CXFA_Node* ToNode(const CXFA_Object* pObj) { + return pObj ? pObj->AsNode() : nullptr; +} +inline const CXFA_OrdinaryObject* ToOrdinaryObject(const CXFA_Object* pObj) { + return pObj ? pObj->AsOrdinaryObject() : nullptr; +} +inline const CXFA_NodeList* ToNodeList(const CXFA_Object* pObj) { + return pObj ? pObj->AsNodeList() : nullptr; +} + +#endif // XFA_OBJECT_H_ diff --git a/xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp b/xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp index f74a4dc3e3..6d1ba3b84e 100644 --- a/xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp @@ -1162,7 +1162,7 @@ static void XFA_DataMerge_UpdateBindingRelations(CXFA_Document* pDocument, ? XFA_ELEMENT_DataGroup : XFA_ELEMENT_DataValue; CXFA_Node* pRecordNode = - (CXFA_Node*)pDocument->GetXFANode(XFA_HASHCODE_Record); + (CXFA_Node*)pDocument->GetXFAObject(XFA_HASHCODE_Record); pDataNode = XFA_DataDescription_MaybeCreateDataNode( pDocument, pRecordNode, eDataNodeType, pFormNode->GetCData(XFA_ATTRIBUTE_Name)); @@ -1279,7 +1279,7 @@ static void XFA_DataMerge_UpdateBindingRelations(CXFA_Document* pDocument, CXFA_ ? XFA_ELEMENT_DataGroup : XFA_ELEMENT_DataValue; CXFA_Node* pRecordNode = - (CXFA_Node*)pDocument->GetXFANode(XFA_HASHCODE_Record); + (CXFA_Node*)pDocument->GetXFAObject(XFA_HASHCODE_Record); pDataNode = XFA_DataDescription_MaybeCreateDataNode( pDocument, pRecordNode, eDataNodeType, pFormNode->GetCData(XFA_ATTRIBUTE_Name)); @@ -1337,7 +1337,7 @@ CXFA_Node* XFA_DataMerge_FindDataScope(CXFA_Node* pParentFormNode) { return pDataScope; } } - return (CXFA_Node*)pParentFormNode->GetDocument()->GetXFANode( + return (CXFA_Node*)pParentFormNode->GetDocument()->GetXFAObject( XFA_HASHCODE_Data); } void CXFA_Document::DataMerge_UpdateBindingRelations( @@ -1383,7 +1383,7 @@ CXFA_Node* CXFA_Document::GetNotBindNode(CXFA_ObjArray& arrayNodes) { return NULL; } void CXFA_Document::DoDataMerge() { - CXFA_Node* pDatasetsRoot = (CXFA_Node*)GetXFANode(XFA_HASHCODE_Datasets); + CXFA_Node* pDatasetsRoot = (CXFA_Node*)GetXFAObject(XFA_HASHCODE_Datasets); if (!pDatasetsRoot) { IFDE_XMLElement* pDatasetsXMLNode = IFDE_XMLElement::Create(FX_WSTRC(L"xfa:datasets")); @@ -1537,7 +1537,7 @@ void CXFA_Document::DoDataMerge() { } } void CXFA_Document::DoDataRemerge(FX_BOOL bDoDataMerge) { - CXFA_Node* pFormRoot = (CXFA_Node*)this->GetXFANode(XFA_HASHCODE_Form); + CXFA_Node* pFormRoot = (CXFA_Node*)this->GetXFAObject(XFA_HASHCODE_Form); if (pFormRoot) { while (CXFA_Node* pNode = pFormRoot->GetNodeItem(XFA_NODEITEM_FirstChild)) { pFormRoot->RemoveChild(pNode); diff --git a/xfa/src/fxfa/src/parser/xfa_document_imp.cpp b/xfa/src/fxfa/src/parser/xfa_document_imp.cpp index bb0983686c..ed50ce4822 100644 --- a/xfa/src/fxfa/src/parser/xfa_document_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_document_imp.cpp @@ -90,14 +90,15 @@ void CXFA_Document::SetRoot(CXFA_Node* pNewRoot) { IXFA_Notify* CXFA_Document::GetNotify() const { return m_pParser->GetNotify(); } -CXFA_Object* CXFA_Document::GetXFANode(const CFX_WideStringC& wsNodeName) { - return GetXFANode( +CXFA_Object* CXFA_Document::GetXFAObject(const CFX_WideStringC& wsNodeName) { + return GetXFAObject( FX_HashCode_String_GetW(wsNodeName.GetPtr(), wsNodeName.GetLength())); } -CXFA_Object* CXFA_Document::GetXFANode(FX_DWORD dwNodeNameHash) { +CXFA_Object* CXFA_Document::GetXFAObject(FX_DWORD dwNodeNameHash) { switch (dwNodeNameHash) { case XFA_HASHCODE_Data: { - CXFA_Node* pDatasetsNode = (CXFA_Node*)GetXFANode(XFA_HASHCODE_Datasets); + CXFA_Node* pDatasetsNode = + (CXFA_Node*)GetXFAObject(XFA_HASHCODE_Datasets); if (!pDatasetsNode) { return NULL; } @@ -124,7 +125,7 @@ CXFA_Object* CXFA_Document::GetXFANode(FX_DWORD dwNodeNameHash) { } return NULL; case XFA_HASHCODE_Record: { - CXFA_Node* pData = (CXFA_Node*)GetXFANode(XFA_HASHCODE_Data); + CXFA_Node* pData = (CXFA_Node*)GetXFAObject(XFA_HASHCODE_Data); return pData ? pData->GetFirstChildByClass(XFA_ELEMENT_DataGroup) : NULL; } case XFA_HASHCODE_DataWindow: { @@ -212,7 +213,7 @@ FX_BOOL CXFA_Document::IsInteractive() { if (m_dwDocFlags & XFA_DOCFLAG_HasInteractive) { return m_dwDocFlags & XFA_DOCFLAG_Interactive; } - CXFA_Node* pConfig = (CXFA_Node*)this->GetXFANode(XFA_HASHCODE_Config); + CXFA_Node* pConfig = (CXFA_Node*)this->GetXFAObject(XFA_HASHCODE_Config); if (!pConfig) { return FALSE; } @@ -241,7 +242,7 @@ CXFA_LocaleMgr* CXFA_Document::GetLocalMgr() { CFX_WideString wsLanguage; this->GetParser()->GetNotify()->GetAppProvider()->GetLanguage(wsLanguage); m_pLocalMgr = new CXFA_LocaleMgr( - (CXFA_Node*)this->GetXFANode(XFA_HASHCODE_LocaleSet), wsLanguage); + (CXFA_Node*)this->GetXFAObject(XFA_HASHCODE_LocaleSet), wsLanguage); } return m_pLocalMgr; } @@ -355,7 +356,7 @@ static void XFA_ProtoMerge_MergeNode(CXFA_Document* pDocument, } } void CXFA_Document::DoProtoMerge() { - CXFA_Node* pTemplateRoot = (CXFA_Node*)GetXFANode(XFA_HASHCODE_Template); + CXFA_Node* pTemplateRoot = (CXFA_Node*)GetXFAObject(XFA_HASHCODE_Template); if (!pTemplateRoot) { return; } diff --git a/xfa/src/fxfa/src/parser/xfa_document_layout_imp.cpp b/xfa/src/fxfa/src/parser/xfa_document_layout_imp.cpp index ef4fcdb0c8..a9843fae2b 100644 --- a/xfa/src/fxfa/src/parser/xfa_document_layout_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_document_layout_imp.cpp @@ -52,7 +52,7 @@ int32_t CXFA_LayoutProcessor::StartLayout(FX_BOOL bForceRestart) { } m_nProgressCounter = 0; CXFA_Node* pFormPacketNode = - (CXFA_Node*)m_pDocument->GetXFANode(XFA_HASHCODE_Form); + (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Form); if (!pFormPacketNode) { return -1; } diff --git a/xfa/src/fxfa/src/parser/xfa_document_serialize.cpp b/xfa/src/fxfa/src/parser/xfa_document_serialize.cpp index 9ed7d3c1d2..b5eaa5f4c6 100644 --- a/xfa/src/fxfa/src/parser/xfa_document_serialize.cpp +++ b/xfa/src/fxfa/src/parser/xfa_document_serialize.cpp @@ -42,12 +42,13 @@ FX_BOOL CXFA_DataImporter::ImportData(IFX_FileRead* pDataDocument) { return FALSE; } CXFA_Node* pDataModel = - (CXFA_Node*)m_pDocument->GetXFANode(XFA_HASHCODE_Datasets); + (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Datasets); if (!pDataModel) { pDataDocumentParser->Release(); return FALSE; } - CXFA_Node* pDataNode = (CXFA_Node*)m_pDocument->GetXFANode(XFA_HASHCODE_Data); + CXFA_Node* pDataNode = + (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Data); if (pDataNode) { pDataModel->RemoveChild(pDataNode); } @@ -444,7 +445,7 @@ void XFA_DataExporter_RegenerateFormFile(CXFA_Node* pNode, pStream->WriteString(pURI, FXSYS_wcslen(pURI)); CFX_WideString wsVersionNumber; XFA_DataExporter_RecognizeXFAVersionNumber( - (CXFA_Node*)pNode->GetDocument()->GetXFANode(XFA_XDPPACKET_Template), + (CXFA_Node*)pNode->GetDocument()->GetXFAObject(XFA_XDPPACKET_Template), wsVersionNumber); if (wsVersionNumber.IsEmpty()) { wsVersionNumber = FX_WSTRC(L"2.8"); diff --git a/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp b/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp index ffae772cd2..0d5dfb4b07 100644 --- a/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp +++ b/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp @@ -293,7 +293,7 @@ static CXFA_Node* XFA_ResolveBreakTarget(CXFA_Node* pPageSetRoot, bTargetAllFind = FALSE; if (wsTargetExpr.GetAt(0) == '#') { CXFA_Node* pNode = pDocument->GetNodeByID( - (CXFA_Node*)pDocument->GetXFANode(XFA_HASHCODE_Template), + (CXFA_Node*)pDocument->GetXFAObject(XFA_HASHCODE_Template), wsTargetExpr.Mid(1)); if (pNode) { return pNode; @@ -1739,7 +1739,7 @@ void CXFA_LayoutPageMgr::MergePageSetContents() { } pContainerItem->m_pFormNode = pDocument->DataMerge_CopyContainer( pContainerItem->m_pFormNode, pParentNode, - (CXFA_Node*)pDocument->GetXFANode(XFA_HASHCODE_Record), TRUE); + (CXFA_Node*)pDocument->GetXFAObject(XFA_HASHCODE_Record), TRUE); } break; case XFA_ELEMENT_ContentArea: { CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode; @@ -1760,7 +1760,7 @@ void CXFA_LayoutPageMgr::MergePageSetContents() { } if (!pPendingPageSet->GetNodeItem(XFA_NODEITEM_Parent)) { CXFA_Node* pFormToplevelSubform = - ((CXFA_Node*)pDocument->GetXFANode(XFA_HASHCODE_Form)) + ((CXFA_Node*)pDocument->GetXFAObject(XFA_HASHCODE_Form)) ->GetFirstChildByClass(XFA_ELEMENT_Subform); pFormToplevelSubform->InsertChild(pPendingPageSet); } diff --git a/xfa/src/fxfa/src/parser/xfa_object_imp.cpp b/xfa/src/fxfa/src/parser/xfa_object_imp.cpp index 9ec612fd23..ed79e08b94 100644 --- a/xfa/src/fxfa/src/parser/xfa_object_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_object_imp.cpp @@ -480,7 +480,7 @@ CXFA_WidgetData* CXFA_Node::GetContainerWidgetData() { : NULL; } FX_BOOL CXFA_Node::GetLocaleName(CFX_WideString& wsLocaleName) { - CXFA_Node* pForm = (CXFA_Node*)GetDocument()->GetXFANode(XFA_HASHCODE_Form); + CXFA_Node* pForm = (CXFA_Node*)GetDocument()->GetXFAObject(XFA_HASHCODE_Form); CXFA_Node* pTopSubform = pForm->GetFirstChildByClass(XFA_ELEMENT_Subform); FXSYS_assert(pTopSubform); CXFA_Node* pLocaleNode = this; @@ -495,7 +495,7 @@ FX_BOOL CXFA_Node::GetLocaleName(CFX_WideString& wsLocaleName) { return bLocale; } CXFA_Node* pConfig = - (CXFA_Node*)GetDocument()->GetXFANode(XFA_HASHCODE_Config); + (CXFA_Node*)GetDocument()->GetXFAObject(XFA_HASHCODE_Config); wsLocaleName = GetDocument()->GetLocalMgr()->GetConfigLocaleName(pConfig); if (!wsLocaleName.IsEmpty()) { bLocale = TRUE; @@ -1479,7 +1479,7 @@ void CXFA_Node::Script_Attribute_String(FXJSE_HVALUE hValue, this->GetClassID() == XFA_ELEMENT_Desc) { CFX_WideString wsUseVal = wsValue, wsID, wsSOM; CXFA_Node* pTemplateNode = - (CXFA_Node*)m_pDocument->GetXFANode(XFA_HASHCODE_Template); + (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Template); CXFA_Node* pProtoRoot = pTemplateNode->GetFirstChildByClass(XFA_ELEMENT_Subform) ->GetFirstChildByClass(XFA_ELEMENT_Proto); @@ -3110,7 +3110,7 @@ static CXFA_Node* XFA_ScriptInstanceManager_CreateInstance( } } if (!pDataScope) { - pDataScope = (CXFA_Node*)pDocument->GetXFANode(XFA_HASHCODE_Record); + pDataScope = (CXFA_Node*)pDocument->GetXFAObject(XFA_HASHCODE_Record); ASSERT(pDataScope); } CXFA_Node* pInstance = pDocument->DataMerge_CopyContainer( @@ -3190,7 +3190,7 @@ void CXFA_Node::Script_InstanceManager_RemoveInstance( return; } pLayoutPro->AddChangedContainer( - (CXFA_Node*)m_pDocument->GetXFANode(XFA_HASHCODE_Form)); + (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Form)); } void CXFA_Node::Script_InstanceManager_SetInstances( CFXJSE_Arguments* pArguments) { @@ -3237,7 +3237,7 @@ void CXFA_Node::Script_InstanceManager_AddInstance( return; } pLayoutPro->AddChangedContainer( - (CXFA_Node*)m_pDocument->GetXFANode(XFA_HASHCODE_Form)); + (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Form)); } void CXFA_Node::Script_InstanceManager_InsertInstance( CFXJSE_Arguments* pArguments) { @@ -3280,7 +3280,7 @@ void CXFA_Node::Script_InstanceManager_InsertInstance( return; } pLayoutPro->AddChangedContainer( - (CXFA_Node*)m_pDocument->GetXFANode(XFA_HASHCODE_Form)); + (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Form)); } int32_t CXFA_Node::InstanceManager_SetInstances(int32_t iDesired) { CXFA_Occur nodeOccur = GetOccurNode(); @@ -3345,7 +3345,7 @@ int32_t CXFA_Node::InstanceManager_SetInstances(int32_t iDesired) { return 0; } pLayoutPro->AddChangedContainer( - (CXFA_Node*)m_pDocument->GetXFANode(XFA_HASHCODE_Form)); + (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Form)); return 0; } int32_t CXFA_Node::InstanceManager_MoveInstance(int32_t iTo, int32_t iFrom) { @@ -3366,7 +3366,7 @@ int32_t CXFA_Node::InstanceManager_MoveInstance(int32_t iTo, int32_t iFrom) { return 0; } pLayoutPro->AddChangedContainer( - (CXFA_Node*)m_pDocument->GetXFANode(XFA_HASHCODE_Form)); + (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Form)); return 0; } void CXFA_Node::Script_Occur_Max(FXJSE_HVALUE hValue, @@ -4485,21 +4485,21 @@ CXFA_Node* CXFA_Node::GetModelNode() { case XFA_XDPPACKET_XDP: return m_pDocument->GetRoot(); case XFA_XDPPACKET_Config: - return (CXFA_Node*)m_pDocument->GetXFANode(XFA_HASHCODE_Config); + return (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Config); case XFA_XDPPACKET_Template: - return (CXFA_Node*)m_pDocument->GetXFANode(XFA_HASHCODE_Template); + return (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Template); case XFA_XDPPACKET_Form: - return (CXFA_Node*)m_pDocument->GetXFANode(XFA_HASHCODE_Form); + return (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Form); case XFA_XDPPACKET_Datasets: - return (CXFA_Node*)m_pDocument->GetXFANode(XFA_HASHCODE_Datasets); + return (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Datasets); case XFA_XDPPACKET_LocaleSet: - return (CXFA_Node*)m_pDocument->GetXFANode(XFA_HASHCODE_LocaleSet); + return (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_LocaleSet); case XFA_XDPPACKET_ConnectionSet: - return (CXFA_Node*)m_pDocument->GetXFANode(XFA_HASHCODE_ConnectionSet); + return (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_ConnectionSet); case XFA_XDPPACKET_SourceSet: - return (CXFA_Node*)m_pDocument->GetXFANode(XFA_HASHCODE_SourceSet); + return (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_SourceSet); case XFA_XDPPACKET_Xdc: - return (CXFA_Node*)m_pDocument->GetXFANode(XFA_HASHCODE_Xdc); + return (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Xdc); default: return this; } diff --git a/xfa/src/fxfa/src/parser/xfa_script_imp.cpp b/xfa/src/fxfa/src/parser/xfa_script_imp.cpp index 14dcbf4007..5fa1c6aff6 100644 --- a/xfa/src/fxfa/src/parser/xfa_script_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_script_imp.cpp @@ -181,7 +181,7 @@ void CXFA_ScriptContext::GlobalPropertyGetter(FXJSE_HOBJECT hObject, FX_HashCode_String_GetW(wsPropName, wsPropName.GetLength()); if (uHashCode != XFA_HASHCODE_Layout) { CXFA_Object* pObject = - lpScriptContext->GetDocument()->GetXFANode(uHashCode); + lpScriptContext->GetDocument()->GetXFAObject(uHashCode); if (pObject) { FXJSE_Value_Set(hValue, lpScriptContext->GetJSValueFromMap(pObject)); return; diff --git a/xfa/src/fxfa/src/parser/xfa_script_nodehelper.cpp b/xfa/src/fxfa/src/parser/xfa_script_nodehelper.cpp index ee256c5681..32a3d58d20 100644 --- a/xfa/src/fxfa/src/parser/xfa_script_nodehelper.cpp +++ b/xfa/src/fxfa/src/parser/xfa_script_nodehelper.cpp @@ -353,7 +353,7 @@ FX_BOOL CXFA_NodeHelper::XFA_ResolveNodes_CreateNode( FX_BOOL bResult = FALSE; if (wsName.GetAt(0) == '!') { wsName = wsName.Right(wsName.GetLength() - 1); - m_pCreateParent = (CXFA_Node*)pScriptContext->GetDocument()->GetXFANode( + m_pCreateParent = (CXFA_Node*)pScriptContext->GetDocument()->GetXFAObject( XFA_HASHCODE_Datasets); } if (wsName.GetAt(0) == '#') { diff --git a/xfa/src/fxfa/src/parser/xfa_script_resolveprocessor.cpp b/xfa/src/fxfa/src/parser/xfa_script_resolveprocessor.cpp index 00d8c025d3..f9503ce4ca 100644 --- a/xfa/src/fxfa/src/parser/xfa_script_resolveprocessor.cpp +++ b/xfa/src/fxfa/src/parser/xfa_script_resolveprocessor.cpp @@ -60,7 +60,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes(CXFA_ResolveNodesData& rnd) { return 1; } else if (rnd.m_CurNode->GetClassID() == XFA_ELEMENT_Xfa) { CXFA_Object* pObjNode = - rnd.m_pSC->GetDocument()->GetXFANode(rnd.m_uHashName); + rnd.m_pSC->GetDocument()->GetXFAObject(rnd.m_uHashName); if (pObjNode) { rnd.m_Nodes.Add(pObjNode); } else if (rnd.m_uHashName == XFA_HASHCODE_Xfa) { @@ -124,7 +124,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Dollar( if (dwNameHash == XFA_HASHCODE_Xfa) { nodes.Add(rnd.m_pSC->GetDocument()->GetRoot()); } else { - CXFA_Object* pObjNode = rnd.m_pSC->GetDocument()->GetXFANode(dwNameHash); + CXFA_Object* pObjNode = rnd.m_pSC->GetDocument()->GetXFAObject(dwNameHash); if (pObjNode) { rnd.m_Nodes.Add(pObjNode); } @@ -140,7 +140,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Excalmatory( return 0; } CXFA_Node* datasets = - (CXFA_Node*)rnd.m_pSC->GetDocument()->GetXFANode(XFA_HASHCODE_Datasets); + (CXFA_Node*)rnd.m_pSC->GetDocument()->GetXFAObject(XFA_HASHCODE_Datasets); if (datasets == NULL) { return 0; } |