comphelper/source/property/propshlp.cxx      |   11 ++---------
 include/comphelper/propshlp.hxx              |    4 ----
 include/toolkit/controls/unocontrolmodel.hxx |    2 --
 toolkit/source/controls/dialogcontrol.cxx    |    6 +++---
 toolkit/source/controls/formattedcontrol.cxx |    2 +-
 toolkit/source/controls/unocontrolmodel.cxx  |   13 +------------
 6 files changed, 7 insertions(+), 31 deletions(-)

New commits:
commit 96a47eeedfe4c8adcf2c2903d72fe6e4e12a65e3
Author:     Noel Grandin <[email protected]>
AuthorDate: Fri Mar 31 14:38:56 2023 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Fri Mar 31 14:34:08 2023 +0000

    simplify subclasses of comphelper::OPropertySetHelper
    
    they should deal in terms of the fast property IDS, they should not need
    to override setPropertyValueImpl, so just remove this, and standardise
    on the subclasses overriding setFastPropertyValueImpl
    
    Change-Id: I190955ccc4ae3e07dd481a1044f3c074dd1a40aa
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149836
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/comphelper/source/property/propshlp.cxx 
b/comphelper/source/property/propshlp.cxx
index 3071dfd4a32d..af6e3f398734 100644
--- a/comphelper/source/property/propshlp.cxx
+++ b/comphelper/source/property/propshlp.cxx
@@ -161,20 +161,13 @@ 
OPropertySetHelper::createPropertySetInfo(IPropertyArrayHelper& rProperties)
 
 // XPropertySet
 void OPropertySetHelper::setPropertyValue(const OUString& rPropertyName, const 
Any& rValue)
-{
-    std::unique_lock aGuard(m_aMutex);
-    setPropertyValueImpl(aGuard, rPropertyName, rValue);
-}
-
-void OPropertySetHelper::setPropertyValueImpl(std::unique_lock<std::mutex>& 
rGuard,
-                                              const OUString& rPropertyName, 
const Any& rValue)
 {
     // get the map table
     IPropertyArrayHelper& rPH = getInfoHelper();
     // map the name to the handle
     sal_Int32 nHandle = rPH.getHandleByName(rPropertyName);
-    // call the method of the XFastPropertySet interface
-    setFastPropertyValueImpl(rGuard, nHandle, rValue);
+    std::unique_lock aGuard(m_aMutex);
+    setFastPropertyValueImpl(aGuard, nHandle, rValue);
 }
 
 // XPropertySet
diff --git a/include/comphelper/propshlp.hxx b/include/comphelper/propshlp.hxx
index c9e397ae8d15..bca25d84d9d6 100644
--- a/include/comphelper/propshlp.hxx
+++ b/include/comphelper/propshlp.hxx
@@ -184,10 +184,6 @@ protected:
      */
     ~OPropertySetHelper();
 
-    /** Override this if you need to do something special during 
setPropertyValue */
-    virtual void setPropertyValueImpl(std::unique_lock<std::mutex>& rGuard,
-                                      const ::rtl::OUString& rPropertyName,
-                                      const css::uno::Any& aValue);
     /** Override this if you need to do something special during 
setFastPropertyValue */
     virtual void setFastPropertyValueImpl(std::unique_lock<std::mutex>& 
rGuard, sal_Int32 nHandle,
                                           const css::uno::Any& rValue);
diff --git a/include/toolkit/controls/unocontrolmodel.hxx 
b/include/toolkit/controls/unocontrolmodel.hxx
index a0d8e39d9901..9a0e2b9de168 100644
--- a/include/toolkit/controls/unocontrolmodel.hxx
+++ b/include/toolkit/controls/unocontrolmodel.hxx
@@ -163,8 +163,6 @@ public:
     css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL 
getPropertySetInfo(  ) override;
 protected:
     // override setValue methods to handle properties of FontDescriptor
