From 47e43d9be9f76e2aac90754f8d2d1cb59e278d82 Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Fri, 11 Feb 2005 10:45:24 +0000 Subject: [PATCH] Implemented table-omit-header-at-break. The same for footers comes later when page breaking is revisited. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198418 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/fo/flow/Table.java | 10 ++++++++++ .../fop/layoutmgr/table/TableLayoutManager.java | 16 +++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/java/org/apache/fop/fo/flow/Table.java b/src/java/org/apache/fop/fo/flow/Table.java index d82a14631..15b402fa6 100644 --- a/src/java/org/apache/fop/fo/flow/Table.java +++ b/src/java/org/apache/fop/fo/flow/Table.java @@ -179,6 +179,16 @@ public class Table extends FObj { public TableBody getTableFooter() { return tableFooter; } + + /** @return true if the table-header should be omitted at breaks */ + public boolean omitHeaderAtBreak() { + return (this.tableOmitHeaderAtBreak == EN_TRUE); + } + + /** @return true if the table-footer should be omitted at breaks */ + public boolean omitFooterAtBreak() { + return (this.tableOmitFooterAtBreak == EN_TRUE); + } /** * @return the "inline-progression-dimension" property. diff --git a/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java index 0a2a767de..c2778fce7 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java @@ -57,6 +57,7 @@ public class TableLayoutManager extends BlockStackingLayoutManager { private List bodyBreaks = new java.util.ArrayList(); private BreakPoss headerBreak; private BreakPoss footerBreak; + private boolean firstRowHandled = false; private int referenceIPD; private boolean autoLayout = true; @@ -185,13 +186,17 @@ public class TableLayoutManager extends BlockStackingLayoutManager { //Calculate the headers and footers only when needed MinOptMax headerSize = null; if (getTable().getTableHeader() != null) { - Body tableHeader = new Body(getTable().getTableHeader()); - tableHeader.setParent(this); - headerBreak = getHeight(tableHeader, context); - headerSize = headerBreak.getStackingSize(); - stackSize.add(headerSize); + if (!getTable().omitHeaderAtBreak() || !firstRowHandled) { + Body tableHeader = new Body(getTable().getTableHeader()); + tableHeader.setParent(this); + headerBreak = getHeight(tableHeader, context); + headerSize = headerBreak.getStackingSize(); + stackSize.add(headerSize); + } } + //TODO Implement table-omit-footer-at-break once the page breaking + //is improved, so we don't have to do this twice MinOptMax footerSize = null; if (getTable().getTableFooter() != null) { Body tableFooter = new Body(getTable().getTableFooter()); @@ -244,6 +249,7 @@ public class TableLayoutManager extends BlockStackingLayoutManager { stackSize.add(bp.getStackingSize()); lastPos = bp; bodyBreaks.add(bp); + firstRowHandled = true; if (bp.nextBreakOverflows()) { over = true; -- 2.39.5