[Libreoffice-commits] core.git: sw/source

Jan Holesovsky kendy at collabora.com
Tue Jul 19 18:34:09 UTC 2016


 sw/source/uibase/utlui/bookctrl.cxx |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 1fe71ce42ed6977885a3253639bbc3f0881a47e7
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Tue Jul 19 12:13:37 2016 +0200

    Simplify dynamic_cast followed by a static_cast.
    
    Change-Id: I615100fcdcc1bb6e461ecc1f8bdcef301cd68615

diff --git a/sw/source/uibase/utlui/bookctrl.cxx b/sw/source/uibase/utlui/bookctrl.cxx
index 41f0641..d7b51a6 100644
--- a/sw/source/uibase/utlui/bookctrl.cxx
+++ b/sw/source/uibase/utlui/bookctrl.cxx
@@ -76,14 +76,14 @@ void SwBookmarkControl::StateChanged(
 {
     if( eState != SfxItemState::DEFAULT || dynamic_cast< const SfxVoidItem *>( pState ) !=  nullptr )
         GetStatusBar().SetItemText( GetId(), OUString() );
-    else if ( dynamic_cast< const SfxStringItem *>( pState ) !=  nullptr )
+    else if (const SfxStringItem* pStringItem = dynamic_cast<const SfxStringItem*>(pState))
     {
-        sPageNumber = static_cast<const SfxStringItem*>(pState)->GetValue();
-        GetStatusBar().SetItemText( GetId(), sPageNumber );
+        sPageNumber = pStringItem->GetValue();
+        GetStatusBar().SetItemText(GetId(), sPageNumber);
     }
-    else if ( dynamic_cast< const SfxBoolItem *>( pState ) !=  nullptr )
+    else if (const SfxBoolItem* pBoolItem = dynamic_cast<const SfxBoolItem*>(pState))
     {
-        if (static_cast<const SfxBoolItem*>(pState)->GetValue()) // Indicates whether to show extended tooltip
+        if (pBoolItem->GetValue()) // Indicates whether to show extended tooltip
             GetStatusBar().SetQuickHelpText(GetId(), SW_RESSTR(STR_BOOKCTRL_HINT_EXTENDED));
         else
             GetStatusBar().SetQuickHelpText(GetId(), SW_RESSTR(STR_BOOKCTRL_HINT));


More information about the Libreoffice-commits mailing list