summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/source/core/text/frmform.cxx9
-rw-r--r--sw/source/core/text/txtfrm.cxx2
2 files changed, 9 insertions, 2 deletions
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 157a338bda34..dad1b9a47109 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -238,7 +238,14 @@ bool SwTextFrame::CalcFollow(TextFrameIndex const nTextOfst)
if ( !pMyFollow->GetNext() && !pMyFollow->HasFootnote() )
nOldBottom = aRectFnSet.IsVert() ? 0 : LONG_MAX;
- while( true )
+ // tdf#122892 check flag:
+ // 1. WidowsAndOrphans::FindWidows() determines follow is a widow
+ // 2. SwTextFrame::PrepWidows() calls SetPrepWidows() on master;
+ // if it can spare lines, master truncates one line
+ // 3. SwTextFrame::CalcPreps() on master (below);
+ // unless IsPrepMustFit(), if master hasn't shrunk via 2., it will SetWidow()
+ // 4. loop must exit then, because the follow didn't grow so nothing will ever change
+ while (!IsWidow())
{
if( !FormatLevel::LastLevel() )
{
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 99981405d297..d5a71ed936a7 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -2567,6 +2567,7 @@ void SwTextFrame::PrepWidows( const sal_uInt16 nNeed, bool bNotify )
SwParaPortion *pPara = GetPara();
if ( !pPara )
return;
+ pPara->SetPrepWidows();
sal_uInt16 nHave = nNeed;
@@ -2598,7 +2599,6 @@ void SwTextFrame::PrepWidows( const sal_uInt16 nNeed, bool bNotify )
if( bSplit )
{
- pPara->SetPrepWidows();
GetFollow()->SetOfst( aLine.GetEnd() );
aLine.TruncLines( true );
if( pPara->IsFollowField() )