sw/qa/extras/uiwriter/uiwriter3.cxx | 8 ++++++++ sw/source/core/frmedt/tblsel.cxx | 11 ++++++++++- sw/source/core/undo/untbl.cxx | 11 +++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-)
New commits: commit e07ea7a6f5f7059663e99daa97cbda5e63b141dd Author: László Németh <nem...@numbertext.org> AuthorDate: Fri Mar 25 15:27:21 2022 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon Mar 28 20:52:58 2022 +0200 tdf#148227 sw: fix Undo of tracked row deletion in Hide Changes mode In Hide Changes mode, table rows didn't reappear during Undo of tracked deletion of table rows, only by saving and reloading the document. Follow-up to commit a74c51025fa4519caaf461492e4ed8e68bd34885 "tdf#146962 sw: hide deleted row at deletion in Hide Changes" and commit 794fd10af7361d5a64a0f8bfbe5c8b5f308617a5 "tdf#147347 sw: hide deleted table at deletion in Hide Changes". Change-Id: I7ffe8a3687d1d385a549f7d438f7058d829ffd8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132123 Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> (cherry picked from commit 0c6221e1545e7b96d9df23cdc24302c28ae935b8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132049 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index b8cb857043b2..57f5e6649b70 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -1987,6 +1987,14 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf146962) pXmlDoc = parseLayoutDump(); // only a single row is visible again assertXPath(pXmlDoc, "/root/page[1]/body/tab/row", 1); + + // check Undo + + dispatchCommand(mxComponent, ".uno:Undo", {}); + discardDumpedLayout(); + pXmlDoc = parseLayoutDump(); + // This was 1 + assertXPath(pXmlDoc, "/root/page[1]/body/tab/row", 2); } CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf147347) diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index 80b797384859..b203281506cd 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -2336,6 +2336,10 @@ void FndBox_::MakeFrames( SwTable &rTable ) // And this for all instances of a table (for example in header/footer). sal_uInt16 nStPos = 0; sal_uInt16 nEndPos= rTable.GetTabLines().size() - 1; + SwRootFrame* pLayout = + rTable.GetFrameFormat()->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(); + bool bHideChanges = pLayout && pLayout->IsHideRedlines(); + if ( m_pLineBefore ) { nStPos = rTable.GetTabLines().GetPos( @@ -2389,9 +2393,14 @@ void FndBox_::MakeFrames( SwTable &rTable ) // ???? or is this the last Follow of the table ???? pUpperFrame = pTable; + SwRedlineTable::size_type nRedlinePos = 0; for ( sal_uInt16 j = nStPos; j <= nEndPos; ++j ) - ::lcl_InsertRow( *rTable.GetTabLines()[j], + { + SwTableLine * pLine = rTable.GetTabLines()[j]; + if ( !bHideChanges || !pLine->IsDeleted(nRedlinePos) ) + ::lcl_InsertRow( *pLine, static_cast<SwLayoutFrame*>(pUpperFrame), pSibling ); + } if ( pUpperFrame->IsTabFrame() ) static_cast<SwTabFrame*>(pUpperFrame)->SetCalcLowers(); } diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index d3294b5446a3..d5536b01e624 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -34,6 +34,8 @@ #include <IDocumentRedlineAccess.hxx> #include <IDocumentFieldsAccess.hxx> #include <IDocumentStylePoolAccess.hxx> +#include <IDocumentLayoutAccess.hxx> +#include <rootfrm.hxx> #include <editsh.hxx> #include <docary.hxx> #include <ndtxt.hxx> @@ -936,6 +938,12 @@ void SaveTable::RestoreAttr( SwTable& rTable, bool bMdfyBox ) { m_bModifyBox = bMdfyBox; + FndBox_ aTmpBox( nullptr, nullptr ); + bool bHideChanges = rTable.GetFrameFormat()->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout()->IsHideRedlines(); + // TODO delete/make frames only at changing line attribute TextChangesOnly (RES_PRINT) to true again + if ( bHideChanges ) + aTmpBox.DelFrames( rTable ); + // first, get back attributes of TableFrameFormat SwFrameFormat* pFormat = rTable.GetFrameFormat(); SfxItemSet& rFormatSet = const_cast<SfxItemSet&>(static_cast<SfxItemSet const &>(pFormat->GetAttrSet())); @@ -976,6 +984,9 @@ void SaveTable::RestoreAttr( SwTable& rTable, bool bMdfyBox ) m_aFrameFormats.clear(); m_bModifyBox = false; + + if ( bHideChanges ) + aTmpBox.MakeFrames( rTable ); } void SaveTable::SaveContentAttrs( SwDoc* pDoc )