diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2015-12-15 21:34:20 +0100 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2015-12-27 16:51:29 +0100 |
commit | 7cd9eba81dc3be56def062e3f22d290636a11b1c (patch) | |
tree | 9e1f9f9b566f8e42589a1733c4f325f2629f89a0 | |
parent | 6b9fdc5860b710bd9bc864b11e7e44ca844b68c8 (diff) |
Prefer switch-case to cascaded ifs
Change-Id: Ic3fdf87c3028ae6367447f168a04cdc6fd2b0559
-rw-r--r-- | sw/source/uibase/docvw/srcedtw.cxx | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx index 041acaf960cb..1c3937c2f6ab 100644 --- a/sw/source/uibase/docvw/srcedtw.cxx +++ b/sw/source/uibase/docvw/srcedtw.cxx @@ -744,26 +744,28 @@ void SwSrcEditWindow::ImpDoHighlight( const OUString& rSource, sal_uInt16 nLineO void SwSrcEditWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) { - if ( dynamic_cast<const TextHint*>(&rHint) ) + if ( !dynamic_cast<const TextHint*>(&rHint) ) + return; + + const TextHint& rTextHint = static_cast<const TextHint&>(rHint); + switch (rTextHint.GetId()) { - const TextHint& rTextHint = static_cast<const TextHint&>(rHint); - if( rTextHint.GetId() == TEXT_HINT_VIEWSCROLLED ) - { + case TEXT_HINT_VIEWSCROLLED: pHScrollbar->SetThumbPos( pTextView->GetStartDocPos().X() ); pVScrollbar->SetThumbPos( pTextView->GetStartDocPos().Y() ); - } - else if( rTextHint.GetId() == TEXT_HINT_TEXTHEIGHTCHANGED ) - { + break; + + case TEXT_HINT_TEXTHEIGHTCHANGED: if ( pTextEngine->GetTextHeight() < pOutWin->GetOutputSizePixel().Height() ) pTextView->Scroll( 0, pTextView->GetStartDocPos().Y() ); pVScrollbar->SetThumbPos( pTextView->GetStartDocPos().Y() ); SetScrollBarRanges(); - } - else if( ( rTextHint.GetId() == TEXT_HINT_PARAINSERTED ) || - ( rTextHint.GetId() == TEXT_HINT_PARACONTENTCHANGED ) ) - { + break; + + case TEXT_HINT_PARAINSERTED: + case TEXT_HINT_PARACONTENTCHANGED: DoDelayedSyntaxHighlight( (sal_uInt16)rTextHint.GetValue() ); - } + break; } } |