From: Vincent Hennebert Date: Wed, 13 Feb 2008 20:10:01 +0000 (+0000) Subject: Moved to the FO tree stage the check for break-before/after on table-row while spanni... X-Git-Tag: fop-0_95beta~71 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=40f03bc5a0233f5081acae13cc55f26e91714790;p=xmlgraphics-fop.git Moved to the FO tree stage the check for break-before/after on table-row while spanning in progress, and fixed bug #44321 as well git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@627576 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/fo/FONode.java b/src/java/org/apache/fop/fo/FONode.java index 7c517e418..f0422e414 100644 --- a/src/java/org/apache/fop/fo/FONode.java +++ b/src/java/org/apache/fop/fo/FONode.java @@ -360,7 +360,7 @@ public abstract class FONode implements Cloneable { * (e.g., currently unsupported properties) * @param problem text to display that indicates the problem */ - protected void attributeWarning(String problem) { + public void attributeWarning(String problem) { log.warn(warningText(locator) + getName() + ", " + problem); } diff --git a/src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java b/src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java index b0126dff0..62cf3e26d 100644 --- a/src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java +++ b/src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java @@ -23,6 +23,7 @@ import java.util.ArrayList; import java.util.List; import java.util.ListIterator; +import org.apache.fop.fo.Constants; import org.apache.fop.fo.ValidationException; @@ -115,7 +116,24 @@ class FixedColRowGroupBuilder extends RowGroupBuilder { } /** {@inheritDoc} */ - void endRow(TableCellContainer container) { + void endRow(TableRow row) { + if (currentRowIndex > 0 && row.getBreakBefore() != Constants.EN_AUTO) { + row.attributeWarning("break-before ignored because of row spanning " + + "in progress (See XSL 1.1, 7.20.2)"); + } + if (currentRowIndex < rows.size() - 1 && row.getBreakAfter() != Constants.EN_AUTO) { + row.attributeWarning("break-after ignored because of row spanning " + + "in progress (See XSL 1.1, 7.20.1)"); + } + handleRowEnd(row); + } + + /** {@inheritDoc} */ + void endRow(TableBody body) { + handleRowEnd(body); + } + + private void handleRowEnd(TableCellContainer container) { List currentRow = (List) rows.get(currentRowIndex); lastRow = currentRow; // Fill gaps with empty grid units diff --git a/src/java/org/apache/fop/fo/flow/table/RowGroupBuilder.java b/src/java/org/apache/fop/fo/flow/table/RowGroupBuilder.java index f25886581..3f7549787 100644 --- a/src/java/org/apache/fop/fo/flow/table/RowGroupBuilder.java +++ b/src/java/org/apache/fop/fo/flow/table/RowGroupBuilder.java @@ -58,12 +58,23 @@ abstract class RowGroupBuilder { /** * Receives notification of the end of the current row. If the current row finishes * the row group, the {@link TableBody#addRowGroup(List)} method of the parent table - * part (i.e., the given container itself or its parent if this is a table-row) will - * be called + * part will be called. * - * @param container the parent element of the current row + * @param row the row being finished */ - abstract void endRow(TableCellContainer container); + abstract void endRow(TableRow row); + + /** + * Receives notification of the end of the current row, when the source contains no + * fo:table-row element. If the current row finishes the row group, the + * {@link TableBody#addRowGroup(List)} method of the given table part will be called. + * + *

If the source does contain explicit fo:table-row elements, then the + * {@link #endRow(TableRow)} method will be called instead.

+ * + * @param part the part containing the current row + */ + abstract void endRow(TableBody part); /** * Receives notification of the start of a table-header/footer/body. diff --git a/src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java b/src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java index 47c96dcca..801153ce9 100644 --- a/src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java +++ b/src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java @@ -73,10 +73,19 @@ class VariableColRowGroupBuilder extends RowGroupBuilder { } /** {@inheritDoc} */ - void endRow(final TableCellContainer container) { + void endRow(final TableRow row) { events.add(new Event() { public void play(RowGroupBuilder rowGroupBuilder) { - rowGroupBuilder.endRow(container); + rowGroupBuilder.endRow(row); + } + }); + } + + /** {@inheritDoc} */ + void endRow(final TableBody part) { + events.add(new Event() { + public void play(RowGroupBuilder rowGroupBuilder) { + rowGroupBuilder.endRow(part); } }); } diff --git a/src/java/org/apache/fop/layoutmgr/table/TableStepper.java b/src/java/org/apache/fop/layoutmgr/table/TableStepper.java index 0b494bf2d..2560b3aac 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableStepper.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableStepper.java @@ -26,11 +26,9 @@ import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.fop.fo.Constants; -import org.apache.fop.fo.FONode; import org.apache.fop.fo.flow.table.EffRow; import org.apache.fop.fo.flow.table.GridUnit; import org.apache.fop.fo.flow.table.PrimaryGridUnit; -import org.apache.fop.fo.flow.table.TableRow; import org.apache.fop.layoutmgr.BreakElement; import org.apache.fop.layoutmgr.KnuthBox; import org.apache.fop.layoutmgr.KnuthGlue; @@ -456,20 +454,8 @@ public class TableStepper { */ private void prepareNextRow() { if (activeRowIndex < rowGroup.length - 1) { - TableRow rowFO = rowGroup[activeRowIndex].getTableRow(); - if (rowFO != null && rowFO.getBreakAfter() != Constants.EN_AUTO) { - log.warn(FONode.decorateWithContextInfo( - "break-after ignored on table-row because of row spanning " - + "in progress (See XSL 1.0, 7.19.1)", rowFO)); - } previousRowsLength += rowGroup[activeRowIndex].getHeight().opt; activateCells(nextActiveCells, activeRowIndex + 1); - rowFO = rowGroup[activeRowIndex + 1].getTableRow(); - if (rowFO != null && rowFO.getBreakBefore() != Constants.EN_AUTO) { - log.warn(FONode.decorateWithContextInfo( - "break-before ignored on table-row because of row spanning " - + "in progress (See XSL 1.0, 7.19.2)", rowFO)); - } if (log.isTraceEnabled()) { log.trace("Computing first step for row " + (activeRowIndex + 2)); } diff --git a/status.xml b/status.xml index 367bdf58d..7926fe379 100644 --- a/status.xml +++ b/status.xml @@ -28,6 +28,10 @@ + + Moved to the FO tree stage the check for break-before/after on table-row while spanning in + progress. + Added full support for breaks before and after table cells (that is, break-before/after set on the first/last child of a cell). diff --git a/test/layoutengine/standard-testcases/table-row_break-inside-span.xml b/test/layoutengine/standard-testcases/table-row_break-inside-span.xml index 9918ec5ed..d55921e57 100644 --- a/test/layoutengine/standard-testcases/table-row_break-inside-span.xml +++ b/test/layoutengine/standard-testcases/table-row_break-inside-span.xml @@ -20,7 +20,7 @@

This test checks breaks on tables. Breaks on table-row during row spanning are ignored - (XSL 1.0, 7.19.1 and 7.19.2). + (XSL 1.1, 7.20.1 and 7.20.2).

@@ -33,10 +33,10 @@ - - + - + cell1 line 1 cell1 line 2