sw/qa/extras/uiwriter/uiwriter2.cxx | 7 +++++++ sw/source/core/inc/flyfrm.hxx | 3 +++ sw/source/core/layout/fly.cxx | 3 ++- sw/source/core/layout/paintfrm.cxx | 4 ++-- sw/source/core/text/porlay.cxx | 11 +++++++---- 5 files changed, 21 insertions(+), 7 deletions(-)
New commits: commit 76dc21860ce185bd5495adde8858d2f23284c78e Author: László Németh <nem...@numbertext.org> AuthorDate: Mon Jun 7 15:07:16 2021 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Tue Jun 8 09:14:06 2021 +0200 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 <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index c87d0bdd19a9..ef40b19641ab 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -2513,6 +2513,13 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf142196) // vertical "changed line" indicator before the paragraph line) assertXPath(pXmlDoc, "//line", 3); + // check line color + assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/linecolor", 1); + // tdf#142128 This was NON_PRINTING_CHARACTER_COLOR (#268bd2) + assertXPath( + pXmlDoc, + "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/linecolor[@color='#268bd2']", 0); + // reject deletion of the image IDocumentRedlineAccess& rIDRA(pDoc->getIDocumentRedlineAccess()); rIDRA.AcceptAllRedline(false); 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); } - } } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits