sw/qa/core/layout/data/tdf158713_footnoteInHeadline.odt |binary sw/qa/core/layout/ftnfrm.cxx | 14 ++++++++++++++ sw/source/core/text/txtftn.cxx | 8 ++++---- 3 files changed, 18 insertions(+), 4 deletions(-)
New commits: commit 8431865e6b4d006f9df34663c4d81e76cccbda44 Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Fri Nov 22 19:33:52 2024 -0500 Commit: Justin Luth <justin.l...@collabora.com> CommitDate: Mon Nov 25 17:31:42 2024 +0100 tdf#108820 tdf#158713 sw layout: no footnote in repeated table rows This fixes my LO 7.1 regression from bug 108820. The problem was that footnotes-placed-in-table-headline were being visually removed if a split-table was ever joined during editing, etc. (i.e. one less page needed). Avoid the join() cleanup code being triggered on GetFollow frames because those were wrongly being informed that there was a footnote, despite being deliberately disallowed in IsFootnoteAllowed, so it really must not HasFootnote()! make CppunitTest_sw_core_layout \ CPPUNIT_TEST_NAME=testTdf158713_footnoteInHeadline Change-Id: I8f395217ba66a258738fc3f32846b952c69d367b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177059 Reviewed-by: Justin Luth <jl...@mail.com> Tested-by: Jenkins diff --git a/sw/qa/core/layout/data/tdf158713_footnoteInHeadline.odt b/sw/qa/core/layout/data/tdf158713_footnoteInHeadline.odt new file mode 100644 index 000000000000..d1c470c23cda Binary files /dev/null and b/sw/qa/core/layout/data/tdf158713_footnoteInHeadline.odt differ diff --git a/sw/qa/core/layout/ftnfrm.cxx b/sw/qa/core/layout/ftnfrm.cxx index 215d766682dd..0bd0b2c5d077 100644 --- a/sw/qa/core/layout/ftnfrm.cxx +++ b/sw/qa/core/layout/ftnfrm.cxx @@ -65,6 +65,20 @@ CPPUNIT_TEST_FIXTURE(Test, testFlySplitFootnoteLayout) CPPUNIT_ASSERT(pPage->FindFootnoteCont()); } +CPPUNIT_TEST_FIXTURE(Test, testTdf158713_footnoteInHeadline) +{ + // Given a file with table-with-headline split across multiple pages, + // and a footnote in the table's repeated heading row: + createSwDoc("tdf158713_footnoteInHeadline.odt"); + + // delete first paragraph, so table now fits all on the first page - no more "follow table"... + dispatchCommand(mxComponent, u".uno:Delete"_ustr, {}); + + // ensure the footnote text has not been removed from the layout + xmlDocUniquePtr pLayout = parseLayoutDump(); + assertXPath(pLayout, "/root/page/ftncont/ftn", 1); +} + CPPUNIT_TEST_FIXTURE(Test, testInlineEndnoteAndFootnote) { // Given a DOC file with an endnote and then a footnote: diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx index 0cf0f266511a..84f961781232 100644 --- a/sw/source/core/text/txtftn.cxx +++ b/sw/source/core/text/txtftn.cxx @@ -797,10 +797,10 @@ SwFootnotePortion *SwTextFormatter::NewFootnotePortion( SwTextFormatInfo &rInf, OSL_ENSURE( ! m_pFrame->IsVertical() || m_pFrame->IsSwapped(), "NewFootnotePortion with unswapped frame" ); - SwTextFootnote *pFootnote = static_cast<SwTextFootnote*>(pHint); + if (!m_pFrame->IsFootnoteAllowed()) + return new SwFootnotePortion(u""_ustr, nullptr); - if( !m_pFrame->IsFootnoteAllowed() ) - return new SwFootnotePortion(u""_ustr, pFootnote); + SwTextFootnote *pFootnote = static_cast<SwTextFootnote*>(pHint); const SwFormatFootnote& rFootnote = pFootnote->GetFootnote(); SwDoc *const pDoc = &m_pFrame->GetDoc(); @@ -1408,7 +1408,7 @@ bool SwFootnotePortion::Format( SwTextFormatInfo &rInf ) SetAscent( rInf.GetAscent() ); Height( rInf.GetTextHeight() ); rInf.SetFootnoteDone( !bFull ); - if( !bFull ) + if (!bFull && m_pFootnote) rInf.SetParaFootnote(); return bFull; }