[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sw/qa sw/source
Michael Stahl (via logerrit)
logerrit at kemper.freedesktop.org
Fri May 29 16:05:36 UTC 2020
sw/qa/extras/uiwriter/uiwriter2.cxx | 9 +++++++++
sw/source/core/layout/frmtool.cxx | 30 ++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+)
New commits:
commit 8871f81f218dd49de27d528e54a515d1648d3554
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue May 26 16:43:27 2020 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri May 29 18:05:00 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.stahl at cib.de>
(cherry picked from commit 55576842ec72a748d0bad123d41fa03c89fc136d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95023
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index a035cef8b3e3..e8f1f47dcf86 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -171,6 +171,15 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf131684)
// without the fix, it crashes
lcl_dispatchCommand(mxComponent, ".uno:Undo", {});
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+
+ // check that the text frame has the correct upper
+ xmlDocPtr 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(SwUiWriterTest2, testTdfChangeNumberingListAutoFormat)
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 32447b47bb45..2a2a59377636 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1694,6 +1694,36 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
static_cast<SwTextFrame*>(pPrv)->Prepare( PREP_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.
More information about the Libreoffice-commits
mailing list