]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Making display-align work again. May not be the optimal way to do this, but I didn...
authorJeremias Maerki <jeremias@apache.org>
Wed, 6 Apr 2005 07:52:28 +0000 (07:52 +0000)
committerJeremias Maerki <jeremias@apache.org>
Wed, 6 Apr 2005 07:52:28 +0000 (07:52 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_KnuthStylePageBreaking@198565 13f79535-47bb-0310-9956-ffa450edef68

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

index 07e07f7cb0e55432bec5ec4dc8d3b927e8eca2fe..8b0e020eccc27a70762a08802da3ae217fab8e84 100644 (file)
@@ -385,6 +385,16 @@ public class Cell extends BlockStackingLayoutManager implements BlockLevelLayout
         this.inRowIPDOffset = off;
     }
     
+    /**
+     * Set the content height for this cell. This method is used during
+     * addAreas() stage.
+     *
+     * @param h the height of the contents of this cell
+     */
+    public void setContentHeight(int h) {
+        usedBPD = h;
+    }
+    
     /**
      * Set the row height that contains this cell. This method is used during
      * addAreas() stage.
index b2a949bb6e17e7f416facca21d636b72d3121182..35223d36f0436ebbf31d6f28ac0f90b01eaa0935 100644 (file)
@@ -320,6 +320,7 @@ public class TableContentLayoutManager {
         PrimaryGridUnit[] gridUnits = new PrimaryGridUnit[colCount];
         int[] start = new int[colCount];
         int[] end = new int[colCount];
+        int[] partLength = new int[colCount];
         
         //Iterate over all steps
         while (parentIter.hasNext()) {
@@ -356,6 +357,7 @@ public class TableContentLayoutManager {
                                 + start[i] + "-" + end[i]);
                         int len = calcCellHeightFromContents(
                                 gridUnits[i].getElements(), start[i], end[i]);
+                        partLength[i] = len;
                         log.debug("len of part: " + len);
                         maxLen = Math.max(maxLen, len);
                         maxLen = Math.max(maxLen, getExplicitCellHeight(gridUnits[i]));
@@ -368,7 +370,7 @@ public class TableContentLayoutManager {
                         log.debug("flushing..." + i + " " 
                                 + start[i] + "-" + end[i]);
                         addAreasForCell(gridUnits[i], start[i], end[i], 
-                                layoutContext, lastRow, yoffset, maxLen);
+                                layoutContext, lastRow, yoffset, partLength[i], maxLen);
                         gridUnits[i] = null;
                         start[i] = 0;
                         end[i] = 0;
@@ -382,6 +384,7 @@ public class TableContentLayoutManager {
             if (gridUnits[i] != null) {
                 int len = calcCellHeightFromContents(
                         gridUnits[i].getElements(), start[i], end[i]);
+                partLength[i] = len;
                 log.debug("len of part: " + len);
                 maxLen = Math.max(maxLen, len);
                 maxLen = Math.max(maxLen, getExplicitCellHeight(gridUnits[i]));
@@ -391,7 +394,7 @@ public class TableContentLayoutManager {
             if (gridUnits[i] != null) {
                 log.debug("final flushing " + i + " " + start[i] + "-" + end[i]);
                 addAreasForCell(gridUnits[i], start[i], end[i], 
-                        layoutContext, lastRow, yoffset, maxLen);
+                        layoutContext, lastRow, yoffset, partLength[i], maxLen);
             }
         }
         
@@ -413,10 +416,11 @@ public class TableContentLayoutManager {
     
     private void addAreasForCell(PrimaryGridUnit gu, int start, int end, 
             LayoutContext layoutContext, TableRowIterator.EffRow row, 
-            int yoffset, int rowHeight) {
+            int yoffset, int contentHeight, int rowHeight) {
         Cell cellLM = gu.getCellLM();
         cellLM.setXOffset(getXOffsetOfGridUnit(gu));
         cellLM.setYOffset(yoffset);
+        cellLM.setContentHeight(contentHeight);
         cellLM.setRowHeight(rowHeight);
         //cellLM.setRowHeight(row.getHeight().opt);
         cellLM.addAreas(new KnuthPossPosIter(gu.getElements(),