[Libreoffice-commits] core.git: extensions/source

Noel Grandin noel.grandin at collabora.co.uk
Tue Nov 8 11:12:24 UTC 2016


 extensions/source/bibliography/formcontrolcontainer.cxx |    7 ---
 extensions/source/bibliography/formcontrolcontainer.hxx |    2 
 extensions/source/dbpilots/commonpagesdbp.cxx           |   25 ++++------
 extensions/source/dbpilots/commonpagesdbp.hxx           |    1 
 extensions/source/dbpilots/groupboxwiz.cxx              |   18 ++-----
 extensions/source/dbpilots/groupboxwiz.hxx              |    5 --
 extensions/source/dbpilots/listcombowizard.cxx          |    2 
 extensions/source/dbpilots/listcombowizard.hxx          |    2 
 extensions/source/propctrlr/browserline.cxx             |   18 ++-----
 extensions/source/propctrlr/browserline.hxx             |    1 
 extensions/source/propctrlr/browserlistbox.cxx          |   17 -------
 extensions/source/propctrlr/formcomponenthandler.cxx    |   37 +++++-----------
 extensions/source/propctrlr/formcomponenthandler.hxx    |   10 ----
 extensions/source/propctrlr/propcontroller.cxx          |   20 +++-----
 extensions/source/propctrlr/propcontroller.hxx          |    5 --
 extensions/source/propctrlr/sqlcommanddesign.cxx        |    8 ---
 extensions/source/propctrlr/sqlcommanddesign.hxx        |    5 --
 extensions/source/propctrlr/standardcontrol.cxx         |    2 
 18 files changed, 47 insertions(+), 138 deletions(-)

New commits:
commit 1b277a37c5ad219d2e275df1289ccfbce27183ee
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Nov 8 11:10:50 2016 +0200

    loplugin:expandablemethods in extensions
    
    Change-Id: I93a770933de86146de1d25db9d596615916c3e28
    Reviewed-on: https://gerrit.libreoffice.org/30689
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/extensions/source/bibliography/formcontrolcontainer.cxx b/extensions/source/bibliography/formcontrolcontainer.cxx
index 9d71877..f0dfe3b 100644
--- a/extensions/source/bibliography/formcontrolcontainer.cxx
+++ b/extensions/source/bibliography/formcontrolcontainer.cxx
@@ -69,7 +69,7 @@ namespace bib
             m_pFormAdapter->acquire();
             m_pFormAdapter->Init( this );
 
-            ensureDesignMode();
+            implSetDesignMode( !m_xForm.is() || !m_xForm->isLoaded() );
         }
 
         m_xForm = _rxForm;
@@ -109,11 +109,6 @@ namespace bib
         }
     }
 
-    void FormControlContainer::ensureDesignMode()
-    {
-        implSetDesignMode( !m_xForm.is() || !m_xForm->isLoaded() );
-    }
-
     void FormControlContainer::_loaded( const css::lang::EventObject& /*_rEvent*/ )
     {
         implSetDesignMode( false );
diff --git a/extensions/source/bibliography/formcontrolcontainer.hxx b/extensions/source/bibliography/formcontrolcontainer.hxx
index 3f35df9..a75a528 100644
--- a/extensions/source/bibliography/formcontrolcontainer.hxx
+++ b/extensions/source/bibliography/formcontrolcontainer.hxx
@@ -46,8 +46,6 @@ namespace bib
         void        connectForm( const css::uno::Reference< css::form::XLoadable >& _rxForm );
         void        disconnectForm();
 
-        void        ensureDesignMode();
-
         virtual css::uno::Reference< css::awt::XControlContainer >
                     getControlContainer() = 0;
 
diff --git a/extensions/source/dbpilots/commonpagesdbp.cxx b/extensions/source/dbpilots/commonpagesdbp.cxx
index 0dc6b27..9938213 100644
--- a/extensions/source/dbpilots/commonpagesdbp.cxx
+++ b/extensions/source/dbpilots/commonpagesdbp.cxx
@@ -62,7 +62,16 @@ namespace dbp
         get(m_pDatasourceLabel, "datasourcelabel");
         get(m_pSearchDatabase, "search");
 
-        implCollectDatasource();
+        try
+        {
+            m_xDSContext = getContext().xDatasourceContext;
+            if (m_xDSContext.is())
+                fillListBox(*m_pDatasource, m_xDSContext->getElementNames());
+        }
+        catch (const Exception&)
+        {
+            OSL_FAIL("OTableSelectionPage::OTableSelectionPage: could not collect the data source names!");
+        }
 
         m_pDatasource->SetSelectHdl(LINK(this, OTableSelectionPage, OnListboxSelection));
         m_pTable->SetSelectHdl(LINK(this, OTableSelectionPage, OnListboxSelection));
@@ -361,20 +370,6 @@ namespace dbp
     }
 
 
