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 /svl | |
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 'svl')
-rw-r--r-- | svl/source/items/aeitem.cxx | 2 | ||||
-rw-r--r-- | svl/source/items/cenumitm.cxx | 2 | ||||
-rw-r--r-- | svl/source/items/cintitem.cxx | 11 | ||||
-rw-r--r-- | svl/source/items/custritm.cxx | 2 | ||||
-rw-r--r-- | svl/source/items/flagitem.cxx | 7 | ||||
-rw-r--r-- | svl/source/items/globalnameitem.cxx | 5 | ||||
-rw-r--r-- | svl/source/items/grabbagitem.cxx | 2 | ||||
-rw-r--r-- | svl/source/items/ilstitem.cxx | 2 | ||||
-rw-r--r-- | svl/source/items/imageitm.cxx | 4 | ||||
-rw-r--r-- | svl/source/items/int64item.cxx | 3 | ||||
-rw-r--r-- | svl/source/items/intitem.cxx | 2 | ||||
-rw-r--r-- | svl/source/items/lckbitem.cxx | 4 | ||||
-rw-r--r-- | svl/source/items/macitem.cxx | 5 | ||||
-rw-r--r-- | svl/source/items/poolcach.cxx | 2 | ||||
-rw-r--r-- | svl/source/items/poolitem.cxx | 4 | ||||
-rw-r--r-- | svl/source/items/ptitem.cxx | 4 | ||||
-rw-r--r-- | svl/source/items/rectitem.cxx | 4 | ||||
-rw-r--r-- | svl/source/items/rngitem.cxx | 3 | ||||
-rw-r--r-- | svl/source/items/slstitm.cxx | 4 | ||||
-rw-r--r-- | svl/source/items/srchitem.cxx | 5 | ||||
-rw-r--r-- | svl/source/items/stritem.cxx | 5 | ||||
-rw-r--r-- | svl/source/items/visitem.cxx | 2 |
22 files changed, 26 insertions, 58 deletions
diff --git a/svl/source/items/aeitem.cxx b/svl/source/items/aeitem.cxx index 5ac6fbac3980..7c85153b63a8 100644 --- a/svl/source/items/aeitem.cxx +++ b/svl/source/items/aeitem.cxx @@ -48,7 +48,7 @@ OUString const & SfxAllEnumItem::GetTextByPos( sal_uInt16 nPos ) const return m_Values[nPos]; } -SfxPoolItem* SfxAllEnumItem::Clone( SfxItemPool * ) const +SfxAllEnumItem* SfxAllEnumItem::Clone( SfxItemPool * ) const { return new SfxAllEnumItem(*this); } diff --git a/svl/source/items/cenumitm.cxx b/svl/source/items/cenumitm.cxx index c5e30b81ece3..3d0b7e581d52 100644 --- a/svl/source/items/cenumitm.cxx +++ b/svl/source/items/cenumitm.cxx @@ -134,7 +134,7 @@ bool SfxBoolItem::PutValue(const css::uno::Any& rVal, sal_uInt8) } // virtual -SfxPoolItem * SfxBoolItem::Clone(SfxItemPool *) const +SfxBoolItem* SfxBoolItem::Clone(SfxItemPool *) const { return new SfxBoolItem(*this); } diff --git a/svl/source/items/cintitem.cxx b/svl/source/items/cintitem.cxx index 07728df344b2..0f522f7a9260 100644 --- a/svl/source/items/cintitem.cxx +++ b/svl/source/items/cintitem.cxx @@ -61,12 +61,11 @@ bool CntByteItem::PutValue(const css::uno::Any& rVal, sal_uInt8) } // virtual -SfxPoolItem * CntByteItem::Clone(SfxItemPool *) const +CntByteItem* CntByteItem::Clone(SfxItemPool *) const { return new CntByteItem(*this); } - // virtual bool CntUInt16Item::operator ==(const SfxPoolItem & rItem) const { @@ -109,12 +108,11 @@ bool CntUInt16Item::PutValue(const css::uno::Any& rVal, sal_uInt8) } // virtual -SfxPoolItem * CntUInt16Item::Clone(SfxItemPool *) const +CntUInt16Item* CntUInt16Item::Clone(SfxItemPool *) const { return new CntUInt16Item(*this); } - // virtual bool CntInt32Item::operator ==(const SfxPoolItem & rItem) const { @@ -155,12 +153,11 @@ bool CntInt32Item::PutValue(const css::uno::Any& rVal, sal_uInt8) } // virtual -SfxPoolItem * CntInt32Item::Clone(SfxItemPool *) const +CntInt32Item* CntInt32Item::Clone(SfxItemPool *) const { return new CntInt32Item(*this); } - // virtual bool CntUInt32Item::operator ==(const SfxPoolItem & rItem) const { @@ -204,7 +201,7 @@ bool CntUInt32Item::PutValue(const css::uno::Any& rVal, sal_uInt8) } // virtual -SfxPoolItem * CntUInt32Item::Clone(SfxItemPool *) const +CntUInt32Item* CntUInt32Item::Clone(SfxItemPool *) const { return new CntUInt32Item(*this); } diff --git a/svl/source/items/custritm.cxx b/svl/source/items/custritm.cxx index 36a32d1ff34b..b6946a4f4e6e 100644 --- a/svl/source/items/custritm.cxx +++ b/svl/source/items/custritm.cxx @@ -72,7 +72,7 @@ bool CntUnencodedStringItem::PutValue(const css::uno::Any& rVal, } // virtual -SfxPoolItem * CntUnencodedStringItem::Clone(SfxItemPool *) const +CntUnencodedStringItem* CntUnencodedStringItem::Clone(SfxItemPool *) const { return new CntUnencodedStringItem(*this); } diff --git a/svl/source/items/flagitem.cxx b/svl/source/items/flagitem.cxx index 33a28718ba90..fd96c5317b79 100644 --- a/svl/source/items/flagitem.cxx +++ b/svl/source/items/flagitem.cxx @@ -29,7 +29,6 @@ SfxFlagItem::SfxFlagItem( sal_uInt16 nW, sal_uInt16 nV ) : { } - bool SfxFlagItem::GetPresentation ( SfxItemPresentation /*ePresentation*/, @@ -45,25 +44,21 @@ bool SfxFlagItem::GetPresentation return true; } - sal_uInt8 SfxFlagItem::GetFlagCount() const { SAL_INFO("svl", "calling GetValueText(sal_uInt16) on SfxFlagItem -- override!"); return 0; } - bool SfxFlagItem::operator==( const SfxPoolItem& rItem ) const { assert(SfxPoolItem::operator==(rItem)); return static_cast<const SfxFlagItem&>(rItem).nVal == nVal; } - -SfxPoolItem* SfxFlagItem::Clone(SfxItemPool *) const +SfxFlagItem* SfxFlagItem::Clone(SfxItemPool *) const { return new SfxFlagItem( *this ); } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svl/source/items/globalnameitem.cxx b/svl/source/items/globalnameitem.cxx index 2cd289f05f84..3f8d3265d779 100644 --- a/svl/source/items/globalnameitem.cxx +++ b/svl/source/items/globalnameitem.cxx @@ -41,20 +41,17 @@ SfxGlobalNameItem::SfxGlobalNameItem( sal_uInt16 nW, const SvGlobalName& rName ) { } - SfxGlobalNameItem::~SfxGlobalNameItem() { } - bool SfxGlobalNameItem::operator==( const SfxPoolItem& rItem ) const { return SfxPoolItem::operator==(rItem) && static_cast<const SfxGlobalNameItem&>(rItem).m_aName == m_aName; } - -SfxPoolItem* SfxGlobalNameItem::Clone(SfxItemPool *) const +SfxGlobalNameItem* SfxGlobalNameItem::Clone(SfxItemPool *) const { return new SfxGlobalNameItem( *this ); } diff --git a/svl/source/items/grabbagitem.cxx b/svl/source/items/grabbagitem.cxx index e4d70bded1e8..39ee566866b3 100644 --- a/svl/source/items/grabbagitem.cxx +++ b/svl/source/items/grabbagitem.cxx @@ -31,7 +31,7 @@ bool SfxGrabBagItem::operator==(const SfxPoolItem& rItem) const && m_aMap == static_cast<const SfxGrabBagItem*>(&rItem)->m_aMap; } -SfxPoolItem* SfxGrabBagItem::Clone(SfxItemPool* /*pPool*/) const +SfxGrabBagItem* SfxGrabBagItem::Clone(SfxItemPool* /*pPool*/) const { return new SfxGrabBagItem(*this); } diff --git a/svl/source/items/ilstitem.cxx b/svl/source/items/ilstitem.cxx index 221bb0b074e2..d9ddeae2182e 100644 --- a/svl/source/items/ilstitem.cxx +++ b/svl/source/items/ilstitem.cxx @@ -56,7 +56,7 @@ bool SfxIntegerListItem::operator==( const SfxPoolItem& rPoolItem ) const return rItem.m_aList == m_aList; } -SfxPoolItem* SfxIntegerListItem::Clone( SfxItemPool * ) const +SfxIntegerListItem* SfxIntegerListItem::Clone( SfxItemPool * ) const { return new SfxIntegerListItem( *this ); } diff --git a/svl/source/items/imageitm.cxx b/svl/source/items/imageitm.cxx index e7ca5db4455e..4959914b152d 100644 --- a/svl/source/items/imageitm.cxx +++ b/svl/source/items/imageitm.cxx @@ -52,13 +52,11 @@ SfxImageItem::~SfxImageItem() { } - -SfxPoolItem* SfxImageItem::Clone( SfxItemPool* ) const +SfxImageItem* SfxImageItem::Clone( SfxItemPool* ) const { return new SfxImageItem( *this ); } - bool SfxImageItem::operator==( const SfxPoolItem& rItem ) const { return SfxInt16Item::operator==(rItem) && diff --git a/svl/source/items/int64item.cxx b/svl/source/items/int64item.cxx index c7f46452c27a..06efd1fc9aca 100644 --- a/svl/source/items/int64item.cxx +++ b/svl/source/items/int64item.cxx @@ -50,10 +50,9 @@ bool SfxInt64Item::PutValue( return false; } -SfxPoolItem* SfxInt64Item::Clone( SfxItemPool* /*pOther*/ ) const +SfxInt64Item* SfxInt64Item::Clone( SfxItemPool* /*pOther*/ ) const { return new SfxInt64Item(*this); } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svl/source/items/intitem.cxx b/svl/source/items/intitem.cxx index b3ccec4c4159..c0c4831a5c3d 100644 --- a/svl/source/items/intitem.cxx +++ b/svl/source/items/intitem.cxx @@ -88,7 +88,7 @@ bool SfxInt16Item::PutValue(const css::uno::Any& rVal, sal_uInt8 ) return false; } -SfxPoolItem * SfxInt16Item::Clone(SfxItemPool *) const +SfxInt16Item* SfxInt16Item::Clone(SfxItemPool *) const { return new SfxInt16Item(*this); } diff --git a/svl/source/items/lckbitem.cxx b/svl/source/items/lckbitem.cxx index e2ad91a4c30f..87165ae50756 100644 --- a/svl/source/items/lckbitem.cxx +++ b/svl/source/items/lckbitem.cxx @@ -42,13 +42,11 @@ bool SfxLockBytesItem::operator==( const SfxPoolItem& rItem ) const return SfxPoolItem::operator==(rItem) && static_cast<const SfxLockBytesItem&>(rItem)._xVal == _xVal; } - -SfxPoolItem* SfxLockBytesItem::Clone(SfxItemPool *) const +SfxLockBytesItem* SfxLockBytesItem::Clone(SfxItemPool *) const { return new SfxLockBytesItem( *this ); } - // virtual bool SfxLockBytesItem::PutValue( const css::uno::Any& rVal, sal_uInt8 ) { diff --git a/svl/source/items/macitem.cxx b/svl/source/items/macitem.cxx index 37a895d3673e..03bd8f6d53e2 100644 --- a/svl/source/items/macitem.cxx +++ b/svl/source/items/macitem.cxx @@ -185,7 +185,6 @@ void SvxMacroTableDtor::Erase(SvMacroItemId nEvent) } } - bool SvxMacroItem::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); @@ -196,13 +195,11 @@ bool SvxMacroItem::operator==( const SfxPoolItem& rAttr ) const return rOwn == rOther; } - -SfxPoolItem* SvxMacroItem::Clone( SfxItemPool* ) const +SvxMacroItem* SvxMacroItem::Clone( SfxItemPool* ) const { return new SvxMacroItem( *this ); } - bool SvxMacroItem::GetPresentation ( SfxItemPresentation /*ePres*/, diff --git a/svl/source/items/poolcach.cxx b/svl/source/items/poolcach.cxx index 23a4c1629f0e..2d406e18c08e 100644 --- a/svl/source/items/poolcach.cxx +++ b/svl/source/items/poolcach.cxx @@ -77,7 +77,7 @@ const SfxSetItem& SfxItemPoolCache::ApplyTo( const SfxSetItem &rOrigItem ) } // Insert the new attributes in a new Set - std::unique_ptr<SfxSetItem> pNewItem(static_cast<SfxSetItem *>(rOrigItem.Clone())); + std::unique_ptr<SfxSetItem> pNewItem(rOrigItem.Clone()); if ( pItemToPut ) { pNewItem->GetItemSet().PutDirect( *pItemToPut ); diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx index 272beceb5927..c5e09ddf9048 100644 --- a/svl/source/items/poolitem.cxx +++ b/svl/source/items/poolitem.cxx @@ -609,7 +609,7 @@ void SfxVoidItem::dumpAsXml(xmlTextWriterPtr pWriter) const xmlTextWriterEndElement(pWriter); } -SfxPoolItem* SfxVoidItem::Clone(SfxItemPool *) const +SfxVoidItem* SfxVoidItem::Clone(SfxItemPool *) const { return new SfxVoidItem(*this); } @@ -623,13 +623,11 @@ void SfxPoolItem::ScaleMetrics( long /*lMult*/, long /*lDiv*/ ) { } - bool SfxPoolItem::HasMetrics() const { return false; } - bool SfxPoolItem::QueryValue( css::uno::Any&, sal_uInt8 ) const { OSL_FAIL("There is no implementation for QueryValue for this item!"); diff --git a/svl/source/items/ptitem.cxx b/svl/source/items/ptitem.cxx index af634fcc201c..08912f55700f 100644 --- a/svl/source/items/ptitem.cxx +++ b/svl/source/items/ptitem.cxx @@ -65,13 +65,11 @@ bool SfxPointItem::operator==( const SfxPoolItem& rItem ) const return static_cast<const SfxPointItem&>(rItem).aVal == aVal; } - -SfxPoolItem* SfxPointItem::Clone(SfxItemPool *) const +SfxPointItem* SfxPointItem::Clone(SfxItemPool *) const { return new SfxPointItem( *this ); } - bool SfxPointItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { diff --git a/svl/source/items/rectitem.cxx b/svl/source/items/rectitem.cxx index 5889140782a6..1d9d00aa5e48 100644 --- a/svl/source/items/rectitem.cxx +++ b/svl/source/items/rectitem.cxx @@ -65,13 +65,11 @@ bool SfxRectangleItem::operator==( const SfxPoolItem& rItem ) const return static_cast<const SfxRectangleItem&>(rItem).aVal == aVal; } - -SfxPoolItem* SfxRectangleItem::Clone(SfxItemPool *) const +SfxRectangleItem* SfxRectangleItem::Clone(SfxItemPool *) const { return new SfxRectangleItem( *this ); } - bool SfxRectangleItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId) const { diff --git a/svl/source/items/rngitem.cxx b/svl/source/items/rngitem.cxx index 6bc41e6976d0..89f7e642ed50 100644 --- a/svl/source/items/rngitem.cxx +++ b/svl/source/items/rngitem.cxx @@ -51,8 +51,7 @@ bool SfxRangeItem::operator==( const SfxPoolItem& rItem ) const return nFrom==rT.nFrom && nTo==rT.nTo; } - -SfxPoolItem* SfxRangeItem::Clone(SfxItemPool *) const +SfxRangeItem* SfxRangeItem::Clone(SfxItemPool *) const { return new SfxRangeItem( Which(), nFrom, nTo ); } diff --git a/svl/source/items/slstitm.cxx b/svl/source/items/slstitm.cxx index 225c43f08cfe..95de93e7b635 100644 --- a/svl/source/items/slstitm.cxx +++ b/svl/source/items/slstitm.cxx @@ -88,13 +88,11 @@ bool SfxStringListItem::GetPresentation return false; } - -SfxPoolItem* SfxStringListItem::Clone( SfxItemPool *) const +SfxStringListItem* SfxStringListItem::Clone( SfxItemPool *) const { return new SfxStringListItem( *this ); } - void SfxStringListItem::SetString( const OUString& rStr ) { mpList.reset( new std::vector<OUString> ); diff --git a/svl/source/items/srchitem.cxx b/svl/source/items/srchitem.cxx index 4fd9ead794af..4588d7a8bfc4 100644 --- a/svl/source/items/srchitem.cxx +++ b/svl/source/items/srchitem.cxx @@ -224,18 +224,15 @@ SvxSearchItem::SvxSearchItem( const SvxSearchItem& rItem ) : EnableNotification( lcl_GetNotifyNames() ); } - SvxSearchItem::~SvxSearchItem() { } - -SfxPoolItem* SvxSearchItem::Clone( SfxItemPool *) const +SvxSearchItem* SvxSearchItem::Clone( SfxItemPool *) const { return new SvxSearchItem(*this); } - //! used below static bool equalsWithoutLocale( const i18nutil::SearchOptions2& rItem1, const i18nutil::SearchOptions2& rItem2 ) { diff --git a/svl/source/items/stritem.cxx b/svl/source/items/stritem.cxx index 85e7ec8d4ce2..86e2087cd503 100644 --- a/svl/source/items/stritem.cxx +++ b/svl/source/items/stritem.cxx @@ -20,10 +20,8 @@ #include <svl/stritem.hxx> #include <libxml/xmlwriter.h> - - // virtual -SfxPoolItem * SfxStringItem::Clone(SfxItemPool *) const +SfxStringItem* SfxStringItem::Clone(SfxItemPool *) const { return new SfxStringItem(*this); } @@ -40,4 +38,5 @@ SfxPoolItem* SfxStringItem::CreateDefault() { return new SfxStringItem(); }; + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svl/source/items/visitem.cxx b/svl/source/items/visitem.cxx index 515572de7913..2ba61a517c6c 100644 --- a/svl/source/items/visitem.cxx +++ b/svl/source/items/visitem.cxx @@ -59,7 +59,7 @@ bool SfxVisibilityItem::PutValue(const css::uno::Any& rVal, sal_uInt8) } // virtual -SfxPoolItem * SfxVisibilityItem::Clone(SfxItemPool *) const +SfxVisibilityItem* SfxVisibilityItem::Clone(SfxItemPool *) const { return new SfxVisibilityItem(*this); } |