keiron 02/01/08 00:18:42 Modified: src/org/apache/fop/fo/flow Tag: fop-0_20_2-maintain RowSpanMgr.java TableBody.java Log: fix for infinite loops with table keeps Submitted by: Christian Geisert <[EMAIL PROTECTED]> Revision Changes Path No revision No revision 1.2.2.1 +21 -1 xml-fop/src/org/apache/fop/fo/flow/RowSpanMgr.java Index: RowSpanMgr.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/RowSpanMgr.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- RowSpanMgr.java 30 Jul 2001 20:29:23 -0000 1.2 +++ RowSpanMgr.java 8 Jan 2002 08:18:42 -0000 1.2.2.1 @@ -1,5 +1,5 @@ /* - * -- $Id: RowSpanMgr.java,v 1.2 2001/07/30 20:29:23 tore Exp $ -- + * -- $Id: RowSpanMgr.java,v 1.2.2.1 2002/01/08 08:18:42 keiron Exp $ -- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. @@ -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; } } 1.38.2.1 +12 -3 xml-fop/src/org/apache/fop/fo/flow/TableBody.java Index: TableBody.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/TableBody.java,v retrieving revision 1.38 retrieving revision 1.38.2.1 diff -u -r1.38 -r1.38.2.1 --- TableBody.java 6 Aug 2001 09:12:59 -0000 1.38 +++ TableBody.java 8 Jan 2002 08:18:42 -0000 1.38.2.1 @@ -1,5 +1,5 @@ /* - * $Id: TableBody.java,v 1.38 2001/08/06 09:12:59 keiron Exp $ + * $Id: TableBody.java,v 1.38.2.1 2002/01/08 08:18:42 keiron Exp $ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. @@ -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, e-mail: [EMAIL PROTECTED]