dbaccess/source/ui/browser/genericcontroller.cxx         |    6 ++----
 dbaccess/source/ui/browser/unodatbr.cxx                  |    6 ++----
 dbaccess/source/ui/inc/RelationController.hxx            |    2 +-
 dbaccess/source/ui/inc/TableController.hxx               |    2 +-
 dbaccess/source/ui/inc/querycontroller.hxx               |    2 +-
 dbaccess/source/ui/inc/unodatbr.hxx                      |    2 +-
 dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx     |    6 ++----
 dbaccess/source/ui/querydesign/querycontroller.cxx       |   10 +++-------
 dbaccess/source/ui/relationdesign/RelationController.cxx |    4 ++--
 dbaccess/source/ui/tabledesign/TableController.cxx       |    6 ++----
 include/dbaccess/dbsubcomponentcontroller.hxx            |    2 +-
 include/dbaccess/genericcontroller.hxx                   |    6 +-----
 reportdesign/source/ui/inc/ReportController.hxx          |    2 +-
 reportdesign/source/ui/report/ReportController.cxx       |    6 ++----
 14 files changed, 22 insertions(+), 40 deletions(-)

New commits:
commit 78833978264581f1e7f485526c8ef0e0e34afe56
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Tue Apr 9 17:52:57 2024 +0100
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Apr 10 10:18:47 2024 +0200

    simplify OGenericUnoController init
    
    Change-Id: I9053e8f320b140bbb6907daac61939258245ff7f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165913
    Tested-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx 
b/dbaccess/source/ui/browser/genericcontroller.cxx
index d07a7e51b0a2..8bde54b54549 100644
--- a/dbaccess/source/ui/browser/genericcontroller.cxx
+++ b/dbaccess/source/ui/browser/genericcontroller.cxx
@@ -166,7 +166,7 @@ IMPL_LINK_NOARG(OGenericUnoController, 
OnAsyncInvalidateAll, void*, void)
         InvalidateFeature_Impl();
 }
 
-void OGenericUnoController::impl_initialize()
+void OGenericUnoController::impl_initialize(const 
::comphelper::NamedValueCollection& /*rArguments*/)
 {
 }
 
@@ -205,7 +205,6 @@ void SAL_CALL OGenericUnoController::initialize( const 
Sequence< Any >& aArgumen
             throw IllegalArgumentException("Parent window is null", *this, 1 );
         }
 
-        m_aInitParameters.assign( aArguments );
         Construct( pParentWin );
 
         ODataView* pView = getView();
@@ -215,7 +214,7 @@ void SAL_CALL OGenericUnoController::initialize( const 
Sequence< Any >& aArgumen
         if ( m_bReadOnly || m_bPreview )
             pView->EnableInput( false );
 
-        impl_initialize();
+        impl_initialize(::comphelper::NamedValueCollection(aArguments));
     }
     catch(Exception&)
     {
@@ -686,7 +685,6 @@ void OGenericUnoController::disposing()
     m_xSlaveDispatcher = nullptr;
     m_xTitleHelper.clear();
     m_xUrlTransformer.clear();
-    m_aInitParameters.clear();
 }
 
 void SAL_CALL OGenericUnoController::addEventListener( const Reference< 
XEventListener >& xListener )
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx 
b/dbaccess/source/ui/browser/unodatbr.cxx
index fa9561f35c91..889c168247f0 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -3094,13 +3094,13 @@ namespace
     }
 }
 
-void SbaTableQueryBrowser::impl_initialize()
+void SbaTableQueryBrowser::impl_initialize(const 
::comphelper::NamedValueCollection& rArguments)
 {
     SolarMutexGuard aGuard;
         // doin' a lot of VCL stuff here -> lock the SolarMutex
 
     // first initialize the parent
-    SbaXDataBrowserController::impl_initialize();
+    SbaXDataBrowserController::impl_initialize(rArguments);
 
     Reference<XConnection> xForeignConnection;
     Reference< XFrame > xFrame;
@@ -3112,8 +3112,6 @@ void SbaTableQueryBrowser::impl_initialize()
     OUString sInitialDataSourceName;
     OUString sInitialCommand;
 
-    const NamedValueCollection& rArguments( getInitParams() );
-
     rArguments.get_ensureType( PROPERTY_DATASOURCENAME, sInitialDataSourceName 
);
     rArguments.get_ensureType( PROPERTY_COMMAND_TYPE, 
nInitialDisplayCommandType );
     rArguments.get_ensureType( PROPERTY_COMMAND, sInitialCommand );
diff --git a/dbaccess/source/ui/inc/RelationController.hxx 
b/dbaccess/source/ui/inc/RelationController.hxx
index e76223375a8d..d4aa52faf080 100644
--- a/dbaccess/source/ui/inc/RelationController.hxx
+++ b/dbaccess/source/ui/inc/RelationController.hxx
@@ -70,7 +70,7 @@ namespace dbaui
         // ask the user if the design should be saved when it is modified
         virtual short saveModified() override;
         virtual void reset() override;
-        virtual void impl_initialize() override;
+        virtual void impl_initialize(const ::comphelper::NamedValueCollection& 
rArguments) override;
         virtual OUString getPrivateTitle( ) const override;
         DECL_LINK( OnThreadFinished, void*, void );
     };
