[Libreoffice-commits] core.git: sw/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jan 9 13:03:52 UTC 2020
sw/source/core/swg/SwXMLTextBlocks1.cxx | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
New commits:
commit fd6feb4f538b0c5c9061529ff002be9f62a7239a
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jan 9 11:00:15 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Jan 9 14:03:18 2020 +0100
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 at collabora.co.uk>
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;
}
More information about the Libreoffice-commits
mailing list