summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2020-10-30 14:20:07 +0100
committerLászló Németh <nemeth@numbertext.org>2020-10-30 18:52:22 +0100
commit58f64686cd83a349611daa52188db8bca347b3d4 (patch)
treecf1f20e456d1926452c194c36da0bf0122f60f87
parenttdf#137625 sc: autofill user list sequences in merged cells (diff)
downloadcore-58f64686cd83a349611daa52188db8bca347b3d4.tar.gz
core-58f64686cd83a349611daa52188db8bca347b3d4.zip
tdf#105967 sw change tracking: fix line break symbol
Paint strikeout/underline based on redline color and settings at the inserted or deleted line breaks. Follow-up of commit 350dbba44ee7703b1da11cc4732a5090ce5efe3d (tdf#105967 sw change tracking: fix pilcrow symbol). Change-Id: I64e267aef5a8bb1818f7e9d1a2fe5febb0df43a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105068 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
-rw-r--r--sw/source/core/text/itrpaint.cxx2
-rw-r--r--sw/source/core/text/porrst.cxx19
-rw-r--r--sw/source/core/text/porrst.hxx3
3 files changed, 24 insertions, 0 deletions
diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index 153131a2a3e9..ea0b965914e9 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -329,6 +329,8 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip,
SeekAndChg( GetInfo() );
else
SeekAndChgBefore( GetInfo() );
+ // paint redlining
+ static_cast<SwBreakPortion&>(*pPor).PaintRedline( GetInfo() );
}
else
bSeeked = false;
diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx
index f04960725c54..a82ee74c1a94 100644
--- a/sw/source/core/text/porrst.cxx
+++ b/sw/source/core/text/porrst.cxx
@@ -118,6 +118,25 @@ void SwBreakPortion::Paint( const SwTextPaintInfo &rInf ) const
rInf.DrawLineBreak( *this );
}
+void SwBreakPortion::PaintRedline( const SwTextPaintInfo &rInf ) const
+{
+ if( rInf.OnWin() && rInf.GetOpt().IsLineBreak() )
+ {
+ sal_Int16 nNoBreakWidth = rInf.GetTextSize(S_NOBREAK_FOR_REDLINE).Width();
+ if ( nNoBreakWidth > 0 )
+ {
+ // approximate portion size with multiple no-break spaces
+ // and draw these spaces (at least a single one) by DrawText
+ // painting the requested redline underline/strikeout
+ sal_Int16 nSpaces = (LINE_BREAK_WIDTH + nNoBreakWidth/2) / nNoBreakWidth;
+ OUStringBuffer aBuf(S_NOBREAK_FOR_REDLINE);
+ for (sal_Int16 i = 1; i < nSpaces; ++i)
+ aBuf.append(S_NOBREAK_FOR_REDLINE);
+ rInf.DrawText(aBuf.makeStringAndClear(), *this);
+ }
+ }
+}
+
bool SwBreakPortion::Format( SwTextFormatInfo &rInf )
{
const SwLinePortion *pRoot = rInf.GetRoot();
diff --git a/sw/source/core/text/porrst.hxx b/sw/source/core/text/porrst.hxx
index a0d47683a5f7..32a94ca32e17 100644
--- a/sw/source/core/text/porrst.hxx
+++ b/sw/source/core/text/porrst.hxx
@@ -66,6 +66,9 @@ public:
// Accessibility: pass information about this portion to the PortionHandler
virtual void HandlePortion( SwPortionHandler& rPH ) const override;
+
+ static constexpr OUStringLiteral S_NOBREAK_FOR_REDLINE = u"\u00A0";
+ void PaintRedline( const SwTextPaintInfo &rInf ) const;
};
class SwKernPortion : public SwLinePortion