summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2021-06-07 17:56:42 +0200
committerLászló Németh <nemeth@numbertext.org>2021-06-08 11:10:16 +0200
commit16eda7db38e978a178b161cff7715ee4a32f1493 (patch)
tree4bb4ee52e751426c14229d3ada9cbd6baec98d2e /sw/source/core
parent489102d28e9c67773d72eedfc4e663f51fe331ea (diff)
tdf#142128 sw: set author-color strikethrough for AS_CHAR images
(anchored as character) during change tracking instead of using always the same NON_PRINTING_CHARACTER_COLOR blue one. Follow-up to commit 76dc21860ce185bd5495adde8858d2f23284c78e "tdf#142128 sw: set author-color strikethrough for deleted images". Change-Id: I3fa02f6ec6cd1f71ae3b3c06644dd24f6c684f6f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116795 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/source/core')
-rw-r--r--sw/source/core/text/porfly.cxx7
-rw-r--r--sw/source/core/text/porfly.hxx3
-rw-r--r--sw/source/core/text/porlay.cxx4
-rw-r--r--sw/source/core/text/redlnitr.cxx6
-rw-r--r--sw/source/core/text/redlnitr.hxx2
5 files changed, 16 insertions, 6 deletions
diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx
index 71a7021aa6ff..b999e3d7c354 100644
--- a/sw/source/core/text/porfly.cxx
+++ b/sw/source/core/text/porfly.cxx
@@ -39,6 +39,7 @@
#include <sortedobjs.hxx>
#include <officecfg/Office/Common.hxx>
+#include <PostItMgr.hxx>
/**
* class SwFlyPortion => we expect a frame-locale SwRect!
@@ -226,7 +227,7 @@ void sw::FlyContentPortion::Paint(const SwTextPaintInfo& rInf) const
// track changes: cross out the image, if it is deleted
const SwFrame *pFrame = m_pFly->Lower();
- if ( IsDeleted() && pFrame )
+ if ( GetAuthor() != std::string::npos && IsDeleted() && pFrame )
{
SwRect aPaintRect( pFrame->GetPaintArea() );
@@ -236,7 +237,8 @@ void sw::FlyContentPortion::Paint(const SwTextPaintInfo& rInf) const
const_cast<vcl::RenderContext&>(*rInf.GetOut()).SetAntialiasing(AntialiasingFlags::Enable);
tools::Long startX = aPaintRect.Left( ), endX = aPaintRect.Right();
tools::Long startY = aPaintRect.Top( ), endY = aPaintRect.Bottom();
- const_cast<vcl::RenderContext&>(*rInf.GetOut()).SetLineColor(NON_PRINTING_CHARACTER_COLOR);
+ const_cast<vcl::RenderContext&>(*rInf.GetOut()).SetLineColor(
+ SwPostItMgr::GetColorAnchor(GetAuthor()) );
const_cast<vcl::RenderContext&>(*rInf.GetOut()).DrawLine(Point(startX, startY), Point(endX, endY));
const_cast<vcl::RenderContext&>(*rInf.GetOut()).DrawLine(Point(startX, endY), Point(endX, startY));
if ( bIsAntiAliasing )
@@ -270,6 +272,7 @@ void sw::DrawFlyCntPortion::Paint(const SwTextPaintInfo&) const
SwFlyCntPortion::SwFlyCntPortion()
: m_bMax(false)
, m_bDeleted(false)
+ , m_nAuthor(std::string::npos)
, m_eAlign(sw::LineAlign::NONE)
{
mnLineLength = TextFrameIndex(1);
diff --git a/sw/source/core/text/porfly.hxx b/sw/source/core/text/porfly.hxx
index fdd974050513..a519c1109c87 100644
--- a/sw/source/core/text/porfly.hxx
+++ b/sw/source/core/text/porfly.hxx
@@ -46,6 +46,7 @@ class SwFlyCntPortion : public SwLinePortion
Point m_aRef; // Relatively to this point we calculate the AbsPos
bool m_bMax; // Line adjustment and height == line height
bool m_bDeleted; // Part of tracked deletion: it needs strikethrough
+ size_t m_nAuthor; // Redline author for color of the strikethrough
sw::LineAlign m_eAlign;
virtual SdrObject* GetSdrObj(const SwTextFrame&) =0;
@@ -55,6 +56,8 @@ public:
const Point& GetRefPoint() const { return m_aRef; }
bool IsMax() const { return m_bMax; }
bool IsDeleted() const { return m_bDeleted; }
+ void SetAuthor(size_t nAuthor) { m_nAuthor = nAuthor; }
+ size_t GetAuthor() const { return m_nAuthor; }
sw::LineAlign GetAlign() const { return m_eAlign; }
void SetAlign(sw::LineAlign eAlign) { m_eAlign = eAlign; }
void SetMax(bool bMax) { m_bMax = bMax; }
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index f0a3a4e00eee..95809edf540d 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -642,6 +642,7 @@ void SwLineLayout::CalcLine( SwTextFormatter &rLine, SwTextFormatInfo &rInf )
if( pPos->IsFlyCntPortion() )
{
bool bDeleted = false;
+ size_t nAuthor = std::string::npos;
if ( bHasRedline )
{
OUString sRedlineText;
@@ -651,10 +652,11 @@ void SwLineLayout::CalcLine( SwTextFormatter &rLine, SwTextFormatInfo &rInf )
rInf.GetTextFrame()->MapViewToModel(nPorSttIdx));
bool bHasFlyRedline = rLine.GetRedln()->CheckLine(flyStart.first->GetIndex(),
flyStart.second, flyStart.first->GetIndex(), flyStart.second, sRedlineText,
- bHasRedlineEnd, eRedlineEnd, /*bFullLine=*/false);
+ bHasRedlineEnd, eRedlineEnd, /*pAuthorAtPos=*/&nAuthor);
bDeleted = bHasFlyRedline && eRedlineEnd == RedlineType::Delete;
}
static_cast<SwFlyCntPortion*>(pPos)->SetDeleted(bDeleted);
+ static_cast<SwFlyCntPortion*>(pPos)->SetAuthor(nAuthor);
}
// anchored to characters
else if ( pPos->IsFlyPortion() )
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index faeb0fbbaa8d..d4ced03f1c8c 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -941,13 +941,13 @@ bool SwRedlineItr::ChkSpecialUnderline_() const
bool SwRedlineItr::CheckLine(
sal_uLong const nStartNode, sal_Int32 const nChkStart,
sal_uLong const nEndNode, sal_Int32 nChkEnd, OUString& rRedlineText,
- bool& bRedlineEnd, RedlineType& eRedlineEnd, bool bFullLine)
+ bool& bRedlineEnd, RedlineType& eRedlineEnd, size_t* pAuthorAtPos)
{
// note: previously this would return true in the (!m_bShow && m_pExt)
// case, but surely that was a bug?
if (m_nFirst == SwRedlineTable::npos || m_eMode != Mode::Show)
return false;
- if( nChkEnd == nChkStart && bFullLine ) // empty lines look one char further
+ if( nChkEnd == nChkStart && pAuthorAtPos == nullptr ) // empty lines look one char further
++nChkEnd;
sal_Int32 nOldStart = m_nStart;
sal_Int32 nOldEnd = m_nEnd;
@@ -978,6 +978,8 @@ bool SwRedlineItr::CheckLine(
eRedlineEnd = pRedline->GetType();
bRedlineEnd = true;
isBreak = true;
+ if (pAuthorAtPos)
+ *pAuthorAtPos = pRedline->GetAuthor();
[[fallthrough]];
case SwComparePosition::OverlapBefore:
case SwComparePosition::CollideEnd:
diff --git a/sw/source/core/text/redlnitr.hxx b/sw/source/core/text/redlnitr.hxx
index 0d0e013ff6d5..087df8bbbba8 100644
--- a/sw/source/core/text/redlnitr.hxx
+++ b/sw/source/core/text/redlnitr.hxx
@@ -119,7 +119,7 @@ public:
{ return IsOn() && ChkSpecialUnderline_(); }
bool CheckLine(sal_uLong nStartNode, sal_Int32 nChkStart, sal_uLong nEndNode,
sal_Int32 nChkEnd, OUString& rRedlineText, bool& bRedlineEnd,
- RedlineType& eRedlineEnd, bool bFullLine = true);
+ RedlineType& eRedlineEnd, size_t* pAuthorAtPos = nullptr);
bool LeaveExtend(SwFont& rFnt, sal_uLong const nNode, sal_Int32 const nNew)
{ return m_pExt->Leave(rFnt, nNode, nNew); }
bool ExtOn() {