From a1b0772321e9b839073b9b312bac22143f2d4011 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Mon, 11 Jul 2016 08:20:58 -0700 Subject: Remove IXFA_Parser, cleanup XFA parser code. The IXFA_Parser only created a CXFA_SimpleParser, the CXFA_DocumentParser is only created in one spot and doesn't need all the IXFA_Parser methods. This CL removes IXFA_Parser, instantiates the CXFA_SimpleParser where needed and cleans up surrounding code. Review-Url: https://codereview.chromium.org/2123133004 --- xfa/fxfa/parser/xfa_basic_imp.cpp | 1 - xfa/fxfa/parser/xfa_document.h | 4 +- xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 6 +- xfa/fxfa/parser/xfa_document_imp.cpp | 7 +- xfa/fxfa/parser/xfa_document_layout_imp.cpp | 1 - xfa/fxfa/parser/xfa_document_serialize.cpp | 35 +++++----- xfa/fxfa/parser/xfa_layout_appadapter.cpp | 4 +- xfa/fxfa/parser/xfa_layout_itemlayout.cpp | 15 ++--- xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp | 27 +++----- xfa/fxfa/parser/xfa_locale.cpp | 1 - xfa/fxfa/parser/xfa_localemgr.cpp | 1 - xfa/fxfa/parser/xfa_localevalue.cpp | 1 - xfa/fxfa/parser/xfa_object_imp.cpp | 76 ++++++++++----------- xfa/fxfa/parser/xfa_parser.h | 35 ---------- xfa/fxfa/parser/xfa_parser_imp.cpp | 61 +++-------------- xfa/fxfa/parser/xfa_parser_imp.h | 53 +++++++-------- xfa/fxfa/parser/xfa_script_datawindow.cpp | 1 - xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp | 3 +- xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp | 78 +++++++++++++--------- xfa/fxfa/parser/xfa_script_imp.cpp | 1 - xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp | 13 ++-- xfa/fxfa/parser/xfa_script_logpseudomodel.cpp | 1 - xfa/fxfa/parser/xfa_script_nodehelper.cpp | 1 - xfa/fxfa/parser/xfa_script_resolveprocessor.cpp | 1 - .../parser/xfa_script_signaturepseudomodel.cpp | 9 ++- xfa/fxfa/parser/xfa_utils_imp.cpp | 1 - 26 files changed, 170 insertions(+), 267 deletions(-) delete mode 100644 xfa/fxfa/parser/xfa_parser.h (limited to 'xfa/fxfa/parser') diff --git a/xfa/fxfa/parser/xfa_basic_imp.cpp b/xfa/fxfa/parser/xfa_basic_imp.cpp index 23592830d0..f236d0e8a3 100644 --- a/xfa/fxfa/parser/xfa_basic_imp.cpp +++ b/xfa/fxfa/parser/xfa_basic_imp.cpp @@ -14,7 +14,6 @@ #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_parser.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/xfa_document.h b/xfa/fxfa/parser/xfa_document.h index ba9979bc5c..328f1bcdd2 100644 --- a/xfa/fxfa/parser/xfa_document.h +++ b/xfa/fxfa/parser/xfa_document.h @@ -10,6 +10,7 @@ #include "xfa/fxfa/include/fxfa.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" class CXFA_Document; class CXFA_LayoutItem; @@ -64,7 +65,8 @@ class CXFA_Document { ~CXFA_Document(); CXFA_Node* GetRoot() const { return m_pRootNode; } - CXFA_DocumentParser* GetParser() const { return m_pParser; } + + CFDE_XMLDoc* GetXMLDoc() const; CXFA_FFNotify* GetNotify() const; void SetRoot(CXFA_Node* pNewRoot); CXFA_Object* GetXFAObject(XFA_HashCode wsNodeNameHash); diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index 4374b7c43d..dd1fce6eed 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -15,7 +15,6 @@ #include "xfa/fxfa/parser/xfa_document_layout_imp.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" -#include "xfa/fxfa/parser/xfa_parser.h" #include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_script_imp.h" @@ -531,9 +530,8 @@ CXFA_Node* CloneOrMergeInstanceManager(CXFA_Document* pDocument, return pExistingNode; } - CXFA_Node* pNewNode = pDocument->GetParser()->GetFactory()->CreateNode( - XFA_XDPPACKET_Form, XFA_Element::InstanceManager); - ASSERT(pNewNode); + CXFA_Node* pNewNode = + pDocument->CreateNode(XFA_XDPPACKET_Form, XFA_Element::InstanceManager); wsInstMgrNodeName = FX_WSTRC(L"_") + pTemplateNode->GetCData(XFA_ATTRIBUTE_Name); pNewNode->SetCData(XFA_ATTRIBUTE_Name, wsInstMgrNodeName); diff --git a/xfa/fxfa/parser/xfa_document_imp.cpp b/xfa/fxfa/parser/xfa_document_imp.cpp index 7ba85bb35c..efd48e66a1 100644 --- a/xfa/fxfa/parser/xfa_document_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_imp.cpp @@ -12,7 +12,6 @@ #include "xfa/fxfa/parser/xfa_document_layout_imp.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" -#include "xfa/fxfa/parser/xfa_parser.h" #include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_script_datawindow.h" @@ -74,6 +73,10 @@ void CXFA_Document::SetRoot(CXFA_Node* pNewRoot) { RemovePurgeNode(pNewRoot); } +CFDE_XMLDoc* CXFA_Document::GetXMLDoc() const { + return m_pParser->GetXMLDoc(); +} + CXFA_FFNotify* CXFA_Document::GetNotify() const { return m_pParser->GetNotify(); } @@ -219,7 +222,7 @@ FX_BOOL CXFA_Document::IsInteractive() { CXFA_LocaleMgr* CXFA_Document::GetLocalMgr() { if (!m_pLocalMgr) { CFX_WideString wsLanguage; - GetParser()->GetNotify()->GetAppProvider()->GetLanguage(wsLanguage); + GetNotify()->GetAppProvider()->GetLanguage(wsLanguage); m_pLocalMgr = new CXFA_LocaleMgr( ToNode(GetXFAObject(XFA_HASHCODE_LocaleSet)), wsLanguage); } diff --git a/xfa/fxfa/parser/xfa_document_layout_imp.cpp b/xfa/fxfa/parser/xfa_document_layout_imp.cpp index 416982b749..5bcc4493d5 100644 --- a/xfa/fxfa/parser/xfa_document_layout_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_layout_imp.cpp @@ -15,7 +15,6 @@ #include "xfa/fxfa/parser/xfa_layout_pagemgr_new.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" -#include "xfa/fxfa/parser/xfa_parser.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/xfa_document_serialize.cpp b/xfa/fxfa/parser/xfa_document_serialize.cpp index febfa3e827..428b470c13 100644 --- a/xfa/fxfa/parser/xfa_document_serialize.cpp +++ b/xfa/fxfa/parser/xfa_document_serialize.cpp @@ -12,7 +12,6 @@ #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_parser.h" #include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_utils.h" @@ -22,34 +21,31 @@ CXFA_DataImporter::CXFA_DataImporter(CXFA_Document* pDocument) ASSERT(m_pDocument); } FX_BOOL CXFA_DataImporter::ImportData(IFX_FileRead* pDataDocument) { - IXFA_Parser* pDataDocumentParser = IXFA_Parser::Create(m_pDocument); - if (!pDataDocumentParser) { + std::unique_ptr pDataDocumentParser( + new CXFA_SimpleParser(m_pDocument, false)); + if (!pDataDocumentParser) return FALSE; - } + if (pDataDocumentParser->StartParse(pDataDocument, XFA_XDPPACKET_Datasets) != XFA_PARSESTATUS_Ready) { - pDataDocumentParser->Release(); return FALSE; } - if (pDataDocumentParser->DoParse(nullptr) < XFA_PARSESTATUS_Done) { - pDataDocumentParser->Release(); + if (pDataDocumentParser->DoParse(nullptr) < XFA_PARSESTATUS_Done) return FALSE; - } + CXFA_Node* pImportDataRoot = pDataDocumentParser->GetRootNode(); - if (!pImportDataRoot) { - pDataDocumentParser->Release(); + if (!pImportDataRoot) return FALSE; - } + CXFA_Node* pDataModel = ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Datasets)); - if (!pDataModel) { - pDataDocumentParser->Release(); + if (!pDataModel) return FALSE; - } + CXFA_Node* pDataNode = ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Data)); - if (pDataNode) { + if (pDataNode) pDataModel->RemoveChild(pDataNode); - } + if (pImportDataRoot->GetElementType() == XFA_Element::DataModel) { while (CXFA_Node* pChildNode = pImportDataRoot->GetNodeItem(XFA_NODEITEM_FirstChild)) { @@ -59,15 +55,14 @@ FX_BOOL CXFA_DataImporter::ImportData(IFX_FileRead* pDataDocument) { } else { CFDE_XMLNode* pXMLNode = pImportDataRoot->GetXMLMappingNode(); CFDE_XMLNode* pParentXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::Parent); - if (pParentXMLNode) { + if (pParentXMLNode) pParentXMLNode->RemoveChildNode(pXMLNode); - } pDataModel->InsertChild(pImportDataRoot); } m_pDocument->DoDataRemerge(FALSE); - pDataDocumentParser->Release(); return TRUE; } + CFX_WideString XFA_ExportEncodeAttribute(const CFX_WideString& str) { CFX_WideTextBuf textBuf; int32_t iLen = str.GetLength(); @@ -487,7 +482,7 @@ FX_BOOL CXFA_DataExporter::Export(IFX_Stream* pStream, CXFA_Node* pNode, uint32_t dwFlag, const FX_CHAR* pChecksum) { - CFDE_XMLDoc* pXMLDoc = m_pDocument->GetParser()->GetXMLDoc(); + CFDE_XMLDoc* pXMLDoc = m_pDocument->GetXMLDoc(); if (pNode->IsModelNode()) { switch (pNode->GetPacketID()) { case XFA_XDPPACKET_XDP: { diff --git a/xfa/fxfa/parser/xfa_layout_appadapter.cpp b/xfa/fxfa/parser/xfa_layout_appadapter.cpp index f85f96da2f..0b94c644c4 100644 --- a/xfa/fxfa/parser/xfa_layout_appadapter.cpp +++ b/xfa/fxfa/parser/xfa_layout_appadapter.cpp @@ -14,15 +14,13 @@ #include "xfa/fxfa/parser/xfa_layout_pagemgr_new.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" -#include "xfa/fxfa/parser/xfa_parser.h" #include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_utils.h" void XFA_ReleaseLayoutItem(CXFA_LayoutItem* pLayoutItem) { CXFA_LayoutItem* pNode = pLayoutItem->m_pFirstChild; - CXFA_FFNotify* pNotify = - pLayoutItem->m_pFormNode->GetDocument()->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = pLayoutItem->m_pFormNode->GetDocument()->GetNotify(); CXFA_LayoutProcessor* pDocLayout = pLayoutItem->m_pFormNode->GetDocument()->GetDocLayout(); while (pNode) { diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp index f5b0920548..fb024ab8db 100644 --- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp +++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp @@ -18,7 +18,6 @@ #include "xfa/fxfa/parser/xfa_layout_pagemgr_new.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" -#include "xfa/fxfa/parser/xfa_parser.h" #include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_utils.h" @@ -92,7 +91,6 @@ CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::CreateContentLayoutItem( return pLayoutItem; } pLayoutItem = (CXFA_ContentLayoutItem*)pFormNode->GetDocument() - ->GetParser() ->GetNotify() ->OnCreateLayoutItem(pFormNode); CXFA_ContentLayoutItem* pPrevLayoutItem = @@ -122,7 +120,7 @@ FX_BOOL CXFA_ItemLayoutProcessor::FindLayoutItemSplitPos( case XFA_ATTRIBUTEENUM_None: { FX_BOOL bAnyChanged = FALSE; CXFA_Document* pDocument = pFormNode->GetDocument(); - CXFA_FFNotify* pNotify = pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = pDocument->GetNotify(); FX_FLOAT fCurTopMargin = 0, fCurBottomMargin = 0; CXFA_Node* pMarginNode = pFormNode->GetFirstChildByClass(XFA_Element::Margin); @@ -585,7 +583,7 @@ CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::ExtractLayoutItem() { if (m_pOldLayoutItem->m_pPrev) m_pOldLayoutItem->m_pPrev->m_pNext = nullptr; CXFA_FFNotify* pNotify = - m_pOldLayoutItem->m_pFormNode->GetDocument()->GetParser()->GetNotify(); + m_pOldLayoutItem->m_pFormNode->GetDocument()->GetNotify(); CXFA_LayoutProcessor* pDocLayout = m_pOldLayoutItem->m_pFormNode->GetDocument()->GetDocLayout(); CXFA_ContentLayoutItem* pOldLayoutItem = m_pOldLayoutItem; @@ -647,8 +645,7 @@ static FX_BOOL XFA_ItemLayoutProcessor_FindBreakNode( return bFindRs; } static void XFA_DeleteLayoutGeneratedNode(CXFA_Node* pGenerateNode) { - CXFA_FFNotify* pNotify = - pGenerateNode->GetDocument()->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = pGenerateNode->GetDocument()->GetNotify(); CXFA_LayoutProcessor* pDocLayout = pGenerateNode->GetDocument()->GetDocLayout(); CXFA_NodeIteratorTemplate sIterator( @@ -1233,8 +1230,8 @@ static inline void XFA_ItemLayoutProcessor_UpdateWidgetSize( } case XFA_Element::Draw: case XFA_Element::Field: { - pNode->GetDocument()->GetParser()->GetNotify()->StartFieldDrawLayout( - pNode, fWidth, fHeight); + pNode->GetDocument()->GetNotify()->StartFieldDrawLayout(pNode, fWidth, + fHeight); break; } default: @@ -2896,7 +2893,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutField() { return; } CXFA_Document* pDocument = m_pFormNode->GetDocument(); - CXFA_FFNotify* pNotify = pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = pDocument->GetNotify(); FX_FLOAT fHeight = -1; FX_FLOAT fWidth = -1; pNotify->StartFieldDrawLayout(m_pFormNode, fWidth, fHeight); diff --git a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp index 117e1cec8e..14329c68fb 100644 --- a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp +++ b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp @@ -15,7 +15,6 @@ #include "xfa/fxfa/parser/xfa_layout_itemlayout.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" -#include "xfa/fxfa/parser/xfa_parser.h" #include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_script_imp.h" @@ -282,11 +281,10 @@ FX_BOOL CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { return FALSE; } CXFA_Document* pDocument = pTemplateNode->GetDocument(); - CXFA_Document* pObjFactory = pDocument->GetParser()->GetFactory(); pPageArea = m_pTemplatePageSetRoot->GetChild(0, XFA_Element::PageArea); if (!pPageArea) { - pPageArea = pObjFactory->CreateNode(m_pTemplatePageSetRoot->GetPacketID(), - XFA_Element::PageArea); + pPageArea = pDocument->CreateNode(m_pTemplatePageSetRoot->GetPacketID(), + XFA_Element::PageArea); if (!pPageArea) { return FALSE; } @@ -295,8 +293,8 @@ FX_BOOL CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { } CXFA_Node* pContentArea = pPageArea->GetChild(0, XFA_Element::ContentArea); if (!pContentArea) { - pContentArea = pObjFactory->CreateNode(pPageArea->GetPacketID(), - XFA_Element::ContentArea); + pContentArea = pDocument->CreateNode(pPageArea->GetPacketID(), + XFA_Element::ContentArea); if (!pContentArea) { return FALSE; } @@ -314,7 +312,7 @@ FX_BOOL CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { CXFA_Node* pMedium = pPageArea->GetChild(0, XFA_Element::Medium); if (!pMedium) { pMedium = - pObjFactory->CreateNode(pPageArea->GetPacketID(), XFA_Element::Medium); + pDocument->CreateNode(pPageArea->GetPacketID(), XFA_Element::Medium); if (!pContentArea) { return FALSE; } @@ -455,7 +453,7 @@ FX_BOOL XFA_LayoutPageMgr_RunBreakTestScript(CXFA_Node* pTestScript) { if (wsExpression.IsEmpty()) { return TRUE; } - return pTestScript->GetDocument()->GetParser()->GetNotify()->RunScript( + return pTestScript->GetDocument()->GetNotify()->RunScript( pTestScript, pTestScript->GetNodeItem(XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode)); } @@ -536,8 +534,7 @@ void CXFA_LayoutPageMgr::AddPageAreaLayoutItem(CXFA_ContainerRecord* pNewRecord, m_nAvailPages++; pNewPageAreaLayoutItem = pContainerItem; } else { - CXFA_FFNotify* pNotify = - pNewPageArea->GetDocument()->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = pNewPageArea->GetDocument()->GetNotify(); CXFA_ContainerLayoutItem* pContainerItem = (CXFA_ContainerLayoutItem*)pNotify->OnCreateLayoutItem(pNewPageArea); m_PageArray.Add(pContainerItem); @@ -1564,8 +1561,7 @@ void CXFA_LayoutPageMgr::ClearRecordList() { } CXFA_LayoutItem* CXFA_LayoutPageMgr::FindOrCreateLayoutItem( CXFA_Node* pFormNode) { - return pFormNode->GetDocument()->GetParser()->GetNotify()->OnCreateLayoutItem( - pFormNode); + return pFormNode->GetDocument()->GetNotify()->OnCreateLayoutItem(pFormNode); } void CXFA_LayoutPageMgr::SaveLayoutItem(CXFA_LayoutItem* pParentLayoutItem) { @@ -1576,7 +1572,7 @@ void CXFA_LayoutPageMgr::SaveLayoutItem(CXFA_LayoutItem* pParentLayoutItem) { if (pCurLayoutItem->IsContentLayoutItem()) { if (pCurLayoutItem->m_pFormNode->HasRemovedChildren()) { CXFA_FFNotify* pNotify = - m_pTemplatePageSetRoot->GetDocument()->GetParser()->GetNotify(); + m_pTemplatePageSetRoot->GetDocument()->GetNotify(); CXFA_LayoutProcessor* pDocLayout = m_pTemplatePageSetRoot->GetDocument()->GetDocLayout(); if (pCurLayoutItem->m_pFirstChild) { @@ -1636,7 +1632,7 @@ CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow( void CXFA_LayoutPageMgr::MergePageSetContents() { CXFA_Document* pDocument = m_pTemplatePageSetRoot->GetDocument(); - CXFA_FFNotify* pNotify = pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = pDocument->GetNotify(); CXFA_LayoutProcessor* pDocLayout = pDocument->GetDocLayout(); CXFA_ContainerLayoutItem* pRootLayout = GetRootLayoutItem(); { @@ -1850,8 +1846,7 @@ void CXFA_LayoutPageMgr::LayoutPageSetContents() { void CXFA_LayoutPageMgr::SyncLayoutData() { MergePageSetContents(); LayoutPageSetContents(); - CXFA_FFNotify* pNotify = - m_pTemplatePageSetRoot->GetDocument()->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pTemplatePageSetRoot->GetDocument()->GetNotify(); int32_t nPageIdx = -1; CXFA_ContainerLayoutItem* pRootLayoutItem = GetRootLayoutItem(); for (; pRootLayoutItem; diff --git a/xfa/fxfa/parser/xfa_locale.cpp b/xfa/fxfa/parser/xfa_locale.cpp index 507add939c..e0e42a8d74 100644 --- a/xfa/fxfa/parser/xfa_locale.cpp +++ b/xfa/fxfa/parser/xfa_locale.cpp @@ -11,7 +11,6 @@ #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_parser.h" #include "xfa/fxfa/parser/xfa_script.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 570a719279..fbc3f15bc1 100644 --- a/xfa/fxfa/parser/xfa_localemgr.cpp +++ b/xfa/fxfa/parser/xfa_localemgr.cpp @@ -13,7 +13,6 @@ #include "xfa/fxfa/parser/xfa_document.h" #include "xfa/fxfa/parser/xfa_locale.h" #include "xfa/fxfa/parser/xfa_object.h" -#include "xfa/fxfa/parser/xfa_parser.h" #include "xfa/fxfa/parser/xfa_script.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 c7f78b387e..995d021726 100644 --- a/xfa/fxfa/parser/xfa_localevalue.cpp +++ b/xfa/fxfa/parser/xfa_localevalue.cpp @@ -12,7 +12,6 @@ #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_parser.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp index 99198d24f5..5ada3bd197 100644 --- a/xfa/fxfa/parser/xfa_object_imp.cpp +++ b/xfa/fxfa/parser/xfa_object_imp.cpp @@ -21,7 +21,6 @@ #include "xfa/fxfa/parser/xfa_document.h" #include "xfa/fxfa/parser/xfa_document_layout_imp.h" #include "xfa/fxfa/parser/xfa_localemgr.h" -#include "xfa/fxfa/parser/xfa_parser.h" #include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_script_imp.h" @@ -136,8 +135,7 @@ CXFA_Node::~CXFA_Node() { } CXFA_Node* CXFA_Node::Clone(FX_BOOL bRecursive) { - CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); - CXFA_Node* pClone = pFactory->CreateNode(m_ePacket, m_elementType); + CXFA_Node* pClone = m_pDocument->CreateNode(m_ePacket, m_elementType); if (!pClone) return nullptr; @@ -295,10 +293,9 @@ int32_t CXFA_Node::GetNodeList(CXFA_NodeArray& nodes, return 0; for (int32_t i = 0; i < iProperties; i++) { if (pProperty[i].uFlags & XFA_PROPERTYFLAG_DefaultOneOf) { - CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(GetPacketID()); CXFA_Node* pNewNode = - pFactory->CreateNode(pPacket, pProperty[i].eName); + m_pDocument->CreateNode(pPacket, pProperty[i].eName); if (!pNewNode) break; InsertChild(pNewNode, nullptr); @@ -314,16 +311,15 @@ int32_t CXFA_Node::GetNodeList(CXFA_NodeArray& nodes, CXFA_Node* CXFA_Node::CreateSamePacketNode(XFA_Element eType, uint32_t dwFlags) { - CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); - CXFA_Node* pNode = pFactory->CreateNode(m_ePacket, eType); + CXFA_Node* pNode = m_pDocument->CreateNode(m_ePacket, eType); pNode->SetFlag(dwFlags, true); return pNode; } CXFA_Node* CXFA_Node::CloneTemplateToForm(FX_BOOL bRecursive) { ASSERT(m_ePacket == XFA_XDPPACKET_Template); - CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); - CXFA_Node* pClone = pFactory->CreateNode(XFA_XDPPACKET_Form, m_elementType); + CXFA_Node* pClone = + m_pDocument->CreateNode(XFA_XDPPACKET_Form, m_elementType); if (!pClone) return nullptr; @@ -938,8 +934,8 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) { bIgnoreRoot = !!pArguments->GetInt32(1); if (iLength >= 3) bOverwrite = !!pArguments->GetInt32(2); - std::unique_ptr> pParser( - IXFA_Parser::Create(m_pDocument)); + std::unique_ptr pParser( + new CXFA_SimpleParser(m_pDocument, false)); if (!pParser) return; CFDE_XMLNode* pXMLNode = nullptr; @@ -1265,7 +1261,7 @@ void CXFA_Node::Script_Attribute_SendAttributeChangeMessage( if (!pLayoutPro) return; - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) return; @@ -1541,7 +1537,7 @@ void CXFA_Node::Script_Som_Message(CFXJSE_Value* pValue, break; } if (!bNew) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -2105,7 +2101,7 @@ void CXFA_Node::Script_Field_ExecEvent(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_Field_ExecInitialize(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -2192,7 +2188,7 @@ void CXFA_Node::Script_Field_GetItemState(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_Field_ExecCalculate(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -2270,7 +2266,7 @@ void CXFA_Node::Script_Field_AddItem(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_Field_ExecValidate(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { pArguments->GetReturnValue()->SetBoolean(FALSE); } else { @@ -2359,7 +2355,7 @@ void CXFA_Node::Script_ExclGroup_SelectedMember(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_ExclGroup_ExecInitialize(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -2371,7 +2367,7 @@ void CXFA_Node::Script_ExclGroup_ExecInitialize(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_ExclGroup_ExecCalculate(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -2383,7 +2379,7 @@ void CXFA_Node::Script_ExclGroup_ExecCalculate(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_ExclGroup_ExecValidate(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { pArguments->GetReturnValue()->SetBoolean(FALSE); } else { @@ -2445,7 +2441,7 @@ void CXFA_Node::Script_Som_InstanceIndex(CFXJSE_Value* pValue, } if (pManagerNode) { pManagerNode->InstanceManager_MoveInstance(iTo, iFrom); - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -2520,7 +2516,7 @@ void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_Subform_ExecInitialize(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -2532,7 +2528,7 @@ void CXFA_Node::Script_Subform_ExecInitialize(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_Subform_ExecCalculate(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -2544,7 +2540,7 @@ void CXFA_Node::Script_Subform_ExecCalculate(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_Subform_ExecValidate(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { pArguments->GetReturnValue()->SetBoolean(FALSE); } else { @@ -3006,7 +3002,7 @@ void CXFA_Node::Script_InstanceManager_MoveInstance( int32_t iFrom = pArguments->GetInt32(0); int32_t iTo = pArguments->GetInt32(1); InstanceManager_MoveInstance(iTo, iFrom); - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -3041,7 +3037,7 @@ void CXFA_Node::Script_InstanceManager_RemoveInstance( } CXFA_Node* pRemoveInstance = XFA_ScriptInstanceManager_GetItem(this, iIndex); XFA_ScriptInstanceManager_RemoveItem(this, pRemoveInstance); - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (pNotify) { for (int32_t i = iIndex; i < iCount - 1; i++) { CXFA_Node* pSubformInstance = XFA_ScriptInstanceManager_GetItem(this, i); @@ -3092,7 +3088,7 @@ void CXFA_Node::Script_InstanceManager_AddInstance( FALSE); pArguments->GetReturnValue()->Assign( m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewInstance)); - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -3133,7 +3129,7 @@ void CXFA_Node::Script_InstanceManager_InsertInstance( TRUE); pArguments->GetReturnValue()->Assign( m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewInstance)); - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -3194,7 +3190,7 @@ int32_t CXFA_Node::InstanceManager_SetInstances(int32_t iDesired) { XFA_ScriptInstanceManager_InsertItem(this, pNewInstance, iCount, iCount, FALSE); iCount++; - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return 0; } @@ -3286,7 +3282,7 @@ void CXFA_Node::Script_Form_Remerge(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_Form_ExecInitialize(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -3305,7 +3301,7 @@ void CXFA_Node::Script_Form_Recalculate(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 1) { const bool bScriptFlags = pArguments->GetInt32(0) != 0; - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -3322,7 +3318,7 @@ void CXFA_Node::Script_Form_Recalculate(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_Form_ExecCalculate(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -3334,7 +3330,7 @@ void CXFA_Node::Script_Form_ExecCalculate(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_Form_ExecValidate(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { pArguments->GetReturnValue()->SetBoolean(FALSE); } else { @@ -4375,11 +4371,11 @@ CXFA_Node* CXFA_Node::GetProperty(int32_t index, return nullptr; } } - CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); + const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(dwPacket); CXFA_Node* pNewNode = nullptr; for (; iCount <= index; iCount++) { - pNewNode = pFactory->CreateNode(pPacket, eProperty); + pNewNode = m_pDocument->CreateNode(pPacket, eProperty); if (!pNewNode) return nullptr; InsertChild(pNewNode, nullptr); @@ -4462,7 +4458,7 @@ int32_t CXFA_Node::InsertChild(int32_t index, CXFA_Node* pNode) { ASSERT(m_pLastChild); ASSERT(!m_pLastChild->m_pNext); pNode->ClearFlag(XFA_NodeFlag_HasRemovedChildren); - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (pNotify) pNotify->OnChildAdded(this); @@ -4509,7 +4505,7 @@ FX_BOOL CXFA_Node::InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode) { ASSERT(m_pLastChild); ASSERT(!m_pLastChild->m_pNext); pNode->ClearFlag(XFA_NodeFlag_HasRemovedChildren); - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (pNotify) pNotify->OnChildAdded(this); @@ -4688,7 +4684,7 @@ bool CXFA_Node::HasFlag(XFA_NodeFlag dwFlag) const { void CXFA_Node::SetFlag(uint32_t dwFlag, bool bNotify) { if (dwFlag == XFA_NodeFlag_Initialized && bNotify && !IsInitialized()) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (pNotify) { pNotify->OnNodeReady(this); } @@ -4708,14 +4704,14 @@ void CXFA_Node::OnRemoved(bool bNotify) { if (!bNotify) return; - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (pNotify) pNotify->OnChildRemoved(); } void CXFA_Node::OnChanging(XFA_ATTRIBUTE eAttr, bool bNotify) { if (bNotify && IsInitialized()) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (pNotify) { pNotify->OnValueChanging(this, eAttr); } @@ -4737,7 +4733,7 @@ int32_t CXFA_Node::execSingleEventByName(const CFX_WideStringC& wsEventName, GetEventParaInfoByName(wsEventName); if (eventParaInfo) { uint32_t validFlags = eventParaInfo->m_validFlags; - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return iRet; } diff --git a/xfa/fxfa/parser/xfa_parser.h b/xfa/fxfa/parser/xfa_parser.h deleted file mode 100644 index 90b462541c..0000000000 --- a/xfa/fxfa/parser/xfa_parser.h +++ /dev/null @@ -1,35 +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_PARSER_H_ -#define XFA_FXFA_PARSER_XFA_PARSER_H_ - -#include "xfa/fxfa/parser/xfa_document.h" - -class CFDE_XMLDoc; - -class IXFA_Parser { - public: - static IXFA_Parser* Create(CXFA_Document* pFactory, - FX_BOOL bDocumentParser = FALSE); - - virtual ~IXFA_Parser() {} - virtual void Release() = 0; - virtual int32_t StartParse(IFX_FileRead* pStream, - XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP) = 0; - virtual int32_t DoParse(IFX_Pause* pPause = nullptr) = 0; - virtual int32_t ParseXMLData(const CFX_WideString& wsXML, - CFDE_XMLNode*& pXMLNode, - IFX_Pause* pPause = nullptr) = 0; - virtual void ConstructXFANode(CXFA_Node* pXFANode, - CFDE_XMLNode* pXMLNode) = 0; - virtual CXFA_Document* GetFactory() const = 0; - virtual CXFA_Node* GetRootNode() const = 0; - virtual CFDE_XMLDoc* GetXMLDoc() const = 0; - virtual void CloseParser() = 0; -}; - -#endif // XFA_FXFA_PARSER_XFA_PARSER_H_ diff --git a/xfa/fxfa/parser/xfa_parser_imp.cpp b/xfa/fxfa/parser/xfa_parser_imp.cpp index 2ce17372ae..e4387a7838 100644 --- a/xfa/fxfa/parser/xfa_parser_imp.cpp +++ b/xfa/fxfa/parser/xfa_parser_imp.cpp @@ -16,16 +16,11 @@ #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_parser.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_utils.h" -IXFA_Parser* IXFA_Parser::Create(CXFA_Document* pFactory, - FX_BOOL bDocumentParser) { - return new CXFA_SimpleParser(pFactory, bDocumentParser); -} CXFA_SimpleParser::CXFA_SimpleParser(CXFA_Document* pFactory, - FX_BOOL bDocumentParser) + bool bDocumentParser) : m_pXMLParser(nullptr), m_pXMLDoc(nullptr), m_pStream(nullptr), @@ -34,15 +29,15 @@ CXFA_SimpleParser::CXFA_SimpleParser(CXFA_Document* pFactory, m_pRootNode(nullptr), m_ePacketID(XFA_XDPPACKET_UNKNOWN), m_bDocumentParser(bDocumentParser) {} + CXFA_SimpleParser::~CXFA_SimpleParser() { CloseParser(); } -void CXFA_SimpleParser::Release() { - delete this; -} + void CXFA_SimpleParser::SetFactory(CXFA_Document* pFactory) { m_pFactory = pFactory; } + static CFDE_XMLNode* XFA_FDEExtension_GetDocumentNode( CFDE_XMLDoc* pXMLDoc, FX_BOOL bVerifyWellFormness = FALSE) { @@ -194,10 +189,6 @@ void CXFA_SimpleParser::ConstructXFANode(CXFA_Node* pXFANode, } } -CXFA_Document* CXFA_SimpleParser::GetFactory() const { - return m_pFactory; -} - CXFA_Node* CXFA_SimpleParser::GetRootNode() const { return m_pRootNode; } @@ -1335,23 +1326,22 @@ void CXFA_SimpleParser::CloseParser() { CXFA_DocumentParser::CXFA_DocumentParser(CXFA_FFNotify* pNotify) : m_nodeParser(nullptr, TRUE), m_pNotify(pNotify), m_pDocument(nullptr) {} + CXFA_DocumentParser::~CXFA_DocumentParser() { CloseParser(); } -void CXFA_DocumentParser::Release() { - delete this; -} int32_t CXFA_DocumentParser::StartParse(IFX_FileRead* pStream, XFA_XDPPACKET ePacketID) { CloseParser(); int32_t nRetStatus = m_nodeParser.StartParse(pStream, ePacketID); if (nRetStatus == XFA_PARSESTATUS_Ready) { - m_pDocument = new CXFA_Document(this); - m_nodeParser.SetFactory(m_pDocument); + m_pDocument.reset(new CXFA_Document(this)); + m_nodeParser.SetFactory(m_pDocument.get()); } return nRetStatus; } + int32_t CXFA_DocumentParser::DoParse(IFX_Pause* pPause) { int32_t nRetStatus = m_nodeParser.DoParse(pPause); if (nRetStatus >= XFA_PARSESTATUS_Done) { @@ -1360,36 +1350,6 @@ int32_t CXFA_DocumentParser::DoParse(IFX_Pause* pPause) { } return nRetStatus; } -int32_t CXFA_DocumentParser::ParseXMLData(const CFX_WideString& wsXML, - CFDE_XMLNode*& pXMLNode, - IFX_Pause* pPause) { - CloseParser(); - int32_t nRetStatus = m_nodeParser.ParseXMLData(wsXML, pXMLNode, nullptr); - if (nRetStatus == XFA_PARSESTATUS_Done && pXMLNode) { - m_pDocument = new CXFA_Document(this); - m_nodeParser.SetFactory(m_pDocument); - } - return nRetStatus; -} -void CXFA_DocumentParser::ConstructXFANode(CXFA_Node* pXFANode, - CFDE_XMLNode* pXMLNode) { - if (!pXFANode || !pXMLNode) { - return; - } - m_nodeParser.ConstructXFANode(pXFANode, pXMLNode); - CXFA_Node* pRootNode = m_nodeParser.GetRootNode(); - if (m_pDocument && pRootNode) { - m_pDocument->SetRoot(pRootNode); - } -} - -CXFA_Document* CXFA_DocumentParser::GetFactory() const { - return m_nodeParser.GetFactory(); -} - -CXFA_Node* CXFA_DocumentParser::GetRootNode() const { - return m_nodeParser.GetRootNode(); -} CFDE_XMLDoc* CXFA_DocumentParser::GetXMLDoc() const { return m_nodeParser.GetXMLDoc(); @@ -1400,12 +1360,11 @@ CXFA_FFNotify* CXFA_DocumentParser::GetNotify() const { } CXFA_Document* CXFA_DocumentParser::GetDocument() const { - return m_pDocument; + return m_pDocument.get(); } void CXFA_DocumentParser::CloseParser() { - delete m_pDocument; - m_pDocument = nullptr; + m_pDocument.reset(); m_nodeParser.CloseParser(); } diff --git a/xfa/fxfa/parser/xfa_parser_imp.h b/xfa/fxfa/parser/xfa_parser_imp.h index df0b31dc69..c10ab4dfdc 100644 --- a/xfa/fxfa/parser/xfa_parser_imp.h +++ b/xfa/fxfa/parser/xfa_parser_imp.h @@ -8,28 +8,28 @@ #define XFA_FXFA_PARSER_XFA_PARSER_IMP_H_ #include "xfa/fde/xml/fde_xml_imp.h" -#include "xfa/fxfa/parser/xfa_parser.h" +#include "xfa/fxfa/include/fxfa_basic.h" +class CXFA_Document; +class CXFA_FFNotify; +class CXFA_Node; class CXFA_XMLParser; -class CXFA_SimpleParser : public IXFA_Parser { +class CXFA_SimpleParser { public: - CXFA_SimpleParser(CXFA_Document* pFactory, FX_BOOL bDocumentParser = FALSE); - ~CXFA_SimpleParser() override; + CXFA_SimpleParser(CXFA_Document* pFactory, bool bDocumentParser); + ~CXFA_SimpleParser(); - // IXFA_Parser - void Release() override; int32_t StartParse(IFX_FileRead* pStream, - XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP) override; - int32_t DoParse(IFX_Pause* pPause = nullptr) override; + XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP); + int32_t DoParse(IFX_Pause* pPause = nullptr); int32_t ParseXMLData(const CFX_WideString& wsXML, CFDE_XMLNode*& pXMLNode, - IFX_Pause* pPause = nullptr) override; - void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode) override; - CXFA_Document* GetFactory() const override; - CXFA_Node* GetRootNode() const override; - CFDE_XMLDoc* GetXMLDoc() const override; - void CloseParser() override; + IFX_Pause* pPause = nullptr); + void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode); + CXFA_Node* GetRootNode() const; + CFDE_XMLDoc* GetXMLDoc() const; + void CloseParser(); protected: CXFA_Node* ParseAsXDPPacket(CFDE_XMLNode* pXMLDocumentNode, @@ -82,31 +82,24 @@ class CXFA_SimpleParser : public IXFA_Parser { friend class CXFA_DocumentParser; }; -class CXFA_DocumentParser : public IXFA_Parser { +class CXFA_DocumentParser { public: - CXFA_DocumentParser(CXFA_FFNotify* pNotify); - ~CXFA_DocumentParser() override; + explicit CXFA_DocumentParser(CXFA_FFNotify* pNotify); + ~CXFA_DocumentParser(); - // IXFA_Parser - void Release() override; int32_t StartParse(IFX_FileRead* pStream, - XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP) override; - int32_t DoParse(IFX_Pause* pPause = nullptr) override; - int32_t ParseXMLData(const CFX_WideString& wsXML, - CFDE_XMLNode*& pXMLNode, - IFX_Pause* pPause = nullptr) override; - void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode) override; - CXFA_Document* GetFactory() const override; - CXFA_Node* GetRootNode() const override; - CFDE_XMLDoc* GetXMLDoc() const override; + XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP); + int32_t DoParse(IFX_Pause* pPause = nullptr); + + CFDE_XMLDoc* GetXMLDoc() const; CXFA_FFNotify* GetNotify() const; CXFA_Document* GetDocument() const; - void CloseParser() override; + void CloseParser(); protected: CXFA_SimpleParser m_nodeParser; CXFA_FFNotify* m_pNotify; - CXFA_Document* m_pDocument; + std::unique_ptr m_pDocument; }; class CXFA_XMLParser : public CFDE_XMLParser { diff --git a/xfa/fxfa/parser/xfa_script_datawindow.cpp b/xfa/fxfa/parser/xfa_script_datawindow.cpp index c04b5e2770..8e37e00911 100644 --- a/xfa/fxfa/parser/xfa_script_datawindow.cpp +++ b/xfa/fxfa/parser/xfa_script_datawindow.cpp @@ -11,7 +11,6 @@ #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_parser.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp index 1c54a5dbb7..a08b512591 100644 --- a/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp @@ -14,7 +14,6 @@ #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_parser.h" #include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_script_imp.h" @@ -212,7 +211,7 @@ void CScript_EventPseudoModel::Emit(CFXJSE_Arguments* pArguments) { if (!pEventParam) { return; } - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } diff --git a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp index 6d659cd9c6..b699c1f3ca 100644 --- a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp @@ -13,7 +13,6 @@ #include "xfa/fxfa/parser/xfa_document_layout_imp.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" -#include "xfa/fxfa/parser/xfa_parser.h" #include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_script_imp.h" @@ -39,10 +38,11 @@ void CScript_HostPseudoModel::LoadString(CFXJSE_Value* pValue, pNotify->GetAppProvider()->LoadString(dwFlag, wsValue); pValue->SetString(FX_UTF8Encode(wsValue).AsStringC()); } + void CScript_HostPseudoModel::AppType(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -54,10 +54,11 @@ void CScript_HostPseudoModel::AppType(CFXJSE_Value* pValue, pNotify->GetAppProvider()->GetAppType(wsAppType); pValue->SetString(FX_UTF8Encode(wsAppType).AsStringC()); } + void CScript_HostPseudoModel::FoxitAppType(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -69,10 +70,11 @@ void CScript_HostPseudoModel::FoxitAppType(CFXJSE_Value* pValue, pNotify->GetAppProvider()->GetFoxitAppType(wsAppType); pValue->SetString(FX_UTF8Encode(wsAppType).AsStringC()); } + void CScript_HostPseudoModel::CalculationsEnabled(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -84,10 +86,11 @@ void CScript_HostPseudoModel::CalculationsEnabled(CFXJSE_Value* pValue, } pValue->SetBoolean(pNotify->GetDocProvider()->IsCalculationsEnabled(hDoc)); } + void CScript_HostPseudoModel::CurrentPage(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -98,10 +101,11 @@ void CScript_HostPseudoModel::CurrentPage(CFXJSE_Value* pValue, } pValue->SetInteger(pNotify->GetDocProvider()->GetCurrentPage(hDoc)); } + void CScript_HostPseudoModel::Language(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -113,10 +117,11 @@ void CScript_HostPseudoModel::Language(CFXJSE_Value* pValue, pNotify->GetAppProvider()->GetLanguage(wsLanguage); pValue->SetString(FX_UTF8Encode(wsLanguage).AsStringC()); } + void CScript_HostPseudoModel::NumPages(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -127,10 +132,11 @@ void CScript_HostPseudoModel::NumPages(CFXJSE_Value* pValue, } pValue->SetInteger(pNotify->GetDocProvider()->CountPages(hDoc)); } + void CScript_HostPseudoModel::Platform(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -148,7 +154,7 @@ void CScript_HostPseudoModel::Title(CFXJSE_Value* pValue, if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { return; } - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -161,10 +167,11 @@ void CScript_HostPseudoModel::Title(CFXJSE_Value* pValue, pNotify->GetDocProvider()->GetTitle(hDoc, wsTitle); pValue->SetString(FX_UTF8Encode(wsTitle).AsStringC()); } + void CScript_HostPseudoModel::ValidationsEnabled(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -182,7 +189,7 @@ void CScript_HostPseudoModel::Variation(CFXJSE_Value* pValue, if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { return; } - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -194,10 +201,11 @@ void CScript_HostPseudoModel::Variation(CFXJSE_Value* pValue, pNotify->GetAppProvider()->GetVariation(wsVariation); pValue->SetString(FX_UTF8Encode(wsVariation).AsStringC()); } + void CScript_HostPseudoModel::Version(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -209,10 +217,11 @@ void CScript_HostPseudoModel::Version(CFXJSE_Value* pValue, pNotify->GetAppProvider()->GetVersion(wsVersion); pValue->SetString(FX_UTF8Encode(wsVersion).AsStringC()); } + void CScript_HostPseudoModel::FoxitVersion(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -224,10 +233,11 @@ void CScript_HostPseudoModel::FoxitVersion(CFXJSE_Value* pValue, pNotify->GetAppProvider()->GetFoxitVersion(wsVersion); pValue->SetString(FX_UTF8Encode(wsVersion).AsStringC()); } + void CScript_HostPseudoModel::Name(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -239,10 +249,11 @@ void CScript_HostPseudoModel::Name(CFXJSE_Value* pValue, pNotify->GetAppProvider()->GetAppName(wsAppName); pValue->SetString(FX_UTF8Encode(wsAppName).AsStringC()); } + void CScript_HostPseudoModel::FoxitName(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -263,7 +274,7 @@ void CScript_HostPseudoModel::GotoURL(CFXJSE_Arguments* pArguments) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"gotoURL"); return; } - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -284,7 +295,7 @@ void CScript_HostPseudoModel::OpenList(CFXJSE_Arguments* pArguments) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"openList"); return; } - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -331,7 +342,7 @@ void CScript_HostPseudoModel::Response(CFXJSE_Arguments* pArguments) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"response"); return; } - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -360,8 +371,9 @@ void CScript_HostPseudoModel::Response(CFXJSE_Arguments* pArguments) { if (pValue) pValue->SetString(FX_UTF8Encode(wsAnswer).AsStringC()); } + void CScript_HostPseudoModel::DocumentInBatch(CFXJSE_Arguments* pArguments) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -400,7 +412,7 @@ void CScript_HostPseudoModel::ResetData(CFXJSE_Arguments* pArguments) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"resetData"); return; } - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -451,7 +463,7 @@ void CScript_HostPseudoModel::Beep(CFXJSE_Arguments* pArguments) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"beep"); return; } - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -470,7 +482,7 @@ void CScript_HostPseudoModel::SetFocus(CFXJSE_Arguments* pArguments) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setFocus"); return; } - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -501,8 +513,9 @@ void CScript_HostPseudoModel::SetFocus(CFXJSE_Arguments* pArguments) { } pNotify->SetFocusWidgetNode(pNode); } + void CScript_HostPseudoModel::GetFocus(CFXJSE_Arguments* pArguments) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -522,7 +535,7 @@ void CScript_HostPseudoModel::MessageBox(CFXJSE_Arguments* pArguments) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"messageBox"); return; } - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -584,7 +597,7 @@ FX_BOOL CScript_HostPseudoModel::ValidateArgsForMsg( } void CScript_HostPseudoModel::DocumentCountInBatch( CFXJSE_Arguments* pArguments) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -602,7 +615,7 @@ void CScript_HostPseudoModel::Print(CFXJSE_Arguments* pArguments) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"print"); return; } - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -667,7 +680,7 @@ void CScript_HostPseudoModel::ImportData(CFXJSE_Arguments* pArguments) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"importData"); return; } - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -685,7 +698,7 @@ void CScript_HostPseudoModel::ExportData(CFXJSE_Arguments* pArguments) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"exportData"); return; } - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -701,8 +714,9 @@ void CScript_HostPseudoModel::ExportData(CFXJSE_Arguments* pArguments) { } pNotify->GetDocProvider()->ExportData(hDoc, wsFilePath, bXDP); } + void CScript_HostPseudoModel::PageUp(CFXJSE_Arguments* pArguments) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -715,8 +729,9 @@ void CScript_HostPseudoModel::PageUp(CFXJSE_Arguments* pArguments) { nNewPage = nCurPage - 1; pNotify->GetDocProvider()->SetCurrentPage(hDoc, nNewPage); } + void CScript_HostPseudoModel::PageDown(CFXJSE_Arguments* pArguments) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -734,8 +749,9 @@ void CScript_HostPseudoModel::PageDown(CFXJSE_Arguments* pArguments) { } pNotify->GetDocProvider()->SetCurrentPage(hDoc, nNewPage); } + void CScript_HostPseudoModel::CurrentDateTime(CFXJSE_Arguments* pArguments) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } diff --git a/xfa/fxfa/parser/xfa_script_imp.cpp b/xfa/fxfa/parser/xfa_script_imp.cpp index 10ca2106ca..95298e4799 100644 --- a/xfa/fxfa/parser/xfa_script_imp.cpp +++ b/xfa/fxfa/parser/xfa_script_imp.cpp @@ -16,7 +16,6 @@ #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_parser.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_script_nodehelper.h" #include "xfa/fxfa/parser/xfa_script_resolveprocessor.h" diff --git a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp index b8864a6f4f..5b24e3ae2e 100644 --- a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp @@ -17,7 +17,6 @@ #include "xfa/fxfa/parser/xfa_layout_appadapter.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" -#include "xfa/fxfa/parser/xfa_parser.h" #include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_script_imp.h" @@ -31,7 +30,7 @@ CScript_LayoutPseudoModel::~CScript_LayoutPseudoModel() {} void CScript_LayoutPseudoModel::Ready(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -345,7 +344,7 @@ void CScript_LayoutPseudoModel::PageContent(CFXJSE_Arguments* pArguments) { if (iLength >= 3) { bOnPageArea = pArguments->GetInt32(2) == 0 ? FALSE : TRUE; } - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -365,7 +364,7 @@ void CScript_LayoutPseudoModel::AbsPageCount(CFXJSE_Arguments* pArguments) { } void CScript_LayoutPseudoModel::AbsPageCountInBatch( CFXJSE_Arguments* pArguments) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -377,7 +376,7 @@ void CScript_LayoutPseudoModel::AbsPageCountInBatch( } void CScript_LayoutPseudoModel::SheetCountInBatch( CFXJSE_Arguments* pArguments) { - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -414,7 +413,7 @@ void CScript_LayoutPseudoModel::AbsPageInBatch(CFXJSE_Arguments* pArguments) { if (!pNode) { return; } - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -446,7 +445,7 @@ void CScript_LayoutPseudoModel::SheetInBatch(CFXJSE_Arguments* pArguments) { if (!pNode) { return; } - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } diff --git a/xfa/fxfa/parser/xfa_script_logpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_logpseudomodel.cpp index d835bd5057..800a8059d5 100644 --- a/xfa/fxfa/parser/xfa_script_logpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_logpseudomodel.cpp @@ -11,7 +11,6 @@ #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_parser.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/xfa_script_nodehelper.cpp b/xfa/fxfa/parser/xfa_script_nodehelper.cpp index ecb4616d9b..dd0f3eacd8 100644 --- a/xfa/fxfa/parser/xfa_script_nodehelper.cpp +++ b/xfa/fxfa/parser/xfa_script_nodehelper.cpp @@ -11,7 +11,6 @@ #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_parser.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_script_imp.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp index aed23f0b01..2025cf246b 100644 --- a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp +++ b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp @@ -11,7 +11,6 @@ #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_parser.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_script_imp.h" #include "xfa/fxfa/parser/xfa_script_nodehelper.h" diff --git a/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp b/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp index 007820c47c..c328396e79 100644 --- a/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp @@ -12,7 +12,6 @@ #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_parser.h" #include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_script_imp.h" @@ -30,7 +29,7 @@ void CScript_SignaturePseudoModel::Verify(CFXJSE_Arguments* pArguments) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"verify"); return; } - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -50,7 +49,7 @@ void CScript_SignaturePseudoModel::Sign(CFXJSE_Arguments* pArguments) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"sign"); return; } - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -81,7 +80,7 @@ void CScript_SignaturePseudoModel::Enumerate(CFXJSE_Arguments* pArguments) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"enumerate"); return; } - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } @@ -98,7 +97,7 @@ void CScript_SignaturePseudoModel::Clear(CFXJSE_Arguments* pArguments) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"clear"); return; } - CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); if (!pNotify) { return; } diff --git a/xfa/fxfa/parser/xfa_utils_imp.cpp b/xfa/fxfa/parser/xfa_utils_imp.cpp index 5a7c2d1104..3e0db4836b 100644 --- a/xfa/fxfa/parser/xfa_utils_imp.cpp +++ b/xfa/fxfa/parser/xfa_utils_imp.cpp @@ -13,7 +13,6 @@ #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_localevalue.h" #include "xfa/fxfa/parser/xfa_object.h" -#include "xfa/fxfa/parser/xfa_parser.h" #include "xfa/fxfa/parser/xfa_script.h" namespace { -- cgit v1.2.3