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 Christer Morén <ch...@omgroup.com> on 2000/08/01 15:38:00 UTC
keep-with-next
I'm playing around with the cvs source (co july 27). Except for the fact that
the areas aren't removed from the previous page, keep-with-next doesn't work
with more than the last fo element using keep-with-next. The problem seems to be
in Flow.java: layout (Area area).
boolean prevChildMustKeepWithNext; This doesn't keep track of previous (more
than 1) elements using the keep-with-next attribute. I don't know if this breaks
any other code, but a solution could be to use a counter instead (see below), it
seems to work for me... The prevChild.removeAreas () statement should of course
also be changed appropriatly...
Flow.java:
public Status layout(Area area) throws FOPException
{
if (this.marker == START)
{
this.marker = 0;
}
int prevChildMustKeepWithNext = 0;
int numChildren = this.children.size();
for (int i = this.marker; i < numChildren; i++)
{
FObj fo = (FObj) children.elementAt(i);
Status status;
if ((status = fo.layout(area)).isIncomplete())
{
if ((prevChildMustKeepWithNext != 0) && (status.laidOutNone()))
{
this.marker = i - prevChildMustKeepWithNext;
FObj prevChild = (FObj) children.elementAt(this.marker);
prevChild.removeAreas();
prevChild.resetMarker();
prevChild.removeID(area.getIDReferences());
return new Status(Status.AREA_FULL_SOME);
// should probably return AREA_FULL_NONE if first
// or perhaps an entirely new status code
}
else
{
this.marker = i;
return status;
}
}
if (status.getCode() == Status.KEEP_WITH_NEXT)
{
prevChildMustKeepWithNext++;
}
else
{
prevChildMustKeepWithNext = 0;
}
}
return new Status(Status.OK);
}
Regards
Christer Moren