You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by bu...@apache.org on 2005/04/05 06:28:14 UTC

DO NOT REPLY [Bug 33808] - problem with large number-rows-spanned

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=33808>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=33808





------- Additional Comments From vitus@ac-sw.com  2005-04-05 06:28 -------
(From update of attachment 14566)
diff -Nur fop-0.20.5-dist/src/org/apache/fop/fo/flow/AbstractTableBody.java
fop-0.20.5/src/org/apache/fop/fo/flow/AbstractTableBody.java
--- fop-0.20.5-dist/src/org/apache/fop/fo/flow/AbstractTableBody.java  
2005-02-07 19:44:05.000000000 +0600
+++ fop-0.20.5/src/org/apache/fop/fo/flow/AbstractTableBody.java       
2005-04-05 11:21:12.246807323 +0700
@@ -106,17 +106,17 @@
	 if (this.marker == START) {

	     // Common Accessibility Properties
-	     AccessibilityProps mAccProps = propMgr.getAccessibilityProps();
+//	       AccessibilityProps mAccProps = propMgr.getAccessibilityProps();

	     // Common Aural Properties
-	     AuralProps mAurProps = propMgr.getAuralProps();
+//	       AuralProps mAurProps = propMgr.getAuralProps();

	     // Common Border, Padding, and Background Properties
-	     BorderAndPadding bap = propMgr.getBorderAndPadding();
-	     BackgroundProps bProps = propMgr.getBackgroundProps();
+//	       BorderAndPadding bap = propMgr.getBorderAndPadding();
+//	       BackgroundProps bProps = propMgr.getBackgroundProps();

	     // Common Relative Position Properties
-	     RelativePositionProps mRelProps =
propMgr.getRelativePositionProps();
+//	       RelativePositionProps mRelProps =
propMgr.getRelativePositionProps();

	     // this.properties.get("id");

diff -Nur fop-0.20.5-dist/src/org/apache/fop/fo/flow/Block.java
fop-0.20.5/src/org/apache/fop/fo/flow/Block.java
--- fop-0.20.5-dist/src/org/apache/fop/fo/flow/Block.java	2005-02-07
19:44:05.000000000 +0600
+++ fop-0.20.5/src/org/apache/fop/fo/flow/Block.java	2005-04-01
11:50:48.000000000 +0700
@@ -153,26 +153,26 @@
	     noLayoutCount=0; // Reset the "loop counter".

	     // Common Accessibility Properties
-	     AccessibilityProps mAccProps = propMgr.getAccessibilityProps();
+//	       AccessibilityProps mAccProps = propMgr.getAccessibilityProps();

	     // Common Aural Properties
-	     AuralProps mAurProps = propMgr.getAuralProps();
+//	       AuralProps mAurProps = propMgr.getAuralProps();

	     // Common Border, Padding, and Background Properties
-	     BorderAndPadding bap = propMgr.getBorderAndPadding();
-	     BackgroundProps bProps = propMgr.getBackgroundProps();
+//	       BorderAndPadding bap = propMgr.getBorderAndPadding();
+//	       BackgroundProps bProps = propMgr.getBackgroundProps();

	     // Common Font Properties
	     //this.fontState = propMgr.getFontState(area.getFontInfo());

	     // Common Hyphenation Properties
-	     HyphenationProps mHyphProps = propMgr.getHyphenationProps();
+//	       HyphenationProps mHyphProps = propMgr.getHyphenationProps();

	     // Common Margin Properties-Block
-	     MarginProps mProps = propMgr.getMarginProps();
+//	       MarginProps mProps = propMgr.getMarginProps();

	     // Common Relative Position Properties
-	     RelativePositionProps mRelProps =
propMgr.getRelativePositionProps();
+//	       RelativePositionProps mRelProps =
propMgr.getRelativePositionProps();

	     this.align = this.properties.get("text-align").getEnum();
	     this.alignLast = this.properties.get("text-align-last").getEnum();
diff -Nur fop-0.20.5-dist/src/org/apache/fop/fo/flow/RowSpanMgr.java
fop-0.20.5/src/org/apache/fop/fo/flow/RowSpanMgr.java
--- fop-0.20.5-dist/src/org/apache/fop/fo/flow/RowSpanMgr.java	2005-02-07
19:44:05.000000000 +0600
+++ fop-0.20.5/src/org/apache/fop/fo/flow/RowSpanMgr.java	2005-04-01
12:48:16.000000000 +0700
@@ -77,9 +77,9 @@
	     return (rowsRemaining == 1);
	 }

