summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/xfa_document_serialize.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-06-20 11:11:12 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-20 11:11:12 -0700
commitc5a8f217fedc1224104b34f7577044776a9d83d8 (patch)
tree0b457b9ccc3511ad45f75fe0f385425af8d6272d /xfa/fxfa/parser/xfa_document_serialize.cpp
parent950e68f14aa6db5022919c55ce80f346a94a762e (diff)
downloadpdfium-c5a8f217fedc1224104b34f7577044776a9d83d8.tar.xz
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
Diffstat (limited to 'xfa/fxfa/parser/xfa_document_serialize.cpp')
-rw-r--r--xfa/fxfa/parser/xfa_document_serialize.cpp30
1 files changed, 14 insertions, 16 deletions
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"<form";
static const FX_WCHAR s_pwsClose[] = L"</form\n>";
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[] =