diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-07 13:55:06 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-09 07:31:24 +0100 |
commit | 5ba447bdcd13ba3d7c27c8609f207910227e4ab6 (patch) | |
tree | 9a59e7058ef40be90867518590e35abb6c0615f5 /sfx2 | |
parent | ea4a47d7d442d5d897cfa3a6e9f09ce3f1f233c5 (diff) |
new loplugin simplifydynamiccast
simplify dynamic_cast followed by static_cast
Change-Id: I965afcf05d1675094cfde53d3590a0fd00f26279
Reviewed-on: https://gerrit.libreoffice.org/44460
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/appuno.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/control/bindings.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/toolbox/tbxitem.cxx | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index 56ad256aa335..ca9ca3a13794 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -1400,13 +1400,13 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<b if ( rSet.GetItemState( SID_FILLFRAME, false, &pItem ) == SfxItemState::SET ) { pValue[nActProp].Name = sFrame; - if ( dynamic_cast< const SfxUsrAnyItem *>( pItem ) != nullptr ) + if ( auto pUsrAnyItem = dynamic_cast< const SfxUsrAnyItem *>( pItem ) ) { OSL_FAIL( "TransformItems: transporting an XFrame via an SfxUsrAnyItem is not deprecated!" ); - pValue[nActProp++].Value = static_cast< const SfxUsrAnyItem* >( pItem )->GetValue(); + pValue[nActProp++].Value = pUsrAnyItem->GetValue(); } - else if ( dynamic_cast< const SfxUnoFrameItem *>( pItem ) != nullptr ) - pValue[nActProp++].Value <<= static_cast< const SfxUnoFrameItem* >( pItem )->GetFrame(); + else if ( auto pUnoFrameItem = dynamic_cast< const SfxUnoFrameItem *>( pItem ) ) + pValue[nActProp++].Value <<= pUnoFrameItem->GetFrame(); else OSL_FAIL( "TransformItems: invalid item type for SID_FILLFRAME!" ); } diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index a71060120efd..1356c20fc231 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -1019,10 +1019,10 @@ void SfxBindings::Execute_Impl( SfxRequest& aReq, const SfxSlot* pSlot, SfxShell SfxItemPool::IsWhich(nWhich) && pOldItem ) ) { - if ( dynamic_cast< const SfxBoolItem *>( pOldItem ) != nullptr ) + if ( auto pOldBoolItem = dynamic_cast< const SfxBoolItem *>( pOldItem ) ) { // we can toggle Bools - bool bOldValue = static_cast<const SfxBoolItem *>(pOldItem)->GetValue(); + bool bOldValue = pOldBoolItem->GetValue(); SfxBoolItem *pNewItem = static_cast<SfxBoolItem*>(pOldItem->Clone()); pNewItem->SetValue( !bOldValue ); aReq.AppendItem( *pNewItem ); diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx index ac06a2f659e4..4732b6bae239 100644 --- a/sfx2/source/toolbox/tbxitem.cxx +++ b/sfx2/source/toolbox/tbxitem.cxx @@ -619,10 +619,10 @@ void SfxToolBoxControl::StateChanged case SfxItemState::DEFAULT: if ( pState ) { - if ( dynamic_cast< const SfxBoolItem* >(pState) != nullptr ) + if ( auto pBoolItem = dynamic_cast< const SfxBoolItem* >(pState) ) { // BoolItem for checking - if ( static_cast<const SfxBoolItem*>(pState)->GetValue() ) + if ( pBoolItem->GetValue() ) eTri = TRISTATE_TRUE; nItemBits |= ToolBoxItemBits::CHECKABLE; } |