diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-10-17 10:30:31 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-10-17 11:32:00 +0200 |
commit | d9596a20b8b0664e5570e421184767e6edaa57bb (patch) | |
tree | f3d1aa72ad6f978d4950dac98b70ce48bc883c66 /xmloff | |
parent | e7eaa66d4de5d3c634e8a148f8838276d539546c (diff) |
xmloff: use the fastparser API when possible
part of the process of making SvXMLImport fastparser-only
Change-Id: If80ba22f370d5da6f268d6456ab0c974e6ff4209
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104455
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/core/XMLEmbeddedObjectImportContext.cxx | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx b/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx index 3255e2e6fdbf..36bb7e4d8e7e 100644 --- a/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx +++ b/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx @@ -21,6 +21,7 @@ #include <string_view> +#include <sal/log.hxx> #include <com/sun/star/document/XImporter.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/util/XModifiable2.hpp> @@ -74,6 +75,7 @@ XMLEmbeddedObjectImportContext_Impl::XMLEmbeddedObjectImportContext_Impl( SvXMLImportContext( rImport, nPrfx, rLName ), xHandler( rHandler ) { + assert(xHandler); } SvXMLImportContextRef XMLEmbeddedObjectImportContext_Impl::CreateChildContext( @@ -115,15 +117,18 @@ void XMLEmbeddedObjectImportContext::SetComponent( Reference< XComponent > const Reference< XComponentContext > xContext( GetImport().GetComponentContext() ); - xHandler.set( - xContext->getServiceManager()->createInstanceWithArgumentsAndContext(sFilterService, aArgs, xContext), - UNO_QUERY); - - if( !xHandler.is() ) + Reference<XInterface> xFilter = + xContext->getServiceManager()->createInstanceWithArgumentsAndContext(sFilterService, aArgs, xContext); + SAL_WARN_IF(!xFilter, "xmloff", "could not create filter " << sFilterService); + if( !xFilter.is() ) return; - if (SvXMLImport *pFastHandler = dynamic_cast<SvXMLImport*>(xHandler.get())) + if (SvXMLImport *pFastHandler = dynamic_cast<SvXMLImport*>(xFilter.get())) xHandler.set( new SvXMLLegacyToFastDocHandler( pFastHandler ) ); + else + xHandler.set(xFilter, UNO_QUERY); + + assert( xHandler ); try { |