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>
diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx
index 36a69ff..9995d3c 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;
}