diff options
Diffstat (limited to 'src/java/org/apache/fop/layoutmgr/table')
6 files changed, 23 insertions, 8 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java index f41f77ea4..ed46d2199 100644 --- a/src/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java @@ -112,7 +112,7 @@ class RowGroupLayoutManager { spanWidth += ((TableColumn) colIter.next()).getColumnWidth().getValue( tableLM); } - LayoutContext childLC = new LayoutContext(0); + LayoutContext childLC = LayoutContext.newInstance(); childLC.setStackLimitBP(context.getStackLimitBP()); //necessary? childLC.setRefIPD(spanWidth); diff --git a/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java index fc35a8069..0582a0283 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java @@ -81,7 +81,7 @@ public class TableAndCaptionLayoutManager extends BlockStackingLayoutManager { int ipd = context.getRefIPD(); BreakPoss bp; - LayoutContext childLC = new LayoutContext(0); + LayoutContext childLC = LayoutContext.newInstance(); // if line layout manager then set stack limit to ipd // line LM actually generates a LineArea which is a block childLC.setStackLimit( @@ -145,7 +145,7 @@ public class TableAndCaptionLayoutManager extends BlockStackingLayoutManager { /* TODO: Reimplement using Knuth approach LayoutManager childLM; int iStartPos = 0; - LayoutContext lc = new LayoutContext(0); + LayoutContext lc = LayoutContext.newInstance(); while (parentIter.hasNext()) { LeafPosition lfp = (LeafPosition) parentIter.next(); // Add the block areas to Area diff --git a/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java index 7ba0b5970..66f7ad9f2 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java @@ -76,7 +76,7 @@ public class TableCaptionLayoutManager extends BlockStackingLayoutManager { int ipd = context.getRefIPD(); BreakPoss bp; - LayoutContext childLC = new LayoutContext(0); + LayoutContext childLC = LayoutContext.newInstance(); // if line layout manager then set stack limit to ipd // line LM actually generates a LineArea which is a block childLC.setStackLimit( @@ -141,7 +141,7 @@ public class TableCaptionLayoutManager extends BlockStackingLayoutManager { /* TODO: Reimplement using Knuth approach LayoutManager childLM; int iStartPos = 0; - LayoutContext lc = new LayoutContext(0); + LayoutContext lc = LayoutContext.newInstance(); while (parentIter.hasNext()) { LeafPosition lfp = (LeafPosition) parentIter.next(); // Add the block areas to Area diff --git a/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java index d5f259b38..2ca5a26d1 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java @@ -144,7 +144,7 @@ public class TableCellLayoutManager extends BlockStackingLayoutManager LayoutManager curLM; // currently active LM LayoutManager prevLM = null; // previously active LM while ((curLM = getChildLM()) != null) { - LayoutContext childLC = new LayoutContext(0); + LayoutContext childLC = LayoutContext.newInstance(); // curLM is a ? childLC.setStackLimitBP(context.getStackLimitBP().minus(stackLimit)); childLC.setRefIPD(cellIPD); diff --git a/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java index f5e7500e2..ea8774716 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java @@ -71,6 +71,8 @@ public class TableContentLayoutManager implements PercentBaseContext { private TableStepper stepper; + private boolean headerIsBeingRepeated; + /** * Main constructor * @param parent Parent layout manager @@ -383,6 +385,7 @@ public class TableContentLayoutManager implements PercentBaseContext { } } } + boolean treatFooterAsArtifact = layoutContext.treatAsArtifact(); if (lastPos instanceof TableHFPenaltyPosition) { TableHFPenaltyPosition penaltyPos = (TableHFPenaltyPosition)lastPos; LOG.debug("Break at penalty!"); @@ -393,6 +396,7 @@ public class TableContentLayoutManager implements PercentBaseContext { } if (penaltyPos.footerElements != null) { footerElements = penaltyPos.footerElements; + treatFooterAsArtifact = true; } } @@ -403,10 +407,18 @@ public class TableContentLayoutManager implements PercentBaseContext { } if (headerElements != null) { + boolean ancestorTreatAsArtifact = layoutContext.treatAsArtifact(); + if (headerIsBeingRepeated) { + layoutContext.setTreatAsArtifact(true); + } //header positions for the last part are the second-to-last element and need to //be handled first before all other TableContentPositions addHeaderFooterAreas(headerElements, tableLM.getTable().getTableHeader(), painter, false); + if (!ancestorTreatAsArtifact) { + headerIsBeingRepeated = true; + } + layoutContext.setTreatAsArtifact(ancestorTreatAsArtifact); } if (tablePositions.isEmpty()) { @@ -419,9 +431,12 @@ public class TableContentLayoutManager implements PercentBaseContext { } if (footerElements != null) { + boolean ancestorTreatAsArtifact = layoutContext.treatAsArtifact(); + layoutContext.setTreatAsArtifact(treatFooterAsArtifact); //Positions for footers are simply added at the end addHeaderFooterAreas(footerElements, tableLM.getTable().getTableFooter(), painter, true); + layoutContext.setTreatAsArtifact(ancestorTreatAsArtifact); } this.usedBPD += painter.getAccumulatedBPD(); diff --git a/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java index 7e343697a..5a4152c69 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java @@ -242,7 +242,7 @@ public class TableLayoutManager extends BlockStackingLayoutManager // Elements for the table-header/footer/body List contentKnuthElements; contentLM = new TableContentLayoutManager(this); - LayoutContext childLC = new LayoutContext(0); + LayoutContext childLC = LayoutContext.newInstance(); /* childLC.setStackLimit( MinOptMax.subtract(context.getStackLimit(), @@ -355,7 +355,7 @@ public class TableLayoutManager extends BlockStackingLayoutManager // BPD of the table, i.e., height of its content; table's borders and paddings not counted int tableHeight = 0; //Body childLM; - LayoutContext lc = new LayoutContext(0); + LayoutContext lc = LayoutContext.offspringOf(layoutContext); lc.setRefIPD(getContentAreaIPD()); |