diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-04-19 09:19:57 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-19 13:33:07 +0000 |
commit | 0d86ecb08e1b2c204333b1f1f6b0b014e5b2971c (patch) | |
tree | f816429f8581c16a60773eb23385dc8e55729bac /xfa/fxfa | |
parent | 3b71d26f092ebc86ca9177fbbe89d83caa67ae1b (diff) | |
download | pdfium-0d86ecb08e1b2c204333b1f1f6b0b014e5b2971c.tar.xz |
Move fde XML parser to core
This CL moves the XML parser from FDE into FXCRT and renames to CFX_
from CFDE_.
Change-Id: I21a9590bf74daf5517df630d7e7a5de89da99ea4
Reviewed-on: https://pdfium-review.googlesource.com/4312
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'xfa/fxfa')
-rw-r--r-- | xfa/fxfa/app/cxfa_loadercontext.h | 4 | ||||
-rw-r--r-- | xfa/fxfa/app/cxfa_textlayout.cpp | 59 | ||||
-rw-r--r-- | xfa/fxfa/app/cxfa_textlayout.h | 8 | ||||
-rw-r--r-- | xfa/fxfa/app/cxfa_textparser.cpp | 35 | ||||
-rw-r--r-- | xfa/fxfa/app/cxfa_textparser.h | 18 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffwidgetacc.cpp | 16 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffdoc.cpp | 30 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_widgetacc.cpp | 10 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_dataexporter.cpp | 46 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_dataimporter.cpp | 6 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_document.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_document.h | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_document_parser.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_document_parser.h | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_node.cpp | 140 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_node.h | 10 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_simple_parser.cpp | 287 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_simple_parser.h | 48 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 28 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_utils.cpp | 26 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_utils.h | 10 |
21 files changed, 393 insertions, 402 deletions
diff --git a/xfa/fxfa/app/cxfa_loadercontext.h b/xfa/fxfa/app/cxfa_loadercontext.h index 16d9608bac..553252e200 100644 --- a/xfa/fxfa/app/cxfa_loadercontext.h +++ b/xfa/fxfa/app/cxfa_loadercontext.h @@ -13,7 +13,7 @@ #include "core/fxcrt/fx_system.h" #include "xfa/fde/css/cfde_csscomputedstyle.h" -class CFDE_XMLNode; +class CFX_XMLNode; class CXFA_Node; class CXFA_LoaderContext { @@ -30,7 +30,7 @@ class CXFA_LoaderContext { int32_t m_iLines; int32_t m_iTotalLines; uint32_t m_dwFlags; - CFDE_XMLNode* m_pXMLNode; + CFX_XMLNode* m_pXMLNode; CXFA_Node* m_pNode; CFX_RetainPtr<CFDE_CSSComputedStyle> m_pParentStyle; std::vector<float> m_lineHeights; diff --git a/xfa/fxfa/app/cxfa_textlayout.cpp b/xfa/fxfa/app/cxfa_textlayout.cpp index 880bdf4585..69f5f53db3 100644 --- a/xfa/fxfa/app/cxfa_textlayout.cpp +++ b/xfa/fxfa/app/cxfa_textlayout.cpp @@ -9,6 +9,9 @@ #include <algorithm> #include <utility> +#include "core/fxcrt/xml/cfx_xmlelement.h" +#include "core/fxcrt/xml/cfx_xmlnode.h" +#include "core/fxcrt/xml/cfx_xmltext.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" #include "xfa/fde/cfde_brush.h" @@ -17,9 +20,6 @@ #include "xfa/fde/cfde_renderdevice.h" #include "xfa/fde/css/cfde_csscomputedstyle.h" #include "xfa/fde/css/cfde_cssstyleselector.h" -#include "xfa/fde/xml/cfde_xmlelement.h" -#include "xfa/fde/xml/cfde_xmlnode.h" -#include "xfa/fde/xml/cfde_xmltext.h" #include "xfa/fxfa/app/cxfa_linkuserdata.h" #include "xfa/fxfa/app/cxfa_loadercontext.h" #include "xfa/fxfa/app/cxfa_pieceline.h" @@ -66,21 +66,20 @@ void CXFA_TextLayout::GetTextDataNode() { m_pTextDataNode = pNode; } -CFDE_XMLNode* CXFA_TextLayout::GetXMLContainerNode() { +CFX_XMLNode* CXFA_TextLayout::GetXMLContainerNode() { if (!m_bRichText) return nullptr; - CFDE_XMLNode* pXMLRoot = m_pTextDataNode->GetXMLMappingNode(); + CFX_XMLNode* pXMLRoot = m_pTextDataNode->GetXMLMappingNode(); if (!pXMLRoot) return nullptr; - CFDE_XMLNode* pXMLContainer = nullptr; - for (CFDE_XMLNode* pXMLChild = - pXMLRoot->GetNodeItem(CFDE_XMLNode::FirstChild); + CFX_XMLNode* pXMLContainer = nullptr; + for (CFX_XMLNode* pXMLChild = pXMLRoot->GetNodeItem(CFX_XMLNode::FirstChild); pXMLChild; - pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) { - if (pXMLChild->GetType() == FDE_XMLNODE_Element) { - CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLChild); + pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) { + if (pXMLChild->GetType() == FX_XMLNODE_Element) { + CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLChild); CFX_WideString wsTag = pXMLElement->GetLocalTagName(); if (wsTag == L"body" || wsTag == L"html") { pXMLContainer = pXMLChild; @@ -159,7 +158,7 @@ void CXFA_TextLayout::InitBreak(float fLineWidth) { void CXFA_TextLayout::InitBreak(CFDE_CSSComputedStyle* pStyle, FDE_CSSDisplay eDisplay, float fLineWidth, - CFDE_XMLNode* pXMLNode, + CFX_XMLNode* pXMLNode, CFDE_CSSComputedStyle* pParentStyle) { if (!pStyle) { InitBreak(fLineWidth); @@ -460,24 +459,24 @@ bool CXFA_TextLayout::Layout(int32_t iBlock) { m_pBreak->Reset(); if (m_bRichText) { - CFDE_XMLNode* pContainerNode = GetXMLContainerNode(); + CFX_XMLNode* pContainerNode = GetXMLContainerNode(); if (!pContainerNode) return true; - CFDE_XMLNode* pXMLNode = m_pLoader->m_pXMLNode; + CFX_XMLNode* pXMLNode = m_pLoader->m_pXMLNode; if (!pXMLNode) return true; - CFDE_XMLNode* pSaveXMLNode = m_pLoader->m_pXMLNode; + CFX_XMLNode* pSaveXMLNode = m_pLoader->m_pXMLNode; for (; pXMLNode; - pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) { + pXMLNode = pXMLNode->GetNodeItem(CFX_XMLNode::NextSibling)) { if (!LoadRichText(pXMLNode, szText, fLinePos, m_pLoader->m_pParentStyle, true, nullptr)) { break; } } while (!pXMLNode) { - pXMLNode = pSaveXMLNode->GetNodeItem(CFDE_XMLNode::Parent); + pXMLNode = pSaveXMLNode->GetNodeItem(CFX_XMLNode::Parent); if (pXMLNode == pContainerNode) break; if (!LoadRichText(pXMLNode, szText, fLinePos, m_pLoader->m_pParentStyle, @@ -485,11 +484,11 @@ bool CXFA_TextLayout::Layout(int32_t iBlock) { break; } pSaveXMLNode = pXMLNode; - pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling); + pXMLNode = pXMLNode->GetNodeItem(CFX_XMLNode::NextSibling); if (!pXMLNode) continue; for (; pXMLNode; - pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) { + pXMLNode = pXMLNode->GetNodeItem(CFX_XMLNode::NextSibling)) { if (!LoadRichText(pXMLNode, szText, fLinePos, m_pLoader->m_pParentStyle, true, nullptr)) { break; @@ -645,7 +644,7 @@ bool CXFA_TextLayout::Loader(const CFX_SizeF& szText, return true; if (m_bRichText) { - CFDE_XMLNode* pXMLContainer = GetXMLContainerNode(); + CFX_XMLNode* pXMLContainer = GetXMLContainerNode(); if (pXMLContainer) { if (!m_textParser.IsParsed()) m_textParser.DoParse(pXMLContainer, m_pTextProvider); @@ -694,7 +693,7 @@ void CXFA_TextLayout::LoadText(CXFA_Node* pNode, } bool CXFA_TextLayout::LoadRichText( - CFDE_XMLNode* pXMLNode, + CFX_XMLNode* pXMLNode, const CFX_SizeF& szText, float& fLinePos, const CFX_RetainPtr<CFDE_CSSComputedStyle>& pParentStyle, @@ -716,16 +715,16 @@ bool CXFA_TextLayout::LoadRichText( if (bEndBreak) { bool bCurOl = false; bool bCurLi = false; - CFDE_XMLElement* pElement = nullptr; + CFX_XMLElement* pElement = nullptr; if (pContext) { if (m_bBlockContinue || (m_pLoader && pXMLNode == m_pLoader->m_pXMLNode)) { m_bBlockContinue = true; } - if (pXMLNode->GetType() == FDE_XMLNODE_Text) { + if (pXMLNode->GetType() == FX_XMLNODE_Text) { bContentNode = true; - } else if (pXMLNode->GetType() == FDE_XMLNODE_Element) { - pElement = static_cast<CFDE_XMLElement*>(pXMLNode); + } else if (pXMLNode->GetType() == FX_XMLNODE_Element) { + pElement = static_cast<CFX_XMLElement*>(pXMLNode); wsName = pElement->GetLocalTagName(); } if (wsName == L"ol") { @@ -771,7 +770,7 @@ bool CXFA_TextLayout::LoadRichText( bContentNode ? pParentStyle.Get() : pStyle.Get()); CFX_WideString wsText; if (bContentNode && iTabCount == 0) { - wsText = static_cast<CFDE_XMLText*>(pXMLNode)->GetText(); + wsText = static_cast<CFX_XMLText*>(pXMLNode)->GetText(); } else if (wsName == L"br") { wsText = L'\n'; } else if (wsName == L"li") { @@ -834,10 +833,10 @@ bool CXFA_TextLayout::LoadRichText( } } - for (CFDE_XMLNode* pChildNode = - pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); + for (CFX_XMLNode* pChildNode = + pXMLNode->GetNodeItem(CFX_XMLNode::FirstChild); pChildNode; - pChildNode = pChildNode->GetNodeItem(CFDE_XMLNode::NextSibling)) { + pChildNode = pChildNode->GetNodeItem(CFX_XMLNode::NextSibling)) { if (bCurOl) iLiCount++; @@ -872,7 +871,7 @@ bool CXFA_TextLayout::LoadRichText( if (IsEnd(bSavePieces)) { if (m_pLoader && m_pLoader->m_iTotalLines > -1) { m_pLoader->m_pXMLNode = - pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling); + pXMLNode->GetNodeItem(CFX_XMLNode::NextSibling); m_pLoader->m_pParentStyle = pParentStyle; } return false; diff --git a/xfa/fxfa/app/cxfa_textlayout.h b/xfa/fxfa/app/cxfa_textlayout.h index 5bce1c9ab2..75c2d56324 100644 --- a/xfa/fxfa/app/cxfa_textlayout.h +++ b/xfa/fxfa/app/cxfa_textlayout.h @@ -21,7 +21,7 @@ class CFDE_Brush; class CFDE_CSSComputedStyle; class CFDE_Pen; class CFDE_RenderDevice; -class CFDE_XMLNode; +class CFX_XMLNode; class CFX_RTFBreak; class CXFA_LoaderContext; class CXFA_LinkUserData; @@ -64,13 +64,13 @@ class CXFA_TextLayout { private: void GetTextDataNode(); - CFDE_XMLNode* GetXMLContainerNode(); + CFX_XMLNode* GetXMLContainerNode(); std::unique_ptr<CFX_RTFBreak> CreateBreak(bool bDefault); void InitBreak(float fLineWidth); void InitBreak(CFDE_CSSComputedStyle* pStyle, FDE_CSSDisplay eDisplay, float fLineWidth, - CFDE_XMLNode* pXMLNode, + CFX_XMLNode* pXMLNode, CFDE_CSSComputedStyle* pParentStyle = nullptr); bool Loader(const CFX_SizeF& szText, float& fLinePos, @@ -79,7 +79,7 @@ class CXFA_TextLayout { const CFX_SizeF& szText, float& fLinePos, bool bSavePieces); - bool LoadRichText(CFDE_XMLNode* pXMLNode, + bool LoadRichText(CFX_XMLNode* pXMLNode, const CFX_SizeF& szText, float& fLinePos, const CFX_RetainPtr<CFDE_CSSComputedStyle>& pParentStyle, diff --git a/xfa/fxfa/app/cxfa_textparser.cpp b/xfa/fxfa/app/cxfa_textparser.cpp index 1243f5b7ea..33bd2b9deb 100644 --- a/xfa/fxfa/app/cxfa_textparser.cpp +++ b/xfa/fxfa/app/cxfa_textparser.cpp @@ -11,13 +11,13 @@ #include <vector> #include "core/fxcrt/fx_codepage.h" +#include "core/fxcrt/xml/cfx_xmlelement.h" +#include "core/fxcrt/xml/cfx_xmlnode.h" #include "third_party/base/ptr_util.h" #include "xfa/fde/css/cfde_csscomputedstyle.h" #include "xfa/fde/css/cfde_cssstyleselector.h" #include "xfa/fde/css/cfde_cssstylesheet.h" #include "xfa/fde/css/fde_css.h" -#include "xfa/fde/xml/cfde_xmlelement.h" -#include "xfa/fde/xml/cfde_xmlnode.h" #include "xfa/fgas/font/cfgas_fontmgr.h" #include "xfa/fxfa/app/cxfa_csstagprovider.h" #include "xfa/fxfa/app/cxfa_textparsecontext.h" @@ -175,7 +175,7 @@ CFX_RetainPtr<CFDE_CSSComputedStyle> CXFA_TextParser::CreateStyle( } CFX_RetainPtr<CFDE_CSSComputedStyle> CXFA_TextParser::ComputeStyle( - CFDE_XMLNode* pXMLNode, + CFX_XMLNode* pXMLNode, CFDE_CSSComputedStyle* pParentStyle) { auto it = m_mapXMLNodeToParseContext.find(pXMLNode); if (it == m_mapXMLNodeToParseContext.end()) @@ -198,7 +198,7 @@ CFX_RetainPtr<CFDE_CSSComputedStyle> CXFA_TextParser::ComputeStyle( return pStyle; } -void CXFA_TextParser::DoParse(CFDE_XMLNode* pXMLContainer, +void CXFA_TextParser::DoParse(CFX_XMLNode* pXMLContainer, CXFA_TextProvider* pTextProvider) { if (!pXMLContainer || !pTextProvider || m_bParsed) return; @@ -209,7 +209,7 @@ void CXFA_TextParser::DoParse(CFDE_XMLNode* pXMLContainer, ParseRichText(pXMLContainer, pRootStyle.Get()); } -void CXFA_TextParser::ParseRichText(CFDE_XMLNode* pXMLNode, +void CXFA_TextParser::ParseRichText(CFX_XMLNode* pXMLNode, CFDE_CSSComputedStyle* pParentStyle) { if (!pXMLNode) return; @@ -240,10 +240,9 @@ void CXFA_TextParser::ParseRichText(CFDE_XMLNode* pXMLNode, m_mapXMLNodeToParseContext[pXMLNode] = std::move(pTextContext); } - for (CFDE_XMLNode* pXMLChild = - pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); + for (CFX_XMLNode* pXMLChild = pXMLNode->GetNodeItem(CFX_XMLNode::FirstChild); pXMLChild; - pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) { + pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) { ParseRichText(pXMLChild, pNewStyle.Get()); } } @@ -271,12 +270,12 @@ bool CXFA_TextParser::TagValidate(const CFX_WideString& wsName) const { } std::unique_ptr<CXFA_CSSTagProvider> CXFA_TextParser::ParseTagInfo( - CFDE_XMLNode* pXMLNode) { + CFX_XMLNode* pXMLNode) { auto tagProvider = pdfium::MakeUnique<CXFA_CSSTagProvider>(); CFX_WideString wsName; - if (pXMLNode->GetType() == FDE_XMLNODE_Element) { - CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); + if (pXMLNode->GetType() == FX_XMLNODE_Element) { + CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLNode); wsName = pXMLElement->GetLocalTagName(); tagProvider->SetTagName(wsName); tagProvider->m_bTagAvailable = TagValidate(wsName); @@ -284,7 +283,7 @@ std::unique_ptr<CXFA_CSSTagProvider> CXFA_TextParser::ParseTagInfo( CFX_WideString wsValue = pXMLElement->GetString(L"style"); if (!wsValue.IsEmpty()) tagProvider->SetAttribute(L"style", wsValue); - } else if (pXMLNode->GetType() == FDE_XMLNODE_Text) { + } else if (pXMLNode->GetType() == FX_XMLNODE_Text) { tagProvider->m_bTagAvailable = true; tagProvider->m_bContent = true; } @@ -363,7 +362,7 @@ float CXFA_TextParser::GetFontSize(CXFA_TextProvider* pTextProvider, int32_t CXFA_TextParser::GetHorScale(CXFA_TextProvider* pTextProvider, CFDE_CSSComputedStyle* pStyle, - CFDE_XMLNode* pXMLNode) const { + CFX_XMLNode* pXMLNode) const { if (pStyle) { CFX_WideString wsValue; if (pStyle->GetCustomStyle(L"xfa-font-horizontal-scale", wsValue)) @@ -379,7 +378,7 @@ int32_t CXFA_TextParser::GetHorScale(CXFA_TextProvider* pTextProvider, return wsValue.GetInteger(); } } - pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::Parent); + pXMLNode = pXMLNode->GetNodeItem(CFX_XMLNode::Parent); } } @@ -490,15 +489,15 @@ float CXFA_TextParser::GetLineHeight(CXFA_TextProvider* pTextProvider, } bool CXFA_TextParser::GetEmbbedObj(CXFA_TextProvider* pTextProvider, - CFDE_XMLNode* pXMLNode, + CFX_XMLNode* pXMLNode, CFX_WideString& wsValue) { wsValue.clear(); if (!pXMLNode) return false; bool bRet = false; - if (pXMLNode->GetType() == FDE_XMLNODE_Element) { - CFDE_XMLElement* pElement = static_cast<CFDE_XMLElement*>(pXMLNode); + if (pXMLNode->GetType() == FX_XMLNODE_Element) { + CFX_XMLElement* pElement = static_cast<CFX_XMLElement*>(pXMLNode); CFX_WideString wsAttr = pElement->GetString(L"xfa:embed"); if (wsAttr.IsEmpty()) return false; @@ -531,7 +530,7 @@ bool CXFA_TextParser::GetEmbbedObj(CXFA_TextProvider* pTextProvider, } CXFA_TextParseContext* CXFA_TextParser::GetParseContextFromMap( - CFDE_XMLNode* pXMLNode) { + CFX_XMLNode* pXMLNode) { auto it = m_mapXMLNodeToParseContext.find(pXMLNode); return it != m_mapXMLNodeToParseContext.end() ? it->second.get() : nullptr; } diff --git a/xfa/fxfa/app/cxfa_textparser.h b/xfa/fxfa/app/cxfa_textparser.h index 29f03a8dea..04bd51fafe 100644 --- a/xfa/fxfa/app/cxfa_textparser.h +++ b/xfa/fxfa/app/cxfa_textparser.h @@ -19,7 +19,7 @@ class CFDE_CSSComputedStyle; class CFDE_CSSStyleSelector; class CFDE_CSSStyleSheet; -class CFDE_XMLNode; +class CFX_XMLNode; class CXFA_CSSTagProvider; class CXFA_TextParseContext; class CXFA_TextProvider; @@ -31,12 +31,12 @@ class CXFA_TextParser { virtual ~CXFA_TextParser(); void Reset(); - void DoParse(CFDE_XMLNode* pXMLContainer, CXFA_TextProvider* pTextProvider); + void DoParse(CFX_XMLNode* pXMLContainer, CXFA_TextProvider* pTextProvider); CFX_RetainPtr<CFDE_CSSComputedStyle> CreateRootStyle( CXFA_TextProvider* pTextProvider); CFX_RetainPtr<CFDE_CSSComputedStyle> ComputeStyle( - CFDE_XMLNode* pXMLNode, + CFX_XMLNode* pXMLNode, CFDE_CSSComputedStyle* pParentStyle); bool IsParsed() const { return m_bParsed; } @@ -57,7 +57,7 @@ class CXFA_TextParser { int32_t GetHorScale(CXFA_TextProvider* pTextProvider, CFDE_CSSComputedStyle* pStyle, - CFDE_XMLNode* pXMLNode) const; + CFX_XMLNode* pXMLNode) const; int32_t GetVerScale(CXFA_TextProvider* pTextProvider, CFDE_CSSComputedStyle* pStyle) const; @@ -78,18 +78,18 @@ class CXFA_TextParser { float fVerScale) const; bool GetEmbbedObj(CXFA_TextProvider* pTextProvider, - CFDE_XMLNode* pXMLNode, + CFX_XMLNode* pXMLNode, CFX_WideString& wsValue); - CXFA_TextParseContext* GetParseContextFromMap(CFDE_XMLNode* pXMLNode); + CXFA_TextParseContext* GetParseContextFromMap(CFX_XMLNode* pXMLNode); protected: bool TagValidate(const CFX_WideString& str) const; private: void InitCSSData(CXFA_TextProvider* pTextProvider); - void ParseRichText(CFDE_XMLNode* pXMLNode, + void ParseRichText(CFX_XMLNode* pXMLNode, CFDE_CSSComputedStyle* pParentStyle); - std::unique_ptr<CXFA_CSSTagProvider> ParseTagInfo(CFDE_XMLNode* pXMLNode); + std::unique_ptr<CXFA_CSSTagProvider> ParseTagInfo(CFX_XMLNode* pXMLNode); std::unique_ptr<CFDE_CSSStyleSheet> LoadDefaultSheetStyle(); CFX_RetainPtr<CFDE_CSSComputedStyle> CreateStyle( CFDE_CSSComputedStyle* pParentStyle); @@ -97,7 +97,7 @@ class CXFA_TextParser { bool m_bParsed; bool m_cssInitialized; std::unique_ptr<CFDE_CSSStyleSelector> m_pSelector; - std::map<CFDE_XMLNode*, std::unique_ptr<CXFA_TextParseContext>> + std::map<CFX_XMLNode*, std::unique_ptr<CXFA_TextParseContext>> m_mapXMLNodeToParseContext; }; diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp index 760def2759..7f53027e5c 100644 --- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp +++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp @@ -10,12 +10,12 @@ #include <memory> #include <vector> +#include "core/fxcrt/xml/cfx_xmlelement.h" +#include "core/fxcrt/xml/cfx_xmlnode.h" #include "fxjs/cfxjse_value.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" #include "xfa/fde/cfde_textout.h" -#include "xfa/fde/xml/cfde_xmlelement.h" -#include "xfa/fde/xml/cfde_xmlnode.h" #include "xfa/fxfa/app/xfa_ffcheckbutton.h" #include "xfa/fxfa/app/xfa_ffchoicelist.h" #include "xfa/fxfa/app/xfa_fffield.h" @@ -63,14 +63,14 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) { return pChildNode; } else if (m_eType == XFA_TEXTPROVIDERTYPE_Datasets) { CXFA_Node* pBind = m_pWidgetAcc->GetDatasets(); - CFDE_XMLNode* pXMLNode = pBind->GetXMLMappingNode(); + CFX_XMLNode* pXMLNode = pBind->GetXMLMappingNode(); ASSERT(pXMLNode); - for (CFDE_XMLNode* pXMLChild = - pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); + for (CFX_XMLNode* pXMLChild = + pXMLNode->GetNodeItem(CFX_XMLNode::FirstChild); pXMLChild; - pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) { - if (pXMLChild->GetType() == FDE_XMLNODE_Element) { - CFDE_XMLElement* pElement = static_cast<CFDE_XMLElement*>(pXMLChild); + pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) { + if (pXMLChild->GetType() == FX_XMLNODE_Element) { + CFX_XMLElement* pElement = static_cast<CFX_XMLElement*>(pXMLChild); if (XFA_RecognizeRichText(pElement)) { bRichText = true; } diff --git a/xfa/fxfa/cxfa_ffdoc.cpp b/xfa/fxfa/cxfa_ffdoc.cpp index 3565370bde..04741f9082 100644 --- a/xfa/fxfa/cxfa_ffdoc.cpp +++ b/xfa/fxfa/cxfa_ffdoc.cpp @@ -17,9 +17,9 @@ #include "core/fxcrt/cfx_checksumcontext.h" #include "core/fxcrt/fx_ext.h" #include "core/fxcrt/fx_memory.h" +#include "core/fxcrt/xml/cfx_xmlelement.h" +#include "core/fxcrt/xml/cfx_xmlnode.h" #include "third_party/base/ptr_util.h" -#include "xfa/fde/xml/cfde_xmlelement.h" -#include "xfa/fde/xml/cfde_xmlnode.h" #include "xfa/fwl/cfwl_notedriver.h" #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/cxfa_ffapp.h" @@ -171,15 +171,15 @@ int32_t CXFA_FFDoc::StartLoad() { return m_pDocumentParser->StartParse(m_pStream, XFA_XDPPACKET_XDP); } -bool XFA_GetPDFContentsFromPDFXML(CFDE_XMLNode* pPDFElement, +bool XFA_GetPDFContentsFromPDFXML(CFX_XMLNode* pPDFElement, uint8_t*& pByteBuffer, int32_t& iBufferSize) { - CFDE_XMLElement* pDocumentElement = nullptr; - for (CFDE_XMLNode* pXMLNode = - pPDFElement->GetNodeItem(CFDE_XMLNode::FirstChild); - pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) { - if (pXMLNode->GetType() == FDE_XMLNODE_Element) { - CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); + CFX_XMLElement* pDocumentElement = nullptr; + for (CFX_XMLNode* pXMLNode = + pPDFElement->GetNodeItem(CFX_XMLNode::FirstChild); + pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFX_XMLNode::NextSibling)) { + if (pXMLNode->GetType() == FX_XMLNODE_Element) { + CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLNode); CFX_WideString wsTagName = pXMLElement->GetName(); if (wsTagName == L"document") { pDocumentElement = pXMLElement; @@ -190,12 +190,12 @@ bool XFA_GetPDFContentsFromPDFXML(CFDE_XMLNode* pPDFElement, if (!pDocumentElement) { return false; } - CFDE_XMLElement* pChunkElement = nullptr; - for (CFDE_XMLNode* pXMLNode = - pDocumentElement->GetNodeItem(CFDE_XMLNode::FirstChild); - pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) { - if (pXMLNode->GetType() == FDE_XMLNODE_Element) { - CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); + CFX_XMLElement* pChunkElement = nullptr; + for (CFX_XMLNode* pXMLNode = + pDocumentElement->GetNodeItem(CFX_XMLNode::FirstChild); + pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFX_XMLNode::NextSibling)) { + if (pXMLNode->GetType() == FX_XMLNODE_Element) { + CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLNode); CFX_WideString wsTagName = pXMLElement->GetName(); if (wsTagName == L"chunk") { pChunkElement = pXMLElement; diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp index be7556ee24..ad8f4bf5fa 100644 --- a/xfa/fxfa/cxfa_widgetacc.cpp +++ b/xfa/fxfa/cxfa_widgetacc.cpp @@ -9,10 +9,10 @@ #include <algorithm> #include <vector> +#include "core/fxcrt/xml/cfx_xmlelement.h" +#include "core/fxcrt/xml/cfx_xmlnode.h" #include "third_party/base/stl_util.h" #include "xfa/fde/cfde_textout.h" -#include "xfa/fde/xml/cfde_xmlelement.h" -#include "xfa/fde/xml/cfde_xmlnode.h" #include "xfa/fxfa/app/cxfa_textlayout.h" #include "xfa/fxfa/app/xfa_ffwidgetacc.h" #include "xfa/fxfa/cxfa_ffapp.h" @@ -265,9 +265,9 @@ void CXFA_WidgetAcc::SetImageEdit(const CFX_WideString& wsContentType, if (pHrefNode) { pHrefNode->SetCData(XFA_ATTRIBUTE_Value, wsHref); } else { - CFDE_XMLNode* pXMLNode = pBind->GetXMLMappingNode(); - ASSERT(pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element); - static_cast<CFDE_XMLElement*>(pXMLNode)->SetString(L"href", wsHref); + CFX_XMLNode* pXMLNode = pBind->GetXMLMappingNode(); + ASSERT(pXMLNode && pXMLNode->GetType() == FX_XMLNODE_Element); + static_cast<CFX_XMLElement*>(pXMLNode)->SetString(L"href", wsHref); } } diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp index c1eda8d9e6..0c702fe53c 100644 --- a/xfa/fxfa/parser/cxfa_dataexporter.cpp +++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp @@ -10,10 +10,10 @@ #include "core/fxcrt/fx_basic.h" #include "core/fxcrt/fx_codepage.h" +#include "core/fxcrt/xml/cfx_xmldoc.h" +#include "core/fxcrt/xml/cfx_xmlelement.h" +#include "core/fxcrt/xml/cfx_xmlnode.h" #include "third_party/base/stl_util.h" -#include "xfa/fde/xml/cfde_xmldoc.h" -#include "xfa/fde/xml/cfde_xmlelement.h" -#include "xfa/fde/xml/cfde_xmlnode.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_widgetdata.h" @@ -215,12 +215,12 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, pNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, false); if (pRawValueNode->GetElementType() == XFA_Element::SharpxHTML && wsContentType == L"text/html") { - CFDE_XMLNode* pExDataXML = pNode->GetXMLMappingNode(); + CFX_XMLNode* pExDataXML = pNode->GetXMLMappingNode(); if (!pExDataXML) break; - CFDE_XMLNode* pRichTextXML = - pExDataXML->GetNodeItem(CFDE_XMLNode::FirstChild); + CFX_XMLNode* pRichTextXML = + pExDataXML->GetNodeItem(CFX_XMLNode::FirstChild); if (!pRichTextXML) break; @@ -454,19 +454,19 @@ void XFA_DataExporter_DealWithDataGroupNode(CXFA_Node* pDataNode) { return; if (iChildNum > 0) { - CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); - ASSERT(pXMLNode->GetType() == FDE_XMLNODE_Element); - CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); + CFX_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); + ASSERT(pXMLNode->GetType() == FX_XMLNODE_Element); + CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLNode); if (pXMLElement->HasAttribute(L"xfa:dataNode")) pXMLElement->RemoveAttribute(L"xfa:dataNode"); return; } - CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); - ASSERT(pXMLNode->GetType() == FDE_XMLNODE_Element); - static_cast<CFDE_XMLElement*>(pXMLNode)->SetString(L"xfa:dataNode", - L"dataGroup"); + CFX_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); + ASSERT(pXMLNode->GetType() == FX_XMLNODE_Element); + static_cast<CFX_XMLElement*>(pXMLNode)->SetString(L"xfa:dataNode", + L"dataGroup"); } CXFA_DataExporter::CXFA_DataExporter(CXFA_Document* pDocument) @@ -497,7 +497,7 @@ bool CXFA_DataExporter::Export( CXFA_Node* pNode, uint32_t dwFlag, const char* pChecksum) { - CFDE_XMLDoc* pXMLDoc = m_pDocument->GetXMLDoc(); + CFX_XMLDoc* pXMLDoc = m_pDocument->GetXMLDoc(); if (pNode->IsModelNode()) { switch (pNode->GetPacketID()) { case XFA_XDPPACKET_XDP: { @@ -511,9 +511,9 @@ bool CXFA_DataExporter::Export( break; } case XFA_XDPPACKET_Datasets: { - CFDE_XMLElement* pElement = - static_cast<CFDE_XMLElement*>(pNode->GetXMLMappingNode()); - if (!pElement || pElement->GetType() != FDE_XMLNODE_Element) + CFX_XMLElement* pElement = + static_cast<CFX_XMLElement*>(pNode->GetXMLMappingNode()); + if (!pElement || pElement->GetType() != FX_XMLNODE_Element) return false; CXFA_Node* pDataNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); @@ -528,9 +528,9 @@ bool CXFA_DataExporter::Export( } case XFA_XDPPACKET_Template: default: { - CFDE_XMLElement* pElement = - static_cast<CFDE_XMLElement*>(pNode->GetXMLMappingNode()); - if (!pElement || pElement->GetType() != FDE_XMLNODE_Element) + CFX_XMLElement* pElement = + static_cast<CFX_XMLElement*>(pNode->GetXMLMappingNode()); + if (!pElement || pElement->GetType() != FX_XMLNODE_Element) return false; pXMLDoc->SaveXMLNode(pStream, pElement); @@ -550,9 +550,9 @@ bool CXFA_DataExporter::Export( break; } } - CFDE_XMLElement* pElement = - static_cast<CFDE_XMLElement*>(pExportNode->GetXMLMappingNode()); - if (!pElement || pElement->GetType() != FDE_XMLNODE_Element) + CFX_XMLElement* pElement = + static_cast<CFX_XMLElement*>(pExportNode->GetXMLMappingNode()); + if (!pElement || pElement->GetType() != FX_XMLNODE_Element) return false; XFA_DataExporter_DealWithDataGroupNode(pExportNode); diff --git a/xfa/fxfa/parser/cxfa_dataimporter.cpp b/xfa/fxfa/parser/cxfa_dataimporter.cpp index d87d0914e4..cb5a42c428 100644 --- a/xfa/fxfa/parser/cxfa_dataimporter.cpp +++ b/xfa/fxfa/parser/cxfa_dataimporter.cpp @@ -9,8 +9,8 @@ #include <memory> #include "core/fxcrt/fx_stream.h" +#include "core/fxcrt/xml/cfx_xmlnode.h" #include "third_party/base/ptr_util.h" -#include "xfa/fde/xml/cfde_xmlnode.h" #include "xfa/fxfa/fxfa.h" #include "xfa/fxfa/fxfa_basic.h" #include "xfa/fxfa/parser/cxfa_document.h" @@ -53,8 +53,8 @@ bool CXFA_DataImporter::ImportData( pDataModel->InsertChild(pChildNode); } } else { - CFDE_XMLNode* pXMLNode = pImportDataRoot->GetXMLMappingNode(); - CFDE_XMLNode* pParentXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::Parent); + CFX_XMLNode* pXMLNode = pImportDataRoot->GetXMLMappingNode(); + CFX_XMLNode* pParentXMLNode = pXMLNode->GetNodeItem(CFX_XMLNode::Parent); if (pParentXMLNode) pParentXMLNode->RemoveChildNode(pXMLNode); pDataModel->InsertChild(pImportDataRoot); diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp index 7c979fec22..8e39dafa84 100644 --- a/xfa/fxfa/parser/cxfa_document.cpp +++ b/xfa/fxfa/parser/cxfa_document.cpp @@ -127,7 +127,7 @@ void CXFA_Document::SetRoot(CXFA_Node* pNewRoot) { RemovePurgeNode(pNewRoot); } -CFDE_XMLDoc* CXFA_Document::GetXMLDoc() const { +CFX_XMLDoc* CXFA_Document::GetXMLDoc() const { return m_pParser->GetXMLDoc(); } diff --git a/xfa/fxfa/parser/cxfa_document.h b/xfa/fxfa/parser/cxfa_document.h index 101b23332e..03586b6591 100644 --- a/xfa/fxfa/parser/cxfa_document.h +++ b/xfa/fxfa/parser/cxfa_document.h @@ -40,7 +40,7 @@ enum XFA_DocFlag { XFA_DOCFLAG_Scripting = 0x0008 }; -class CFDE_XMLDoc; +class CFX_XMLDoc; class CScript_DataWindow; class CScript_EventPseudoModel; class CScript_HostPseudoModel; @@ -66,7 +66,7 @@ class CXFA_Document { CXFA_Node* GetRoot() const { return m_pRootNode; } - CFDE_XMLDoc* GetXMLDoc() const; + CFX_XMLDoc* GetXMLDoc() const; CXFA_FFNotify* GetNotify() const; CXFA_LocaleMgr* GetLocalMgr(); CXFA_Object* GetXFAObject(XFA_HashCode wsNodeNameHash); diff --git a/xfa/fxfa/parser/cxfa_document_parser.cpp b/xfa/fxfa/parser/cxfa_document_parser.cpp index a6860d6b52..eb7cadc01c 100644 --- a/xfa/fxfa/parser/cxfa_document_parser.cpp +++ b/xfa/fxfa/parser/cxfa_document_parser.cpp @@ -6,8 +6,8 @@ #include "xfa/fxfa/parser/cxfa_document_parser.h" +#include "core/fxcrt/xml/cfx_xmldoc.h" #include "third_party/base/ptr_util.h" -#include "xfa/fde/xml/cfde_xmldoc.h" #include "xfa/fxfa/fxfa.h" #include "xfa/fxfa/parser/cxfa_document.h" @@ -40,7 +40,7 @@ int32_t CXFA_DocumentParser::DoParse(IFX_Pause* pPause) { return nRetStatus; } -CFDE_XMLDoc* CXFA_DocumentParser::GetXMLDoc() const { +CFX_XMLDoc* CXFA_DocumentParser::GetXMLDoc() const { return m_nodeParser.GetXMLDoc(); } diff --git a/xfa/fxfa/parser/cxfa_document_parser.h b/xfa/fxfa/parser/cxfa_document_parser.h index 90bd47f829..d876244e35 100644 --- a/xfa/fxfa/parser/cxfa_document_parser.h +++ b/xfa/fxfa/parser/cxfa_document_parser.h @@ -11,7 +11,7 @@ #include "xfa/fxfa/parser/cxfa_simple_parser.h" -class CFDE_XMLDoc; +class CFX_XMLDoc; class CXFA_Document; class CXFA_FFNotify; class CXFA_Notify; @@ -27,7 +27,7 @@ class CXFA_DocumentParser { XFA_XDPPACKET ePacketID); int32_t DoParse(IFX_Pause* pPause); - CFDE_XMLDoc* GetXMLDoc() const; + CFX_XMLDoc* GetXMLDoc() const; CXFA_FFNotify* GetNotify() const; CXFA_Document* GetDocument() const; diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index 83c05d1269..ce45ae10db 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -15,12 +15,12 @@ #include "core/fxcrt/cfx_decimal.h" #include "core/fxcrt/fx_codepage.h" #include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/xml/cfx_xmlelement.h" +#include "core/fxcrt/xml/cfx_xmlnode.h" +#include "core/fxcrt/xml/cfx_xmltext.h" #include "fxjs/cfxjse_value.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" -#include "xfa/fde/xml/cfde_xmlelement.h" -#include "xfa/fde/xml/cfde_xmlnode.h" -#include "xfa/fde/xml/cfde_xmltext.h" #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/cxfa_eventparam.h" #include "xfa/fxfa/cxfa_ffwidget.h" @@ -517,11 +517,11 @@ CXFA_Node* CXFA_Node::Clone(bool bRecursive) { MergeAllData(pClone); pClone->UpdateNameHash(); if (IsNeedSavingXMLNode()) { - std::unique_ptr<CFDE_XMLNode> pCloneXML; + std::unique_ptr<CFX_XMLNode> pCloneXML; if (IsAttributeInXML()) { CFX_WideString wsName; GetAttribute(XFA_ATTRIBUTE_Name, wsName, false); - auto pCloneXMLElement = pdfium::MakeUnique<CFDE_XMLElement>(wsName); + auto pCloneXMLElement = pdfium::MakeUnique<CFX_XMLElement>(wsName); CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value); if (!wsValue.IsEmpty()) { pCloneXMLElement->SetTextData(CFX_WideString(wsValue)); @@ -1284,12 +1284,12 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) { auto pParser = pdfium::MakeUnique<CXFA_SimpleParser>(m_pDocument, false); if (!pParser) return; - CFDE_XMLNode* pXMLNode = pParser->ParseXMLData(wsExpression, nullptr); + CFX_XMLNode* pXMLNode = pParser->ParseXMLData(wsExpression, nullptr); if (!pXMLNode) return; if (bIgnoreRoot && - (pXMLNode->GetType() != FDE_XMLNODE_Element || - XFA_RecognizeRichText(static_cast<CFDE_XMLElement*>(pXMLNode)))) { + (pXMLNode->GetType() != FX_XMLNODE_Element || + XFA_RecognizeRichText(static_cast<CFX_XMLElement*>(pXMLNode)))) { bIgnoreRoot = false; } CXFA_Node* pFakeRoot = Clone(false); @@ -1299,27 +1299,27 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) { CFX_WideString(wsContentType)); } - std::unique_ptr<CFDE_XMLNode> pFakeXMLRoot(pFakeRoot->GetXMLMappingNode()); + std::unique_ptr<CFX_XMLNode> pFakeXMLRoot(pFakeRoot->GetXMLMappingNode()); if (!pFakeXMLRoot) { - CFDE_XMLNode* pThisXMLRoot = GetXMLMappingNode(); + CFX_XMLNode* pThisXMLRoot = GetXMLMappingNode(); pFakeXMLRoot = pThisXMLRoot ? pThisXMLRoot->Clone() : nullptr; } if (!pFakeXMLRoot) { pFakeXMLRoot = - pdfium::MakeUnique<CFDE_XMLElement>(CFX_WideString(GetClassName())); + pdfium::MakeUnique<CFX_XMLElement>(CFX_WideString(GetClassName())); } if (bIgnoreRoot) { - CFDE_XMLNode* pXMLChild = pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); + CFX_XMLNode* pXMLChild = pXMLNode->GetNodeItem(CFX_XMLNode::FirstChild); while (pXMLChild) { - CFDE_XMLNode* pXMLSibling = - pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling); + CFX_XMLNode* pXMLSibling = + pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling); pXMLNode->RemoveChildNode(pXMLChild); pFakeXMLRoot->InsertChildNode(pXMLChild); pXMLChild = pXMLSibling; } } else { - CFDE_XMLNode* pXMLParent = pXMLNode->GetNodeItem(CFDE_XMLNode::Parent); + CFX_XMLNode* pXMLParent = pXMLNode->GetNodeItem(CFX_XMLNode::Parent); if (pXMLParent) { pXMLParent->RemoveChildNode(pXMLNode); } @@ -1349,10 +1349,10 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) { } if (GetPacketID() == XFA_XDPPACKET_Form && GetElementType() == XFA_Element::ExData) { - CFDE_XMLNode* pTempXMLNode = GetXMLMappingNode(); + CFX_XMLNode* pTempXMLNode = GetXMLMappingNode(); SetXMLMappingNode(pFakeXMLRoot.release()); SetFlag(XFA_NodeFlag_OwnXMLNode, false); - if (pTempXMLNode && !pTempXMLNode->GetNodeItem(CFDE_XMLNode::Parent)) + if (pTempXMLNode && !pTempXMLNode->GetNodeItem(CFX_XMLNode::Parent)) pFakeXMLRoot.reset(pTempXMLNode); else pFakeXMLRoot = nullptr; @@ -1396,10 +1396,10 @@ void CXFA_Node::Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments) { CFX_WideString bsXMLHeader = L"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; if (GetPacketID() == XFA_XDPPACKET_Form || GetPacketID() == XFA_XDPPACKET_Datasets) { - CFDE_XMLNode* pElement = nullptr; + CFX_XMLNode* pElement = nullptr; if (GetPacketID() == XFA_XDPPACKET_Datasets) { pElement = GetXMLMappingNode(); - if (!pElement || pElement->GetType() != FDE_XMLNODE_Element) { + if (!pElement || pElement->GetType() != FX_XMLNODE_Element) { pArguments->GetReturnValue()->SetString( bsXMLHeader.UTF8Encode().AsStringC()); return; @@ -3366,9 +3366,9 @@ void CXFA_Node::Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments) { } CFX_ByteString bsAttributeName = pArguments->GetUTF8String(0); CFX_WideString wsAttributeValue; - CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); - if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { - wsAttributeValue = static_cast<CFDE_XMLElement*>(pXMLNode)->GetString( + CFX_XMLNode* pXMLNode = GetXMLMappingNode(); + if (pXMLNode && pXMLNode->GetType() == FX_XMLNODE_Element) { + wsAttributeValue = static_cast<CFX_XMLElement*>(pXMLNode)->GetString( CFX_WideString::FromUTF8(bsAttributeName.AsStringC()).c_str()); } pArguments->GetReturnValue()->SetString( @@ -3382,9 +3382,9 @@ void CXFA_Node::Script_Packet_SetAttribute(CFXJSE_Arguments* pArguments) { } CFX_ByteString bsValue = pArguments->GetUTF8String(0); CFX_ByteString bsName = pArguments->GetUTF8String(1); - CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); - if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { - static_cast<CFDE_XMLElement*>(pXMLNode)->SetString( + CFX_XMLNode* pXMLNode = GetXMLMappingNode(); + if (pXMLNode && pXMLNode->GetType() == FX_XMLNODE_Element) { + static_cast<CFX_XMLElement*>(pXMLNode)->SetString( CFX_WideString::FromUTF8(bsName.AsStringC()), CFX_WideString::FromUTF8(bsValue.AsStringC())); } @@ -3399,9 +3399,9 @@ void CXFA_Node::Script_Packet_RemoveAttribute(CFXJSE_Arguments* pArguments) { CFX_ByteString bsName = pArguments->GetUTF8String(0); CFX_WideString wsName = CFX_WideString::FromUTF8(bsName.AsStringC()); - CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); - if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { - CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); + CFX_XMLNode* pXMLNode = GetXMLMappingNode(); + if (pXMLNode && pXMLNode->GetType() == FX_XMLNODE_Element) { + CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLNode); if (pXMLElement->HasAttribute(wsName.c_str())) { pXMLElement->RemoveAttribute(wsName.c_str()); } @@ -3413,16 +3413,16 @@ void CXFA_Node::Script_Packet_Content(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { if (bSetting) { - CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); - if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { - CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); + CFX_XMLNode* pXMLNode = GetXMLMappingNode(); + if (pXMLNode && pXMLNode->GetType() == FX_XMLNODE_Element) { + CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLNode); pXMLElement->SetTextData(pValue->ToWideString()); } } else { CFX_WideString wsTextData; - CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); - if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { - CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); + CFX_XMLNode* pXMLNode = GetXMLMappingNode(); + if (pXMLNode && pXMLNode->GetType() == FX_XMLNODE_Element) { + CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLNode); wsTextData = pXMLElement->GetTextData(); } pValue->SetString(wsTextData.UTF8Encode().AsStringC()); @@ -3782,11 +3782,11 @@ bool CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, } if (eAttr == XFA_ATTRIBUTE_Value) { - FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType(); + FX_XMLNODETYPE eXMLType = m_pXMLNode->GetType(); switch (eXMLType) { - case FDE_XMLNODE_Element: + case FX_XMLNODE_Element: if (IsAttributeInXML()) { - static_cast<CFDE_XMLElement*>(m_pXMLNode) + static_cast<CFX_XMLElement*>(m_pXMLNode) ->SetString(CFX_WideString(GetCData(XFA_ATTRIBUTE_QualifiedName)), wsValue); } else { @@ -3803,13 +3803,13 @@ bool CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, } } if (bDeleteChildren) { - static_cast<CFDE_XMLElement*>(m_pXMLNode)->DeleteChildren(); + static_cast<CFX_XMLElement*>(m_pXMLNode)->DeleteChildren(); } - static_cast<CFDE_XMLElement*>(m_pXMLNode)->SetTextData(wsValue); + static_cast<CFX_XMLElement*>(m_pXMLNode)->SetTextData(wsValue); } break; - case FDE_XMLNODE_Text: - static_cast<CFDE_XMLText*>(m_pXMLNode)->SetText(wsValue); + case FX_XMLNODE_Text: + static_cast<CFX_XMLText*>(m_pXMLNode)->SetText(wsValue); break; default: ASSERT(0); @@ -3819,12 +3819,12 @@ bool CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttr); if (pInfo) { - ASSERT(m_pXMLNode->GetType() == FDE_XMLNODE_Element); + ASSERT(m_pXMLNode->GetType() == FX_XMLNODE_Element); CFX_WideString wsAttrName = pInfo->pName; if (pInfo->eName == XFA_ATTRIBUTE_ContentType) { wsAttrName = L"xfa:" + wsAttrName; } - static_cast<CFDE_XMLElement*>(m_pXMLNode)->SetString(wsAttrName, wsValue); + static_cast<CFX_XMLElement*>(m_pXMLNode)->SetString(wsAttrName, wsValue); } return true; } @@ -3839,11 +3839,11 @@ bool CXFA_Node::SetAttributeValue(const CFX_WideString& wsValue, SetUserData(pKey, pClone, &deleteWideStringCallBack); OnChanged(XFA_ATTRIBUTE_Value, bNotify, bScriptModify); if (IsNeedSavingXMLNode()) { - FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType(); + FX_XMLNODETYPE eXMLType = m_pXMLNode->GetType(); switch (eXMLType) { - case FDE_XMLNODE_Element: + case FX_XMLNODE_Element: if (IsAttributeInXML()) { - static_cast<CFDE_XMLElement*>(m_pXMLNode) + static_cast<CFX_XMLElement*>(m_pXMLNode) ->SetString(CFX_WideString(GetCData(XFA_ATTRIBUTE_QualifiedName)), wsXMLValue); } else { @@ -3860,13 +3860,13 @@ bool CXFA_Node::SetAttributeValue(const CFX_WideString& wsValue, } } if (bDeleteChildren) { - static_cast<CFDE_XMLElement*>(m_pXMLNode)->DeleteChildren(); + static_cast<CFX_XMLElement*>(m_pXMLNode)->DeleteChildren(); } - static_cast<CFDE_XMLElement*>(m_pXMLNode)->SetTextData(wsXMLValue); + static_cast<CFX_XMLElement*>(m_pXMLNode)->SetTextData(wsXMLValue); } break; - case FDE_XMLNODE_Text: - static_cast<CFDE_XMLText*>(m_pXMLNode)->SetText(wsXMLValue); + case FX_XMLNODE_Text: + static_cast<CFX_XMLText*>(m_pXMLNode)->SetText(wsXMLValue); break; default: ASSERT(0); @@ -3955,26 +3955,26 @@ bool CXFA_Node::SetValue(XFA_ATTRIBUTE eAttr, SetMapModuleValue(pKey, pValue); OnChanged(eAttr, bNotify, false); if (IsNeedSavingXMLNode()) { - ASSERT(m_pXMLNode->GetType() == FDE_XMLNODE_Element); + ASSERT(m_pXMLNode->GetType() == FX_XMLNODE_Element); const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttr); if (pInfo) { switch (eType) { case XFA_ATTRIBUTETYPE_Enum: - static_cast<CFDE_XMLElement*>(m_pXMLNode) + static_cast<CFX_XMLElement*>(m_pXMLNode) ->SetString( pInfo->pName, GetAttributeEnumByID((XFA_ATTRIBUTEENUM)(uintptr_t)pValue) ->pName); break; case XFA_ATTRIBUTETYPE_Boolean: - static_cast<CFDE_XMLElement*>(m_pXMLNode) + static_cast<CFX_XMLElement*>(m_pXMLNode) ->SetString(pInfo->pName, pValue ? L"1" : L"0"); break; case XFA_ATTRIBUTETYPE_Integer: { CFX_WideString wsValue; wsValue.Format( L"%d", static_cast<int32_t>(reinterpret_cast<uintptr_t>(pValue))); - static_cast<CFDE_XMLElement*>(m_pXMLNode) + static_cast<CFX_XMLElement*>(m_pXMLNode) ->SetString(pInfo->pName, wsValue); break; } @@ -4293,27 +4293,27 @@ CXFA_Node* CXFA_Node::GetModelNode() { bool CXFA_Node::TryNamespace(CFX_WideString& wsNamespace) { wsNamespace.clear(); if (IsModelNode() || GetElementType() == XFA_Element::Packet) { - CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); - if (!pXMLNode || pXMLNode->GetType() != FDE_XMLNODE_Element) { + CFX_XMLNode* pXMLNode = GetXMLMappingNode(); + if (!pXMLNode || pXMLNode->GetType() != FX_XMLNODE_Element) { return false; } - wsNamespace = static_cast<CFDE_XMLElement*>(pXMLNode)->GetNamespaceURI(); + wsNamespace = static_cast<CFX_XMLElement*>(pXMLNode)->GetNamespaceURI(); return true; } else if (GetPacketID() == XFA_XDPPACKET_Datasets) { - CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); + CFX_XMLNode* pXMLNode = GetXMLMappingNode(); if (!pXMLNode) { return false; } - if (pXMLNode->GetType() != FDE_XMLNODE_Element) { + if (pXMLNode->GetType() != FX_XMLNODE_Element) { return true; } if (GetElementType() == XFA_Element::DataValue && GetEnum(XFA_ATTRIBUTE_Contains) == XFA_ATTRIBUTEENUM_MetaData) { return XFA_FDEExtension_ResolveNamespaceQualifier( - static_cast<CFDE_XMLElement*>(pXMLNode), + static_cast<CFX_XMLElement*>(pXMLNode), GetCData(XFA_ATTRIBUTE_QualifiedName), &wsNamespace); } - wsNamespace = static_cast<CFDE_XMLElement*>(pXMLNode)->GetNamespaceURI(); + wsNamespace = static_cast<CFX_XMLElement*>(pXMLNode)->GetNamespaceURI(); return true; } else { CXFA_Node* pModelNode = GetModelNode(); @@ -4448,7 +4448,7 @@ int32_t CXFA_Node::InsertChild(int32_t index, CXFA_Node* pNode) { pNotify->OnChildAdded(this); if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) { - ASSERT(!pNode->m_pXMLNode->GetNodeItem(CFDE_XMLNode::Parent)); + ASSERT(!pNode->m_pXMLNode->GetNodeItem(CFX_XMLNode::Parent)); m_pXMLNode->InsertChildNode(pNode->m_pXMLNode, index); pNode->ClearFlag(XFA_NodeFlag_OwnXMLNode); } @@ -4495,7 +4495,7 @@ bool CXFA_Node::InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode) { pNotify->OnChildAdded(this); if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) { - ASSERT(!pNode->m_pXMLNode->GetNodeItem(CFDE_XMLNode::Parent)); + ASSERT(!pNode->m_pXMLNode->GetNodeItem(CFX_XMLNode::Parent)); m_pXMLNode->InsertChildNode(pNode->m_pXMLNode, nIndex); pNode->ClearFlag(XFA_NodeFlag_OwnXMLNode); } @@ -4543,17 +4543,17 @@ bool CXFA_Node::RemoveChild(CXFA_Node* pNode, bool bNotify) { if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) { if (pNode->IsAttributeInXML()) { ASSERT(pNode->m_pXMLNode == m_pXMLNode && - m_pXMLNode->GetType() == FDE_XMLNODE_Element); - if (pNode->m_pXMLNode->GetType() == FDE_XMLNODE_Element) { - CFDE_XMLElement* pXMLElement = - static_cast<CFDE_XMLElement*>(pNode->m_pXMLNode); + m_pXMLNode->GetType() == FX_XMLNODE_Element); + if (pNode->m_pXMLNode->GetType() == FX_XMLNODE_Element) { + CFX_XMLElement* pXMLElement = + static_cast<CFX_XMLElement*>(pNode->m_pXMLNode); CFX_WideStringC wsAttributeName = pNode->GetCData(XFA_ATTRIBUTE_QualifiedName); pXMLElement->RemoveAttribute(wsAttributeName.c_str()); } CFX_WideString wsName; pNode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, false); - CFDE_XMLElement* pNewXMLElement = new CFDE_XMLElement(wsName); + CFX_XMLElement* pNewXMLElement = new CFX_XMLElement(wsName); CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value); if (!wsValue.IsEmpty()) { pNewXMLElement->SetTextData(CFX_WideString(wsValue)); @@ -4799,10 +4799,10 @@ void CXFA_Node::UpdateNameHash() { } } -CFDE_XMLNode* CXFA_Node::CreateXMLMappingNode() { +CFX_XMLNode* CXFA_Node::CreateXMLMappingNode() { if (!m_pXMLNode) { CFX_WideString wsTag(GetCData(XFA_ATTRIBUTE_Name)); - m_pXMLNode = new CFDE_XMLElement(wsTag); + m_pXMLNode = new CFX_XMLElement(wsTag); SetFlag(XFA_NodeFlag_OwnXMLNode, false); } return m_pXMLNode; diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h index 970d267ff3..db4b2ce553 100644 --- a/xfa/fxfa/parser/cxfa_node.h +++ b/xfa/fxfa/parser/cxfa_node.h @@ -13,7 +13,7 @@ #include "core/fxcrt/fx_string.h" #include "xfa/fxfa/parser/cxfa_object.h" -class CFDE_XMLNode; +class CFX_XMLNode; class CFXJSE_Argument; class CXFA_WidgetData; @@ -95,9 +95,9 @@ class CXFA_Node : public CXFA_Object { bool IsFormContainer() const { return m_ePacket == XFA_XDPPACKET_Form && IsContainerNode(); } - void SetXMLMappingNode(CFDE_XMLNode* pXMLNode) { m_pXMLNode = pXMLNode; } - CFDE_XMLNode* GetXMLMappingNode() const { return m_pXMLNode; } - CFDE_XMLNode* CreateXMLMappingNode(); + void SetXMLMappingNode(CFX_XMLNode* pXMLNode) { m_pXMLNode = pXMLNode; } + CFX_XMLNode* GetXMLMappingNode() const { return m_pXMLNode; } + CFX_XMLNode* CreateXMLMappingNode(); bool IsNeedSavingXMLNode(); uint32_t GetNameHash() const { return m_dwNameHash; } bool IsUnnamed() const { return m_dwNameHash == 0; } @@ -592,7 +592,7 @@ class CXFA_Node : public CXFA_Object { CXFA_Node* m_pChild; CXFA_Node* m_pLastChild; CXFA_Node* m_pParent; - CFDE_XMLNode* m_pXMLNode; + CFX_XMLNode* m_pXMLNode; uint16_t m_ePacket; uint16_t m_uNodeFlags; uint32_t m_dwNameHash; diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_simple_parser.cpp index 642b7641bd..9fd684c0a9 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser.cpp +++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp @@ -13,14 +13,14 @@ #include "core/fxcrt/cfx_seekablestreamproxy.h" #include "core/fxcrt/fx_codepage.h" #include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/xml/cfx_xmlchardata.h" +#include "core/fxcrt/xml/cfx_xmldoc.h" +#include "core/fxcrt/xml/cfx_xmlelement.h" +#include "core/fxcrt/xml/cfx_xmlinstruction.h" +#include "core/fxcrt/xml/cfx_xmlnode.h" +#include "core/fxcrt/xml/cfx_xmlparser.h" +#include "core/fxcrt/xml/cfx_xmltext.h" #include "third_party/base/ptr_util.h" -#include "xfa/fde/xml/cfde_xmlchardata.h" -#include "xfa/fde/xml/cfde_xmldoc.h" -#include "xfa/fde/xml/cfde_xmlelement.h" -#include "xfa/fde/xml/cfde_xmlinstruction.h" -#include "xfa/fde/xml/cfde_xmlnode.h" -#include "xfa/fde/xml/cfde_xmlparser.h" -#include "xfa/fde/xml/cfde_xmltext.h" #include "xfa/fxfa/fxfa.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_node.h" @@ -29,25 +29,25 @@ namespace { -CFDE_XMLNode* GetDocumentNode(CFDE_XMLDoc* pXMLDoc, - bool bVerifyWellFormness = false) { +CFX_XMLNode* GetDocumentNode(CFX_XMLDoc* pXMLDoc, + bool bVerifyWellFormness = false) { if (!pXMLDoc) return nullptr; - for (CFDE_XMLNode* pXMLNode = - pXMLDoc->GetRoot()->GetNodeItem(CFDE_XMLNode::FirstChild); - pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) { - if (pXMLNode->GetType() != FDE_XMLNODE_Element) + for (CFX_XMLNode* pXMLNode = + pXMLDoc->GetRoot()->GetNodeItem(CFX_XMLNode::FirstChild); + pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFX_XMLNode::NextSibling)) { + if (pXMLNode->GetType() != FX_XMLNODE_Element) continue; if (!bVerifyWellFormness) return pXMLNode; - for (CFDE_XMLNode* pNextNode = - pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling); + for (CFX_XMLNode* pNextNode = + pXMLNode->GetNodeItem(CFX_XMLNode::NextSibling); pNextNode; - pNextNode = pNextNode->GetNodeItem(CFDE_XMLNode::NextSibling)) { - if (pNextNode->GetType() == FDE_XMLNODE_Element) + pNextNode = pNextNode->GetNodeItem(CFX_XMLNode::NextSibling)) { + if (pNextNode->GetType() == FX_XMLNODE_Element) return nullptr; } return pXMLNode; @@ -55,7 +55,7 @@ CFDE_XMLNode* GetDocumentNode(CFDE_XMLDoc* pXMLDoc, return nullptr; } -CFX_WideString GetElementTagNamespaceURI(CFDE_XMLElement* pElement) { +CFX_WideString GetElementTagNamespaceURI(CFX_XMLElement* pElement) { CFX_WideString wsNodeStr = pElement->GetNamespacePrefix(); CFX_WideString wsNamespaceURI; if (!XFA_FDEExtension_ResolveNamespaceQualifier( @@ -65,14 +65,14 @@ CFX_WideString GetElementTagNamespaceURI(CFDE_XMLElement* pElement) { return wsNamespaceURI; } -bool MatchNodeName(CFDE_XMLNode* pNode, +bool MatchNodeName(CFX_XMLNode* pNode, const CFX_WideStringC& wsLocalTagName, const CFX_WideStringC& wsNamespaceURIPrefix, uint32_t eMatchFlags = XFA_XDPPACKET_FLAGS_NOMATCH) { - if (!pNode || pNode->GetType() != FDE_XMLNODE_Element) + if (!pNode || pNode->GetType() != FX_XMLNODE_Element) return false; - CFDE_XMLElement* pElement = reinterpret_cast<CFDE_XMLElement*>(pNode); + CFX_XMLElement* pElement = reinterpret_cast<CFX_XMLElement*>(pNode); CFX_WideString wsNodeStr = pElement->GetLocalTagName(); if (wsNodeStr != wsLocalTagName) return false; @@ -100,7 +100,7 @@ bool GetAttributeLocalName(const CFX_WideStringC& wsAttributeName, return true; } -bool ResolveAttribute(CFDE_XMLElement* pElement, +bool ResolveAttribute(CFX_XMLElement* pElement, const CFX_WideStringC& wsAttributeName, CFX_WideString& wsLocalAttrName, CFX_WideString& wsNamespaceURI) { @@ -122,7 +122,7 @@ bool ResolveAttribute(CFDE_XMLElement* pElement, return true; } -bool FindAttributeWithNS(CFDE_XMLElement* pElement, +bool FindAttributeWithNS(CFX_XMLElement* pElement, const CFX_WideStringC& wsLocalAttributeName, const CFX_WideStringC& wsNamespaceURIPrefix, CFX_WideString& wsValue, @@ -164,7 +164,7 @@ bool FindAttributeWithNS(CFDE_XMLElement* pElement, return false; } -CFDE_XMLNode* GetDataSetsFromXDP(CFDE_XMLNode* pXMLDocumentNode) { +CFX_XMLNode* GetDataSetsFromXDP(CFX_XMLNode* pXMLDocumentNode) { if (MatchNodeName(pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_Datasets)->pName, XFA_GetPacketByIndex(XFA_PACKET_Datasets)->pURI, @@ -177,10 +177,10 @@ CFDE_XMLNode* GetDataSetsFromXDP(CFDE_XMLNode* pXMLDocumentNode) { XFA_GetPacketByIndex(XFA_PACKET_XDP)->eFlags)) { return nullptr; } - for (CFDE_XMLNode* pDatasetsNode = - pXMLDocumentNode->GetNodeItem(CFDE_XMLNode::FirstChild); + for (CFX_XMLNode* pDatasetsNode = + pXMLDocumentNode->GetNodeItem(CFX_XMLNode::FirstChild); pDatasetsNode; - pDatasetsNode = pDatasetsNode->GetNodeItem(CFDE_XMLNode::NextSibling)) { + pDatasetsNode = pDatasetsNode->GetNodeItem(CFX_XMLNode::NextSibling)) { if (!MatchNodeName(pDatasetsNode, XFA_GetPacketByIndex(XFA_PACKET_Datasets)->pName, XFA_GetPacketByIndex(XFA_PACKET_Datasets)->pURI, @@ -197,24 +197,23 @@ bool IsStringAllWhitespace(CFX_WideString wsText) { return wsText.IsEmpty(); } -void ConvertXMLToPlainText(CFDE_XMLElement* pRootXMLNode, +void ConvertXMLToPlainText(CFX_XMLElement* pRootXMLNode, CFX_WideString& wsOutput) { - for (CFDE_XMLNode* pXMLChild = - pRootXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); + for (CFX_XMLNode* pXMLChild = + pRootXMLNode->GetNodeItem(CFX_XMLNode::FirstChild); pXMLChild; - pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) { + pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) { switch (pXMLChild->GetType()) { - case FDE_XMLNODE_Element: { + case FX_XMLNODE_Element: { CFX_WideString wsTextData = - static_cast<CFDE_XMLElement*>(pXMLChild)->GetTextData(); + static_cast<CFX_XMLElement*>(pXMLChild)->GetTextData(); wsTextData += L"\n"; wsOutput += wsTextData; break; } - case FDE_XMLNODE_Text: - case FDE_XMLNODE_CharData: { - CFX_WideString wsText = - static_cast<CFDE_XMLText*>(pXMLChild)->GetText(); + case FX_XMLNODE_Text: + case FX_XMLNODE_CharData: { + CFX_WideString wsText = static_cast<CFX_XMLText*>(pXMLChild)->GetText(); if (IsStringAllWhitespace(wsText)) continue; @@ -250,7 +249,7 @@ const XFA_PACKETINFO* GetPacketByName(const CFX_WideStringC& wsName) { } // namespace -bool XFA_RecognizeRichText(CFDE_XMLElement* pRichTextXMLNode) { +bool XFA_RecognizeRichText(CFX_XMLElement* pRichTextXMLNode) { return pRichTextXMLNode && GetElementTagNamespaceURI(pRichTextXMLNode) == L"http://www.w3.org/1999/xhtml"; } @@ -283,9 +282,9 @@ int32_t CXFA_SimpleParser::StartParse( wCodePage != FX_CODEPAGE_UTF8) { m_pStream->SetCodePage(FX_CODEPAGE_UTF8); } - m_pXMLDoc = pdfium::MakeUnique<CFDE_XMLDoc>(); + m_pXMLDoc = pdfium::MakeUnique<CFX_XMLDoc>(); auto pNewParser = - pdfium::MakeUnique<CFDE_XMLParser>(m_pXMLDoc->GetRoot(), m_pStream); + pdfium::MakeUnique<CFX_XMLParser>(m_pXMLDoc->GetRoot(), m_pStream); m_pXMLParser = pNewParser.get(); if (!m_pXMLDoc->LoadXML(std::move(pNewParser))) return XFA_PARSESTATUS_StatusErr; @@ -314,15 +313,15 @@ int32_t CXFA_SimpleParser::DoParse(IFX_Pause* pPause) { return XFA_PARSESTATUS_Done; } -CFDE_XMLNode* CXFA_SimpleParser::ParseXMLData(const CFX_ByteString& wsXML, - IFX_Pause* pPause) { +CFX_XMLNode* CXFA_SimpleParser::ParseXMLData(const CFX_ByteString& wsXML, + IFX_Pause* pPause) { CloseParser(); - m_pXMLDoc = pdfium::MakeUnique<CFDE_XMLDoc>(); + m_pXMLDoc = pdfium::MakeUnique<CFX_XMLDoc>(); auto pStream = pdfium::MakeRetain<CFX_SeekableStreamProxy>( const_cast<uint8_t*>(wsXML.raw_str()), wsXML.GetLength()); auto pParser = - pdfium::MakeUnique<CFDE_XMLParser>(m_pXMLDoc->GetRoot(), pStream); + pdfium::MakeUnique<CFX_XMLParser>(m_pXMLDoc->GetRoot(), pStream); pParser->m_dwCheckStatus = 0x03; if (!m_pXMLDoc->LoadXML(std::move(pParser))) return nullptr; @@ -334,25 +333,25 @@ CFDE_XMLNode* CXFA_SimpleParser::ParseXMLData(const CFX_ByteString& wsXML, } void CXFA_SimpleParser::ConstructXFANode(CXFA_Node* pXFANode, - CFDE_XMLNode* pXMLNode) { + CFX_XMLNode* pXMLNode) { XFA_XDPPACKET ePacketID = (XFA_XDPPACKET)pXFANode->GetPacketID(); if (ePacketID == XFA_XDPPACKET_Datasets) { if (pXFANode->GetElementType() == XFA_Element::DataValue) { - for (CFDE_XMLNode* pXMLChild = - pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); + for (CFX_XMLNode* pXMLChild = + pXMLNode->GetNodeItem(CFX_XMLNode::FirstChild); pXMLChild; - pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) { - FDE_XMLNODETYPE eNodeType = pXMLChild->GetType(); - if (eNodeType == FDE_XMLNODE_Instruction) + pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) { + FX_XMLNODETYPE eNodeType = pXMLChild->GetType(); + if (eNodeType == FX_XMLNODE_Instruction) continue; - if (eNodeType == FDE_XMLNODE_Element) { + if (eNodeType == FX_XMLNODE_Element) { CXFA_Node* pXFAChild = m_pFactory->CreateNode(XFA_XDPPACKET_Datasets, XFA_Element::DataValue); if (!pXFAChild) return; - CFDE_XMLElement* child = static_cast<CFDE_XMLElement*>(pXMLChild); + CFX_XMLElement* child = static_cast<CFX_XMLElement*>(pXMLChild); CFX_WideString wsNodeStr = child->GetLocalTagName(); pXFAChild->SetCData(XFA_ATTRIBUTE_Name, wsNodeStr); CFX_WideString wsChildValue; @@ -382,18 +381,18 @@ CXFA_Node* CXFA_SimpleParser::GetRootNode() const { return m_pRootNode; } -CFDE_XMLDoc* CXFA_SimpleParser::GetXMLDoc() const { +CFX_XMLDoc* CXFA_SimpleParser::GetXMLDoc() const { return m_pXMLDoc.get(); } bool XFA_FDEExtension_ResolveNamespaceQualifier( - CFDE_XMLElement* pNode, + CFX_XMLElement* pNode, const CFX_WideStringC& wsQualifier, CFX_WideString* wsNamespaceURI) { if (!pNode) return false; - CFDE_XMLNode* pFakeRoot = pNode->GetNodeItem(CFDE_XMLNode::Root); + CFX_XMLNode* pFakeRoot = pNode->GetNodeItem(CFX_XMLNode::Root); CFX_WideString wsNSAttribute; bool bRet = false; if (wsQualifier.IsEmpty()) { @@ -402,12 +401,12 @@ bool XFA_FDEExtension_ResolveNamespaceQualifier( } else { wsNSAttribute = L"xmlns:" + wsQualifier; } - for (CFDE_XMLNode* pParent = pNode; pParent != pFakeRoot; - pParent = pParent->GetNodeItem(CFDE_XMLNode::Parent)) { - if (pParent->GetType() != FDE_XMLNODE_Element) + for (CFX_XMLNode* pParent = pNode; pParent != pFakeRoot; + pParent = pParent->GetNodeItem(CFX_XMLNode::Parent)) { + if (pParent->GetType() != FX_XMLNODE_Element) continue; - auto* pElement = static_cast<CFDE_XMLElement*>(pParent); + auto* pElement = static_cast<CFX_XMLElement*>(pParent); if (pElement->HasAttribute(wsNSAttribute.c_str())) { *wsNamespaceURI = pElement->GetString(wsNSAttribute.c_str()); return true; @@ -417,7 +416,7 @@ bool XFA_FDEExtension_ResolveNamespaceQualifier( return bRet; } -CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket(CFDE_XMLNode* pXMLDocumentNode, +CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket(CFX_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID) { switch (ePacketID) { case XFA_XDPPACKET_UNKNOWN: @@ -444,7 +443,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket(CFDE_XMLNode* pXMLDocumentNode, } CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP( - CFDE_XMLNode* pXMLDocumentNode, + CFX_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID) { if (!MatchNodeName(pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_XDP)->pName, @@ -461,7 +460,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP( m_pRootNode = pXFARootNode; pXFARootNode->SetCData(XFA_ATTRIBUTE_Name, L"xfa"); - CFDE_XMLElement* pElement = static_cast<CFDE_XMLElement*>(pXMLDocumentNode); + CFX_XMLElement* pElement = static_cast<CFX_XMLElement*>(pXMLDocumentNode); for (auto it : pElement->GetAttributes()) { if (it.first == L"uuid") pXFARootNode->SetCData(XFA_ATTRIBUTE_Uuid, it.second); @@ -469,12 +468,12 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP( pXFARootNode->SetCData(XFA_ATTRIBUTE_TimeStamp, it.second); } - CFDE_XMLNode* pXMLConfigDOMRoot = nullptr; + CFX_XMLNode* pXMLConfigDOMRoot = nullptr; CXFA_Node* pXFAConfigDOMRoot = nullptr; - for (CFDE_XMLNode* pChildItem = - pXMLDocumentNode->GetNodeItem(CFDE_XMLNode::FirstChild); + for (CFX_XMLNode* pChildItem = + pXMLDocumentNode->GetNodeItem(CFX_XMLNode::FirstChild); pChildItem; - pChildItem = pChildItem->GetNodeItem(CFDE_XMLNode::NextSibling)) { + pChildItem = pChildItem->GetNodeItem(CFX_XMLNode::NextSibling)) { const XFA_PACKETINFO* pPacketInfo = XFA_GetPacketByIndex(XFA_PACKET_Config); if (!MatchNodeName(pChildItem, pPacketInfo->pName, pPacketInfo->pURI, pPacketInfo->eFlags)) { @@ -489,19 +488,19 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP( pXFARootNode->InsertChild(pXFAConfigDOMRoot, nullptr); } - CFDE_XMLNode* pXMLDatasetsDOMRoot = nullptr; - CFDE_XMLNode* pXMLFormDOMRoot = nullptr; - CFDE_XMLNode* pXMLTemplateDOMRoot = nullptr; - for (CFDE_XMLNode* pChildItem = - pXMLDocumentNode->GetNodeItem(CFDE_XMLNode::FirstChild); + CFX_XMLNode* pXMLDatasetsDOMRoot = nullptr; + CFX_XMLNode* pXMLFormDOMRoot = nullptr; + CFX_XMLNode* pXMLTemplateDOMRoot = nullptr; + for (CFX_XMLNode* pChildItem = + pXMLDocumentNode->GetNodeItem(CFX_XMLNode::FirstChild); pChildItem; - pChildItem = pChildItem->GetNodeItem(CFDE_XMLNode::NextSibling)) { - if (!pChildItem || pChildItem->GetType() != FDE_XMLNODE_Element) + pChildItem = pChildItem->GetNodeItem(CFX_XMLNode::NextSibling)) { + if (!pChildItem || pChildItem->GetType() != FX_XMLNODE_Element) continue; if (pChildItem == pXMLConfigDOMRoot) continue; - CFDE_XMLElement* pElement = reinterpret_cast<CFDE_XMLElement*>(pChildItem); + CFX_XMLElement* pElement = reinterpret_cast<CFX_XMLElement*>(pChildItem); CFX_WideString wsPacketName = pElement->GetLocalTagName(); const XFA_PACKETINFO* pPacketInfo = GetPacketByName(wsPacketName.AsStringC()); @@ -570,7 +569,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP( } CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Config( - CFDE_XMLNode* pXMLDocumentNode, + CFX_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID) { if (!MatchNodeName(pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_Config)->pName, @@ -593,7 +592,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Config( } CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( - CFDE_XMLNode* pXMLDocumentNode, + CFX_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID) { CXFA_Node* pNode = nullptr; if (ePacketID == XFA_XDPPACKET_Template) { @@ -609,8 +608,8 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( pNode->SetCData(XFA_ATTRIBUTE_Name, XFA_GetPacketByIndex(XFA_PACKET_Template)->pName); if (m_bDocumentParser) { - CFDE_XMLElement* pXMLDocumentElement = - static_cast<CFDE_XMLElement*>(pXMLDocumentNode); + CFX_XMLElement* pXMLDocumentElement = + static_cast<CFX_XMLElement*>(pXMLDocumentNode); CFX_WideString wsNamespaceURI = pXMLDocumentElement->GetNamespaceURI(); if (wsNamespaceURI.IsEmpty()) wsNamespaceURI = pXMLDocumentElement->GetString(L"xmlns:xfa"); @@ -625,8 +624,8 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( XFA_GetPacketByIndex(XFA_PACKET_Form)->pName, XFA_GetPacketByIndex(XFA_PACKET_Form)->pURI, XFA_GetPacketByIndex(XFA_PACKET_Form)->eFlags)) { - CFDE_XMLElement* pXMLDocumentElement = - static_cast<CFDE_XMLElement*>(pXMLDocumentNode); + CFX_XMLElement* pXMLDocumentElement = + static_cast<CFX_XMLElement*>(pXMLDocumentNode); CFX_WideString wsChecksum = pXMLDocumentElement->GetString(L"checksum"); if (wsChecksum.GetLength() != 28 || m_pXMLParser->m_dwCheckStatus != 0x03) { @@ -674,9 +673,9 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( } CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data( - CFDE_XMLNode* pXMLDocumentNode, + CFX_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID) { - CFDE_XMLNode* pDatasetsXMLNode = GetDataSetsFromXDP(pXMLDocumentNode); + CFX_XMLNode* pDatasetsXMLNode = GetDataSetsFromXDP(pXMLDocumentNode); if (pDatasetsXMLNode) { CXFA_Node* pNode = m_pFactory->CreateNode(XFA_XDPPACKET_Datasets, XFA_Element::DataModel); @@ -692,23 +691,23 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data( return pNode; } - CFDE_XMLNode* pDataXMLNode = nullptr; + CFX_XMLNode* pDataXMLNode = nullptr; if (MatchNodeName(pXMLDocumentNode, L"data", XFA_GetPacketByIndex(XFA_PACKET_Datasets)->pURI, XFA_GetPacketByIndex(XFA_PACKET_Datasets)->eFlags)) { - static_cast<CFDE_XMLElement*>(pXMLDocumentNode) + static_cast<CFX_XMLElement*>(pXMLDocumentNode) ->RemoveAttribute(L"xmlns:xfa"); pDataXMLNode = pXMLDocumentNode; } else { - CFDE_XMLElement* pDataElement = new CFDE_XMLElement(L"xfa:data"); - CFDE_XMLNode* pParentXMLNode = - pXMLDocumentNode->GetNodeItem(CFDE_XMLNode::Parent); + CFX_XMLElement* pDataElement = new CFX_XMLElement(L"xfa:data"); + CFX_XMLNode* pParentXMLNode = + pXMLDocumentNode->GetNodeItem(CFX_XMLNode::Parent); if (pParentXMLNode) pParentXMLNode->RemoveChildNode(pXMLDocumentNode); - ASSERT(pXMLDocumentNode->GetType() == FDE_XMLNODE_Element); - if (pXMLDocumentNode->GetType() == FDE_XMLNODE_Element) { - static_cast<CFDE_XMLElement*>(pXMLDocumentNode) + ASSERT(pXMLDocumentNode->GetType() == FX_XMLNODE_Element); + if (pXMLDocumentNode->GetType() == FX_XMLNODE_Element) { + static_cast<CFX_XMLElement*>(pXMLDocumentNode) ->RemoveAttribute(L"xmlns:xfa"); } pDataElement->InsertChildNode(pXMLDocumentNode); @@ -724,7 +723,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data( return nullptr; } CFX_WideString wsLocalName = - static_cast<CFDE_XMLElement*>(pDataXMLNode)->GetLocalTagName(); + static_cast<CFX_XMLElement*>(pDataXMLNode)->GetLocalTagName(); pNode->SetCData(XFA_ATTRIBUTE_Name, wsLocalName); if (!DataLoader(pNode, pDataXMLNode, true)) return nullptr; @@ -738,7 +737,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data( } CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_LocaleConnectionSourceSet( - CFDE_XMLNode* pXMLDocumentNode, + CFX_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID) { CXFA_Node* pNode = nullptr; if (ePacketID == XFA_XDPPACKET_LocaleSet) { @@ -793,7 +792,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_LocaleConnectionSourceSet( } CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Xdc( - CFDE_XMLNode* pXMLDocumentNode, + CFX_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID) { if (!MatchNodeName(pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_Xdc)->pName, @@ -813,7 +812,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Xdc( } CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_User( - CFDE_XMLNode* pXMLDocumentNode, + CFX_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID) { CXFA_Node* pNode = m_pFactory->CreateNode(XFA_XDPPACKET_XDP, XFA_Element::Packet); @@ -821,7 +820,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_User( return nullptr; CFX_WideString wsName = - static_cast<CFDE_XMLElement*>(pXMLDocumentNode)->GetLocalTagName(); + static_cast<CFX_XMLElement*>(pXMLDocumentNode)->GetLocalTagName(); pNode->SetCData(XFA_ATTRIBUTE_Name, wsName); if (!UserPacketLoader(pNode, pXMLDocumentNode)) return nullptr; @@ -831,28 +830,28 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_User( } CXFA_Node* CXFA_SimpleParser::UserPacketLoader(CXFA_Node* pXFANode, - CFDE_XMLNode* pXMLDoc) { + CFX_XMLNode* pXMLDoc) { return pXFANode; } CXFA_Node* CXFA_SimpleParser::DataLoader(CXFA_Node* pXFANode, - CFDE_XMLNode* pXMLDoc, + CFX_XMLNode* pXMLDoc, bool bDoTransform) { ParseDataGroup(pXFANode, pXMLDoc, XFA_XDPPACKET_Datasets); return pXFANode; } CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, - CFDE_XMLNode* pXMLDoc, + CFX_XMLNode* pXMLDoc, XFA_XDPPACKET ePacketID, bool bUseAttribute) { bool bOneOfPropertyFound = false; - for (CFDE_XMLNode* pXMLChild = pXMLDoc->GetNodeItem(CFDE_XMLNode::FirstChild); + for (CFX_XMLNode* pXMLChild = pXMLDoc->GetNodeItem(CFX_XMLNode::FirstChild); pXMLChild; - pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) { + pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) { switch (pXMLChild->GetType()) { - case FDE_XMLNODE_Element: { - CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLChild); + case FX_XMLNODE_Element: { + CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLChild); CFX_WideString wsTagName = pXMLElement->GetLocalTagName(); XFA_Element eType = XFA_GetElementTypeForName(wsTagName.AsStringC()); if (eType == XFA_Element::Unknown) @@ -914,8 +913,8 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, break; } } break; - case FDE_XMLNODE_Instruction: - ParseInstruction(pXFANode, static_cast<CFDE_XMLInstruction*>(pXMLChild), + case FX_XMLNODE_Instruction: + ParseInstruction(pXFANode, static_cast<CFX_XMLInstruction*>(pXMLChild), ePacketID); break; default: @@ -926,7 +925,7 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, } void CXFA_SimpleParser::ParseContentNode(CXFA_Node* pXFANode, - CFDE_XMLNode* pXMLNode, + CFX_XMLNode* pXMLNode, XFA_XDPPACKET ePacketID) { XFA_Element element = XFA_Element::Sharptext; if (pXFANode->GetElementType() == XFA_Element::ExData) { @@ -941,31 +940,30 @@ void CXFA_SimpleParser::ParseContentNode(CXFA_Node* pXFANode, pXFANode->SetXMLMappingNode(pXMLNode); CFX_WideString wsValue; - for (CFDE_XMLNode* pXMLChild = - pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); + for (CFX_XMLNode* pXMLChild = pXMLNode->GetNodeItem(CFX_XMLNode::FirstChild); pXMLChild; - pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) { - FDE_XMLNODETYPE eNodeType = pXMLChild->GetType(); - if (eNodeType == FDE_XMLNODE_Instruction) + pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) { + FX_XMLNODETYPE eNodeType = pXMLChild->GetType(); + if (eNodeType == FX_XMLNODE_Instruction) continue; if (element == XFA_Element::SharpxHTML) { - if (eNodeType != FDE_XMLNODE_Element) + if (eNodeType != FX_XMLNODE_Element) break; - if (XFA_RecognizeRichText(static_cast<CFDE_XMLElement*>(pXMLChild))) - XFA_GetPlainTextFromRichText(static_cast<CFDE_XMLElement*>(pXMLChild), + if (XFA_RecognizeRichText(static_cast<CFX_XMLElement*>(pXMLChild))) + XFA_GetPlainTextFromRichText(static_cast<CFX_XMLElement*>(pXMLChild), wsValue); } else if (element == XFA_Element::Sharpxml) { - if (eNodeType != FDE_XMLNODE_Element) + if (eNodeType != FX_XMLNODE_Element) break; - ConvertXMLToPlainText(static_cast<CFDE_XMLElement*>(pXMLChild), wsValue); + ConvertXMLToPlainText(static_cast<CFX_XMLElement*>(pXMLChild), wsValue); } else { - if (eNodeType == FDE_XMLNODE_Element) + if (eNodeType == FX_XMLNODE_Element) break; - if (eNodeType == FDE_XMLNODE_Text || eNodeType == FDE_XMLNODE_CharData) - wsValue = static_cast<CFDE_XMLText*>(pXMLChild)->GetText(); + if (eNodeType == FX_XMLNODE_Text || eNodeType == FX_XMLNODE_CharData) + wsValue = static_cast<CFX_XMLText*>(pXMLChild)->GetText(); } break; } @@ -983,15 +981,14 @@ void CXFA_SimpleParser::ParseContentNode(CXFA_Node* pXFANode, } void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, - CFDE_XMLNode* pXMLNode, + CFX_XMLNode* pXMLNode, XFA_XDPPACKET ePacketID) { - for (CFDE_XMLNode* pXMLChild = - pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); + for (CFX_XMLNode* pXMLChild = pXMLNode->GetNodeItem(CFX_XMLNode::FirstChild); pXMLChild; - pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) { + pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) { switch (pXMLChild->GetType()) { - case FDE_XMLNODE_Element: { - CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLChild); + case FX_XMLNODE_Element: { + CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLChild); { CFX_WideString wsNamespaceURI = GetElementTagNamespaceURI(pXMLElement); @@ -1024,13 +1021,13 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, } } if (eNodeType == XFA_Element::DataModel) { - for (CFDE_XMLNode* pXMLDataChild = - pXMLElement->GetNodeItem(CFDE_XMLNode::FirstChild); + for (CFX_XMLNode* pXMLDataChild = + pXMLElement->GetNodeItem(CFX_XMLNode::FirstChild); pXMLDataChild; pXMLDataChild = pXMLDataChild->GetNodeItem( - CFDE_XMLNode::NextSibling)) { - if (pXMLDataChild->GetType() == FDE_XMLNODE_Element) { + CFX_XMLNode::NextSibling)) { + if (pXMLDataChild->GetType() == FX_XMLNODE_Element) { if (!XFA_RecognizeRichText( - static_cast<CFDE_XMLElement*>(pXMLDataChild))) { + static_cast<CFX_XMLElement*>(pXMLDataChild))) { eNodeType = XFA_Element::DataGroup; break; } @@ -1094,9 +1091,9 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false); continue; } - case FDE_XMLNODE_CharData: - case FDE_XMLNODE_Text: { - CFDE_XMLText* pXMLText = static_cast<CFDE_XMLText*>(pXMLChild); + case FX_XMLNODE_CharData: + case FX_XMLNODE_Text: { + CFX_XMLText* pXMLText = static_cast<CFX_XMLText*>(pXMLChild); CFX_WideString wsText = pXMLText->GetText(); if (IsStringAllWhitespace(wsText)) continue; @@ -1119,30 +1116,28 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, } void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode, - CFDE_XMLNode* pXMLNode, + CFX_XMLNode* pXMLNode, XFA_XDPPACKET ePacketID) { CFX_WideTextBuf wsValueTextBuf; CFX_WideTextBuf wsCurValueTextBuf; bool bMarkAsCompound = false; - CFDE_XMLNode* pXMLCurValueNode = nullptr; - for (CFDE_XMLNode* pXMLChild = - pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); + CFX_XMLNode* pXMLCurValueNode = nullptr; + for (CFX_XMLNode* pXMLChild = pXMLNode->GetNodeItem(CFX_XMLNode::FirstChild); pXMLChild; - pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) { - FDE_XMLNODETYPE eNodeType = pXMLChild->GetType(); - if (eNodeType == FDE_XMLNODE_Instruction) + pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) { + FX_XMLNODETYPE eNodeType = pXMLChild->GetType(); + if (eNodeType == FX_XMLNODE_Instruction) continue; CFX_WideString wsText; - if (eNodeType == FDE_XMLNODE_Text || eNodeType == FDE_XMLNODE_CharData) { - wsText = static_cast<CFDE_XMLText*>(pXMLChild)->GetText(); + if (eNodeType == FX_XMLNODE_Text || eNodeType == FX_XMLNODE_CharData) { + wsText = static_cast<CFX_XMLText*>(pXMLChild)->GetText(); if (!pXMLCurValueNode) pXMLCurValueNode = pXMLChild; wsCurValueTextBuf << wsText; - } else if (XFA_RecognizeRichText( - static_cast<CFDE_XMLElement*>(pXMLChild))) { - XFA_GetPlainTextFromRichText(static_cast<CFDE_XMLElement*>(pXMLChild), + } else if (XFA_RecognizeRichText(static_cast<CFX_XMLElement*>(pXMLChild))) { + XFA_GetPlainTextFromRichText(static_cast<CFX_XMLElement*>(pXMLChild), wsText); if (!pXMLCurValueNode) pXMLCurValueNode = pXMLChild; @@ -1174,7 +1169,7 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode, return; CFX_WideString wsNodeStr = - static_cast<CFDE_XMLElement*>(pXMLChild)->GetLocalTagName(); + static_cast<CFX_XMLElement*>(pXMLChild)->GetLocalTagName(); pXFAChild->SetCData(XFA_ATTRIBUTE_Name, wsNodeStr); ParseDataValue(pXFAChild, pXMLChild, ePacketID); pXFANode->InsertChild(pXFAChild); @@ -1209,7 +1204,7 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode, } void CXFA_SimpleParser::ParseInstruction(CXFA_Node* pXFANode, - CFDE_XMLInstruction* pXMLInstruction, + CFX_XMLInstruction* pXMLInstruction, XFA_XDPPACKET ePacketID) { if (!m_bDocumentParser) return; diff --git a/xfa/fxfa/parser/cxfa_simple_parser.h b/xfa/fxfa/parser/cxfa_simple_parser.h index 88a7679e74..cb1efcc1d5 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser.h +++ b/xfa/fxfa/parser/cxfa_simple_parser.h @@ -13,10 +13,10 @@ class CXFA_Document; class CXFA_Node; -class CFDE_XMLDoc; -class CFDE_XMLInstruction; -class CFDE_XMLNode; -class CFDE_XMLParser; +class CFX_XMLDoc; +class CFX_XMLInstruction; +class CFX_XMLNode; +class CFX_XMLParser; class IFX_SeekableStream; class IFX_Pause; class CFX_SeekableStreamProxy; @@ -29,55 +29,55 @@ class CXFA_SimpleParser { int32_t StartParse(const CFX_RetainPtr<IFX_SeekableStream>& pStream, XFA_XDPPACKET ePacketID); int32_t DoParse(IFX_Pause* pPause); - CFDE_XMLNode* ParseXMLData(const CFX_ByteString& wsXML, IFX_Pause* pPause); - void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode); + CFX_XMLNode* ParseXMLData(const CFX_ByteString& wsXML, IFX_Pause* pPause); + void ConstructXFANode(CXFA_Node* pXFANode, CFX_XMLNode* pXMLNode); CXFA_Node* GetRootNode() const; - CFDE_XMLDoc* GetXMLDoc() const; + CFX_XMLDoc* GetXMLDoc() const; void CloseParser(); void SetFactory(CXFA_Document* pFactory); private: - CXFA_Node* ParseAsXDPPacket(CFDE_XMLNode* pXMLDocumentNode, + CXFA_Node* ParseAsXDPPacket(CFX_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID); - CXFA_Node* ParseAsXDPPacket_XDP(CFDE_XMLNode* pXMLDocumentNode, + CXFA_Node* ParseAsXDPPacket_XDP(CFX_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID); - CXFA_Node* ParseAsXDPPacket_Config(CFDE_XMLNode* pXMLDocumentNode, + CXFA_Node* ParseAsXDPPacket_Config(CFX_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID); - CXFA_Node* ParseAsXDPPacket_TemplateForm(CFDE_XMLNode* pXMLDocumentNode, + CXFA_Node* ParseAsXDPPacket_TemplateForm(CFX_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID); - CXFA_Node* ParseAsXDPPacket_Data(CFDE_XMLNode* pXMLDocumentNode, + CXFA_Node* ParseAsXDPPacket_Data(CFX_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID); CXFA_Node* ParseAsXDPPacket_LocaleConnectionSourceSet( - CFDE_XMLNode* pXMLDocumentNode, + CFX_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID); - CXFA_Node* ParseAsXDPPacket_Xdc(CFDE_XMLNode* pXMLDocumentNode, + CXFA_Node* ParseAsXDPPacket_Xdc(CFX_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID); - CXFA_Node* ParseAsXDPPacket_User(CFDE_XMLNode* pXMLDocumentNode, + CXFA_Node* ParseAsXDPPacket_User(CFX_XMLNode* pXMLDocumentNode, XFA_XDPPACKET ePacketID); CXFA_Node* NormalLoader(CXFA_Node* pXFANode, - CFDE_XMLNode* pXMLDoc, + CFX_XMLNode* pXMLDoc, XFA_XDPPACKET ePacketID, bool bUseAttribute); CXFA_Node* DataLoader(CXFA_Node* pXFANode, - CFDE_XMLNode* pXMLDoc, + CFX_XMLNode* pXMLDoc, bool bDoTransform); - CXFA_Node* UserPacketLoader(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLDoc); + CXFA_Node* UserPacketLoader(CXFA_Node* pXFANode, CFX_XMLNode* pXMLDoc); void ParseContentNode(CXFA_Node* pXFANode, - CFDE_XMLNode* pXMLNode, + CFX_XMLNode* pXMLNode, XFA_XDPPACKET ePacketID); void ParseDataValue(CXFA_Node* pXFANode, - CFDE_XMLNode* pXMLNode, + CFX_XMLNode* pXMLNode, XFA_XDPPACKET ePacketID); void ParseDataGroup(CXFA_Node* pXFANode, - CFDE_XMLNode* pXMLNode, + CFX_XMLNode* pXMLNode, XFA_XDPPACKET ePacketID); void ParseInstruction(CXFA_Node* pXFANode, - CFDE_XMLInstruction* pXMLInstruction, + CFX_XMLInstruction* pXMLInstruction, XFA_XDPPACKET ePacketID); - CFDE_XMLParser* m_pXMLParser; - std::unique_ptr<CFDE_XMLDoc> m_pXMLDoc; + CFX_XMLParser* m_pXMLParser; + std::unique_ptr<CFX_XMLDoc> m_pXMLDoc; CFX_RetainPtr<CFX_SeekableStreamProxy> m_pStream; CFX_RetainPtr<IFX_SeekableStream> m_pFileRead; CXFA_Document* m_pFactory; diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index 82aec1f00d..f338595605 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -10,9 +10,9 @@ #include <vector> #include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/xml/cfx_xmlelement.h" +#include "core/fxcrt/xml/cfx_xmlnode.h" #include "third_party/base/stl_util.h" -#include "xfa/fde/xml/cfde_xmlelement.h" -#include "xfa/fde/xml/cfde_xmlnode.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" @@ -142,8 +142,8 @@ void CreateDataBinding(CXFA_Node* pFormNode, image.GetContentType(wsContentType); image.GetHref(wsHref); } - CFDE_XMLElement* pXMLDataElement = - static_cast<CFDE_XMLElement*>(pDataNode->GetXMLMappingNode()); + CFX_XMLElement* pXMLDataElement = + static_cast<CFX_XMLElement*>(pDataNode->GetXMLMappingNode()); ASSERT(pXMLDataElement); pWidgetData->GetFormatDataValue(wsValue, wsFormattedValue); pDataNode->SetAttributeValue(wsValue, wsFormattedValue); @@ -168,10 +168,10 @@ void CreateDataBinding(CXFA_Node* pFormNode, pValue->SetCData(XFA_ATTRIBUTE_Value, text); } } else { - CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); - ASSERT(pXMLNode->GetType() == FDE_XMLNODE_Element); - static_cast<CFDE_XMLElement*>(pXMLNode)->SetString(L"xfa:dataNode", - L"dataGroup"); + CFX_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); + ASSERT(pXMLNode->GetType() == FX_XMLNODE_Element); + static_cast<CFX_XMLElement*>(pXMLNode)->SetString(L"xfa:dataNode", + L"dataGroup"); } } else if (!wsValue.IsEmpty()) { pWidgetData->GetFormatDataValue(wsValue, wsFormattedValue); @@ -281,8 +281,8 @@ void CreateDataBinding(CXFA_Node* pFormNode, XFA_Element::Image); CXFA_Image image = defValue.GetImage(); if (image) { - CFDE_XMLElement* pXMLDataElement = - static_cast<CFDE_XMLElement*>(pDataNode->GetXMLMappingNode()); + CFX_XMLElement* pXMLDataElement = + static_cast<CFX_XMLElement*>(pDataNode->GetXMLMappingNode()); ASSERT(pXMLDataElement); CFX_WideString wsContentType = @@ -1356,7 +1356,7 @@ CXFA_Node* CXFA_Document::GetNotBindNode( void CXFA_Document::DoDataMerge() { CXFA_Node* pDatasetsRoot = ToNode(GetXFAObject(XFA_HASHCODE_Datasets)); if (!pDatasetsRoot) { - CFDE_XMLElement* pDatasetsXMLNode = new CFDE_XMLElement(L"xfa:datasets"); + CFX_XMLElement* pDatasetsXMLNode = new CFX_XMLElement(L"xfa:datasets"); pDatasetsXMLNode->SetString(L"xmlns:xfa", L"http://www.xfa.org/schema/xfa-data/1.0/"); pDatasetsRoot = CreateNode(XFA_XDPPACKET_Datasets, XFA_Element::DataModel); @@ -1392,7 +1392,7 @@ void CXFA_Document::DoDataMerge() { } if (!pDataRoot) { - CFDE_XMLElement* pDataRootXMLNode = new CFDE_XMLElement(L"xfa:data"); + CFX_XMLElement* pDataRootXMLNode = new CFX_XMLElement(L"xfa:data"); pDataRoot = CreateNode(XFA_XDPPACKET_Datasets, XFA_Element::DataGroup); pDataRoot->SetCData(XFA_ATTRIBUTE_Name, L"data"); pDataRoot->SetXMLMappingNode(pDataRootXMLNode); @@ -1441,8 +1441,8 @@ void CXFA_Document::DoDataMerge() { CFX_WideStringC wsFormName = pSubformSetNode->GetCData(XFA_ATTRIBUTE_Name); CFX_WideString wsDataTopLevelName(wsFormName.IsEmpty() ? L"form" : wsFormName); - CFDE_XMLElement* pDataTopLevelXMLNode = - new CFDE_XMLElement(wsDataTopLevelName); + CFX_XMLElement* pDataTopLevelXMLNode = + new CFX_XMLElement(wsDataTopLevelName); pDataTopLevel = CreateNode(XFA_XDPPACKET_Datasets, XFA_Element::DataGroup); pDataTopLevel->SetCData(XFA_ATTRIBUTE_Name, wsDataTopLevelName); diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp index 2ffba9b2e6..1c5adc75c9 100644 --- a/xfa/fxfa/parser/xfa_utils.cpp +++ b/xfa/fxfa/parser/xfa_utils.cpp @@ -9,10 +9,10 @@ #include <algorithm> #include "core/fxcrt/fx_ext.h" -#include "xfa/fde/xml/cfde_xmlchardata.h" -#include "xfa/fde/xml/cfde_xmlelement.h" -#include "xfa/fde/xml/cfde_xmlnode.h" -#include "xfa/fde/xml/cfde_xmltext.h" +#include "core/fxcrt/xml/cfx_xmlchardata.h" +#include "core/fxcrt/xml/cfx_xmlelement.h" +#include "core/fxcrt/xml/cfx_xmlnode.h" +#include "core/fxcrt/xml/cfx_xmltext.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/cxfa_localevalue.h" @@ -171,14 +171,14 @@ CXFA_LocaleValue XFA_GetLocaleValue(CXFA_WidgetData* pWidgetData) { return CXFA_LocaleValue(iVTType, pWidgetData->GetRawValue(), pWidgetData->GetNode()->GetDocument()->GetLocalMgr()); } -void XFA_GetPlainTextFromRichText(CFDE_XMLNode* pXMLNode, +void XFA_GetPlainTextFromRichText(CFX_XMLNode* pXMLNode, CFX_WideString& wsPlainText) { if (!pXMLNode) { return; } switch (pXMLNode->GetType()) { - case FDE_XMLNODE_Element: { - CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); + case FX_XMLNODE_Element: { + CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLNode); CFX_WideString wsTag = pXMLElement->GetLocalTagName(); uint32_t uTag = FX_HashCode_GetW(wsTag.AsStringC(), true); if (uTag == 0x0001f714) { @@ -195,20 +195,18 @@ void XFA_GetPlainTextFromRichText(CFDE_XMLNode* pXMLNode, } break; } - case FDE_XMLNODE_Text: - case FDE_XMLNODE_CharData: { - CFX_WideString wsContent = - static_cast<CFDE_XMLText*>(pXMLNode)->GetText(); + case FX_XMLNODE_Text: + case FX_XMLNODE_CharData: { + CFX_WideString wsContent = static_cast<CFX_XMLText*>(pXMLNode)->GetText(); wsPlainText += wsContent; break; } default: break; } - for (CFDE_XMLNode* pChildXML = - pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); + for (CFX_XMLNode* pChildXML = pXMLNode->GetNodeItem(CFX_XMLNode::FirstChild); pChildXML; - pChildXML = pChildXML->GetNodeItem(CFDE_XMLNode::NextSibling)) { + pChildXML = pChildXML->GetNodeItem(CFX_XMLNode::NextSibling)) { XFA_GetPlainTextFromRichText(pChildXML, wsPlainText); } } diff --git a/xfa/fxfa/parser/xfa_utils.h b/xfa/fxfa/parser/xfa_utils.h index 80f6d096ed..bc05381fc3 100644 --- a/xfa/fxfa/parser/xfa_utils.h +++ b/xfa/fxfa/parser/xfa_utils.h @@ -10,8 +10,8 @@ #include "core/fxcrt/cfx_seekablestreamproxy.h" #include "xfa/fxfa/fxfa_basic.h" -class CFDE_XMLElement; -class CFDE_XMLNode; +class CFX_XMLElement; +class CFX_XMLNode; class CXFA_LocaleValue; class CXFA_Node; class CXFA_WidgetData; @@ -20,7 +20,7 @@ double XFA_GetFractionalScale(uint32_t idx); int XFA_GetMaxFractionalScale(); bool XFA_FDEExtension_ResolveNamespaceQualifier( - CFDE_XMLElement* pNode, + CFX_XMLElement* pNode, const CFX_WideStringC& wsQualifier, CFX_WideString* wsNamespaceURI); @@ -147,8 +147,8 @@ CXFA_LocaleValue XFA_GetLocaleValue(CXFA_WidgetData* pWidgetData); double XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal); int32_t XFA_MapRotation(int32_t nRotation); -bool XFA_RecognizeRichText(CFDE_XMLElement* pRichTextXMLNode); -void XFA_GetPlainTextFromRichText(CFDE_XMLNode* pXMLNode, +bool XFA_RecognizeRichText(CFX_XMLElement* pRichTextXMLNode); +void XFA_GetPlainTextFromRichText(CFX_XMLNode* pXMLNode, CFX_WideString& wsPlainText); bool XFA_FieldIsMultiListBox(CXFA_Node* pFieldNode); |