]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Fix for row spans ending early thus leaving empty grid units.
authorJeremias Maerki <jeremias@apache.org>
Thu, 12 May 2005 13:52:15 +0000 (13:52 +0000)
committerJeremias Maerki <jeremias@apache.org>
Thu, 12 May 2005 13:52:15 +0000 (13:52 +0000)
Adds a sanity check for the stepper.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_KnuthStylePageBreaking@198616 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
src/java/org/apache/fop/layoutmgr/table/TableStepper.java

index 3ca40b0874baaca8542f1828ebf8bbdf66a4d154..1a750407024b7a510d87c4b1fa3d770199327bad 100644 (file)
@@ -651,6 +651,9 @@ public class TableContentLayoutManager {
                     start[colIndex] = gup.start;
                     end[colIndex] = gup.end;
                 } else {
+                    if (gup.end < end[colIndex]) {
+                        throw new IllegalStateException("Internal Error: stepper problem");
+                    }
                     end[colIndex] = gup.end;
                 }
                 if (rowFO == null) {
@@ -703,8 +706,10 @@ public class TableContentLayoutManager {
             //Add areas for row
             //addRowBackgroundArea(rowFO, lastRowHeight, layoutContext.getRefIPD(), yoffset);
             for (int i = 0; i < gridUnits.length; i++) {
+                GridUnit currentGU = (GridUnit)lastRow.getGridUnits().get(i);
                 if ((gridUnits[i] != null) 
-                        && (forcedFlush || (end[i] == gridUnits[i].getElements().size() - 1))) {
+                        && (forcedFlush || (end[i] == gridUnits[i].getElements().size() - 1))
+                        && (currentGU.isLastGridUnitRowSpan())) {
                     if (log.isDebugEnabled()) {
                         log.debug((forcedFlush ? "FORCED " : "") + "flushing..." + i + " " 
                                 + start[i] + "-" + end[i]);
index 8a535130215af0651fae141ea7560fa38ded26a9..c41f0a201d888a3e56e5b21281b5e547a723cf00 100644 (file)
@@ -194,19 +194,12 @@ public class TableStepper {
                     if (start[i] == 0 && end[i] == 0 
                             && elementLists[i].size() == 1
                             && elementLists[i].get(0) instanceof KnuthBoxCellWithBPD) {
+                        //Special case: Cell with fixed BPD
                         gridUnitParts.add(new GridUnitPart(pgu, 
                                 0, pgu.getElements().size() - 1));
                     } else {
                         gridUnitParts.add(new GridUnitPart(pgu, start[i], end[i]));
                     }
-                } else {
-                    /*
-                    if ((end[i] >= 0)
-                            || (elementLists[i] != null && end[i] < 0)) {
-                        PrimaryGridUnit pgu = getActivePrimaryGridUnit(i);
-                        log.debug(">>>>>" + start[i] + "-" + end[i]);
-                        gridUnitParts.add(new GridUnitPart(pgu, 0, -1));
-                    }*/
                 }
             }
             //log.debug(">>> guPARTS: " + gridUnitParts);
@@ -278,7 +271,9 @@ public class TableStepper {
                 log.debug("===> new row: " + activeRow);
                 initializeElementLists();
                 for (int i = 0; i < backupWidths.length; i++) {
-                    backupWidths[i] = 0;
+                    if (end[i] < 0) {
+                        backupWidths[i] = 0;
+                    }
                 }
             }
         }
@@ -343,11 +338,11 @@ public class TableStepper {
         StringBuffer sb = new StringBuffer();
         for (int i = 0; i < widths.length; i++) {
             baseWidth[i] = 0;
+            for (int prevRow = 0; prevRow < startRow[i]; prevRow++) {
+                baseWidth[i] += rowGroup[prevRow].getHeight().opt;
+            }
+            baseWidth[i] += borderBefore[i] + borderAfter[i];
             if (end[i] >= start[i]) {
-                for (int prevRow = 0; prevRow < startRow[i]; prevRow++) {
-                    baseWidth[i] += rowGroup[prevRow].getHeight().opt;
-                }
-                baseWidth[i] += borderBefore[i] + borderAfter[i];
                 int len = baseWidth[i] + widths[i];
                 sb.append(len + " ");
                 minStep = Math.min(len, minStep);