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 /sfx2 | |
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 'sfx2')
-rw-r--r-- | sfx2/inc/sorgitm.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/appl/appopen.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/config/evntconf.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/control/minfitem.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/control/sorgitm.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/dialog/dinfdlg.cxx | 5 | ||||
-rw-r--r-- | sfx2/source/dialog/tabdlg.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/dialog/tplpitem.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/doc/objitem.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/doc/watermarkitem.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/zoomitem.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/view/frame.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 2 |
13 files changed, 16 insertions, 27 deletions
diff --git a/sfx2/inc/sorgitm.hxx b/sfx2/inc/sorgitm.hxx index f43ac927d84a..7c07f27917f6 100644 --- a/sfx2/inc/sorgitm.hxx +++ b/sfx2/inc/sorgitm.hxx @@ -32,7 +32,7 @@ public: static SfxPoolItem* CreateDefault(); SfxScriptOrganizerItem(); - virtual SfxPoolItem* Clone( SfxItemPool* pPool = nullptr ) const override; + virtual SfxScriptOrganizerItem* Clone( SfxItemPool* pPool = nullptr ) const override; virtual bool operator==( const SfxPoolItem& ) const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 0c8200e6fda5..2ef69751b199 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -952,7 +952,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) // remove from Itemset, because it confuses the parameter transformation if (auto pParamLinkItem = rReq.GetArg<SfxLinkItem>(SID_DONELINK)) - pLinkItem.reset( static_cast<SfxLinkItem*>( pParamLinkItem->Clone() ) ); + pLinkItem.reset(pParamLinkItem->Clone()); rReq.RemoveItem( SID_DONELINK ); diff --git a/sfx2/source/config/evntconf.cxx b/sfx2/source/config/evntconf.cxx index 013b129dec36..4f953e3a63e4 100644 --- a/sfx2/source/config/evntconf.cxx +++ b/sfx2/source/config/evntconf.cxx @@ -90,7 +90,7 @@ bool SfxEventNamesItem::GetPresentation( SfxItemPresentation, return false; } -SfxPoolItem* SfxEventNamesItem::Clone( SfxItemPool *) const +SfxEventNamesItem* SfxEventNamesItem::Clone( SfxItemPool *) const { return new SfxEventNamesItem(*this); } diff --git a/sfx2/source/control/minfitem.cxx b/sfx2/source/control/minfitem.cxx index 080723380525..e14b827bdbf2 100644 --- a/sfx2/source/control/minfitem.cxx +++ b/sfx2/source/control/minfitem.cxx @@ -52,13 +52,11 @@ bool SfxMacroInfoItem::operator==( const SfxPoolItem& rCmp) const aCommentText == rItem.aCommentText; } - -SfxPoolItem *SfxMacroInfoItem::Clone( SfxItemPool *) const +SfxMacroInfoItem* SfxMacroInfoItem::Clone( SfxItemPool *) const { return new SfxMacroInfoItem(*this); } - OUString SfxMacroInfoItem::GetQualifiedName() const { OUString aMacroName = aLibName + diff --git a/sfx2/source/control/sorgitm.cxx b/sfx2/source/control/sorgitm.cxx index 76bc397efee0..79f8ddc221f5 100644 --- a/sfx2/source/control/sorgitm.cxx +++ b/sfx2/source/control/sorgitm.cxx @@ -33,13 +33,11 @@ SfxScriptOrganizerItem::SfxScriptOrganizerItem() : { } - -SfxPoolItem* SfxScriptOrganizerItem::Clone( SfxItemPool * ) const +SfxScriptOrganizerItem* SfxScriptOrganizerItem::Clone( SfxItemPool * ) const { return new SfxScriptOrganizerItem( *this ); } - bool SfxScriptOrganizerItem::operator==( const SfxPoolItem& rItem) const { return SfxStringItem::operator==(rItem) && diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index b6f1398f13d1..a7411825050b 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -286,19 +286,16 @@ SfxDocumentInfoItem::SfxDocumentInfoItem( const SfxDocumentInfoItem& rItem ) m_aCmisProperties = rItem.m_aCmisProperties; } - SfxDocumentInfoItem::~SfxDocumentInfoItem() { ClearCustomProperties(); } - -SfxPoolItem* SfxDocumentInfoItem::Clone( SfxItemPool * ) const +SfxDocumentInfoItem* SfxDocumentInfoItem::Clone( SfxItemPool * ) const { return new SfxDocumentInfoItem( *this ); } - bool SfxDocumentInfoItem::operator==( const SfxPoolItem& rItem) const { if (!SfxStringItem::operator==(rItem)) diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index abcdca034b42..9b73516c97c2 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -90,7 +90,7 @@ SfxTabDialogItem::SfxTabDialogItem( sal_uInt16 nId, const SfxItemSet& rItemSet ) { } -SfxPoolItem* SfxTabDialogItem::Clone(SfxItemPool* pToPool) const +SfxTabDialogItem* SfxTabDialogItem::Clone(SfxItemPool* pToPool) const { return new SfxTabDialogItem( *this, pToPool ); } diff --git a/sfx2/source/dialog/tplpitem.cxx b/sfx2/source/dialog/tplpitem.cxx index 60156ad6d4f3..66f378620acb 100644 --- a/sfx2/source/dialog/tplpitem.cxx +++ b/sfx2/source/dialog/tplpitem.cxx @@ -45,13 +45,11 @@ bool SfxTemplateItem::operator==( const SfxPoolItem& rCmp ) const aStyle == static_cast<const SfxTemplateItem&>(rCmp).aStyle ); } - -SfxPoolItem* SfxTemplateItem::Clone( SfxItemPool *) const +SfxTemplateItem* SfxTemplateItem::Clone( SfxItemPool *) const { return new SfxTemplateItem(*this); } - bool SfxTemplateItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const { css::frame::status::Template aTemplate; diff --git a/sfx2/source/doc/objitem.cxx b/sfx2/source/doc/objitem.cxx index 5b5483df5ce8..9f4e6126041b 100644 --- a/sfx2/source/doc/objitem.cxx +++ b/sfx2/source/doc/objitem.cxx @@ -36,7 +36,7 @@ bool SfxObjectShellItem::operator==( const SfxPoolItem &rItem ) const static_cast<const SfxObjectShellItem&>(rItem).pObjSh == pObjSh; } -SfxPoolItem* SfxObjectShellItem::Clone( SfxItemPool *) const +SfxObjectShellItem* SfxObjectShellItem::Clone( SfxItemPool *) const { return new SfxObjectShellItem( *this ); } @@ -97,7 +97,7 @@ bool SfxObjectItem::operator==( const SfxPoolItem &rItem ) const static_cast<const SfxObjectItem&>(rItem)._pSh == _pSh; } -SfxPoolItem* SfxObjectItem::Clone( SfxItemPool *) const +SfxObjectItem* SfxObjectItem::Clone( SfxItemPool *) const { return new SfxObjectItem( *this ); } diff --git a/sfx2/source/doc/watermarkitem.cxx b/sfx2/source/doc/watermarkitem.cxx index e672fc838c87..86e3d27d6a32 100644 --- a/sfx2/source/doc/watermarkitem.cxx +++ b/sfx2/source/doc/watermarkitem.cxx @@ -36,7 +36,7 @@ bool SfxWatermarkItem::operator==( const SfxPoolItem& rCmp ) const m_nColor == static_cast<const SfxWatermarkItem&>(rCmp).m_nColor ); } -SfxPoolItem* SfxWatermarkItem::Clone( SfxItemPool *) const +SfxWatermarkItem* SfxWatermarkItem::Clone( SfxItemPool *) const { return new SfxWatermarkItem(*this); } diff --git a/sfx2/source/doc/zoomitem.cxx b/sfx2/source/doc/zoomitem.cxx index 4ae3c3547eab..4724bf0060f1 100644 --- a/sfx2/source/doc/zoomitem.cxx +++ b/sfx2/source/doc/zoomitem.cxx @@ -46,13 +46,11 @@ SvxZoomItem::SvxZoomItem { } - -SfxPoolItem* SvxZoomItem::Clone( SfxItemPool * /*pPool*/ ) const +SvxZoomItem* SvxZoomItem::Clone( SfxItemPool * /*pPool*/ ) const { return new SvxZoomItem( *this ); } - bool SvxZoomItem::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index b7d832ad260c..ac7245e45966 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -421,7 +421,7 @@ bool SfxFrameItem::operator==( const SfxPoolItem &rItem ) const static_cast<const SfxFrameItem&>(rItem).wFrame == wFrame; } -SfxPoolItem* SfxFrameItem::Clone( SfxItemPool *) const +SfxFrameItem* SfxFrameItem::Clone( SfxItemPool *) const { SfxFrameItem* pNew = new SfxFrameItem( wFrame); pNew->pFrame = pFrame; @@ -478,7 +478,7 @@ bool SfxUnoAnyItem::operator==( const SfxPoolItem& rItem ) const return false; } -SfxPoolItem* SfxUnoAnyItem::Clone( SfxItemPool *) const +SfxUnoAnyItem* SfxUnoAnyItem::Clone( SfxItemPool *) const { return new SfxUnoAnyItem( *this ); } @@ -513,7 +513,7 @@ bool SfxUnoFrameItem::operator==( const SfxPoolItem& i_rItem ) const static_cast< const SfxUnoFrameItem& >( i_rItem ).m_xFrame == m_xFrame; } -SfxPoolItem* SfxUnoFrameItem::Clone( SfxItemPool* ) const +SfxUnoFrameItem* SfxUnoFrameItem::Clone( SfxItemPool* ) const { return new SfxUnoFrameItem( *this ); } diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index cefe8af5bd9b..f0cf80dbe8f3 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1780,7 +1780,7 @@ bool SfxViewFrameItem::operator==( const SfxPoolItem &rItem ) const static_cast<const SfxViewFrameItem&>(rItem).pFrame == pFrame; } -SfxPoolItem* SfxViewFrameItem::Clone( SfxItemPool *) const +SfxViewFrameItem* SfxViewFrameItem::Clone( SfxItemPool *) const { return new SfxViewFrameItem( *this ); } |