sw/qa/extras/layout/data/tdf169999.fodt | 13 +++++++++++++ sw/qa/extras/layout/layout6.cxx | 26 ++++++++++++++++++++++++++ sw/source/core/layout/calcmove.cxx | 3 ++- 3 files changed, 41 insertions(+), 1 deletion(-)
New commits: commit 1e23e2b3f2ccab62bf699f3e267433c0f9b4a6cd Author: Mike Kaganski <[email protected]> AuthorDate: Mon Feb 16 16:45:49 2026 +0500 Commit: Mike Kaganski <[email protected]> CommitDate: Mon Feb 16 17:49:48 2026 +0100 tdf#169999: Also hide footnotes when text frame is hidden This is similar to what MakePrtArea does in that case: call HideHidden. Change-Id: I0625c00c5ec168698feed9d34079a1e84a8fa1b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199477 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/sw/qa/extras/layout/data/tdf169999.fodt b/sw/qa/extras/layout/data/tdf169999.fodt new file mode 100644 index 000000000000..c554309a6e5b --- /dev/null +++ b/sw/qa/extras/layout/data/tdf169999.fodt @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:ooow="http://openoffice.org/2004/writer" office:version="1.4" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:body> + <office:text> + <text:p/> + <text:section text:name="Section1" text:condition="ooow:0" text:display="condition"> + <text:p>This is a hidden section.<text:note text:id="ftn1" text:note-class="footnote"><text:note-citation>1</text:note-citation><text:note-body> + <text:p>This is a footnote in the hidden section.</text:p></text:note-body></text:note> Here are some random words in it.</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 c1eac3679167..b4c58304ada0 100644 --- a/sw/qa/extras/layout/layout6.cxx +++ b/sw/qa/extras/layout/layout6.cxx @@ -2170,6 +2170,32 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter6, testTdf170811) parseLayoutDump(); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter6, testTdf169999) +{ + // Open a document with a section with a paragraph with a footnote + createSwDoc("tdf169999.fodt"); + + // Initially, the hide condition evaluates to false, so footnote is visible: + { + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "//ftn", 1); + } + + // Set hide condition to "1" + auto xTextSectionsSupplier = mxComponent.queryThrow<css::text::XTextSectionsSupplier>(); + auto xSections = xTextSectionsSupplier->getTextSections(); + CPPUNIT_ASSERT(xSections); + auto xSection = xSections->getByName(u"Section1"_ustr).queryThrow<css::beans::XPropertySet>(); + xSection->setPropertyValue(u"Condition"_ustr, css::uno::Any(u"1"_ustr)); + Scheduler::ProcessEventsToIdle(); + + // The footnote must get hidden - without the fix, the text failed, because there was a ftn + { + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "//ftn", 0); + } +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index 6751ed44f804..52b243e2e690 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -1324,11 +1324,12 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) bool const isHiddenNow(static_cast<SwTextFrame*>(this)->IsHiddenNowImpl()); if (isHiddenNow) { + // Similar to respective code in MakePrtArea while (HasFollow()) { static_cast<SwTextFrame&>(*this).JoinFrame(); } - HideAndShowObjects(); + static_cast<SwTextFrame*>(this)->HideHidden(); // also hides footnotes } std::optional<SwFrameDeleteGuard> oDeleteGuard(std::in_place, this);
