Browse Source

Updated tables to handle headers, footers, keep-with

colspan is partly done

Also fixed the bug where some of a block was missing if near end of page

Code changes sponsored by Dresdner Bank, Germany


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193859 13f79535-47bb-0310-9956-ffa450edef68
tags/pre-columns
Keiron Liddle 23 years ago
parent
commit
7464d725f8

+ 57
- 11
src/codegen/foproperties.xml View File

@@ -8,6 +8,36 @@
<datatype-conversion type="String" varname="strval">
new ColorType(strval)</datatype-conversion>
</property>
<property type="generic">
<name>generic-boolean</name>
<class-name>GenericBoolean</class-name>
<datatype>Enum</datatype>
<enumeration>
<value const="TRUE">true</value>
<value const="FALSE">false</value>
</enumeration>
</property>
<property type="generic">
<name>generic-keep</name>
<class-name>GenericKeep</class-name>
<datatype>Number</datatype>
<keyword-equiv match="auto" eval="true">0</keyword-equiv>
<keyword-equiv match="always" eval="true">-1</keyword-equiv>
<!-- <compound>
<subproperty>
<name>within-page</name>
<datatype>Number</datatype>
</subproperty>
<subproperty>
<name>within-line</name>
<datatype>Number</datatype>
</subproperty>
<subproperty>
<name>within-column</name>
<datatype>Number</datatype>
</subproperty>
</compound>-->
</property>
<property type="generic">
<name>conditional-length-template</name>
<class-name>GenericCondLength</class-name>
@@ -300,11 +330,7 @@
<property>
<name>white-space-collapse</name>
<inherited>true</inherited>
<datatype>Enum</datatype>
<enumeration>
<value const="TRUE">true</value>
<value const="FALSE">false</value>
</enumeration>
<use-generic>GenericBoolean</use-generic>
<default>true</default>
</property>
<property>
@@ -376,12 +402,20 @@
<property>
<name>keep-with-next</name>
<inherited>false</inherited>
<datatype>Enum</datatype>
<enumeration>
<value const="TRUE">true</value>
<value const="FALSE">false</value>
</enumeration>
<default>false</default>
<use-generic>GenericKeep</use-generic>
<default>auto</default>
</property>
<property>
<name>keep-with-previous</name>
<inherited>false</inherited>
<use-generic>GenericKeep</use-generic>
<default>auto</default>
</property>
<property>
<name>keep-together</name>
<inherited>false</inherited>
<use-generic>GenericKeep</use-generic>
<default>auto</default>
</property>
<property>
<name>background-color</name>
@@ -857,6 +891,18 @@
<datatype>Number</datatype>
<default>1</default>
</property>
<property>
<name>widows</name>
<inherited>true</inherited>
<datatype>Number</datatype>
<default>2</default>
</property>
<property>
<name>orphans</name>
<inherited>true</inherited>
<datatype>Number</datatype>
<default>2</default>
</property>

<property>
<name>region-name</name>

+ 13
- 0
src/org/apache/fop/fo/FONode.java View File

@@ -92,6 +92,9 @@ abstract public class FONode {
protected int forcedStartOffset = 0;
protected int forcedWidth = 0;

protected int widows = 0;
protected int orphans = 0;

protected LinkSet linkSet;

protected FONode(FObj parent) {
@@ -178,6 +181,16 @@ abstract public class FONode {
}
}

public void setWidows(int wid)
{
widows = wid;
}

public void setOrphans(int orph)
{
orphans = orph;
}

public void removeAreas() {
// still to do
}

+ 17
- 0
src/org/apache/fop/fo/FOText.java View File

@@ -95,6 +95,23 @@ public class FOText extends FONode {
this.underlined = ul;
}

public boolean willCreateArea()
{
this.whiteSpaceCollapse = this.parent.properties.get(
"white-space-collapse").getEnum();
if(this.whiteSpaceCollapse == WhiteSpaceCollapse.FALSE && length > 0) {
return true;
}
for (int i = start; i < start + length - 1; i++) {
char ch = ca[i];
if (!((ch == ' ') || (ch == '\n') || (ch == '\r') ||
(ch == '\t'))) { // whitespace
return true;
}
}
return false;
}

public Status layout(Area area) throws FOPException {
if (!(area instanceof BlockArea)) {
MessageHandler.errorln("WARNING: text outside block area" +

+ 2
- 0
src/org/apache/fop/fo/StandardElementMapping.java View File

@@ -99,7 +99,9 @@ public class StandardElementMapping implements ElementMapping {
ExternalGraphic.maker());
builder.addMapping(uri, "table", Table.maker());
builder.addMapping(uri, "table-column", TableColumn.maker());
builder.addMapping(uri, "table-header", TableHeader.maker());
builder.addMapping(uri, "table-body", TableBody.maker());
builder.addMapping(uri, "table-footer", TableFooter.maker());
builder.addMapping(uri, "table-row", TableRow.maker());
builder.addMapping(uri, "table-cell", TableCell.maker());
builder.addMapping(uri, "basic-link", BasicLink.maker());

+ 305
- 277
src/org/apache/fop/fo/flow/Block.java View File

@@ -1,36 +1,36 @@
/*-- $Id$ --
/*-- $Id$ --

============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -41,12 +41,12 @@
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
James Tauber <jtauber@jtauber.com>. For more information on the Apache
James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
*/

package org.apache.fop.fo.flow;
@@ -60,16 +60,16 @@ import org.apache.fop.datatypes.*;
import org.apache.fop.apps.FOPException;

public class Block extends FObjMixed {
public static class Maker extends FObj.Maker {
public FObj make(FObj parent, PropertyList propertyList)
throws FOPException {
return new Block(parent, propertyList);
}
public FObj make(FObj parent,
PropertyList propertyList) throws FOPException {
return new Block(parent, propertyList);
}
}

public static FObj.Maker maker() {
return new Block.Maker();
return new Block.Maker();
}

FontState fs;
@@ -89,9 +89,11 @@ public class Block extends FObjMixed {
int paddingBottom;
int paddingLeft;
int paddingRight;
int blockWidows;
int blockOrphans;

String id;
ColorType borderTopColor;
int borderTopWidth;
int borderTopStyle;
@@ -104,285 +106,311 @@ public class Block extends FObjMixed {
ColorType borderRightColor;
int borderRightWidth;
int borderRightStyle;
BlockArea blockArea;

// this may be helpful on other FOs too
boolean anythingLaidOut = false;

public Block(FObj parent, PropertyList propertyList) {
super(parent, propertyList);
this.name = "fo:block";
super(parent, propertyList);
this.name = "fo:block";
}

public Status layout(Area area) throws FOPException {
// MessageHandler.error(" b:LAY[" + marker + "] ");

if (this.marker == BREAK_AFTER) {
return new Status(Status.OK);
}

if (this.marker == START) {
String fontFamily =
this.properties.get("font-family").getString();
String fontStyle =
this.properties.get("font-style").getString();
String fontWeight =
this.properties.get("font-weight").getString();
int fontSize =
this.properties.get("font-size").getLength().mvalue();
this.fs = new FontState(area.getFontInfo(), fontFamily,
fontStyle, fontWeight, fontSize);
this.align = this.properties.get("text-align").getEnum();
this.alignLast =
this.properties.get("text-align-last").getEnum();
this.breakBefore =
this.properties.get("break-before").getEnum();
this.breakAfter =
this.properties.get("break-after").getEnum();
this.lineHeight =
this.properties.get("line-height").getLength().mvalue();
this.startIndent =
this.properties.get("start-indent").getLength().mvalue();
this.endIndent =
this.properties.get("end-indent").getLength().mvalue();
this.spaceBefore =
this.properties.get("space-before.optimum").getLength().mvalue();
this.spaceAfter =
this.properties.get("space-after.optimum").getLength().mvalue();
this.textIndent =
this.properties.get("text-indent").getLength().mvalue();
this.keepWithNext =
this.properties.get("keep-with-next").getEnum();
this.backgroundColor =
this.properties.get("background-color").getColorType();
this.paddingTop =
this.properties.get("padding").getLength().mvalue();
// MessageHandler.error(" b:LAY[" + marker + "] ");

if (this.marker == BREAK_AFTER) {
return new Status(Status.OK);
}

if (this.marker == START) {
String fontFamily =
this.properties.get("font-family").getString();
String fontStyle =
this.properties.get("font-style").getString();
String fontWeight =
this.properties.get("font-weight").getString();
int fontSize =
this.properties.get("font-size").getLength().mvalue();

this.fs = new FontState(area.getFontInfo(), fontFamily,
fontStyle, fontWeight, fontSize);
this.align = this.properties.get("text-align").getEnum();
this.alignLast =
this.properties.get("text-align-last").getEnum();
this.breakBefore =
this.properties.get("break-before").getEnum();
this.breakAfter = this.properties.get("break-after").getEnum();
this.lineHeight = this.properties.get(
"line-height").getLength().mvalue();
this.startIndent = this.properties.get(
"start-indent").getLength().mvalue();
this.endIndent = this.properties.get(
"end-indent").getLength().mvalue();
this.spaceBefore = this.properties.get(
"space-before.optimum").getLength().mvalue();
this.spaceAfter = this.properties.get(
"space-after.optimum").getLength().mvalue();
this.textIndent = this.properties.get(
"text-indent").getLength().mvalue();
this.keepWithNext =
this.properties.get("keep-with-next").getEnum();
this.backgroundColor = this.properties.get(
"background-color").getColorType();
this.paddingTop =
this.properties.get("padding").getLength().mvalue();
this.paddingLeft = this.paddingTop;
this.paddingRight = this.paddingTop;
this.paddingBottom = this.paddingTop;
if (this.paddingTop == 0) {
this.paddingTop =
this.properties.get("padding-top").getLength().mvalue();
this.paddingLeft =
this.properties.get("padding-left").getLength().mvalue();
this.paddingBottom =
this.properties.get("padding-bottom").getLength().mvalue();
this.paddingRight =
this.properties.get("padding-right").getLength().mvalue();
this.paddingTop = this.properties.get(
"padding-top").getLength().mvalue();
this.paddingLeft = this.properties.get(
"padding-left").getLength().mvalue();
this.paddingBottom = this.properties.get(
"padding-bottom").getLength().mvalue();
this.paddingRight = this.properties.get(
"padding-right").getLength().mvalue();
}
this.borderTopColor =
this.properties.get("border-color").getColorType();
this.borderBottomColor = this.borderTopColor;
this.borderLeftColor = this.borderTopColor;
this.borderRightColor = this.borderTopColor;
if (this.borderTopColor == null) {
this.borderTopColor = this.properties.get(
"border-top-color").getColorType();
this.borderBottomColor = this.properties.get(
"border-bottom-color").getColorType();
this.borderLeftColor = this.properties.get(
"border-left-color").getColorType();
this.borderRightColor = this.properties.get(
"border-right-color").getColorType();
}
this.borderTopWidth = this.properties.get(
"border-width").getLength().mvalue();
this.borderBottomWidth = this.borderTopWidth;
this.borderLeftWidth = this.borderTopWidth;
this.borderRightWidth = this.borderTopWidth;
if (this.borderTopWidth == 0) {
this.borderTopWidth = this.properties.get(
"border-top-width").getLength().mvalue();
this.borderBottomWidth = this.properties.get(
"border-bottom-width").getLength().mvalue();
this.borderLeftWidth = this.properties.get(
"border-left-width").getLength().mvalue();
this.borderRightWidth = this.properties.get(
"border-right-width").getLength().mvalue();
}
this.borderTopColor =
this.properties.get("border-color").getColorType();
this.borderBottomColor = this.borderTopColor;
this.borderLeftColor = this.borderTopColor;
this.borderRightColor = this.borderTopColor;
if (this.borderTopColor == null) {
this.borderTopColor =
this.properties.get("border-top-color").getColorType();
this.borderBottomColor =
this.properties.get("border-bottom-color").getColorType();
this.borderLeftColor =
this.properties.get("border-left-color").getColorType();
this.borderRightColor =
this.properties.get("border-right-color").getColorType();
}
this.borderTopWidth =
this.properties.get("border-width").getLength().mvalue();
this.borderBottomWidth = this.borderTopWidth;
this.borderLeftWidth = this.borderTopWidth;
this.borderRightWidth = this.borderTopWidth;
if (this.borderTopWidth == 0) {
this.borderTopWidth =
this.properties.get("border-top-width").getLength().mvalue();
this.borderBottomWidth =
this.properties.get("border-bottom-width").getLength().mvalue();
this.borderLeftWidth =
this.properties.get("border-left-width").getLength().mvalue();
this.borderRightWidth =
this.properties.get("border-right-width").getLength().mvalue();
}
this.borderTopStyle =
this.properties.get("border-style").getEnum();
this.borderBottomStyle = this.borderTopStyle;
this.borderLeftStyle = this.borderTopStyle;
this.borderRightStyle = this.borderTopStyle;
if (this.borderTopStyle == 0) {
this.borderTopStyle =
this.properties.get("border-top-style").getEnum();
this.borderBottomStyle =
this.properties.get("border-bottom-style").getEnum();
this.borderLeftStyle =
this.properties.get("border-left-style").getEnum();
this.borderRightStyle =
this.properties.get("border-right-style").getEnum();
}
this.id =
this.properties.get("id").getString();
if (area instanceof BlockArea) {
area.end();
}
if (this.isInLabel) {
startIndent += bodyIndent;
endIndent += (area.getAllocationWidth()
- distanceBetweenStarts - startIndent)
+ labelSeparation;
}
else if (this.isInListBody) {
startIndent += bodyIndent + distanceBetweenStarts;
}

area.getIDReferences().createID(id);

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 ((spaceBefore != 0) && (this.marker ==0)) {
area.addDisplaySpace(spaceBefore);
}

if (anythingLaidOut) {
this.textIndent = 0;
}
if ( marker==0 ) {
area.getIDReferences().configureID(id,area);
this.borderTopStyle =
this.properties.get("border-style").getEnum();
this.borderBottomStyle = this.borderTopStyle;
this.borderLeftStyle = this.borderTopStyle;
this.borderRightStyle = this.borderTopStyle;
if (this.borderTopStyle == 0) {
this.borderTopStyle =
this.properties.get("border-top-style").getEnum();
this.borderBottomStyle = this.properties.get(
"border-bottom-style").getEnum();
this.borderLeftStyle = this.properties.get(
"border-left-style").getEnum();
this.borderRightStyle = this.properties.get(
"border-right-style").getEnum();
}
this.blockWidows =
this.properties.get("widows").getNumber().intValue();
this.blockOrphans =
this.properties.get("orphans").getNumber().intValue();

this.id = this.properties.get("id").getString();

if (area instanceof BlockArea) {
area.end();
}
if (this.isInLabel) {
startIndent += bodyIndent;
endIndent += (area.getAllocationWidth() -
distanceBetweenStarts - startIndent) +
labelSeparation;
} else if (this.isInListBody) {
startIndent += bodyIndent + distanceBetweenStarts;
}

area.getIDReferences().createID(id);

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);
}

int numChildren = this.children.size();
for (int i = 0; i < numChildren; i++) {
FONode fo = (FONode) children.elementAt(i);
if (fo instanceof FOText) {
if (((FOText) fo).willCreateArea()) {
fo.setWidows(blockWidows);
break;
}
} else {
fo.setWidows(blockWidows);
break;
}
}

for (int i = numChildren - 1; i > 0; i--) {
FONode fo = (FONode) children.elementAt(i);
if (fo instanceof FOText) {
if (((FOText) fo).willCreateArea()) {
fo.setOrphans(blockOrphans);
break;
}
} else {
fo.setOrphans(blockOrphans);
break;
}
}
}

if ((spaceBefore != 0) && (this.marker == 0)) {
area.addDisplaySpace(spaceBefore);
}

if (anythingLaidOut) {
this.textIndent = 0;
}

if (marker == 0) {
area.getIDReferences().configureID(id, area);
}
this.blockArea =
new BlockArea(fs, area.getAllocationWidth(),
area.spaceLeft(),
startIndent,
endIndent,
textIndent, align, alignLast, lineHeight);
blockArea.setPage(area.getPage());
blockArea.setBackgroundColor(backgroundColor);
blockArea.setPadding(paddingTop, paddingLeft, paddingBottom,
paddingRight);
blockArea.setBorderStyle(borderTopStyle, borderLeftStyle,
borderBottomStyle, borderRightStyle);
blockArea.setBorderWidth(borderTopWidth, borderLeftWidth,
borderBottomWidth, borderRightWidth);
blockArea.setBorderColor(borderTopColor, borderLeftColor,
borderBottomColor, borderRightColor);
blockArea.start();

blockArea.setAbsoluteHeight(area.getAbsoluteHeight());

this.blockArea = new BlockArea(fs, area.getAllocationWidth(),
area.spaceLeft(), startIndent, endIndent, textIndent,
align, alignLast, lineHeight);
blockArea.setPage(area.getPage());
blockArea.setBackgroundColor(backgroundColor);
blockArea.setPadding(paddingTop, paddingLeft, paddingBottom,
paddingRight);
blockArea.setBorderStyle(borderTopStyle, borderLeftStyle,
borderBottomStyle, borderRightStyle);
blockArea.setBorderWidth(borderTopWidth, borderLeftWidth,
borderBottomWidth, borderRightWidth);
blockArea.setBorderColor(borderTopColor, borderLeftColor,
borderBottomColor, borderRightColor);
blockArea.start();

blockArea.setAbsoluteHeight(area.getAbsoluteHeight());
blockArea.setIDReferences(area.getIDReferences());

blockArea.setTableCellXOffset(area.getTableCellXOffset());
int numChildren = this.children.size();
for (int i = this.marker; i < numChildren; i++) {
FONode fo = (FONode) children.elementAt(i);
if (this.isInListBody) {
fo.setIsInListBody();
fo.setDistanceBetweenStarts(this.distanceBetweenStarts);
fo.setBodyIndent(this.bodyIndent);
}
Status status;
if ((status = fo.layout(blockArea)).isIncomplete())
{
this.marker = i;
// this block was modified by
// Hani Elabed 11/27/2000
//if ((i != 0) && (status.getCode() == Status.AREA_FULL_NONE))
//{
// status = new Status(Status.AREA_FULL_SOME);
//}
// new block to replace the one above
// Hani Elabed 11/27/2000
if( status.getCode() == Status.AREA_FULL_NONE )
{
// something has already been laid out
if( (i != 0) )
{
status = new Status(Status.AREA_FULL_SOME);
anythingLaidOut = true;
return status;
}
else // i == 0 nothing was laid out..
{
anythingLaidOut = false;
return status;
}
}
//blockArea.end();
area.addChild(blockArea);
area.increaseHeight(blockArea.getHeight());
area.setAbsoluteHeight(blockArea.getAbsoluteHeight());
anythingLaidOut = true;
return status;
}
anythingLaidOut = true;
}
blockArea.end();
area.addChild(blockArea);
/* should this be combined into above? */
area.increaseHeight(blockArea.getHeight());
area.setAbsoluteHeight(blockArea.getAbsoluteHeight());
if (spaceAfter != 0) {
area.addDisplaySpace(spaceAfter);
}
if (area instanceof BlockArea) {
area.start();
}
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 (keepWithNext == KeepWithNext.TRUE) {
return new Status(Status.KEEP_WITH_NEXT);
}
//MessageHandler.error(" b:OK" + marker + " ");
return new Status(Status.OK);
int numChildren = this.children.size();
for (int i = this.marker; i < numChildren; i++) {
FONode fo = (FONode) children.elementAt(i);
if (this.isInListBody) {
fo.setIsInListBody();
fo.setDistanceBetweenStarts(this.distanceBetweenStarts);
fo.setBodyIndent(this.bodyIndent);
}
Status status;
if ((status = fo.layout(blockArea)).isIncomplete()) {
this.marker = i;
// this block was modified by
// Hani Elabed 11/27/2000
//if ((i != 0) && (status.getCode() == Status.AREA_FULL_NONE))
//{
// status = new Status(Status.AREA_FULL_SOME);
//}
// new block to replace the one above
// Hani Elabed 11/27/2000
if (status.getCode() == Status.AREA_FULL_NONE) {
// something has already been laid out
if ((i != 0)) {
status = new Status(Status.AREA_FULL_SOME);
area.addChild(blockArea);
area.increaseHeight(blockArea.getHeight());
area.setAbsoluteHeight(
blockArea.getAbsoluteHeight());
anythingLaidOut = true;
return status;
} else // i == 0 nothing was laid out..
{
anythingLaidOut = false;
return status;
}
}
//blockArea.end();
area.addChild(blockArea);
area.increaseHeight(blockArea.getHeight());
area.setAbsoluteHeight(blockArea.getAbsoluteHeight());
anythingLaidOut = true;
return status;
}
anythingLaidOut = true;
}
blockArea.end();
area.addChild(blockArea);
/* should this be combined into above? */
area.increaseHeight(blockArea.getHeight());
area.setAbsoluteHeight(blockArea.getAbsoluteHeight());
if (spaceAfter != 0) {
area.addDisplaySpace(spaceAfter);
}
if (area instanceof BlockArea) {
area.start();
}
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 (keepWithNext != 0) {
return new Status(Status.KEEP_WITH_NEXT);
}
//MessageHandler.error(" b:OK" + marker + " ");
return new Status(Status.OK);
}

public int getAreaHeight() {
return blockArea.getHeight();
return blockArea.getHeight();
}


/**
* Return the content width of the boxes generated by this FO.
*/
protected int getContentWidth() {
if (blockArea != null)
return blockArea.getContentWidth(); //getAllocationWidth()??
else return 0; // not laid out yet
}
/**
* Return the content width of the boxes generated by this FO.
*/
protected int getContentWidth() {
if (blockArea != null)
return blockArea.getContentWidth(); //getAllocationWidth()??
else
return 0; // not laid out yet
}
}

+ 45
- 4
src/org/apache/fop/fo/flow/Table.java View File

@@ -87,6 +87,8 @@ public class Table extends FObj {
int borderWidth;
int borderStyle;
String id;
TableHeader tableHeader = null;
TableFooter tableFooter = null;

Vector columns = new Vector();
int currentColumnNumber = 0;
@@ -203,30 +205,69 @@ public class Table extends FObj {
c.setColumnOffset(offset);
fo.layout(areaContainer);
offset += c.getColumnWidth();
} else if (fo instanceof TableHeader) {
if (columns.size() == 0) {
MessageHandler.errorln("WARNING: current implementation of tables requires a table-column for each column, indicating column-width");
return new Status(Status.OK);
}
tableHeader = (TableHeader)fo;
tableHeader.setColumns(columns);
} else if (fo instanceof TableFooter) {
if (columns.size() == 0) {
MessageHandler.errorln("WARNING: current implementation of tables requires a table-column for each column, indicating column-width");
return new Status(Status.OK);
}
tableFooter = (TableFooter)fo;
tableFooter.setColumns(columns);
} else if (fo instanceof TableBody) {
if (columns.size() == 0) {
MessageHandler.errorln("WARNING: current implementation of tables requires a table-column for each column, indicating column-width");
return new Status(Status.OK);
}
Status status;
if(tableHeader != null) {
if ((status = tableHeader.layout(areaContainer)).isIncomplete()) {
return new Status(Status.AREA_FULL_NONE);
}
tableHeader.resetMarker();
}
if(tableFooter != null) {
if ((status = tableFooter.layout(areaContainer)).isIncomplete()) {
return new Status(Status.AREA_FULL_NONE);
}
tableFooter.resetMarker();
}
fo.setWidows(widows);
fo.setOrphans(orphans);
((TableBody) fo).setColumns(columns);

Status status;
if ((status = fo.layout(areaContainer)).isIncomplete()) {
this.marker = i;
if ((i != 0) && (status.getCode() == Status.AREA_FULL_NONE)) {
status = new Status(Status.AREA_FULL_SOME);
if (/*(i != 0) && */(status.getCode() == Status.AREA_FULL_NONE)) {
// status = new Status(Status.AREA_FULL_SOME);
}
//areaContainer.end();
if(!(/*(i == 0) && */(areaContainer.getContentHeight() <= 0))) {
area.addChild(areaContainer);
area.increaseHeight(areaContainer.getHeight());
area.setAbsoluteHeight(areaContainer.getAbsoluteHeight());
if(tableFooter != null) {
// move footer to bottom of area and move up body
((TableBody) fo).setYPosition(tableFooter.getYPosition());
tableFooter.setYPosition(tableFooter.getYPosition() + ((TableBody) fo).getHeight());
}
}
return status;
}
if(tableFooter != null) {
// move footer to bottom of area and move up body
// space before and after footer will make this wrong
((TableBody) fo).setYPosition(tableFooter.getYPosition());
tableFooter.setYPosition(tableFooter.getYPosition() + ((TableBody) fo).getHeight());
}
}
}

if (height != 0)
areaContainer.setHeight(height);


+ 75
- 1
src/org/apache/fop/fo/flow/TableBody.java View File

@@ -60,6 +60,7 @@ import org.apache.fop.apps.FOPException;

// Java
import java.util.Vector;
import java.util.Enumeration;

public class TableBody extends FObj {
@@ -78,6 +79,9 @@ public class TableBody extends FObj {
int spaceBefore;
int spaceAfter;
ColorType backgroundColor;
ColorType borderColor;
int borderWidth;
int borderStyle;
String id;

Vector columns;
@@ -93,6 +97,21 @@ public class TableBody extends FObj {
this.columns = columns;
}

public void setYPosition(int value)
{
areaContainer.setYPosition(value);
}

public int getYPosition()
{
return areaContainer.getYPosition();
}

public int getHeight()
{
return areaContainer.getHeight();
}

public Status layout(Area area) throws FOPException {
if (this.marker == BREAK_AFTER) {
return new Status(Status.OK);
@@ -116,6 +135,12 @@ public class TableBody extends FObj {
this.properties.get("space-after.optimum").getLength().mvalue();
this.backgroundColor =
this.properties.get("background-color").getColorType();
this.borderColor =
this.properties.get("border-color").getColorType();
this.borderWidth =
this.properties.get("border-width").getLength().mvalue();
this.borderStyle =
this.properties.get("border-style").getEnum();
this.id =
this.properties.get("id").getString();

@@ -143,27 +168,69 @@ public class TableBody extends FObj {
}

this.areaContainer =
new AreaContainer(fs, -area.borderWidthLeft, -area.borderWidthTop, area.getAllocationWidth(),
new AreaContainer(fs, -area.borderWidthLeft, -area.borderWidthTop + area.getHeight(), area.getAllocationWidth(),
area.spaceLeft(), Position.RELATIVE);
areaContainer.setPage(area.getPage());
areaContainer.setBackgroundColor(backgroundColor);
areaContainer.setBorderStyle(borderStyle, borderStyle, borderStyle, borderStyle);
areaContainer.setBorderWidth(borderWidth, borderWidth, borderWidth, borderWidth);
areaContainer.setBorderColor(borderColor, borderColor, borderColor, borderColor);
areaContainer.start();

areaContainer.setAbsoluteHeight(area.getAbsoluteHeight());
areaContainer.setIDReferences(area.getIDReferences());

Vector keepWith = new Vector();
int numChildren = this.children.size();
TableRow lastRow = null;
for (int i = this.marker; i < numChildren; i++) {
TableRow row = (TableRow) children.elementAt(i);

row.setColumns(columns);
row.doSetup(areaContainer);
if(row.getKeepWithPrevious() != 0 && lastRow != null) {
keepWith.addElement(lastRow);
}

Status status;
if ((status = row.layout(areaContainer)).isIncomplete()) {
if(keepWith.size() > 0) { // && status.getCode() == Status.AREA_FULL_NONE
for(Enumeration e = keepWith.elements(); e.hasMoreElements(); ) {
TableRow tr = (TableRow)e.nextElement();
tr.removeLayout(areaContainer);
i--;
}
}
this.marker = i;
if ((i != 0) && (status.getCode() == Status.AREA_FULL_NONE)) {
status = new Status(Status.AREA_FULL_SOME);
}
if(i < widows && numChildren >= widows) {
resetMarker();
return new Status(Status.AREA_FULL_NONE);
}
if(numChildren <= orphans) {
resetMarker();
return new Status(Status.AREA_FULL_NONE);
}
if(numChildren - i < orphans && numChildren > orphans) {
for(int count = numChildren - orphans - i; count > 0; count--) {
row = (TableRow) children.elementAt(count);
row.removeLayout(areaContainer);
i--;
}
if(i < widows && numChildren >= widows) {
resetMarker();
return new Status(Status.AREA_FULL_NONE);
}
this.marker = i;
area.addChild(areaContainer);
//areaContainer.end();

area.increaseHeight(areaContainer.getHeight());
area.setAbsoluteHeight(areaContainer.getAbsoluteHeight());
return new Status(Status.AREA_FULL_SOME);
}
if(!((i == 0) && (areaContainer.getContentHeight() <= 0))) {
area.addChild(areaContainer);
//areaContainer.end();
@@ -172,7 +239,14 @@ public class TableBody extends FObj {
area.setAbsoluteHeight(areaContainer.getAbsoluteHeight());
}
return status;
} else if(status.getCode() == Status.KEEP_WITH_NEXT) {
keepWith.addElement(row);
} else {
if(keepWith.size() > 0 && row.getKeepWithPrevious() != 0) {
keepWith = new Vector();
}
}
lastRow = row;
}
area.addChild(areaContainer);
areaContainer.end();

+ 30
- 5
src/org/apache/fop/fo/flow/TableCell.java View File

@@ -93,10 +93,13 @@ public class TableCell extends FObj {
int paddingRight;
int position;
String id;
int numColumnsSpanned;
int numRowsSpanned;
protected int startOffset;
protected int width;
protected int height = 0;
boolean setup = false;

AreaContainer areaContainer;

@@ -113,12 +116,22 @@ public class TableCell extends FObj {
this.width = width;
}

public Status layout(Area area) throws FOPException {
if (this.marker == BREAK_AFTER) {
return new Status(Status.OK);
}
public int getNumColumnsSpanned()
{
return numColumnsSpanned;
}

if (this.marker == START) {
public int getNumRowsSpanned()
{
return numRowsSpanned;
}

public void doSetup(Area area) throws FOPException
{
this.numColumnsSpanned =
this.properties.get("number-columns-spanned").getNumber().intValue();
this.numRowsSpanned =
this.properties.get("number-rows-spanned").getNumber().intValue();
String fontFamily =
this.properties.get("font-family").getString();
String fontStyle =
@@ -199,6 +212,16 @@ public class TableCell extends FObj {
this.properties.get("background-color").getColorType();
this.id =
this.properties.get("id").getString();
}

public Status layout(Area area) throws FOPException {
if (this.marker == BREAK_AFTER) {
return new Status(Status.OK);
}

if (this.marker == START) {
if(!setup)
doSetup(area);

if (area instanceof BlockArea) {
area.end();
@@ -255,6 +278,8 @@ public class TableCell extends FObj {
} else {
// hani Elabed 11/21/2000
area.addChild(areaContainer);
// area.setHeight(getHeight());
area.setAbsoluteHeight(areaContainer.getAbsoluteHeight());

return new Status(Status.AREA_FULL_SOME);
}

+ 93
- 0
src/org/apache/fop/fo/flow/TableFooter.java View File

@@ -0,0 +1,93 @@
/*-- $Id$ --

============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
*/

package org.apache.fop.fo.flow;

// FOP
import org.apache.fop.fo.*;
import org.apache.fop.fo.properties.*;
import org.apache.fop.datatypes.*;
import org.apache.fop.layout.*;
import org.apache.fop.apps.FOPException;

// Java
import java.util.Vector;
import java.util.Enumeration;

public class TableFooter extends TableBody {
public static class Maker extends FObj.Maker {
public FObj make(FObj parent, PropertyList propertyList)
throws FOPException {
return new TableFooter(parent, propertyList);
}
}

public int getYPosition()
{
return areaContainer.getYPosition() - spaceBefore;
}

public void setYPosition(int value)
{
areaContainer.setYPosition(value + 2 * spaceBefore);
}

public static FObj.Maker maker() {
return new TableFooter.Maker();
}

public TableFooter(FObj parent, PropertyList propertyList) {
super(parent, propertyList);
this.name = "fo:table-footer";
}

}

+ 83
- 0
src/org/apache/fop/fo/flow/TableHeader.java View File

@@ -0,0 +1,83 @@
/*-- $Id$ --

============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
*/

package org.apache.fop.fo.flow;

// FOP
import org.apache.fop.fo.*;
import org.apache.fop.fo.properties.*;
import org.apache.fop.datatypes.*;
import org.apache.fop.layout.*;
import org.apache.fop.apps.FOPException;

// Java
import java.util.Vector;
import java.util.Enumeration;

public class TableHeader extends TableBody {
public static class Maker extends FObj.Maker {
public FObj make(FObj parent, PropertyList propertyList)
throws FOPException {
return new TableHeader(parent, propertyList);
}
}

public static FObj.Maker maker() {
return new TableHeader.Maker();
}

public TableHeader(FObj parent, PropertyList propertyList) {
super(parent, propertyList);
this.name = "fo:table-header";
}

}

+ 73
- 14
src/org/apache/fop/fo/flow/TableRow.java View File

@@ -75,6 +75,8 @@ public class TableRow extends FObj {
return new TableRow.Maker();
}

boolean setup = false;

FontState fs;
int spaceBefore;
int spaceAfter;
@@ -97,6 +99,8 @@ public class TableRow extends FObj {
int paddingBottom;
int paddingLeft;
int paddingRight;
int keepWithNext;
int keepWithPrevious;

int widthOfCellsSoFar = 0;
int largestCellHeight = 0;
@@ -155,6 +159,7 @@ public class TableRow extends FObj {
/** the width of the cell so far.*/
private int widthOfCellSoFar;

private int column = 0;

/**
* simple no args constructor.
@@ -223,6 +228,11 @@ public class TableRow extends FObj {
public final void setWidthOfCellSoFar(int aWidth)
{ widthOfCellSoFar = aWidth; }

public int getColumn()
{ return column; }

public void setColumn(int col)
{ column = col; }
}


@@ -235,12 +245,13 @@ public class TableRow extends FObj {
this.columns = columns;
}

public Status layout(Area area) throws FOPException {
if (this.marker == BREAK_AFTER) {
return new Status(Status.OK);
}
public int getKeepWithPrevious()
{
return keepWithPrevious;
}

if (this.marker == START) {
public void doSetup(Area area) throws FOPException
{
String fontFamily =
this.properties.get("font-family").getString();
String fontStyle =
@@ -303,6 +314,10 @@ public class TableRow extends FObj {
this.borderRightStyle =
this.properties.get("border-right-style").getEnum();
}
this.keepWithNext =
this.properties.get("keep-with-next").getNumber().intValue();
this.keepWithPrevious =
this.properties.get("keep-with-previous").getNumber().intValue();
this.paddingTop =
this.properties.get("padding").getLength().mvalue();
this.paddingLeft = this.paddingTop;
@@ -320,6 +335,17 @@ public class TableRow extends FObj {
}
this.id=
this.properties.get("id").getString();
setup = true;
}

public Status layout(Area area) throws FOPException {
if (this.marker == BREAK_AFTER) {
return new Status(Status.OK);
}

if (this.marker == START) {
if(!setup)
doSetup(area);

if (area instanceof BlockArea) {
area.end();
@@ -386,10 +412,10 @@ public class TableRow extends FObj {
areaContainer.setIDReferences(area.getIDReferences());

int numChildren = this.children.size();
if (numChildren != columns.size()) {
MessageHandler.errorln("WARNING: Number of children under table-row not equal to number of table-columns");
return new Status(Status.OK);
}
// if (numChildren != columns.size()) {
// MessageHandler.errorln("WARNING: Number of children under table-row not equal to number of table-columns");
// return new Status(Status.OK);
// }

// added by Eric Schaeffer
widthOfCellsSoFar = 0;
@@ -398,13 +424,20 @@ public class TableRow extends FObj {
// added by Hani Elabed 11/27/2000
boolean someCellDidNotLayoutCompletely = false;
int colCount = -1;
for (int i = this.marker; i < numChildren; i++) {
TableCell cell = (TableCell) children.elementAt(i);

// added by Hani Elabed 11/22/2000
CellState cellState = (CellState) cells.elementAt( i );

if(colCount == -1) {
colCount = cellState.getColumn();
}
cell.doSetup(areaContainer);
int numCols = cell.getNumColumnsSpanned();
int numRows = cell.getNumRowsSpanned();


//if (this.isInListBody) {
//fo.setIsInListBody();
@@ -419,7 +452,12 @@ public class TableRow extends FObj {
//cell.setStartOffset(widthOfCellsSoFar);
cell.setStartOffset( cellState.getWidthOfCellSoFar() );

int width = ((TableColumn) columns.elementAt(i)).getColumnWidth();
int width = 0;
cellState.setColumn(colCount);
for(int count = 0; count < numCols && count < columns.size(); count++) {
width += ((TableColumn) columns.elementAt(colCount)).getColumnWidth();
colCount++;
}

cell.setWidth(width);
widthOfCellsSoFar += width;
@@ -428,10 +466,10 @@ public class TableRow extends FObj {
if ((status = cell.layout(areaContainer)).isIncomplete())
{
this.marker = i;
if ((i != 0) && (status.getCode() == Status.AREA_FULL_NONE))
/* if ((i != 0) && (status.getCode() == Status.AREA_FULL_NONE))
{
status = new Status(Status.AREA_FULL_SOME);
}
}*/


if( status.getCode() == Status.AREA_FULL_SOME )
@@ -464,6 +502,7 @@ public class TableRow extends FObj {
// removing something that was added by succession
// of cell.layout()
// just to keep my sanity here, Hani
area.increaseHeight(areaContainer.getHeight());
area.removeChild(areaContainer);
this.resetMarker();
this.removeID(area.getIDReferences());
@@ -495,8 +534,10 @@ public class TableRow extends FObj {
}

// added by Dresdner Bank, Germany
if(spacer != null)
if(spacer != null) {
area.addChild(spacer);
spacer = null;
}

area.addChild(areaContainer);
areaContainer.end();
@@ -544,6 +585,9 @@ public class TableRow extends FObj {
}
else
{
if (keepWithNext != 0) {
return new Status(Status.KEEP_WITH_NEXT);
}
return new Status(Status.OK);
}
@@ -552,4 +596,19 @@ public class TableRow extends FObj {
public int getAreaHeight() {
return areaContainer.getHeight();
}

public void removeLayout(Area area)
{
if(spacer != null)
area.removeChild(spacer);

// removing something that was added by succession
// of cell.layout()
// just to keep my sanity here, Hani
// area.increaseHeight(areaContainer.getHeight());
area.removeChild(areaContainer);
this.resetMarker();
this.removeID(area.getIDReferences());
marker = 0;
}
}

+ 28
- 23
src/org/apache/fop/layout/AreaContainer.java View File

@@ -1,36 +1,36 @@
/*-- $Id$ --
/*-- $Id$ --

============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Fop" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -41,12 +41,12 @@
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
James Tauber <jtauber@jtauber.com>. For more information on the Apache
James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.fop.layout;

@@ -57,38 +57,43 @@ import org.apache.fop.fo.properties.*;
// Java
import java.util.Vector;
import java.util.Enumeration;
public class AreaContainer extends Area {

private int xPosition; // should be able to take value 'left' and 'right' too
private int yPosition; // should be able to take value 'top' and 'bottom' too
private int position;

public AreaContainer(FontState fontState, int xPosition, int yPosition, int allocationWidth, int maxHeight, int position) {
super(fontState, allocationWidth, maxHeight);
this.xPosition = xPosition;
this.yPosition = yPosition;
public AreaContainer(FontState fontState, int xPosition,
int yPosition, int allocationWidth, int maxHeight,
int position) {
super(fontState, allocationWidth, maxHeight);
this.xPosition = xPosition;
this.yPosition = yPosition;
this.position = position;
}

public void render(Renderer renderer) {
renderer.renderAreaContainer(this);
renderer.renderAreaContainer(this);
}

public int getPosition() {
return position;
return position;
}

public int getXPosition() {
return xPosition + this.paddingLeft + this.borderWidthLeft;
}

public void setXPosition(int value)
{
xPosition=value;
public void setXPosition(int value) {
xPosition = value;
}

public int getYPosition() {
return yPosition + this.paddingTop + this.borderWidthTop;
return yPosition + this.paddingTop + this.borderWidthTop;
}

public void setYPosition(int value) {
yPosition = value;
}
}

Loading…
Cancel
Save