From 16280245cab39fe646a97030940771bc105a1115 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Thu, 21 Jul 2016 12:03:47 -0700 Subject: Move xfa_document to cxfa_document This moves the code to match the actual class name. Review-Url: https://codereview.chromium.org/2163133004 --- xfa/fxfa/app/xfa_ffdoc.cpp | 2 +- xfa/fxfa/app/xfa_ffnotify.h | 2 +- xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | 2 +- xfa/fxfa/include/xfa_ffdoc.h | 2 +- xfa/fxfa/include/xfa_ffwidgethandler.h | 2 +- xfa/fxfa/parser/cscript_datawindow.cpp | 2 +- xfa/fxfa/parser/cscript_eventpseudomodel.cpp | 2 +- xfa/fxfa/parser/cscript_hostpseudomodel.cpp | 2 +- xfa/fxfa/parser/cscript_hostpseudomodel.h | 2 +- xfa/fxfa/parser/cscript_layoutpseudomodel.cpp | 2 +- xfa/fxfa/parser/cscript_logpseudomodel.cpp | 2 +- xfa/fxfa/parser/cscript_signaturepseudomodel.cpp | 2 +- xfa/fxfa/parser/cxfa_document.cpp | 427 +++++++++++++++++++++++ xfa/fxfa/parser/cxfa_document.h | 126 +++++++ xfa/fxfa/parser/cxfa_document_parser.cpp | 2 +- xfa/fxfa/parser/cxfa_layoutitem.h | 2 +- xfa/fxfa/parser/cxfa_layoutprocessor.cpp | 2 +- xfa/fxfa/parser/cxfa_node.cpp | 2 +- xfa/fxfa/parser/cxfa_nodehelper.cpp | 2 +- xfa/fxfa/parser/cxfa_nodelist.cpp | 2 +- xfa/fxfa/parser/cxfa_object.cpp | 2 +- xfa/fxfa/parser/cxfa_resolveprocessor.cpp | 2 +- xfa/fxfa/parser/cxfa_scriptcontext.cpp | 2 +- xfa/fxfa/parser/cxfa_scriptcontext.h | 2 +- xfa/fxfa/parser/cxfa_simple_parser.cpp | 2 +- xfa/fxfa/parser/cxfa_widgetdata.cpp | 2 +- xfa/fxfa/parser/xfa_document.h | 126 ------- xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 2 +- xfa/fxfa/parser/xfa_document_imp.cpp | 414 ---------------------- xfa/fxfa/parser/xfa_document_serialize.cpp | 2 +- xfa/fxfa/parser/xfa_layout_appadapter.cpp | 2 +- xfa/fxfa/parser/xfa_layout_itemlayout.cpp | 2 +- xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp | 2 +- xfa/fxfa/parser/xfa_locale.cpp | 2 +- xfa/fxfa/parser/xfa_localemgr.cpp | 2 +- xfa/fxfa/parser/xfa_localevalue.cpp | 2 +- xfa/fxfa/parser/xfa_utils_imp.cpp | 2 +- 37 files changed, 586 insertions(+), 573 deletions(-) create mode 100644 xfa/fxfa/parser/cxfa_document.cpp create mode 100644 xfa/fxfa/parser/cxfa_document.h delete mode 100644 xfa/fxfa/parser/xfa_document.h delete mode 100644 xfa/fxfa/parser/xfa_document_imp.cpp (limited to 'xfa') diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp index 294839152e..6ca1704fc6 100644 --- a/xfa/fxfa/app/xfa_ffdoc.cpp +++ b/xfa/fxfa/app/xfa_ffdoc.cpp @@ -21,7 +21,7 @@ #include "xfa/fxfa/include/xfa_ffdocview.h" #include "xfa/fxfa/include/xfa_ffwidget.h" #include "xfa/fxfa/include/xfa_fontmgr.h" -#include "xfa/fxfa/parser/xfa_document.h" +#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/xfa_document_serialize.h" namespace { diff --git a/xfa/fxfa/app/xfa_ffnotify.h b/xfa/fxfa/app/xfa_ffnotify.h index 322caa3652..07e5419842 100644 --- a/xfa/fxfa/app/xfa_ffnotify.h +++ b/xfa/fxfa/app/xfa_ffnotify.h @@ -8,7 +8,7 @@ #define XFA_FXFA_APP_XFA_FFNOTIFY_H_ #include "xfa/fxfa/include/cxfa_eventparam.h" -#include "xfa/fxfa/parser/xfa_document.h" +#include "xfa/fxfa/parser/cxfa_document.h" class CXFA_FFWidgetHandler; diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index 357fd7e3fe..4afcb32e6f 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -15,8 +15,8 @@ #include "xfa/fgas/localization/fgas_locale.h" #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_program.h" +#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" -#include "xfa/fxfa/parser/xfa_document.h" #include "xfa/fxfa/parser/xfa_localevalue.h" namespace { diff --git a/xfa/fxfa/include/xfa_ffdoc.h b/xfa/fxfa/include/xfa_ffdoc.h index 0f32c4300c..ddbc0049f1 100644 --- a/xfa/fxfa/include/xfa_ffdoc.h +++ b/xfa/fxfa/include/xfa_ffdoc.h @@ -11,8 +11,8 @@ #include #include "xfa/fxfa/include/fxfa.h" +#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_document_parser.h" -#include "xfa/fxfa/parser/xfa_document.h" class CXFA_ChecksumContext; class CXFA_FFApp; diff --git a/xfa/fxfa/include/xfa_ffwidgethandler.h b/xfa/fxfa/include/xfa_ffwidgethandler.h index 1cd28ce2f0..40447f7533 100644 --- a/xfa/fxfa/include/xfa_ffwidgethandler.h +++ b/xfa/fxfa/include/xfa_ffwidgethandler.h @@ -11,7 +11,7 @@ #include "xfa/fxfa/include/cxfa_eventparam.h" #include "xfa/fxfa/include/fxfa.h" -#include "xfa/fxfa/parser/xfa_document.h" +#include "xfa/fxfa/parser/cxfa_document.h" class CXFA_FFDocView; enum class FWL_WidgetHit; diff --git a/xfa/fxfa/parser/cscript_datawindow.cpp b/xfa/fxfa/parser/cscript_datawindow.cpp index 9378b2013c..fbf9704aac 100644 --- a/xfa/fxfa/parser/cscript_datawindow.cpp +++ b/xfa/fxfa/parser/cscript_datawindow.cpp @@ -7,7 +7,7 @@ #include "xfa/fxfa/parser/cscript_datawindow.h" #include "fxjs/include/cfxjse_arguments.h" -#include "xfa/fxfa/parser/xfa_document.h" +#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/cscript_eventpseudomodel.cpp b/xfa/fxfa/parser/cscript_eventpseudomodel.cpp index 16b25862b4..c961164c4d 100644 --- a/xfa/fxfa/parser/cscript_eventpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_eventpseudomodel.cpp @@ -10,8 +10,8 @@ #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/include/cxfa_eventparam.h" #include "xfa/fxfa/include/xfa_ffwidgethandler.h" +#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" -#include "xfa/fxfa/parser/xfa_document.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp index a6487351e6..4448180436 100644 --- a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp @@ -8,9 +8,9 @@ #include "fxjs/include/cfxjse_arguments.h" #include "xfa/fxfa/app/xfa_ffnotify.h" +#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" -#include "xfa/fxfa/parser/xfa_document.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" diff --git a/xfa/fxfa/parser/cscript_hostpseudomodel.h b/xfa/fxfa/parser/cscript_hostpseudomodel.h index f07ba956c5..0cfb4f8a19 100644 --- a/xfa/fxfa/parser/cscript_hostpseudomodel.h +++ b/xfa/fxfa/parser/cscript_hostpseudomodel.h @@ -8,7 +8,7 @@ #define XFA_FXFA_PARSER_CSCRIPT_HOSTPSEUDOMODEL_H_ #include "fxjs/include/cfxjse_arguments.h" -#include "xfa/fxfa/parser/xfa_document.h" +#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/xfa_object.h" class CScript_HostPseudoModel : public CXFA_Object { diff --git a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp index 227a2074f6..492e8d9db9 100644 --- a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp @@ -13,11 +13,11 @@ #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/parser/cxfa_containerlayoutitem.h" #include "xfa/fxfa/parser/cxfa_contentlayoutitem.h" +#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_layoutitem.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" #include "xfa/fxfa/parser/cxfa_measurement.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" -#include "xfa/fxfa/parser/xfa_document.h" #include "xfa/fxfa/parser/xfa_layout_appadapter.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" diff --git a/xfa/fxfa/parser/cscript_logpseudomodel.cpp b/xfa/fxfa/parser/cscript_logpseudomodel.cpp index 247a81d26a..96c61a9e0f 100644 --- a/xfa/fxfa/parser/cscript_logpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_logpseudomodel.cpp @@ -7,7 +7,7 @@ #include "xfa/fxfa/parser/cscript_logpseudomodel.h" #include "fxjs/include/cfxjse_arguments.h" -#include "xfa/fxfa/parser/xfa_document.h" +#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp b/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp index 0e7cf65076..071ae39900 100644 --- a/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp @@ -8,8 +8,8 @@ #include "fxjs/include/cfxjse_arguments.h" #include "xfa/fxfa/app/xfa_ffnotify.h" +#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" -#include "xfa/fxfa/parser/xfa_document.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp new file mode 100644 index 0000000000..346690b484 --- /dev/null +++ b/xfa/fxfa/parser/cxfa_document.cpp @@ -0,0 +1,427 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#include "core/fxcrt/include/fx_ext.h" +#include "xfa/fxfa/app/xfa_ffnotify.h" +#include "xfa/fxfa/parser/cscript_datawindow.h" +#include "xfa/fxfa/parser/cscript_eventpseudomodel.h" +#include "xfa/fxfa/parser/cscript_hostpseudomodel.h" +#include "xfa/fxfa/parser/cscript_layoutpseudomodel.h" +#include "xfa/fxfa/parser/cscript_logpseudomodel.h" +#include "xfa/fxfa/parser/cscript_signaturepseudomodel.h" +#include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_document_parser.h" +#include "xfa/fxfa/parser/cxfa_layoutprocessor.h" +#include "xfa/fxfa/parser/cxfa_scriptcontext.h" +#include "xfa/fxfa/parser/xfa_localemgr.h" +#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/xfa_resolvenode_rs.h" +#include "xfa/fxfa/parser/xfa_utils.h" + +namespace { + +void MergeNodeRecurse(CXFA_Document* pDocument, + CXFA_Node* pDestNodeParent, + CXFA_Node* pProtoNode) { + CXFA_Node* pExistingNode = nullptr; + for (CXFA_Node* pFormChild = + pDestNodeParent->GetNodeItem(XFA_NODEITEM_FirstChild); + pFormChild; + pFormChild = pFormChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { + if (pFormChild->GetElementType() == pProtoNode->GetElementType() && + pFormChild->GetNameHash() == pProtoNode->GetNameHash() && + pFormChild->IsUnusedNode()) { + pFormChild->ClearFlag(XFA_NodeFlag_UnusedNode); + pExistingNode = pFormChild; + break; + } + } + + if (pExistingNode) { + pExistingNode->SetTemplateNode(pProtoNode); + for (CXFA_Node* pTemplateChild = + pProtoNode->GetNodeItem(XFA_NODEITEM_FirstChild); + pTemplateChild; pTemplateChild = pTemplateChild->GetNodeItem( + XFA_NODEITEM_NextSibling)) { + MergeNodeRecurse(pDocument, pExistingNode, pTemplateChild); + } + return; + } + CXFA_Node* pNewNode = pProtoNode->Clone(TRUE); + pNewNode->SetTemplateNode(pProtoNode); + pDestNodeParent->InsertChild(pNewNode, nullptr); +} + +void MergeNode(CXFA_Document* pDocument, + CXFA_Node* pDestNode, + CXFA_Node* pProtoNode) { + { + CXFA_NodeIterator sIterator(pDestNode); + for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; + pNode = sIterator.MoveToNext()) { + pNode->SetFlag(XFA_NodeFlag_UnusedNode, true); + } + } + pDestNode->SetTemplateNode(pProtoNode); + for (CXFA_Node* pTemplateChild = + pProtoNode->GetNodeItem(XFA_NODEITEM_FirstChild); + pTemplateChild; + pTemplateChild = pTemplateChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { + MergeNodeRecurse(pDocument, pDestNode, pTemplateChild); + } + { + CXFA_NodeIterator sIterator(pDestNode); + for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; + pNode = sIterator.MoveToNext()) { + pNode->ClearFlag(XFA_NodeFlag_UnusedNode); + } + } +} + +} // namespace + +CXFA_Document::CXFA_Document(CXFA_DocumentParser* pParser) + : m_pParser(pParser), + m_pScriptContext(nullptr), + m_pLayoutProcessor(nullptr), + m_pRootNode(nullptr), + m_pLocalMgr(nullptr), + m_pScriptDataWindow(nullptr), + m_pScriptEvent(nullptr), + m_pScriptHost(nullptr), + m_pScriptLog(nullptr), + m_pScriptLayout(nullptr), + m_pScriptSignature(nullptr), + m_eCurVersionMode(XFA_VERSION_DEFAULT), + m_dwDocFlags(0) { + ASSERT(m_pParser); +} + +CXFA_Document::~CXFA_Document() { + delete m_pRootNode; + PurgeNodes(); +} + +void CXFA_Document::ClearLayoutData() { + delete m_pLayoutProcessor; + m_pLayoutProcessor = nullptr; + delete m_pScriptContext; + m_pScriptContext = nullptr; + delete m_pLocalMgr; + m_pLocalMgr = nullptr; + delete m_pScriptDataWindow; + m_pScriptDataWindow = nullptr; + delete m_pScriptEvent; + m_pScriptEvent = nullptr; + delete m_pScriptHost; + m_pScriptHost = nullptr; + delete m_pScriptLog; + m_pScriptLog = nullptr; + delete m_pScriptLayout; + m_pScriptLayout = nullptr; + delete m_pScriptSignature; + m_pScriptSignature = nullptr; +} + +void CXFA_Document::SetRoot(CXFA_Node* pNewRoot) { + if (m_pRootNode) + AddPurgeNode(m_pRootNode); + + m_pRootNode = pNewRoot; + RemovePurgeNode(pNewRoot); +} + +CFDE_XMLDoc* CXFA_Document::GetXMLDoc() const { + return m_pParser->GetXMLDoc(); +} + +CXFA_FFNotify* CXFA_Document::GetNotify() const { + return m_pParser->GetNotify(); +} + +CXFA_Object* CXFA_Document::GetXFAObject(XFA_HashCode dwNodeNameHash) { + switch (dwNodeNameHash) { + case XFA_HASHCODE_Data: { + CXFA_Node* pDatasetsNode = ToNode(GetXFAObject(XFA_HASHCODE_Datasets)); + if (!pDatasetsNode) + return nullptr; + + for (CXFA_Node* pDatasetsChild = + pDatasetsNode->GetFirstChildByClass(XFA_Element::DataGroup); + pDatasetsChild; + pDatasetsChild = pDatasetsChild->GetNextSameClassSibling( + XFA_Element::DataGroup)) { + if (pDatasetsChild->GetNameHash() != XFA_HASHCODE_Data) + continue; + + CFX_WideString wsNamespaceURI; + if (!pDatasetsChild->TryNamespace(wsNamespaceURI)) + continue; + + CFX_WideString wsDatasetsURI; + if (!pDatasetsNode->TryNamespace(wsDatasetsURI)) + continue; + if (wsNamespaceURI == wsDatasetsURI) + return pDatasetsChild; + } + return nullptr; + } + case XFA_HASHCODE_Record: { + CXFA_Node* pData = ToNode(GetXFAObject(XFA_HASHCODE_Data)); + return pData ? pData->GetFirstChildByClass(XFA_Element::DataGroup) + : nullptr; + } + case XFA_HASHCODE_DataWindow: { + if (!m_pScriptDataWindow) + m_pScriptDataWindow = new CScript_DataWindow(this); + return m_pScriptDataWindow; + } + case XFA_HASHCODE_Event: { + if (!m_pScriptEvent) + m_pScriptEvent = new CScript_EventPseudoModel(this); + return m_pScriptEvent; + } + case XFA_HASHCODE_Host: { + if (!m_pScriptHost) + m_pScriptHost = new CScript_HostPseudoModel(this); + return m_pScriptHost; + } + case XFA_HASHCODE_Log: { + if (!m_pScriptLog) + m_pScriptLog = new CScript_LogPseudoModel(this); + return m_pScriptLog; + } + case XFA_HASHCODE_Signature: { + if (!m_pScriptSignature) + m_pScriptSignature = new CScript_SignaturePseudoModel(this); + return m_pScriptSignature; + } + case XFA_HASHCODE_Layout: { + if (!m_pScriptLayout) + m_pScriptLayout = new CScript_LayoutPseudoModel(this); + return m_pScriptLayout; + } + default: + return m_pRootNode->GetFirstChildByName(dwNodeNameHash); + } +} + +CXFA_Node* CXFA_Document::CreateNode(uint32_t dwPacket, XFA_Element eElement) { + return CreateNode(XFA_GetPacketByID(dwPacket), eElement); +} + +CXFA_Node* CXFA_Document::CreateNode(const XFA_PACKETINFO* pPacket, + XFA_Element eElement) { + if (!pPacket) + return nullptr; + + const XFA_ELEMENTINFO* pElement = XFA_GetElementByID(eElement); + if (pElement && (pElement->dwPackets & pPacket->eName)) { + CXFA_Node* pNode = + new CXFA_Node(this, pPacket->eName, pElement->eObjectType, + pElement->eName, pElement->pName); + AddPurgeNode(pNode); + return pNode; + } + + return nullptr; +} + +void CXFA_Document::AddPurgeNode(CXFA_Node* pNode) { + m_PurgeNodes.insert(pNode); +} + +FX_BOOL CXFA_Document::RemovePurgeNode(CXFA_Node* pNode) { + return !!m_PurgeNodes.erase(pNode); +} + +void CXFA_Document::PurgeNodes() { + for (CXFA_Node* pNode : m_PurgeNodes) + delete pNode; + + m_PurgeNodes.clear(); +} + +void CXFA_Document::SetFlag(uint32_t dwFlag, FX_BOOL bOn) { + if (bOn) + m_dwDocFlags |= dwFlag; + else + m_dwDocFlags &= ~dwFlag; +} + +FX_BOOL CXFA_Document::IsInteractive() { + if (m_dwDocFlags & XFA_DOCFLAG_HasInteractive) + return !!(m_dwDocFlags & XFA_DOCFLAG_Interactive); + + CXFA_Node* pConfig = ToNode(GetXFAObject(XFA_HASHCODE_Config)); + if (!pConfig) + return FALSE; + + CFX_WideString wsInteractive; + CXFA_Node* pPresent = pConfig->GetFirstChildByClass(XFA_Element::Present); + if (!pPresent) + return FALSE; + + CXFA_Node* pPDF = pPresent->GetFirstChildByClass(XFA_Element::Pdf); + if (!pPDF) + return FALSE; + + CXFA_Node* pInteractive = pPDF->GetChild(0, XFA_Element::Interactive); + if (pInteractive) { + m_dwDocFlags |= XFA_DOCFLAG_HasInteractive; + if (pInteractive->TryContent(wsInteractive) && + wsInteractive == FX_WSTRC(L"1")) { + m_dwDocFlags |= XFA_DOCFLAG_Interactive; + return TRUE; + } + } + return FALSE; +} + +CXFA_LocaleMgr* CXFA_Document::GetLocalMgr() { + if (!m_pLocalMgr) { + CFX_WideString wsLanguage; + GetNotify()->GetAppProvider()->GetLanguage(wsLanguage); + m_pLocalMgr = new CXFA_LocaleMgr( + ToNode(GetXFAObject(XFA_HASHCODE_LocaleSet)), wsLanguage); + } + return m_pLocalMgr; +} + +CXFA_ScriptContext* CXFA_Document::InitScriptContext(v8::Isolate* pIsolate) { + if (!m_pScriptContext) + m_pScriptContext = new CXFA_ScriptContext(this); + m_pScriptContext->Initialize(pIsolate); + return m_pScriptContext; +} + +CXFA_ScriptContext* CXFA_Document::GetScriptContext() { + if (!m_pScriptContext) + m_pScriptContext = new CXFA_ScriptContext(this); + return m_pScriptContext; +} + +XFA_VERSION CXFA_Document::RecognizeXFAVersionNumber( + CFX_WideString& wsTemplateNS) { + CFX_WideStringC wsTemplateURIPrefix = + XFA_GetPacketByIndex(XFA_PACKET_Template)->pURI; + FX_STRSIZE nPrefixLength = wsTemplateURIPrefix.GetLength(); + if (CFX_WideStringC(wsTemplateNS.c_str(), wsTemplateNS.GetLength()) != + wsTemplateURIPrefix) { + return XFA_VERSION_UNKNOWN; + } + FX_STRSIZE nDotPos = wsTemplateNS.Find('.', nPrefixLength); + if (nDotPos == (FX_STRSIZE)-1) + return XFA_VERSION_UNKNOWN; + + int8_t iMajor = FXSYS_wtoi( + wsTemplateNS.Mid(nPrefixLength, nDotPos - nPrefixLength).c_str()); + int8_t iMinor = FXSYS_wtoi( + wsTemplateNS.Mid(nDotPos + 1, wsTemplateNS.GetLength() - nDotPos - 2) + .c_str()); + XFA_VERSION eVersion = (XFA_VERSION)((int32_t)iMajor * 100 + iMinor); + if (eVersion < XFA_VERSION_MIN || eVersion > XFA_VERSION_MAX) + return XFA_VERSION_UNKNOWN; + + m_eCurVersionMode = eVersion; + return eVersion; +} + +CXFA_Node* CXFA_Document::GetNodeByID(CXFA_Node* pRoot, + const CFX_WideStringC& wsID) { + if (!pRoot || wsID.IsEmpty()) + return nullptr; + + CXFA_NodeIterator sIterator(pRoot); + for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; + pNode = sIterator.MoveToNext()) { + CFX_WideStringC wsIDVal; + if (pNode->TryCData(XFA_ATTRIBUTE_Id, wsIDVal) && !wsIDVal.IsEmpty()) { + if (wsIDVal == wsID) + return pNode; + } + } + return nullptr; +} + +void CXFA_Document::DoProtoMerge() { + CXFA_Node* pTemplateRoot = ToNode(GetXFAObject(XFA_HASHCODE_Template)); + if (!pTemplateRoot) + return; + + CFX_MapPtrTemplate mIDMap; + CXFA_NodeSet sUseNodes; + CXFA_NodeIterator sIterator(pTemplateRoot); + for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; + pNode = sIterator.MoveToNext()) { + CFX_WideStringC wsIDVal; + if (pNode->TryCData(XFA_ATTRIBUTE_Id, wsIDVal) && !wsIDVal.IsEmpty()) { + mIDMap[FX_HashCode_GetW(wsIDVal, false)] = pNode; + } + CFX_WideStringC wsUseVal; + if (pNode->TryCData(XFA_ATTRIBUTE_Use, wsUseVal) && !wsUseVal.IsEmpty()) { + sUseNodes.insert(pNode); + } else if (pNode->TryCData(XFA_ATTRIBUTE_Usehref, wsUseVal) && + !wsUseVal.IsEmpty()) { + sUseNodes.insert(pNode); + } + } + + for (CXFA_Node* pUseHrefNode : sUseNodes) { + CFX_WideString wsUseVal; + CFX_WideStringC wsURI, wsID, wsSOM; + if (pUseHrefNode->TryCData(XFA_ATTRIBUTE_Usehref, wsUseVal) && + !wsUseVal.IsEmpty()) { + FX_STRSIZE uSharpPos = wsUseVal.Find('#'); + if (uSharpPos < 0) { + wsURI = wsUseVal.AsStringC(); + } else { + wsURI = CFX_WideStringC(wsUseVal.c_str(), uSharpPos); + FX_STRSIZE uLen = wsUseVal.GetLength(); + if (uLen >= uSharpPos + 5 && + CFX_WideStringC(wsUseVal.c_str() + uSharpPos, 5) == + FX_WSTRC(L"#som(") && + wsUseVal[uLen - 1] == ')') { + wsSOM = CFX_WideStringC(wsUseVal.c_str() + uSharpPos + 5, + uLen - 1 - uSharpPos - 5); + } else { + wsID = CFX_WideStringC(wsUseVal.c_str() + uSharpPos + 1, + uLen - uSharpPos - 1); + } + } + } else if (pUseHrefNode->TryCData(XFA_ATTRIBUTE_Use, wsUseVal) && + !wsUseVal.IsEmpty()) { + if (wsUseVal[0] == '#') + wsID = CFX_WideStringC(wsUseVal.c_str() + 1, wsUseVal.GetLength() - 1); + else + wsSOM = CFX_WideStringC(wsUseVal.c_str(), wsUseVal.GetLength()); + } + + if (!wsURI.IsEmpty() && wsURI != FX_WSTRC(L".")) + continue; + + CXFA_Node* pProtoNode = nullptr; + if (!wsSOM.IsEmpty()) { + uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | + XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | + XFA_RESOLVENODE_Siblings; + XFA_RESOLVENODE_RS resoveNodeRS; + int32_t iRet = m_pScriptContext->ResolveObjects(pUseHrefNode, wsSOM, + resoveNodeRS, dwFlag); + if (iRet > 0 && resoveNodeRS.nodes[0]->IsNode()) { + pProtoNode = resoveNodeRS.nodes[0]->AsNode(); + } + } else if (!wsID.IsEmpty()) { + if (!mIDMap.Lookup(FX_HashCode_GetW(wsID, false), pProtoNode)) { + continue; + } + } + if (!pProtoNode) + continue; + + MergeNode(this, pUseHrefNode, pProtoNode); + } +} diff --git a/xfa/fxfa/parser/cxfa_document.h b/xfa/fxfa/parser/cxfa_document.h new file mode 100644 index 0000000000..8258ab1dad --- /dev/null +++ b/xfa/fxfa/parser/cxfa_document.h @@ -0,0 +1,126 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef XFA_FXFA_PARSER_CXFA_DOCUMENT_H_ +#define XFA_FXFA_PARSER_CXFA_DOCUMENT_H_ + +#include "xfa/fxfa/include/fxfa.h" +#include "xfa/fxfa/parser/xfa_localemgr.h" +#include "xfa/fxfa/parser/xfa_object.h" + +enum XFA_VERSION { + XFA_VERSION_UNKNOWN = 0, + XFA_VERSION_200 = 200, + XFA_VERSION_202 = 202, + XFA_VERSION_204 = 204, + XFA_VERSION_205 = 205, + XFA_VERSION_206 = 206, + XFA_VERSION_207 = 207, + XFA_VERSION_208 = 208, + XFA_VERSION_300 = 300, + XFA_VERSION_301 = 301, + XFA_VERSION_303 = 303, + XFA_VERSION_306 = 306, + XFA_VERSION_DEFAULT = XFA_VERSION_303, + XFA_VERSION_MIN = 200, + XFA_VERSION_MAX = 400, +}; + +enum XFA_DocFlag { + XFA_DOCFLAG_StrictScoping = 0x0001, + XFA_DOCFLAG_HasInteractive = 0x0002, + XFA_DOCFLAG_Interactive = 0x0004, + XFA_DOCFLAG_Scripting = 0x0008 +}; + +class CFDE_XMLDoc; +class CScript_DataWindow; +class CScript_EventPseudoModel; +class CScript_HostPseudoModel; +class CScript_LogPseudoModel; +class CScript_LayoutPseudoModel; +class CScript_SignaturePseudoModel; +class CXFA_Document; +class CXFA_LayoutItem; +class CXFA_LayoutProcessor; +class CXFA_Node; +class CXFA_LayoutProcessor; +class CXFA_DocumentParser; +class CXFA_ContainerLayoutItem; +class CXFA_FFNotify; +class CXFA_ScriptContext; + +class CXFA_Document { + public: + explicit CXFA_Document(CXFA_DocumentParser* pParser); + ~CXFA_Document(); + + CXFA_ScriptContext* InitScriptContext(v8::Isolate* pIsolate); + + CXFA_Node* GetRoot() const { return m_pRootNode; } + + CFDE_XMLDoc* GetXMLDoc() const; + CXFA_FFNotify* GetNotify() const; + CXFA_LocaleMgr* GetLocalMgr(); + CXFA_Object* GetXFAObject(XFA_HashCode wsNodeNameHash); + CXFA_Node* GetNodeByID(CXFA_Node* pRoot, const CFX_WideStringC& wsID); + CXFA_Node* GetNotBindNode(CXFA_ObjArray& arrayNodes); + CXFA_LayoutProcessor* GetLayoutProcessor(); + CXFA_LayoutProcessor* GetDocLayout(); + CXFA_ScriptContext* GetScriptContext(); + + void SetRoot(CXFA_Node* pNewRoot); + + void AddPurgeNode(CXFA_Node* pNode); + FX_BOOL RemovePurgeNode(CXFA_Node* pNode); + void PurgeNodes(); + + bool HasFlag(uint32_t dwFlag) { return (m_dwDocFlags & dwFlag) == dwFlag; } + void SetFlag(uint32_t dwFlag, FX_BOOL bOn); + + FX_BOOL IsInteractive(); + XFA_VERSION GetCurVersionMode() { return m_eCurVersionMode; } + XFA_VERSION RecognizeXFAVersionNumber(CFX_WideString& wsTemplateNS); + + CXFA_Node* CreateNode(uint32_t dwPacket, XFA_Element eElement); + CXFA_Node* CreateNode(const XFA_PACKETINFO* pPacket, XFA_Element eElement); + + void DoProtoMerge(); + void DoDataMerge(); + void DoDataRemerge(FX_BOOL bDoDataMerge); + CXFA_Node* DataMerge_CopyContainer(CXFA_Node* pTemplateNode, + CXFA_Node* pFormNode, + CXFA_Node* pDataScope, + FX_BOOL bOneInstance, + FX_BOOL bDataMerge, + FX_BOOL bUpLevel); + void DataMerge_UpdateBindingRelations(CXFA_Node* pFormUpdateRoot); + + void ClearLayoutData(); + + CFX_MapPtrTemplate m_rgGlobalBinding; + CXFA_NodeArray m_pPendingPageSet; + + protected: + friend class CXFA_SimpleParser; + + CXFA_DocumentParser* m_pParser; + CXFA_ScriptContext* m_pScriptContext; + CXFA_LayoutProcessor* m_pLayoutProcessor; + CXFA_Node* m_pRootNode; + CXFA_LocaleMgr* m_pLocalMgr; + CScript_DataWindow* m_pScriptDataWindow; + CScript_EventPseudoModel* m_pScriptEvent; + CScript_HostPseudoModel* m_pScriptHost; + CScript_LogPseudoModel* m_pScriptLog; + CScript_LayoutPseudoModel* m_pScriptLayout; + CScript_SignaturePseudoModel* m_pScriptSignature; + CXFA_NodeSet m_PurgeNodes; + XFA_VERSION m_eCurVersionMode; + uint32_t m_dwDocFlags; +}; + +#endif // XFA_FXFA_PARSER_CXFA_DOCUMENT_H_ diff --git a/xfa/fxfa/parser/cxfa_document_parser.cpp b/xfa/fxfa/parser/cxfa_document_parser.cpp index ff54fb3d87..daf5221489 100644 --- a/xfa/fxfa/parser/cxfa_document_parser.cpp +++ b/xfa/fxfa/parser/cxfa_document_parser.cpp @@ -7,7 +7,7 @@ #include "xfa/fxfa/parser/cxfa_document_parser.h" #include "xfa/fxfa/include/fxfa.h" -#include "xfa/fxfa/parser/xfa_document.h" +#include "xfa/fxfa/parser/cxfa_document.h" CXFA_DocumentParser::CXFA_DocumentParser(CXFA_FFNotify* pNotify) : m_nodeParser(nullptr, TRUE), m_pNotify(pNotify) {} diff --git a/xfa/fxfa/parser/cxfa_layoutitem.h b/xfa/fxfa/parser/cxfa_layoutitem.h index 785272bd86..c8b29811e8 100644 --- a/xfa/fxfa/parser/cxfa_layoutitem.h +++ b/xfa/fxfa/parser/cxfa_layoutitem.h @@ -7,7 +7,7 @@ #ifndef XFA_FXFA_PARSER_CXFA_LAYOUTITEM_H_ #define XFA_FXFA_PARSER_CXFA_LAYOUTITEM_H_ -#include "xfa/fxfa/parser/xfa_document.h" +#include "xfa/fxfa/parser/cxfa_document.h" class CXFA_ContainerLayoutItem; class CXFA_ContentLayoutItem; diff --git a/xfa/fxfa/parser/cxfa_layoutprocessor.cpp b/xfa/fxfa/parser/cxfa_layoutprocessor.cpp index 7ebe5285e3..89ea0ce5bb 100644 --- a/xfa/fxfa/parser/cxfa_layoutprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_layoutprocessor.cpp @@ -6,8 +6,8 @@ #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" +#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_measurement.h" -#include "xfa/fxfa/parser/xfa_document.h" #include "xfa/fxfa/parser/xfa_document_datamerger_imp.h" #include "xfa/fxfa/parser/xfa_layout_appadapter.h" #include "xfa/fxfa/parser/xfa_layout_itemlayout.h" diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index 800ada43fb..fd185771aa 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -17,13 +17,13 @@ #include "xfa/fgas/crt/fgas_system.h" #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/include/cxfa_eventparam.h" +#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" #include "xfa/fxfa/parser/cxfa_measurement.h" #include "xfa/fxfa/parser/cxfa_occur.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" #include "xfa/fxfa/parser/cxfa_simple_parser.h" #include "xfa/fxfa/parser/xfa_basic_data.h" -#include "xfa/fxfa/parser/xfa_document.h" namespace { diff --git a/xfa/fxfa/parser/cxfa_nodehelper.cpp b/xfa/fxfa/parser/cxfa_nodehelper.cpp index f5b4c04655..4fc6830a73 100644 --- a/xfa/fxfa/parser/cxfa_nodehelper.cpp +++ b/xfa/fxfa/parser/cxfa_nodehelper.cpp @@ -7,8 +7,8 @@ #include "xfa/fxfa/parser/cxfa_nodehelper.h" #include "core/fxcrt/include/fx_ext.h" +#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" -#include "xfa/fxfa/parser/xfa_document.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" diff --git a/xfa/fxfa/parser/cxfa_nodelist.cpp b/xfa/fxfa/parser/cxfa_nodelist.cpp index 61e5091c56..86575e6b3f 100644 --- a/xfa/fxfa/parser/cxfa_nodelist.cpp +++ b/xfa/fxfa/parser/cxfa_nodelist.cpp @@ -7,8 +7,8 @@ #include "xfa/fxfa/parser/xfa_object.h" #include "core/fxcrt/include/fx_ext.h" +#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" -#include "xfa/fxfa/parser/xfa_document.h" CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument) : CXFA_Object(pDocument, diff --git a/xfa/fxfa/parser/cxfa_object.cpp b/xfa/fxfa/parser/cxfa_object.cpp index fd553dd096..78f39ee6bc 100644 --- a/xfa/fxfa/parser/cxfa_object.cpp +++ b/xfa/fxfa/parser/cxfa_object.cpp @@ -9,7 +9,7 @@ #include "core/fxcrt/include/fx_ext.h" #include "fxjs/include/cfxjse_value.h" #include "xfa/fxfa/app/xfa_ffnotify.h" -#include "xfa/fxfa/parser/xfa_document.h" +#include "xfa/fxfa/parser/cxfa_document.h" CXFA_Object::CXFA_Object(CXFA_Document* pDocument, XFA_ObjectType objectType, diff --git a/xfa/fxfa/parser/cxfa_resolveprocessor.cpp b/xfa/fxfa/parser/cxfa_resolveprocessor.cpp index 578c2dc651..2a281f9c4b 100644 --- a/xfa/fxfa/parser/cxfa_resolveprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_resolveprocessor.cpp @@ -7,9 +7,9 @@ #include "xfa/fxfa/parser/cxfa_resolveprocessor.h" #include "core/fxcrt/include/fx_ext.h" +#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_nodehelper.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" -#include "xfa/fxfa/parser/xfa_document.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.cpp b/xfa/fxfa/parser/cxfa_scriptcontext.cpp index 24c3e503ce..e91e350d32 100644 --- a/xfa/fxfa/parser/cxfa_scriptcontext.cpp +++ b/xfa/fxfa/parser/cxfa_scriptcontext.cpp @@ -12,10 +12,10 @@ #include "fxjs/include/cfxjse_value.h" #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/include/cxfa_eventparam.h" +#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_nodehelper.h" #include "xfa/fxfa/parser/cxfa_resolveprocessor.h" #include "xfa/fxfa/parser/xfa_basic_data.h" -#include "xfa/fxfa/parser/xfa_document.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.h b/xfa/fxfa/parser/cxfa_scriptcontext.h index f06279024c..a6737e6125 100644 --- a/xfa/fxfa/parser/cxfa_scriptcontext.h +++ b/xfa/fxfa/parser/cxfa_scriptcontext.h @@ -14,7 +14,7 @@ #include "fxjs/include/cfxjse_arguments.h" #include "xfa/fxfa/fm2js/xfa_fm2jscontext.h" #include "xfa/fxfa/include/cxfa_eventparam.h" -#include "xfa/fxfa/parser/xfa_document.h" +#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" #define XFA_RESOLVENODE_TagName 0x0002 diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_simple_parser.cpp index 043c56a270..1a773d621b 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser.cpp +++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp @@ -10,10 +10,10 @@ #include "xfa/fgas/crt/fgas_codepage.h" #include "xfa/fxfa/include/fxfa.h" #include "xfa/fxfa/include/xfa_checksum.h" +#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_widetextread.h" #include "xfa/fxfa/parser/cxfa_xml_parser.h" #include "xfa/fxfa/parser/xfa_basic_data.h" -#include "xfa/fxfa/parser/xfa_document.h" #include "xfa/fxfa/parser/xfa_utils.h" namespace { diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index ae3fecea2c..07f0ebb04d 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -9,9 +9,9 @@ #include "core/fxcrt/include/fx_ext.h" #include "xfa/fxbarcode/include/BC_Library.h" #include "xfa/fxfa/app/xfa_ffnotify.h" +#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_event.h" #include "xfa/fxfa/parser/cxfa_measurement.h" -#include "xfa/fxfa/parser/xfa_document.h" #include "xfa/fxfa/parser/xfa_localevalue.h" #include "xfa/fxfa/parser/xfa_object.h" diff --git a/xfa/fxfa/parser/xfa_document.h b/xfa/fxfa/parser/xfa_document.h deleted file mode 100644 index fbc027a8d4..0000000000 --- a/xfa/fxfa/parser/xfa_document.h +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FXFA_PARSER_XFA_DOCUMENT_H_ -#define XFA_FXFA_PARSER_XFA_DOCUMENT_H_ - -#include "xfa/fxfa/include/fxfa.h" -#include "xfa/fxfa/parser/xfa_localemgr.h" -#include "xfa/fxfa/parser/xfa_object.h" - -enum XFA_VERSION { - XFA_VERSION_UNKNOWN = 0, - XFA_VERSION_200 = 200, - XFA_VERSION_202 = 202, - XFA_VERSION_204 = 204, - XFA_VERSION_205 = 205, - XFA_VERSION_206 = 206, - XFA_VERSION_207 = 207, - XFA_VERSION_208 = 208, - XFA_VERSION_300 = 300, - XFA_VERSION_301 = 301, - XFA_VERSION_303 = 303, - XFA_VERSION_306 = 306, - XFA_VERSION_DEFAULT = XFA_VERSION_303, - XFA_VERSION_MIN = 200, - XFA_VERSION_MAX = 400, -}; - -enum XFA_DocFlag { - XFA_DOCFLAG_StrictScoping = 0x0001, - XFA_DOCFLAG_HasInteractive = 0x0002, - XFA_DOCFLAG_Interactive = 0x0004, - XFA_DOCFLAG_Scripting = 0x0008 -}; - -class CFDE_XMLDoc; -class CScript_DataWindow; -class CScript_EventPseudoModel; -class CScript_HostPseudoModel; -class CScript_LogPseudoModel; -class CScript_LayoutPseudoModel; -class CScript_SignaturePseudoModel; -class CXFA_Document; -class CXFA_LayoutItem; -class CXFA_LayoutProcessor; -class CXFA_Node; -class CXFA_LayoutProcessor; -class CXFA_DocumentParser; -class CXFA_ContainerLayoutItem; -class CXFA_FFNotify; -class CXFA_ScriptContext; - -class CXFA_Document { - public: - explicit CXFA_Document(CXFA_DocumentParser* pParser); - ~CXFA_Document(); - - CXFA_ScriptContext* InitScriptContext(v8::Isolate* pIsolate); - - CXFA_Node* GetRoot() const { return m_pRootNode; } - - CFDE_XMLDoc* GetXMLDoc() const; - CXFA_FFNotify* GetNotify() const; - CXFA_LocaleMgr* GetLocalMgr(); - CXFA_Object* GetXFAObject(XFA_HashCode wsNodeNameHash); - CXFA_Node* GetNodeByID(CXFA_Node* pRoot, const CFX_WideStringC& wsID); - CXFA_Node* GetNotBindNode(CXFA_ObjArray& arrayNodes); - CXFA_LayoutProcessor* GetLayoutProcessor(); - CXFA_LayoutProcessor* GetDocLayout(); - CXFA_ScriptContext* GetScriptContext(); - - void SetRoot(CXFA_Node* pNewRoot); - - void AddPurgeNode(CXFA_Node* pNode); - FX_BOOL RemovePurgeNode(CXFA_Node* pNode); - void PurgeNodes(); - - bool HasFlag(uint32_t dwFlag) { return (m_dwDocFlags & dwFlag) == dwFlag; } - void SetFlag(uint32_t dwFlag, FX_BOOL bOn); - - FX_BOOL IsInteractive(); - XFA_VERSION GetCurVersionMode() { return m_eCurVersionMode; } - XFA_VERSION RecognizeXFAVersionNumber(CFX_WideString& wsTemplateNS); - - CXFA_Node* CreateNode(uint32_t dwPacket, XFA_Element eElement); - CXFA_Node* CreateNode(const XFA_PACKETINFO* pPacket, XFA_Element eElement); - - void DoProtoMerge(); - void DoDataMerge(); - void DoDataRemerge(FX_BOOL bDoDataMerge); - CXFA_Node* DataMerge_CopyContainer(CXFA_Node* pTemplateNode, - CXFA_Node* pFormNode, - CXFA_Node* pDataScope, - FX_BOOL bOneInstance, - FX_BOOL bDataMerge, - FX_BOOL bUpLevel); - void DataMerge_UpdateBindingRelations(CXFA_Node* pFormUpdateRoot); - - void ClearLayoutData(); - - CFX_MapPtrTemplate m_rgGlobalBinding; - CXFA_NodeArray m_pPendingPageSet; - - protected: - friend class CXFA_SimpleParser; - - CXFA_DocumentParser* m_pParser; - CXFA_ScriptContext* m_pScriptContext; - CXFA_LayoutProcessor* m_pLayoutProcessor; - CXFA_Node* m_pRootNode; - CXFA_LocaleMgr* m_pLocalMgr; - CScript_DataWindow* m_pScriptDataWindow; - CScript_EventPseudoModel* m_pScriptEvent; - CScript_HostPseudoModel* m_pScriptHost; - CScript_LogPseudoModel* m_pScriptLog; - CScript_LayoutPseudoModel* m_pScriptLayout; - CScript_SignaturePseudoModel* m_pScriptSignature; - CXFA_NodeSet m_PurgeNodes; - XFA_VERSION m_eCurVersionMode; - uint32_t m_dwDocFlags; -}; - -#endif // XFA_FXFA_PARSER_XFA_DOCUMENT_H_ diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index 19b0698662..11a44b917d 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -8,10 +8,10 @@ #include "core/fxcrt/include/fx_ext.h" #include "xfa/fde/xml/fde_xml_imp.h" +#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" #include "xfa/fxfa/parser/cxfa_occur.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" -#include "xfa/fxfa/parser/xfa_document.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" diff --git a/xfa/fxfa/parser/xfa_document_imp.cpp b/xfa/fxfa/parser/xfa_document_imp.cpp deleted file mode 100644 index 633e2e2209..0000000000 --- a/xfa/fxfa/parser/xfa_document_imp.cpp +++ /dev/null @@ -1,414 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "core/fxcrt/include/fx_ext.h" -#include "xfa/fxfa/app/xfa_ffnotify.h" -#include "xfa/fxfa/parser/cscript_datawindow.h" -#include "xfa/fxfa/parser/cscript_eventpseudomodel.h" -#include "xfa/fxfa/parser/cscript_hostpseudomodel.h" -#include "xfa/fxfa/parser/cscript_layoutpseudomodel.h" -#include "xfa/fxfa/parser/cscript_logpseudomodel.h" -#include "xfa/fxfa/parser/cscript_signaturepseudomodel.h" -#include "xfa/fxfa/parser/cxfa_document_parser.h" -#include "xfa/fxfa/parser/cxfa_layoutprocessor.h" -#include "xfa/fxfa/parser/cxfa_scriptcontext.h" -#include "xfa/fxfa/parser/xfa_document.h" -#include "xfa/fxfa/parser/xfa_localemgr.h" -#include "xfa/fxfa/parser/xfa_object.h" -#include "xfa/fxfa/parser/xfa_resolvenode_rs.h" -#include "xfa/fxfa/parser/xfa_utils.h" - -CXFA_Document::CXFA_Document(CXFA_DocumentParser* pParser) - : m_pParser(pParser), - m_pScriptContext(nullptr), - m_pLayoutProcessor(nullptr), - m_pRootNode(nullptr), - m_pLocalMgr(nullptr), - m_pScriptDataWindow(nullptr), - m_pScriptEvent(nullptr), - m_pScriptHost(nullptr), - m_pScriptLog(nullptr), - m_pScriptLayout(nullptr), - m_pScriptSignature(nullptr), - m_eCurVersionMode(XFA_VERSION_DEFAULT), - m_dwDocFlags(0) { - ASSERT(m_pParser); -} -CXFA_Document::~CXFA_Document() { - delete m_pRootNode; - PurgeNodes(); -} - -void CXFA_Document::ClearLayoutData() { - delete m_pLayoutProcessor; - m_pLayoutProcessor = nullptr; - delete m_pScriptContext; - m_pScriptContext = nullptr; - delete m_pLocalMgr; - m_pLocalMgr = nullptr; - delete m_pScriptDataWindow; - m_pScriptDataWindow = nullptr; - delete m_pScriptEvent; - m_pScriptEvent = nullptr; - delete m_pScriptHost; - m_pScriptHost = nullptr; - delete m_pScriptLog; - m_pScriptLog = nullptr; - delete m_pScriptLayout; - m_pScriptLayout = nullptr; - delete m_pScriptSignature; - m_pScriptSignature = nullptr; -} - -void CXFA_Document::SetRoot(CXFA_Node* pNewRoot) { - if (m_pRootNode) { - AddPurgeNode(m_pRootNode); - } - m_pRootNode = pNewRoot; - RemovePurgeNode(pNewRoot); -} - -CFDE_XMLDoc* CXFA_Document::GetXMLDoc() const { - return m_pParser->GetXMLDoc(); -} - -CXFA_FFNotify* CXFA_Document::GetNotify() const { - return m_pParser->GetNotify(); -} - -CXFA_Object* CXFA_Document::GetXFAObject(XFA_HashCode dwNodeNameHash) { - switch (dwNodeNameHash) { - case XFA_HASHCODE_Data: { - CXFA_Node* pDatasetsNode = ToNode(GetXFAObject(XFA_HASHCODE_Datasets)); - if (!pDatasetsNode) { - return nullptr; - } - for (CXFA_Node* pDatasetsChild = - pDatasetsNode->GetFirstChildByClass(XFA_Element::DataGroup); - pDatasetsChild; - pDatasetsChild = pDatasetsChild->GetNextSameClassSibling( - XFA_Element::DataGroup)) { - if (pDatasetsChild->GetNameHash() != XFA_HASHCODE_Data) { - continue; - } - CFX_WideString wsNamespaceURI; - if (!pDatasetsChild->TryNamespace(wsNamespaceURI)) { - continue; - } - CFX_WideString wsDatasetsURI; - if (!pDatasetsNode->TryNamespace(wsDatasetsURI)) { - continue; - } - if (wsNamespaceURI == wsDatasetsURI) { - return pDatasetsChild; - } - } - return nullptr; - } - case XFA_HASHCODE_Record: { - CXFA_Node* pData = ToNode(GetXFAObject(XFA_HASHCODE_Data)); - return pData ? pData->GetFirstChildByClass(XFA_Element::DataGroup) - : nullptr; - } - case XFA_HASHCODE_DataWindow: { - if (!m_pScriptDataWindow) - m_pScriptDataWindow = new CScript_DataWindow(this); - return m_pScriptDataWindow; - } - case XFA_HASHCODE_Event: { - if (!m_pScriptEvent) - m_pScriptEvent = new CScript_EventPseudoModel(this); - return m_pScriptEvent; - } - case XFA_HASHCODE_Host: { - if (!m_pScriptHost) - m_pScriptHost = new CScript_HostPseudoModel(this); - return m_pScriptHost; - } - case XFA_HASHCODE_Log: { - if (!m_pScriptLog) - m_pScriptLog = new CScript_LogPseudoModel(this); - return m_pScriptLog; - } - case XFA_HASHCODE_Signature: { - if (!m_pScriptSignature) - m_pScriptSignature = new CScript_SignaturePseudoModel(this); - return m_pScriptSignature; - } - case XFA_HASHCODE_Layout: { - if (!m_pScriptLayout) - m_pScriptLayout = new CScript_LayoutPseudoModel(this); - return m_pScriptLayout; - } - default: - return m_pRootNode->GetFirstChildByName(dwNodeNameHash); - } -} -CXFA_Node* CXFA_Document::CreateNode(uint32_t dwPacket, XFA_Element eElement) { - return CreateNode(XFA_GetPacketByID(dwPacket), eElement); -} - -CXFA_Node* CXFA_Document::CreateNode(const XFA_PACKETINFO* pPacket, - XFA_Element eElement) { - if (!pPacket) - return nullptr; - - const XFA_ELEMENTINFO* pElement = XFA_GetElementByID(eElement); - if (pElement && (pElement->dwPackets & pPacket->eName)) { - CXFA_Node* pNode = - new CXFA_Node(this, pPacket->eName, pElement->eObjectType, - pElement->eName, pElement->pName); - AddPurgeNode(pNode); - return pNode; - } - - return nullptr; -} - -void CXFA_Document::AddPurgeNode(CXFA_Node* pNode) { - m_PurgeNodes.insert(pNode); -} - -FX_BOOL CXFA_Document::RemovePurgeNode(CXFA_Node* pNode) { - return !!m_PurgeNodes.erase(pNode); -} - -void CXFA_Document::PurgeNodes() { - for (CXFA_Node* pNode : m_PurgeNodes) - delete pNode; - - m_PurgeNodes.clear(); -} - -void CXFA_Document::SetFlag(uint32_t dwFlag, FX_BOOL bOn) { - if (bOn) { - m_dwDocFlags |= dwFlag; - } else { - m_dwDocFlags &= ~dwFlag; - } -} -FX_BOOL CXFA_Document::IsInteractive() { - if (m_dwDocFlags & XFA_DOCFLAG_HasInteractive) { - return !!(m_dwDocFlags & XFA_DOCFLAG_Interactive); - } - CXFA_Node* pConfig = ToNode(GetXFAObject(XFA_HASHCODE_Config)); - if (!pConfig) { - return FALSE; - } - CFX_WideString wsInteractive; - CXFA_Node* pPresent = pConfig->GetFirstChildByClass(XFA_Element::Present); - if (!pPresent) { - return FALSE; - } - CXFA_Node* pPDF = pPresent->GetFirstChildByClass(XFA_Element::Pdf); - if (!pPDF) { - return FALSE; - } - CXFA_Node* pInteractive = pPDF->GetChild(0, XFA_Element::Interactive); - if (pInteractive) { - m_dwDocFlags |= XFA_DOCFLAG_HasInteractive; - if (pInteractive->TryContent(wsInteractive) && - wsInteractive == FX_WSTRC(L"1")) { - m_dwDocFlags |= XFA_DOCFLAG_Interactive; - return TRUE; - } - } - return FALSE; -} -CXFA_LocaleMgr* CXFA_Document::GetLocalMgr() { - if (!m_pLocalMgr) { - CFX_WideString wsLanguage; - GetNotify()->GetAppProvider()->GetLanguage(wsLanguage); - m_pLocalMgr = new CXFA_LocaleMgr( - ToNode(GetXFAObject(XFA_HASHCODE_LocaleSet)), wsLanguage); - } - return m_pLocalMgr; -} -CXFA_ScriptContext* CXFA_Document::InitScriptContext(v8::Isolate* pIsolate) { - if (!m_pScriptContext) - m_pScriptContext = new CXFA_ScriptContext(this); - m_pScriptContext->Initialize(pIsolate); - return m_pScriptContext; -} -CXFA_ScriptContext* CXFA_Document::GetScriptContext() { - if (!m_pScriptContext) - m_pScriptContext = new CXFA_ScriptContext(this); - return m_pScriptContext; -} -XFA_VERSION CXFA_Document::RecognizeXFAVersionNumber( - CFX_WideString& wsTemplateNS) { - CFX_WideStringC wsTemplateURIPrefix = - XFA_GetPacketByIndex(XFA_PACKET_Template)->pURI; - FX_STRSIZE nPrefixLength = wsTemplateURIPrefix.GetLength(); - if (CFX_WideStringC(wsTemplateNS.c_str(), wsTemplateNS.GetLength()) != - wsTemplateURIPrefix) { - return XFA_VERSION_UNKNOWN; - } - FX_STRSIZE nDotPos = wsTemplateNS.Find('.', nPrefixLength); - if (nDotPos == (FX_STRSIZE)-1) { - return XFA_VERSION_UNKNOWN; - } - int8_t iMajor = FXSYS_wtoi( - wsTemplateNS.Mid(nPrefixLength, nDotPos - nPrefixLength).c_str()); - int8_t iMinor = FXSYS_wtoi( - wsTemplateNS.Mid(nDotPos + 1, wsTemplateNS.GetLength() - nDotPos - 2) - .c_str()); - XFA_VERSION eVersion = (XFA_VERSION)((int32_t)iMajor * 100 + iMinor); - if (eVersion < XFA_VERSION_MIN || eVersion > XFA_VERSION_MAX) { - return XFA_VERSION_UNKNOWN; - } - m_eCurVersionMode = eVersion; - return eVersion; -} -CXFA_Node* CXFA_Document::GetNodeByID(CXFA_Node* pRoot, - const CFX_WideStringC& wsID) { - if (!pRoot || wsID.IsEmpty()) { - return nullptr; - } - CXFA_NodeIterator sIterator(pRoot); - for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; - pNode = sIterator.MoveToNext()) { - CFX_WideStringC wsIDVal; - if (pNode->TryCData(XFA_ATTRIBUTE_Id, wsIDVal) && !wsIDVal.IsEmpty()) { - if (wsIDVal == wsID) { - return pNode; - } - } - } - return nullptr; -} -static void XFA_ProtoMerge_MergeNodeRecurse(CXFA_Document* pDocument, - CXFA_Node* pDestNodeParent, - CXFA_Node* pProtoNode) { - CXFA_Node* pExistingNode = nullptr; - for (CXFA_Node* pFormChild = - pDestNodeParent->GetNodeItem(XFA_NODEITEM_FirstChild); - pFormChild; - pFormChild = pFormChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pFormChild->GetElementType() == pProtoNode->GetElementType() && - pFormChild->GetNameHash() == pProtoNode->GetNameHash() && - pFormChild->IsUnusedNode()) { - pFormChild->ClearFlag(XFA_NodeFlag_UnusedNode); - pExistingNode = pFormChild; - break; - } - } - if (pExistingNode) { - pExistingNode->SetTemplateNode(pProtoNode); - for (CXFA_Node* pTemplateChild = - pProtoNode->GetNodeItem(XFA_NODEITEM_FirstChild); - pTemplateChild; pTemplateChild = pTemplateChild->GetNodeItem( - XFA_NODEITEM_NextSibling)) { - XFA_ProtoMerge_MergeNodeRecurse(pDocument, pExistingNode, pTemplateChild); - } - return; - } - CXFA_Node* pNewNode = pProtoNode->Clone(TRUE); - pNewNode->SetTemplateNode(pProtoNode); - pDestNodeParent->InsertChild(pNewNode, nullptr); -} -static void XFA_ProtoMerge_MergeNode(CXFA_Document* pDocument, - CXFA_Node* pDestNode, - CXFA_Node* pProtoNode) { - { - CXFA_NodeIterator sIterator(pDestNode); - for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; - pNode = sIterator.MoveToNext()) { - pNode->SetFlag(XFA_NodeFlag_UnusedNode, true); - } - } - pDestNode->SetTemplateNode(pProtoNode); - for (CXFA_Node* pTemplateChild = - pProtoNode->GetNodeItem(XFA_NODEITEM_FirstChild); - pTemplateChild; - pTemplateChild = pTemplateChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { - XFA_ProtoMerge_MergeNodeRecurse(pDocument, pDestNode, pTemplateChild); - } - { - CXFA_NodeIterator sIterator(pDestNode); - for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; - pNode = sIterator.MoveToNext()) { - pNode->ClearFlag(XFA_NodeFlag_UnusedNode); - } - } -} -void CXFA_Document::DoProtoMerge() { - CXFA_Node* pTemplateRoot = ToNode(GetXFAObject(XFA_HASHCODE_Template)); - if (!pTemplateRoot) { - return; - } - CFX_MapPtrTemplate mIDMap; - CXFA_NodeSet sUseNodes; - CXFA_NodeIterator sIterator(pTemplateRoot); - for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; - pNode = sIterator.MoveToNext()) { - CFX_WideStringC wsIDVal; - if (pNode->TryCData(XFA_ATTRIBUTE_Id, wsIDVal) && !wsIDVal.IsEmpty()) { - mIDMap[FX_HashCode_GetW(wsIDVal, false)] = pNode; - } - CFX_WideStringC wsUseVal; - if (pNode->TryCData(XFA_ATTRIBUTE_Use, wsUseVal) && !wsUseVal.IsEmpty()) { - sUseNodes.insert(pNode); - } else if (pNode->TryCData(XFA_ATTRIBUTE_Usehref, wsUseVal) && - !wsUseVal.IsEmpty()) { - sUseNodes.insert(pNode); - } - } - for (CXFA_Node* pUseHrefNode : sUseNodes) { - CFX_WideString wsUseVal; - CFX_WideStringC wsURI, wsID, wsSOM; - if (pUseHrefNode->TryCData(XFA_ATTRIBUTE_Usehref, wsUseVal) && - !wsUseVal.IsEmpty()) { - FX_STRSIZE uSharpPos = wsUseVal.Find('#'); - if (uSharpPos < 0) { - wsURI = wsUseVal.AsStringC(); - } else { - wsURI = CFX_WideStringC(wsUseVal.c_str(), uSharpPos); - FX_STRSIZE uLen = wsUseVal.GetLength(); - if (uLen >= uSharpPos + 5 && - CFX_WideStringC(wsUseVal.c_str() + uSharpPos, 5) == - FX_WSTRC(L"#som(") && - wsUseVal[uLen - 1] == ')') { - wsSOM = CFX_WideStringC(wsUseVal.c_str() + uSharpPos + 5, - uLen - 1 - uSharpPos - 5); - } else { - wsID = CFX_WideStringC(wsUseVal.c_str() + uSharpPos + 1, - uLen - uSharpPos - 1); - } - } - } else if (pUseHrefNode->TryCData(XFA_ATTRIBUTE_Use, wsUseVal) && - !wsUseVal.IsEmpty()) { - if (wsUseVal[0] == '#') { - wsID = CFX_WideStringC(wsUseVal.c_str() + 1, wsUseVal.GetLength() - 1); - } else { - wsSOM = CFX_WideStringC(wsUseVal.c_str(), wsUseVal.GetLength()); - } - } - if (!wsURI.IsEmpty() && wsURI != FX_WSTRC(L".")) { - continue; - } - CXFA_Node* pProtoNode = nullptr; - if (!wsSOM.IsEmpty()) { - uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | - XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | - XFA_RESOLVENODE_Siblings; - XFA_RESOLVENODE_RS resoveNodeRS; - int32_t iRet = m_pScriptContext->ResolveObjects(pUseHrefNode, wsSOM, - resoveNodeRS, dwFlag); - if (iRet > 0 && resoveNodeRS.nodes[0]->IsNode()) { - pProtoNode = resoveNodeRS.nodes[0]->AsNode(); - } - } else if (!wsID.IsEmpty()) { - if (!mIDMap.Lookup(FX_HashCode_GetW(wsID, false), pProtoNode)) { - continue; - } - } - if (!pProtoNode) { - continue; - } - XFA_ProtoMerge_MergeNode(this, pUseHrefNode, pProtoNode); - } -} diff --git a/xfa/fxfa/parser/xfa_document_serialize.cpp b/xfa/fxfa/parser/xfa_document_serialize.cpp index a524c733d2..ae30165a2d 100644 --- a/xfa/fxfa/parser/xfa_document_serialize.cpp +++ b/xfa/fxfa/parser/xfa_document_serialize.cpp @@ -8,8 +8,8 @@ #include "xfa/fde/xml/fde_xml_imp.h" #include "xfa/fgas/crt/fgas_codepage.h" +#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_simple_parser.h" -#include "xfa/fxfa/parser/xfa_document.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/xfa_layout_appadapter.cpp b/xfa/fxfa/parser/xfa_layout_appadapter.cpp index 3dc9b5f052..fdf9a27d0b 100644 --- a/xfa/fxfa/parser/xfa_layout_appadapter.cpp +++ b/xfa/fxfa/parser/xfa_layout_appadapter.cpp @@ -7,7 +7,7 @@ #include "xfa/fxfa/parser/xfa_layout_appadapter.h" #include "xfa/fxfa/app/xfa_ffnotify.h" -#include "xfa/fxfa/parser/xfa_document.h" +#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/xfa_layout_itemlayout.h" #include "xfa/fxfa/parser/xfa_layout_pagemgr_new.h" #include "xfa/fxfa/parser/xfa_localemgr.h" diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp index 99432d80f5..2a467a54f1 100644 --- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp +++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp @@ -10,9 +10,9 @@ #include #include "xfa/fxfa/app/xfa_ffnotify.h" +#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_measurement.h" #include "xfa/fxfa/parser/cxfa_occur.h" -#include "xfa/fxfa/parser/xfa_document.h" #include "xfa/fxfa/parser/xfa_layout_appadapter.h" #include "xfa/fxfa/parser/xfa_layout_pagemgr_new.h" #include "xfa/fxfa/parser/xfa_localemgr.h" diff --git a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp index 779e783b9a..914ce6fb36 100644 --- a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp +++ b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp @@ -7,11 +7,11 @@ #include "xfa/fxfa/parser/xfa_layout_pagemgr_new.h" #include "xfa/fxfa/app/xfa_ffnotify.h" +#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" #include "xfa/fxfa/parser/cxfa_measurement.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" #include "xfa/fxfa/parser/cxfa_traversestrategy_layoutitem.h" -#include "xfa/fxfa/parser/xfa_document.h" #include "xfa/fxfa/parser/xfa_document_datamerger_imp.h" #include "xfa/fxfa/parser/xfa_layout_appadapter.h" #include "xfa/fxfa/parser/xfa_layout_itemlayout.h" diff --git a/xfa/fxfa/parser/xfa_locale.cpp b/xfa/fxfa/parser/xfa_locale.cpp index 48e0f1eef5..67a9760646 100644 --- a/xfa/fxfa/parser/xfa_locale.cpp +++ b/xfa/fxfa/parser/xfa_locale.cpp @@ -7,7 +7,7 @@ #include "xfa/fxfa/parser/xfa_locale.h" #include "core/fxcrt/include/fx_xml.h" -#include "xfa/fxfa/parser/xfa_document.h" +#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/xfa_localemgr.cpp b/xfa/fxfa/parser/xfa_localemgr.cpp index 4b80f3e0f4..24f240ddd0 100644 --- a/xfa/fxfa/parser/xfa_localemgr.cpp +++ b/xfa/fxfa/parser/xfa_localemgr.cpp @@ -9,7 +9,7 @@ #include "core/fxcodec/include/fx_codec.h" #include "core/fxcrt/include/fx_xml.h" #include "core/fxge/include/fx_ge.h" -#include "xfa/fxfa/parser/xfa_document.h" +#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/xfa_locale.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/xfa_localevalue.cpp b/xfa/fxfa/parser/xfa_localevalue.cpp index 0ec38d523f..0324c569f3 100644 --- a/xfa/fxfa/parser/xfa_localevalue.cpp +++ b/xfa/fxfa/parser/xfa_localevalue.cpp @@ -8,7 +8,7 @@ #include "core/fxcrt/include/fx_ext.h" #include "xfa/fgas/localization/fgas_localeimp.h" -#include "xfa/fxfa/parser/xfa_document.h" +#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/xfa_utils_imp.cpp b/xfa/fxfa/parser/xfa_utils_imp.cpp index 064ef6c323..da5b68516b 100644 --- a/xfa/fxfa/parser/xfa_utils_imp.cpp +++ b/xfa/fxfa/parser/xfa_utils_imp.cpp @@ -8,9 +8,9 @@ #include "core/fxcrt/include/fx_ext.h" #include "xfa/fde/xml/fde_xml_imp.h" +#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_measurement.h" #include "xfa/fxfa/parser/xfa_basic_data.h" -#include "xfa/fxfa/parser/xfa_document.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_localevalue.h" #include "xfa/fxfa/parser/xfa_object.h" -- cgit v1.2.3