[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source sd/source sfx2/source svl/source svx/source sw/source

Eike Rathke erack at redhat.com
Tue Jun 6 22:57:55 UTC 2017


 sc/source/ui/cctrl/tbzoomsliderctrl.cxx   |    2 +-
 sd/source/ui/app/tmplctrl.cxx             |    2 +-
 sfx2/source/control/ctrlitem.cxx          |    2 +-
 sfx2/source/control/dispatch.cxx          |    4 ++--
 sfx2/source/control/unoctitm.cxx          |    6 +++---
 sfx2/source/doc/objxtor.cxx               |    2 +-
 sfx2/source/statbar/stbitem.cxx           |    2 +-
 sfx2/source/toolbox/tbxitem.cxx           |    2 +-
 svl/source/items/itemset.cxx              |    2 +-
 svx/source/stbctrls/zoomsliderctrl.cxx    |    2 +-
 svx/source/svdraw/svdibrow.cxx            |    2 +-
 sw/source/uibase/docvw/romenu.cxx         |    2 +-
 sw/source/uibase/utlui/bookctrl.cxx       |    2 +-
 sw/source/uibase/utlui/viewlayoutctrl.cxx |    2 +-
 14 files changed, 17 insertions(+), 17 deletions(-)

New commits:
commit 4b8637738c186a0b7ba3f9399e77fb9f2b9ecc8b
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Jun 6 20:55:51 2017 +0200

    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 at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
index ca054000676f..433fcbc01f6d 100644
--- a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
+++ b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
@@ -62,7 +62,7 @@ void ScZoomSliderControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eState
     ScZoomSliderWnd*        pBox = static_cast<ScZoomSliderWnd*>(rTbx.GetItemWindow( nId ));
     OSL_ENSURE( pBox ,"Control not found!" );
 
-    if ( SfxItemState::DEFAULT != eState || dynamic_cast<const SfxVoidItem*>( pState) !=  nullptr )
+    if ( SfxItemState::DEFAULT != eState || pState->IsVoidItem() )
     {
         SvxZoomSliderItem aZoomSliderItem( 100 );
         pBox->Disable();
diff --git a/sd/source/ui/app/tmplctrl.cxx b/sd/source/ui/app/tmplctrl.cxx
index 685d39d6d889..9203201f59f0 100644
--- a/sd/source/ui/app/tmplctrl.cxx
+++ b/sd/source/ui/app/tmplctrl.cxx
@@ -76,7 +76,7 @@ SdTemplateControl::~SdTemplateControl()
 void SdTemplateControl::StateChanged(
     sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState )
 {
-    if( eState != SfxItemState::DEFAULT || dynamic_cast< const SfxVoidItem *>( pState ) !=  nullptr )
+    if( eState != SfxItemState::DEFAULT || pState->IsVoidItem() )
         GetStatusBar().SetItemText( GetId(), OUString() );
     else if ( dynamic_cast< const SfxStringItem *>( pState ) !=  nullptr )
     {
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;
 }
diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index ddd821d85218..0b46705239f0 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -917,7 +917,7 @@ const SfxPoolItem& SfxItemSet::Get( sal_uInt16 nWhich, bool bSrchInParent) const
                         }
 #ifdef DBG_UTIL
                         const SfxPoolItem *pItem = *ppFnd;
-                        if ( dynamic_cast<const SfxVoidItem *>(pItem) != nullptr || !pItem->Which() )
+                        if ( pItem->IsVoidItem() || !pItem->Which() )
                             SAL_INFO("svl.items", "SFX_WARNING: Getting disabled Item");
 #endif
                         return **ppFnd;
diff --git a/svx/source/stbctrls/zoomsliderctrl.cxx b/svx/source/stbctrls/zoomsliderctrl.cxx
index 3c871557c00c..be0b0721f260 100644
--- a/svx/source/stbctrls/zoomsliderctrl.cxx
+++ b/svx/source/stbctrls/zoomsliderctrl.cxx
@@ -168,7 +168,7 @@ SvxZoomSliderControl::~SvxZoomSliderControl()
 
 void SvxZoomSliderControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState )
 {
-    if ( (SfxItemState::DEFAULT != eState) || dynamic_cast<const SfxVoidItem*>( pState) !=  nullptr )
+    if ( (SfxItemState::DEFAULT != eState) || pState->IsVoidItem() )
     {
         GetStatusBar().SetItemText( GetId(), "" );
         mxImpl->mbValuesSet   = false;
diff --git a/svx/source/svdraw/svdibrow.cxx b/svx/source/svdraw/svdibrow.cxx
index 77bf2c1a3243..a83797f3c11a 100644
--- a/svx/source/svdraw/svdibrow.cxx
+++ b/svx/source/svdraw/svdibrow.cxx
@@ -920,7 +920,7 @@ void SdrItemBrowserControl::SetAttributes(const SfxItemSet* pSet, const SfxItemS
             if (eState!=SfxItemState::DISABLED) {
                 const SfxPoolItem& rItem=pSet->Get(nWhich);
                 sal_uInt16 nIndent=0;
-                if (dynamic_cast<const SfxVoidItem *>(&rItem) == nullptr && dynamic_cast<const SfxSetItem *>(&rItem) == nullptr
+                if (!rItem.IsVoidItem() && dynamic_cast<const SfxSetItem *>(&rItem) == nullptr
                         && (!IsItemIneffective(nWhich,pSet,nIndent) || bDontHideIneffectiveItems)) {
                     OUString aCommentStr;
 
diff --git a/sw/source/uibase/docvw/romenu.cxx b/sw/source/uibase/docvw/romenu.cxx
index a06abe1b5a1f..64f90004230e 100644
--- a/sw/source/uibase/docvw/romenu.cxx
+++ b/sw/source/uibase/docvw/romenu.cxx
@@ -68,7 +68,7 @@ void SwReadOnlyPopup::Check( sal_uInt16 nMID, sal_uInt16 nSID, SfxDispatcher &rD
         xMenu->EnableItem(nMID);
         if (_pItem)
         {
-            xMenu->CheckItem(nMID, dynamic_cast< const SfxVoidItem *>( _pItem.get() ) ==  nullptr &&
+            xMenu->CheckItem(nMID, !_pItem->IsVoidItem() &&
                             dynamic_cast< const SfxBoolItem *>( _pItem.get() ) !=  nullptr &&
                             static_cast<SfxBoolItem*>(_pItem.get())->GetValue());
             //remove full screen entry when not in full screen mode
diff --git a/sw/source/uibase/utlui/bookctrl.cxx b/sw/source/uibase/utlui/bookctrl.cxx
index 73bababd218a..620bd42a8d3b 100644
--- a/sw/source/uibase/utlui/bookctrl.cxx
+++ b/sw/source/uibase/utlui/bookctrl.cxx
@@ -74,7 +74,7 @@ SwBookmarkControl::~SwBookmarkControl()
 void SwBookmarkControl::StateChanged(
     sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState )
 {
-    if( eState != SfxItemState::DEFAULT || dynamic_cast< const SfxVoidItem *>( pState ) !=  nullptr )
+    if( eState != SfxItemState::DEFAULT || pState->IsVoidItem() )
         GetStatusBar().SetItemText( GetId(), OUString() );
     else if (const SfxStringItem* pStringItem = dynamic_cast<const SfxStringItem*>(pState))
     {
diff --git a/sw/source/uibase/utlui/viewlayoutctrl.cxx b/sw/source/uibase/utlui/viewlayoutctrl.cxx
index 95f4196f2aa0..abda424dbf8f 100644
--- a/sw/source/uibase/utlui/viewlayoutctrl.cxx
+++ b/sw/source/uibase/utlui/viewlayoutctrl.cxx
@@ -60,7 +60,7 @@ SwViewLayoutControl::~SwViewLayoutControl()
 
 void SwViewLayoutControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState )
 {
-    if ( SfxItemState::DEFAULT != eState || dynamic_cast< const SfxVoidItem *>( pState ) !=  nullptr )
+    if ( SfxItemState::DEFAULT != eState || pState->IsVoidItem() )
         GetStatusBar().SetItemText( GetId(), OUString() );
     else
     {


More information about the Libreoffice-commits mailing list