-    void OTableSelectionPage::implCollectDatasource()
-    {
-        try
-        {
-            m_xDSContext = getContext().xDatasourceContext;
-            if (m_xDSContext.is())
-                fillListBox(*m_pDatasource, m_xDSContext->getElementNames());
-        }
-        catch (const Exception&)
-        {
-            OSL_FAIL("OTableSelectionPage::implCollectDatasource: could not collect the data source names!");
-        }
-    }
-
     OMaybeListSelectionPage::OMaybeListSelectionPage( OControlWizard* _pParent, const OString& _rID, const OUString& _rUIXMLDescription )
         :OControlWizardPage(_pParent, _rID, _rUIXMLDescription)
         ,m_pYes(nullptr)
diff --git a/extensions/source/dbpilots/commonpagesdbp.hxx b/extensions/source/dbpilots/commonpagesdbp.hxx
index 3451139..99d3ad0 100644
--- a/extensions/source/dbpilots/commonpagesdbp.hxx
+++ b/extensions/source/dbpilots/commonpagesdbp.hxx
@@ -58,7 +58,6 @@ namespace dbp
         DECL_LINK( OnListboxDoubleClicked, ListBox&, void );
         DECL_LINK( OnSearchClicked, Button*, void );
 
-        void implCollectDatasource();
         void implFillTables(const css::uno::Reference< css::sdbc::XConnection >&
                         _rxConn = css::uno::Reference< css::sdbc::XConnection >());
 
diff --git a/extensions/source/dbpilots/groupboxwiz.cxx b/extensions/source/dbpilots/groupboxwiz.cxx
index ddce666..ddb34e4 100644
--- a/extensions/source/dbpilots/groupboxwiz.cxx
+++ b/extensions/source/dbpilots/groupboxwiz.cxx
@@ -153,8 +153,12 @@ namespace dbp
     }
 
 
-    void OGroupBoxWizard::createRadios()
+    bool OGroupBoxWizard::onFinish()
     {
+        // commit the basic control settings
+        commitControlSettings(&m_aSettings);
+
+        // create the radio buttons
         try
         {
             OOptionGroupLayouter aLayouter( getComponentContext() );
@@ -164,16 +168,6 @@ namespace dbp
         {
             OSL_FAIL("OGroupBoxWizard::createRadios: caught an exception while creating the radio shapes!");
         }
-    }
-
-
-    bool OGroupBoxWizard::onFinish()
-    {
-        // commit the basic control settings
-        commitControlSettings(&m_aSettings);
-
-        // create the radio buttons
-        createRadios();
 
         return OControlWizard::onFinish();
     }
@@ -480,7 +474,7 @@ namespace dbp
 
     OUString& OOptionDBFieldPage::getDBFieldSetting()
     {
-        return getSettings().sDBField;
+        return static_cast<OGroupBoxWizard*>(getDialog())->getSettings().sDBField;
     }
 
     OFinalizeGBWPage::OFinalizeGBWPage( OControlWizard* _pParent )
diff --git a/extensions/source/dbpilots/groupboxwiz.hxx b/extensions/source/dbpilots/groupboxwiz.hxx
index 92ddc89..2745de9 100644
--- a/extensions/source/dbpilots/groupboxwiz.hxx
+++ b/extensions/source/dbpilots/groupboxwiz.hxx
@@ -60,9 +60,6 @@ namespace dbp
         virtual bool                onFinish() override;
 
         virtual bool                approveControl(sal_Int16 _nClassId) override;
-
-    protected:
-        void createRadios();
     };
 
     class OGBWPage : public OControlWizardPage
@@ -160,8 +157,6 @@ namespace dbp
         explicit OOptionDBFieldPage( OControlWizard* _pParent );
 
     protected:
-        OOptionGroupSettings& getSettings() { return static_cast<OGroupBoxWizard*>(getDialog())->getSettings(); }
-
         // ODBFieldPage overridables
         virtual OUString& getDBFieldSetting() override;
     };
diff --git a/extensions/source/dbpilots/listcombowizard.cxx b/extensions/source/dbpilots/listcombowizard.cxx
index a53288b..6f9386e 100644
--- a/extensions/source/dbpilots/listcombowizard.cxx
+++ b/extensions/source/dbpilots/listcombowizard.cxx
@@ -511,7 +511,7 @@ namespace dbp
 
     OUString& OComboDBFieldPage::getDBFieldSetting()
     {
-        return getSettings().sLinkedFormField;
+        return static_cast<OListComboWizard*>(getDialog())->getSettings().sLinkedFormField;
     }
 
 
