diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-02-12 13:02:25 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-03-04 07:46:05 +0100 |
commit | fed3ed5828eda88f82d97e95b34dfdd1ca0c9dec (patch) | |
tree | 4b508dd4b537745d4d61dcbbeb03b3aca49cacc7 /xmloff | |
parent | 6c86b57a746ab8941ae1c4b0dd1a10c381395eed (diff) |
restore namespace unwinding in SvXMLImport
accidentally lost during the fastparser conversion
Change-Id: I7d53e9f32dd8cff650b9ffb6dae493419ce8461f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110813
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
(cherry picked from commit e5f436bc53e0d07654901ef7cc8ff56d04f0686e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111897
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/core/XMLEmbeddedObjectImportContext.cxx | 3 | ||||
-rw-r--r-- | xmloff/source/core/xmlimp.cxx | 11 |
2 files changed, 11 insertions, 3 deletions
diff --git a/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx b/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx index a8cc84392627..5f6073d171bc 100644 --- a/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx +++ b/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx @@ -82,8 +82,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLEmbeddedObjectImpor sal_Int32 , const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) { - // we carry no state, so just re-use the same instance - return this; + return new XMLEmbeddedObjectImportContext_Impl(GetImport(), mxFastHandler); } void XMLEmbeddedObjectImportContext_Impl::startFastElement( diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index c47ad94ceffa..4a8241e4ea69 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -765,7 +765,7 @@ void SAL_CALL SvXMLImport::startFastElement (sal_Int32 Element, maNamespaceAttrList->Clear(); maNamespaceHandler->addNSDeclAttributes( maNamespaceAttrList ); - processNSAttributes( maNamespaceAttrList.get() ); + std::unique_ptr<SvXMLNamespaceMap> pRewindMap = processNSAttributes( maNamespaceAttrList.get() ); SvXMLImportContextRef xContext; const bool bRootContext = maContexts.empty(); @@ -828,6 +828,10 @@ void SAL_CALL SvXMLImport::startFastElement (sal_Int32 Element, if ( !xContext ) xContext.set( new SvXMLImportContext( *this ) ); + // Remember old namespace map. + if( pRewindMap ) + xContext->PutRewindMap(std::move(pRewindMap)); + // Call a startElement at the new context. xContext->startFastElement( Element, Attribs ); @@ -917,8 +921,13 @@ void SAL_CALL SvXMLImport::endFastElement (sal_Int32 Element) return; } SvXMLImportContextRef xContext = std::move(maContexts.top()); + // Get a namespace map to rewind. + std::unique_ptr<SvXMLNamespaceMap> pRewindMap = xContext->TakeRewindMap(); maContexts.pop(); xContext->endFastElement( Element ); + // Rewind a namespace map. + if (pRewindMap) + mpNamespaceMap = std::move(pRewindMap); } void SAL_CALL SvXMLImport::endUnknownElement (const OUString & rPrefix, const OUString & rLocalName) |