[Libreoffice-commits] core.git: include/xmloff xmloff/source

Mohammed Abdul Azeem azeemmysore at gmail.com
Sun Sep 25 13:25:03 UTC 2016


 include/xmloff/xmlimp.hxx     |    1 +
 xmloff/source/core/xmlimp.cxx |   10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 5678bc99fb685fe09191e8419a1121e565f97f80
Author: Mohammed Abdul Azeem <azeemmysore at gmail.com>
Date:   Sun Sep 25 11:06:32 2016 +0530

    tdf#101935 and tdf#102201:
    
    This fixes both the bugs.
    
    Change-Id: I7a64abc0cb12b5195a3b955549ce4f72f3530d57
    Reviewed-on: https://gerrit.libreoffice.org/29263
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index 87634e7..93c5f25 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -194,6 +194,7 @@ class XMLOFF_DLLPUBLIC SvXMLImport : public ::cppu::WeakImplHelper8<
     bool isFastContext;
     css::uno::Reference< css::xml::sax::XFastParser > mxParser;
     rtl::Reference< SvXMLImportFastNamespaceHandler > maNamespaceHandler;
+    css::uno::Reference< css::xml::sax::XFastDocumentHandler > mxFastDocumentHandler;
     css::uno::Reference< css::xml::sax::XFastTokenHandler > mxTokenHandler;
     std::unordered_map< sal_Int32, OUString > maNamespaceMap;
     const OUString getNameFromToken( sal_Int32 nToken );
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 715ddb9..66e6075 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 )


More information about the Libreoffice-commits mailing list