sw/source/uibase/utlui/tmplctrl.cxx | 11 ++++++----- sw/source/uibase/utlui/zoomctrl.cxx | 13 +++++++------ 2 files changed, 13 insertions(+), 11 deletions(-)
New commits: commit 0c6806b03ac6dc6d5fde8bbede57985a2cad271f Author: Jan Holesovsky <[email protected]> Date: Fri Jun 24 09:24:09 2016 +0200 I suspect the condition was wrong here, change the logic slightly. Change-Id: I232d81bce275ba08de5872d69856fe691f80d50c diff --git a/sw/source/uibase/utlui/tmplctrl.cxx b/sw/source/uibase/utlui/tmplctrl.cxx index f5f2e56..3578e5f 100644 --- a/sw/source/uibase/utlui/tmplctrl.cxx +++ b/sw/source/uibase/utlui/tmplctrl.cxx @@ -74,13 +74,14 @@ SwTemplateControl::~SwTemplateControl() void SwTemplateControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState ) { - if( eState != SfxItemState::DEFAULT || dynamic_cast< const SfxVoidItem *>( pState ) != nullptr ) - GetStatusBar().SetItemText( GetId(), OUString() ); - else if ( dynamic_cast< const SfxStringItem *>( pState ) != nullptr ) + const SfxStringItem* pItem = nullptr; + if (SfxItemState::DEFAULT == eState && (pItem = dynamic_cast<const SfxStringItem*>(pState))) { - sTemplate = static_cast<const SfxStringItem*>(pState)->GetValue(); - GetStatusBar().SetItemText( GetId(), sTemplate ); + sTemplate = pItem->GetValue(); + GetStatusBar().SetItemText(GetId(), sTemplate); } + else + GetStatusBar().SetItemText(GetId(), OUString()); } void SwTemplateControl::Paint( const UserDrawEvent& ) commit dcdcbfef61b86688eb26a3382532e324d122d747 Author: Jan Holesovsky <[email protected]> Date: Fri Jun 24 09:19:32 2016 +0200 Simplify dynamic_cast followed by a static_cast. Change-Id: I50ffe014c37c100714d50c0568551ee4021cd9eb diff --git a/sw/source/uibase/utlui/zoomctrl.cxx b/sw/source/uibase/utlui/zoomctrl.cxx index 5da5c9c..c35d37d 100644 --- a/sw/source/uibase/utlui/zoomctrl.cxx +++ b/sw/source/uibase/utlui/zoomctrl.cxx @@ -43,10 +43,11 @@ SwZoomControl::~SwZoomControl() void SwZoomControl::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) { - if(SfxItemState::DEFAULT == eState && dynamic_cast< const SfxStringItem *>( pState ) != nullptr) + const SfxStringItem* pItem = nullptr; + if (SfxItemState::DEFAULT == eState && (pItem = dynamic_cast<const SfxStringItem*>(pState))) { - sPreviewZoom = static_cast<const SfxStringItem*>(pState)->GetValue(); - GetStatusBar().SetItemText( GetId(), sPreviewZoom ); + sPreviewZoom = pItem->GetValue(); + GetStatusBar().SetItemText(GetId(), sPreviewZoom); } else { @@ -57,15 +58,15 @@ void SwZoomControl::StateChanged( sal_uInt16 nSID, SfxItemState eState, void SwZoomControl::Paint( const UserDrawEvent& rUsrEvt ) { - if(sPreviewZoom.isEmpty()) + if (sPreviewZoom.isEmpty()) SvxZoomStatusBarControl::Paint(rUsrEvt); else - GetStatusBar().SetItemText( GetId(), sPreviewZoom ); + GetStatusBar().SetItemText(GetId(), sPreviewZoom); } void SwZoomControl::Command( const CommandEvent& rCEvt ) { - if(sPreviewZoom.isEmpty()) + if (sPreviewZoom.isEmpty()) SvxZoomStatusBarControl::Command(rCEvt); } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
