9e18775
From 1fec67aab152e0c0ad6dd85082c50f1beff7d520 Mon Sep 17 00:00:00 2001
9e18775
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
9e18775
Date: Tue, 16 Sep 2014 13:22:44 +0100
9e18775
Subject: [PATCH] Resolves: fdo#68967 looping layout
9e18775
9e18775
RemoveFollowFlowLine() marks the layout invalid, but the
9e18775
next cycle through does everything exactly the same again.
9e18775
9e18775
Try the same foul horror as nUnSplitted. But at least with
9e18775
a test-case that nails down reproducing the bug if a better
9e18775
fix is needed.
9e18775
9e18775
Change-Id: Id6698bcb2364bd0253bedd4a7c313e25f705be8d
9e18775
---
9e18775
 sw/qa/extras/ww8import/data/fdo68967.doc | Bin 0 -> 99328 bytes
9e18775
 sw/qa/extras/ww8import/ww8import.cxx     |   4 ++++
9e18775
 sw/source/core/layout/tabfrm.cxx         |   7 +++++++
9e18775
 3 files changed, 11 insertions(+)
9e18775
 create mode 100644 sw/qa/extras/ww8import/data/fdo68967.doc
9e18775
9e18775
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
9e18775
index 06f38c7..f7a39f5 100644
9e18775
--- a/sw/source/core/layout/tabfrm.cxx
9e18775
+++ b/sw/source/core/layout/tabfrm.cxx
9e18775
@@ -1831,6 +1831,7 @@ void SwTabFrm::MakeAll()
9e18775
     }
9e18775
 
9e18775
     int nUnSplitted = 5; // Just another loop control :-(
9e18775
+    int nThrowAwayValidLayoutLimit = 5; // And another one :-(
9e18775
     SWRECTFN( this )
9e18775
     while ( !mbValidPos || !mbValidSize || !mbValidPrtArea )
9e18775
     {
9e18775
@@ -2301,7 +2302,13 @@ void SwTabFrm::MakeAll()
9e18775
                     // An existing follow flow line has to be removed.
9e18775
                     if ( HasFollowFlowLine() )
9e18775
                     {
9e18775
+                        if (!nThrowAwayValidLayoutLimit)
9e18775
+                            continue;
9e18775
+                        bool bInitialLoopEndCondition = mbValidPos && mbValidSize && mbValidPrtArea;
9e18775
                         RemoveFollowFlowLine();
9e18775
+                        bool bFinalLoopEndCondition = mbValidPos && mbValidSize && mbValidPrtArea;
9e18775
+                        if (bInitialLoopEndCondition && !bFinalLoopEndCondition)
9e18775
+                            --nThrowAwayValidLayoutLimit;
9e18775
                     }
9e18775
 
9e18775
                     const bool bSplitError = !Split( nDeadLine, bTryToSplit, ( bTableRowKeep && !bAllowSplitOfRow ) );
9e18775
-- 
9e18775
1.9.3
9e18775