diff --git a/dbaccess/source/ui/inc/TableController.hxx 
b/dbaccess/source/ui/inc/TableController.hxx
index ce2017b586d1..13af9cf51c48 100644
--- a/dbaccess/source/ui/inc/TableController.hxx
+++ b/dbaccess/source/ui/inc/TableController.hxx
@@ -121,7 +121,7 @@ namespace dbaui
     private:
         void startTableListening();
         void stopTableListening();
-        virtual void impl_initialize() override;
+        virtual void impl_initialize(const ::comphelper::NamedValueCollection& 
rArguments) override;
     };
 }
 
diff --git a/dbaccess/source/ui/inc/querycontroller.hxx 
b/dbaccess/source/ui/inc/querycontroller.hxx
index 94bb5d8f4ffa..a2e334871692 100644
--- a/dbaccess/source/ui/inc/querycontroller.hxx
+++ b/dbaccess/source/ui/inc/querycontroller.hxx
@@ -187,7 +187,7 @@ namespace dbaui
         // ask the user if the design should be saved when it is modified
         virtual short saveModified() override;
         virtual void reset() override;
-        virtual void impl_initialize() override;
+        virtual void impl_initialize(const ::comphelper::NamedValueCollection& 
rArguments) override;
 
         void    impl_reset( const bool i_bIgnoreQuerySettings = false );
         /// tells the user that we needed to switch to SQL view automatically
diff --git a/dbaccess/source/ui/inc/unodatbr.hxx 
b/dbaccess/source/ui/inc/unodatbr.hxx
index 093cb8bb6a77..61905563f940 100644
--- a/dbaccess/source/ui/inc/unodatbr.hxx
+++ b/dbaccess/source/ui/inc/unodatbr.hxx
@@ -222,7 +222,7 @@ namespace dbaui
         virtual vcl::Window* getMenuParent() const override;
         virtual void adjustMenuPosition(const weld::TreeView& rControl, 
::Point& rPos) const override;
 
-        virtual void impl_initialize() override;
+        virtual void impl_initialize(const ::comphelper::NamedValueCollection& 
rArguments) override;
 
         // SbaGridListener overridables
         virtual void RowChanged() override;
diff --git a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx 
b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
index 759f202c0d4b..0d3676db5d80 100644
--- a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
+++ b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
@@ -176,11 +176,9 @@ namespace dbaui
     {
     }
 