-	 boolean finishRow(int rowHeight) {
+	 boolean finishRow(int rowHeight, boolean isFullRow) {
	     totalRowHeight += rowHeight;
-	     if (--rowsRemaining == 0) {
+	     if (isFullRow && --rowsRemaining == 0) {
		 if (cell != null) {
		     cell.setRowHeight(totalRowHeight);
		 }
@@ -131,6 +131,16 @@
	 return false;
     }

+    public void setForceFinishSpans(int rowHeight) {
+      for (int i = 0; i < spanInfo.length; i++) {
+	 if (spanInfo[i] != null && spanInfo[i].cell != null){
+	   spanInfo[i].cell.setRowHeight(spanInfo[i].totalRowHeight -
rowHeight);
+	   spanInfo[i].cell.setNumRowsSpanned(spanInfo[i].rowsRemaining);
+	 }
+	 spanInfo[i] = null;
+      }
+    }
+
     /**
      * Done with a row.
      * Any spans with only one row left are done
@@ -140,10 +150,11 @@
      * then remove the cell from the list of spanned cells. For other
      * spans, add the rowHeight to the spanHeight.
      */
-    public void finishRow(int rowHeight) {
+    public void finishRow(int rowHeight, boolean isFullRow) {
	 for (int i = 0; i < spanInfo.length; i++) {
-	     if (spanInfo[i] != null && spanInfo[i].finishRow(rowHeight))
+	     if (spanInfo[i] != null &&
spanInfo[i].finishRow(rowHeight,isFullRow)) {
		 spanInfo[i] = null;
+	     }
	 }
     }

diff -Nur fop-0.20.5-dist/src/org/apache/fop/fo/flow/TableCell.java
fop-0.20.5/src/org/apache/fop/fo/flow/TableCell.java
--- fop-0.20.5-dist/src/org/apache/fop/fo/flow/TableCell.java	2005-02-07
19:44:05.000000000 +0600
+++ fop-0.20.5/src/org/apache/fop/fo/flow/TableCell.java	2005-04-01
11:52:09.000000000 +0700
@@ -179,17 +179,17 @@
     public void doSetup()    // throws FOPException
      {
	 // Common Accessibility Properties
-	 AccessibilityProps mAccProps = propMgr.getAccessibilityProps();
+//	   AccessibilityProps mAccProps = propMgr.getAccessibilityProps();

	 // Common Aural Properties
-	 AuralProps mAurProps = propMgr.getAuralProps();
+//	   AuralProps mAurProps = propMgr.getAuralProps();

	 // Common Border, Padding, and Background Properties
-	 BorderAndPadding bap = propMgr.getBorderAndPadding();
-	 BackgroundProps bProps = propMgr.getBackgroundProps();
+//	   BorderAndPadding bap = propMgr.getBorderAndPadding();
+//	   BackgroundProps bProps = propMgr.getBackgroundProps();

	 // Common Relative Position Properties
-	 RelativePositionProps mRelProps = propMgr.getRelativePositionProps();
+//	   RelativePositionProps mRelProps =
propMgr.getRelativePositionProps();

	 // this.properties.get("border-after-precedence");
	 // this.properties.get("border-before-precendence");
@@ -246,7 +246,7 @@


     public int layout(Area area) throws FOPException {
-	 int originalAbsoluteHeight = area.getAbsoluteHeight();
+//	   int originalAbsoluteHeight = area.getAbsoluteHeight();
	 if (this.marker == BREAK_AFTER) {
	     return Status.OK;
	 }
@@ -530,6 +530,13 @@
	     this.borderHeight = (borderBefore + borderAfter) / 2;
	 }
     }
-

+    public void setNumRowsSpanned(int numRowsSpanned){
+	 this.numRowsSpanned = Math.max(1, numRowsSpanned);
+    }
+
+    public void resetMarker() {
+	 bDone = false;
+	 super.resetMarker();
+    }
 }
diff -Nur fop-0.20.5-dist/src/org/apache/fop/fo/flow/Table.java
fop-0.20.5/src/org/apache/fop/fo/flow/Table.java
--- fop-0.20.5-dist/src/org/apache/fop/fo/flow/Table.java	2005-02-07
19:44:05.000000000 +0600
+++ fop-0.20.5/src/org/apache/fop/fo/flow/Table.java	2005-04-01
11:54:19.000000000 +0700
@@ -117,20 +117,20 @@

	 if (this.marker == START) {
	     // Common Accessibility Properties
-	     AccessibilityProps mAccProps = propMgr.getAccessibilityProps();
+//	       AccessibilityProps mAccProps = propMgr.getAccessibilityProps();

	     // Common Aural Properties
-	     AuralProps mAurProps = propMgr.getAuralProps();
+//	       AuralProps mAurProps = propMgr.getAuralProps();

	     // Common Border, Padding, and Background Properties
-	     BorderAndPadding bap = propMgr.getBorderAndPadding();
-	     BackgroundProps bProps = propMgr.getBackgroundProps();
+//	       BorderAndPadding bap = propMgr.getBorderAndPadding();
+//	       BackgroundProps bProps = propMgr.getBackgroundProps();

	     // Common Margin Properties-Block
-	     MarginProps mProps = propMgr.getMarginProps();
+//	       MarginProps mProps = propMgr.getMarginProps();

	     // Common Relative Position Properties
-	     RelativePositionProps mRelProps =
propMgr.getRelativePositionProps();
+//	       RelativePositionProps mRelProps =
propMgr.getRelativePositionProps();

	     // this.properties.get("block-progression-dimension");
	     // this.properties.get("border-after-precendence");
@@ -447,7 +447,7 @@

     private int calcFixedColumnWidths(int maxAllocationWidth) {
	 int nextColumnNumber=1;
-	 int iEmptyCols=0;
+//	   int iEmptyCols=0;
	 double dTblUnits=0.0;
	 int iFixedWidth=0;
	 double dWidthFactor = 0.0;
@@ -459,7 +459,7 @@
		 log.warn("No table-column specification for column " +
			  nextColumnNumber);
		 // What about sizing issues?
-		 iEmptyCols++;
+//		   iEmptyCols++;
	     }
	     else {
		 Length colLength = c.getColumnWidthAsLength();
@@ -508,9 +508,9 @@
	     /* No proportional units. If minimum IPD is specified, check
	      * that sum of column widths > minIPD.
	      */
-	     int iTableWidth = iFixedWidth;
+//	       int iTableWidth = iFixedWidth;
	     if (this.minIPD > iFixedWidth) {
-		 iTableWidth = this.minIPD;
+//		   iTableWidth = this.minIPD;
		 // Add extra space to each column
		 dWidthFactor = (double)this.minIPD/(double)iFixedWidth;
	     }
diff -Nur fop-0.20.5-dist/src/org/apache/fop/fo/flow/TableRow.java
fop-0.20.5/src/org/apache/fop/fo/flow/TableRow.java
--- fop-0.20.5-dist/src/org/apache/fop/fo/flow/TableRow.java	2005-02-07
19:44:05.000000000 +0600
+++ fop-0.20.5/src/org/apache/fop/fo/flow/TableRow.java 2005-04-05
11:18:44.817271870 +0700
@@ -173,6 +173,13 @@
	     }
	     return rslt;
	 }
+
+      public void setForceCellsStart() {
+	   for (int i=0; i<states.length; i++){
+	     if (cells[i] != null)
+	       states[i] = CELLSTART;
+	   }
+      }
     }


@@ -202,21 +209,21 @@
     public void doSetup(Area area) throws FOPException {

	 // Common Accessibility Properties
-	 AccessibilityProps mAccProps = propMgr.getAccessibilityProps();
+//	   AccessibilityProps mAccProps = propMgr.getAccessibilityProps();

	 // this.properties.get("block-progression-dimension");

	 // Common Aural Properties
-	 AuralProps mAurProps = propMgr.getAuralProps();
+//	   AuralProps mAurProps = propMgr.getAuralProps();

	 // Common Border, Padding, and Background Properties
	 // only background apply, border apply if border-collapse
	 // is collapse.
-	 BorderAndPadding bap = propMgr.getBorderAndPadding();
-	 BackgroundProps bProps = propMgr.getBackgroundProps();
+//	   BorderAndPadding bap = propMgr.getBorderAndPadding();
+//	   BackgroundProps bProps = propMgr.getBackgroundProps();

	 // Common Relative Position Properties
-	 RelativePositionProps mRelProps = propMgr.getRelativePositionProps();
+//	   RelativePositionProps mRelProps =
propMgr.getRelativePositionProps();

	 // this.properties.get("break-before");
	 // this.properties.get("break-after");
@@ -233,7 +240,6 @@
	 this.keepWithNext = getKeepValue("keep-with-next.within-column");
	 this.keepWithPrevious =
	     getKeepValue("keep-with-previous.within-column");
-
	 this.id = this.properties.get("id").getString();
	 this.minHeight = this.properties.get("height").getLength().mvalue();
	 setup = true;
@@ -356,10 +362,15 @@


	     int rowSpan = cell.getNumRowsSpanned();
+	     if (rowSpan > 1)
+	       cell.resetMarker();
	     int status;
	     if (Status.isIncomplete((status = cell.layout(areaContainer)))) {
-		if ((keepTogether.getType() == KeepValue.KEEP_WITH_ALWAYS &&
bIgnoreKeepTogether==false)
-			 || (status == Status.AREA_FULL_NONE)
+		if (keepTogether.getType() == KeepValue.KEEP_WITH_ALWAYS &&
bIgnoreKeepTogether==false){
+		    this.resetMarker();
+		    this.removeID(area.getIDReferences());
+		    return Status.AREA_FULL_NONE;
+		} else if ((status == Status.AREA_FULL_NONE)
			 || rowSpan > 1) {
		     // We will put this row into the next column/page
		     // Note: the only time this shouldn't be honored is
@@ -367,14 +378,22 @@
		     // Remove spanning cells from RowSpanMgr?
		     this.resetMarker();
		     this.removeID(area.getIDReferences());
-		     return Status.AREA_FULL_NONE;
+		     rowSpanMgr.finishRow(largestCellHeight, false);
+		     rowSpanMgr.setForceFinishSpans(largestCellHeight);
+		     cellArray.setForceCellsStart();
+		     return Status.FORCE_PAGE_BREAK;
		 } else if (status == Status.AREA_FULL_SOME) {
		     /*
		      * Row is not keep-together, cell isn't spanning
		      * and part of it fits. We can break the cell and
		      * the row.
		      */
-		     someCellDidNotLayoutCompletely = true;
+		     this.resetMarker();
+		     this.removeID(area.getIDReferences());
+		     rowSpanMgr.finishRow(largestCellHeight, false);
+		     rowSpanMgr.setForceFinishSpans(largestCellHeight);
+		     cellArray.setForceCellsStart();
+		     return Status.FORCE_PAGE_BREAK;
		 }
	     }				  // else {
	      // layout was complete for a particular cell
@@ -404,7 +423,8 @@

	 // Adjust spanning row information
	 // ??? what if some cells are broken???
-	 rowSpanMgr.finishRow(largestCellHeight);
+	 rowSpanMgr.finishRow(largestCellHeight,
+			      !someCellDidNotLayoutCompletely );

	 area.addChild(areaContainer);
	 areaContainer.setHeight(largestCellHeight);
diff -Nur fop-0.20.5-dist/src/org/apache/fop/layout/BodyAreaContainer.java
fop-0.20.5/src/org/apache/fop/layout/BodyAreaContainer.java
--- fop-0.20.5-dist/src/org/apache/fop/layout/BodyAreaContainer.java   
2005-02-07 19:44:06.000000000 +0600
+++ fop-0.20.5/src/org/apache/fop/layout/BodyAreaContainer.java 2005-04-01
11:57:09.000000000 +0700
@@ -84,12 +84,12 @@
     private int mainRefAreaHeight;

     // reference area yPositions
-    private int mainYPosition;
-    private int beforeFloatYPosition;
-    private int footnoteYPosition;
+//    private int mainYPosition;
+//    private int beforeFloatYPosition;
+//    private int footnoteYPosition;

     // the start FO in case of rollback
-    private FObj startFO;
+//    private FObj startFO;
     private boolean isNewSpanArea;

     // keeps track of footnote state for multiple layouts
@@ -377,42 +377,42 @@
	 return footnoteState;
     }

-    public boolean needsFootnoteAdjusting() {
-	 footnoteYPosition = footnoteReferenceArea.getYPosition();
-	 switch (footnoteState) {
-	 case 0:
-	     resetHeights();
-	     if (footnoteReferenceArea.getHeight() > 0
-		     && mainYPosition + mainReferenceArea.getHeight()
-			> footnoteYPosition) {
-		 return true;
-	     }
-	 case 1:
-	     break;
-	 }
-	 return false;
-    }
-
-    public void adjustFootnoteArea() {
-	 footnoteState++;
-	 if (footnoteState == 1) {
-	    
mainReferenceArea.setMaxHeight(footnoteReferenceArea.getYPosition()
-					    - mainYPosition);
-	     footnoteYPosition = footnoteReferenceArea.getYPosition();
-	    
footnoteReferenceArea.setMaxHeight(footnoteReferenceArea.getHeight());
-
-	     ArrayList children = footnoteReferenceArea.getChildren();
-	     for (int i = 0; i < children.size(); i++) {
-		 Object obj = children.get(i);
-		 if (obj instanceof Area) {
-		     Area childArea = (Area)obj;
-		     footnoteReferenceArea.removeChild(childArea);
-		 }
-	     }
-
-	     getPage().setPendingFootnotes(null);
-	 }
-    }
+//    public boolean needsFootnoteAdjusting() {
+//	   footnoteYPosition = footnoteReferenceArea.getYPosition();
+//	   switch (footnoteState) {
+//	   case 0:
+//	       resetHeights();
+//	       if (footnoteReferenceArea.getHeight() > 0
+//		       && mainYPosition + mainReferenceArea.getHeight()
+//			  > footnoteYPosition) {
+//		   return true;
+//	       }
+//	   case 1:
+//	       break;
+//	   }
+//	   return false;
+//    }
+//
+//    public void adjustFootnoteArea() {
+//	   footnoteState++;
+//	   if (footnoteState == 1) {
+//	      
mainReferenceArea.setMaxHeight(footnoteReferenceArea.getYPosition()
+//					      - mainYPosition);
+//	       footnoteYPosition = footnoteReferenceArea.getYPosition();
+//	      
footnoteReferenceArea.setMaxHeight(footnoteReferenceArea.getHeight());
+//
+//	       ArrayList children = footnoteReferenceArea.getChildren();
+//	       for (int i = 0; i < children.size(); i++) {
+//		   Object obj = children.get(i);
+//		   if (obj instanceof Area) {
+//		       Area childArea = (Area)obj;
+//		       footnoteReferenceArea.removeChild(childArea);
+//		   }
+//	       }
+//
+//	       getPage().setPendingFootnotes(null);
+//	   }
+//    }

     protected static void resetMaxHeight(Area ar, int change) {
	 ar.setMaxHeight(change);


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.