diff options
author | Justin Luth <justin_luth@sil.org> | 2021-12-17 18:45:42 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-12-20 08:32:24 +0100 |
commit | 97783676a85ea49aee856b5bd7193a4911856946 (patch) | |
tree | dbf7460be027114897ce4302338e2fc1b43ba9c0 /sw/source | |
parent | f16a19c1869dc167adf44461a7da583a7fa9179f (diff) |
tdf#144364 sw: Revert "Use FastParser in SwXMLTextBlocks"
This reverts 7.0 commit fd6feb4f538b0c5c9061529ff002be9f62a7239a.
Noel said this was just a performance fix, so just go ahead
and revert it.
It caused the regression documented in bug 144364.
Change-Id: I044c49e42873db120a94d93a00e9b35105778b9c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127012
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
(cherry picked from commit 1addd8c104f6ad390bdd0ca61cd5ce97b55ce218)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126982
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/swg/SwXMLTextBlocks1.cxx | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx index 9f0c6cb545af..36ff82236c9e 100644 --- a/sw/source/core/swg/SwXMLTextBlocks1.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx @@ -31,6 +31,7 @@ #include <com/sun/star/io/IOException.hpp> #include <com/sun/star/xml/sax/FastParser.hpp> #include <com/sun/star/xml/sax/FastToken.hpp> +#include <com/sun/star/xml/sax/Parser.hpp> #include <com/sun/star/xml/sax/Writer.hpp> #include <com/sun/star/xml/sax/SAXParseException.hpp> #include <com/sun/star/document/XStorageBasedDocument.hpp> @@ -194,6 +195,9 @@ 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! @@ -205,15 +209,21 @@ 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::XFastParser > xFilter( + uno::Reference< xml::sax::XDocumentHandler > xFilter( xContext->getServiceManager()->createInstanceWithArgumentsAndContext( sFilterComponent, aFilterArguments, xContext), - UNO_QUERY_THROW ); + 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 ); // parse the stream try { - xFilter->parseStream( aParserInput ); + xParser->parseStream( aParserInput ); } catch( xml::sax::SAXParseException& ) { |