summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2015-12-15 21:16:43 +0100
committerMatteo Casalin <matteo.casalin@yahoo.com>2015-12-27 16:51:28 +0100
commit3806388288cc4a9c229bb0c7aa14d806406d4bf4 (patch)
tree9f0638052ea01d5ff6b65dafaa0adf9d5b5723a2
parent801801bbca4db5b568bb947a29326b7b018a48fa (diff)
Prefer switch-case to cascaded ifs
Change-Id: I0848676dcdf6f96fe90f34be018b1c3d9d3d370a
-rw-r--r--vcl/source/edit/vclmedit.cxx41
1 files changed, 21 insertions, 20 deletions
diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx
index 7244c354fb18..13e91579b93e 100644
--- a/vcl/source/edit/vclmedit.cxx
+++ b/vcl/source/edit/vclmedit.cxx
@@ -512,17 +512,19 @@ OUString ImpVclMEdit::GetTextLines( LineEnd aSeparator ) const
void ImpVclMEdit::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
const TextHint* pTextHint = dynamic_cast<const TextHint*>(&rHint);
- if ( pTextHint )
+ if ( !pTextHint )
+ return;
+
+ switch (pTextHint->GetId())
{
- if( pTextHint->GetId() == TEXT_HINT_VIEWSCROLLED )
- {
+ case TEXT_HINT_VIEWSCROLLED:
if ( mpHScrollBar )
ImpSetHScrollBarThumbPos();
if ( mpVScrollBar )
mpVScrollBar->SetThumbPos( mpTextWindow->GetTextView()->GetStartDocPos().Y() );
- }
- else if( pTextHint->GetId() == TEXT_HINT_TEXTHEIGHTCHANGED )
- {
+ break;
+
+ case TEXT_HINT_TEXTHEIGHTCHANGED:
if ( mpTextWindow->GetTextView()->GetStartDocPos().Y() )
{
long nOutHeight = mpTextWindow->GetOutputSizePixel().Height();
@@ -530,11 +532,10 @@ void ImpVclMEdit::Notify( SfxBroadcaster&, const SfxHint& rHint )
if ( nTextHeight < nOutHeight )
mpTextWindow->GetTextView()->Scroll( 0, mpTextWindow->GetTextView()->GetStartDocPos().Y() );
}
-
ImpSetScrollBarRanges();
- }
- else if( pTextHint->GetId() == TEXT_HINT_TEXTFORMATTED )
- {
+ break;
+
+ case TEXT_HINT_TEXTFORMATTED:
if ( mpHScrollBar )
{
const long nWidth = mpTextWindow->GetTextEngine()->CalcTextWidth();
@@ -545,20 +546,20 @@ void ImpVclMEdit::Notify( SfxBroadcaster&, const SfxHint& rHint )
ImpSetHScrollBarThumbPos();
}
}
- }
- else if( pTextHint->GetId() == TEXT_HINT_MODIFIED )
- {
+ break;
+
+ case TEXT_HINT_MODIFIED:
ImpUpdateSrollBarVis(pVclMultiLineEdit->GetStyle());
pVclMultiLineEdit->Modify();
- }
- else if( pTextHint->GetId() == TEXT_HINT_VIEWSELECTIONCHANGED )
- {
+ break;
+
+ case TEXT_HINT_VIEWSELECTIONCHANGED:
pVclMultiLineEdit->SelectionChanged();
- }
- else if( pTextHint->GetId() == TEXT_HINT_VIEWCARETCHANGED )
- {
+ break;
+
+ case TEXT_HINT_VIEWCARETCHANGED:
pVclMultiLineEdit->CaretChanged();
- }
+ break;
}
}