reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx |    8 +++++---
 reportdesign/source/filter/xml/xmlImportDocumentHandler.hxx |    3 +++
 2 files changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 70f3a94949cce612be9eff14fca94976acfc61a4
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue Mar 29 20:00:09 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Mar 30 09:38:49 2022 +0200

    tdf#117162 ImportDocumentHandler expected XDocumentHandler argument
    
    but SvXMLImport not longer supports XDocumentHandler since
    
    commit fe2b4e7dc6533535736a8f08496f316427386179
    Date:   Tue Oct 6 18:27:27 2020 +0200
    
        make SvXMLImport fast-parser only
    
    here use a SvXMLLegacyToFastDocHandler to try and glue the two
    parts together again. Though the use of reflection::XProxyFactory
    is a bit worrying here wrt this change so unforseen side effects
    are possible. Full change over to fast-parser only is probably
    advisable.
    
    Change-Id: Ie14d1d9fa8534c187efc67a6c1cc0989316c4634
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132285
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx 
b/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx
index 3d8b2c1be603..963264436092 100644
--- a/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx
+++ b/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx
@@ -331,13 +331,15 @@ void SAL_CALL ImportDocumentHandler::initialize( const 
uno::Sequence< uno::Any >
 {
     ::osl::MutexGuard aGuard(m_aMutex);
     comphelper::SequenceAsHashMap aArgs(_aArguments);
-    m_xDelegatee = 
aArgs.getUnpackedValueOrDefault("DocumentHandler",m_xDelegatee);
+    m_xDocumentHandler = 
aArgs.getUnpackedValueOrDefault("DocumentHandler",m_xDocumentHandler);
     m_xModel = aArgs.getUnpackedValueOrDefault("Model",m_xModel);
 
-    OSL_ENSURE(m_xDelegatee.is(),"No document handler available!");
-    if ( !m_xDelegatee.is() || !m_xModel.is() )
+    OSL_ENSURE(m_xDocumentHandler.is(), "No document handler available!");
+    if (!m_xDocumentHandler.is() || !m_xModel.is())
         throw uno::Exception("no delegatee and no model", nullptr);
 
+    m_xDelegatee.set(new 
SvXMLLegacyToFastDocHandler(dynamic_cast<SvXMLImport*>(m_xDocumentHandler.get())));
+
     m_xDatabaseDataProvider.set(m_xModel->getDataProvider(),uno::UNO_QUERY);
     if ( !m_xDatabaseDataProvider.is() )
     {
diff --git a/reportdesign/source/filter/xml/xmlImportDocumentHandler.hxx 
b/reportdesign/source/filter/xml/xmlImportDocumentHandler.hxx
index 342194a9612a..aadea441ca62 100644
--- a/reportdesign/source/filter/xml/xmlImportDocumentHandler.hxx
+++ b/reportdesign/source/filter/xml/xmlImportDocumentHandler.hxx
@@ -23,12 +23,14 @@
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <cppuhelper/implbase3.hxx>
 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XFastDocumentHandler.hpp>
 #include <com/sun/star/lang/XInitialization.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/lang/XTypeProvider.hpp>
 #include <com/sun/star/chart2/XChartDocument.hpp>
 #include <com/sun/star/chart2/data/XDatabaseDataProvider.hpp>
 #include <comphelper/uno3.hxx>
+#include <xmloff/xmlimp.hxx>
 #include <memory>
 
 class SvXMLTokenMap;
@@ -77,6 +79,7 @@ private:
     ::std::vector< OUString>                                          
m_aDetailFields;
     css::uno::Sequence< css::beans::PropertyValue >                   
m_aArguments;
     css::uno::Reference< css::uno::XComponentContext >                
m_xContext;
+    css::uno::Reference<css::xml::sax::XFastDocumentHandler>          
m_xDocumentHandler;
     css::uno::Reference< css::xml::sax::XDocumentHandler >            
m_xDelegatee;
     css::uno::Reference< css::uno::XAggregation >                     m_xProxy;
     css::uno::Reference< css::lang::XTypeProvider >                   
m_xTypeProvider;

Reply via email to