[Libreoffice-commits] core.git: xmloff/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Sat Oct 17 09:32:40 UTC 2020
xmloff/source/core/XMLEmbeddedObjectImportContext.cxx | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
New commits:
commit d9596a20b8b0664e5570e421184767e6edaa57bb
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sat Oct 17 10:30:31 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Oct 17 11:32:00 2020 +0200
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 at collabora.co.uk>
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
{
More information about the Libreoffice-commits
mailing list