summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2023-06-01 12:45:20 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2023-06-01 20:15:33 +0200
commit59987d3c77ec7dbf59fbea9f47cc226f4e8903f9 (patch)
tree2b8349ab2683025e10f7fd76ef102066e045a783
parentd7d2b172065f90aa2f61c0216f3722e868ae76a1 (diff)
tdf#150606 sw: layout: leave follow SwTabFrame invalid in columns
With the minimised bugdoc, on Undo, some 12 or so pages are created, and the end of the deleted table is shown in the document view. So first the last pages are layouted, and then once those are done layout proceeds from page 1. The problem is that on page 9, a table remains in the 2nd column of the section, and there is nothing in the 1st column and on pages 5-8. This is because ::CalcContent() is the last thing that formats the table on page 9, and it explicitly disables MoveBwd() for follow tables via m_bLockBackMove. That appears to be intentional but because it's already been there since initial CVS import it's unclear why; it might be based on the assumption that a previous column would have moved over rows from the follow table already. Try to encourage the table to try to MoveBwd() at a later time, when it's being formatted from the SwLayAction::FormatContent_() loop, which appears to help. (somehow regression from commit 723728cd358693b8f4bc9d913541aa4479f2bd48) Change-Id: I421525269948aa58888f5302e6db234c89230f00 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152485 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r--sw/qa/extras/layout/data/tdf150606-1-min.odtbin0 -> 52456 bytes
-rw-r--r--sw/qa/extras/layout/layout.cxx65
-rw-r--r--sw/source/core/layout/fly.cxx6
3 files changed, 70 insertions, 1 deletions
diff --git a/sw/qa/extras/layout/data/tdf150606-1-min.odt b/sw/qa/extras/layout/data/tdf150606-1-min.odt
new file mode 100644
index 000000000000..63bd1ceb0a5b
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf150606-1-min.odt
Binary files differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 07f041faaf96..e985c62626a5 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -1145,6 +1145,71 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInHeader)
}
}
+#if !defined(MACOSX)
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf150606)
+{
+ createSwDoc("tdf150606-1-min.odt");
+
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+ SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+
+ xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+ assertXPath(pXmlDoc, "/root/page[1]/body/section/column[1]/body/tab", 1);
+ assertXPath(pXmlDoc, "/root/page[1]/body/section/column[2]/body/tab", 1);
+ assertXPath(pXmlDoc, "/root/page[1]/body/section/column", 2);
+ assertXPath(pXmlDoc, "/root/page[2]/body/section/column[1]/body/tab", 1);
+ assertXPath(pXmlDoc, "/root/page[2]/body/section/column[2]/body/tab", 1);
+ assertXPath(pXmlDoc, "/root/page[2]/body/section/column", 2);
+ assertXPath(pXmlDoc, "/root/page[3]/body/section/column[1]/body/tab", 1);
+ assertXPath(pXmlDoc, "/root/page[3]/body/section/column[2]/body/tab", 1);
+ assertXPath(pXmlDoc, "/root/page[3]/body/section/column", 2);
+ assertXPath(pXmlDoc, "/root/page[4]/body/section/column[1]/body/tab", 1);
+ assertXPath(pXmlDoc, "/root/page[4]/body/section/column[2]/body/tab", 1);
+ assertXPath(pXmlDoc, "/root/page[4]/body/section/column", 2);
+ // on page 5 the table is split across balanced columns
+ assertXPath(pXmlDoc, "/root/page[5]/body/section/column[1]/body/tab", 1);
+ assertXPath(pXmlDoc, "/root/page[5]/body/section/column[2]/body/tab", 1);
+ assertXPath(pXmlDoc, "/root/page[5]/body/section/column", 2);
+ assertXPath(pXmlDoc, "/root/page", 5);
+
+ pWrtShell->Down(false, 1);
+ dispatchCommand(mxComponent, ".uno:DeleteTable", {});
+
+ discardDumpedLayout();
+ pXmlDoc = parseLayoutDump();
+
+ assertXPath(pXmlDoc, "/root/page[1]/body/section/column/body/tab", 0);
+ assertXPath(pXmlDoc, "/root/page", 1);
+
+ pWrtShell->Undo();
+ Scheduler::ProcessEventsToIdle();
+
+ discardDumpedLayout();
+ pXmlDoc = parseLayoutDump();
+
+ assertXPath(pXmlDoc, "/root/page[1]/body/section/column[1]/body/tab", 1);
+ assertXPath(pXmlDoc, "/root/page[1]/body/section/column[2]/body/tab", 1);
+ assertXPath(pXmlDoc, "/root/page[1]/body/section/column", 2);
+ assertXPath(pXmlDoc, "/root/page[2]/body/section/column[1]/body/tab", 1);
+ assertXPath(pXmlDoc, "/root/page[2]/body/section/column[2]/body/tab", 1);
+ assertXPath(pXmlDoc, "/root/page[2]/body/section/column", 2);
+ assertXPath(pXmlDoc, "/root/page[3]/body/section/column[1]/body/tab", 1);
+ assertXPath(pXmlDoc, "/root/page[3]/body/section/column[2]/body/tab", 1);
+ assertXPath(pXmlDoc, "/root/page[3]/body/section/column", 2);
+ assertXPath(pXmlDoc, "/root/page[4]/body/section/column[1]/body/tab", 1);
+ assertXPath(pXmlDoc, "/root/page[4]/body/section/column[2]/body/tab", 1);
+ assertXPath(pXmlDoc, "/root/page[4]/body/section/column", 2);
+ // on page 5 the table is split across balanced columns
+ // (problem was that there were empty pages and table was on page 10)
+ assertXPath(pXmlDoc, "/root/page[5]/body/section/column[1]/body/tab", 1);
+ assertXPath(pXmlDoc, "/root/page[5]/body/section/column[2]/body/tab", 1);
+ assertXPath(pXmlDoc, "/root/page[5]/body/section/column", 2);
+ assertXPath(pXmlDoc, "/root/page", 5);
+}
+#endif
+
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf137025)
{
// Check the padding of the textbox
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 1d762012a111..d03e015f2c14 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -1822,8 +1822,12 @@ void CalcContent( SwLayoutFrame *pLay, bool bNoColl )
}
if ( pFrame->IsTabFrame() )
{
- if ( static_cast<SwTabFrame*>(pFrame)->IsFollow() )
+ if (static_cast<SwTabFrame*>(pFrame)->m_bLockBackMove)
+ {
+ assert(static_cast<SwTabFrame*>(pFrame)->IsFollow());
static_cast<SwTabFrame*>(pFrame)->m_bLockBackMove = false;
+ pFrame->InvalidatePos();
+ }
}
pFrame = bPrevInvalid ? pTmpPrev : pFrame->FindNext();