sw/qa/extras/layout/data/fdo56797-2-min.odt |binary sw/qa/extras/layout/layout3.cxx | 31 ++++++++++++++++++++++++++++ sw/source/core/layout/layact.cxx | 6 ++--- 3 files changed, 34 insertions(+), 3 deletions(-)
New commits: commit cff929fe5c5bc24be81218ba2ce3d9304d09bf68 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Mon Aug 14 17:13:17 2023 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Mon Aug 21 12:05:58 2023 +0200 tdf#156724 tdf#156722 tdf#156745 sw: layout: partially remove IsPaintLocked() Having the layout algorithm dependend on IsPaintLocked() is very problematic; it is typically set when the layout is invoked from SwViewShell code, as happens several times when loading a document in response to window resize events etc., but not for idle formatting or from SwXTextDocument::getRendererCount(), hence these bugs only reproduce with soffice --convert-to pdf, not via UI. For tdf#156724 the problem is that the table is split, during formatting of the split row a new footnote is created on page 1, and this reduces the space, so splitting fails and is never attempted again. When the document is loaded from UI, when the table is split the footnote already exists and so splitting succeeds; it was created by a call from SwLayAction::FormatLayout() of the cell frame. It turns out that when the condition is removed completely, testUXTSOREL will take 5 minutes instead of 5 seconds, which seems excessive; the problem there appears to be that a text frame in a columned section moves forward and backward; plausibly columned section content should be formatted by ::CalcContent() only. (reportedly regression from commit c605283ad6785dea762feab5fdffd9d27e75c292 and commit 7e8b4756d95057f069467b34e7849f9354856578) Change-Id: I9ed73588efeec654a769eee8aa825186bd51e059 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155672 Tested-by: Michael Stahl <michael.st...@allotropia.de> Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit dc5991ccc8f7d8e86c1e04be9095dda5c08b4763) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155691 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/qa/extras/layout/data/fdo56797-2-min.odt b/sw/qa/extras/layout/data/fdo56797-2-min.odt new file mode 100644 index 000000000000..624149ec0248 Binary files /dev/null and b/sw/qa/extras/layout/data/fdo56797-2-min.odt differ diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx index 784a295fa2e8..abe2b830e804 100644 --- a/sw/qa/extras/layout/layout3.cxx +++ b/sw/qa/extras/layout/layout3.cxx @@ -1176,6 +1176,37 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf128399) CPPUNIT_ASSERT_EQUAL(nExpected, aPosition.GetNodeIndex()); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf156724) +{ + discardDumpedLayout(); + if (mxComponent.is()) + mxComponent->dispose(); + + OUString const url(createFileURL(u"fdo56797-2-min.odt")); + + // note: must set Hidden property, so that SfxFrameViewWindow_Impl::Resize() + // does *not* forward initial VCL Window Resize and thereby triggers a + // layout which does not happen on soffice --convert-to pdf. + std::vector<beans::PropertyValue> aFilterOptions = { + { beans::PropertyValue("Hidden", -1, uno::Any(true), beans::PropertyState_DIRECT_VALUE) }, + }; + + // inline the loading because currently properties can't be passed... + mxComponent = loadFromDesktop(url, "com.sun.star.text.TextDocument", + comphelper::containerToSequence(aFilterOptions)); + save("writer_pdf_Export"); + + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + // both pages have a tab frame and one footnote + assertXPath(pXmlDoc, "/root/page[1]/body/tab", 1); + assertXPath(pXmlDoc, "/root/page[1]/ftncont", 1); + assertXPath(pXmlDoc, "/root/page[1]/ftncont/ftn", 1); + assertXPath(pXmlDoc, "/root/page[2]/body/tab", 1); + assertXPath(pXmlDoc, "/root/page[2]/ftncont", 1); + assertXPath(pXmlDoc, "/root/page[2]/ftncont/ftn", 1); + assertXPath(pXmlDoc, "/root/page", 2); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf145826) { createSwDoc("tdf145826.odt"); diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index ecce180eb336..af93ab796ff6 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -1431,10 +1431,10 @@ bool SwLayAction::FormatLayout( OutputDevice *pRenderContext, SwLayoutFrame *pLa PopFormatLayout(); } } - else if ( m_pImp->GetShell()->IsPaintLocked() ) - // Shortcut to minimize the cycles. With Lock, the - // paint is coming either way (primarily for browse) + else if (m_pImp->GetShell()->IsPaintLocked() || !pLay->IsColBodyFrame()) + { // tdf#156724 unconditionally for frames in tables, so their footnotes exist before trying to split pLow->OptCalc(); + } if ( IsAgain() ) return false;