diff options
author | dsinclair <dsinclair@chromium.org> | 2016-03-29 16:58:29 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-29 16:58:29 -0700 |
commit | ae95f763dfb5e4fab3a9ff026b2f844c202625d7 (patch) | |
tree | 6bde00f193474c50c3eed00e55591cab8a7e29a1 /xfa/fxfa/parser | |
parent | 05d53f0355e9889c43bfa436e985d5643f249d99 (diff) | |
download | pdfium-ae95f763dfb5e4fab3a9ff026b2f844c202625d7.tar.xz |
Remove IFDE_XML* classes.
The CFDE_XML* classes did not inhert from the IFDE_XML variants but we casted
to them anyway. This CL removes the IFDE_XML* variants and we just use the
CPDF_XML* classes directly.
BUG=pdfium:357
Review URL: https://codereview.chromium.org/1836353002
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r-- | xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 31 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_document_serialize.cpp | 33 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_object.h | 8 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_object_imp.cpp | 101 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_parser.h | 8 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_parser_imp.cpp | 287 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_parser_imp.h | 60 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_utils.h | 8 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_utils_imp.cpp | 15 |
9 files changed, 279 insertions, 272 deletions
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index 8872400bb5..476dde4104 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -7,6 +7,7 @@ #include "xfa/fxfa/parser/xfa_document_datamerger_imp.h" #include "core/fxcrt/include/fx_ext.h" +#include "xfa/fde/xml/fde_xml_imp.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_basic_imp.h" #include "xfa/fxfa/parser/xfa_docdata.h" @@ -125,8 +126,8 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, image.GetContentType(wsContentType); image.GetHref(wsHref); } - IFDE_XMLElement* pXMLDataElement = - (IFDE_XMLElement*)(pDataNode->GetXMLMappingNode()); + CFDE_XMLElement* pXMLDataElement = + static_cast<CFDE_XMLElement*>(pDataNode->GetXMLMappingNode()); FXSYS_assert(pXMLDataElement); pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue); pDataNode->SetAttributeValue(wsValue, wsFormatedValue); @@ -151,9 +152,9 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, pValue->SetCData(XFA_ATTRIBUTE_Value, wsSelTextArray[i]); } } else { - IFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); + CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); FXSYS_assert(pXMLNode->GetType() == FDE_XMLNODE_Element); - ((IFDE_XMLElement*)pXMLNode) + static_cast<CFDE_XMLElement*>(pXMLNode) ->SetString(FX_WSTRC(L"xfa:dataNode"), FX_WSTRC(L"dataGroup")); } } else if (!wsValue.IsEmpty()) { @@ -263,8 +264,8 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, defValue.GetNode(), wsNormailizeValue, XFA_ELEMENT_Image); CXFA_Image image = defValue.GetImage(); if (image) { - IFDE_XMLElement* pXMLDataElement = - (IFDE_XMLElement*)(pDataNode->GetXMLMappingNode()); + CFDE_XMLElement* pXMLDataElement = + static_cast<CFDE_XMLElement*>(pDataNode->GetXMLMappingNode()); FXSYS_assert(pXMLDataElement); CFX_WideString wsContentType; CFX_WideString wsHref; @@ -1261,9 +1262,9 @@ CXFA_Node* CXFA_Document::GetNotBindNode(CXFA_ObjArray& arrayNodes) { void CXFA_Document::DoDataMerge() { CXFA_Node* pDatasetsRoot = ToNode(GetXFAObject(XFA_HASHCODE_Datasets)); if (!pDatasetsRoot) { - IFDE_XMLElement* pDatasetsXMLNode = - IFDE_XMLElement::Create(FX_WSTRC(L"xfa:datasets")); - FXSYS_assert(pDatasetsXMLNode); + CFDE_XMLElement* pDatasetsXMLNode = + new CFDE_XMLElement(FX_WSTRC(L"xfa:datasets")); + pDatasetsXMLNode->SetString( FX_WSTRC(L"xmlns:xfa"), FX_WSTRC(L"http://www.xfa.org/schema/xfa-data/1.0/")); @@ -1305,9 +1306,9 @@ void CXFA_Document::DoDataMerge() { } } if (!pDataRoot) { - IFDE_XMLElement* pDataRootXMLNode = - IFDE_XMLElement::Create(FX_WSTRC(L"xfa:data")); - FXSYS_assert(pDataRootXMLNode); + CFDE_XMLElement* pDataRootXMLNode = + new CFDE_XMLElement(FX_WSTRC(L"xfa:data")); + pDataRoot = CreateNode(XFA_XDPPACKET_Datasets, XFA_ELEMENT_DataGroup); pDataRoot->SetCData(XFA_ATTRIBUTE_Name, FX_WSTRC(L"data")); pDataRoot->SetXMLMappingNode(pDataRootXMLNode); @@ -1353,9 +1354,9 @@ void CXFA_Document::DoDataMerge() { CFX_WideStringC wsFormName = pSubformSetNode->GetCData(XFA_ATTRIBUTE_Name); CFX_WideString wsDataTopLevelName = wsFormName.IsEmpty() ? FX_WSTRC(L"form") : wsFormName; - IFDE_XMLElement* pDataTopLevelXMLNode = - IFDE_XMLElement::Create(wsDataTopLevelName); - FXSYS_assert(pDataTopLevelXMLNode); + CFDE_XMLElement* pDataTopLevelXMLNode = + new CFDE_XMLElement(wsDataTopLevelName); + pDataTopLevel = CreateNode(XFA_XDPPACKET_Datasets, XFA_ELEMENT_DataGroup); pDataTopLevel->SetCData(XFA_ATTRIBUTE_Name, wsDataTopLevelName); pDataTopLevel->SetXMLMappingNode(pDataTopLevelXMLNode); diff --git a/xfa/fxfa/parser/xfa_document_serialize.cpp b/xfa/fxfa/parser/xfa_document_serialize.cpp index 3df82e38f1..289581ecae 100644 --- a/xfa/fxfa/parser/xfa_document_serialize.cpp +++ b/xfa/fxfa/parser/xfa_document_serialize.cpp @@ -6,6 +6,7 @@ #include "xfa/fxfa/parser/xfa_document_serialize.h" +#include "xfa/fde/xml/fde_xml_imp.h" #include "xfa/fgas/crt/fgas_codepage.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_docdata.h" @@ -60,8 +61,8 @@ FX_BOOL CXFA_DataImporter::ImportData(IFX_FileRead* pDataDocument) { pDataModel->InsertChild(pChildNode); } } else { - IFDE_XMLNode* pXMLNode = pImportDataRoot->GetXMLMappingNode(); - IFDE_XMLNode* pParentXMLNode = pXMLNode->GetNodeItem(IFDE_XMLNode::Parent); + CFDE_XMLNode* pXMLNode = pImportDataRoot->GetXMLMappingNode(); + CFDE_XMLNode* pParentXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::Parent); if (pParentXMLNode) { pParentXMLNode->RemoveChildNode(pXMLNode); } @@ -244,12 +245,12 @@ static void XFA_DataExporter_RegenerateFormFile_Changed( pNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); if (pRawValueNode->GetClassID() == XFA_ELEMENT_SharpxHTML && wsContentType.Equal(FX_WSTRC(L"text/html"))) { - IFDE_XMLNode* pExDataXML = pNode->GetXMLMappingNode(); + CFDE_XMLNode* pExDataXML = pNode->GetXMLMappingNode(); if (!pExDataXML) { break; } - IFDE_XMLNode* pRichTextXML = - pExDataXML->GetNodeItem(IFDE_XMLNode::FirstChild); + CFDE_XMLNode* pRichTextXML = + pExDataXML->GetNodeItem(CFDE_XMLNode::FirstChild); if (!pRichTextXML) { break; } @@ -498,7 +499,7 @@ FX_BOOL CXFA_DataExporter::Export(IFX_Stream* pStream, CXFA_Node* pNode, uint32_t dwFlag, const FX_CHAR* pChecksum) { - IFDE_XMLDoc* pXMLDoc = m_pDocument->GetParser()->GetXMLDoc(); + CFDE_XMLDoc* pXMLDoc = m_pDocument->GetParser()->GetXMLDoc(); if (pNode->GetObjectType() == XFA_OBJECTTYPE_ModelNode) { switch (pNode->GetPacketID()) { case XFA_XDPPACKET_XDP: { @@ -513,8 +514,8 @@ FX_BOOL CXFA_DataExporter::Export(IFX_Stream* pStream, pStream->WriteString(s_pwsPostamble, FXSYS_wcslen(s_pwsPostamble)); } break; case XFA_XDPPACKET_Datasets: { - IFDE_XMLElement* pElement = - (IFDE_XMLElement*)pNode->GetXMLMappingNode(); + CFDE_XMLElement* pElement = + static_cast<CFDE_XMLElement*>(pNode->GetXMLMappingNode()); if (!pElement || pElement->GetType() != FDE_XMLNODE_Element) { return FALSE; } @@ -528,8 +529,8 @@ FX_BOOL CXFA_DataExporter::Export(IFX_Stream* pStream, } break; case XFA_XDPPACKET_Template: default: { - IFDE_XMLElement* pElement = - (IFDE_XMLElement*)pNode->GetXMLMappingNode(); + CFDE_XMLElement* pElement = + static_cast<CFDE_XMLElement*>(pNode->GetXMLMappingNode()); if (!pElement || pElement->GetType() != FDE_XMLNODE_Element) { return FALSE; } @@ -548,8 +549,8 @@ FX_BOOL CXFA_DataExporter::Export(IFX_Stream* pStream, break; } } - IFDE_XMLElement* pElement = - (IFDE_XMLElement*)pExportNode->GetXMLMappingNode(); + CFDE_XMLElement* pElement = + static_cast<CFDE_XMLElement*>(pExportNode->GetXMLMappingNode()); if (!pElement || pElement->GetType() != FDE_XMLNODE_Element) { return FALSE; } @@ -574,16 +575,16 @@ void XFA_DataExporter_DealWithDataGroupNode(CXFA_Node* pDataNode) { } if (pDataNode->GetClassID() == XFA_ELEMENT_DataGroup) { if (iChildNum > 0) { - IFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); + CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); FXSYS_assert(pXMLNode->GetType() == FDE_XMLNODE_Element); - IFDE_XMLElement* pXMLElement = (IFDE_XMLElement*)pXMLNode; + CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); if (pXMLElement->HasAttribute(L"xfa:dataNode")) { pXMLElement->RemoveAttribute(L"xfa:dataNode"); } } else { - IFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); + CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); FXSYS_assert(pXMLNode->GetType() == FDE_XMLNODE_Element); - ((IFDE_XMLElement*)pXMLNode) + static_cast<CFDE_XMLElement*>(pXMLNode) ->SetString(FX_WSTRC(L"xfa:dataNode"), FX_WSTRC(L"dataGroup")); } } diff --git a/xfa/fxfa/parser/xfa_object.h b/xfa/fxfa/parser/xfa_object.h index a41cf4af2a..3279941a4a 100644 --- a/xfa/fxfa/parser/xfa_object.h +++ b/xfa/fxfa/parser/xfa_object.h @@ -138,9 +138,9 @@ class CXFA_Node : public CXFA_Object { FX_BOOL IsFormContainer() { return m_ePacket == XFA_XDPPACKET_Form && IsContainerNode(); } - void SetXMLMappingNode(IFDE_XMLNode* pXMLNode) { m_pXMLNode = pXMLNode; } - IFDE_XMLNode* GetXMLMappingNode() const { return m_pXMLNode; } - IFDE_XMLNode* CreateXMLMappingNode(); + void SetXMLMappingNode(CFDE_XMLNode* pXMLNode) { m_pXMLNode = pXMLNode; } + CFDE_XMLNode* GetXMLMappingNode() const { return m_pXMLNode; } + CFDE_XMLNode* CreateXMLMappingNode(); FX_BOOL IsNeedSavingXMLNode(); uint32_t GetNameHash() const { return m_dwNameHash; } bool IsUnnamed() const { return m_dwNameHash == 0; } @@ -638,7 +638,7 @@ class CXFA_Node : public CXFA_Object { CXFA_Node* m_pChild; CXFA_Node* m_pLastChild; CXFA_Node* m_pParent; - IFDE_XMLNode* m_pXMLNode; + CFDE_XMLNode* m_pXMLNode; XFA_ELEMENT m_eNodeClass; uint16_t m_ePacket; uint32_t m_dwNameHash; diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp index fad2b26d4e..eed5323ab8 100644 --- a/xfa/fxfa/parser/xfa_object_imp.cpp +++ b/xfa/fxfa/parser/xfa_object_imp.cpp @@ -7,6 +7,7 @@ #include "xfa/fxfa/parser/xfa_object.h" #include "core/fxcrt/include/fx_ext.h" +#include "xfa/fde/xml/fde_xml_imp.h" #include "xfa/fgas/crt/fgas_codepage.h" #include "xfa/fgas/crt/fgas_system.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" @@ -124,11 +125,11 @@ CXFA_Node* CXFA_Node::Clone(FX_BOOL bRecursive) { MergeAllData(pClone); pClone->UpdateNameHash(); if (IsNeedSavingXMLNode()) { - IFDE_XMLNode* pCloneXML = NULL; + CFDE_XMLNode* pCloneXML = NULL; if (IsAttributeInXML()) { CFX_WideString wsName; GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE); - IFDE_XMLElement* pCloneXMLElement = IFDE_XMLElement::Create(wsName); + CFDE_XMLElement* pCloneXMLElement = new CFDE_XMLElement(wsName); CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value); if (!wsValue.IsEmpty()) { pCloneXMLElement->SetTextData(wsValue); @@ -962,15 +963,16 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) { if (!pParser) { return; } - IFDE_XMLNode* pXMLNode = NULL; + CFDE_XMLNode* pXMLNode = NULL; int32_t iParserStatus = pParser->ParseXMLData(wsExpression, pXMLNode, NULL); if (iParserStatus != XFA_PARSESTATUS_Done || !pXMLNode) { pParser->Release(); pParser = NULL; return; } - if (bIgnoreRoot && (pXMLNode->GetType() != FDE_XMLNODE_Element || - XFA_RecognizeRichText((IFDE_XMLElement*)pXMLNode))) { + if (bIgnoreRoot && + (pXMLNode->GetType() != FDE_XMLNODE_Element || + XFA_RecognizeRichText(static_cast<CFDE_XMLElement*>(pXMLNode)))) { bIgnoreRoot = FALSE; } CXFA_Node* pFakeRoot = Clone(FALSE); @@ -978,27 +980,27 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) { if (!wsContentType.IsEmpty()) { pFakeRoot->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType); } - IFDE_XMLNode* pFakeXMLRoot = pFakeRoot->GetXMLMappingNode(); + CFDE_XMLNode* pFakeXMLRoot = pFakeRoot->GetXMLMappingNode(); if (!pFakeXMLRoot) { - IFDE_XMLNode* pThisXMLRoot = GetXMLMappingNode(); + CFDE_XMLNode* pThisXMLRoot = GetXMLMappingNode(); pFakeXMLRoot = pThisXMLRoot ? pThisXMLRoot->Clone(FALSE) : NULL; } if (!pFakeXMLRoot) { CFX_WideStringC wsClassName; GetClassName(wsClassName); - pFakeXMLRoot = IFDE_XMLElement::Create(wsClassName); + pFakeXMLRoot = new CFDE_XMLElement(wsClassName); } if (bIgnoreRoot) { - IFDE_XMLNode* pXMLChild = pXMLNode->GetNodeItem(IFDE_XMLNode::FirstChild); + CFDE_XMLNode* pXMLChild = pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); while (pXMLChild) { - IFDE_XMLNode* pXMLSibling = - pXMLChild->GetNodeItem(IFDE_XMLNode::NextSibling); + CFDE_XMLNode* pXMLSibling = + pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling); pXMLNode->RemoveChildNode(pXMLChild); pFakeXMLRoot->InsertChildNode(pXMLChild); pXMLChild = pXMLSibling; } } else { - IFDE_XMLNode* pXMLParent = pXMLNode->GetNodeItem(IFDE_XMLNode::Parent); + CFDE_XMLNode* pXMLParent = pXMLNode->GetNodeItem(CFDE_XMLNode::Parent); if (pXMLParent) { pXMLParent->RemoveChildNode(pXMLNode); } @@ -1026,11 +1028,11 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) { } if (GetPacketID() == XFA_XDPPACKET_Form && GetClassID() == XFA_ELEMENT_ExData) { - IFDE_XMLNode* pTempXMLNode = GetXMLMappingNode(); + CFDE_XMLNode* pTempXMLNode = GetXMLMappingNode(); SetXMLMappingNode(pFakeXMLRoot); SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE); if (pTempXMLNode && - pTempXMLNode->GetNodeItem(IFDE_XMLNode::Parent) == NULL) { + pTempXMLNode->GetNodeItem(CFDE_XMLNode::Parent) == NULL) { pFakeXMLRoot = pTempXMLNode; } else { pFakeXMLRoot = NULL; @@ -1106,7 +1108,7 @@ void CXFA_Node::Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments) { return; } if (GetPacketID() == XFA_XDPPACKET_Datasets) { - IFDE_XMLNode* pElement = GetXMLMappingNode(); + CFDE_XMLNode* pElement = GetXMLMappingNode(); if (!pElement || pElement->GetType() != FDE_XMLNODE_Element) { FXJSE_Value_SetUTF8String(pArguments->GetReturnValue(), bsXMLHeader); return; @@ -3500,9 +3502,9 @@ void CXFA_Node::Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments) { if (argc == 1) { CFX_ByteString bsAttributeName = pArguments->GetUTF8String(0); CFX_WideString wsAttributeValue; - IFDE_XMLNode* pXMLNode = GetXMLMappingNode(); + CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { - ((IFDE_XMLElement*)pXMLNode) + static_cast<CFDE_XMLElement*>(pXMLNode) ->GetString(CFX_WideString::FromUTF8(bsAttributeName, bsAttributeName.GetLength()), wsAttributeValue); @@ -3520,9 +3522,9 @@ void CXFA_Node::Script_Packet_SetAttribute(CFXJSE_Arguments* pArguments) { if (argc == 2) { CFX_ByteString bsValue = pArguments->GetUTF8String(0); CFX_ByteString bsName = pArguments->GetUTF8String(1); - IFDE_XMLNode* pXMLNode = GetXMLMappingNode(); + CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { - ((IFDE_XMLElement*)pXMLNode) + static_cast<CFDE_XMLElement*>(pXMLNode) ->SetString(CFX_WideString::FromUTF8(bsName, bsName.GetLength()), CFX_WideString::FromUTF8(bsValue, bsValue.GetLength())); } @@ -3538,9 +3540,9 @@ void CXFA_Node::Script_Packet_RemoveAttribute(CFXJSE_Arguments* pArguments) { CFX_ByteString bsName = pArguments->GetUTF8String(0); CFX_WideString wsName = CFX_WideString::FromUTF8(bsName, bsName.GetLength()); - IFDE_XMLNode* pXMLNode = GetXMLMappingNode(); + CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { - IFDE_XMLElement* pXMLElement = (IFDE_XMLElement*)pXMLNode; + CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); if (pXMLElement->HasAttribute(wsName)) { pXMLElement->RemoveAttribute(wsName); } @@ -3557,17 +3559,17 @@ void CXFA_Node::Script_Packet_Content(FXJSE_HVALUE hValue, if (bSetting) { CFX_ByteString bsNewContent; FXJSE_Value_ToUTF8String(hValue, bsNewContent); - IFDE_XMLNode* pXMLNode = GetXMLMappingNode(); + CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { - IFDE_XMLElement* pXMLElement = (IFDE_XMLElement*)pXMLNode; + CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); pXMLElement->SetTextData( CFX_WideString::FromUTF8(bsNewContent, bsNewContent.GetLength())); } } else { CFX_WideString wsTextData; - IFDE_XMLNode* pXMLNode = GetXMLMappingNode(); + CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { - IFDE_XMLElement* pXMLElement = (IFDE_XMLElement*)pXMLNode; + CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); pXMLElement->GetTextData(wsTextData); } FXJSE_Value_SetUTF8String( @@ -3960,7 +3962,7 @@ FX_BOOL CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, switch (eXMLType) { case FDE_XMLNODE_Element: if (IsAttributeInXML()) { - ((IFDE_XMLElement*)m_pXMLNode) + static_cast<CFDE_XMLElement*>(m_pXMLNode) ->SetString(GetCData(XFA_ATTRIBUTE_QualifiedName), wsValue); } else { FX_BOOL bDeleteChildren = TRUE; @@ -3977,13 +3979,13 @@ FX_BOOL CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, } } if (bDeleteChildren) { - ((IFDE_XMLElement*)m_pXMLNode)->DeleteChildren(); + static_cast<CFDE_XMLElement*>(m_pXMLNode)->DeleteChildren(); } - ((IFDE_XMLElement*)m_pXMLNode)->SetTextData(wsValue); + static_cast<CFDE_XMLElement*>(m_pXMLNode)->SetTextData(wsValue); } break; case FDE_XMLNODE_Text: - ((IFDE_XMLText*)m_pXMLNode)->SetText(wsValue); + static_cast<CFDE_XMLText*>(m_pXMLNode)->SetText(wsValue); break; default: FXSYS_assert(0); @@ -3997,7 +3999,7 @@ FX_BOOL CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, if (pInfo->eName == XFA_ATTRIBUTE_ContentType) { wsAttrName = FX_WSTRC(L"xfa:") + wsAttrName; } - ((IFDE_XMLElement*)m_pXMLNode)->SetString(wsAttrName, wsValue); + static_cast<CFDE_XMLElement*>(m_pXMLNode)->SetString(wsAttrName, wsValue); } } return TRUE; @@ -4017,7 +4019,7 @@ FX_BOOL CXFA_Node::SetAttributeValue(const CFX_WideString& wsValue, switch (eXMLType) { case FDE_XMLNODE_Element: if (IsAttributeInXML()) { - ((IFDE_XMLElement*)m_pXMLNode) + static_cast<CFDE_XMLElement*>(m_pXMLNode) ->SetString(GetCData(XFA_ATTRIBUTE_QualifiedName), wsXMLValue); } else { FX_BOOL bDeleteChildren = TRUE; @@ -4034,13 +4036,13 @@ FX_BOOL CXFA_Node::SetAttributeValue(const CFX_WideString& wsValue, } } if (bDeleteChildren) { - ((IFDE_XMLElement*)m_pXMLNode)->DeleteChildren(); + static_cast<CFDE_XMLElement*>(m_pXMLNode)->DeleteChildren(); } - ((IFDE_XMLElement*)m_pXMLNode)->SetTextData(wsXMLValue); + static_cast<CFDE_XMLElement*>(m_pXMLNode)->SetTextData(wsXMLValue); } break; case FDE_XMLNODE_Text: - ((IFDE_XMLText*)m_pXMLNode)->SetText(wsXMLValue); + static_cast<CFDE_XMLText*>(m_pXMLNode)->SetText(wsXMLValue); break; default: FXSYS_assert(0); @@ -4129,19 +4131,19 @@ FX_BOOL CXFA_Node::SetValue(XFA_ATTRIBUTE eAttr, if (pInfo) { switch (eType) { case XFA_ATTRIBUTETYPE_Enum: - ((IFDE_XMLElement*)m_pXMLNode) + static_cast<CFDE_XMLElement*>(m_pXMLNode) ->SetString( pInfo->pName, XFA_GetAttributeEnumByID((XFA_ATTRIBUTEENUM)(uintptr_t)pValue) ->pName); break; case XFA_ATTRIBUTETYPE_Boolean: - ((IFDE_XMLElement*)m_pXMLNode) + static_cast<CFDE_XMLElement*>(m_pXMLNode) ->SetString(pInfo->pName, pValue ? FX_WSTRC(L"1") : FX_WSTRC(L"0")); break; case XFA_ATTRIBUTETYPE_Integer: - ((IFDE_XMLElement*)m_pXMLNode) + static_cast<CFDE_XMLElement*>(m_pXMLNode) ->SetInteger(pInfo->pName, (int32_t)(uintptr_t)pValue); break; default: @@ -4464,14 +4466,14 @@ FX_BOOL CXFA_Node::TryNamespace(CFX_WideString& wsNamespace) { wsNamespace.Empty(); if (GetObjectType() == XFA_OBJECTTYPE_ModelNode || GetClassID() == XFA_ELEMENT_Packet) { - IFDE_XMLNode* pXMLNode = GetXMLMappingNode(); + CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); if (!pXMLNode || pXMLNode->GetType() != FDE_XMLNODE_Element) { return FALSE; } - ((IFDE_XMLElement*)pXMLNode)->GetNamespaceURI(wsNamespace); + static_cast<CFDE_XMLElement*>(pXMLNode)->GetNamespaceURI(wsNamespace); return TRUE; } else if (GetPacketID() == XFA_XDPPACKET_Datasets) { - IFDE_XMLNode* pXMLNode = GetXMLMappingNode(); + CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); if (!pXMLNode) { return FALSE; } @@ -4481,10 +4483,10 @@ FX_BOOL CXFA_Node::TryNamespace(CFX_WideString& wsNamespace) { if (GetClassID() == XFA_ELEMENT_DataValue && GetEnum(XFA_ATTRIBUTE_Contains) == XFA_ATTRIBUTEENUM_MetaData) { return XFA_FDEExtension_ResolveNamespaceQualifier( - (IFDE_XMLElement*)pXMLNode, GetCData(XFA_ATTRIBUTE_QualifiedName), - wsNamespace); + static_cast<CFDE_XMLElement*>(pXMLNode), + GetCData(XFA_ATTRIBUTE_QualifiedName), wsNamespace); } - ((IFDE_XMLElement*)pXMLNode)->GetNamespaceURI(wsNamespace); + static_cast<CFDE_XMLElement*>(pXMLNode)->GetNamespaceURI(wsNamespace); return TRUE; } else { CXFA_Node* pModelNode = GetModelNode(); @@ -4617,7 +4619,7 @@ int32_t CXFA_Node::InsertChild(int32_t index, CXFA_Node* pNode) { pNotify->OnNodeEvent(this, XFA_NODEEVENT_ChildAdded, pNode); } if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) { - FXSYS_assert(pNode->m_pXMLNode->GetNodeItem(IFDE_XMLNode::Parent) == NULL); + FXSYS_assert(pNode->m_pXMLNode->GetNodeItem(CFDE_XMLNode::Parent) == NULL); m_pXMLNode->InsertChildNode(pNode->m_pXMLNode, index); pNode->SetFlag(XFA_NODEFLAG_OwnXMLNode, FALSE, FALSE); } @@ -4663,7 +4665,7 @@ FX_BOOL CXFA_Node::InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode) { pNotify->OnNodeEvent(this, XFA_NODEEVENT_ChildAdded, pNode); } if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) { - FXSYS_assert(pNode->m_pXMLNode->GetNodeItem(IFDE_XMLNode::Parent) == NULL); + FXSYS_assert(pNode->m_pXMLNode->GetNodeItem(CFDE_XMLNode::Parent) == NULL); m_pXMLNode->InsertChildNode(pNode->m_pXMLNode, nIndex); pNode->SetFlag(XFA_NODEFLAG_OwnXMLNode, FALSE, FALSE); } @@ -4711,14 +4713,15 @@ FX_BOOL CXFA_Node::RemoveChild(CXFA_Node* pNode, FX_BOOL bNotify) { FXSYS_assert(pNode->m_pXMLNode == m_pXMLNode && m_pXMLNode->GetType() == FDE_XMLNODE_Element); if (pNode->m_pXMLNode->GetType() == FDE_XMLNODE_Element) { - IFDE_XMLElement* pXMLElement = (IFDE_XMLElement*)(pNode->m_pXMLNode); + CFDE_XMLElement* pXMLElement = + static_cast<CFDE_XMLElement*>(pNode->m_pXMLNode); CFX_WideStringC wsAttributeName = pNode->GetCData(XFA_ATTRIBUTE_QualifiedName); pXMLElement->RemoveAttribute(wsAttributeName.GetPtr()); } CFX_WideString wsName; pNode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE); - IFDE_XMLElement* pNewXMLElement = IFDE_XMLElement::Create(wsName); + CFDE_XMLElement* pNewXMLElement = new CFDE_XMLElement(wsName); CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value); if (!wsValue.IsEmpty()) { pNewXMLElement->SetTextData(wsValue); @@ -4971,10 +4974,10 @@ void CXFA_Node::UpdateNameHash() { wsName.GetLength()); } } -IFDE_XMLNode* CXFA_Node::CreateXMLMappingNode() { +CFDE_XMLNode* CXFA_Node::CreateXMLMappingNode() { if (!m_pXMLNode) { CFX_WideStringC wsTag = GetCData(XFA_ATTRIBUTE_Name); - m_pXMLNode = IFDE_XMLElement::Create(wsTag); + m_pXMLNode = new CFDE_XMLElement(wsTag); SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE); } return m_pXMLNode; diff --git a/xfa/fxfa/parser/xfa_parser.h b/xfa/fxfa/parser/xfa_parser.h index 2d45e5f9c8..86a0d9d94f 100644 --- a/xfa/fxfa/parser/xfa_parser.h +++ b/xfa/fxfa/parser/xfa_parser.h @@ -9,6 +9,8 @@ #include "xfa/fxfa/parser/xfa_document.h" +class CFDE_XMLDoc; + class IXFA_Parser { public: static IXFA_Parser* Create(IXFA_ObjFactory* pFactory, @@ -19,13 +21,13 @@ class IXFA_Parser { XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP) = 0; virtual int32_t DoParse(IFX_Pause* pPause = NULL) = 0; virtual int32_t ParseXMLData(const CFX_WideString& wsXML, - IFDE_XMLNode*& pXMLNode, + CFDE_XMLNode*& pXMLNode, IFX_Pause* pPause = NULL) = 0; virtual void ConstructXFANode(CXFA_Node* pXFANode, - IFDE_XMLNode* pXMLNode) = 0; + CFDE_XMLNode* pXMLNode) = 0; virtual IXFA_ObjFactory* GetFactory() const = 0; virtual CXFA_Node* GetRootNode() const = 0; - virtual IFDE_XMLDoc* GetXMLDoc() const = 0; + virtual CFDE_XMLDoc* GetXMLDoc() const = 0; virtual void CloseParser() = 0; }; class IXFA_DocParser : public IXFA_Parser { diff --git a/xfa/fxfa/parser/xfa_parser_imp.cpp b/xfa/fxfa/parser/xfa_parser_imp.cpp index efddc427a6..75198dc443 100644 --- a/xfa/fxfa/parser/xfa_parser_imp.cpp +++ b/xfa/fxfa/parser/xfa_parser_imp.cpp @@ -6,6 +6,7 @@ #include "xfa/fxfa/parser/xfa_parser_imp.h" +#include "xfa/fde/xml/fde_xml_imp.h" #include "xfa/fgas/crt/fgas_codepage.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_basic_imp.h" @@ -38,22 +39,22 @@ CXFA_SimpleParser::~CXFA_SimpleParser() { void CXFA_SimpleParser::SetFactory(IXFA_ObjFactory* pFactory) { m_pFactory = pFactory; } -static IFDE_XMLNode* XFA_FDEExtension_GetDocumentNode( - IFDE_XMLDoc* pXMLDoc, +static CFDE_XMLNode* XFA_FDEExtension_GetDocumentNode( + CFDE_XMLDoc* pXMLDoc, FX_BOOL bVerifyWellFormness = FALSE) { if (!pXMLDoc) { return NULL; } - IFDE_XMLNode* pXMLFakeRoot = pXMLDoc->GetRoot(); - for (IFDE_XMLNode* pXMLNode = - pXMLFakeRoot->GetNodeItem(IFDE_XMLNode::FirstChild); - pXMLNode; pXMLNode = pXMLNode->GetNodeItem(IFDE_XMLNode::NextSibling)) { + CFDE_XMLNode* pXMLFakeRoot = pXMLDoc->GetRoot(); + for (CFDE_XMLNode* pXMLNode = + pXMLFakeRoot->GetNodeItem(CFDE_XMLNode::FirstChild); + pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) { if (pXMLNode->GetType() == FDE_XMLNODE_Element) { if (bVerifyWellFormness) { - for (IFDE_XMLNode* pNextNode = - pXMLNode->GetNodeItem(IFDE_XMLNode::NextSibling); + for (CFDE_XMLNode* pNextNode = + pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling); pNextNode; - pNextNode = pNextNode->GetNodeItem(IFDE_XMLNode::NextSibling)) { + pNextNode = pNextNode->GetNodeItem(CFDE_XMLNode::NextSibling)) { if (pNextNode->GetType() == FDE_XMLNODE_Element) { return FALSE; } @@ -78,14 +79,8 @@ int32_t CXFA_SimpleParser::StartParse(IFX_FileRead* pStream, wCodePage != FX_CODEPAGE_UTF8) { m_pStream->SetCodePage(FX_CODEPAGE_UTF8); } - m_pXMLDoc = IFDE_XMLDoc::Create(); - if (m_pXMLDoc == NULL) { - return XFA_PARSESTATUS_StatusErr; - } + m_pXMLDoc = new CFDE_XMLDoc; m_pXMLParser = new CXFA_XMLParser(m_pXMLDoc->GetRoot(), m_pStream); - if (m_pXMLParser == NULL) { - return XFA_PARSESTATUS_StatusErr; - } if (!m_pXMLDoc->LoadXML(m_pXMLParser)) { return XFA_PARSESTATUS_StatusErr; } @@ -116,7 +111,7 @@ int32_t CXFA_SimpleParser::DoParse(IFX_Pause* pPause) { return XFA_PARSESTATUS_Done; } int32_t CXFA_SimpleParser::ParseXMLData(const CFX_WideString& wsXML, - IFDE_XMLNode*& pXMLNode, + CFDE_XMLNode*& pXMLNode, IFX_Pause* pPause) { CloseParser(); pXMLNode = NULL; @@ -125,15 +120,8 @@ int32_t CXFA_SimpleParser::ParseXMLData(const CFX_WideString& wsXML, return XFA_PARSESTATUS_StreamErr; } m_pStream = pStream; - m_pXMLDoc = IFDE_XMLDoc::Create(); - if (m_pXMLDoc == NULL) { - return XFA_PARSESTATUS_StatusErr; - } + m_pXMLDoc = new CFDE_XMLDoc; CXFA_XMLParser* pParser = new CXFA_XMLParser(m_pXMLDoc->GetRoot(), m_pStream); - if (pParser == NULL) { - return XFA_PARSESTATUS_StatusErr; - } - pParser->m_dwCheckStatus = 0x03; if (!m_pXMLDoc->LoadXML(pParser)) { return XFA_PARSESTATUS_StatusErr; @@ -157,14 +145,14 @@ int32_t CXFA_SimpleParser::ParseXMLData(const CFX_WideString& wsXML, } void CXFA_SimpleParser::ConstructXFANode(CXFA_Node* pXFANode, - IFDE_XMLNode* pXMLNode) { + CFDE_XMLNode* pXMLNode) { XFA_XDPPACKET ePacketID = (XFA_XDPPACKET)pXFANode->GetPacketID(); if (ePacketID == XFA_XDPPACKET_Datasets) { if (pXFANode->GetClassID() == XFA_ELEMENT_DataValue) { - for (IFDE_XMLNode* pXMLChild = - pXMLNode->GetNodeItem(IFDE_XMLNode::FirstChild); + for (CFDE_XMLNode* pXMLChild = + pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); pXMLChild; - pXMLChild = pXMLChild->GetNodeItem(IFDE_XMLNode::NextSibling)) { + pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) { FDE_XMLNODETYPE eNodeType = pXMLChild->GetType(); if (eNodeType == FDE_XMLNODE_Instruction) continue; @@ -176,11 +164,11 @@ void CXFA_SimpleParser::ConstructXFANode(CXFA_Node* pXFANode, return; CFX_WideString wsNodeStr; - ((IFDE_XMLElement*)pXMLChild)->GetLocalTagName(wsNodeStr); + CFDE_XMLElement* child = static_cast<CFDE_XMLElement*>(pXMLChild); + child->GetLocalTagName(wsNodeStr); pXFAChild->SetCData(XFA_ATTRIBUTE_Name, wsNodeStr); CFX_WideString wsChildValue; - XFA_GetPlainTextFromRichText((IFDE_XMLElement*)pXMLChild, - wsChildValue); + XFA_GetPlainTextFromRichText(child, wsChildValue); if (!wsChildValue.IsEmpty()) pXFAChild->SetCData(XFA_ATTRIBUTE_Value, wsChildValue); @@ -203,13 +191,13 @@ void CXFA_SimpleParser::ConstructXFANode(CXFA_Node* pXFANode, } FX_BOOL XFA_FDEExtension_ResolveNamespaceQualifier( - IFDE_XMLElement* pNode, + CFDE_XMLElement* pNode, const CFX_WideStringC& wsQualifier, CFX_WideString& wsNamespaceURI) { if (!pNode) { return FALSE; } - IFDE_XMLNode* pFakeRoot = pNode->GetNodeItem(IFDE_XMLNode::Root); + CFDE_XMLNode* pFakeRoot = pNode->GetNodeItem(CFDE_XMLNode::Root); CFX_WideString wsNSAttribute; FX_BOOL bRet = FALSE; if (wsQualifier.IsEmpty()) { @@ -218,8 +206,8 @@ FX_BOOL XFA_FDEExtension_ResolveNamespaceQualifier( } else { wsNSAttribute = FX_WSTRC(L"xmlns:") + wsQualifier; } - for (; pNode != pFakeRoot; - pNode = (IFDE_XMLElement*)pNode->GetNodeItem(IFDE_XMLNode::Parent)) { + for (; pNode != pFakeRoot; pNode = static_cast<CFDE_XMLElement*>( + pNode->GetNodeItem(CFDE_XMLNode::Parent))) { if (pNode->GetType() != FDE_XMLNODE_Element) { continue; } @@ -232,7 +220,7 @@ FX_BOOL XFA_FDEExtension_ResolveNamespaceQualifier( return bRet; } static inline void XFA_FDEExtension_GetElementTagNamespaceURI( - IFDE_XMLElement* pElement, + CFDE_XMLElement* pElement, CFX_WideString& wsNamespaceURI) { CFX_WideString wsNodeStr; pElement->GetNamespacePrefix(wsNodeStr); @@ -242,14 +230,14 @@ static inline void XFA_FDEExtension_GetElementTagNamespaceURI( } } static FX_BOOL XFA_FDEExtension_MatchNodeName( - IFDE_XMLNode* pNode, + CFDE_XMLNode* pNode, const CFX_WideStringC& wsLocalTagName, const CFX_WideStringC& wsNamespaceURIPrefix, uint32_t eMatchFlags = XFA_XDPPACKET_FLAGS_NOMATCH) { if (!pNode || pNode->GetType() != FDE_XMLNODE_Element) { return FALSE; } - IFDE_XMLElement* pElement = reinterpret_cast<IFDE_XMLElement*>(pNode); + CFDE_XMLElement* pElement = reinterpret_cast<CFDE_XMLElement*>(pNode); CFX_WideString wsNodeStr; pElement->GetLocalTagName(wsNodeStr); if (wsNodeStr != wsLocalTagName) { @@ -279,7 +267,7 @@ static FX_BOOL XFA_FDEExtension_GetAttributeLocalName( } } static FX_BOOL XFA_FDEExtension_ResolveAttribute( - IFDE_XMLElement* pElement, + CFDE_XMLElement* pElement, const CFX_WideStringC& wsAttributeName, CFX_WideString& wsLocalAttrName, CFX_WideString& wsNamespaceURI) { @@ -302,7 +290,7 @@ static FX_BOOL XFA_FDEExtension_ResolveAttribute( return TRUE; } static FX_BOOL XFA_FDEExtension_FindAttributeWithNS( - IFDE_XMLElement* pElement, + CFDE_XMLElement* pElement, const CFX_WideStringC& wsLocalAttributeName, const CFX_WideStringC& wsNamespaceURIPrefix, CFX_WideString& wsValue, @@ -348,7 +336,7 @@ static FX_BOOL XFA_FDEExtension_FindAttributeWithNS( } return FALSE; } -CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket(IFDE_XMLNode* pXMLDocumentNode, +CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket(CFDE_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID) { switch (ePacketID) { case XFA_XDPPACKET_UNKNOWN: @@ -375,7 +363,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket(IFDE_XMLNode* pXMLDocumentNode, return NULL; } CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP( - IFDE_XMLNode* pXMLDocumentNode, + CFDE_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID) { if (!XFA_FDEExtension_MatchNodeName( pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_XDP)->pName, @@ -391,7 +379,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP( m_pRootNode = pXFARootNode; pXFARootNode->SetCData(XFA_ATTRIBUTE_Name, FX_WSTRC(L"xfa")); { - IFDE_XMLElement* pElement = (IFDE_XMLElement*)pXMLDocumentNode; + CFDE_XMLElement* pElement = static_cast<CFDE_XMLElement*>(pXMLDocumentNode); int32_t iAttributeCount = pElement->CountAttributes(); for (int32_t i = 0; i < iAttributeCount; i++) { CFX_WideString wsAttriName, wsAttriValue; @@ -403,13 +391,13 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP( } } } - IFDE_XMLNode* pXMLConfigDOMRoot = nullptr; + CFDE_XMLNode* pXMLConfigDOMRoot = nullptr; CXFA_Node* pXFAConfigDOMRoot = nullptr; { - for (IFDE_XMLNode* pChildItem = - pXMLDocumentNode->GetNodeItem(IFDE_XMLNode::FirstChild); + for (CFDE_XMLNode* pChildItem = + pXMLDocumentNode->GetNodeItem(CFDE_XMLNode::FirstChild); pChildItem; - pChildItem = pChildItem->GetNodeItem(IFDE_XMLNode::NextSibling)) { + pChildItem = pChildItem->GetNodeItem(CFDE_XMLNode::NextSibling)) { const XFA_PACKETINFO* pPacketInfo = XFA_GetPacketByIndex(XFA_PACKET_Config); if (!XFA_FDEExtension_MatchNodeName(pChildItem, pPacketInfo->pName, @@ -426,22 +414,22 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP( pXFARootNode->InsertChild(pXFAConfigDOMRoot, NULL); } } - IFDE_XMLNode* pXMLDatasetsDOMRoot = nullptr; - IFDE_XMLNode* pXMLFormDOMRoot = nullptr; - IFDE_XMLNode* pXMLTemplateDOMRoot = nullptr; + CFDE_XMLNode* pXMLDatasetsDOMRoot = nullptr; + CFDE_XMLNode* pXMLFormDOMRoot = nullptr; + CFDE_XMLNode* pXMLTemplateDOMRoot = nullptr; { - for (IFDE_XMLNode* pChildItem = - pXMLDocumentNode->GetNodeItem(IFDE_XMLNode::FirstChild); + for (CFDE_XMLNode* pChildItem = + pXMLDocumentNode->GetNodeItem(CFDE_XMLNode::FirstChild); pChildItem; - pChildItem = pChildItem->GetNodeItem(IFDE_XMLNode::NextSibling)) { + pChildItem = pChildItem->GetNodeItem(CFDE_XMLNode::NextSibling)) { if (!pChildItem || pChildItem->GetType() != FDE_XMLNODE_Element) { continue; } if (pChildItem == pXMLConfigDOMRoot) { continue; } - IFDE_XMLElement* pElement = - reinterpret_cast<IFDE_XMLElement*>(pChildItem); + CFDE_XMLElement* pElement = + reinterpret_cast<CFDE_XMLElement*>(pChildItem); CFX_WideString wsPacketName; pElement->GetLocalTagName(wsPacketName); const XFA_PACKETINFO* pPacketInfo = XFA_GetPacketByName(wsPacketName); @@ -512,7 +500,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP( return pXFARootNode; } CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Config( - IFDE_XMLNode* pXMLDocumentNode, + CFDE_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID) { if (!XFA_FDEExtension_MatchNodeName( pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_Config)->pName, @@ -534,7 +522,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Config( return pNode; } CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( - IFDE_XMLNode* pXMLDocumentNode, + CFDE_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID) { CXFA_Node* pNode = NULL; if (ePacketID == XFA_XDPPACKET_Template) { @@ -551,8 +539,8 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( XFA_GetPacketByIndex(XFA_PACKET_Template)->pName); if (m_bDocumentParser) { CFX_WideString wsNamespaceURI; - IFDE_XMLElement* pXMLDocumentElement = - (IFDE_XMLElement*)pXMLDocumentNode; + CFDE_XMLElement* pXMLDocumentElement = + static_cast<CFDE_XMLElement*>(pXMLDocumentNode); pXMLDocumentElement->GetNamespaceURI(wsNamespaceURI); if (wsNamespaceURI.IsEmpty()) { pXMLDocumentElement->GetString(L"xmlns:xfa", wsNamespaceURI); @@ -568,7 +556,8 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_Form)->pName, XFA_GetPacketByIndex(XFA_PACKET_Form)->pURI, XFA_GetPacketByIndex(XFA_PACKET_Form)->eFlags)) { - IFDE_XMLElement* pXMLDocumentElement = (IFDE_XMLElement*)pXMLDocumentNode; + CFDE_XMLElement* pXMLDocumentElement = + static_cast<CFDE_XMLElement*>(pXMLDocumentNode); CFX_WideString wsChecksum; pXMLDocumentElement->GetString(L"checksum", wsChecksum); if (wsChecksum.GetLength() != 28 || @@ -618,7 +607,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( } return pNode; } -static IFDE_XMLNode* XFA_GetDataSetsFromXDP(IFDE_XMLNode* pXMLDocumentNode) { +static CFDE_XMLNode* XFA_GetDataSetsFromXDP(CFDE_XMLNode* pXMLDocumentNode) { if (XFA_FDEExtension_MatchNodeName( pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_Datasets)->pName, XFA_GetPacketByIndex(XFA_PACKET_Datasets)->pURI, @@ -631,10 +620,10 @@ static IFDE_XMLNode* XFA_GetDataSetsFromXDP(IFDE_XMLNode* pXMLDocumentNode) { XFA_GetPacketByIndex(XFA_PACKET_XDP)->eFlags)) { return NULL; } - for (IFDE_XMLNode* pDatasetsNode = - pXMLDocumentNode->GetNodeItem(IFDE_XMLNode::FirstChild); + for (CFDE_XMLNode* pDatasetsNode = + pXMLDocumentNode->GetNodeItem(CFDE_XMLNode::FirstChild); pDatasetsNode; - pDatasetsNode = pDatasetsNode->GetNodeItem(IFDE_XMLNode::NextSibling)) { + pDatasetsNode = pDatasetsNode->GetNodeItem(CFDE_XMLNode::NextSibling)) { if (!XFA_FDEExtension_MatchNodeName( pDatasetsNode, XFA_GetPacketByIndex(XFA_PACKET_Datasets)->pName, XFA_GetPacketByIndex(XFA_PACKET_Datasets)->pURI, @@ -646,9 +635,9 @@ static IFDE_XMLNode* XFA_GetDataSetsFromXDP(IFDE_XMLNode* pXMLDocumentNode) { return NULL; } CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data( - IFDE_XMLNode* pXMLDocumentNode, + CFDE_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID) { - IFDE_XMLNode* pDatasetsXMLNode = XFA_GetDataSetsFromXDP(pXMLDocumentNode); + CFDE_XMLNode* pDatasetsXMLNode = XFA_GetDataSetsFromXDP(pXMLDocumentNode); if (pDatasetsXMLNode) { CXFA_Node* pNode = m_pFactory->CreateNode(XFA_XDPPACKET_Datasets, XFA_ELEMENT_DataModel); @@ -663,24 +652,25 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data( pNode->SetXMLMappingNode(pDatasetsXMLNode); return pNode; } - IFDE_XMLNode* pDataXMLNode = NULL; + CFDE_XMLNode* pDataXMLNode = NULL; if (XFA_FDEExtension_MatchNodeName( pXMLDocumentNode, FX_WSTRC(L"data"), XFA_GetPacketByIndex(XFA_PACKET_Datasets)->pURI, XFA_GetPacketByIndex(XFA_PACKET_Datasets)->eFlags)) { - ((IFDE_XMLElement*)pXMLDocumentNode)->RemoveAttribute(L"xmlns:xfa"); + static_cast<CFDE_XMLElement*>(pXMLDocumentNode) + ->RemoveAttribute(L"xmlns:xfa"); pDataXMLNode = pXMLDocumentNode; } else { - IFDE_XMLElement* pDataElement = - IFDE_XMLElement::Create(FX_WSTRC(L"xfa:data")); - IFDE_XMLNode* pParentXMLNode = - pXMLDocumentNode->GetNodeItem(IFDE_XMLNode::Parent); + CFDE_XMLElement* pDataElement = new CFDE_XMLElement(FX_WSTRC(L"xfa:data")); + CFDE_XMLNode* pParentXMLNode = + pXMLDocumentNode->GetNodeItem(CFDE_XMLNode::Parent); if (pParentXMLNode) { pParentXMLNode->RemoveChildNode(pXMLDocumentNode); } FXSYS_assert(pXMLDocumentNode->GetType() == FDE_XMLNODE_Element); if (pXMLDocumentNode->GetType() == FDE_XMLNODE_Element) { - ((IFDE_XMLElement*)pXMLDocumentNode)->RemoveAttribute(L"xmlns:xfa"); + static_cast<CFDE_XMLElement*>(pXMLDocumentNode) + ->RemoveAttribute(L"xmlns:xfa"); } pDataElement->InsertChildNode(pXMLDocumentNode); pDataXMLNode = pDataElement; @@ -695,7 +685,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data( return NULL; } CFX_WideString wsLocalName; - ((IFDE_XMLElement*)pDataXMLNode)->GetLocalTagName(wsLocalName); + static_cast<CFDE_XMLElement*>(pDataXMLNode)->GetLocalTagName(wsLocalName); pNode->SetCData(XFA_ATTRIBUTE_Name, wsLocalName); if (!DataLoader(pNode, pDataXMLNode, TRUE)) { return NULL; @@ -709,7 +699,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data( return NULL; } CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_LocaleConnectionSourceSet( - IFDE_XMLNode* pXMLDocumentNode, + CFDE_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID) { CXFA_Node* pNode = NULL; if (ePacketID == XFA_XDPPACKET_LocaleSet) { @@ -768,7 +758,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_LocaleConnectionSourceSet( return pNode; } CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Xdc( - IFDE_XMLNode* pXMLDocumentNode, + CFDE_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID) { if (XFA_FDEExtension_MatchNodeName( pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_Xdc)->pName, @@ -787,7 +777,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Xdc( return NULL; } CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_User( - IFDE_XMLNode* pXMLDocumentNode, + CFDE_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID) { CXFA_Node* pNode = m_pFactory->CreateNode(XFA_XDPPACKET_XDP, XFA_ELEMENT_Packet); @@ -795,7 +785,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_User( return NULL; } CFX_WideString wsName; - ((IFDE_XMLElement*)pXMLDocumentNode)->GetLocalTagName(wsName); + static_cast<CFDE_XMLElement*>(pXMLDocumentNode)->GetLocalTagName(wsName); pNode->SetCData(XFA_ATTRIBUTE_Name, wsName); if (!UserPacketLoader(pNode, pXMLDocumentNode)) { return NULL; @@ -804,7 +794,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_User( return pNode; } CXFA_Node* CXFA_SimpleParser::UserPacketLoader(CXFA_Node* pXFANode, - IFDE_XMLNode* pXMLDoc) { + CFDE_XMLNode* pXMLDoc) { return pXFANode; } static FX_BOOL XFA_FDEExtension_IsStringAllWhitespace(CFX_WideString wsText) { @@ -812,22 +802,22 @@ static FX_BOOL XFA_FDEExtension_IsStringAllWhitespace(CFX_WideString wsText) { return wsText.IsEmpty(); } CXFA_Node* CXFA_SimpleParser::DataLoader(CXFA_Node* pXFANode, - IFDE_XMLNode* pXMLDoc, + CFDE_XMLNode* pXMLDoc, FX_BOOL bDoTransform) { ParseDataGroup(pXFANode, pXMLDoc, XFA_XDPPACKET_Datasets); return pXFANode; } CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, - IFDE_XMLNode* pXMLDoc, + CFDE_XMLNode* pXMLDoc, XFA_XDPPACKET ePacketID, FX_BOOL bUseAttribute) { FX_BOOL bOneOfPropertyFound = FALSE; - for (IFDE_XMLNode* pXMLChild = pXMLDoc->GetNodeItem(IFDE_XMLNode::FirstChild); + for (CFDE_XMLNode* pXMLChild = pXMLDoc->GetNodeItem(CFDE_XMLNode::FirstChild); pXMLChild; - pXMLChild = pXMLChild->GetNodeItem(IFDE_XMLNode::NextSibling)) { + pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) { switch (pXMLChild->GetType()) { case FDE_XMLNODE_Element: { - IFDE_XMLElement* pXMLElement = (IFDE_XMLElement*)pXMLChild; + CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLChild); CFX_WideString wsTagName; pXMLElement->GetLocalTagName(wsTagName); const XFA_ELEMENTINFO* pElemInfo = XFA_GetElementByName(wsTagName); @@ -901,7 +891,8 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, } } break; case FDE_XMLNODE_Instruction: - ParseInstruction(pXFANode, (IFDE_XMLInstruction*)pXMLChild, ePacketID); + ParseInstruction(pXFANode, static_cast<CFDE_XMLInstruction*>(pXMLChild), + ePacketID); break; default: break; @@ -909,7 +900,7 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, } return pXFANode; } -FX_BOOL XFA_RecognizeRichText(IFDE_XMLElement* pRichTextXMLNode) { +FX_BOOL XFA_RecognizeRichText(CFDE_XMLElement* pRichTextXMLNode) { if (pRichTextXMLNode) { CFX_WideString wsNamespaceURI; XFA_FDEExtension_GetElementTagNamespaceURI(pRichTextXMLNode, @@ -922,33 +913,33 @@ FX_BOOL XFA_RecognizeRichText(IFDE_XMLElement* pRichTextXMLNode) { } class RichTextNodeVisitor { public: - static inline IFDE_XMLNode* GetFirstChild(IFDE_XMLNode* pNode) { - return pNode->GetNodeItem(IFDE_XMLNode::FirstChild); + static inline CFDE_XMLNode* GetFirstChild(CFDE_XMLNode* pNode) { + return pNode->GetNodeItem(CFDE_XMLNode::FirstChild); } - static inline IFDE_XMLNode* GetNextSibling(IFDE_XMLNode* pNode) { - return pNode->GetNodeItem(IFDE_XMLNode::NextSibling); + static inline CFDE_XMLNode* GetNextSibling(CFDE_XMLNode* pNode) { + return pNode->GetNodeItem(CFDE_XMLNode::NextSibling); } - static inline IFDE_XMLNode* GetParent(IFDE_XMLNode* pNode) { - return pNode->GetNodeItem(IFDE_XMLNode::Parent); + static inline CFDE_XMLNode* GetParent(CFDE_XMLNode* pNode) { + return pNode->GetNodeItem(CFDE_XMLNode::Parent); } }; -void XFA_ConvertXMLToPlainText(IFDE_XMLElement* pRootXMLNode, +void XFA_ConvertXMLToPlainText(CFDE_XMLElement* pRootXMLNode, CFX_WideString& wsOutput) { - for (IFDE_XMLNode* pXMLChild = - pRootXMLNode->GetNodeItem(IFDE_XMLNode::FirstChild); + for (CFDE_XMLNode* pXMLChild = + pRootXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); pXMLChild; - pXMLChild = pXMLChild->GetNodeItem(IFDE_XMLNode::NextSibling)) { + pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) { switch (pXMLChild->GetType()) { case FDE_XMLNODE_Element: { CFX_WideString wsTextData; - ((IFDE_XMLElement*)pXMLChild)->GetTextData(wsTextData); + static_cast<CFDE_XMLElement*>(pXMLChild)->GetTextData(wsTextData); wsTextData += FX_WSTRC(L"\n"); wsOutput += wsTextData; } break; case FDE_XMLNODE_Text: { CFX_WideString wsText; - ((IFDE_XMLText*)pXMLChild)->GetText(wsText); + static_cast<CFDE_XMLText*>(pXMLChild)->GetText(wsText); if (XFA_FDEExtension_IsStringAllWhitespace(wsText)) { continue; } else { @@ -957,7 +948,7 @@ void XFA_ConvertXMLToPlainText(IFDE_XMLElement* pRootXMLNode, } break; case FDE_XMLNODE_CharData: { CFX_WideString wsCharData; - ((IFDE_XMLCharData*)pXMLChild)->GetCharData(wsCharData); + static_cast<CFDE_XMLCharData*>(pXMLChild)->GetCharData(wsCharData); if (XFA_FDEExtension_IsStringAllWhitespace(wsCharData)) { continue; } else { @@ -972,7 +963,7 @@ void XFA_ConvertXMLToPlainText(IFDE_XMLElement* pRootXMLNode, } void CXFA_SimpleParser::ParseContentNode(CXFA_Node* pXFANode, - IFDE_XMLNode* pXMLNode, + CFDE_XMLNode* pXMLNode, XFA_XDPPACKET ePacketID) { XFA_ELEMENT element = XFA_ELEMENT_Sharptext; if (pXFANode->GetClassID() == XFA_ELEMENT_ExData) { @@ -987,10 +978,10 @@ void CXFA_SimpleParser::ParseContentNode(CXFA_Node* pXFANode, pXFANode->SetXMLMappingNode(pXMLNode); CFX_WideString wsValue; - for (IFDE_XMLNode* pXMLChild = - pXMLNode->GetNodeItem(IFDE_XMLNode::FirstChild); + for (CFDE_XMLNode* pXMLChild = + pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); pXMLChild; - pXMLChild = pXMLChild->GetNodeItem(IFDE_XMLNode::NextSibling)) { + pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) { FDE_XMLNODETYPE eNodeType = pXMLChild->GetType(); if (eNodeType == FDE_XMLNODE_Instruction) continue; @@ -999,19 +990,21 @@ void CXFA_SimpleParser::ParseContentNode(CXFA_Node* pXFANode, if (eNodeType != FDE_XMLNODE_Element) break; - if (XFA_RecognizeRichText((IFDE_XMLElement*)pXMLChild)) - XFA_GetPlainTextFromRichText((IFDE_XMLElement*)pXMLChild, wsValue); + if (XFA_RecognizeRichText(static_cast<CFDE_XMLElement*>(pXMLChild))) + XFA_GetPlainTextFromRichText(static_cast<CFDE_XMLElement*>(pXMLChild), + wsValue); } else if (element == XFA_ELEMENT_Sharpxml) { if (eNodeType != FDE_XMLNODE_Element) break; - XFA_ConvertXMLToPlainText((IFDE_XMLElement*)pXMLChild, wsValue); + XFA_ConvertXMLToPlainText(static_cast<CFDE_XMLElement*>(pXMLChild), + wsValue); } else { if (eNodeType == FDE_XMLNODE_Element) break; if (eNodeType == FDE_XMLNODE_Text) - ((IFDE_XMLText*)pXMLChild)->GetText(wsValue); + static_cast<CFDE_XMLText*>(pXMLChild)->GetText(wsValue); else if (eNodeType == FDE_XMLNODE_CharData) - ((IFDE_XMLCharData*)pXMLChild)->GetCharData(wsValue); + static_cast<CFDE_XMLCharData*>(pXMLChild)->GetCharData(wsValue); } break; } @@ -1029,15 +1022,15 @@ void CXFA_SimpleParser::ParseContentNode(CXFA_Node* pXFANode, } void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, - IFDE_XMLNode* pXMLNode, + CFDE_XMLNode* pXMLNode, XFA_XDPPACKET ePacketID) { - for (IFDE_XMLNode* pXMLChild = - pXMLNode->GetNodeItem(IFDE_XMLNode::FirstChild); + for (CFDE_XMLNode* pXMLChild = + pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); pXMLChild; - pXMLChild = pXMLChild->GetNodeItem(IFDE_XMLNode::NextSibling)) { + pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) { switch (pXMLChild->GetType()) { case FDE_XMLNODE_Element: { - IFDE_XMLElement* pXMLElement = (IFDE_XMLElement*)pXMLChild; + CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLChild); { CFX_WideString wsNamespaceURI; XFA_FDEExtension_GetElementTagNamespaceURI(pXMLElement, @@ -1080,12 +1073,13 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, } } if (eNodeType == XFA_ELEMENT_DataModel) { - for (IFDE_XMLNode* pXMLDataChild = - pXMLElement->GetNodeItem(IFDE_XMLNode::FirstChild); + for (CFDE_XMLNode* pXMLDataChild = + pXMLElement->GetNodeItem(CFDE_XMLNode::FirstChild); pXMLDataChild; pXMLDataChild = pXMLDataChild->GetNodeItem( - IFDE_XMLNode::NextSibling)) { + CFDE_XMLNode::NextSibling)) { if (pXMLDataChild->GetType() == FDE_XMLNODE_Element) { - if (!XFA_RecognizeRichText((IFDE_XMLElement*)pXMLDataChild)) { + if (!XFA_RecognizeRichText( + static_cast<CFDE_XMLElement*>(pXMLDataChild))) { eNodeType = XFA_ELEMENT_DataGroup; break; } @@ -1168,7 +1162,8 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, } continue; case FDE_XMLNODE_CharData: { - IFDE_XMLCharData* pXMLCharData = (IFDE_XMLCharData*)pXMLChild; + CFDE_XMLCharData* pXMLCharData = + static_cast<CFDE_XMLCharData*>(pXMLChild); CFX_WideString wsCharData; pXMLCharData->GetCharData(wsCharData); if (XFA_FDEExtension_IsStringAllWhitespace(wsCharData)) { @@ -1186,7 +1181,7 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, } continue; case FDE_XMLNODE_Text: { - IFDE_XMLText* pXMLText = (IFDE_XMLText*)pXMLChild; + CFDE_XMLText* pXMLText = static_cast<CFDE_XMLText*>(pXMLChild); CFX_WideString wsText; pXMLText->GetText(wsText); if (XFA_FDEExtension_IsStringAllWhitespace(wsText)) { @@ -1212,35 +1207,37 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, } void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode, - IFDE_XMLNode* pXMLNode, + CFDE_XMLNode* pXMLNode, XFA_XDPPACKET ePacketID) { CFX_WideTextBuf wsValueTextBuf; CFX_WideTextBuf wsCurValueTextBuf; FX_BOOL bMarkAsCompound = FALSE; - IFDE_XMLNode* pXMLCurValueNode = nullptr; - for (IFDE_XMLNode* pXMLChild = - pXMLNode->GetNodeItem(IFDE_XMLNode::FirstChild); + CFDE_XMLNode* pXMLCurValueNode = nullptr; + for (CFDE_XMLNode* pXMLChild = + pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); pXMLChild; - pXMLChild = pXMLChild->GetNodeItem(IFDE_XMLNode::NextSibling)) { + pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) { FDE_XMLNODETYPE eNodeType = pXMLChild->GetType(); if (eNodeType == FDE_XMLNODE_Instruction) continue; CFX_WideString wsText; if (eNodeType == FDE_XMLNODE_Text) { - ((IFDE_XMLText*)pXMLChild)->GetText(wsText); + static_cast<CFDE_XMLText*>(pXMLChild)->GetText(wsText); if (!pXMLCurValueNode) pXMLCurValueNode = pXMLChild; wsCurValueTextBuf << wsText; } else if (eNodeType == FDE_XMLNODE_CharData) { - ((IFDE_XMLCharData*)pXMLChild)->GetCharData(wsText); + static_cast<CFDE_XMLCharData*>(pXMLChild)->GetCharData(wsText); if (!pXMLCurValueNode) pXMLCurValueNode = pXMLChild; wsCurValueTextBuf << wsText; - } else if (XFA_RecognizeRichText((IFDE_XMLElement*)pXMLChild)) { - XFA_GetPlainTextFromRichText((IFDE_XMLElement*)pXMLChild, wsText); + } else if (XFA_RecognizeRichText( + static_cast<CFDE_XMLElement*>(pXMLChild))) { + XFA_GetPlainTextFromRichText(static_cast<CFDE_XMLElement*>(pXMLChild), + wsText); if (!pXMLCurValueNode) pXMLCurValueNode = pXMLChild; @@ -1271,7 +1268,7 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode, return; CFX_WideString wsNodeStr; - ((IFDE_XMLElement*)pXMLChild)->GetLocalTagName(wsNodeStr); + static_cast<CFDE_XMLElement*>(pXMLChild)->GetLocalTagName(wsNodeStr); pXFAChild->SetCData(XFA_ATTRIBUTE_Name, wsNodeStr); ParseDataValue(pXFAChild, pXMLChild, ePacketID); pXFANode->InsertChild(pXFAChild); @@ -1306,7 +1303,7 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode, } void CXFA_SimpleParser::ParseInstruction(CXFA_Node* pXFANode, - IFDE_XMLInstruction* pXMLInstruction, + CFDE_XMLInstruction* pXMLInstruction, XFA_XDPPACKET ePacketID) { if (!m_bDocumentParser) { return; @@ -1372,7 +1369,7 @@ int32_t CXFA_DocumentParser::DoParse(IFX_Pause* pPause) { return nRetStatus; } int32_t CXFA_DocumentParser::ParseXMLData(const CFX_WideString& wsXML, - IFDE_XMLNode*& pXMLNode, + CFDE_XMLNode*& pXMLNode, IFX_Pause* pPause) { CloseParser(); int32_t nRetStatus = m_nodeParser.ParseXMLData(wsXML, pXMLNode, NULL); @@ -1383,7 +1380,7 @@ int32_t CXFA_DocumentParser::ParseXMLData(const CFX_WideString& wsXML, return nRetStatus; } void CXFA_DocumentParser::ConstructXFANode(CXFA_Node* pXFANode, - IFDE_XMLNode* pXMLNode) { + CFDE_XMLNode* pXMLNode) { if (!pXFANode || !pXMLNode) { return; } @@ -1400,7 +1397,7 @@ void CXFA_DocumentParser::CloseParser() { } m_nodeParser.CloseParser(); } -CXFA_XMLParser::CXFA_XMLParser(IFDE_XMLNode* pRoot, IFX_Stream* pStream) +CXFA_XMLParser::CXFA_XMLParser(CFDE_XMLNode* pRoot, IFX_Stream* pStream) : m_nElementStart(0), m_dwCheckStatus(0), m_dwCurrentCheckStatus(0), @@ -1413,7 +1410,7 @@ CXFA_XMLParser::CXFA_XMLParser(IFDE_XMLNode* pRoot, IFX_Stream* pStream) m_dwStatus(FDE_XMLSYNTAXSTATUS_None) { ASSERT(m_pParent && m_pStream); m_NodeStack.Push(m_pParent); - m_pParser = IFDE_XMLSyntaxParser::Create(); + m_pParser = new CFDE_XMLSyntaxParser; m_pParser->Init(m_pStream, 32 * 1024, 1024 * 1024); } CXFA_XMLParser::~CXFA_XMLParser() { @@ -1459,7 +1456,7 @@ int32_t CXFA_XMLParser::DoParser(IFX_Pause* pPause) { break; } m_pParser->GetTagName(m_ws1); - ((IFDE_XMLElement*)m_pChild)->GetTagName(m_ws2); + static_cast<CFDE_XMLElement*>(m_pChild)->GetTagName(m_ws2); if (m_ws1.GetLength() > 0 && !m_ws1.Equal(m_ws2)) { m_dwStatus = FDE_XMLSYNTAXSTATUS_Error; break; @@ -1475,7 +1472,7 @@ int32_t CXFA_XMLParser::DoParser(IFX_Pause* pPause) { m_dwCurrentCheckStatus = 0; } - m_pParent = (IFDE_XMLNode*)*m_NodeStack.GetTopElement(); + m_pParent = static_cast<CFDE_XMLNode*>(*m_NodeStack.GetTopElement()); m_pChild = m_pParent; iCount++; break; @@ -1483,7 +1480,7 @@ int32_t CXFA_XMLParser::DoParser(IFX_Pause* pPause) { m_pParser->GetTargetName(m_ws1); if (m_ws1 == FX_WSTRC(L"originalXFAVersion") || m_ws1 == FX_WSTRC(L"acrobat")) { - m_pChild = IFDE_XMLInstruction::Create(m_ws1); + m_pChild = new CFDE_XMLInstruction(m_ws1); m_pParent->InsertChildNode(m_pChild); } else { m_pChild = NULL; @@ -1492,14 +1489,14 @@ int32_t CXFA_XMLParser::DoParser(IFX_Pause* pPause) { break; case FDE_XMLSYNTAXSTATUS_TagName: m_pParser->GetTagName(m_ws1); - m_pChild = IFDE_XMLElement::Create(m_ws1); + m_pChild = new CFDE_XMLElement(m_ws1); m_pParent->InsertChildNode(m_pChild); m_NodeStack.Push(m_pChild); m_pParent = m_pChild; if (m_dwCheckStatus != 0x03 && m_NodeStack.GetSize() == 3) { CFX_WideString wsTag; - ((IFDE_XMLElement*)m_pChild)->GetLocalTagName(wsTag); + static_cast<CFDE_XMLElement*>(m_pChild)->GetLocalTagName(wsTag); if (wsTag == FX_WSTRC(L"template")) { m_dwCheckStatus |= 0x01; m_dwCurrentCheckStatus = 0x01; @@ -1520,20 +1517,20 @@ int32_t CXFA_XMLParser::DoParser(IFX_Pause* pPause) { if (m_pChild) { m_pParser->GetAttributeName(m_ws2); if (m_pChild->GetType() == FDE_XMLNODE_Element) { - ((IFDE_XMLElement*)m_pChild)->SetString(m_ws1, m_ws2); + static_cast<CFDE_XMLElement*>(m_pChild)->SetString(m_ws1, m_ws2); } } m_ws1.Empty(); break; case FDE_XMLSYNTAXSTATUS_Text: m_pParser->GetTextData(m_ws1); - m_pChild = IFDE_XMLText::Create(m_ws1); + m_pChild = new CFDE_XMLText(m_ws1); m_pParent->InsertChildNode(m_pChild); m_pChild = m_pParent; break; case FDE_XMLSYNTAXSTATUS_CData: m_pParser->GetTextData(m_ws1); - m_pChild = IFDE_XMLCharData::Create(m_ws1); + m_pChild = new CFDE_XMLCharData(m_ws1); m_pParent->InsertChildNode(m_pChild); m_pChild = m_pParent; break; @@ -1544,10 +1541,10 @@ int32_t CXFA_XMLParser::DoParser(IFX_Pause* pPause) { break; } if (!m_ws1.IsEmpty()) { - ((IFDE_XMLInstruction*)m_pChild)->AppendData(m_ws1); + static_cast<CFDE_XMLInstruction*>(m_pChild)->AppendData(m_ws1); } m_pParser->GetTargetData(m_ws1); - ((IFDE_XMLInstruction*)m_pChild)->AppendData(m_ws1); + static_cast<CFDE_XMLInstruction*>(m_pChild)->AppendData(m_ws1); } m_ws1.Empty(); break; diff --git a/xfa/fxfa/parser/xfa_parser_imp.h b/xfa/fxfa/parser/xfa_parser_imp.h index 6ef890857a..308de7e587 100644 --- a/xfa/fxfa/parser/xfa_parser_imp.h +++ b/xfa/fxfa/parser/xfa_parser_imp.h @@ -7,6 +7,7 @@ #ifndef XFA_FXFA_PARSER_XFA_PARSER_IMP_H_ #define XFA_FXFA_PARSER_XFA_PARSER_IMP_H_ +#include "xfa/fde/xml/fde_xml_imp.h" #include "xfa/fxfa/parser/xfa_parser.h" class CXFA_XMLParser; @@ -21,56 +22,56 @@ class CXFA_SimpleParser : public IXFA_Parser { XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP); virtual int32_t DoParse(IFX_Pause* pPause = NULL); virtual int32_t ParseXMLData(const CFX_WideString& wsXML, - IFDE_XMLNode*& pXMLNode, + CFDE_XMLNode*& pXMLNode, IFX_Pause* pPause = NULL); - virtual void ConstructXFANode(CXFA_Node* pXFANode, IFDE_XMLNode* pXMLNode); + virtual void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode); virtual IXFA_ObjFactory* GetFactory() const { return m_pFactory; } virtual CXFA_Node* GetRootNode() const { return m_pRootNode; } - virtual IFDE_XMLDoc* GetXMLDoc() const { return m_pXMLDoc; } + virtual CFDE_XMLDoc* GetXMLDoc() const { return m_pXMLDoc; } virtual void CloseParser(); protected: - CXFA_Node* ParseAsXDPPacket(IFDE_XMLNode* pXMLDocumentNode, + CXFA_Node* ParseAsXDPPacket(CFDE_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID); - CXFA_Node* ParseAsXDPPacket_XDP(IFDE_XMLNode* pXMLDocumentNode, + CXFA_Node* ParseAsXDPPacket_XDP(CFDE_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID); - CXFA_Node* ParseAsXDPPacket_Config(IFDE_XMLNode* pXMLDocumentNode, + CXFA_Node* ParseAsXDPPacket_Config(CFDE_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID); - CXFA_Node* ParseAsXDPPacket_TemplateForm(IFDE_XMLNode* pXMLDocumentNode, + CXFA_Node* ParseAsXDPPacket_TemplateForm(CFDE_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID); - CXFA_Node* ParseAsXDPPacket_Data(IFDE_XMLNode* pXMLDocumentNode, + CXFA_Node* ParseAsXDPPacket_Data(CFDE_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID); CXFA_Node* ParseAsXDPPacket_LocaleConnectionSourceSet( - IFDE_XMLNode* pXMLDocumentNode, + CFDE_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID); - CXFA_Node* ParseAsXDPPacket_Xdc(IFDE_XMLNode* pXMLDocumentNode, + CXFA_Node* ParseAsXDPPacket_Xdc(CFDE_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID); - CXFA_Node* ParseAsXDPPacket_User(IFDE_XMLNode* pXMLDocumentNode, + CXFA_Node* ParseAsXDPPacket_User(CFDE_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID); CXFA_Node* NormalLoader(CXFA_Node* pXFANode, - IFDE_XMLNode* pXMLDoc, + CFDE_XMLNode* pXMLDoc, XFA_XDPPACKET ePacketID, FX_BOOL bUseAttribute = TRUE); CXFA_Node* DataLoader(CXFA_Node* pXFANode, - IFDE_XMLNode* pXMLDoc, + CFDE_XMLNode* pXMLDoc, FX_BOOL bDoTransform); - CXFA_Node* UserPacketLoader(CXFA_Node* pXFANode, IFDE_XMLNode* pXMLDoc); + CXFA_Node* UserPacketLoader(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLDoc); void ParseContentNode(CXFA_Node* pXFANode, - IFDE_XMLNode* pXMLNode, + CFDE_XMLNode* pXMLNode, XFA_XDPPACKET ePacketID); void ParseDataValue(CXFA_Node* pXFANode, - IFDE_XMLNode* pXMLNode, + CFDE_XMLNode* pXMLNode, XFA_XDPPACKET ePacketID); void ParseDataGroup(CXFA_Node* pXFANode, - IFDE_XMLNode* pXMLNode, + CFDE_XMLNode* pXMLNode, XFA_XDPPACKET ePacketID); void ParseInstruction(CXFA_Node* pXFANode, - IFDE_XMLInstruction* pXMLInstruction, + CFDE_XMLInstruction* pXMLInstruction, XFA_XDPPACKET ePacketID); void SetFactory(IXFA_ObjFactory* pFactory); CXFA_XMLParser* m_pXMLParser; - IFDE_XMLDoc* m_pXMLDoc; + CFDE_XMLDoc* m_pXMLDoc; IFX_Stream* m_pStream; IFX_FileRead* m_pFileRead; IXFA_ObjFactory* m_pFactory; @@ -89,14 +90,14 @@ class CXFA_DocumentParser : public IXFA_DocParser { XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP); virtual int32_t DoParse(IFX_Pause* pPause = NULL); virtual int32_t ParseXMLData(const CFX_WideString& wsXML, - IFDE_XMLNode*& pXMLNode, + CFDE_XMLNode*& pXMLNode, IFX_Pause* pPause = NULL); - virtual void ConstructXFANode(CXFA_Node* pXFANode, IFDE_XMLNode* pXMLNode); + virtual void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode); virtual IXFA_ObjFactory* GetFactory() const { return m_nodeParser.GetFactory(); } virtual CXFA_Node* GetRootNode() const { return m_nodeParser.GetRootNode(); } - virtual IFDE_XMLDoc* GetXMLDoc() const { return m_nodeParser.GetXMLDoc(); } + virtual CFDE_XMLDoc* GetXMLDoc() const { return m_nodeParser.GetXMLDoc(); } virtual IXFA_Notify* GetNotify() const { return m_pNotify; } virtual CXFA_Document* GetDocument() const { return m_pDocument; } virtual void CloseParser(); @@ -106,11 +107,11 @@ class CXFA_DocumentParser : public IXFA_DocParser { IXFA_Notify* m_pNotify; CXFA_Document* m_pDocument; }; -typedef CFX_StackTemplate<IFDE_XMLNode*> CXFA_XMLNodeStack; +typedef CFX_StackTemplate<CFDE_XMLNode*> CXFA_XMLNodeStack; -class CXFA_XMLParser : public IFDE_XMLParser { +class CXFA_XMLParser : public CFDE_XMLParser { public: - CXFA_XMLParser(IFDE_XMLNode* pRoot, IFX_Stream* pStream); + CXFA_XMLParser(CFDE_XMLNode* pRoot, IFX_Stream* pStream); ~CXFA_XMLParser(); virtual void Release() { delete this; } @@ -123,12 +124,11 @@ class CXFA_XMLParser : public IFDE_XMLParser { uint16_t m_dwCurrentCheckStatus; protected: - IFDE_XMLNode* m_pRoot; + CFDE_XMLNode* m_pRoot; IFX_Stream* m_pStream; - IFDE_XMLSyntaxParser* m_pParser; - - IFDE_XMLNode* m_pParent; - IFDE_XMLNode* m_pChild; + CFDE_XMLSyntaxParser* m_pParser; + CFDE_XMLNode* m_pParent; + CFDE_XMLNode* m_pChild; CXFA_XMLNodeStack m_NodeStack; CFX_WideString m_ws1; CFX_WideString m_ws2; diff --git a/xfa/fxfa/parser/xfa_utils.h b/xfa/fxfa/parser/xfa_utils.h index 6cc17d97c0..9070b97e0e 100644 --- a/xfa/fxfa/parser/xfa_utils.h +++ b/xfa/fxfa/parser/xfa_utils.h @@ -10,10 +10,12 @@ #include "xfa/fde/xml/fde_xml.h" #include "xfa/include/fxfa/fxfa_basic.h" +class CFDE_XMLElement; +class CFDE_XMLNode; class CXFA_LocaleValue; FX_BOOL XFA_FDEExtension_ResolveNamespaceQualifier( - IFDE_XMLElement* pNode, + CFDE_XMLElement* pNode, const CFX_WideStringC& wsQualifier, CFX_WideString& wsNamespaceURI); template <class NodeType, class TraverseStrategy> @@ -200,8 +202,8 @@ FX_DOUBLE XFA_WideStringToDouble(const CFX_WideString& wsStringVal); FX_DOUBLE XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal); int32_t XFA_MapRotation(int32_t nRotation); -FX_BOOL XFA_RecognizeRichText(IFDE_XMLElement* pRichTextXMLNode); -void XFA_GetPlainTextFromRichText(IFDE_XMLNode* pXMLNode, +FX_BOOL XFA_RecognizeRichText(CFDE_XMLElement* pRichTextXMLNode); +void XFA_GetPlainTextFromRichText(CFDE_XMLNode* pXMLNode, CFX_WideString& wsPlainText); FX_BOOL XFA_FieldIsMultiListBox(CXFA_Node* pFieldNode); IFX_Stream* XFA_CreateWideTextRead(const CFX_WideString& wsBuffer); diff --git a/xfa/fxfa/parser/xfa_utils_imp.cpp b/xfa/fxfa/parser/xfa_utils_imp.cpp index 5e8881e192..6630d060d4 100644 --- a/xfa/fxfa/parser/xfa_utils_imp.cpp +++ b/xfa/fxfa/parser/xfa_utils_imp.cpp @@ -7,6 +7,7 @@ #include "xfa/fxfa/parser/xfa_utils.h" #include "core/fxcrt/include/fx_ext.h" +#include "xfa/fde/xml/fde_xml_imp.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_docdata.h" #include "xfa/fxfa/parser/xfa_doclayout.h" @@ -186,14 +187,14 @@ CXFA_LocaleValue XFA_GetLocaleValue(CXFA_WidgetData* pWidgetData) { return CXFA_LocaleValue(iVTType, pWidgetData->GetRawValue(), pWidgetData->GetNode()->GetDocument()->GetLocalMgr()); } -void XFA_GetPlainTextFromRichText(IFDE_XMLNode* pXMLNode, +void XFA_GetPlainTextFromRichText(CFDE_XMLNode* pXMLNode, CFX_WideString& wsPlainText) { if (pXMLNode == NULL) { return; } switch (pXMLNode->GetType()) { case FDE_XMLNODE_Element: { - IFDE_XMLElement* pXMLElement = (IFDE_XMLElement*)pXMLNode; + CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); CFX_WideString wsTag; pXMLElement->GetLocalTagName(wsTag); uint32_t uTag = FX_HashCode_String_GetW(wsTag, wsTag.GetLength(), TRUE); @@ -212,21 +213,21 @@ void XFA_GetPlainTextFromRichText(IFDE_XMLNode* pXMLNode, } break; case FDE_XMLNODE_Text: { CFX_WideString wsContent; - ((IFDE_XMLText*)pXMLNode)->GetText(wsContent); + static_cast<CFDE_XMLText*>(pXMLNode)->GetText(wsContent); wsPlainText += wsContent; } break; case FDE_XMLNODE_CharData: { CFX_WideString wsCharData; - ((IFDE_XMLCharData*)pXMLNode)->GetCharData(wsCharData); + static_cast<CFDE_XMLCharData*>(pXMLNode)->GetCharData(wsCharData); wsPlainText += wsCharData; } break; default: break; } - for (IFDE_XMLNode* pChildXML = - pXMLNode->GetNodeItem(IFDE_XMLNode::FirstChild); + for (CFDE_XMLNode* pChildXML = + pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); pChildXML; - pChildXML = pChildXML->GetNodeItem(IFDE_XMLNode::NextSibling)) { + pChildXML = pChildXML->GetNodeItem(CFDE_XMLNode::NextSibling)) { XFA_GetPlainTextFromRichText(pChildXML, wsPlainText); } } |