]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Moved to the FO tree stage the check for break-before/after on table-row while spanni...
authorVincent Hennebert <vhennebert@apache.org>
Wed, 13 Feb 2008 20:10:01 +0000 (20:10 +0000)
committerVincent Hennebert <vhennebert@apache.org>
Wed, 13 Feb 2008 20:10:01 +0000 (20:10 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@627576 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/fo/FONode.java
src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java
src/java/org/apache/fop/fo/flow/table/RowGroupBuilder.java
src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java
src/java/org/apache/fop/layoutmgr/table/TableStepper.java
status.xml
test/layoutengine/standard-testcases/table-row_break-inside-span.xml

index 7c517e418b2e7882ccc84596b4c24600c62c84f2..f0422e4140e18f787b451f5a32e315462e48e648 100644 (file)
@@ -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);
     }
 
index b0126dff0a6760afbcb889547eacba5c45d04437..62cf3e26de203f6c5bdfa9e21312c7be1374256d 100644 (file)
@@ -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
index f258865819de84a3c0aec425c12bb53fce381779..3f7549787682849a9ff39db4eb2b957d2d4517a1 100644 (file)
@@ -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.
+     * 
+     * <p>If the source does contain explicit fo:table-row elements, then the
+     * {@link #endRow(TableRow)} method will be called instead.</p>
+     * 
+     * @param part the part containing the current row
+     */
+    abstract void endRow(TableBody part);
 
     /**
      * Receives notification of the start of a table-header/footer/body.
index 47c96dccaaa598ee8e08c9f782efff77892bf215..801153ce9e667ac8d8e8b3fed1a1cae7a8ceb9bd 100644 (file)
@@ -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);
             }
         });
     }
index 0b494bf2d8a8bfa88722e932ae114f31130d8387..2560b3aac3f3c46515fa514f556d8b8e1516566b 100644 (file)
@@ -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));
             }
index 367bdf58d23f242a3a39b69a830a5f868120a444..7926fe379ee433f983b577de60ced079fd861852 100644 (file)
 
   <changes>
     <release version="FOP Trunk">
+      <action context="Layout" dev="VH" type="fix" fixes-bug="44321">
+        Moved to the FO tree stage the check for break-before/after on table-row while spanning in
+        progress.
+      </action>
       <action context="Layout" dev="VH" type="add">
         Added full support for breaks before and after table cells (that is, break-before/after set
         on the first/last child of a cell).
index 9918ec5edc827ef5544ffd6d0e848e38d3e7fc69..d55921e570aa585e350ab20c0e11292adde2da24 100644 (file)
@@ -20,7 +20,7 @@
   <info>
     <p>
       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).
     </p>
   </info>
   <fo>
       <fo:page-sequence master-reference="normal" white-space-collapse="true">
         <fo:flow flow-name="xsl-region-body">
           <fo:table table-layout="fixed" width="100%">
-            <fo:table-column/>
-            <fo:table-column/>
+            <fo:table-column column-width="proportional-column-width(1)"
+              number-columns-repeated="2"/>
             <fo:table-body>
-              <fo:table-row>
+              <fo:table-row break-after="page">
                 <fo:table-cell number-rows-spanned="2" background-color="orange">
                   <fo:block>cell1 line 1</fo:block>
                   <fo:block>cell1 line 2</fo:block>