summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorVitaliy Anderson <vanderson@smartru.com>2016-12-09 02:48:00 -0500
committerjan iversen <jani@documentfoundation.org>2016-12-21 08:07:46 +0000
commit4a410dd147f7160c1d62e3e0b67388a178d5136c (patch)
treede35f47e7cfa1594d4c2714da17132017eb16188 /sw/source
parent517994c640ac83d48b9e5f238bc4d219ebd6abbd (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>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/text/inftxt.cxx73
1 files changed, 71 insertions, 2 deletions
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index d06ccd5c00f5..71b99b13918e 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);