-    // css::beans::XPropertySet
-    virtual void setPropertyValueImpl( std::unique_lock<std::mutex>& rGuard, 
const OUString& aPropertyName, const css::uno::Any& aValue ) override;
     // css::beans::XFastPropertySet
     void setFastPropertyValueImpl( std::unique_lock<std::mutex>& rGuard, 
sal_Int32 nHandle, const css::uno::Any& aValue ) override;
     css::beans::PropertyState getPropertyStateImpl( 
std::unique_lock<std::mutex>& rGuard, const OUString& PropertyName );
diff --git a/toolkit/source/controls/dialogcontrol.cxx 
b/toolkit/source/controls/dialogcontrol.cxx
index b9027cbf17d7..1b3e7d988ffa 100644
--- a/toolkit/source/controls/dialogcontrol.cxx
+++ b/toolkit/source/controls/dialogcontrol.cxx
@@ -279,14 +279,14 @@ void 
UnoControlDialogModel::setFastPropertyValue_NoBroadcast( std::unique_lock<s
             uno::Reference<graphic::XGraphic> xGraphic;
             if (rValue >>= sImageURL)
             {
-                setPropertyValueImpl(rGuard,
-                    GetPropertyName(BASEPROPERTY_GRAPHIC),
+                setFastPropertyValueImpl(rGuard,
+                    BASEPROPERTY_GRAPHIC,
                     
uno::Any(ImageHelper::getGraphicAndGraphicObjectFromURL_nothrow(
                         mxGrfObj, sImageURL)));
             }
             else if (rValue >>= xGraphic)
             {
-                setPropertyValueImpl(rGuard, "Graphic", uno::Any(xGraphic));
+                setFastPropertyValueImpl(rGuard, BASEPROPERTY_GRAPHIC, 
uno::Any(xGraphic));
             }
         }
     }
diff --git a/toolkit/source/controls/formattedcontrol.cxx 
b/toolkit/source/controls/formattedcontrol.cxx
index ff34f4cbdda7..13ef8886cc4f 100644
--- a/toolkit/source/controls/formattedcontrol.cxx
+++ b/toolkit/source/controls/formattedcontrol.cxx
@@ -201,7 +201,7 @@ namespace toolkit
                 }
             }
 
-            setPropertyValueImpl( rGuard, GetPropertyName( BASEPROPERTY_TEXT 
), Any( sStringValue ) );
+            setFastPropertyValueImpl( rGuard, BASEPROPERTY_TEXT, Any( 
sStringValue ) );
         }
         catch( const Exception& )
         {
diff --git a/toolkit/source/controls/unocontrolmodel.cxx 
b/toolkit/source/controls/unocontrolmodel.cxx
index bfadc7f6bb8a..8cb7b3a526f9 100644
--- a/toolkit/source/controls/unocontrolmodel.cxx
+++ b/toolkit/source/controls/unocontrolmodel.cxx
@@ -1002,7 +1002,7 @@ void UnoControlModel::read( const css::uno::Reference< 
css::io::XObjectInputStre
     {
         css::uno::Any aValue;
         aValue <<= *pFD;
-        setPropertyValueImpl( aGuard, GetPropertyName( 
BASEPROPERTY_FONTDESCRIPTOR ), aValue );
+        setFastPropertyValueImpl( aGuard, BASEPROPERTY_FONTDESCRIPTOR, aValue 
);
     }
 }
 
@@ -1210,17 +1210,6 @@ void UnoControlModel::getFastPropertyValue( 
std::unique_lock<std::mutex>& /*rGua
     }
 }
 
-// css::beans::XPropertySet
-void UnoControlModel::setPropertyValueImpl( std::unique_lock<std::mutex>& 
rGuard, const OUString& rPropertyName, const css::uno::Any& rValue )
-{
-    sal_Int32 nPropId = static_cast<sal_Int32>(GetPropertyId( rPropertyName ));
-    DBG_ASSERT( nPropId, "Invalid ID in UnoControlModel::setPropertyValue" );
-    if( !nPropId )
-        throw css::beans::UnknownPropertyException(rPropertyName);
-
-    setFastPropertyValueImpl( rGuard, nPropId, rValue );
-}
-
 // css::beans::XFastPropertySet
 void UnoControlModel::setFastPropertyValueImpl( std::unique_lock<std::mutex>& 
rGuard, sal_Int32 nPropId, const css::uno::Any& rValue )
 {

Reply via email to