diff --git a/extensions/source/dbpilots/listcombowizard.hxx b/extensions/source/dbpilots/listcombowizard.hxx
index 5cc6555..135bc1d 100644
--- a/extensions/source/dbpilots/listcombowizard.hxx
+++ b/extensions/source/dbpilots/listcombowizard.hxx
@@ -174,8 +174,6 @@ namespace dbp
         explicit OComboDBFieldPage( OControlWizard* _pParent );
 
     protected:
-        OListComboSettings& getSettings() { return static_cast<OListComboWizard*>(getDialog())->getSettings(); }
-
         // TabPage overridables
         virtual void ActivatePage() override;
 
diff --git a/extensions/source/propctrlr/browserline.cxx b/extensions/source/propctrlr/browserline.cxx
index d40f9f3..b9fe588 100644
--- a/extensions/source/propctrlr/browserline.cxx
+++ b/extensions/source/propctrlr/browserline.cxx
@@ -386,8 +386,12 @@ namespace pcr
     }
 
 
-    void OBrowserLine::impl_getImagesFromURL_nothrow( const OUString& _rImageURL, Image& _out_rImage )
+    void OBrowserLine::ShowBrowseButton( const OUString& _rImageURL, bool _bPrimary )
     {
+        PushButton& rButton( impl_ensureButton( _bPrimary ) );
+
+        OSL_PRECOND( !_rImageURL.isEmpty(), "OBrowserLine::ShowBrowseButton: use the other version if you don't have an image!" );
+        Image aImage;
         try
         {
             Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
@@ -398,22 +402,12 @@ namespace pcr
             aMediaProperties[0].Value <<= _rImageURL;
 
             Reference< XGraphic > xGraphic( xGraphicProvider->queryGraphic( aMediaProperties ), UNO_QUERY_THROW );
-            _out_rImage = Image( xGraphic );
+            aImage = Image( xGraphic );
         }
         catch( const Exception& )
         {
             DBG_UNHANDLED_EXCEPTION();
         }
-    }
-
-
-    void OBrowserLine::ShowBrowseButton( const OUString& _rImageURL, bool _bPrimary )
-    {
-        PushButton& rButton( impl_ensureButton( _bPrimary ) );
-
-        OSL_PRECOND( !_rImageURL.isEmpty(), "OBrowserLine::ShowBrowseButton: use the other version if you don't have an image!" );
-        Image aImage;
-        impl_getImagesFromURL_nothrow( _rImageURL, aImage );
 
         rButton.SetModeImage( aImage );
    }
diff --git a/extensions/source/propctrlr/browserline.hxx b/extensions/source/propctrlr/browserline.hxx
index 5442c19..815ac66 100644
--- a/extensions/source/propctrlr/browserline.hxx
+++ b/extensions/source/propctrlr/browserline.hxx
@@ -122,7 +122,6 @@ namespace pcr
         void    impl_layoutComponents();
 
         PushButton& impl_ensureButton( bool _bPrimary );
-        static void impl_getImagesFromURL_nothrow( const OUString& _rImageURL, Image& _out_rImage );
     };
 
 
diff --git a/extensions/source/propctrlr/browserlistbox.cxx b/extensions/source/propctrlr/browserlistbox.cxx
index b0e7231..9d6b899 100644
--- a/extensions/source/propctrlr/browserlistbox.cxx
+++ b/extensions/source/propctrlr/browserlistbox.cxx
@@ -180,13 +180,6 @@ namespace pcr
         */
         void impl_processEvent_throw( const ::comphelper::AnyEvent& _rEvent );
 
-        /** checks whether we're alive
-
-            @throws DisposedException
-                if the instance is already disposed
-        */
-        void impl_checkAlive_throw() const;
-
         /** checks whether the instance is already disposed
         */
         bool impl_isDisposed_nothrow() const { return m_pContext.get() == nullptr; }
@@ -214,13 +207,6 @@ namespace pcr
     }
 
 
