sw/qa/extras/layout/data/tdf161718.docx |binary sw/qa/extras/layout/layout3.cxx | 17 +++++++++++++++++ sw/source/core/text/txtftn.cxx | 7 +++++++ 3 files changed, 24 insertions(+)
New commits: commit 3e845b10be7ae7f2ac91e37fe6404dd390aaa49d Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Tue Jun 25 18:47:15 2024 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed Jun 26 14:29:16 2024 +0200 tdf#161718 sw: fix background flys blocking footnotes The problem is that the document has an unwanted page break on the paragraph with the footnote. The reason is that lcl_GetFootnoteLower() tries to evade flys, but doesn't take into account that background flys (Wrap Through) should be ignored. (somehow regression from commit c303981cfd95ce1c3881366023d5495ae2edce97) Change-Id: I02578f14644e232fac127142fe12801101f87f86 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169530 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/qa/extras/layout/data/tdf161718.docx b/sw/qa/extras/layout/data/tdf161718.docx new file mode 100644 index 000000000000..240192e07a71 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf161718.docx differ diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx index a07e7e6cd037..7c36605bb82d 100644 --- a/sw/qa/extras/layout/layout3.cxx +++ b/sw/qa/extras/layout/layout3.cxx @@ -195,6 +195,23 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf128966) xmlXPathFreeObject(pXmlObj); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf161718) +{ + createSwDoc("tdf161718.docx"); + + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + + // everything on one page + assertXPath(pXmlDoc, "/root/page/header"_ostr, 1); + assertXPath(pXmlDoc, "/root/page/header/txt/anchored"_ostr, 1); + assertXPath(pXmlDoc, "/root/page/footer"_ostr, 1); + assertXPath(pXmlDoc, "/root/page/ftncont/ftn"_ostr, 1); + assertXPath(pXmlDoc, "/root/page/ftncont/ftn/txt"_ostr, 1); + assertXPath(pXmlDoc, "/root/page/body/txt"_ostr, 27); + assertXPath(pXmlDoc, "/root/page/body/txt/anchored"_ostr, 1); + assertXPath(pXmlDoc, "/root/page"_ostr, 1); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf119908) { createSwDoc("tdf130088.docx"); diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx index 745d40ce23bc..787ea1390e78 100644 --- a/sw/source/core/text/txtftn.cxx +++ b/sw/source/core/text/txtftn.cxx @@ -32,6 +32,7 @@ #include <txtftn.hxx> #include <flyfrm.hxx> #include <fmtftn.hxx> +#include <fmtsrnd.hxx> #include <ftninfo.hxx> #include <charfmt.hxx> #include <rowfrm.hxx> @@ -246,6 +247,12 @@ static SwTwips lcl_GetFootnoteLower( const SwTextFrame* pFrame, SwTwips nLower ) const SwSortedObjs &rObjs = *pStartFrame->GetDrawObjs(); for (SwAnchoredObject* pAnchoredObj : rObjs) { + if (pAnchoredObj->GetFrameFormat()->GetSurround().GetSurround() + == text::WrapTextMode_THROUGH) + { + continue; // tdf#161718 no effect on text flow, skip + } + SwRect aRect( pAnchoredObj->GetObjRect() ); auto pFlyFrame = pAnchoredObj->DynCastFlyFrame();