]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
added table header and footer
authorKeiron Liddle <keiron@apache.org>
Thu, 28 Nov 2002 13:04:51 +0000 (13:04 +0000)
committerKeiron Liddle <keiron@apache.org>
Thu, 28 Nov 2002 13:04:51 +0000 (13:04 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@195641 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
src/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
src/org/apache/fop/layoutmgr/table/Cell.java
src/org/apache/fop/layoutmgr/table/TableLayoutManager.java

index 73db239dd90ff2d1553f9dd54b7229295e83634f..95335b4b16d34224186093abb1c502768b4d0d42 100644 (file)
@@ -104,6 +104,7 @@ public class ListBlockLayoutManager extends BlockStackingLayoutManager {
                         } else {
                             curLM.resetPosition(null);
                         }
+                        over = true;
                         break;
                     }
                     stackSize.add(bp.getStackingSize());
index 2b76a860d16e2a1e7f5897db0a0f0e3a5abf1aa6..b7a3219be9b38706e102658c505f552cb2c5b96c 100644 (file)
@@ -135,6 +135,7 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager {
                         } else {
                             curLM.resetPosition(null);
                         }
+                        over = true;
                         break;
                     } else {
                         lastPos = bp;
index c0e00da2d0d8d74a9625dd209fdcb417db1ee6c6..f590d45c57ad198864d4355b13fe65630a8ddfcf 100644 (file)
@@ -258,6 +258,7 @@ public class Cell extends BlockStackingLayoutManager {
     public void resetPosition(Position resetPos) {
         if (resetPos == null) {
             reset(null);
+            childBreaks.clear();
         }
     }
 }
index 45672fffed65fd9e79c14a4eaddf2f1bccbc0ec5..db0864afc65ebb98dde26111f4243f1d4c149f32 100644 (file)
@@ -86,6 +86,7 @@ public class TableLayoutManager extends BlockStackingLayoutManager {
      */
     public void setTableHeader(Body th) {
         tableHeader = th;
+        tableHeader.setParentLM(this);
     }
 
     /**
@@ -95,6 +96,7 @@ public class TableLayoutManager extends BlockStackingLayoutManager {
      */
     public void setTableFooter(Body tf) {
         tableFooter = tf;
+        tableFooter.setParentLM(this);
     }
 
     /**
@@ -115,14 +117,26 @@ public class TableLayoutManager extends BlockStackingLayoutManager {
 
         MinOptMax headerSize = null;
         if (tableHeader != null) {
+            tableHeader.resetPosition(null);
             headerBreak = getHeight(tableHeader, context);
             headerSize = headerBreak.getStackingSize();
+            stackSize.add(headerSize);
         }
 
         MinOptMax footerSize = null;
         if (tableFooter != null) {
+            tableFooter.resetPosition(null);
             footerBreak = getHeight(tableFooter, context);
             footerSize = footerBreak.getStackingSize();
+            stackSize.add(footerSize);
+        }
+
+        if (stackSize.opt > context.getStackLimit().max) {
+            BreakPoss breakPoss = new BreakPoss(
+                                    new LeafPosition(this, 0));
+            breakPoss.setFlag(BreakPoss.NEXT_OVERFLOWS, true);
+            breakPoss.setStackingSize(stackSize);
+            return breakPoss;
         }
 
         while ((curLM = (Body)getChildLM()) != null) {
@@ -213,7 +227,6 @@ public class TableLayoutManager extends BlockStackingLayoutManager {
                                new SectionPosition(this, breaks.size() - 1, breaks));
         breakPoss.setStackingSize(stackSize);
         return breakPoss;
-
     }
 
     /**
@@ -230,13 +243,22 @@ public class TableLayoutManager extends BlockStackingLayoutManager {
 
         // add column, body then row areas
 
-        // add table header areas
-
         int tableHeight = 0;
-
         Body childLM;
-        int iStartPos = 0;
         LayoutContext lc = new LayoutContext(0);
+
+        // add table header areas
+        if (headerBreak != null) {
+            SectionPosition pos = (SectionPosition)headerBreak.getPosition();
+            List list = pos.list;
+            PositionIterator breakPosIter = new BreakPossPosIter(list, 0, list.size() + 1);
+            while ((childLM = (Body)breakPosIter.getNextChildLM()) != null) {
+                childLM.addAreas(breakPosIter, lc);
+                tableHeight += childLM.getBodyHeight();
+            }
+        }
+
+        int iStartPos = 0;
         while (parentIter.hasNext()) {
             LeafPosition lfp = (LeafPosition) parentIter.next();
             // Add the block areas to Area
@@ -245,12 +267,23 @@ public class TableLayoutManager extends BlockStackingLayoutManager {
                                    lfp.getLeafPos() + 1);
             iStartPos = lfp.getLeafPos() + 1;
             while ((childLM = (Body)breakPosIter.getNextChildLM()) != null) {
+                childLM.setYOffset(tableHeight);
                 childLM.addAreas(breakPosIter, lc);
                 tableHeight += childLM.getBodyHeight();
             }
         }
 
         // add footer areas
+        if (footerBreak != null) {
+            SectionPosition pos = (SectionPosition)footerBreak.getPosition();
+            List list = pos.list;
+            PositionIterator breakPosIter = new BreakPossPosIter(list, 0, list.size() + 1);
+            while ((childLM = (Body)breakPosIter.getNextChildLM()) != null) {
+                childLM.setYOffset(tableHeight);
+                childLM.addAreas(breakPosIter, lc);
+                tableHeight += childLM.getBodyHeight();
+            }
+        }
 
         curBlockArea.setHeight(tableHeight);