-    void PropertyControlContext_Impl::impl_checkAlive_throw() const
-    {
-        if ( impl_isDisposed_nothrow() )
-            throw DisposedException( OUString(), *const_cast< PropertyControlContext_Impl* >( this ) );
-    }
-
-
     void SAL_CALL PropertyControlContext_Impl::dispose()
     {
         SolarMutexGuard aGuard;
@@ -245,7 +231,8 @@ namespace pcr
 
         {
             SolarMutexGuard aGuard;
-            impl_checkAlive_throw();
+            if ( impl_isDisposed_nothrow() )
+                 throw DisposedException( OUString(), *this );
             pEvent = new ControlEvent( _rxControl, _eType );
 
             if ( m_eMode == eSynchronously )
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index c20126e..ae1f136 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -825,21 +825,6 @@ namespace pcr
     }
 
 
-    void FormComponentPropertyHandler::onNewComponent()
-    {
-        FormComponentPropertyHandler_Base::onNewComponent();
-        if ( !m_xComponentPropertyInfo.is() && m_xComponent.is() )
-            throw NullPointerException();
-
-        m_xPropertyState.set( m_xComponent, UNO_QUERY );
-        m_eComponentClass = eUnknown;
-        m_bComponentIsSubForm = m_bHaveListSource = m_bHaveCommand = false;
-        m_nClassId = 0;
-
-        impl_initComponentMetaData_throw();
-    }
-
-
     Sequence< Property > SAL_CALL FormComponentPropertyHandler::doDescribeSupportedProperties() const
     {
         if ( !m_xComponentPropertyInfo.is() )
@@ -1535,7 +1520,7 @@ namespace pcr
         // ----- DataSourceName -----
         case PROPERTY_ID_DATASOURCE:
             // reset the connection, now that we have a new data source
-            impl_clearRowsetConnection_nothrow();
+            m_xRowSetConnection.clear();
 
             // available list source values (tables or queries) might have changed
             if ( !_bFirstTimeInit && m_bHaveListSource )
@@ -2016,11 +2001,19 @@ namespace pcr
     }
 
 
-    void FormComponentPropertyHandler::impl_initComponentMetaData_throw()
+    void FormComponentPropertyHandler::onNewComponent()
     {
+        FormComponentPropertyHandler_Base::onNewComponent();
+        if ( !m_xComponentPropertyInfo.is() && m_xComponent.is() )
+            throw NullPointerException();
+
+        m_xPropertyState.set( m_xComponent, UNO_QUERY );
+        m_eComponentClass = eUnknown;
+        m_bComponentIsSubForm = m_bHaveListSource = m_bHaveCommand = false;
+        m_nClassId = 0;
+
         try
         {
-
             // component class
             m_eComponentClass = eUnknown;
 
@@ -2064,7 +2057,7 @@ namespace pcr
         }
         catch( const Exception& )
         {
-            OSL_FAIL( "FormComponentPropertyHandler::impl_initComponentMetaData_throw: caught an exception!" );
+            OSL_FAIL( "FormComponentPropertyHandler::onNewComponent: caught an exception!" );
             DBG_UNHANDLED_EXCEPTION();
         }
     }
@@ -2364,12 +2357,6 @@ namespace pcr
     }
 
 
