From fbfbd2f51ebc5ab239d06ded7931214b1c84a5fd Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Wed, 20 Nov 2024 19:30:54 +0100 Subject: [PATCH] sw: fix hiding/unhiding section via condition The problem was that when un-hiding a section, table rows that contained only empty paragraphs were not reformatted and remained at height 0. It turns out that the table row that became visible did so because the cells had a VertOrientation different from NONE and so SwContentNotify::ImplDestroy() invalidated the cells' printarea. However, the real problem isn't in the layout code at all, as it then turns out that the reason why anything is reformatted at all is that there are docinfo fields on the same page as the section and also in the paragraphs at the start of the section, and these get invalidated somehow after unhiding the section. Unhiding the section didn't actually invalidate anything in the layout because in ImplSetHiddenFlag() no change is detected, and that is because the section was first hidden by removing its (false) condition, which calls SwSection::SetSectionData() and that didn't call ImplSetHiddenFlag(), again relying on docinfo field update to trigger the relayouting. Change-Id: Ie5d9e4d5a0467c17c662f20f8d54aa6b22b382da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176914 Tested-by: Jenkins Reviewed-by: Michael Stahl --- sw/source/core/docnode/section.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index c539c7531dc8..d9ac1d35ddd6 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -254,12 +254,14 @@ SwSection::~SwSection() void SwSection::SetSectionData(SwSectionData const& rData) { bool const bOldHidden( m_Data.IsHidden() ); + bool const bOldCondHidden{m_Data.IsCondHidden()}; m_Data = rData; // The next two may actually overwrite the m_Data.m_bProtect or EditInReadonly Flag // in Modify, which should result in same flag value as the old code! SetProtect(m_Data.IsProtectFlag()); SetEditInReadonly(m_Data.IsEditInReadonlyFlag()); - if (bOldHidden != m_Data.IsHidden()) // check if changed... + if (bOldHidden != m_Data.IsHidden() + || bOldCondHidden != m_Data.IsCondHidden()) // check if changed... { ImplSetHiddenFlag(m_Data.IsHidden(), m_Data.IsCondHidden()); }