diff options
author | Vitaliy Anderson <vanderson@smartru.com> | 2016-12-09 02:48:00 -0500 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2018-05-22 12:03:52 +0200 |
commit | 8c48027e0c6fbd8235a7d21b8b1c5fe4e42a0ad7 (patch) | |
tree | 5b026b56a2135b6673e185fab52df4edfc43ac53 /sw | |
parent | d0049f965c6583832df6f4f1d72f92809abbe929 (diff) |
tdf#104349 remove the difference between MSO and LO highlight chars
Change-Id: I5daadef359260ea74b828567197228633bb972ca
Reviewed-on: https://gerrit.libreoffice.org/31783
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: jan iversen <jani@documentfoundation.org>
Tested-by: jan iversen <jani@documentfoundation.org>
(cherry picked from commit 4a410dd147f7160c1d62e3e0b67388a178d5136c)
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/text/inftxt.cxx | 73 |
1 files changed, 71 insertions, 2 deletions
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index 0f467d28e713..2c577010768e 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -690,8 +690,8 @@ void SwTextPaintInfo::DrawText_( const OUString &rText, const SwLinePortion &rPo } if( aFontPos.X() < 0 ) aFontPos.X() = 0; - if( aFontPos.X() < 0 ) - aFontPos.X() = 0; + if( aFontPos.Y() < 0 ) + aFontPos.Y() = 0; } if( GetTextFly().IsOn() ) @@ -1184,6 +1184,75 @@ void SwTextPaintInfo::DrawBackBrush( const SwLinePortion &rPor ) const aFillColor = *m_pFnt->GetBackColor(); } + // tdf#104349 do not hightlight portions of space chars before end of line + bool draw = false; + bool full = false; + SwLinePortion *pPos = const_cast<SwLinePortion *>(&rPor); + sal_Int32 nIdx = GetIdx(); + sal_Int32 nLen; + + do + { + nLen = pPos->GetLen(); + for ( int i = nIdx; i < (nIdx + nLen); ++i ) + { + if ( GetText()[i] == CH_TXTATR_NEWLINE ) + { + if ( i >= (GetIdx() + rPor.GetLen()) ) + { + goto drawcontinue; + } + } + if ( GetText()[i] != CH_BLANK ) + { + draw = true; + if ( i >= (GetIdx() + rPor.GetLen()) ) + { + full = true; + goto drawcontinue; + } + } + } + nIdx += nLen; + pPos = pPos->GetPortion(); + } while ( pPos ); + + drawcontinue: + + if ( !draw ) + return; + + if ( !full ) + { + pPos = const_cast<SwLinePortion *>(&rPor); + nIdx = GetIdx(); + + nLen = pPos->GetLen(); + for ( int i = (nIdx + nLen - 1); i >= nIdx; --i ) + { + if ( GetText()[i] == CH_TXTATR_NEWLINE ) + { + continue; + } + if ( GetText()[i] != CH_BLANK ) + { + sal_uInt16 nOldWidth = rPor.Width(); + sal_uInt16 nNewWidth = GetTextSize( m_pOut, nullptr, GetText(), nIdx, (i + 1 - nIdx) ).Width(); + + const_cast<SwLinePortion&>(rPor).Width( nNewWidth ); + CalcRect( rPor, nullptr, &aIntersect, true ); + const_cast<SwLinePortion&>(rPor).Width( nOldWidth ); + + if ( ! aIntersect.HasArea() ) + { + return; + } + + break; + } + } + } + pTmpOut->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR ); pTmpOut->SetFillColor(aFillColor); |