keiron 2002/11/06 07:46:55
Modified: src/org/apache/fop/layoutmgr
BlockContainerLayoutManager.java
src/org/apache/fop/layoutmgr/list Item.java
ListBlockLayoutManager.java
ListItemLayoutManager.java
src/org/apache/fop/layoutmgr/table Body.java Caption.java
Cell.java Row.java
TableAndCaptionLayoutManager.java
Log:
some minor improvements to make layout work a bit better
Revision Changes Path
1.4 +15 -15
xml-fop/src/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
Index: BlockContainerLayoutManager.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BlockContainerLayoutManager.java 13 Sep 2002 08:21:54 -0000 1.3
+++ BlockContainerLayoutManager.java 6 Nov 2002 15:46:55 -0000 1.4
@@ -58,7 +58,7 @@
propManager = pm;
abProps = pm.getAbsolutePositionProps();
- if(abProps.absolutePosition == AbsolutePosition.ABSOLUTE) {
+ if (abProps.absolutePosition == AbsolutePosition.ABSOLUTE) {
Rectangle2D rect = new Rectangle2D.Double(abProps.left,
abProps.top, abProps.right - abProps.left,
abProps.bottom - abProps.top);
@@ -77,7 +77,7 @@
public BreakPoss getNextBreakPoss(LayoutContext context) {
- if(abProps.absolutePosition == AbsolutePosition.ABSOLUTE) {
+ if (abProps.absolutePosition == AbsolutePosition.ABSOLUTE) {
return getAbsoluteBreakPoss(context);
}
@@ -90,13 +90,13 @@
MinOptMax stackLimit;
int ipd = context.getRefIPD();
boolean rotated = vals[0] == 0.0;
- if(rotated) {
+ if (rotated) {
// rotated 90 degrees
stackLimit = new MinOptMax(1000000);
ipd = getRotatedIPD();
absoluteCTM = new CTM(vals[0], vals[1], vals[2], vals[3], 0, 0);
} else {
- if(vals[0] == -1.0) {
+ if (vals[0] == -1.0) {
absoluteCTM = new CTM(vals[0], vals[1], vals[2], vals[3], 0, 0);
}
stackLimit = context.getStackLimit();
@@ -123,7 +123,7 @@
while (!curLM.isFinished()) {
if ((bp = curLM.getNextBreakPoss(childLC)) != null) {
stackSize.add(bp.getStackingSize());
- if (stackSize.min > stackLimit.max) {
+ if (stackSize.opt > stackLimit.max) {
// reset to last break
if (lastPos != null) {
reset(lastPos.getPosition());
@@ -139,7 +139,7 @@
stackLimit, stackSize));
}
}
- if(!rotated) {
+ if (!rotated) {
BreakPoss breakPoss;
breakPoss = new BreakPoss(new LeafPosition(this,
childBreaks.size() - 1));
@@ -148,7 +148,7 @@
}
}
setFinished(true);
- if(rotated) {
+ if (rotated) {
BreakPoss breakPoss;
breakPoss = new BreakPoss(new LeafPosition(this,
childBreaks.size() - 1));
@@ -189,10 +189,10 @@
// to the normal stacking
breakPoss.setStackingSize(new MinOptMax(0));
- if(stackSize.min > relDims.bpd) {
- if(overflow == Overflow.HIDDEN) {
+ if (stackSize.opt > relDims.bpd) {
+ if (overflow == Overflow.HIDDEN) {
clip = true;
- } else if(overflow == Overflow.ERROR_IF_OVERFLOW) {
+ } else if (overflow == Overflow.ERROR_IF_OVERFLOW) {
//log.error("contents overflows block-container viewport:
clipping");
clip = true;
}
@@ -230,7 +230,7 @@
public Area getParentArea(Area childArea) {
if (curBlockArea == null) {
viewportBlockArea = new BlockViewport();
- if(abProps.absolutePosition == AbsolutePosition.ABSOLUTE) {
+ if (abProps.absolutePosition == AbsolutePosition.ABSOLUTE) {
viewportBlockArea.setXOffset(abProps.left);
viewportBlockArea.setYOffset(abProps.top);
viewportBlockArea.setWidth(abProps.right - abProps.left);
@@ -241,12 +241,12 @@
} else {
double[] vals = absoluteCTM.toArray();
boolean rotated = vals[0] == 0.0;
- if(rotated) {
+ if (rotated) {
viewportBlockArea.setWidth(relDims.bpd);
viewportBlockArea.setHeight(getRotatedIPD());
viewportBlockArea.setCTM(absoluteCTM);
viewportBlockArea.setClip(clip);
- } else if(vals[0] == -1.0) {
+ } else if (vals[0] == -1.0) {
// need to set bpd to actual size for rotation
// and stacking
viewportBlockArea.setWidth(relDims.ipd);
@@ -259,7 +259,7 @@
curBlockArea = new Block();
viewportBlockArea.addBlock(curBlockArea);
- if(abProps.absolutePosition == AbsolutePosition.ABSOLUTE) {
+ if (abProps.absolutePosition == AbsolutePosition.ABSOLUTE) {
viewportBlockArea.setPositioning(Block.ABSOLUTE);
}
1.2 +10 -21 xml-fop/src/org/apache/fop/layoutmgr/list/Item.java
Index: Item.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/list/Item.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Item.java 3 Nov 2002 16:29:58 -0000 1.1
+++ Item.java 6 Nov 2002 15:46:55 -0000 1.2
@@ -39,7 +39,6 @@
private ArrayList childBreaks = new ArrayList();
private int xoffset;
- private int yoffset;
private int itemIPD;
/**
@@ -74,7 +73,7 @@
itemIPD = context.getRefIPD();
while ((curLM = getChildLM()) != null) {
- if(curLM.generatesInlineAreas()) {
+ if (curLM.generatesInlineAreas()) {
// error
curLM.setFinished(true);
continue;
@@ -91,7 +90,7 @@
while (!curLM.isFinished()) {
if ((bp = curLM.getNextBreakPoss(childLC)) != null) {
stackSize.add(bp.getStackingSize());
- if (stackSize.min > context.getStackLimit().max) {
+ if (stackSize.opt > context.getStackLimit().max) {
// reset to last break
if (lastPos != null) {
reset(lastPos.getPosition());
@@ -117,18 +116,9 @@
}
/**
- * Set the y offset of this cell.
- * This offset is used to set the absolute position of the cell.
- *
- * @param off the y direction offset
- */
- public void setYOffset(int off) {
- yoffset = off;
- }
-
- /**
- * Set the x offset of this cell.
- * This offset is used to set the absolute position of the cell.
+ * Set the x offset of this list item.
+ * This offset is used to set the absolute position
+ * of the list item within the parent block area.
*
* @param off the x offset
*/
@@ -138,7 +128,7 @@
/**
* Add the areas for the break points.
- * The cell contains block stacking layout managers
+ * The list item contains block stacking layout managers
* that add block areas.
*
* @param parentIter the iterator of the break positions
@@ -164,10 +154,10 @@
}
}
- if(borderProps != null) {
+ if (borderProps != null) {
addBorders(curBlockArea, borderProps);
}
- if(backgroundProps != null) {
+ if (backgroundProps != null) {
addBackground(curBlockArea, backgroundProps);
}
@@ -196,7 +186,6 @@
curBlockArea.setPositioning(Block.ABSOLUTE);
// set position
curBlockArea.setXOffset(xoffset);
- curBlockArea.setYOffset(yoffset);
curBlockArea.setWidth(itemIPD);
//curBlockArea.setHeight();
@@ -211,7 +200,7 @@
}
/**
- * Add the child to the cell block area.
+ * Add the child to the list item area.
*
* @param childArea the child to add to the cell
* @return unused
1.2 +5 -7
xml-fop/src/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
Index: ListBlockLayoutManager.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ListBlockLayoutManager.java 3 Nov 2002 16:29:58 -0000 1.1
+++ ListBlockLayoutManager.java 6 Nov 2002 15:46:55 -0000 1.2
@@ -134,11 +134,9 @@
getParentArea(null);
addID();
- // add column, body then row areas
+ // the list block contains areas stacked from each list item
- // add table header areas
-
- int tableHeight = 0;
+ int listHeight = 0;
ListItemLayoutManager childLM;
int iStartPos = 0;
@@ -152,13 +150,13 @@
iStartPos = lfp.getLeafPos() + 1;
while ((childLM = (ListItemLayoutManager)breakPosIter.getNextChildLM())
!= null) {
childLM.addAreas(breakPosIter, lc);
- tableHeight += childLM.getListItemHeight();
+ listHeight += childLM.getListItemHeight();
}
}
// add footer areas
- curBlockArea.setHeight(tableHeight);
+ curBlockArea.setHeight(listHeight);
if(borderProps != null) {
addBorders(curBlockArea, borderProps);
1.2 +4 -18
xml-fop/src/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
Index: ListItemLayoutManager.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ListItemLayoutManager.java 3 Nov 2002 16:29:58 -0000 1.1
+++ ListItemLayoutManager.java 6 Nov 2002 15:46:55 -0000 1.2
@@ -40,7 +40,6 @@
private List cellList = null;
private List columns = null;
private int listItemHeight;
- private int yoffset;
private BorderAndPadding borderProps = null;
private BackgroundProps backgroundProps;
@@ -122,7 +121,7 @@
while (!curLM.isFinished()) {
if ((bp = curLM.getNextBreakPoss(childLC)) != null) {
stackSize.add(bp.getStackingSize());
- if (stackSize.min > context.getStackLimit().max) {
+ if (stackSize.opt > context.getStackLimit().max) {
// reset to last break
if (lastPos != null) {
curLM.resetPosition(lastPos.getPosition());
@@ -130,8 +129,9 @@
curLM.resetPosition(null);
}
break;
+ } else {
+ lastPos = bp;
}
- lastPos = bp;
childBreaks.add(bp);
childLC.setStackLimit(MinOptMax.subtract(
@@ -165,16 +165,6 @@
}
/**
- * Set the y position offset of this list item.
- * This is used to set the position of the areas returned by this list item.
- *
- * @param off the y offset
- */
- public void setYOffset(int off) {
- yoffset = off;
- }
-
- /**
* Add the areas for the break points.
* This sets the offset of each cell as it is added.
*
@@ -187,18 +177,15 @@
addID();
Item childLM;
- int iStartPos = 0;
LayoutContext lc = new LayoutContext(0);
while (parentIter.hasNext()) {
ItemPosition lfp = (ItemPosition) parentIter.next();
// Add the block areas to Area
- int xoffset = 0;
for (Iterator iter = lfp.cellBreaks.iterator(); iter.hasNext();) {
List cellsbr = (List)iter.next();
PositionIterator breakPosIter;
breakPosIter = new BreakPossPosIter(cellsbr, 0, cellsbr.size());
- iStartPos = lfp.getLeafPos() + 1;
while ((childLM = (Item)breakPosIter.getNextChildLM()) != null) {
if(childLM == body) {
@@ -206,7 +193,6 @@
}
childLM.addAreas(breakPosIter, lc);
}
- xoffset += 100000;
}
}
1.5 +6 -1 xml-fop/src/org/apache/fop/layoutmgr/table/Body.java
Index: Body.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/table/Body.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Body.java 1 Nov 2002 10:49:34 -0000 1.4
+++ Body.java 6 Nov 2002 15:46:55 -0000 1.5
@@ -53,6 +53,11 @@
super(fobj);
}
+ /**
+ * Initialize properties for this layout manager.
+ *
+ * @param propMgr the property manager from the fo object
+ */
protected void initProperties(PropertyManager propMgr) {
borderProps = propMgr.getBorderAndPadding();
backgroundProps = propMgr.getBackgroundProps();
1.2 +2 -2 xml-fop/src/org/apache/fop/layoutmgr/table/Caption.java
Index: Caption.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/table/Caption.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Caption.java 13 Sep 2002 08:21:55 -0000 1.1
+++ Caption.java 6 Nov 2002 15:46:55 -0000 1.2
@@ -76,7 +76,7 @@
while (!curLM.isFinished()) {
if ((bp = curLM.getNextBreakPoss(childLC)) != null) {
stackSize.add(bp.getStackingSize());
- if (stackSize.min > context.getStackLimit().max) {
+ if (stackSize.opt > context.getStackLimit().max) {
// reset to last break
if (lastPos != null) {
reset(lastPos.getPosition());
1.5 +2 -2 xml-fop/src/org/apache/fop/layoutmgr/table/Cell.java
Index: Cell.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/table/Cell.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Cell.java 5 Nov 2002 11:19:52 -0000 1.4
+++ Cell.java 6 Nov 2002 15:46:55 -0000 1.5
@@ -92,7 +92,7 @@
while (!curLM.isFinished()) {
if ((bp = curLM.getNextBreakPoss(childLC)) != null) {
stackSize.add(bp.getStackingSize());
- if (stackSize.min > context.getStackLimit().max) {
+ if (stackSize.opt > context.getStackLimit().max) {
// reset to last break
if (lastPos != null) {
reset(lastPos.getPosition());
1.5 +2 -2 xml-fop/src/org/apache/fop/layoutmgr/table/Row.java
Index: Row.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/table/Row.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Row.java 5 Nov 2002 11:19:52 -0000 1.4
+++ Row.java 6 Nov 2002 15:46:55 -0000 1.5
@@ -152,7 +152,7 @@
while (!curLM.isFinished()) {
if ((bp = curLM.getNextBreakPoss(childLC)) != null) {
stackSize.add(bp.getStackingSize());
- if (stackSize.min > context.getStackLimit().max) {
+ if (stackSize.opt > context.getStackLimit().max) {
// reset to last break
if (lastPos != null) {
reset(lastPos.getPosition());
1.2 +2 -2
xml-fop/src/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java
Index: TableAndCaptionLayoutManager.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TableAndCaptionLayoutManager.java 13 Sep 2002 08:21:55 -0000 1.1
+++ TableAndCaptionLayoutManager.java 6 Nov 2002 15:46:55 -0000 1.2
@@ -78,7 +78,7 @@
while (!curLM.isFinished()) {
if ((bp = curLM.getNextBreakPoss(childLC)) != null) {
stackSize.add(bp.getStackingSize());
- if (stackSize.min > context.getStackLimit().max) {
+ if (stackSize.opt > context.getStackLimit().max) {
// reset to last break
if (lastPos != null) {
reset(lastPos.getPosition());
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]