From e1a47ddab37e70c400de254251be38e844117cc1 Mon Sep 17 00:00:00 2001 From: Noel Date: Fri, 16 Oct 2020 09:16:41 +0200 Subject: chart2: use the fastparser API when possible part of the process of making SvXMLImport fastparser-only Change-Id: I9fd7dbcc8b5c345f7e86bc06b1b898b7d39f36da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104412 Tested-by: Jenkins Reviewed-by: Noel Grandin --- chart2/source/model/filter/XMLFilter.cxx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'chart2') diff --git a/chart2/source/model/filter/XMLFilter.cxx b/chart2/source/model/filter/XMLFilter.cxx index 3980e96003e2..76f88027a0e2 100644 --- a/chart2/source/model/filter/XMLFilter.cxx +++ b/chart2/source/model/filter/XMLFilter.cxx @@ -440,11 +440,11 @@ ErrCode XMLFilter::impl_ImportStream( aFilterCompArgs[ nArgs++ ] <<= xImportInfo; // the underlying SvXMLImport implements XFastParser, XImporter, XFastDocumentHandler - Reference< xml::sax::XDocumentHandler > xDocHandler( - xFactory->createInstanceWithArgumentsAndContext( rServiceName, aFilterCompArgs, m_xContext ), - uno::UNO_QUERY_THROW ); - - Reference< document::XImporter > xImporter( xDocHandler, uno::UNO_QUERY_THROW ); + Reference< XInterface > xFilter = + xFactory->createInstanceWithArgumentsAndContext( rServiceName, aFilterCompArgs, m_xContext ); + assert(xFilter); + Reference< document::XImporter > xImporter( xFilter, uno::UNO_QUERY ); + assert(xImporter); xImporter->setTargetDocument( Reference< lang::XComponent >( m_xTargetDoc, uno::UNO_SET_THROW )); if ( !m_sDocumentHandler.isEmpty() ) @@ -454,30 +454,30 @@ ErrCode XMLFilter::impl_ImportStream( uno::Sequence< uno::Any > aArgs(2); beans::NamedValue aValue; aValue.Name = "DocumentHandler"; - aValue.Value <<= xDocHandler; + aValue.Value <<= xFilter; aArgs[0] <<= aValue; aValue.Name = "Model"; aValue.Value <<= m_xTargetDoc; aArgs[1] <<= aValue; - xDocHandler.set(xFactory->createInstanceWithArgumentsAndContext(m_sDocumentHandler,aArgs,m_xContext), uno::UNO_QUERY_THROW ); + xFilter = xFactory->createInstanceWithArgumentsAndContext(m_sDocumentHandler,aArgs,m_xContext); } catch (const uno::Exception&) { - TOOLS_WARN_EXCEPTION("chart2", ""); + TOOLS_WARN_EXCEPTION("chart2", "failed to instantiate " << m_sDocumentHandler); } } xml::sax::InputSource aParserInput; aParserInput.aInputStream.set(xInputStream, uno::UNO_QUERY_THROW); // the underlying SvXMLImport implements XFastParser, XImporter, XFastDocumentHandler - Reference< xml::sax::XFastParser > xFastParser(xDocHandler, uno::UNO_QUERY); + Reference< xml::sax::XFastParser > xFastParser(xFilter, uno::UNO_QUERY); if (xFastParser.is()) xFastParser->parseStream(aParserInput); else { Reference xParser = xml::sax::Parser::create(m_xContext); - xParser->setDocumentHandler( xDocHandler ); + xParser->setDocumentHandler( uno::Reference(xFilter, uno::UNO_QUERY_THROW) ); xParser->parseStream(aParserInput); } } -- cgit