Prefer switch-case to cascaded ifs

Change-Id: Ic3fdf87c3028ae6367447f168a04cdc6fd2b0559
This commit is contained in:
Matteo Casalin
2015-12-15 21:34:20 +01:00
parent 6b9fdc5860
commit 7cd9eba81d

View File

@@ -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;
}
}