diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-04 13:08:59 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-05 09:31:50 +0200 |
commit | d2b3ea4d377bf05830f6eb11d53fd55ea6b435fc (patch) | |
tree | a9ca855eac45810e67d6e629538de13b2a9e589d /sfx2/source/statbar | |
parent | 7a11e702569ab89eb7722c883ecc3cbbe1a19a65 (diff) |
loplugin:useuniqueptr in sfx2
Change-Id: I7b406cd07cae579de608faa3ec47dd1190dea411
Reviewed-on: https://gerrit.libreoffice.org/60003
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2/source/statbar')
-rw-r--r-- | sfx2/source/statbar/stbitem.cxx | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/sfx2/source/statbar/stbitem.cxx b/sfx2/source/statbar/stbitem.cxx index 2949ec86a578..9512c25c1bf6 100644 --- a/sfx2/source/statbar/stbitem.cxx +++ b/sfx2/source/statbar/stbitem.cxx @@ -224,7 +224,7 @@ void SAL_CALL SfxStatusBarControl::statusChanged( const frame::FeatureStateEvent else { SfxItemState eState = SfxItemState::DISABLED; - SfxPoolItem* pItem = nullptr; + std::unique_ptr<SfxPoolItem> pItem; if ( rEvent.IsEnabled ) { eState = SfxItemState::DEFAULT; @@ -232,39 +232,39 @@ void SAL_CALL SfxStatusBarControl::statusChanged( const frame::FeatureStateEvent if ( aType == cppu::UnoType<void>::get() ) { - pItem = new SfxVoidItem( nSlotID ); + pItem.reset( new SfxVoidItem( nSlotID ) ); eState = SfxItemState::UNKNOWN; } else if ( aType == cppu::UnoType<bool>::get() ) { bool bTemp = false; rEvent.State >>= bTemp ; - pItem = new SfxBoolItem( nSlotID, bTemp ); + pItem.reset( new SfxBoolItem( nSlotID, bTemp ) ); } else if ( aType == ::cppu::UnoType< ::cppu::UnoUnsignedShortType >::get() ) { sal_uInt16 nTemp = 0; rEvent.State >>= nTemp ; - pItem = new SfxUInt16Item( nSlotID, nTemp ); + pItem.reset( new SfxUInt16Item( nSlotID, nTemp ) ); } else if ( aType == cppu::UnoType<sal_uInt32>::get() ) { sal_uInt32 nTemp = 0; rEvent.State >>= nTemp ; - pItem = new SfxUInt32Item( nSlotID, nTemp ); + pItem.reset( new SfxUInt32Item( nSlotID, nTemp ) ); } else if ( aType == cppu::UnoType<OUString>::get() ) { OUString sTemp ; rEvent.State >>= sTemp ; - pItem = new SfxStringItem( nSlotID, sTemp ); + pItem.reset( new SfxStringItem( nSlotID, sTemp ) ); } else if ( aType == cppu::UnoType< css::frame::status::ItemStatus>::get() ) { frame::status::ItemStatus aItemStatus; rEvent.State >>= aItemStatus; eState = static_cast<SfxItemState>(aItemStatus.State); - pItem = new SfxVoidItem( nSlotID ); + pItem.reset( new SfxVoidItem( nSlotID ) ); } else { @@ -276,12 +276,11 @@ void SAL_CALL SfxStatusBarControl::statusChanged( const frame::FeatureStateEvent pItem->PutValue( rEvent.State, 0 ); } else - pItem = new SfxVoidItem( nSlotID ); + pItem.reset( new SfxVoidItem( nSlotID ) ); } } - StateChanged( nSlotID, eState, pItem ); - delete pItem; + StateChanged( nSlotID, eState, pItem.get() ); } } } |