diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-01-09 11:00:15 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-01-09 14:03:18 +0100 |
commit | fd6feb4f538b0c5c9061529ff002be9f62a7239a (patch) | |
tree | 592a672aa902450997c6d3f03aebe345ccb73280 /sw | |
parent | 9c0065dd4127b852281a175e523b176730dea417 (diff) |
Use FastParser in SwXMLTextBlocks
the underlying SvXMLImport subclass already has a FastParser inside it
Change-Id: I4c33508fc28eac2c119361506158c1f4520162ce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86476
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/swg/SwXMLTextBlocks1.cxx | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx index 36a69ffb033c..9995d3c1fde1 100644 --- a/sw/source/core/swg/SwXMLTextBlocks1.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx @@ -195,9 +195,6 @@ ErrCode SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx, uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); - // get parser - uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create( xContext ); - // create descriptor and reference to it. Either // both or neither must be kept because of the // reference counting! @@ -211,21 +208,15 @@ ErrCode SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx, OUString sFilterComponent = bOasis ? OUString("com.sun.star.comp.Writer.XMLOasisAutotextEventsImporter") : OUString("com.sun.star.comp.Writer.XMLAutotextEventsImporter"); - uno::Reference< xml::sax::XDocumentHandler > xFilter( + uno::Reference< xml::sax::XFastParser > xFilter( xContext->getServiceManager()->createInstanceWithArgumentsAndContext( sFilterComponent, aFilterArguments, xContext), - UNO_QUERY ); - OSL_ENSURE( xFilter.is(), "can't instantiate autotext-events filter"); - if ( !xFilter.is() ) - return ERR_SWG_READ_ERROR; - - // connect parser and filter - xParser->setDocumentHandler( xFilter ); + UNO_QUERY_THROW ); // parse the stream try { - xParser->parseStream( aParserInput ); + xFilter->parseStream( aParserInput ); } catch( xml::sax::SAXParseException& ) { @@ -234,10 +225,12 @@ ErrCode SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx, } catch( xml::sax::SAXException& ) { + TOOLS_WARN_EXCEPTION("sw", ""); return ERR_SWG_READ_ERROR; } catch( io::IOException& ) { + TOOLS_WARN_EXCEPTION("sw", ""); return ERR_SWG_READ_ERROR; } |