summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2017-08-12 23:33:57 +0800
committerMark Hung <marklh9@gmail.com>2017-08-21 16:04:02 +0200
commitcd65bae41c52c4d2f40589776a645e224ee222cd (patch)
treef35476c9ebdec550e8a33db5044d909b6f0ceaf0
parent25b3806ac509006573e669acc33643af3bd77380 (diff)
tdf#111626 switch underline color.
Switch underline font color if it is from the underline color of the portion. If the underline color is auto, take the font color into consideration. Change-Id: I81a0e100cd024add603b574f07e10b5e3a785d0b Reviewed-on: https://gerrit.libreoffice.org/41090 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mark Hung <marklh9@gmail.com>
-rw-r--r--sw/source/core/text/itrpaint.cxx16
1 files changed, 13 insertions, 3 deletions
diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index cd76aa2a0b13..7bd3ce8e549e 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -70,6 +70,12 @@ bool IsUnderlineBreak( const SwLinePortion& rPor, const SwFont& rFnt )
SvxCaseMap::SmallCaps == rFnt.GetCaseMap();
}
+const Color GetUnderColor( const SwFont *pFont )
+{
+ return pFont->GetUnderColor() == Color( COL_AUTO ) ?
+ pFont->GetColor() : pFont->GetUnderColor();
+}
+
void SwTextPainter::CtorInitTextPainter( SwTextFrame *pNewFrame, SwTextPaintInfo *pNewInf )
{
CtorInitTextCursor( pNewFrame, pNewInf );
@@ -486,10 +492,15 @@ void SwTextPainter::CheckSpecialUnderline( const SwLinePortion* pPor,
GetInfo().SetUnderFnt( nullptr );
return;
}
-
// Reuse calculated underline font as much as possible.
- if ( GetInfo().GetUnderFnt() && GetInfo().GetIdx() + pPor->GetLen() <= GetInfo().GetUnderFnt()->GetEnd() + 1)
+ if ( GetInfo().GetUnderFnt() && GetInfo().GetIdx() + pPor->GetLen() <= GetInfo().GetUnderFnt()->GetEnd() + 1 )
+ {
+ SwFont &rFont = GetInfo().GetUnderFnt()->GetFont();
+ const Color aColor = GetUnderColor( GetInfo().GetFont() );
+ if ( GetUnderColor( &rFont ) != aColor )
+ rFont.SetColor( aColor );
return;
+ }
// If current underline matches the common underline font, we continue
// to use the common underline font.
@@ -578,7 +589,6 @@ void SwTextPainter::CheckSpecialUnderline( const SwLinePortion* pPor,
break;
aIter.Seek( nTmpIdx );
-
if ( aIter.GetFnt()->GetEscapement() < 0 || m_pFont->IsWordLineMode() ||
SvxCaseMap::SmallCaps == m_pFont->GetCaseMap() )
break;