From 42d88d788f7706872c34e56a7af65db3e82100c7 Mon Sep 17 00:00:00 2001 From: Keiron Liddle Date: Tue, 28 Nov 2000 07:09:29 +0000 Subject: [PATCH] this handles the situation where the first row of a table cannot fit on the current page, so the table must begin from the next page. This makes sure that no part of the table remains on the page and also no border will show up Code changes sponsored by Dresdner Bank, Germany git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193843 13f79535-47bb-0310-9956-ffa450edef68 --- src/org/apache/fop/fo/flow/Table.java | 8 +++++--- src/org/apache/fop/fo/flow/TableBody.java | 4 +++- src/org/apache/fop/fo/flow/TableRow.java | 8 +++++++- src/org/apache/fop/layout/Area.java | 6 ++++++ 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/org/apache/fop/fo/flow/Table.java b/src/org/apache/fop/fo/flow/Table.java index 89595d02f..03272fcec 100644 --- a/src/org/apache/fop/fo/flow/Table.java +++ b/src/org/apache/fop/fo/flow/Table.java @@ -218,9 +218,11 @@ public class Table extends FObj { status = new Status(Status.AREA_FULL_SOME); } //areaContainer.end(); - area.addChild(areaContainer); - area.increaseHeight(areaContainer.getHeight()); - area.setAbsoluteHeight(areaContainer.getAbsoluteHeight()); + if(!(/*(i == 0) && */(areaContainer.getContentHeight() <= 0))) { + area.addChild(areaContainer); + area.increaseHeight(areaContainer.getHeight()); + area.setAbsoluteHeight(areaContainer.getAbsoluteHeight()); + } return status; } } diff --git a/src/org/apache/fop/fo/flow/TableBody.java b/src/org/apache/fop/fo/flow/TableBody.java index d5139c948..c7b04986f 100644 --- a/src/org/apache/fop/fo/flow/TableBody.java +++ b/src/org/apache/fop/fo/flow/TableBody.java @@ -164,11 +164,13 @@ public class TableBody extends FObj { if ((i != 0) && (status.getCode() == Status.AREA_FULL_NONE)) { status = new Status(Status.AREA_FULL_SOME); } + if(!((i == 0) && (areaContainer.getContentHeight() <= 0))) { area.addChild(areaContainer); //areaContainer.end(); - area.increaseHeight(areaContainer.getHeight()); + area.increaseHeight(areaContainer.getHeight()); area.setAbsoluteHeight(areaContainer.getAbsoluteHeight()); + } return status; } } diff --git a/src/org/apache/fop/fo/flow/TableRow.java b/src/org/apache/fop/fo/flow/TableRow.java index af4d03176..28c02f242 100644 --- a/src/org/apache/fop/fo/flow/TableRow.java +++ b/src/org/apache/fop/fo/flow/TableRow.java @@ -104,6 +104,7 @@ public class TableRow extends FObj { Vector columns; AreaContainer areaContainer; + DisplaySpace spacer = null; public TableRow(FObj parent, PropertyList propertyList) { super(parent, propertyList); @@ -211,7 +212,8 @@ public class TableRow extends FObj { } if ((spaceBefore != 0) && (this.marker ==0)) { - area.addDisplaySpace(spaceBefore); + spacer = new DisplaySpace(spaceBefore); + area.increaseHeight(spaceBefore); } if ( marker==0 ) { @@ -267,6 +269,8 @@ public class TableRow extends FObj { status = new Status(Status.AREA_FULL_SOME); } + if(spacer != null) + area.removeChild(spacer); area.removeChild(areaContainer); this.resetMarker(); this.removeID(area.getIDReferences()); @@ -284,6 +288,8 @@ public class TableRow extends FObj { cell.setHeight(largestCellHeight); } + if(spacer != null) + area.addChild(spacer); area.addChild(areaContainer); areaContainer.end(); area.addDisplaySpace(largestCellHeight diff --git a/src/org/apache/fop/layout/Area.java b/src/org/apache/fop/layout/Area.java index bed0a247e..2ecee588e 100644 --- a/src/org/apache/fop/layout/Area.java +++ b/src/org/apache/fop/layout/Area.java @@ -226,6 +226,12 @@ abstract public class Area extends Box { this.children.removeElement(area); } + public void removeChild(DisplaySpace spacer) { + this.currentHeight -= spacer.getSize(); + this.absoluteHeight -= spacer.getSize(); + this.children.removeElement(spacer); + } + public void remove() { this.parent.removeChild(this); } -- 2.39.5