From: Keiron Liddle Date: Thu, 28 Nov 2002 13:04:51 +0000 (+0000) Subject: added table header and footer X-Git-Tag: Alt-Design-integration-base~299 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ab5116ffd2d1d3d04c98e7df50f4d4e5396d8bfa;p=xmlgraphics-fop.git added table header and footer git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@195641 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java b/src/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java index 73db239dd..95335b4b1 100644 --- a/src/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java @@ -104,6 +104,7 @@ public class ListBlockLayoutManager extends BlockStackingLayoutManager { } else { curLM.resetPosition(null); } + over = true; break; } stackSize.add(bp.getStackingSize()); diff --git a/src/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java b/src/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java index 2b76a860d..b7a3219be 100644 --- a/src/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java @@ -135,6 +135,7 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager { } else { curLM.resetPosition(null); } + over = true; break; } else { lastPos = bp; diff --git a/src/org/apache/fop/layoutmgr/table/Cell.java b/src/org/apache/fop/layoutmgr/table/Cell.java index c0e00da2d..f590d45c5 100644 --- a/src/org/apache/fop/layoutmgr/table/Cell.java +++ b/src/org/apache/fop/layoutmgr/table/Cell.java @@ -258,6 +258,7 @@ public class Cell extends BlockStackingLayoutManager { public void resetPosition(Position resetPos) { if (resetPos == null) { reset(null); + childBreaks.clear(); } } } diff --git a/src/org/apache/fop/layoutmgr/table/TableLayoutManager.java b/src/org/apache/fop/layoutmgr/table/TableLayoutManager.java index 45672fffe..db0864afc 100644 --- a/src/org/apache/fop/layoutmgr/table/TableLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/table/TableLayoutManager.java @@ -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);