diff options
author | Eike Rathke <erack@redhat.com> | 2017-06-06 20:55:51 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-06-07 00:57:23 +0200 |
commit | 4b8637738c186a0b7ba3f9399e77fb9f2b9ecc8b (patch) | |
tree | 91f374a897ae4f02cc1912a66973b18bfe75791d /sfx2 | |
parent | 3f94381f72782e0c5b16df12de6d52de96e8a0d5 (diff) |
Eliminate dynamic_cast<const SfxVoidItem*>, use SfxPoolItem::IsVoidItem()
Change-Id: I09dafffd64dd107e802d016494d884f32363521a
(cherry picked from commit ca8a4a7abc81a53a88fc0daa61447f9562f532f5)
Reviewed-on: https://gerrit.libreoffice.org/38463
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/control/ctrlitem.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/control/dispatch.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/control/unoctitm.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/doc/objxtor.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/statbar/stbitem.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/toolbox/tbxitem.cxx | 2 |
6 files changed, 9 insertions, 9 deletions
diff --git a/sfx2/source/control/ctrlitem.cxx b/sfx2/source/control/ctrlitem.cxx index bfcb183f8a83..cd22920f144e 100644 --- a/sfx2/source/control/ctrlitem.cxx +++ b/sfx2/source/control/ctrlitem.cxx @@ -293,7 +293,7 @@ SfxItemState SfxControllerItem::GetItemState ? SfxItemState::DISABLED : IsInvalidItem(pState) ? SfxItemState::DONTCARE - : dynamic_cast< const SfxVoidItem *>( pState ) != nullptr && !pState->Which() + : pState->IsVoidItem() && !pState->Which() ? SfxItemState::UNKNOWN : SfxItemState::DEFAULT; } diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 3e9e6d9827f3..8002f37ed1b2 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -1884,7 +1884,7 @@ bool SfxDispatcher::FillState_(const SfxSlotServer& rSvr, SfxItemSet& rState, pItem; pItem = aIter.NextItem() ) { - if ( !IsInvalidItem(pItem) && dynamic_cast< const SfxVoidItem *>( pItem ) == nullptr ) + if ( !IsInvalidItem(pItem) && !pItem->IsVoidItem() ) { sal_uInt16 nSlotId = rState.GetPool()->GetSlotId(pItem->Which()); SAL_INFO_IF( @@ -2086,7 +2086,7 @@ SfxItemState SfxDispatcher::QueryState( sal_uInt16 nSID, css::uno::Any& rAny ) else { css::uno::Any aState; - if ( dynamic_cast< const SfxVoidItem *>( pItem ) == nullptr ) + if ( !pItem->IsVoidItem() ) { sal_uInt16 nSubId( 0 ); SfxItemPool& rPool = pShell->GetPool(); diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index a4c8ba30d1a7..dbbd96074f77 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -746,7 +746,7 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const css::util::URL& aURL, { if (const SfxBoolItem* pBoolItem = dynamic_cast<const SfxBoolItem*>(pItem)) bSuccess = pBoolItem->GetValue(); - else if ( dynamic_cast< const SfxVoidItem *>( pItem ) == nullptr ) + else if ( !pItem->IsVoidItem() ) bSuccess = true; // all other types are true } // else bSuccess = false look to line 664 it is false @@ -808,7 +808,7 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const css::util::URL& aURL, aEvent.State = css::frame::DispatchResultState::FAILURE; aEvent.Source = static_cast<css::frame::XDispatch*>(pDispatch); - if ( bSuccess && pItem && dynamic_cast< const SfxVoidItem *>( pItem ) == nullptr ) + if ( bSuccess && pItem && !pItem->IsVoidItem() ) { sal_uInt16 nSubId( 0 ); if ( eMapUnit == MapUnit::MapTwip ) @@ -924,7 +924,7 @@ void SfxDispatchController_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eSt if (bNotify) { css::uno::Any aState; - if ( ( eState >= SfxItemState::DEFAULT ) && pState && !IsInvalidItem( pState ) && dynamic_cast< const SfxVoidItem *>( pState ) == nullptr ) + if ( ( eState >= SfxItemState::DEFAULT ) && pState && !IsInvalidItem( pState ) && !pState->IsVoidItem() ) { // Retrieve metric from pool to have correct sub ID when calling QueryValue sal_uInt16 nSubId( 0 ); diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index d17203cf5328..7b605d2684c0 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -610,7 +610,7 @@ bool SfxObjectShell::PrepareClose pPoolItem = pFrame->GetBindings().ExecuteSynchron( SID_SAVEDOC, ppArgs ); } - if ( !pPoolItem || dynamic_cast< const SfxVoidItem *>( pPoolItem ) != nullptr || ( dynamic_cast< const SfxBoolItem *>( pPoolItem ) != nullptr && !static_cast<const SfxBoolItem*>( pPoolItem )->GetValue() ) ) + if ( !pPoolItem || pPoolItem->IsVoidItem() || ( dynamic_cast< const SfxBoolItem *>( pPoolItem ) != nullptr && !static_cast<const SfxBoolItem*>( pPoolItem )->GetValue() ) ) return false; } else if ( RET_CANCEL == nRet ) diff --git a/sfx2/source/statbar/stbitem.cxx b/sfx2/source/statbar/stbitem.cxx index 5d1cf9c460bd..12c977e8e5b0 100644 --- a/sfx2/source/statbar/stbitem.cxx +++ b/sfx2/source/statbar/stbitem.cxx @@ -410,7 +410,7 @@ void SfxStatusBarControl::StateChanged pBar->SetItemText( nSID, pStr->GetValue() ); else { - DBG_ASSERT( eState != SfxItemState::DEFAULT || dynamic_cast< const SfxVoidItem *>( pState ) != nullptr, + DBG_ASSERT( eState != SfxItemState::DEFAULT || pState->IsVoidItem(), "wrong SfxPoolItem subclass in SfxStatusBarControl" ); pBar->SetItemText( nSID, OUString() ); } diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx index 5aed453f2392..daa9787f620a 100644 --- a/sfx2/source/toolbox/tbxitem.cxx +++ b/sfx2/source/toolbox/tbxitem.cxx @@ -374,7 +374,7 @@ SfxItemState SfxToolBoxControl::GetItemState( ? SfxItemState::DISABLED : IsInvalidItem(pState) ? SfxItemState::DONTCARE - : dynamic_cast< const SfxVoidItem *>( pState ) != nullptr && !pState->Which() + : pState->IsVoidItem() && !pState->Which() ? SfxItemState::UNKNOWN : SfxItemState::DEFAULT; } |