diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-12-11 20:57:45 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-12-12 21:12:10 +0100 |
commit | 2431477337f4ac4384ba615f76bfb5904f1a3b47 (patch) | |
tree | 6f676441983e9b3c8440600d09a49478353e1faf /cui | |
parent | 23cfd3d1004f5ddda8cd79878c00b6c64f20068c (diff) |
use covariant return type for SfxPoolItem::Clone
and can then remove some casting
Change-Id: Id821c32ca2cbcdb7f57ef7a5fa1960042e630ffc
Reviewed-on: https://gerrit.libreoffice.org/85022
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/options/cfgchart.cxx | 2 | ||||
-rw-r--r-- | cui/source/options/cfgchart.hxx | 2 | ||||
-rw-r--r-- | cui/source/options/connpoolsettings.cxx | 3 | ||||
-rw-r--r-- | cui/source/options/connpoolsettings.hxx | 2 | ||||
-rw-r--r-- | cui/source/options/dbregistersettings.cxx | 7 | ||||
-rw-r--r-- | cui/source/options/dbregistersettings.hxx | 2 | ||||
-rw-r--r-- | cui/source/tabpages/align.cxx | 12 | ||||
-rw-r--r-- | cui/source/tabpages/numfmt.cxx | 2 | ||||
-rw-r--r-- | cui/source/tabpages/page.cxx | 2 | ||||
-rw-r--r-- | cui/source/tabpages/paragrph.cxx | 2 | ||||
-rw-r--r-- | cui/source/tabpages/tabstpge.cxx | 2 |
11 files changed, 16 insertions, 22 deletions
diff --git a/cui/source/options/cfgchart.cxx b/cui/source/options/cfgchart.cxx index a077506363ee..660241519110 100644 --- a/cui/source/options/cfgchart.cxx +++ b/cui/source/options/cfgchart.cxx @@ -264,7 +264,7 @@ SvxChartColorTableItem::SvxChartColorTableItem( sal_uInt16 nWhich_, const SvxCha { } -SfxPoolItem* SvxChartColorTableItem::Clone( SfxItemPool * ) const +SvxChartColorTableItem* SvxChartColorTableItem::Clone( SfxItemPool * ) const { return new SvxChartColorTableItem( *this ); } diff --git a/cui/source/options/cfgchart.hxx b/cui/source/options/cfgchart.hxx index 57060ba594e5..4984d1bd31e8 100644 --- a/cui/source/options/cfgchart.hxx +++ b/cui/source/options/cfgchart.hxx @@ -89,7 +89,7 @@ class SvxChartColorTableItem : public SfxPoolItem public: SvxChartColorTableItem( sal_uInt16 nWhich, const SvxChartColorTable& ); - virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual SvxChartColorTableItem* Clone( SfxItemPool *pPool = nullptr ) const override; virtual bool operator==( const SfxPoolItem& ) const override; const SvxChartColorTable & GetColorList() const { return m_aColorTable;} diff --git a/cui/source/options/connpoolsettings.cxx b/cui/source/options/connpoolsettings.cxx index f794f669f659..46742d826aa5 100644 --- a/cui/source/options/connpoolsettings.cxx +++ b/cui/source/options/connpoolsettings.cxx @@ -70,8 +70,7 @@ namespace offapp return true; } - - SfxPoolItem* DriverPoolingSettingsItem::Clone( SfxItemPool * ) const + DriverPoolingSettingsItem* DriverPoolingSettingsItem::Clone( SfxItemPool * ) const { return new DriverPoolingSettingsItem(*this); } diff --git a/cui/source/options/connpoolsettings.hxx b/cui/source/options/connpoolsettings.hxx index 153ff94597e4..45c38cb9a6d7 100644 --- a/cui/source/options/connpoolsettings.hxx +++ b/cui/source/options/connpoolsettings.hxx @@ -76,7 +76,7 @@ namespace offapp DriverPoolingSettingsItem( sal_uInt16 _nId, const DriverPoolingSettings &_rSettings ); virtual bool operator==( const SfxPoolItem& ) const override; - virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual DriverPoolingSettingsItem* Clone( SfxItemPool *pPool = nullptr ) const override; const DriverPoolingSettings& getSettings() const { return m_aSettings; } }; diff --git a/cui/source/options/dbregistersettings.cxx b/cui/source/options/dbregistersettings.cxx index e9e2ae0fb167..f7739a1092cc 100644 --- a/cui/source/options/dbregistersettings.cxx +++ b/cui/source/options/dbregistersettings.cxx @@ -25,14 +25,12 @@ namespace svx { - DatabaseMapItem::DatabaseMapItem( sal_uInt16 _nId, const DatabaseRegistrations& _rRegistrations ) :SfxPoolItem( _nId ) ,m_aRegistrations( _rRegistrations ) { } - bool DatabaseMapItem::operator==( const SfxPoolItem& _rCompare ) const { if (!SfxPoolItem::operator==(_rCompare)) @@ -47,14 +45,11 @@ namespace svx return m_aRegistrations == pItem->m_aRegistrations; } - - SfxPoolItem* DatabaseMapItem::Clone( SfxItemPool* ) const + DatabaseMapItem* DatabaseMapItem::Clone( SfxItemPool* ) const { return new DatabaseMapItem( *this ); } - } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/dbregistersettings.hxx b/cui/source/options/dbregistersettings.hxx index 05e1f5fadc37..ce1322a101db 100644 --- a/cui/source/options/dbregistersettings.hxx +++ b/cui/source/options/dbregistersettings.hxx @@ -68,7 +68,7 @@ namespace svx DatabaseMapItem( sal_uInt16 _nId, const DatabaseRegistrations& _rRegistrations ); virtual bool operator==( const SfxPoolItem& ) const override; - virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual DatabaseMapItem* Clone( SfxItemPool *pPool = nullptr ) const override; const DatabaseRegistrations& getRegistrations() const { return m_aRegistrations; } diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx index d0dbae16e685..6af362814cbd 100644 --- a/cui/source/tabpages/align.cxx +++ b/cui/source/tabpages/align.cxx @@ -216,7 +216,7 @@ bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet ) const SfxUInt16Item* pIndentItem = static_cast<const SfxUInt16Item*>(GetOldItem( *rSet, SID_ATTR_ALIGN_INDENT)); assert(pIndentItem); - std::unique_ptr<SfxUInt16Item> pNewIndentItem(static_cast<SfxUInt16Item*>(pIndentItem->Clone())); + std::unique_ptr<SfxUInt16Item> pNewIndentItem(pIndentItem->Clone()); pNewIndentItem->SetValue(m_xEdIndent->get_value(FieldUnit::TWIP)); rSet->Put(*pNewIndentItem); bChanged = true; @@ -259,7 +259,7 @@ bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet ) const SdrAngleItem* pAngleItem = static_cast<const SdrAngleItem*>(GetOldItem( *rSet, SID_ATTR_ALIGN_DEGREES)); assert(pAngleItem); - std::unique_ptr<SdrAngleItem> pNewAngleItem(static_cast<SdrAngleItem*>(pAngleItem->Clone())); + std::unique_ptr<SdrAngleItem> pNewAngleItem(pAngleItem->Clone()); pNewAngleItem->SetValue(m_aCtrlDial.GetRotation()); rSet->Put(*pNewAngleItem); bChanged = true; @@ -296,7 +296,7 @@ bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet ) const SfxBoolItem* pStackItem = static_cast<const SfxBoolItem*>(GetOldItem( *rSet, SID_ATTR_ALIGN_STACKED)); assert(pStackItem); - std::unique_ptr<SfxBoolItem> pNewStackItem(static_cast<SfxBoolItem*>(pStackItem->Clone())); + std::unique_ptr<SfxBoolItem> pNewStackItem(pStackItem->Clone()); pNewStackItem->SetValue(m_xCbStacked->get_active()); rSet->Put(*pNewStackItem); bChanged = true; @@ -319,7 +319,7 @@ bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet ) const SfxBoolItem* pWrapItem = static_cast<const SfxBoolItem*>(GetOldItem( *rSet, SID_ATTR_ALIGN_LINEBREAK)); assert(pWrapItem); - std::unique_ptr<SfxBoolItem> pNewWrapItem(static_cast<SfxBoolItem*>(pWrapItem->Clone())); + std::unique_ptr<SfxBoolItem> pNewWrapItem(pWrapItem->Clone()); pNewWrapItem->SetValue(m_xBtnWrap->get_active()); rSet->Put(*pNewWrapItem); bChanged = true; @@ -333,7 +333,7 @@ bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet ) const SfxBoolItem* pHyphItem = static_cast<const SfxBoolItem*>(GetOldItem( *rSet, SID_ATTR_ALIGN_HYPHENATION)); assert(pHyphItem); - std::unique_ptr<SfxBoolItem> pNewHyphItem(static_cast<SfxBoolItem*>(pHyphItem->Clone())); + std::unique_ptr<SfxBoolItem> pNewHyphItem(pHyphItem->Clone()); pNewHyphItem->SetValue(m_xBtnHyphen->get_active()); rSet->Put(*pNewHyphItem); bChanged = true; @@ -347,7 +347,7 @@ bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet ) const SfxBoolItem* pShrinkItem = static_cast<const SfxBoolItem*>(GetOldItem( *rSet, SID_ATTR_ALIGN_SHRINKTOFIT)); assert(pShrinkItem); - std::unique_ptr<SfxBoolItem> pNewShrinkItem(static_cast<SfxBoolItem*>(pShrinkItem->Clone())); + std::unique_ptr<SfxBoolItem> pNewShrinkItem(pShrinkItem->Clone()); pNewShrinkItem->SetValue(m_xBtnShrink->get_active()); rSet->Put(*pNewShrinkItem); bChanged = true; diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx index a4b4169a793c..273386c5724b 100644 --- a/cui/source/tabpages/numfmt.cxx +++ b/cui/source/tabpages/numfmt.cxx @@ -1728,7 +1728,7 @@ void SvxNumberFormatTabPage::PageCreated(const SfxAllItemSet& aSet) { const SvxNumberInfoItem* pNumberInfoItem = aSet.GetItem<SvxNumberInfoItem>(SID_ATTR_NUMBERFORMAT_INFO, false); if (pNumberInfoItem && !pNumItem) - pNumItem.reset( static_cast<SvxNumberInfoItem*>(pNumberInfoItem->Clone()) ); + pNumItem.reset(pNumberInfoItem->Clone()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx index 99d1fcb67bcd..c2592f0d944b 100644 --- a/cui/source/tabpages/page.cxx +++ b/cui/source/tabpages/page.cxx @@ -752,7 +752,7 @@ bool SvxPageDescPage::FillItemSet( SfxItemSet* rSet ) (m_xRegisterCB->get_active() || m_xRegisterCB->get_state_changed_from_saved())) { const SfxBoolItem& rRegItem = static_cast<const SfxBoolItem&>(rOldSet.Get(SID_SWREGISTER_MODE)); - std::unique_ptr<SfxBoolItem> pRegItem(static_cast<SfxBoolItem*>(rRegItem.Clone())); + std::unique_ptr<SfxBoolItem> pRegItem(rRegItem.Clone()); bool bCheck = m_xRegisterCB->get_active(); pRegItem->SetValue(bCheck); rSet->Put(std::move(pRegItem)); diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx index 0c9734d197b4..c8ef51b1245c 100644 --- a/cui/source/tabpages/paragrph.cxx +++ b/cui/source/tabpages/paragrph.cxx @@ -400,7 +400,7 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet ) *rOutSet, SID_ATTR_PARA_REGISTER)); if (!pBoolItem) return bModified; - std::unique_ptr<SfxBoolItem> pRegItem(static_cast<SfxBoolItem*>(pBoolItem->Clone())); + std::unique_ptr<SfxBoolItem> pRegItem(pBoolItem->Clone()); sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_REGISTER ); bool bSet = pRegItem->GetValue(); diff --git a/cui/source/tabpages/tabstpge.cxx b/cui/source/tabpages/tabstpge.cxx index f9b7205247cb..70ede0a40e3d 100644 --- a/cui/source/tabpages/tabstpge.cxx +++ b/cui/source/tabpages/tabstpge.cxx @@ -183,7 +183,7 @@ bool SvxTabulatorTabPage::FillItemSet(SfxItemSet* rSet) aNewTabs->Insert(aNull); } - std::unique_ptr<SvxTabStopItem> aTmp(static_cast<SvxTabStopItem*>(aNewTabs->Clone())); + std::unique_ptr<SvxTabStopItem> aTmp(aNewTabs->Clone()); aTmp->Remove(0, aTmp->Count()); for (sal_uInt16 i = 0; i < aNewTabs->Count(); ++i) |