chart2/source/inc/ConfigColorScheme.hxx   |    2 +-
 chart2/source/tools/ConfigColorScheme.cxx |   22 +++++++---------------
 2 files changed, 8 insertions(+), 16 deletions(-)

New commits:
commit f74490877aae984d2991e18118baae797db04e92
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Mar 10 12:41:11 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Mar 10 18:51:53 2023 +0000

    simplify ConfigColorScheme
    
    there is only one property that we are interested in
    
    Change-Id: I5c2b80e7ade38c822f495b79bda7e541b191199a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148603
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/chart2/source/inc/ConfigColorScheme.hxx 
b/chart2/source/inc/ConfigColorScheme.hxx
index 0cf65d0307ec..8375c600277e 100644
--- a/chart2/source/inc/ConfigColorScheme.hxx
+++ b/chart2/source/inc/ConfigColorScheme.hxx
@@ -54,7 +54,7 @@ public:
     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() 
override;
 
     // ____ ConfigItemListener ____
-    void notify( std::u16string_view rPropertyName );
+    void notify();
 
 protected:
     // ____ XColorScheme ____
diff --git a/chart2/source/tools/ConfigColorScheme.cxx 
b/chart2/source/tools/ConfigColorScheme.cxx
index f6bbfe232dd2..b3b77ac2a212 100644
--- a/chart2/source/tools/ConfigColorScheme.cxx
+++ b/chart2/source/tools/ConfigColorScheme.cxx
@@ -53,7 +53,6 @@ class ChartConfigItem : public ::utl::ConfigItem
 public:
     explicit ChartConfigItem( ConfigColorScheme & rListener );
 
-    void addPropertyNotification( const OUString & rPropertyName );
     uno::Any getProperty( const OUString & aPropertyName );
 
 protected:
@@ -63,32 +62,27 @@ protected:
 
 private:
     ConfigColorScheme &      m_rListener;
-    std::set< OUString >   m_aPropertiesToNotify;
 };
 
 ChartConfigItem::ChartConfigItem( ConfigColorScheme & rListener ) :
         ::utl::ConfigItem( "Office.Chart/DefaultColor" ),
     m_rListener( rListener )
-{}
+{
+    EnableNotification( { aSeriesPropName } );
+}
 
 void ChartConfigItem::Notify( const Sequence< OUString > & aPropertyNames )
 {
     for( OUString const & s : aPropertyNames )
     {
-        if( m_aPropertiesToNotify.find( s ) != m_aPropertiesToNotify.end())
-            m_rListener.notify( s );
+        if( s == aSeriesPropName )
+            m_rListener.notify();
     }
 }
 
 void ChartConfigItem::ImplCommit()
 {}
 
-void ChartConfigItem::addPropertyNotification( const OUString & rPropertyName )
-{
-    m_aPropertiesToNotify.insert( rPropertyName );
-    EnableNotification( comphelper::containerToSequence( m_aPropertiesToNotify 
));
-}
-
 uno::Any ChartConfigItem::getProperty( const OUString & aPropertyName )
 {
     Sequence< uno::Any > aValues(
@@ -122,7 +116,6 @@ void ConfigColorScheme::retrieveConfigColors()
     {
         m_apChartConfigItem.reset(
             new impl::ChartConfigItem( *this ));
-        m_apChartConfigItem->addPropertyNotification( aSeriesPropName );
     }
     assert(m_apChartConfigItem && "this can only be set at this point");
 
@@ -155,10 +148,9 @@ void ConfigColorScheme::retrieveConfigColors()
     return nDefaultColors[ nIndex % nMaxDefaultColors ];
 }
 
-void ConfigColorScheme::notify( std::u16string_view rPropertyName )
+void ConfigColorScheme::notify()
 {
-    if( rPropertyName == aSeriesPropName )
-        m_bNeedsUpdate = true;
+    m_bNeedsUpdate = true;
 }
 
 OUString SAL_CALL ConfigColorScheme::getImplementationName()

Reply via email to