summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-06-06 20:55:51 +0200
committerEike Rathke <erack@redhat.com>2017-06-06 20:57:45 +0200
commitca8a4a7abc81a53a88fc0daa61447f9562f532f5 (patch)
tree658f57adbfc8bc52b9cb4cc3a52f191077b771cc /sfx2
parentf300a627b9a88eb8814cc35844ed7c6aa7f19379 (diff)
Eliminate dynamic_cast<const SfxVoidItem*>, use SfxPoolItem::IsVoidItem()
Change-Id: I09dafffd64dd107e802d016494d884f32363521a
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/control/ctrlitem.cxx2
-rw-r--r--sfx2/source/control/dispatch.cxx4
-rw-r--r--sfx2/source/control/unoctitm.cxx6
-rw-r--r--sfx2/source/doc/objxtor.cxx2
-rw-r--r--sfx2/source/statbar/stbitem.cxx2
-rw-r--r--sfx2/source/toolbox/tbxitem.cxx2
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 9c4a0edcab0e..15b445663deb 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -1882,7 +1882,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(
@@ -2084,7 +2084,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 895bacb5e19d..169c0344a216 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;
}