diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index c14ce2127a31..20755efa8d2c 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -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(Lower()); const SwFrame* pText = pCell->Lower(); - return pText && pText->IsTextFrame() && + return pText && pText->IsTextFrame() && !pText->IsHiddenNow() && static_cast(pText)->GetTextNodeForParaProps()->GetSwAttrSet().GetKeep(bCheckParents).GetValue(); }