summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2021-06-07 15:07:16 +0200
committerLászló Németh <nemeth@numbertext.org>2021-06-08 09:14:06 +0200
commit76dc21860ce185bd5495adde8858d2f23284c78e (patch)
tree8dda0f66f1f094e8a9f1e698a188a837f27fb08b /sw/source/core
parent46cc1c79485f81f2e657c226de44d68cec752e6f (diff)
tdf#142128 sw: set author-color strikethrough for deleted images
anchored to character during change tracking instead of using always the same NON_PRINTING_CHARACTER_COLOR blue one. Follow-up to commit 1610eeef6f2312616fe5d3535475f27f7896bef8 "tdf#142196 sw: crossing out images anchored to character". Change-Id: I267a492dc6bb75327fb96ccdb51b784d00ba7a41 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116785 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/inc/flyfrm.hxx3
-rw-r--r--sw/source/core/layout/fly.cxx3
-rw-r--r--sw/source/core/layout/paintfrm.cxx4
-rw-r--r--sw/source/core/text/porlay.cxx11
4 files changed, 14 insertions, 7 deletions
diff --git a/sw/source/core/inc/flyfrm.hxx b/sw/source/core/inc/flyfrm.hxx
index 399bbbe913fe..47017e71e50e 100644
--- a/sw/source/core/inc/flyfrm.hxx
+++ b/sw/source/core/inc/flyfrm.hxx
@@ -131,6 +131,7 @@ protected:
bool m_bLayout :1; ///< RndStdIds::FLY_AT_PAGE, RndStdIds::FLY_AT_FLY, at page or at frame
bool m_bAutoPosition :1; ///< RndStdIds::FLY_AT_CHAR, anchored at character
bool m_bDeleted :1; ///< Anchored to a tracked deletion
+ size_t m_nAuthor; ///< Redline author index for colored crossing out
friend class SwNoTextFrame; // is allowed to call NotifyBackground
@@ -217,6 +218,8 @@ public:
bool IsFlyAtContentFrame() const { return m_bAtCnt; }
bool IsDeleted() const { return m_bDeleted; }
void SetDeleted(bool bDeleted) { m_bDeleted = bDeleted; }
+ void SetAuthor( size_t nAuthor ) { m_nAuthor = nAuthor; }
+ size_t GetAuthor() const { return m_nAuthor; }
bool IsNotifyBack() const { return m_bNotifyBack; }
void SetNotifyBack() { m_bNotifyBack = true; }
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index bf01c3b1dc7a..8181bd623d39 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -87,7 +87,8 @@ SwFlyFrame::SwFlyFrame( SwFlyFrameFormat *pFormat, SwFrame* pSib, SwFrame *pAnch
m_bAtCnt( false ),
m_bLayout( false ),
m_bAutoPosition( false ),
- m_bDeleted (false ),
+ m_bDeleted( false ),
+ m_nAuthor( std::string::npos ),
m_bValidContentPos( false )
{
mnFrameType = SwFrameType::Fly;
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 4a9eb647bbd6..f5cb3c50ad1c 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -4222,11 +4222,11 @@ void SwFlyFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect const&
PaintDecorators();
// crossing out for tracked deletion
- if ( IsDeleted() )
+ if ( GetAuthor() != std::string::npos && IsDeleted() )
{
tools::Long startX = aRect.Left( ), endX = aRect.Right();
tools::Long startY = aRect.Top( ), endY = aRect.Bottom();
- rRenderContext.SetLineColor(NON_PRINTING_CHARACTER_COLOR);
+ rRenderContext.SetLineColor( SwPostItMgr::GetColorAnchor(GetAuthor()) );
rRenderContext.DrawLine(Point(startX, startY), Point(endX, endY));
rRenderContext.DrawLine(Point(startX, endY), Point(endX, startY));
}
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 9a162b6993d7..f0a3a4e00eee 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -670,20 +670,23 @@ void SwLineLayout::CalcLine( SwTextFormatter &rLine, SwTextFormatInfo &rInf )
if ( auto pFly = dynamic_cast<SwFlyFrame *>( pAnchoredObj ) )
{
bool bDeleted = false;
+ size_t nAuthor = std::string::npos;
const SwFormatAnchor& rAnchor = pAnchoredObj->GetFrameFormat().GetAnchor();
if ( rAnchor.GetAnchorId() == RndStdIds::FLY_AT_CHAR )
{
SwPosition aAnchor = *rAnchor.GetContentAnchor();
- const SwPaM aPam(aAnchor, aAnchor);
- if ( rIDRA.HasRedline( aPam, RedlineType::Delete,
- /*bStartOrEndInRange=*/false) )
+ SwRedlineTable::size_type n = 0;
+ const SwRangeRedline* pFnd =
+ rIDRA.GetRedlineTable().FindAtPosition( aAnchor, n );
+ if ( pFnd && RedlineType::Delete == pFnd->GetType() )
{
bDeleted = true;
+ nAuthor = pFnd->GetAuthor();
}
}
pFly->SetDeleted(bDeleted);
+ pFly->SetAuthor(nAuthor);
}
-
}
}
}