summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2024-11-22 19:33:52 -0500
committerJustin Luth <justin.luth@collabora.com>2024-11-25 17:31:42 +0100
commit8431865e6b4d006f9df34663c4d81e76cccbda44 (patch)
treeabdd5572992cdb45fd439ae4b36d0d405fd6ade4 /sw
parentac2b3c339ee47497365066754e9937aba2cca700 (diff)
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 <jluth@mail.com> Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/core/layout/data/tdf158713_footnoteInHeadline.odtbin0 -> 18639 bytes
-rw-r--r--sw/qa/core/layout/ftnfrm.cxx14
-rw-r--r--sw/source/core/text/txtftn.cxx8
3 files changed, 18 insertions, 4 deletions
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
--- /dev/null
+++ b/sw/qa/core/layout/data/tdf158713_footnoteInHeadline.odt
Binary files 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;
}