sw/qa/extras/uiwriter/uiwriter3.cxx | 9 +++++++++ sw/source/core/layout/frmtool.cxx | 30 ++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+)
New commits: commit 55576842ec72a748d0bad123d41fa03c89fc136d Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Tue May 26 16:43:27 2020 +0200 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Wed May 27 19:17:45 2020 +0200 tdf#131684 tdf#132236 sw_redlinehide: fix upper of frame moved... ... in SwUndoDelete::UndoImpl; this wasn't fixed properly in commit 6c7245e789f973cf6dad03f7008ab3f9d12d350c - the SwTextFrame was moved into the SwSectionFrame but its upper was whatever it was previously. This is rather ugly because with the constraint from the very special case of tdf#131684 the MakeFrames() requires one node with pre-existing frames, and it's not possible to move the pre-existing frame after MakeFrames() because then the tdf#132236 case will have an empty SwSectionFrame and InsertCnt_() will just delete it. So try to detect the situation with some hack in InsertCnt_() to move it into the SwSectionFrame. (regression from 723728cd358693b8f4bc9d913541aa4479f2bd48) Change-Id: Ic0199c85d7523a49676ad3df1d2c4d8fe135c2ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94881 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@cib.de> diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 3b67a6fde7ca..2ba1db6974d2 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -478,6 +478,15 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf131684) // without the fix, it crashes dispatchCommand(mxComponent, ".uno:Undo", {}); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); + + // check that the text frame has the correct upper + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + OUString const sectionId = getXPath(pXmlDoc, "/root/page[1]/body/section[7]", "id"); + OUString const sectionLower = getXPath(pXmlDoc, "/root/page[1]/body/section[7]", "lower"); + OUString const textId = getXPath(pXmlDoc, "/root/page[1]/body/section[7]/txt[1]", "id"); + OUString const textUpper = getXPath(pXmlDoc, "/root/page[1]/body/section[7]/txt[1]", "upper"); + CPPUNIT_ASSERT_EQUAL(textId, sectionLower); + CPPUNIT_ASSERT_EQUAL(sectionId, textUpper); } CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf80663) diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index b55f56775bb2..01af928c3fe9 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -1678,6 +1678,36 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc, static_cast<SwTextFrame*>(pPrv)->Prepare( PrepareHint::QuoVadis, nullptr, false ); } } + if (nIndex + 1 == nEndIndex) + { // tdf#131684 tdf#132236 fix upper of frame moved in + // SwUndoDelete; can't be done there unfortunately + // because empty section frames are deleted here + SwFrame *const pNext( + // if there's a parent section, it has been split + // into 2 SwSectionFrame already :( + ( pFrame->GetNext()->IsSctFrame() + && pActualSection->GetUpper() + && pActualSection->GetUpper()->GetSectionNode() == + static_cast<SwSectionFrame const*>(pFrame->GetNext())->GetSection()->GetFormat()->GetSectionNode()) + ? static_cast<SwSectionFrame *>(pFrame->GetNext())->ContainsContent() + : pFrame->GetNext()); + if (pNext + && pNext->IsTextFrame() + && static_cast<SwTextFrame*>(pNext)->GetTextNodeFirst() == pDoc->GetNodes()[nEndIndex] + && (pNext->GetUpper() == pFrame->GetUpper() + || pFrame->GetNext()->IsSctFrame())) // checked above + { + pNext->Cut(); + pNext->InvalidateInfFlags(); // mbInfSct changed + // could have columns + SwSectionFrame *const pSection(static_cast<SwSectionFrame*>(pFrame)); + assert(!pSection->Lower() || pSection->Lower()->IsLayoutFrame()); + SwLayoutFrame *const pParent(pSection->Lower() ? pSection->GetNextLayoutLeaf() : pSection); + assert(!pParent->Lower()); + // paste invalidates, section could have indent... + pNext->Paste(pParent, nullptr); + } + } // #i27138# // notify accessibility paragraphs objects about changed // CONTENT_FLOWS_FROM/_TO relation. _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits