]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
fix for infinite loops with table keeps
authorKeiron Liddle <keiron@apache.org>
Tue, 8 Jan 2002 08:18:42 +0000 (08:18 +0000)
committerKeiron Liddle <keiron@apache.org>
Tue, 8 Jan 2002 08:18:42 +0000 (08:18 +0000)
Submitted by: Christian Geisert <Christian.Geisert@isu-gmbh.de>

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_20_2-maintain@194616 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/fo/flow/RowSpanMgr.java
src/org/apache/fop/fo/flow/TableBody.java

index 363963b62e4c7e591b863652067914621cb7154d..c98b054cc691b68020da192ca3eb437c68f0a302 100644 (file)
@@ -52,6 +52,8 @@ public class RowSpanMgr {
 
     private SpanInfo spanInfo[];
 
+    private boolean ignoreKeeps = false;
+
     public RowSpanMgr(int numCols) {
         this.spanInfo = new SpanInfo[numCols];
     }
@@ -125,4 +127,22 @@ public class RowSpanMgr {
             return false;
     }
 
+    /**
+     * helper method to prevent infinite loops if
+     * keeps or spans are not fitting on a page
+     * @param <code>true</code> if keeps and spans should be ignored
+     */
+    public void setIgnoreKeeps(boolean ignoreKeeps) {
+        this.ignoreKeeps = ignoreKeeps;
+    }
+
+    /**
+     * helper method (i.e. hack ;-) to prevent infinite loops if
+     * keeps or spans are not fitting on a page
+     * @return true if keeps or spans should be ignored
+     */
+    public boolean ignoreKeeps() {
+        return ignoreKeeps;
+    }
+
 }
index 7ca06d17266e9db3d6c821ab9bb0ecd9dec995a3..b69e59feb727fa4ac97186ee7f4e6381c7988f68 100644 (file)
@@ -186,8 +186,9 @@ public class TableBody extends FObj {
                     }
                     return status;
                 }
-                if (keepWith.size()
-                        > 0) {    // && status.getCode() == Status.AREA_FULL_NONE
+                if ((keepWith.size() > 0)
+                    && (!rowSpanMgr.ignoreKeeps())) {
+                    // && status.getCode() == Status.AREA_FULL_NONE
                     // FIXME!!! Handle rows spans!!!
                     row.removeLayout(areaContainer);
                     for (Enumeration e = keepWith.elements();
@@ -198,6 +199,10 @@ public class TableBody extends FObj {
                     }
                     if (i == 0) {
                         resetMarker();
+
+                        // Fix for infinite loop bug if keeps are too big for page
+                        rowSpanMgr.setIgnoreKeeps(true);
+
                         return new Status(Status.AREA_FULL_NONE);
                     }
                 }
@@ -212,6 +217,10 @@ public class TableBody extends FObj {
                     area.increaseHeight(areaContainer.getHeight());
                     area.setAbsoluteHeight(areaContainer.getAbsoluteHeight());
                 }
+
+                // Fix for infinite loop bug if spanned rows are too big for page
+                rowSpanMgr.setIgnoreKeeps(true);
+
                 return status;
             } else if (status.getCode() == Status.KEEP_WITH_NEXT
                        || rowSpanMgr.hasUnfinishedSpans()) {