From 5678bc99fb685fe09191e8419a1121e565f97f80 Mon Sep 17 00:00:00 2001 From: Mohammed Abdul Azeem Date: Sun, 25 Sep 2016 11:06:32 +0530 Subject: tdf#101935 and tdf#102201: This fixes both the bugs. Change-Id: I7a64abc0cb12b5195a3b955549ce4f72f3530d57 Reviewed-on: https://gerrit.libreoffice.org/29263 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- xmloff/source/core/xmlimp.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'xmloff') diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index 715ddb9e3f9f..66e6075fb1bc 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -431,6 +431,7 @@ SvXMLImport::SvXMLImport( mnErrorFlags(SvXMLErrorFlags::NO), isFastContext( false ), maNamespaceHandler( new SvXMLImportFastNamespaceHandler() ), + mxFastDocumentHandler( nullptr ), mxTokenHandler( new FastTokenHandler() ), mbIsFormsSupported( true ), mbIsTableShapeSupported( false ), @@ -439,7 +440,6 @@ SvXMLImport::SvXMLImport( SAL_WARN_IF( !xContext.is(), "xmloff.core", "got no service manager" ); InitCtor_(); mxParser = xml::sax::FastParser::create( xContext ); - setFastDocumentHandler( this ); setNamespaceHandler( maNamespaceHandler.get() ); setTokenHandler( mxTokenHandler ); registerNamespaces(); @@ -478,13 +478,19 @@ sal_Int64 SAL_CALL SvXMLImport::getSomething( const uno::Sequence< sal_Int8 >& r void SAL_CALL SvXMLImport::parseStream( const xml::sax::InputSource& aInputSource ) throw (xml::sax::SAXException, io::IOException, uno::RuntimeException, std::exception) { + if ( mxFastDocumentHandler.is() ) + mxParser->setFastDocumentHandler( mxFastDocumentHandler ); + else + mxParser->setFastDocumentHandler( this ); + mxParser->parseStream( aInputSource ); + mxParser->setFastDocumentHandler( nullptr ); } void SAL_CALL SvXMLImport::setFastDocumentHandler( const uno::Reference< xml::sax::XFastDocumentHandler >& Handler ) throw (uno::RuntimeException, std::exception) { - mxParser->setFastDocumentHandler( Handler ); + mxFastDocumentHandler = Handler; } void SAL_CALL SvXMLImport::setTokenHandler( const uno::Reference< xml::sax::XFastTokenHandler >& Handler ) -- cgit