From c5a8f217fedc1224104b34f7577044776a9d83d8 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Mon, 20 Jun 2016 11:11:12 -0700 Subject: Split the XFA_OBJECTTYPE enum into two parts. Currently the object type and the node flags are both mixed into the single XFA_OBJECTTYPE_* enum. These two things are un-related and should not share a single type. This Cl creates an XFA_ObjectType enum class and a XFA_NodeFlag enum to hold the two types. Accessors are added to determine if the flags are set (or called where they already existed. Review-Url: https://codereview.chromium.org/2083453003 --- xfa/fxfa/parser/xfa_document_serialize.cpp | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'xfa/fxfa/parser/xfa_document_serialize.cpp') diff --git a/xfa/fxfa/parser/xfa_document_serialize.cpp b/xfa/fxfa/parser/xfa_document_serialize.cpp index d7b8bf04d9..9ffae1850f 100644 --- a/xfa/fxfa/parser/xfa_document_serialize.cpp +++ b/xfa/fxfa/parser/xfa_document_serialize.cpp @@ -161,22 +161,20 @@ static FX_BOOL XFA_DataExporter_AttributeSaveInDataModel( } FX_BOOL XFA_DataExporter_ContentNodeNeedtoExport(CXFA_Node* pContentNode) { CFX_WideString wsContent; - if (!pContentNode->TryContent(wsContent, FALSE, FALSE)) { + if (!pContentNode->TryContent(wsContent, FALSE, FALSE)) return FALSE; - } - ASSERT(pContentNode->GetObjectType() == XFA_OBJECTTYPE_ContentNode); + + ASSERT(pContentNode->IsContentNode()); CXFA_Node* pParentNode = pContentNode->GetNodeItem(XFA_NODEITEM_Parent); - if (!pParentNode || pParentNode->GetClassID() != XFA_ELEMENT_Value) { + if (!pParentNode || pParentNode->GetClassID() != XFA_ELEMENT_Value) return TRUE; - } + CXFA_Node* pGrandParentNode = pParentNode->GetNodeItem(XFA_NODEITEM_Parent); - if (!pGrandParentNode || - pGrandParentNode->GetObjectType() != XFA_OBJECTTYPE_ContainerNode) { + if (!pGrandParentNode || !pGrandParentNode->IsContainerNode()) return TRUE; - } - if (pGrandParentNode->GetBindData()) { + if (pGrandParentNode->GetBindData()) return FALSE; - } + CXFA_WidgetData* pWidgetData = pGrandParentNode->GetWidgetData(); XFA_ELEMENT eUIType = pWidgetData->GetUIType(); if (eUIType == XFA_ELEMENT_PasswordEdit) { @@ -223,7 +221,7 @@ static void XFA_DataExporter_RegenerateFormFile_Changed( } CFX_WideString wsChildren; switch (pNode->GetObjectType()) { - case XFA_OBJECTTYPE_ContentNode: { + case XFA_ObjectType::ContentNode: { if (!bSaveXML && !XFA_DataExporter_ContentNodeNeedtoExport(pNode)) { break; } @@ -308,9 +306,9 @@ static void XFA_DataExporter_RegenerateFormFile_Changed( wsChildren += XFA_ExportEncodeContent(wsValue); } } break; - case XFA_OBJECTTYPE_TextNode: - case XFA_OBJECTTYPE_NodeC: - case XFA_OBJECTTYPE_NodeV: { + case XFA_ObjectType::TextNode: + case XFA_ObjectType::NodeC: + case XFA_ObjectType::NodeV: { CFX_WideStringC wsValue = pNode->GetCData(XFA_ATTRIBUTE_Value); wsChildren += XFA_ExportEncodeContent(wsValue); } break; @@ -425,7 +423,7 @@ void XFA_DataExporter_RegenerateFormFile(CXFA_Node* pNode, IFX_Stream* pStream, const FX_CHAR* pChecksum, FX_BOOL bSaveXML) { - if (pNode->GetObjectType() == XFA_OBJECTTYPE_ModelNode) { + if (pNode->IsModelNode()) { static const FX_WCHAR s_pwsTagName[] = L""; pStream->WriteString(s_pwsTagName, FXSYS_wcslen(s_pwsTagName)); @@ -490,7 +488,7 @@ FX_BOOL CXFA_DataExporter::Export(IFX_Stream* pStream, uint32_t dwFlag, const FX_CHAR* pChecksum) { CFDE_XMLDoc* pXMLDoc = m_pDocument->GetParser()->GetXMLDoc(); - if (pNode->GetObjectType() == XFA_OBJECTTYPE_ModelNode) { + if (pNode->IsModelNode()) { switch (pNode->GetPacketID()) { case XFA_XDPPACKET_XDP: { static const FX_WCHAR s_pwsPreamble[] = -- cgit v1.2.3