diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-04 09:22:10 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-04 11:21:22 +0200 |
commit | f45ff1a7147e6a9479c669f082dd74349c6bcb4b (patch) | |
tree | 9ec5eee03fe7bbc5e026318efd6dcca3502d4696 /vcl/source/edit/texteng.cxx | |
parent | 58937aa4a50ecd681382f03331340da4c843b01e (diff) |
loplugin:flatten in vcl
Change-Id: I271cc67ecf34acbf0edbda960e33315fb6a1f9dc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100041
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/edit/texteng.cxx')
-rw-r--r-- | vcl/source/edit/texteng.cxx | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index e5465c52c402..e1cd87a682b6 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -1376,35 +1376,35 @@ void TextEngine::SeekCursor( sal_uInt32 nPara, sal_Int32 nPos, vcl::Font& rFont, } } - if ( mpIMEInfos && mpIMEInfos->pAttribs && ( mpIMEInfos->aPos.GetPara() == nPara ) && - ( nPos > mpIMEInfos->aPos.GetIndex() ) && ( nPos <= ( mpIMEInfos->aPos.GetIndex() + mpIMEInfos->nLen ) ) ) - { - ExtTextInputAttr nAttr = mpIMEInfos->pAttribs[ nPos - mpIMEInfos->aPos.GetIndex() - 1 ]; - if ( nAttr & ExtTextInputAttr::Underline ) - rFont.SetUnderline( LINESTYLE_SINGLE ); - else if ( nAttr & ExtTextInputAttr::BoldUnderline ) - rFont.SetUnderline( LINESTYLE_BOLD ); - else if ( nAttr & ExtTextInputAttr::DottedUnderline ) - rFont.SetUnderline( LINESTYLE_DOTTED ); - else if ( nAttr & ExtTextInputAttr::DashDotUnderline ) - rFont.SetUnderline( LINESTYLE_DOTTED ); - if ( nAttr & ExtTextInputAttr::RedText ) - rFont.SetColor( COL_RED ); - else if ( nAttr & ExtTextInputAttr::HalfToneText ) - rFont.SetColor( COL_LIGHTGRAY ); - if ( nAttr & ExtTextInputAttr::Highlight ) - { - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - rFont.SetColor( rStyleSettings.GetHighlightTextColor() ); - rFont.SetFillColor( rStyleSettings.GetHighlightColor() ); - rFont.SetTransparent( false ); - } - else if ( nAttr & ExtTextInputAttr::GrayWaveline ) - { - rFont.SetUnderline( LINESTYLE_WAVE ); + if ( !(mpIMEInfos && mpIMEInfos->pAttribs && ( mpIMEInfos->aPos.GetPara() == nPara ) && + ( nPos > mpIMEInfos->aPos.GetIndex() ) && ( nPos <= ( mpIMEInfos->aPos.GetIndex() + mpIMEInfos->nLen ) )) ) + return; + + ExtTextInputAttr nAttr = mpIMEInfos->pAttribs[ nPos - mpIMEInfos->aPos.GetIndex() - 1 ]; + if ( nAttr & ExtTextInputAttr::Underline ) + rFont.SetUnderline( LINESTYLE_SINGLE ); + else if ( nAttr & ExtTextInputAttr::BoldUnderline ) + rFont.SetUnderline( LINESTYLE_BOLD ); + else if ( nAttr & ExtTextInputAttr::DottedUnderline ) + rFont.SetUnderline( LINESTYLE_DOTTED ); + else if ( nAttr & ExtTextInputAttr::DashDotUnderline ) + rFont.SetUnderline( LINESTYLE_DOTTED ); + if ( nAttr & ExtTextInputAttr::RedText ) + rFont.SetColor( COL_RED ); + else if ( nAttr & ExtTextInputAttr::HalfToneText ) + rFont.SetColor( COL_LIGHTGRAY ); + if ( nAttr & ExtTextInputAttr::Highlight ) + { + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + rFont.SetColor( rStyleSettings.GetHighlightTextColor() ); + rFont.SetFillColor( rStyleSettings.GetHighlightColor() ); + rFont.SetTransparent( false ); + } + else if ( nAttr & ExtTextInputAttr::GrayWaveline ) + { + rFont.SetUnderline( LINESTYLE_WAVE ); // if( pOut ) // pOut->SetTextLineColor( COL_LIGHTGRAY ); - } } } @@ -2462,20 +2462,20 @@ void TextEngine::Write( SvStream& rOutput ) void TextEngine::RemoveAttribs( sal_uInt32 nPara ) { - if ( nPara < mpDoc->GetNodes().size() ) + if ( nPara >= mpDoc->GetNodes().size() ) + return; + + TextNode* pNode = mpDoc->GetNodes()[ nPara ].get(); + if ( pNode->GetCharAttribs().Count() ) { - TextNode* pNode = mpDoc->GetNodes()[ nPara ].get(); - if ( pNode->GetCharAttribs().Count() ) - { - pNode->GetCharAttribs().Clear(); + pNode->GetCharAttribs().Clear(); - TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara ); - pTEParaPortion->MarkSelectionInvalid( 0 ); + TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara ); + pTEParaPortion->MarkSelectionInvalid( 0 ); - mbFormatted = false; + mbFormatted = false; - IdleFormatAndUpdate( nullptr, 0xFFFF ); - } + IdleFormatAndUpdate( nullptr, 0xFFFF ); } } @@ -2487,23 +2487,23 @@ void TextEngine::SetAttrib( const TextAttrib& rAttr, sal_uInt32 nPara, sal_Int32 // As TextEngine is currently intended only for TextEditors, there is no Undo for Attributes! - if ( nPara < mpDoc->GetNodes().size() ) - { - TextNode* pNode = mpDoc->GetNodes()[ nPara ].get(); - TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara ); + if ( nPara >= mpDoc->GetNodes().size() ) + return; + + TextNode* pNode = mpDoc->GetNodes()[ nPara ].get(); + TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara ); - const sal_Int32 nMax = pNode->GetText().getLength(); - if ( nStart > nMax ) - nStart = nMax; - if ( nEnd > nMax ) - nEnd = nMax; + const sal_Int32 nMax = pNode->GetText().getLength(); + if ( nStart > nMax ) + nStart = nMax; + if ( nEnd > nMax ) + nEnd = nMax; - pNode->GetCharAttribs().InsertAttrib( std::make_unique<TextCharAttrib>( rAttr, nStart, nEnd ) ); - pTEParaPortion->MarkSelectionInvalid( nStart ); + pNode->GetCharAttribs().InsertAttrib( std::make_unique<TextCharAttrib>( rAttr, nStart, nEnd ) ); + pTEParaPortion->MarkSelectionInvalid( nStart ); - mbFormatted = false; - IdleFormatAndUpdate( nullptr, 0xFFFF ); - } + mbFormatted = false; + IdleFormatAndUpdate( nullptr, 0xFFFF ); } void TextEngine::SetTextAlign( TxtAlign eAlign ) |