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 kl...@apache.org on 2002/12/01 12:55:57 UTC
cvs commit: xml-fop/src/org/apache/fop/fo/flow TableRow.java AbstractTableBody.java
klease 2002/12/01 03:55:57
Modified: src/org/apache/fop/fo/flow Tag: fop-0_20_2-maintain
TableRow.java AbstractTableBody.java
Log:
Improve keep handling in table rows
Revision Changes Path
No revision
No revision
1.51.2.9 +13 -6 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.51.2.8
retrieving revision 1.51.2.9
diff -u -r1.51.2.8 -r1.51.2.9
--- TableRow.java 22 Nov 2002 15:10:46 -0000 1.51.2.8
+++ TableRow.java 1 Dec 2002 11:55:56 -0000 1.51.2.9
@@ -48,7 +48,9 @@
AreaContainer areaContainer;
boolean areaAdded = false;
-
+
+ boolean bIgnoreKeepTogether = false;
+
private RowSpanMgr rowSpanMgr = null;
private CellArray cellArray = null;
@@ -247,7 +249,7 @@
Position.RELATIVE);
areaContainer.foCreator = this; // G Seshadri
areaContainer.setPage(area.getPage());
- areaContainer.setParent(area);
+ areaContainer.setParent(area);
areaContainer.setBackground(propMgr.getBackgroundProps());
areaContainer.start();
@@ -303,7 +305,7 @@
int rowSpan = cell.getNumRowsSpanned();
int status;
if (Status.isIncomplete((status = cell.layout(areaContainer)))) {
- if ((keepTogether.getType() == KeepValue.KEEP_WITH_ALWAYS)
+ if ((keepTogether.getType() == KeepValue.KEEP_WITH_ALWAYS && bIgnoreKeepTogether==false)
|| (status == Status.AREA_FULL_NONE)
|| rowSpan > 1) {
// We will put this row into the next column/page
@@ -417,9 +419,10 @@
}
public void removeLayout(Area area) {
- if (areaAdded)
+ if (areaAdded) {
area.removeChild(areaContainer);
- areaAdded = false;
+ areaAdded = false;
+ }
this.resetMarker();
this.removeID(area.getIDReferences());
}
@@ -499,6 +502,10 @@
- 1)).getColumnWidth();
}
return width;
+ }
+
+ void setIgnoreKeepTogether(boolean bIgnoreKeepTogether) {
+ this.bIgnoreKeepTogether = bIgnoreKeepTogether;
}
}
1.1.2.6 +41 -4 xml-fop/src/org/apache/fop/fo/flow/Attic/AbstractTableBody.java
Index: AbstractTableBody.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/Attic/AbstractTableBody.java,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -r1.1.2.5 -r1.1.2.6
--- AbstractTableBody.java 22 Nov 2002 15:10:46 -0000 1.1.2.5
+++ AbstractTableBody.java 1 Dec 2002 11:55:57 -0000 1.1.2.6
@@ -124,7 +124,7 @@
area.spaceLeft(), Position.RELATIVE);
areaContainer.foCreator = this; // G Seshadri
areaContainer.setPage(area.getPage());
- areaContainer.setParent(area);
+ areaContainer.setParent(area);
areaContainer.setBackground(propMgr.getBackgroundProps());
areaContainer.setBorderAndPadding(propMgr.getBorderAndPadding());
areaContainer.start();
@@ -152,11 +152,29 @@
== -1) {
keepWith.add(lastRow);
} else {
+ /* This row has no keep-with-previous, or it is the first
+ * row in this area.
+ */
if (endKeepGroup && keepWith.size() > 0) {
keepWith = new ArrayList();
}
+ // If we have composed at least one complete row which is not part
+ // of a keep set, we can take following keeps into account again
+ if (endKeepGroup && i > this.marker) {
+ rowSpanMgr.setIgnoreKeeps(false);
+ }
}
-
+
+ /* Tell the row whether it is at the top of this area: if so, the row
+ * should not honor keep-together.
+ */
+ boolean bRowStartsArea = (i == this.marker);
+ if (bRowStartsArea == false && keepWith.size() > 0) {
+ if (children.indexOf(keepWith.get(0)) == this.marker) {
+ bRowStartsArea = true;
+ }
+ }
+ row.setIgnoreKeepTogether(bRowStartsArea && startsAC(area));
int status;
if (Status.isIncomplete((status = row.layout(areaContainer)))) {
// BUG!!! don't distinguish between break-before and after!
@@ -250,5 +268,24 @@
this.resetMarker();
this.removeID(area.getIDReferences());
}
-
+
+ /**
+ * Return true if the passed area is on the left edge of its nearest
+ * absolute AreaContainer (generally a page column).
+ */
+ private boolean startsAC(Area area) {
+ Area parent=null;
+
+ while ((parent = area.getParent()) != null &&
+ parent.hasNonSpaceChildren() == false) {
+ // The area will be the first non-space child in its parent
+ // Note: it's not added yet!
+ if (parent instanceof AreaContainer &&
+ ((AreaContainer)parent).getPosition() == Position.ABSOLUTE) {
+ return true;
+ }
+ area = parent;
+ }
+ return false;
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org