sw/qa/extras/layout/data/footnote-in-2-column-section.fodt | 25 +++++++++++++ sw/qa/extras/layout/layout6.cxx | 15 +++++++ sw/source/core/layout/ftnfrm.cxx | 3 + 3 files changed, 42 insertions(+), 1 deletion(-)
New commits: commit 4ec14ca63fc02240c6df862dd78616c140606a24 Author: Mike Kaganski <[email protected]> AuthorDate: Sat Dec 20 11:48:55 2025 +0500 Commit: Mike Kaganski <[email protected]> CommitDate: Sat Dec 20 09:40:50 2025 +0100 tdf#155306: find the correct footnote boss frame SwFrame::FindFootnoteBossFrame may return different results depending on the note type (footnoote / endnote). Unfortunately, there is a mess in the code, where in most places, the method is called with default argument value. This change fixes one such place. Change-Id: I66f18b88f4ceeb7b9626a66d6459ef376c03eb07 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195948 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/sw/qa/extras/layout/data/footnote-in-2-column-section.fodt b/sw/qa/extras/layout/data/footnote-in-2-column-section.fodt new file mode 100644 index 000000000000..1bdd8bd71ad1 --- /dev/null +++ b/sw/qa/extras/layout/data/footnote-in-2-column-section.fodt @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" office:version="1.4" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:styles> + <text:notes-configuration text:note-class="footnote" text:start-numbering-at="page"/> + </office:styles> + <office:automatic-styles> + <style:style style:name="Sect1" style:family="section"> + <style:section-properties> + <style:columns fo:column-count="2" fo:column-gap="5mm"/> + </style:section-properties> + </style:style> + </office:automatic-styles> + <office:master-styles/> + <office:body> + <office:text> + <text:p>foo<text:note text:id="ftn1" text:note-class="footnote"><text:note-citation>1</text:note-citation><text:note-body> + <text:p>First</text:p></text:note-body></text:note></text:p> + <text:section text:style-name="Sect1" text:name="Section1"> + <text:p>bar<text:note text:id="ftn2" text:note-class="footnote"><text:note-citation>2</text:note-citation><text:note-body> + <text:p>Second</text:p></text:note-body></text:note></text:p> + </text:section> + </office:text> + </office:body> +</office:document> \ No newline at end of file diff --git a/sw/qa/extras/layout/layout6.cxx b/sw/qa/extras/layout/layout6.cxx index 847da858f3ee..59571bcdf03f 100644 --- a/sw/qa/extras/layout/layout6.cxx +++ b/sw/qa/extras/layout/layout6.cxx @@ -1756,6 +1756,21 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter6, testTdf169399) assertXPath(pXmlDoc, "/root/page", 1); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter6, testTdf155306) +{ + // Given a document defining footnotes counted per page, with a 2-column section containing + // a footnote: + createSwDoc("footnote-in-2-column-section.fodt"); + + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + // The footnote must have the correct number. Without the fix, the following tests both failed, + // because the number was 0: + assertXPath(pXmlDoc, "//body/section/column[1]//SwFieldPortion[@type='PortionType::Footnote']", + "expand", u"2"); + assertXPath(pXmlDoc, "//ftncont/ftn[2]//SwFieldPortion[@type='PortionType::FootnoteNum']", + "expand", u"2"); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index 0779e1661afd..4c8d2419242b 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -1277,7 +1277,8 @@ const SwFootnoteFrame *SwFootnoteBossFrame::FindFirstFootnote( SwContentFrame co } if ( pRet ) { - const SwFootnoteBossFrame* pBoss = pRet->GetRef()->FindFootnoteBossFrame(); + const SwFootnoteBossFrame* pBoss = pRet->GetRef()->FindFootnoteBossFrame( + !pRet->GetAttr()->GetFootnote().IsEndNote()); if( !pBoss || pBoss->GetPhyPageNum() != nPageNum || nColNum != lcl_ColumnNum( pBoss ) ) pRet = nullptr;
