diff options
author | Vitaliy Anderson <vanderson@smartru.com> | 2016-12-09 02:48:00 -0500 |
---|---|---|
committer | Aron Budea <aron.budea@collabora.com> | 2018-03-14 21:23:54 +0100 |
commit | 7bb59a114e7d1419e247b8367ab48265c1b8bc16 (patch) | |
tree | fa95437650ca131203a4c1215e6353e646bf68ce /sw | |
parent | bd2d9e29701757bd8306a2a1e00ee57da9262e21 (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)
(cherry picked from commit ec87fa387fec1f37f483b8e6bc65cbb210d83a49)
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); |