diff options
author | László Németh <nemeth@numbertext.org> | 2020-10-29 13:37:21 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-10-29 23:19:09 +0100 |
commit | 37d85df2d2fd53ee436f24484b48aafc91d501b1 (patch) | |
tree | aa525b11cd0313ab11b1f799a0b92b5b230c4fad /sw/source/core/text/porrst.cxx | |
parent | 55e0a9f5506ca95238b3b70cb9beb33d089577f4 (diff) |
tdf#105967 sw change tracking: fix pilcrow color
Paint strikeout/underline based on redline color
and settings at the inserted or deleted paragraph
break.
Follow-up of commit 350dbba44ee7703b1da11cc4732a5090ce5efe3d
(tdf#105967 sw change tracking: fix pilcrow symbol).
Note: because the pilcrow symbol is painted by
the temporary text portion SwTmpEndPortion, see
sw/qa/extras/layout/data/tdf42748.fodt for testing.
Change-Id: I4c9c6bb7ce445aa30224fabe7162a19df0df08b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105007
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/source/core/text/porrst.cxx')
-rw-r--r-- | sw/source/core/text/porrst.cxx | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index 58cf0cf3f3e3..f04960725c54 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -47,8 +47,10 @@ #include <crsrsh.hxx> SwTmpEndPortion::SwTmpEndPortion( const SwLinePortion &rPortion, - const bool bCh, const bool bDel ) : - bChanged( bCh ), bDeleted( bDel ) + const FontLineStyle eUL, + const FontStrikeout eStrkout, + const Color& rCol ) : + eUnderline( eUL ), eStrikeout( eStrkout ), aColor( rCol ) { Height( rPortion.Height() ); SetAscent( rPortion.GetAscent() ); @@ -63,9 +65,27 @@ void SwTmpEndPortion::Paint( const SwTextPaintInfo &rInf ) const const SwFont* pOldFnt = rInf.GetFont(); SwFont aFont(*pOldFnt); - aFont.SetColor(NON_PRINTING_CHARACTER_COLOR); - aFont.SetStrikeout( bDeleted ? STRIKEOUT_SINGLE : STRIKEOUT_NONE ); - aFont.SetUnderline( (bChanged && !bDeleted) ? LINESTYLE_SINGLE : LINESTYLE_NONE ); + + // Paint strikeout/underline based on redline color and settings + // (with an extra pilcrow in the background, because there is + // no SetStrikeoutColor(), also SetUnderColor() doesn't work()). + if ( eUnderline != LINESTYLE_NONE || eStrikeout != STRIKEOUT_NONE ) + { + aFont.SetColor( aColor ); + // don't show underline with strikeout + aFont.SetUnderline( eStrikeout == STRIKEOUT_NONE ? eUnderline : LINESTYLE_NONE ); + aFont.SetStrikeout( eStrikeout ); + + const_cast<SwTextPaintInfo&>(rInf).SetFont(&aFont); + + // draw the pilcrow with strikeout/underline in redline color + rInf.DrawText(CH_PAR, *this); + + } + + aFont.SetColor( NON_PRINTING_CHARACTER_COLOR ); + aFont.SetStrikeout( STRIKEOUT_NONE ); + aFont.SetUnderline( LINESTYLE_NONE ); const_cast<SwTextPaintInfo&>(rInf).SetFont(&aFont); // draw the pilcrow |