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 <michael.stahl@allotropia.de>
This commit is contained in:
Michael Stahl 2024-11-20 19:30:54 +01:00
parent 483a3db520
commit fbfbd2f51e

View file

@ -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());
}