[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - sw/qa sw/source
Michael Stahl (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jun 2 21:40:54 UTC 2020
sw/qa/extras/uiwriter/uiwriter2.cxx | 9 +++++++++
sw/source/core/layout/frmtool.cxx | 30 ++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+)
New commits:
commit 706f86ea68968b8817bf3844fa538d804d22482c
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue May 26 16:43:27 2020 +0200
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Tue Jun 2 23:40:21 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>
(cherry picked from commit 8871f81f218dd49de27d528e54a515d1648d3554)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95363
Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 902395a74a2a..357df4f9bd4a 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -83,6 +83,15 @@ void 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);
}
void SwUiWriterTest2::testTdf101534()
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 594de9ec8b80..9e8ee48a4b72 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1612,6 +1612,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