-    void FormComponentPropertyHandler::impl_clearRowsetConnection_nothrow()
-    {
-        m_xRowSetConnection.clear();
-    }
-
-
     void FormComponentPropertyHandler::impl_displaySQLError_nothrow( const ::dbtools::SQLExceptionInfo& _rErrorDescriptor ) const
     {
         ::dbtools::showError( _rErrorDescriptor, VCLUnoHelper::GetInterface( impl_getDefaultDialogParent_nothrow() ), m_xContext );
diff --git a/extensions/source/propctrlr/formcomponenthandler.hxx b/extensions/source/propctrlr/formcomponenthandler.hxx
index 0041b12..0b2791d 100644
--- a/extensions/source/propctrlr/formcomponenthandler.hxx
+++ b/extensions/source/propctrlr/formcomponenthandler.hxx
@@ -137,12 +137,6 @@ namespace pcr
         virtual void onNewComponent() override;
 
     private:
-        /** initializes some (cached) meta data about the component
-            @throws RuntimeException
-                if a serious error occurs, for instance if the component does not provide an XPropertySetInfo instance
-        */
-        void    impl_initComponentMetaData_throw();
-
         /** classifies our component, in case it's a control model, by ClassId
 
             Note that UNO dialog controls are also classified, though they don't have the ClassId property
@@ -191,10 +185,6 @@ namespace pcr
         */
         bool impl_ensureRowsetConnection_nothrow() const;
 
-        /** clears ->m_xRowSetConnection
-        */
-        void impl_clearRowsetConnection_nothrow();
-
         /** fills an ->LineDescriptor with information to represent a cursor source
             of our form - that is, a table, a query, or an SQL statement.
 
diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx
index 43a1e6c..7ab004a 100644
--- a/extensions/source/propctrlr/propcontroller.cxx
+++ b/extensions/source/propctrlr/propcontroller.cxx
@@ -187,18 +187,6 @@ namespace pcr
     }
 
 
-    void OPropertyBrowserController::impl_updateReadOnlyView_nothrow()
-    {
-        // this is a huge cudgel, admitted.
-        // The problem is that in case we were previously read-only, all our controls
-        // were created read-only, too. We cannot simply switch them to not-read-only.
-        // Even if they had an API for this, we do not know whether they were
-        // originally created read-only, or if they are read-only just because
-        // the model was.
-        impl_rebindToInspectee_nothrow( m_aInspectedObjects );
-    }
-
-
     bool OPropertyBrowserController::impl_isReadOnlyModel_throw() const
     {
         if ( !m_xModel.is() )
@@ -721,7 +709,13 @@ namespace pcr
         if ( _rEvent.Source == m_xModel )
         {
             if ( _rEvent.PropertyName == "IsReadOnly" )
-                impl_updateReadOnlyView_nothrow();
+               // this is a huge cudgel, admitted.
+                // The problem is that in case we were previously read-only, all our controls
+                // were created read-only, too. We cannot simply switch them to not-read-only.
+                // Even if they had an API for this, we do not know whether they were
+                // originally created read-only, or if they are read-only just because
+                // the model was.
+                impl_rebindToInspectee_nothrow( m_aInspectedObjects );
             return;
         }
 
diff --git a/extensions/source/propctrlr/propcontroller.hxx b/extensions/source/propctrlr/propcontroller.hxx
index 52b8b4a..bf99b6d 100644
--- a/extensions/source/propctrlr/propcontroller.hxx
+++ b/extensions/source/propctrlr/propcontroller.hxx
@@ -374,11 +374,6 @@ namespace pcr
         */
         bool    impl_isReadOnlyModel_throw() const;
 
-        /** updates our view so that it is read-only, as indicated by the model property
-            @see impl_isReadOnlyModel_throw
-        */
-        void    impl_updateReadOnlyView_nothrow();
-
         /** starts or stops listening at the model
         */
         void    impl_startOrStopModelListening_nothrow( bool _bDoListen ) const;
diff --git a/extensions/source/propctrlr/sqlcommanddesign.cxx b/extensions/source/propctrlr/sqlcommanddesign.cxx
index 1d565c6..6436985 100644
--- a/extensions/source/propctrlr/sqlcommanddesign.cxx
+++ b/extensions/source/propctrlr/sqlcommanddesign.cxx
@@ -145,7 +145,7 @@ namespace pcr
     {
         if ( m_xDesigner.is() && ( Source.Source == m_xDesigner ) )
         {
-            impl_designerClosed_nothrow();
+            m_aCloseLink.Call( *this );
             m_xDesigner.clear();
         }
     }
@@ -298,12 +298,6 @@ namespace pcr
     }
 
 
-    void SQLCommandDesigner::impl_designerClosed_nothrow()
-    {
-        m_aCloseLink.Call( *this );
-    }
-
-
     void SQLCommandDesigner::impl_closeDesigner_nothrow()
     {
         OSL_PRECOND( isActive(), "SQLCommandDesigner::impl_closeDesigner_nothrow: invalid calle!" );
diff --git a/extensions/source/propctrlr/sqlcommanddesign.hxx b/extensions/source/propctrlr/sqlcommanddesign.hxx
index d712312..106b946 100644
--- a/extensions/source/propctrlr/sqlcommanddesign.hxx
+++ b/extensions/source/propctrlr/sqlcommanddesign.hxx
@@ -149,11 +149,6 @@ namespace pcr
         css::uno::Reference< css::frame::XFrame >
             impl_createEmptyParentlessTask_nothrow() const;
 
-        /** called whenever the component denoted by m_xDesigner has been closed
-            <em>by an external instance</em>
-        */
-        void impl_designerClosed_nothrow();
-
         /** closes the component denoted by m_xDesigner
             @precond
                 our designer component is actually active (->isActive)
diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx
index 7d42296..af15abf 100644
--- a/extensions/source/propctrlr/standardcontrol.cxx
+++ b/extensions/source/propctrlr/standardcontrol.cxx
@@ -669,7 +669,7 @@ namespace pcr
             css::util::Color nColor = COL_TRANSPARENT;
             _rValue >>= nColor;
             ::Color aRgbCol((ColorData)nColor);
-            getTypedControlWindow()->SelectEntry(std::make_pair(aRgbCol, MakeHexStr(nColor, 8)));
+           getTypedControlWindow()->SelectEntry(std::make_pair(aRgbCol, MakeHexStr(nColor, 8)));
         }
         else
             getTypedControlWindow()->SetNoSelection();


More information about the Libreoffice-commits mailing list