[Libreoffice-commits] core.git: svx/source
Noel (via logerrit)
logerrit at kemper.freedesktop.org
Fri Oct 16 15:46:00 UTC 2020
svx/source/xml/xmlexport.cxx | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
New commits:
commit 3dd9fb3076511faa94363be56d416fdfa8249c30
Author: Noel <noelgrandin at gmail.com>
AuthorDate: Fri Oct 16 13:24:34 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Oct 16 17:45:17 2020 +0200
svx: use the fastparser API when possible
part of the process of making SvXMLImport fastparser-only
Change-Id: I30aa8a429fabf54e39cf401419f627cc13ed719c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104427
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/svx/source/xml/xmlexport.cxx b/svx/source/xml/xmlexport.cxx
index 5f179873b0ca..e36f6f5191b7 100644
--- a/svx/source/xml/xmlexport.cxx
+++ b/svx/source/xml/xmlexport.cxx
@@ -185,9 +185,6 @@ bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference<io::XInputStr
xml::sax::InputSource aParserInput;
aParserInput.aInputStream = xInputStream;
- // get parser
- Reference< xml::sax::XParser > xParser = xml::sax::Parser::create( xContext );
-
// prepare filter arguments
Sequence<Any> aFilterArgs( 2 );
Any *pArgs = aFilterArgs.getArray();
@@ -195,26 +192,20 @@ bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference<io::XInputStr
*pArgs++ <<= xObjectResolver;
// get filter
- Reference< xml::sax::XDocumentHandler > xFilter( xContext->getServiceManager()->createInstanceWithArgumentsAndContext( OUString::createFromAscii( pImportService ), aFilterArgs, xContext), UNO_QUERY );
- uno::Reference< xml::sax::XFastParser > xFastParser = dynamic_cast<
- xml::sax::XFastParser* >( xFilter.get() );
- DBG_ASSERT( xFilter.is(), "Can't instantiate filter component." );
+ Reference< XInterface > xFilter = xContext->getServiceManager()->createInstanceWithArgumentsAndContext( OUString::createFromAscii( pImportService ), aFilterArgs, xContext);
+ SAL_WARN_IF( !xFilter, "svx", "Can't instantiate filter component " << pImportService);
+ uno::Reference< xml::sax::XFastParser > xFastParser( xFilter, UNO_QUERY );
+ assert(xFastParser);
bRet = false;
- if( xParser.is() && xFilter.is() )
+ if( xFastParser.is() )
{
- // connect parser and filter
- xParser->setDocumentHandler( xFilter );
-
// connect model and filter
uno::Reference < document::XImporter > xImporter( xFilter, UNO_QUERY );
xImporter->setTargetDocument( xTargetDocument );
// finally, parser the stream
- if( xFastParser.is() )
- xFastParser->parseStream( aParserInput );
- else
- xParser->parseStream( aParserInput );
+ xFastParser->parseStream( aParserInput );
bRet = true;
}
More information about the Libreoffice-commits
mailing list