area.spaceLeft(), Position.RELATIVE);
areaContainer.foCreator = this; // G Seshadri
areaContainer.setPage(area.getPage());
+ areaContainer.setParent(area);
areaContainer.setBackground(propMgr.getBackgroundProps());
areaContainer.setBorderAndPadding(propMgr.getBorderAndPadding());
areaContainer.start();
// areaContainer.end();
area.increaseHeight(areaContainer.getHeight());
- area.setAbsoluteHeight(areaContainer.getAbsoluteHeight());
if (i == numChildren - 1) {
this.marker = BREAK_AFTER;
if (spaceAfter != 0) {
// areaContainer.end();
area.increaseHeight(areaContainer.getHeight());
- area.setAbsoluteHeight(areaContainer.getAbsoluteHeight());
}
// Fix for infinite loop bug if spanned rows are too big for page
area.increaseHeight(areaContainer.getHeight());
- area.setAbsoluteHeight(areaContainer.getAbsoluteHeight());
-
if (spaceAfter != 0) {
area.increaseHeight(spaceAfter);
area.setMaxHeight(area.getMaxHeight() - spaceAfter);
Page p = area.getPage();
- AreaContainer ac = p.getBody().getCurrentColumnArea();
+ //AreaContainer ac = p.getBody().getCurrentColumnArea();
+ AreaContainer ac = area.getNearestAncestorAreaContainer();
+ while (ac!=null && ac.getPosition()!=Position.ABSOLUTE) {
+ ac = ac.getNearestAncestorAreaContainer();
+ }
+ if (ac == null) {
+ ac = p.getBody().getCurrentColumnArea();
+ //System.err.println("Using currentColumnArea as AC for link");
+ }
if (ac == null) {
throw new FOPException("Couldn't get ancestor AreaContainer when processing basic-link");
}
// pass on command line
String mergeLinks = System.getProperty("links.merge");
- if ((null != mergeLinks) &&!mergeLinks.equalsIgnoreCase("no")) {
+ if ((null == mergeLinks) || mergeLinks.equalsIgnoreCase("yes")) {
ls.mergeLinks();
}
area.setMaxHeight(area.getMaxHeight() - spaceLeft
+ blockArea.getMaxHeight());
area.increaseHeight(blockArea.getHeight());
- area.setAbsoluteHeight(blockArea.getAbsoluteHeight());
anythingLaidOut = true;
return status;
area.setMaxHeight(area.getMaxHeight() - spaceLeft
+ blockArea.getMaxHeight());
area.increaseHeight(blockArea.getHeight());
- area.setAbsoluteHeight(blockArea.getAbsoluteHeight());
anythingLaidOut = true;
return status;
}
/* should this be combined into above? */
area.increaseHeight(blockArea.getHeight());
- area.setAbsoluteHeight(blockArea.getAbsoluteHeight());
-
if (spaceAfter != 0) {
area.addDisplaySpace(spaceAfter);
}
return this.span;
}
+ public void resetMarker() {
+ anythingLaidOut = false;
+ super.resetMarker();
+ }
+
}
areaContainer.setBorderAndPadding(propMgr.getBorderAndPadding());
areaContainer.start();
- areaContainer.setAbsoluteHeight(area.getAbsoluteHeight());
+ //areaContainer.setAbsoluteHeight(top);
+ areaContainer.setAbsoluteHeight(0);
areaContainer.setIDReferences(area.getIDReferences());
int numChildren = this.children.size();
prevChildMustKeepWithNext = true;
}
}
- area.setAbsoluteHeight(areaContainer.getAbsoluteHeight());
areaContainer.end();
if (position == Position.ABSOLUTE)
return new Status(Status.AREA_FULL_NONE);
}
}
- la.addInlineArea(imageArea);
+ la.addInlineArea(imageArea, this.getLinkSet());
} else {
area.addChild(imageArea);
area.increaseHeight(imageArea.getContentHeight());
alignLast, lineHeight);
blockArea.setGeneratedBy(this);
blockArea.isFirst(true);
+ blockArea.setParent(area);
blockArea.setPage(area.getPage());
blockArea.start();
return new Status(Status.AREA_FULL_NONE);
}
}
- la.addInlineArea(areaCurrent);
+ la.addInlineArea(areaCurrent, this.getLinkSet());
} else {
area.addChild(areaCurrent);
area.increaseHeight(areaCurrent.getEffectiveHeight());
}
}
+
area.getAllocationWidth(), area.spaceLeft(),
startIndent, endIndent, 0, align, alignLast,
lineHeight);
+ // Fix links in lists in tables problem
+ blockArea.setTableCellXOffset(area.getTableCellXOffset());
blockArea.setGeneratedBy(this);
this.areasGenerated++;
if (this.areasGenerated == 1)
blockArea.addMarkers(this.getMarkers());
+ blockArea.setParent(area);
blockArea.setPage(area.getPage());
blockArea.setBackground(propMgr.getBackgroundProps());
blockArea.start();
blockArea.end();
area.addChild(blockArea);
area.increaseHeight(blockArea.getHeight());
- area.setAbsoluteHeight(blockArea.getAbsoluteHeight());
return status;
}
}
blockArea.end();
area.addChild(blockArea);
area.increaseHeight(blockArea.getHeight());
- area.setAbsoluteHeight(blockArea.getAbsoluteHeight());
if (spaceAfter != 0) {
area.addDisplaySpace(spaceAfter);
new BlockArea(propMgr.getFontState(area.getFontInfo()),
area.getAllocationWidth(), area.spaceLeft(), 0, 0,
0, align, alignLast, lineHeight);
+
+ // Fix links in lists in tables problem
+ blockArea.setTableCellXOffset(area.getTableCellXOffset());
+
this.blockArea.setGeneratedBy(this);
this.areasGenerated++;
if (this.areasGenerated == 1)
if (this.hasMarkers())
this.blockArea.addMarkers(this.getMarkers());
+ blockArea.setParent(area);
blockArea.setPage(area.getPage());
blockArea.start();
blockArea.end();
area.addChild(blockArea);
area.increaseHeight(blockArea.getHeight());
- area.setAbsoluteHeight(blockArea.getAbsoluteHeight());
this.marker = 1;
return status;
}
blockArea.end();
area.addChild(blockArea);
area.increaseHeight(blockArea.getHeight());
- area.setAbsoluteHeight(blockArea.getAbsoluteHeight());
if (spaceAfter != 0) {
area.addDisplaySpace(spaceAfter);
if (area instanceof org.apache.fop.layout.AreaContainer)
((org.apache.fop.layout.AreaContainer)area).setAreaName(regionClass);
- if (regionClass.equals(RegionBefore.REGION_CLASS)) {
- area.setAbsoluteHeight(-area.getMaxHeight());
- } else if (regionClass.equals(RegionAfter.REGION_CLASS)) {
- area.setAbsoluteHeight(area.getPage().getBody().getMaxHeight());
- }
+ area.setAbsoluteHeight(0); // Ytop relative to self!
+
setContentWidth(area.getContentWidth());
for (int i = 0; i < numChildren; i++) {
areaContainer.foCreator = this; // G Seshadri
areaContainer.setPage(area.getPage());
+ areaContainer.setParent(area);
areaContainer.setBackground(propMgr.getBackgroundProps());
areaContainer.setBorderAndPadding(propMgr.getBorderAndPadding());
areaContainer.start();
if (areaContainer.getContentHeight() > 0) {
area.addChild(areaContainer);
area.increaseHeight(areaContainer.getHeight());
- area.setAbsoluteHeight(areaContainer.getAbsoluteHeight());
if (this.omitHeaderAtBreak) {
// remove header, no longer needed
tableHeader = null;
log.warn("footer could not fit on page, moving last body row to next page");
area.addChild(areaContainer);
area.increaseHeight(areaContainer.getHeight());
- area.setAbsoluteHeight(areaContainer.getAbsoluteHeight());
if (this.omitHeaderAtBreak) {
// remove header, no longer needed
tableHeader = null;
/* should this be combined into above? */
area.increaseHeight(areaContainer.getHeight());
- area.setAbsoluteHeight(areaContainer.getAbsoluteHeight());
-
if (spaceAfter != 0) {
area.addDisplaySpace(spaceAfter);
}
cellArea.foCreator = this; // G Seshadri
cellArea.setPage(area.getPage());
+ cellArea.setParent(area);
try {
cellArea.setBorderAndPadding((BorderAndPadding)
propMgr.getBorderAndPadding().clone());
cellArea.setAbsoluteHeight(area.getAbsoluteHeight()); // ???
cellArea.setIDReferences(area.getIDReferences());
- // ******** CHECK THIS: we've changed startOffset (KL)
- cellArea.setTableCellXOffset(startOffset);
+ // Add adjust for padding and border to fix link alignment!
+ cellArea.setTableCellXOffset(startOffset + startAdjust);
int numChildren = this.children.size();
for (int i = this.marker; bDone==false && i < numChildren; i++) {
Position.RELATIVE);
areaContainer.foCreator = this; // G Seshadri
areaContainer.setPage(area.getPage());
+ areaContainer.setParent(area);
areaContainer.setBackground(propMgr.getBackgroundProps());
areaContainer.start();
// used to keep track of the current x position within a table. Required for drawing rectangle links.
protected int tableCellXOffset = 0;
- // used to keep track of the absolute height on the page. Required for drawing rectangle links.
- private int absoluteHeight = 0;
+ /** Stores position of top of this area relative to page column Ypos.
+ * Used to set the position of link hotspot rectangles.
+ */
+ private int absoluteYtop = 0;
protected int contentRectangleWidth;
public void addDisplaySpace(int size) {
this.addChild(new DisplaySpace(size));
- this.absoluteHeight += size;
this.currentHeight += size;
}
tableCellXOffset = offset;
}
+ /**
+ * Return absolute Y position of the current bottom of this area,
+ * not counting any bottom padding or border. This is used
+ * to set positions for link hotspots.
+ * In fact, the position is not really absolute, but is relative
+ * to the Ypos of the column-level AreaContainer, even when the
+ * area is in a page header or footer!
+ */
public int getAbsoluteHeight() {
- return absoluteHeight;
+ return absoluteYtop + getPaddingTop() + getBorderTopWidth() +
+ currentHeight;
}
+ /**
+ * Set "absolute" Y position of the top of this area. In fact, the
+ * position is not really absolute, but relative to the Ypos of
+ * the column-level AreaContainer, even when the area is in a
+ * page header or footer!
+ * It is set from the value of getAbsoluteHeight() on the parent
+ * area, just before adding this area.
+ */
public void setAbsoluteHeight(int value) {
- absoluteHeight = value;
- }
-
- public void increaseAbsoluteHeight(int value) {
- absoluteHeight += value;
+ absoluteYtop = value;
}
public void increaseHeight(int amount) {
this.currentHeight += amount;
- this.absoluteHeight += amount;
}
// Remove allocation height of child
public void removeChild(Area area) {
this.currentHeight -= area.getHeight();
- this.absoluteHeight -= area.getHeight();
this.children.remove(area);
}
public void removeChild(DisplaySpace spacer) {
this.currentHeight -= spacer.getSize();
- this.absoluteHeight -= spacer.getSize();
this.children.remove(spacer);
}
if (currentHeight > getMaxHeight()) {
currentHeight = getMaxHeight();
}
- absoluteHeight += (currentHeight - prevHeight);
}
public void setMaxHeight(int height) {
public AreaContainer getNearestAncestorAreaContainer() {
Area area = this.getParent();
- while (!(area instanceof AreaContainer)) {
+ while (area != null && !(area instanceof AreaContainer)) {
area = area.getParent();
}
return (AreaContainer)area;
}
addSpacedWord(new String(data, wordStart, wordLength), ls,
- finalWidth + spaceWidth + embeddedLinkStart,
+ finalWidth + pendingWidth,
spaceWidth, textState, true);
embeddedLinkStart += wordWidth;
public void setLinkSet(LinkSet ls) {}
- public void addInlineArea(Area box) {
+ public void addInlineArea(InlineArea box, LinkSet ls) {
addPending();
addChild(box);
+ if (ls != null) {
+ Rectangle lr=new Rectangle(finalWidth, 0,box.getContentWidth(),
+ box.getContentHeight());
+ ls.addRect(lr, this, box);
+ }
prev = TEXT;
finalWidth += box.getContentWidth();
}
}
+
return getEffectiveHeight();
}
+ public int getContentHeight() {
+ return getEffectiveHeight();
+ }
+
public int getXOffset() {
return this.xOffset;
}