summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2024-06-25 18:47:15 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2024-06-26 16:23:46 +0200
commitf683f1262eb9d04492d4516e44416f899b89f7ce (patch)
treedcfc735aef6aac3d2c053278a79debbe80ed2f84
parent7899d277cdd790303ffea309c8b717cc668e272a (diff)
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.stahl@allotropia.de> (cherry picked from commit 3e845b10be7ae7f2ac91e37fe6404dd390aaa49d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169554
-rw-r--r--sw/qa/extras/layout/data/tdf161718.docxbin0 -> 18843 bytes
-rw-r--r--sw/qa/extras/layout/layout3.cxx17
-rw-r--r--sw/source/core/text/txtftn.cxx7
3 files changed, 24 insertions, 0 deletions
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
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf161718.docx
Binary files differ
diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index b670030a15c1..8cc6216c977d 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 da51233ac190..4efb4d83b6cc 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();