diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-15 10:18:43 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-15 12:13:42 +0100 |
commit | 5b74eb68113d3721e1a3f9fa40024bf9b2a15f0c (patch) | |
tree | 1c959ccc7769fd8530a16cc904b5424d04faa208 /vcl/source/edit | |
parent | b4aa631867638b993fda98b1c4fcfc47e5c6a1aa (diff) |
loplugin:flatten in vcl
Change-Id: I3527477277a9ae96eaf9fd068232f672da7c28c3
Reviewed-on: https://gerrit.libreoffice.org/44753
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/edit')
-rw-r--r-- | vcl/source/edit/texteng.cxx | 71 |
1 files changed, 36 insertions, 35 deletions
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index d7e90cd555e9..e369e8299f9c 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -171,44 +171,45 @@ void TextEngine::SetActiveView( TextView* pTextView ) void TextEngine::SetFont( const vcl::Font& rFont ) { - if ( rFont != maFont ) - { - maFont = rFont; - // #i40221# As the font's color now defaults to transparent (since i35764) - // we have to choose a useful textcolor in this case. - // Otherwise maTextColor and maFont.GetColor() are both transparent.... - if( rFont.GetColor() == COL_TRANSPARENT ) - maTextColor = COL_BLACK; - else - maTextColor = rFont.GetColor(); - - // Do not allow transparent fonts because of selection - // (otherwise delete the background in ImplPaint later differently) - maFont.SetTransparent( false ); - // Tell VCL not to use the font color, use text color from OutputDevice - maFont.SetColor( COL_TRANSPARENT ); - Color aFillColor( maFont.GetFillColor() ); - aFillColor.SetTransparency( 0 ); - maFont.SetFillColor( aFillColor ); - - maFont.SetAlignment( ALIGN_TOP ); - mpRefDev->SetFont( maFont ); - mnDefTab = mpRefDev->GetTextWidth(" "); - if ( !mnDefTab ) - mnDefTab = mpRefDev->GetTextWidth("XXXX"); - if ( !mnDefTab ) - mnDefTab = 1; - mnCharHeight = mpRefDev->GetTextHeight(); + if ( rFont == maFont ) + return; - FormatFullDoc(); - UpdateViews(); + maFont = rFont; + // #i40221# As the font's color now defaults to transparent (since i35764) + // we have to choose a useful textcolor in this case. + // Otherwise maTextColor and maFont.GetColor() are both transparent.... + if( rFont.GetColor() == COL_TRANSPARENT ) + maTextColor = COL_BLACK; + else + maTextColor = rFont.GetColor(); + + // Do not allow transparent fonts because of selection + // (otherwise delete the background in ImplPaint later differently) + maFont.SetTransparent( false ); + // Tell VCL not to use the font color, use text color from OutputDevice + maFont.SetColor( COL_TRANSPARENT ); + Color aFillColor( maFont.GetFillColor() ); + aFillColor.SetTransparency( 0 ); + maFont.SetFillColor( aFillColor ); - for ( auto nView = mpViews->size(); nView; ) - { - TextView* pView = (*mpViews)[ --nView ]; - pView->GetWindow()->SetInputContext( InputContext( GetFont(), !pView->IsReadOnly() ? InputContextFlags::Text|InputContextFlags::ExtText : InputContextFlags::NONE ) ); - } + maFont.SetAlignment( ALIGN_TOP ); + mpRefDev->SetFont( maFont ); + mnDefTab = mpRefDev->GetTextWidth(" "); + if ( !mnDefTab ) + mnDefTab = mpRefDev->GetTextWidth("XXXX"); + if ( !mnDefTab ) + mnDefTab = 1; + mnCharHeight = mpRefDev->GetTextHeight(); + + FormatFullDoc(); + UpdateViews(); + + for ( auto nView = mpViews->size(); nView; ) + { + TextView* pView = (*mpViews)[ --nView ]; + pView->GetWindow()->SetInputContext( InputContext( GetFont(), !pView->IsReadOnly() ? InputContextFlags::Text|InputContextFlags::ExtText : InputContextFlags::NONE ) ); } + } void TextEngine::SetMaxTextLen( sal_Int32 nLen ) |