-    void DBSubComponentController::impl_initialize()
+    void DBSubComponentController::impl_initialize(const 
::comphelper::NamedValueCollection& rArguments)
     {
-        OGenericUnoController::impl_initialize();
-
-        const ::comphelper::NamedValueCollection& rArguments( getInitParams() 
);
+        OGenericUnoController::impl_initialize(rArguments);
 
         Reference< XConnection > xConnection;
         xConnection = rArguments.getOrDefault( PROPERTY_ACTIVE_CONNECTION, 
xConnection );
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx 
b/dbaccess/source/ui/querydesign/querycontroller.cxx
index f94d7342566e..d963ca3c293d 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -646,11 +646,9 @@ void OQueryController::impl_setViewMode( 
::dbtools::SQLExceptionInfo* _pErrorInf
     setModified( wasModified );
 }
 
-void OQueryController::impl_initialize()
+void OQueryController::impl_initialize(const 
::comphelper::NamedValueCollection& rArguments)
 {
-    OJoinController::impl_initialize();
-
-    const NamedValueCollection& rArguments( getInitParams() );
+    OJoinController::impl_initialize(rArguments);
 
     OUString sCommand;
     m_nCommandType = CommandType::QUERY;
@@ -1760,9 +1758,7 @@ bool OQueryController::allowQueries() const
     if ( !getSdbMetaData().supportsSubqueriesInFrom() )
         return false;
 
-    const NamedValueCollection& rArguments( getInitParams() );
-    sal_Int32 nCommandType = rArguments.getOrDefault( PROPERTY_COMMAND_TYPE, 
sal_Int32(CommandType::QUERY) );
-    bool bCreatingView = ( nCommandType == CommandType::TABLE );
+    bool bCreatingView = ( m_nCommandType == CommandType::TABLE );
     return !bCreatingView;
 }
 
diff --git a/dbaccess/source/ui/relationdesign/RelationController.cxx 
b/dbaccess/source/ui/relationdesign/RelationController.cxx
index a0c34c668fce..ebeca9a64b24 100644
--- a/dbaccess/source/ui/relationdesign/RelationController.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationController.cxx
@@ -156,9 +156,9 @@ void ORelationController::Execute(sal_uInt16 _nId, const 
Sequence< PropertyValue
     InvalidateFeature(_nId);
 }
 
-void ORelationController::impl_initialize()
+void ORelationController::impl_initialize(const 
::comphelper::NamedValueCollection& rArguments)
 {
-    OJoinController::impl_initialize();
+    OJoinController::impl_initialize(rArguments);
 
     if( !getSdbMetaData().supportsRelations() )
     {// check if this database supports relations
diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx 
b/dbaccess/source/ui/tabledesign/TableController.cxx
index b0dfc6854636..924d9010b362 100644
--- a/dbaccess/source/ui/tabledesign/TableController.cxx
+++ b/dbaccess/source/ui/tabledesign/TableController.cxx
@@ -453,13 +453,11 @@ void OTableController::doEditIndexes()
 
 }
 
-void OTableController::impl_initialize()
+void OTableController::impl_initialize(const 
::comphelper::NamedValueCollection& rArguments)
 {
     try
     {
-        OTableController_BASE::impl_initialize();
-
-        const NamedValueCollection& rArguments( getInitParams() );
+        OTableController_BASE::impl_initialize(rArguments);
 
         rArguments.get_ensureType( PROPERTY_CURRENTTABLE, m_sName );
 
diff --git a/include/dbaccess/dbsubcomponentcontroller.hxx 
b/include/dbaccess/dbsubcomponentcontroller.hxx
index 43cbf41fe6cf..d4ed948d1bff 100644
--- a/include/dbaccess/dbsubcomponentcontroller.hxx
+++ b/include/dbaccess/dbsubcomponentcontroller.hxx
@@ -75,7 +75,7 @@ namespace dbaui
 
     protected:
         // OGenericUnoController - initialization
-        virtual void impl_initialize() override;
+        virtual void impl_initialize(const ::comphelper::NamedValueCollection& 
rArguments) override;
 
         // OGenericUnoController
         virtual void      Execute(sal_uInt16 nId, const css::uno::Sequence< 
css::beans::PropertyValue>& aArgs) override;
diff --git a/include/dbaccess/genericcontroller.hxx 
b/include/dbaccess/genericcontroller.hxx
index 175cf955d799..3795e3e63678 100644
--- a/include/dbaccess/genericcontroller.hxx
+++ b/include/dbaccess/genericcontroller.hxx
@@ -206,8 +206,6 @@ namespace dbaui
     {
     private:
         SupportedFeatures               m_aSupportedFeatures;
-        ::comphelper::NamedValueCollection
-                                        m_aInitParameters;
         ::sfx2::UserInputInterception   m_aUserInputInterception;
         VclPtr<ODataView>               m_pView;                // our (VCL) 
"main window"
 
@@ -258,8 +256,6 @@ namespace dbaui
         // methods
         OGenericUnoController( const css::uno::Reference< 
css::uno::XComponentContext >& _rM );
         OGenericUnoController() = delete;
-        const ::comphelper::NamedValueCollection&
-                                    getInitParams() const   { return 
m_aInitParameters; }
 
         // closes the task when possible
         void closeTask();
@@ -344,7 +340,7 @@ namespace dbaui
         css::uno::Reference< css::awt::XWindow> getTopMostContainerWindow() 
const;
 
         // XInitialize will be called inside initialize
-        virtual void impl_initialize();
+        virtual void impl_initialize(const ::comphelper::NamedValueCollection& 
rArguments);
 
         virtual OUString getPrivateTitle() const { return OUString(); }
 
diff --git a/reportdesign/source/ui/inc/ReportController.hxx 
b/reportdesign/source/ui/inc/ReportController.hxx
index 726ac8012370..fe73fe278242 100644
--- a/reportdesign/source/ui/inc/ReportController.hxx
+++ b/reportdesign/source/ui/inc/ReportController.hxx
@@ -274,7 +274,7 @@ namespace rptui
         virtual void impl_onModifyChanged() override;
 
         virtual void onLoadedMenu( const css::uno::Reference< 
css::frame::XLayoutManager >& _xLayoutManager ) override;
-        virtual void impl_initialize( ) override;
+        virtual void impl_initialize( const 
::comphelper::NamedValueCollection& rArguments ) override;
         bool isUiVisible() const;
 
         /** creates a new default control for the currently set type when the 
modifier KEY_MOD1 was pressed
diff --git a/reportdesign/source/ui/report/ReportController.cxx 
b/reportdesign/source/ui/report/ReportController.cxx
index 6a6db230034f..06c8e4ff25bf 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -1635,11 +1635,9 @@ void OReportController::Execute(sal_uInt16 _nId, const 
Sequence< PropertyValue >
     InvalidateFeature(_nId,Reference< XStatusListener >(),bForceBroadcast);
 }
 
-void OReportController::impl_initialize( )
+void OReportController::impl_initialize( const 
::comphelper::NamedValueCollection& rArguments )
 {
-    OReportController_BASE::impl_initialize();
-
-    const ::comphelper::NamedValueCollection& rArguments( getInitParams() );
+    OReportController_BASE::impl_initialize(rArguments);
 
     rArguments.get_ensureType( PROPERTY_REPORTNAME, m_sName );
     if ( m_sName.isEmpty() )

Reply via email to