[Libreoffice-commits] core.git: sw/source
László Németh (via logerrit)
logerrit at kemper.freedesktop.org
Wed Oct 28 18:13:47 UTC 2020
sw/source/core/text/itrpaint.cxx | 3 ++-
sw/source/core/text/porlay.cxx | 12 +++++++++++-
sw/source/core/text/porlay.hxx | 6 ++++++
sw/source/core/text/porrst.cxx | 6 +++++-
sw/source/core/text/porrst.hxx | 5 ++++-
sw/source/core/text/redlnitr.cxx | 10 +++++++---
sw/source/core/text/redlnitr.hxx | 2 +-
7 files changed, 36 insertions(+), 8 deletions(-)
New commits:
commit 350dbba44ee7703b1da11cc4732a5090ce5efe3d
Author: László Németh <nemeth at numbertext.org>
AuthorDate: Wed Oct 28 12:35:51 2020 +0100
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Wed Oct 28 19:13:05 2020 +0100
tdf#105967 sw change tracking: fix pilcrow symbol
formatting according to the tracked insertion or
deletion of the paragraph break. There was no
formatting at all or only (often bad) inheritance
of the character style (strike out or underline)
of the previous character, confusing the user.
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: I8afef01c515b8abd368cae12d3a02cabf6d897f2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104933
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth at numbertext.org>
diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index 6c3e7a2e4eeb..b00507c907c8 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -427,7 +427,8 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip,
GetInfo().GetOpt().IsParagraph() && !GetTextFrame()->GetFollow() &&
GetInfo().GetIdx() >= TextFrameIndex(GetInfo().GetText().getLength()))
{
- const SwTmpEndPortion aEnd( *pEndTempl );
+ const SwTmpEndPortion aEnd( *pEndTempl, m_pCurr->HasRedlineEnd(),
+ m_pCurr->HasRedlineEndDel() );
GetFnt()->ChgPhysFnt( GetInfo().GetVsh(), *pOut );
if ( bAdjustBaseLine )
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index bb3fb103260f..69a7c39b5dc2 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -605,10 +605,19 @@ void SwLineLayout::CalcLine( SwTextFormatter &rLine, SwTextFormatInfo &rInf )
if( bHasRedline )
{
OUString sRedlineText;
+ bool bHasRedlineEnd, bHasRedlineEndDel;
bHasRedline = rLine.GetRedln()->CheckLine(start.first->GetIndex(), start.second,
- end.first->GetIndex(), end.second, sRedlineText );
+ end.first->GetIndex(), end.second, sRedlineText, bHasRedlineEnd, bHasRedlineEndDel );
if( bHasRedline )
+ {
SetRedlineText( sRedlineText );
+ if( bHasRedlineEnd )
+ {
+ SetRedlineEnd( bHasRedlineEnd );
+ if( bHasRedlineEndDel )
+ SetRedlineEndDel( bHasRedlineEndDel );
+ }
+ }
}
SetRedline( bHasRedline );
}
@@ -670,6 +679,7 @@ void SwLineLayout::ResetFlags()
{
m_bFormatAdj = m_bDummy = m_bEndHyph = m_bMidHyph = m_bFly
= m_bRest = m_bBlinking = m_bClipping = m_bContent = m_bRedline
+ = m_bRedlineEnd = m_bRedlineEndDel
= m_bForcedLeftMargin = m_bHanging = false;
}
diff --git a/sw/source/core/text/porlay.hxx b/sw/source/core/text/porlay.hxx
index 255337d583c1..39e50d28ba94 100644
--- a/sw/source/core/text/porlay.hxx
+++ b/sw/source/core/text/porlay.hxx
@@ -93,6 +93,8 @@ private:
bool m_bClipping : 1; // Clipping needed for exact line height
bool m_bContent : 1; // Text for line numbering
bool m_bRedline : 1; // The Redlining
+ bool m_bRedlineEnd: 1; // Redlining for paragraph mark: tracked change at the end
+ bool m_bRedlineEndDel : 1; // Redlining for paragraph mark: tracked deletion at the end
bool m_bForcedLeftMargin : 1; // Left adjustment moved by the Fly
bool m_bHanging : 1; // Contains a hanging portion in the margin
bool m_bUnderscore : 1;
@@ -130,6 +132,10 @@ public:
bool HasContent() const { return m_bContent; }
void SetRedline( const bool bNew ) { m_bRedline = bNew; }
bool HasRedline() const { return m_bRedline; }
+ void SetRedlineEnd( const bool bNew ) { m_bRedlineEnd = bNew; }
+ bool HasRedlineEnd() const { return m_bRedlineEnd; }
+ void SetRedlineEndDel( const bool bNew ) { m_bRedlineEndDel = bNew; }
+ bool HasRedlineEndDel() const { return m_bRedlineEndDel; }
void SetRedlineText ( const OUString& sText ) { m_sRedlineText = sText; }
const OUString* GetRedlineText() const { return &m_sRedlineText; }
void SetForcedLeftMargin() { m_bForcedLeftMargin = true; }
diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx
index a304958613a7..58cf0cf3f3e3 100644
--- a/sw/source/core/text/porrst.cxx
+++ b/sw/source/core/text/porrst.cxx
@@ -46,7 +46,9 @@
#include <crsrsh.hxx>
-SwTmpEndPortion::SwTmpEndPortion( const SwLinePortion &rPortion )
+SwTmpEndPortion::SwTmpEndPortion( const SwLinePortion &rPortion,
+ const bool bCh, const bool bDel ) :
+ bChanged( bCh ), bDeleted( bDel )
{
Height( rPortion.Height() );
SetAscent( rPortion.GetAscent() );
@@ -62,6 +64,8 @@ void SwTmpEndPortion::Paint( const SwTextPaintInfo &rInf ) const
SwFont aFont(*pOldFnt);
aFont.SetColor(NON_PRINTING_CHARACTER_COLOR);
+ aFont.SetStrikeout( bDeleted ? STRIKEOUT_SINGLE : STRIKEOUT_NONE );
+ aFont.SetUnderline( (bChanged && !bDeleted) ? LINESTYLE_SINGLE : LINESTYLE_NONE );
const_cast<SwTextPaintInfo&>(rInf).SetFont(&aFont);
// draw the pilcrow
diff --git a/sw/source/core/text/porrst.hxx b/sw/source/core/text/porrst.hxx
index 7c716be8dba5..8e05750c8e2d 100644
--- a/sw/source/core/text/porrst.hxx
+++ b/sw/source/core/text/porrst.hxx
@@ -40,8 +40,11 @@ class SwTextFormatInfo;
class SwTmpEndPortion : public SwLinePortion
{
+ bool bChanged;
+ bool bDeleted;
+
public:
- explicit SwTmpEndPortion( const SwLinePortion &rPortion );
+ explicit SwTmpEndPortion( const SwLinePortion &rPortion, const bool bChanged, const bool bDel );
virtual void Paint( const SwTextPaintInfo &rInf ) const override;
};
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index 03b67b9b4784..b05df68a90a8 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -804,7 +804,8 @@ bool SwRedlineItr::ChkSpecialUnderline_() const
bool SwRedlineItr::CheckLine(
sal_uLong const nStartNode, sal_Int32 const nChkStart,
- sal_uLong const nEndNode, sal_Int32 nChkEnd, OUString& rRedlineText)
+ sal_uLong const nEndNode, sal_Int32 nChkEnd, OUString& rRedlineText,
+ bool& bRedlineEnd, bool& bRedlineEndDel)
{
// note: previously this would return true in the (!m_bShow && m_pExt)
// case, but surely that was a bug?
@@ -816,7 +817,7 @@ bool SwRedlineItr::CheckLine(
sal_Int32 nOldStart = m_nStart;
sal_Int32 nOldEnd = m_nEnd;
SwRedlineTable::size_type const nOldAct = m_nAct;
- bool bRet = false;
+ bool bRet = bRedlineEnd = bRedlineEndDel = false;
for (m_nAct = m_nFirst; m_nAct < m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().size(); ++m_nAct)
{
@@ -828,10 +829,13 @@ bool SwRedlineItr::CheckLine(
if (nChkStart <= m_nEnd && (nChkEnd > m_nStart || COMPLETE_STRING == m_nEnd))
{
bRet = true;
+ if ( COMPLETE_STRING == m_nEnd )
+ bRedlineEnd = true;
if ( pRedline->GetType() == RedlineType::Delete )
{
rRedlineText = const_cast<SwRangeRedline*>(pRedline)->GetDescr(/*bSimplified=*/true);
- break;
+ if ( COMPLETE_STRING == m_nEnd )
+ bRedlineEndDel = true;
}
}
}
diff --git a/sw/source/core/text/redlnitr.hxx b/sw/source/core/text/redlnitr.hxx
index 715fa9ed7e33..ab242b245d08 100644
--- a/sw/source/core/text/redlnitr.hxx
+++ b/sw/source/core/text/redlnitr.hxx
@@ -119,7 +119,7 @@ public:
bool ChkSpecialUnderline() const
{ return IsOn() && ChkSpecialUnderline_(); }
bool CheckLine(sal_uLong nStartNode, sal_Int32 nChkStart, sal_uLong nEndNode,
- sal_Int32 nChkEnd, OUString& rRedlineText);
+ sal_Int32 nChkEnd, OUString& rRedlineText, bool& bRedlineEnd, bool& bRedlineEndDel);
bool LeaveExtend(SwFont& rFnt, sal_uLong const nNode, sal_Int32 const nNew)
{ return m_pExt->Leave(rFnt, nNode, nNew); }
bool ExtOn() {
More information about the Libreoffice-commits
mailing list