Author: ssteiner Date: Fri Feb 6 15:48:44 2015 New Revision: 1657872 URL: http://svn.apache.org/r1657872 Log: FOP-2443: Repeated Table headers and footers with markers are not being treated as artifacts
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LocalBreaker.java xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LocalBreaker.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LocalBreaker.java?rev=1657872&r1=1657871&r2=1657872&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LocalBreaker.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LocalBreaker.java Fri Feb 6 15:48:44 2015 @@ -31,6 +31,17 @@ public abstract class LocalBreaker exten private int displayAlign; private int ipd; private int overflow; + private boolean repeatedHeader; + private boolean isDescendantOfTableFooter; + private boolean repeatedFooter; + + public void setRepeatedFooter(boolean repeatedFooter) { + this.repeatedFooter = repeatedFooter; + } + + public void setDescendantOfTableFooter(boolean isDescendantOfTableFooter) { + this.isDescendantOfTableFooter = isDescendantOfTableFooter; + } public LocalBreaker(BlockStackingLayoutManager lm, int ipd, int displayAlign) { this.lm = lm; @@ -38,6 +49,10 @@ public abstract class LocalBreaker exten this.displayAlign = displayAlign; } + public void setRepeatedHeader(boolean repeatedHeader) { + this.repeatedHeader = repeatedHeader; + } + /** {@inheritDoc} */ protected boolean isPartOverflowRecoveryActivated() { // For side regions, this must be disabled because of wanted overflow. @@ -109,6 +124,15 @@ public abstract class LocalBreaker exten } protected void addAreas(PositionIterator posIter, LayoutContext context) { + if (isDescendantOfTableFooter) { + if (repeatedHeader) { + context.setTreatAsArtifact(true); + } + } else { + if (repeatedFooter) { + context.setTreatAsArtifact(true); + } + } AreaAdditionUtil.addAreas(lm, posIter, context); } Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java?rev=1657872&r1=1657871&r2=1657872&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java Fri Feb 6 15:48:44 2015 @@ -88,6 +88,7 @@ public class TableCellLayoutManager exte private boolean isDescendantOfTableFooter; private boolean isDescendantOfTableHeader; private boolean hasRetrieveTableMarker; + private boolean hasRepeatedHeader; // place holder for the addAreas arguments private boolean savedAddAreasArguments; @@ -140,6 +141,9 @@ public class TableCellLayoutManager exte return getTableCell().getTable(); } + public void setHasRepeatedHeader(boolean hasRepeatedHeader) { + this.hasRepeatedHeader = hasRepeatedHeader; + } /** {@inheritDoc} */ protected int getIPIndents() { @@ -534,6 +538,12 @@ public class TableCellLayoutManager exte recreateChildrenLMs(); int displayAlign = ((TableCell) this.getFObj()).getDisplayAlign(); TableCellBreaker breaker = new TableCellBreaker(this, cellIPD, displayAlign); + breaker.setDescendantOfTableFooter(isDescendantOfTableHeader); + if (isDescendantOfTableHeader) { + breaker.setRepeatedHeader(hasRepeatedHeader); + } else { + breaker.setRepeatedFooter(layoutContext.treatAsArtifact()); + } breaker.doLayout(usedBPD, false); // this is needed so the next time the LMs are recreated they look like the originals; this // is due to the fact that during the doLayout() above the FO tree changes when the Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java?rev=1657872&r1=1657871&r2=1657872&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java Fri Feb 6 15:48:44 2015 @@ -78,6 +78,7 @@ public class TableContentLayoutManager i private TableStepper stepper; private boolean headerIsBeingRepeated; + private boolean atLeastOnce; /** * Main constructor @@ -478,7 +479,9 @@ public class TableContentLayoutManager i // if there are TCLMs saved because they have a RetrieveTableMarker, we repeat the header areas now; // this can also be done after the areas for the footer are added but should be the same as here + tableLM.setRepeateHeader(atLeastOnce); tableLM.repeatAddAreasForSavedTableHeaderTableCellLayoutManagers(); + atLeastOnce = true; if (footerElements != null) { boolean ancestorTreatAsArtifact = layoutContext.treatAsArtifact(); Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java?rev=1657872&r1=1657871&r2=1657872&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java Fri Feb 6 15:48:44 2015 @@ -99,6 +99,8 @@ public class TableLayoutManager extends private boolean hasRetrieveTableMarker; + private boolean repeatedHeader; + private List<List<KnuthElement>> headerFootnotes = Collections.emptyList(); private List<List<KnuthElement>> footerFootnotes = Collections.emptyList(); @@ -558,6 +560,9 @@ public class TableLayoutManager extends areAllTCLMsSaved = true; for (int i = 0; i < savedTCLMs.size(); i++) { TableCellLayoutManager tclm = savedTCLMs.get(i); + if (this.repeatedHeader) { + tclm.setHasRepeatedHeader(true); + } tclm.repeatAddAreas(); } } @@ -652,6 +657,10 @@ public class TableLayoutManager extends this.footerFootnotes = footnotes; } + public void setRepeateHeader(boolean repeateHeader) { + this.repeatedHeader = repeateHeader; + } + List<List<KnuthElement>> getFooterFootnotes() { return footerFootnotes; } --------------------------------------------------------------------- To unsubscribe, e-mail: fop-commits-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-commits-h...@xmlgraphics.apache.org