Hi,

this patch should fix infinite looping on tables if keep_with or row spans are
not fitting on a page. This hack just ignores all keeps for a table after the
first page-break (sounds really simple :-)
It would be better to check if the table starts already on top of the page but
I found no simple way to do this (table-header etc..)

Christian

P.S. I would like to finish the text-decoration patch before the release but
if I don't manage it till tomorrow we should do the release anyway...
diff -ur xml-fop/src/org/apache/fop/fo/flow/RowSpanMgr.java 
xml-fop-tab-final/src/org/apache/fop/fo/flow/RowSpanMgr.java
--- xml-fop/src/org/apache/fop/fo/flow/RowSpanMgr.java  Mon Jul 30 22:29:23 2001
+++ xml-fop-tab-final/src/org/apache/fop/fo/flow/RowSpanMgr.java        Mon Jan  7 
+02:36:54 2002
@@ -52,6 +52,8 @@
 
     private SpanInfo spanInfo[];
 
+    private boolean ignoreKeeps = false;
+
     public RowSpanMgr(int numCols) {
         this.spanInfo = new SpanInfo[numCols];
     }
@@ -123,6 +125,24 @@
             return spanInfo[colNum - 1].isInLastRow();
         } else
             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;
     }
 
 }
diff -ur xml-fop/src/org/apache/fop/fo/flow/TableBody.java 
xml-fop-tab-final/src/org/apache/fop/fo/flow/TableBody.java
--- xml-fop/src/org/apache/fop/fo/flow/TableBody.java   Mon Aug  6 11:12:59 2001
+++ xml-fop-tab-final/src/org/apache/fop/fo/flow/TableBody.java Mon Jan  7 04:11:51 
+2002
@@ -186,8 +186,9 @@
                     }
                     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 @@
                     }
                     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 @@
                     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()) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to