diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2019-10-05 13:32:10 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-06 11:58:50 +0200 |
commit | 6a789e617ed07bfddc516c8fc0cf94cd6dfe7250 (patch) | |
tree | 11d6097893a301ae65cf4668077134ac7510091a /cui/source | |
parent | 070b3a848d6824ea154ae2d68fc7571feed60a5f (diff) |
improve SfxPoolItem operator== implementations
(*) make them all call the superclass operator==
(*) make the base class check which and typeid to ensure
we are only comparing the safe subclasses together
(*) remove a couple of operator== that were not doing
anything useful
Change-Id: Ia6234aed42df04157a5d6a323dc951916a9cb316
Reviewed-on: https://gerrit.libreoffice.org/80308
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cui/source')
-rw-r--r-- | cui/source/options/cfgchart.cxx | 8 | ||||
-rw-r--r-- | cui/source/options/connpoolsettings.cxx | 5 | ||||
-rw-r--r-- | cui/source/options/dbregistersettings.cxx | 4 |
3 files changed, 6 insertions, 11 deletions
diff --git a/cui/source/options/cfgchart.cxx b/cui/source/options/cfgchart.cxx index 5641687fa94e..1aacff5a6395 100644 --- a/cui/source/options/cfgchart.cxx +++ b/cui/source/options/cfgchart.cxx @@ -275,13 +275,7 @@ bool SvxChartColorTableItem::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); - const SvxChartColorTableItem * rCTItem( dynamic_cast<const SvxChartColorTableItem * >( & rAttr )); - if( rCTItem ) - { - return (m_aColorTable == rCTItem->GetColorList()); - } - - return false; + return static_cast<const SvxChartColorTableItem & >( rAttr ).m_aColorTable == m_aColorTable; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/connpoolsettings.cxx b/cui/source/options/connpoolsettings.cxx index 0f23b3fe9bd2..f794f669f659 100644 --- a/cui/source/options/connpoolsettings.cxx +++ b/cui/source/options/connpoolsettings.cxx @@ -52,9 +52,8 @@ namespace offapp bool DriverPoolingSettingsItem::operator==( const SfxPoolItem& _rCompare ) const { - const DriverPoolingSettingsItem* pItem = dynamic_cast<const DriverPoolingSettingsItem*>( &_rCompare ); - if (!pItem) - return false; + assert(SfxPoolItem::operator==(_rCompare)); + const DriverPoolingSettingsItem* pItem = static_cast<const DriverPoolingSettingsItem*>( &_rCompare ); if (m_aSettings.size() != pItem->m_aSettings.size()) return false; diff --git a/cui/source/options/dbregistersettings.cxx b/cui/source/options/dbregistersettings.cxx index dc67c27f1ec3..e9e2ae0fb167 100644 --- a/cui/source/options/dbregistersettings.cxx +++ b/cui/source/options/dbregistersettings.cxx @@ -35,7 +35,9 @@ namespace svx bool DatabaseMapItem::operator==( const SfxPoolItem& _rCompare ) const { - const DatabaseMapItem* pItem = dynamic_cast<const DatabaseMapItem*>( &_rCompare ); + if (!SfxPoolItem::operator==(_rCompare)) + return false; + const DatabaseMapItem* pItem = static_cast<const DatabaseMapItem*>( &_rCompare ); if ( !pItem ) return false; |