Blob Blame History Raw
From 1fec67aab152e0c0ad6dd85082c50f1beff7d520 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Tue, 16 Sep 2014 13:22:44 +0100
Subject: [PATCH] Resolves: fdo#68967 looping layout

RemoveFollowFlowLine() marks the layout invalid, but the
next cycle through does everything exactly the same again.

Try the same foul horror as nUnSplitted. But at least with
a test-case that nails down reproducing the bug if a better
fix is needed.

Change-Id: Id6698bcb2364bd0253bedd4a7c313e25f705be8d
---
 sw/qa/extras/ww8import/data/fdo68967.doc | Bin 0 -> 99328 bytes
 sw/qa/extras/ww8import/ww8import.cxx     |   4 ++++
 sw/source/core/layout/tabfrm.cxx         |   7 +++++++
 3 files changed, 11 insertions(+)
 create mode 100644 sw/qa/extras/ww8import/data/fdo68967.doc

diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 06f38c7..f7a39f5 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -1831,6 +1831,7 @@ void SwTabFrm::MakeAll()
     }
 
     int nUnSplitted = 5; // Just another loop control :-(
+    int nThrowAwayValidLayoutLimit = 5; // And another one :-(
     SWRECTFN( this )
     while ( !mbValidPos || !mbValidSize || !mbValidPrtArea )
     {
@@ -2301,7 +2302,13 @@ void SwTabFrm::MakeAll()
                     // An existing follow flow line has to be removed.
                     if ( HasFollowFlowLine() )
                     {
+                        if (!nThrowAwayValidLayoutLimit)
+                            continue;
+                        bool bInitialLoopEndCondition = mbValidPos && mbValidSize && mbValidPrtArea;
                         RemoveFollowFlowLine();
+                        bool bFinalLoopEndCondition = mbValidPos && mbValidSize && mbValidPrtArea;
+                        if (bInitialLoopEndCondition && !bFinalLoopEndCondition)
+                            --nThrowAwayValidLayoutLimit;
                     }
 
                     const bool bSplitError = !Split( nDeadLine, bTryToSplit, ( bTableRowKeep && !bAllowSplitOfRow ) );
-- 
1.9.3