sw: layout: ignore Keep-With-Next on hidden frames, part3

SwTabFrame: :MakeAll(), SwRowFrame::ShouldRowKeepWithNext()
Change-Id: I7cb6e558dc05736658a9bc75d6c735e6a47062b0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177977
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Tested-by: Jenkins
This commit is contained in:
Michael Stahl 2024-12-06 14:24:12 +01:00
parent a08b8fa2d0
commit afab0fa906

View file

@ -2287,7 +2287,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
&& !pAttrs->GetAttrSet().GetKeep().GetValue()
&& AreAllRowsKeepWithNext(GetFirstNonHeadlineRow(), /*bCheckParents=*/false);
// The beloved keep attribute
const bool bKeep = IsKeep(pAttrs->GetAttrSet().GetKeep(), GetBreakItem(), bEmulateTableKeep);
const bool bKeep{!isHiddenNow && IsKeep(pAttrs->GetAttrSet().GetKeep(), GetBreakItem(), bEmulateTableKeep)};
// Join follow table, if this table is not allowed to split:
if ( bDontSplit )
@ -2407,9 +2407,8 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
}
aNotify.SetLowersComplete( false );
}
SwFrame *pPre;
if ( bKeep || (nullptr != (pPre = FindPrev()) &&
pPre->GetAttrSet()->GetKeep().GetValue()) )
SwFrame const*const pPre{bKeep ? nullptr : FindPrevIgnoreHidden()};
if (bKeep || (nullptr != pPre && pPre->GetAttrSet()->GetKeep().GetValue()))
{
m_bCalcLowers = true;
}
@ -2764,7 +2763,8 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
oAccess.emplace(SwFrame::GetCache(), this);
pAttrs = oAccess->Get();
}
if (IsKeep(pAttrs->GetAttrSet().GetKeep(), GetBreakItem(), true)
if (!isHiddenNow
&& IsKeep(pAttrs->GetAttrSet().GetKeep(), GetBreakItem(), true)
&& pLastRow->ShouldRowKeepWithNext())
{
bFormat = true;
@ -5647,7 +5647,7 @@ bool SwRowFrame::ShouldRowKeepWithNext( const bool bCheckParents ) const
const SwCellFrame* pCell = static_cast<const SwCellFrame*>(Lower());
const SwFrame* pText = pCell->Lower();
return pText && pText->IsTextFrame() &&
return pText && pText->IsTextFrame() && !pText->IsHiddenNow() &&
static_cast<const SwTextFrame*>(pText)->GetTextNodeForParaProps()->GetSwAttrSet().GetKeep(bCheckParents).GetValue();
}