You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ke...@apache.org on 2001/02/19 01:17:44 UTC

cvs commit: xml-fop/src/org/apache/fop/fo/flow TableBody.java TableRow.java

keiron      01/02/18 16:17:44

  Modified:    src/org/apache/fop/fo/flow TableBody.java TableRow.java
  Log:
  adds break before and break after for table rows
  also reports error if the number of columns the cells
  are using is different to the number of columns in the
  table
  
  Revision  Changes    Path
  1.27      +11 -1     xml-fop/src/org/apache/fop/fo/flow/TableBody.java
  
  Index: TableBody.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/TableBody.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- TableBody.java	2001/02/10 03:31:22	1.26
  +++ TableBody.java	2001/02/19 00:17:41	1.27
  @@ -1,4 +1,4 @@
  -/*-- $Id: TableBody.java,v 1.26 2001/02/10 03:31:22 arved Exp $ --
  +/*-- $Id: TableBody.java,v 1.27 2001/02/19 00:17:41 keiron Exp $ --
   
    ============================================================================
   									 The Apache Software License, Version 1.1
  @@ -210,6 +210,16 @@
   
   						Status status;
   						if ((status = row.layout(areaContainer)).isIncomplete()) {
  +								if(status.isPageBreak()) {
  +								this.marker = i;
  +										area.addChild(areaContainer);
  +										//areaContainer.end();
  +
  +										area.increaseHeight(areaContainer.getHeight());
  +										area.setAbsoluteHeight(
  +											areaContainer.getAbsoluteHeight());
  +								return status;
  +								}
   								if (keepWith.size() > 0) { // && status.getCode() == Status.AREA_FULL_NONE
   										row.removeLayout(areaContainer);
   										for (Enumeration e = keepWith.elements();
  
  
  
  1.36      +48 -1     xml-fop/src/org/apache/fop/fo/flow/TableRow.java
  
  Index: TableRow.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/TableRow.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- TableRow.java	2001/02/10 03:32:05	1.35
  +++ TableRow.java	2001/02/19 00:17:42	1.36
  @@ -1,4 +1,4 @@
  -/*-- $Id: TableRow.java,v 1.35 2001/02/10 03:32:05 arved Exp $ --
  +/*-- $Id: TableRow.java,v 1.36 2001/02/19 00:17:42 keiron Exp $ --
   
    ============================================================================
   									 The Apache Software License, Version 1.1
  @@ -80,6 +80,8 @@
   		FontState fs;
   		int spaceBefore;
   		int spaceAfter;
  +		int breakBefore;
  +		int breakAfter;
   		ColorType backgroundColor;
   		String id;
   
  @@ -273,6 +275,9 @@
   														 "space-before.optimum").getLength().mvalue();
   				this.spaceAfter = this.properties.get(
   														"space-after.optimum").getLength().mvalue();
  +						this.breakBefore =
  +							this.properties.get("break-before").getEnum();
  +						this.breakAfter = this.properties.get("break-after").getEnum();
   				this.backgroundColor =
   					this.properties.get("background-color").getColorType();
   				this.borderTopColor =
  @@ -378,6 +383,21 @@
   
   
   						this.marker = 0;
  +						if (breakBefore == BreakBefore.PAGE) {
  +								return new Status(Status.FORCE_PAGE_BREAK);
  +						}
  +
  +						if (breakBefore == BreakBefore.ODD_PAGE) {
  +								return new Status(Status.FORCE_PAGE_BREAK_ODD);
  +						}
  +
  +						if (breakBefore == BreakBefore.EVEN_PAGE) {
  +								return new Status(Status.FORCE_PAGE_BREAK_EVEN);
  +						}
  +
  +						if (breakBefore == BreakBefore.COLUMN) {
  +								return new Status(Status.FORCE_COLUMN_BREAK);
  +						}
   				}
   
   				if ((spaceBefore != 0) && (this.marker == 0)) {
  @@ -431,6 +451,10 @@
   								state.setColumn(colCount);
   								// add the state of a cell.
   								cells.insertElementAt(state, i);
  +								if(colCount + numCols > columns.size()) {
  +									MessageHandler.errorln("WARNING: Number of cell columns under table-row not equal to number of table-columns");
  +									return new Status(Status.OK);
  +								}
   								for (int count = 0;
   												count < numCols && count < columns.size();
   												count++) {
  @@ -443,6 +467,10 @@
   								widthOfCellsSoFar += width;
   
   						}
  +						if(colCount < columns.size()) {
  +							MessageHandler.errorln("WARNING: Number of cell columns under table-row not equal to number of table-columns");
  +							return new Status(Status.OK);
  +						}
   				}
   
   				int numChildren = this.children.size();
  @@ -588,6 +616,25 @@
   				if (someCellDidNotLayoutCompletely) {
   						return new Status(Status.AREA_FULL_SOME);
   				} else {
  +				if (breakAfter == BreakAfter.PAGE) {
  +						this.marker = BREAK_AFTER;
  +						return new Status(Status.FORCE_PAGE_BREAK);
  +				}
  +
  +				if (breakAfter == BreakAfter.ODD_PAGE) {
  +						this.marker = BREAK_AFTER;
  +						return new Status(Status.FORCE_PAGE_BREAK_ODD);
  +				}
  +
  +				if (breakAfter == BreakAfter.EVEN_PAGE) {
  +						this.marker = BREAK_AFTER;
  +						return new Status(Status.FORCE_PAGE_BREAK_EVEN);
  +				}
  +
  +				if (breakAfter == BreakAfter.COLUMN) {
  +						this.marker = BREAK_AFTER;
  +						return new Status(Status.FORCE_COLUMN_BREAK);
  +				}
   						if (keepWithNext.getType() != KeepValue.KEEP_WITH_AUTO) {
   								return new Status(Status.KEEP_WITH_NEXT);
   						}