keiron 2002/09/18 06:50:14
Modified: src/org/apache/fop/area Area.java BeforeFloat.java
Block.java BlockParent.java BlockViewport.java
BodyRegion.java Flow.java Footnote.java
LineArea.java LineTrait.java MainReference.java
MinOptMax.java Page.java RegionReference.java
RegionViewport.java Resolveable.java Span.java
Title.java Trait.java TreeExt.java
src/org/apache/fop/area/inline Anchor.java Character.java
FilledArea.java ForeignObject.java Image.java
InlineArea.java InlineParent.java Leader.java
Space.java UnresolvedPageNumber.java Viewport.java
Word.java
Removed: src/org/apache/fop/area/inline Stretch.java
Log:
cleaned up some of the area tree
removed parent and min/opt/max from area tree, layout managers can handle all this
fixed a number of style errors
Revision Changes Path
1.9 +48 -58 xml-fop/src/org/apache/fop/area/Area.java
Index: Area.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/Area.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Area.java 13 Sep 2002 08:21:53 -0000 1.8
+++ Area.java 18 Sep 2002 13:50:13 -0000 1.9
@@ -105,86 +105,59 @@
private int areaClass = CLASS_NORMAL;
private int ipd;
+ private HashMap props = null;
- protected Area parent = null; // Doesn't need to be saved in serialization
-
+ /**
+ * Get the area class of this area.
+ *
+ * @return the area class
+ */
public int getAreaClass() {
return areaClass;
}
+ /**
+ * Set the area class of this area.
+ *
+ * @param areaClass the area class
+ */
public void setAreaClass(int areaClass) {
this.areaClass = areaClass;
}
+ /**
+ * Set the inline progression dimension of this area.
+ *
+ * @param i the new inline progression dimension
+ */
public void setIPD(int i) {
ipd = i;
}
+ /**
+ * Get the inline progression dimension of this area.
+ *
+ * @return the inline progression dimension
+ */
public int getIPD() {
return ipd;
}
/**
- * Return a length range describing the minimum, optimum and maximum
- * lengths available for content in the block-progression-direction.
- * This is calculated from the theoretical maximum size of the area
- * and its current content.
- */
- public MinOptMax getAvailBPD() {
- return MinOptMax.subtract(getMaxBPD(), getContentBPD());
- }
-
- /**
- * Return a length range describing the theoretical maximum size of an
- * area in the block-progression-direction.
- * For areas holding normal flowing or floating content in paged media,
- * this depends on the size of the body. In general the answer is the
- * gotten from the parent. At the body level, the calculation accounts
- * for the sizes of the conditional areas.
- */
- public MinOptMax getMaxBPD() {
- if (parent != null) {
- return parent.getMaxBPD();
- } else {
- return new MinOptMax();
- }
- }
-
- /**
- * Return a length range describing the minimum, optimum and maximum
- * lengths of all area content in the block-progression-direction.
- * This is based on the allocation rectangles of all content in
- * the area.
+ * Add a child to this area.
+ * The default is to do nothing. Subclasses must override
+ * to do something if they can have child areas.
+ *
+ * @param child the child area to add
*/
- public MinOptMax getContentBPD() {
- return new MinOptMax();
+ public void addChild(Area child) {
}
/**
- * Return a length range describing the minimum, optimum and maximum
- * lengths of the area's allocation rectangle
- * in the block-progression-direction.
- * This is based on the allocation rectangles of all content in
- * the area.
- * The default implementation simply returns the same as the content BPD.
- * If an Area has before or after border and padding, these contribute
- * to the allocation BPD, depending on conditionality.
+ * Add a trait property to this area.
+ *
+ * @param prop the Trait to add
*/
- public MinOptMax getAllocationBPD() {
- return getContentBPD();
- }
-
- public void setParent(Area parent) {
- this.parent = parent;
- }
-
- // Do nothing! Let subclasses do something if they can have child areas.
- public void addChild(Area child) {
- }
-
-
- HashMap props = null;
-
public void addTrait(Trait prop) {
if (props == null) {
props = new HashMap(20);
@@ -192,6 +165,12 @@
props.put(prop.propType, prop.data);
}
+ /**
+ * Add a trait to this area.
+ *
+ * @param traitCode the trait key
+ * @param prop the value of the trait
+ */
public void addTrait(Object traitCode, Object prop) {
if (props == null) {
props = new HashMap(20);
@@ -199,10 +178,21 @@
props.put(traitCode, prop);
}
+ /**
+ * Get the map of all traits on this area.
+ *
+ * @return the map of traits
+ */
public HashMap getTraits() {
return this.props;
}
+ /**
+ * Get a trait from this area.
+ *
+ * @param oTraitCode the trait key
+ * @return the trait value
+ */
public Object getTrait(Object oTraitCode) {
return (props != null ? props.get(oTraitCode) : null);
}
1.4 +29 -39 xml-fop/src/org/apache/fop/area/BeforeFloat.java
Index: BeforeFloat.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/BeforeFloat.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BeforeFloat.java 9 Nov 2001 22:02:34 -0000 1.3
+++ BeforeFloat.java 18 Sep 2002 13:50:13 -0000 1.4
@@ -1,64 +1,54 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
package org.apache.fop.area;
-import java.util.List;
-import java.util.ArrayList;
-
+/**
+ * The before float area.
+ * This is used to place the before float areas.
+ * It has an optional separator and before float block children.
+ */
public class BeforeFloat extends BlockParent {
// this is an optional block area that will be rendered
// as the separator only if there are float areas
- Block separator = null;
-
- // before float area
- // has an optional separator
- // and a list of sub block areas
-
- ArrayList blocks = null;
-
- public void addBlock(Block block) {
- if (blocks == null) {
- blocks = new ArrayList();
- }
- blocks.add(block);
- }
+ private Block separator = null;
+ /**
+ * Set the separator area for this before float.
+ *
+ * @param sep the before float separator area
+ */
public void setSeparator(Block sep) {
separator = sep;
}
- public List getBlocks() {
- return blocks;
- }
-
+ /**
+ * Get the separator area for this before float.
+ *
+ * @return the before float separator area
+ */
public Block getSeparator() {
return separator;
}
+ /**
+ * Get the height of this before float.
+ * It gets the height of the children and if there is a
+ * separator its height is also added.
+ *
+ * @return the height of the before float including separator
+ */
public int getHeight() {
- if (blocks == null) {
- return 0;
+ int h = super.getHeight();
+ if (separator != null) {
+ h += separator.getHeight();
}
- int h = 0;
return h;
}
- public MinOptMax getMaxBPD() {
- MinOptMax maxbpd = parent.getMaxBPD();
- BodyRegion body = (BodyRegion)parent;
- Area a = body.getMainReference();
- if (a != null) {
- maxbpd = MinOptMax.subtract(maxbpd, a.getContentBPD());
- }
- if ((a=body.getFootnote()) != null) {
- maxbpd = MinOptMax.subtract(maxbpd, a.getContentBPD());
- }
- return maxbpd;
- }
-
}
+
1.10 +36 -29 xml-fop/src/org/apache/fop/area/Block.java
Index: Block.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/Block.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Block.java 13 Sep 2002 08:21:53 -0000 1.9
+++ Block.java 18 Sep 2002 13:50:13 -0000 1.10
@@ -1,6 +1,6 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
@@ -9,9 +9,6 @@
import java.io.Serializable;
import java.util.ArrayList;
-import java.util.List;
-import java.util.Iterator;
-import java.awt.geom.Rectangle2D;
// block areas hold either more block areas or line
// areas can also be used as a block spacer
@@ -19,10 +16,21 @@
// or by relative to the parent for floats, tables and lists
// cacheable object
// has id information
+
+/**
+ * This is the block area class.
+ * It holds child block areas such as other blocks or lines.
+ */
public class Block extends BlockParent implements Serializable {
- // normally stacked with other blocks
+ /**
+ * Normally stacked with other blocks.
+ */
public static final int STACK = 0;
- // placed relative to the parent area
+
+ /**
+ * Placed relative to the flow position.
+ * This effects the flow placement of stacking normally.
+ */
public static final int RELATIVE = 1;
/**
@@ -32,19 +40,16 @@
public static final int ABSOLUTE = 2;
private int stacking = TB;
-
- // list of marker fo objects that are associated with this area
- // if a retrieve marker resolves this area it will format the
- // available markers, markers are discarded once page complete
- private ArrayList markers = null;
+ private int positioning = STACK;
// a block with may contain the dominant styling info in
// terms of most lines or blocks with info
-
- int positioning = STACK;
-
-
+ /**
+ * Add the block to this block area.
+ *
+ * @param block the block area to add
+ */
public void addBlock(Block block) {
if (children == null) {
children = new ArrayList();
@@ -53,6 +58,11 @@
children.add(block);
}
+ /**
+ * Add the line area to this block area.
+ *
+ * @param line the line area to add
+ */
public void addLineArea(LineArea line) {
if (children == null) {
children = new ArrayList();
@@ -61,26 +71,23 @@
children.add(line);
}
- public MinOptMax getContentBPD() {
- MinOptMax bpd = new MinOptMax();
- if(children != null) {
- for(Iterator iter = children.iterator(); iter.hasNext(); ) {
- Area area = (Area)iter.next();
- MinOptMax mom = area.getContentBPD();
- bpd.add(mom);
- }
- }
- return bpd;
- }
-
+ /**
+ * Set the positioning of this area.
+ *
+ * @param pos the positioning to use when rendering this area
+ */
public void setPositioning(int pos) {
positioning = pos;
}
+ /**
+ * Get the positioning of this area.
+ *
+ * @return the positioning to use when rendering this area
+ */
public int getPositioning() {
return positioning;
}
-
}
1.4 +75 -5 xml-fop/src/org/apache/fop/area/BlockParent.java
Index: BlockParent.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/BlockParent.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BlockParent.java 13 Sep 2002 08:21:53 -0000 1.3
+++ BlockParent.java 18 Sep 2002 13:50:13 -0000 1.4
@@ -1,6 +1,6 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
@@ -10,7 +10,6 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-import java.awt.geom.Rectangle2D;
/**
* A BlockParent holds block-level areas.
@@ -20,16 +19,42 @@
// this position is used for absolute position
// or as an indent
// this has the size in the block progression dimension
+
+ /**
+ * The x offset position of this block parent.
+ * Used for relative and absolute positioning.
+ */
protected int xOffset = 0;
+
+ /**
+ * The y offset position of this block parent.
+ * Used for relative and absolute positioning.
+ */
protected int yOffset = 0;
+
+ /**
+ * The width of this block parent.
+ */
protected int width = 0;
+
+ /**
+ * The height of this block parent.
+ */
protected int height = 0;
- ArrayList children = null;
+ /**
+ * The children of this block parent area.
+ */
+ protected ArrayList children = null;
// orientation if reference area
- int orientation = ORIENT_0;
+ private int orientation = ORIENT_0;
+ /**
+ * Add the block area to this block parent.
+ *
+ * @param block the child block area to add
+ */
public void addBlock(Block block) {
if (children == null) {
children = new ArrayList();
@@ -37,38 +62,83 @@
children.add(block);
}
+ /**
+ * Get the list of child areas for this block area.
+ *
+ * @return the list of child areas
+ */
public List getChildAreas() {
return children;
}
+ /**
+ * Set the X offset of this block parent area.
+ *
+ * @param off the x offset of the block parent area
+ */
public void setXOffset(int off) {
xOffset = off;
}
+ /**
+ * Set the Y offset of this block parent area.
+ *
+ * @param off the y offset of the block parent area
+ */
public void setYOffset(int off) {
yOffset = off;
}
+ /**
+ * Set the width of this block parent area.
+ *
+ * @param w the width of the area
+ */
public void setWidth(int w) {
width = w;
}
+ /**
+ * Set the height of this block parent area.
+ *
+ * @param h the height of the block parent area
+ */
public void setHeight(int h) {
height = h;
}
+ /**
+ * Get the X offset of this block parent area.
+ *
+ * @return the x offset of the block parent area
+ */
public int getXOffset() {
return xOffset;
}
+ /**
+ * Get the Y offset of this block parent area.
+ *
+ * @return the y offset of the block parent area
+ */
public int getYOffset() {
return yOffset;
}
+ /**
+ * Get the width of this block parent area.
+ *
+ * @return the width of the area
+ */
public int getWidth() {
return width;
}
+ /**
+ * Get the height of this block parent area.
+ *
+ * @return the height of the block parent area
+ */
public int getHeight() {
return height;
}
1.2 +34 -8 xml-fop/src/org/apache/fop/area/BlockViewport.java
Index: BlockViewport.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/BlockViewport.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BlockViewport.java 30 Aug 2002 08:03:23 -0000 1.1
+++ BlockViewport.java 18 Sep 2002 13:50:13 -0000 1.2
@@ -1,14 +1,12 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
package org.apache.fop.area;
-import java.awt.geom.Rectangle2D;
-
/**
* A BlockViewport.
* This is used for block level Viewport/reference pairs.
@@ -16,26 +14,54 @@
*/
public class BlockViewport extends Block {
// clipping for this viewport
- boolean clip = false;
- CTM viewportCTM;
-
+ private boolean clip = false;
+ // transform if rotated or absolute
+ private CTM viewportCTM;
+
+ /**
+ * Create a new block viewport area.
+ */
public BlockViewport() {
-
}
+ /**
+ * Set the transform of this viewport.
+ * If the viewport is rotated or has an absolute positioning
+ * this transform will do the work.
+ *
+ * @param ctm the transformation
+ */
public void setCTM(CTM ctm) {
viewportCTM = ctm;
}
+ /**
+ * Get the transform of this block viewport.
+ *
+ * @return the transformation of this viewport
+ * or null if normally stacked without rotation
+ */
public CTM getCTM() {
return viewportCTM;
}
+ /**
+ * Set the clipping for this viewport.
+ *
+ * @param cl the clipping for the viewport
+ */
public void setClip(boolean cl) {
clip = cl;
}
+ /**
+ * Get the clipping for this viewport.
+ *
+ * @return the clipping for the viewport
+ * true if the contents should be clipped for this viewport
+ */
public boolean getClip() {
return clip;
}
}
+
1.7 +17 -28 xml-fop/src/org/apache/fop/area/BodyRegion.java
Index: BodyRegion.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/BodyRegion.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- BodyRegion.java 17 May 2002 14:47:12 -0000 1.6
+++ BodyRegion.java 18 Sep 2002 13:50:13 -0000 1.7
@@ -1,67 +1,60 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
package org.apache.fop.area;
-import java.awt.geom.Rectangle2D;
-
+/**
+ * The body region area.
+ * This area contains a main reference area and optionally a
+ * before float and footnote area.
+ */
public class BodyRegion extends RegionReference {
- BeforeFloat beforeFloat;
- MainReference mainReference;
- Footnote footnote;
+ private BeforeFloat beforeFloat;
+ private MainReference mainReference;
+ private Footnote footnote;
private int columnGap;
private int columnCount;
- /** Maximum block progression dimension. Note: min=opt=max */
- private MinOptMax maxBPD;
-
/** Referenc inline progression dimension for the body. */
private int refIPD;
+ /**
+ * Create a new body region area.
+ * This sets the region reference area class to BODY.
+ */
public BodyRegion() {
super(BODY);
}
// Number of columns when not spanning
public void setColumnCount(int colCount) {
- this.columnCount = colCount;
+ this.columnCount = colCount;
}
// Number of columns when not spanning
public int getColumnCount() {
- return this.columnCount ;
+ return this.columnCount;
}
// A length (mpoints)
public void setColumnGap(int colGap) {
- this.columnGap = colGap;
- }
-
- public void setParent(Area area) {
- super.setParent(area);
- // Only if not scrolling or overflow !!!
- Rectangle2D refRect = ((RegionViewport)area).getViewArea();
- maxBPD = new MinOptMax((int)refRect.getHeight());
- refIPD = (int)refRect.getWidth();
+ this.columnGap = colGap;
}
public void setBeforeFloat(BeforeFloat bf) {
beforeFloat = bf;
- beforeFloat.setParent(this);
}
public void setMainReference(MainReference mr) {
mainReference = mr;
- mainReference.setParent(this);
}
public void setFootnote(Footnote foot) {
footnote = foot;
- footnote.setParent(this);
}
@@ -75,10 +68,6 @@
public Footnote getFootnote() {
return footnote;
- }
-
- public MinOptMax getMaxBPD() {
- return maxBPD;
}
public Object clone() {
1.4 +9 -27 xml-fop/src/org/apache/fop/area/Flow.java
Index: Flow.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/Flow.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Flow.java 9 Nov 2001 22:02:34 -0000 1.3
+++ Flow.java 18 Sep 2002 13:50:13 -0000 1.4
@@ -1,38 +1,20 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
package org.apache.fop.area;
-import java.util.ArrayList;
-import java.util.List;
-
-// this is a normal flow reference area
-// it containts a list of block areas from the flow
+/**
+ * The normal flow reference area class.
+ * This area contains a list of block areas from the flow
+ */
public class Flow extends BlockParent {
// the list of blocks created from the flow
- ArrayList blocks = new ArrayList();
- int stacking = TB;
- int width;
-
- public void addBlock(Block block) {
- blocks.add(block);
- }
-
- public List getBlocks() {
- return blocks;
- }
-
- /**
- * Maximum block progression dimension for a Flow is
- * the same as that of its parent Span.
- */
- public MinOptMax getMaxBPD() {
- return parent.getMaxBPD();
- }
-
+ private int stacking = TB;
+ private int width;
}
+
1.5 +20 -33 xml-fop/src/org/apache/fop/area/Footnote.java
Index: Footnote.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/Footnote.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Footnote.java 9 Nov 2001 22:02:34 -0000 1.4
+++ Footnote.java 18 Sep 2002 13:50:13 -0000 1.5
@@ -1,58 +1,45 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
package org.apache.fop.area;
-import java.io.Serializable;
-import java.util.List;
-import java.util.ArrayList;
-
// may combine with before float into a conditional area
+
+/**
+ * Footnote reference area.
+ * This areas holds footnote areas and an optional separator area.
+ */
public class Footnote extends BlockParent {
- Block separator = null;
+ private Block separator = null;
// footnote has an optional separator
// and a list of sub block areas that can be added/removed
// this is the relative position of the footnote inside
// the body region
- int top;
-
- ArrayList blocks = null;
+ private int top;
+ /**
+ * Set the separator area for this footnote.
+ *
+ * @param sep the separator area
+ */
public void setSeparator(Block sep) {
separator = sep;
}
- public void addBlock(Block block) {
- if (blocks == null) {
- blocks = new ArrayList();
- }
- blocks.add(block);
- }
-
+ /**
+ * Get the separator area for this footnote area.
+ *
+ * @return the separator area
+ */
public Block getSeparator() {
return separator;
}
- public List getBlocks() {
- return blocks;
- }
-
- public MinOptMax getMaxBPD() {
- MinOptMax maxbpd = parent.getMaxBPD();
- BodyRegion body = (BodyRegion)parent;
- Area a = body.getMainReference();
- if (a != null) {
- maxbpd = MinOptMax.subtract(maxbpd, a.getContentBPD());
- }
- if ((a=body.getBeforeFloat()) != null) {
- maxbpd = MinOptMax.subtract(maxbpd, a.getContentBPD());
- }
- return maxbpd;
- }
}
+
1.10 +51 -16 xml-fop/src/org/apache/fop/area/LineArea.java
Index: LineArea.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/LineArea.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- LineArea.java 22 Aug 2002 13:57:47 -0000 1.9
+++ LineArea.java 18 Sep 2002 13:50:13 -0000 1.10
@@ -1,6 +1,6 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
@@ -11,57 +11,92 @@
import java.util.ArrayList;
import java.util.List;
-import java.util.Iterator;
-// a line area can contain information in ranges of child inline
-// areas that have properties such as
-// links, background, underline, bold, id areas
+/**
+ * The line area.
+ * This is a line area that contains inline areas.
+ */
public class LineArea extends Area {
- int stacking = LR;
+ private int stacking = LR;
// contains inline areas
// has start indent and length, dominant baseline, height
- int startIndent;
- int length;
+ private int startIndent;
+ private int length;
- int lineHeight;
+ private int lineHeight;
// this is the offset for the dominant baseline
- int baseLine;
+ private int baseLine;
// this class can contain the dominant char styling info
// this means that many renderers can optimise a bit
- ArrayList inlineAreas = new ArrayList();
+ private ArrayList inlineAreas = new ArrayList();
+ /**
+ * Set the height of this line area.
+ *
+ * @param height the height of the line area
+ */
public void setHeight(int height) {
lineHeight = height;
}
+ /**
+ * Get the height of this line area.
+ *
+ * @return the height of the line area
+ */
public int getHeight() {
return lineHeight;
}
- public MinOptMax getContentBPD() {
- return new MinOptMax(lineHeight);
- }
-
+ /**
+ * Add a child area to this line area.
+ *
+ * @param childArea the inline child area to add
+ */
public void addChild(Area childArea) {
if (childArea instanceof InlineArea) {
addInlineArea((InlineArea)childArea);
}
}
+ /**
+ * Add an inline child area to this line area.
+ *
+ * @param area the inline child area to add
+ */
public void addInlineArea(InlineArea area) {
inlineAreas.add(area);
}
+ /**
+ * Get the inline child areas of this line area.
+ *
+ * @return the list of inline areas
+ */
public List getInlineAreas() {
return inlineAreas;
}
+ /**
+ * Set the start indent of this line area.
+ * The start indent is used for offsetting the start of
+ * the inline areas for alignment or other indents.
+ *
+ * @param si the start indent value
+ */
public void setStartIndent(int si) {
startIndent = si;
}
+ /**
+ * Get the start indent of this line area.
+ * The start indent is used for offsetting the start of
+ * the inline areas for alignment or other indents.
+ *
+ * @return the start indent value
+ */
public int getStartIndent() {
return startIndent;
}
1.2 +7 -3 xml-fop/src/org/apache/fop/area/LineTrait.java
Index: LineTrait.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/LineTrait.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LineTrait.java 21 Mar 2002 09:34:19 -0000 1.1
+++ LineTrait.java 18 Sep 2002 13:50:13 -0000 1.2
@@ -1,13 +1,17 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
package org.apache.fop.area;
+/**
+ * Traits for a range of areas in a line.
+ * Not sure if this is needed.
+ */
public class LineTrait extends Trait {
- int[] range;
+ private int[] range;
}
1.5 +32 -22 xml-fop/src/org/apache/fop/area/MainReference.java
Index: MainReference.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/MainReference.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- MainReference.java 11 Nov 2001 14:10:29 -0000 1.4
+++ MainReference.java 18 Sep 2002 13:50:13 -0000 1.5
@@ -1,49 +1,59 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
package org.apache.fop.area;
-import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-// the area that contains the flow via the span areas
-public class MainReference extends Area implements Serializable {
- List spanAreas = new ArrayList();
- int columnGap;
- int width;
-
+/**
+ * The main body reference area.
+ * This area that contains the flow via the span areas.
+ */
+public class MainReference extends Area {
+ private List spanAreas = new ArrayList();
+ private int columnGap;
+ private int width;
+
+ /**
+ * Add a span area to this area.
+ *
+ * @param span the span area to add
+ */
public void addSpan(Span span) {
spanAreas.add(span);
- span.setParent(this);
}
+ /**
+ * Get the span areas from this area.
+ *
+ * @return the list of span areas
+ */
public List getSpans() {
return spanAreas;
}
+ /**
+ * Get the column gap in millipoints.
+ *
+ * @return the column gap in millioints
+ */
public int getColumnGap() {
return columnGap;
}
+ /**
+ * Get the width of this reference area.
+ *
+ * @return the width
+ */
public int getWidth() {
return width;
}
- public MinOptMax getMaxBPD() {
- MinOptMax maxbpd = parent.getMaxBPD();
- BodyRegion body = (BodyRegion)parent;
- Area a = body.getBeforeFloat();
- if (a != null) {
- maxbpd = MinOptMax.subtract(maxbpd, a.getContentBPD());
- }
- if ((a=body.getFootnote()) != null) {
- maxbpd = MinOptMax.subtract(maxbpd, a.getContentBPD());
- }
- return maxbpd;
- }
}
+
1.4 +26 -28 xml-fop/src/org/apache/fop/area/MinOptMax.java
Index: MinOptMax.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/MinOptMax.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MinOptMax.java 28 Apr 2002 21:28:01 -0000 1.3
+++ MinOptMax.java 18 Sep 2002 13:50:13 -0000 1.4
@@ -1,6 +1,6 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
@@ -13,7 +13,6 @@
* MinOptMax values are used during layout calculations. The instance
* variables are package visible.
*/
-
public class MinOptMax implements java.io.Serializable, Cloneable {
/** Publicly visible min(imum), opt(imum) and max(imum) values.*/
@@ -22,55 +21,54 @@
public int max;
public MinOptMax() {
- this(0);
+ this(0);
}
public MinOptMax(int val) {
- this(val, val, val);
+ this(val, val, val);
}
public MinOptMax(int min, int opt, int max) {
- this.min = min;
- this.opt = opt;
- this.max = max;
+ this.min = min;
+ this.opt = opt;
+ this.max = max;
}
public Object clone() {
- try {
- return super.clone();
- } catch (CloneNotSupportedException ex) {
- // SHOULD NEVER OCCUR - all members are primitive types!
- return null;
- }
+ try {
+ return super.clone();
+ } catch (CloneNotSupportedException ex) {
+ // SHOULD NEVER OCCUR - all members are primitive types!
+ return null;
+ }
}
public static MinOptMax subtract(MinOptMax op1, MinOptMax op2) {
- return new MinOptMax(op1.min - op2.max, op1.opt - op2.opt,
- op1.max - op2.min);
+ return new MinOptMax(op1.min - op2.max, op1.opt - op2.opt,
+ op1.max - op2.min);
}
public static MinOptMax add(MinOptMax op1, MinOptMax op2) {
- return new MinOptMax(op1.min + op2.min, op1.opt + op2.opt,
- op1.max + op2.max);
+ return new MinOptMax(op1.min + op2.min, op1.opt + op2.opt,
+ op1.max + op2.max);
}
public static MinOptMax multiply(MinOptMax op1, double mult) {
- return new MinOptMax((int)(op1.min * mult),
- (int)(op1.opt * mult),
- (int)(op1.max * mult));
+ return new MinOptMax((int)(op1.min * mult),
+ (int)(op1.opt * mult), (int)(op1.max * mult));
}
public void add(MinOptMax op) {
- min += op.min;
- opt += op.opt;
- max += op.max;
+ min += op.min;
+ opt += op.opt;
+ max += op.max;
}
public void subtract(MinOptMax op) {
- min -= op.max;
- opt -= op.opt;
- max -= op.min;
+ min -= op.max;
+ opt -= op.opt;
+ max -= op.min;
}
-
}
+
1.6 +51 -15 xml-fop/src/org/apache/fop/area/Page.java
Index: Page.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/Page.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Page.java 9 Sep 2002 05:58:14 -0000 1.5
+++ Page.java 18 Sep 2002 13:50:13 -0000 1.6
@@ -1,6 +1,6 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
@@ -23,19 +23,26 @@
*/
public class Page implements Serializable, Cloneable {
// contains before, start, body, end and after regions
- RegionViewport regionBefore = null;
- RegionViewport regionStart = null;
- RegionViewport regionBody = null;
- RegionViewport regionEnd = null;
- RegionViewport regionAfter = null;
+ private RegionViewport regionBefore = null;
+ private RegionViewport regionStart = null;
+ private RegionViewport regionBody = null;
+ private RegionViewport regionEnd = null;
+ private RegionViewport regionAfter = null;
// hashmap of markers for this page
// start and end are added by the fo that contains the markers
- HashMap markerStart = null;
- HashMap markerEnd = null;
+ private HashMap markerStart = null;
+ private HashMap markerEnd = null;
+ // temporary map of unresolved objects used when serializing the page
private HashMap unresolved = null;
+ /**
+ * Set the region on this page.
+ *
+ * @param areaclass the area class of the region to set
+ * @param port the region viewport to set
+ */
public void setRegion(int areaclass, RegionViewport port) {
if (areaclass == RegionReference.BEFORE) {
regionBefore = port;
@@ -50,6 +57,12 @@
}
}
+ /**
+ * Get the region from this page.
+ *
+ * @param areaclass the region area class
+ * @return the region viewport or null if none
+ */
public RegionViewport getRegion(int areaclass) {
if (areaclass == RegionReference.BEFORE) {
return regionBefore;
@@ -65,26 +78,49 @@
return null;
}
+ /**
+ * Clone this page.
+ * This returns a new page with a clone of all the regions.
+ *
+ * @return a new clone of this page
+ */
public Object clone() {
Page p = new Page();
- if(regionBefore != null)
+ if (regionBefore != null) {
p.regionBefore = (RegionViewport)regionBefore.clone();
- if(regionStart != null)
+ }
+ if (regionStart != null) {
p.regionStart = (RegionViewport)regionStart.clone();
- if(regionBody != null)
+ }
+ if (regionBody != null) {
p.regionBody = (RegionViewport)regionBody.clone();
- if(regionEnd != null)
+ }
+ if (regionEnd != null) {
p.regionEnd = (RegionViewport)regionEnd.clone();
- if(regionAfter != null)
+ }
+ if (regionAfter != null) {
p.regionAfter = (RegionViewport)regionAfter.clone();
+ }
return p;
}
+ /**
+ * Set the unresolved references on this page for serializing.
+ *
+ * @param unres the map of unresolved objects
+ */
public void setUnresolvedReferences(HashMap unres) {
unresolved = unres;
}
-
+
+ /**
+ * Get the map unresolved references from this page.
+ * This should be called after deserializing to retrieve
+ * the map of unresolved references that were serialized.
+ *
+ * @return the de-serialized map of unresolved objects
+ */
public HashMap getUnresolvedReferences() {
return unresolved;
}
1.6 +64 -6 xml-fop/src/org/apache/fop/area/RegionReference.java
Index: RegionReference.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/RegionReference.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- RegionReference.java 17 Aug 2002 23:51:07 -0000 1.5
+++ RegionReference.java 18 Sep 2002 13:50:13 -0000 1.6
@@ -1,6 +1,6 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
@@ -11,15 +11,47 @@
import java.util.ArrayList;
import java.util.List;
+/**
+ * This is a region reference area for the page regions.
+ * This area represents a region on the page. It is cloneable
+ * so the page master can make copies from the original page and regions.
+ */
public class RegionReference extends Area implements Serializable, Cloneable {
+ /**
+ * The before region.
+ */
public static final int BEFORE = 0;
+
+ /**
+ * The start region.
+ */
public static final int START = 1;
+
+ /**
+ * The body region.
+ */
public static final int BODY = 2;
+
+ /**
+ * The end region.
+ */
public static final int END = 3;
+
+ /**
+ * The after region.
+ */
public static final int AFTER = 4;
- int regionClass = BEFORE;
+
+ private int regionClass = BEFORE;
private CTM ctm;
+ // the list of block areas from the static flow
+ private ArrayList blocks = new ArrayList();
+ /**
+ * Create a new region reference area.
+ *
+ * @param type the region class type
+ */
public RegionReference(int type) {
regionClass = type;
}
@@ -30,30 +62,56 @@
* terms of "start" and "before" into coordinates in a system which
* is positioned in "absolute" directions (with origin at lower left of
* the region reference area.
+ *
+ * @param ctm the current transform to position this region
*/
public void setCTM(CTM ctm) {
this.ctm = ctm;
}
+ /**
+ * Get the current transform of this region.
+ *
+ * @return ctm the current transform to position this region
+ */
public CTM getCTM() {
return this.ctm;
}
- // the list of block areas from the static flow
- ArrayList blocks = new ArrayList();
-
+ /**
+ * Get the block in this region.
+ *
+ * @return the list of blocks in this region
+ */
public List getBlocks() {
return blocks;
}
+ /**
+ * Get the region class of this region.
+ *
+ * @return the region class
+ */
public int getRegionClass() {
return regionClass;
}
+ /**
+ * Add a block area to this region reference area.
+ *
+ * @param block the block area to add
+ */
public void addBlock(Block block) {
blocks.add(block);
}
+ /**
+ * Clone this region.
+ * This is used when cloning the page by the page master.
+ * The blocks are not copied since the master will have no blocks.
+ *
+ * @return a copy of this region reference area
+ */
public Object clone() {
RegionReference rr = new RegionReference(regionClass);
rr.ctm = ctm;
1.5 +44 -13 xml-fop/src/org/apache/fop/area/RegionViewport.java
Index: RegionViewport.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/RegionViewport.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- RegionViewport.java 17 May 2002 14:47:12 -0000 1.4
+++ RegionViewport.java 18 Sep 2002 13:50:13 -0000 1.5
@@ -1,6 +1,6 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
@@ -8,33 +8,59 @@
package org.apache.fop.area;
import java.awt.geom.Rectangle2D;
-import java.io.Serializable;
import java.io.IOException;
-public class RegionViewport extends Area implements Serializable, Cloneable {
+/**
+ * Region Viewport reference area.
+ * This area is the viewport for a region and contains a region area.
+ */
+public class RegionViewport extends Area implements Cloneable {
// this rectangle is relative to the page
- RegionReference region;
- Rectangle2D viewArea;
- boolean clip = false;
-
-
+ private RegionReference region;
+ private Rectangle2D viewArea;
+ private boolean clip = false;
+
+ /**
+ * Create a new region viewport.
+ *
+ * @param viewArea the view area of this viewport
+ */
public RegionViewport(Rectangle2D viewArea) {
this.viewArea = viewArea;
}
+ /**
+ * Set the region for this region viewport.
+ *
+ * @param reg the child region inside this viewport
+ */
public void setRegion(RegionReference reg) {
region = reg;
- region.setParent(this);
}
+ /**
+ * Get the region for this region viewport.
+ *
+ * @return the child region inside this viewport
+ */
public RegionReference getRegion() {
return region;
}
+ /**
+ * Set the clipping for this region viewport.
+ *
+ * @param c the clipping value
+ */
public void setClip(boolean c) {
clip = c;
}
+ /**
+ * Get the view area of this viewport.
+ *
+ * @return the viewport rectangle area
+ */
public Rectangle2D getViewArea() {
return viewArea;
}
@@ -52,15 +78,20 @@
private void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException {
viewArea = new Rectangle2D.Float(in.readFloat(), in.readFloat(),
- in.readFloat(), in.readFloat());
+ in.readFloat(), in.readFloat());
clip = in.readBoolean();
- setRegion( (RegionReference) in.readObject());
+ setRegion((RegionReference) in.readObject());
}
+ /**
+ * Clone this region viewport.
+ * Used when creating a copy from the page master.
+ *
+ * @return a new copy of this region viewport
+ */
public Object clone() {
RegionViewport rv = new RegionViewport((Rectangle2D)viewArea.clone());
rv.region = (RegionReference)region.clone();
- rv.region.setParent(rv);
return rv;
}
}
1.4 +18 -5 xml-fop/src/org/apache/fop/area/Resolveable.java
Index: Resolveable.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/Resolveable.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Resolveable.java 9 Sep 2002 05:58:14 -0000 1.3
+++ Resolveable.java 18 Sep 2002 13:50:13 -0000 1.4
@@ -1,6 +1,6 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
@@ -16,9 +16,22 @@
*/
public interface Resolveable {
- public boolean isResolved();
+ /**
+ * Check if this area has been resolved.
+ *
+ * @return true once this area is resolved
+ */
+ boolean isResolved();
- public String[] getIDs();
+ /**
+ * Get the array of id references of this resolveable object.
+ * If this object contains child resolveables that are
+ * resolved through this then it should return the id's of
+ * the child also.
+ *
+ * @return the id references for resolving this object
+ */
+ String[] getIDs();
/**
* This resolves reference with a list of pages.
@@ -27,5 +40,5 @@
* @param pages the list of pages with the id area
* may be null if not found
*/
- public void resolve(String id, List pages);
+ void resolve(String id, List pages);
}
1.5 +5 -22 xml-fop/src/org/apache/fop/area/Span.java
Index: Span.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/Span.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Span.java 11 Nov 2001 14:10:29 -0000 1.4
+++ Span.java 18 Sep 2002 13:50:13 -0000 1.5
@@ -1,6 +1,6 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
@@ -8,13 +8,12 @@
package org.apache.fop.area;
import java.util.ArrayList;
-import java.util.Iterator;
// this is a reference area block area with 0 border and padding
public class Span extends Area {
// the list of flow reference areas in this span area
- ArrayList flowAreas;
- int height;
+ private ArrayList flowAreas;
+ private int height;
public Span(int cols) {
flowAreas = new ArrayList(cols);
@@ -22,7 +21,6 @@
public void addFlow(Flow flow) {
flowAreas.add(flow);
- flow.setParent(this);
}
public int getColumnCount() {
@@ -37,20 +35,5 @@
return (Flow) flowAreas.get(count);
}
- /**
- * Maximum available BPD for a Span is the maxBPD for its containing
- * MainReference less the content BPD of any previous spans
- */
- public MinOptMax getMaxBPD() {
- MinOptMax maxbpd = parent.getMaxBPD();
- MainReference mainref = (MainReference)parent;
- Iterator spanIter = mainref.getSpans().iterator();
- while (spanIter.hasNext()) {
- Span s = (Span)spanIter.next();
- if (s == this) break;
- maxbpd = MinOptMax.subtract(maxbpd, s.getContentBPD());
- }
- return maxbpd;
- }
-
}
+
1.2 +7 -2 xml-fop/src/org/apache/fop/area/Title.java
Index: Title.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/Title.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Title.java 22 Oct 2001 09:30:30 -0000 1.1
+++ Title.java 18 Sep 2002 13:50:13 -0000 1.2
@@ -1,11 +1,16 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
package org.apache.fop.area;
+/**
+ * The title area.
+ * This area holds the inline areas from the page-sequence
+ * title element.
+ */
public class Title extends LineArea {
}
1.6 +62 -1 xml-fop/src/org/apache/fop/area/Trait.java
Index: Trait.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/Trait.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Trait.java 13 Sep 2002 08:21:53 -0000 1.5
+++ Trait.java 18 Sep 2002 13:50:13 -0000 1.6
@@ -17,20 +17,81 @@
import java.util.Iterator;
// properties should be serialized by the holder
+/**
+ * Area traits used for rendering.
+ * This class represents an area trait that specifies a value for rendering.
+ */
public class Trait implements Serializable {
+ /**
+ * Id reference line, not resolved.
+ * not sure if this is needed.
+ */
public static final Integer ID_LINK = new Integer(0);
+
+ /**
+ * Internal link trait.
+ * This is resolved and provides a link to an internal area.
+ */
public static final Integer INTERNAL_LINK = new Integer(1); //resolved
+
+ /**
+ * External link. A URL link to an external resource.
+ */
public static final Integer EXTERNAL_LINK = new Integer(2);
+
+ /**
+ * The font name from the font setup.
+ */
public static final Integer FONT_NAME = new Integer(3);
+
+ /**
+ * Font size for the current font.
+ */
public static final Integer FONT_SIZE = new Integer(4);
+
+ /**
+ * The current colour.
+ */
public static final Integer COLOR = new Integer(7);
+
+ /**
+ * Don't think this is necessary.
+ */
public static final Integer ID_AREA = new Integer(8);
+
+ /**
+ * Background trait for an area.
+ */
public static final Integer BACKGROUND = new Integer(9);
+
+ /**
+ * Underline trait used when rendering inline parent.
+ */
public static final Integer UNDERLINE = new Integer(10);
+
+ /**
+ * Overline trait used when rendering inline parent.
+ */
public static final Integer OVERLINE = new Integer(11);
+
+ /**
+ * Linethrough trait used when rendering inline parent.
+ */
public static final Integer LINETHROUGH = new Integer(12);
+
+ /**
+ *
+ */
public static final Integer OFFSET = new Integer(13);
+
+ /**
+ * The shadow for text.
+ */
public static final Integer SHADOW = new Integer(14);
+
+ /**
+ * The border start.
+ */
public static final Integer BORDER_START = new Integer(15);
public static final Integer BORDER_END = new Integer(16);
public static final Integer BORDER_BEFORE = new Integer(17);
1.3 +49 -9 xml-fop/src/org/apache/fop/area/TreeExt.java
Index: TreeExt.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/TreeExt.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TreeExt.java 5 Sep 2002 15:15:08 -0000 1.2
+++ TreeExt.java 18 Sep 2002 13:50:13 -0000 1.3
@@ -1,6 +1,6 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
@@ -8,13 +8,53 @@
package org.apache.fop.area;
/**
+ * Area tree extension interface.
+ * This interface is used by area tree extensions that are handled
+ * by the renderer.
+ * When this extension is handled by the area tree it is rendered
+ * according to the three possibilities, IMMEDIATELY, AFTER_PAGE
+ * or END_OF_DOC.
*/
public interface TreeExt {
- public final static int IMMEDIATELY = 0;
- public final static int AFTER_PAGE = 1;
- public final static int END_OF_DOC = 2;
-
- public boolean isResolveable();
- public String getMimeType();
- public String getName();
+ /**
+ * Render this extension immediately when
+ * being handled by the area tree.
+ */
+ public static final int IMMEDIATELY = 0;
+
+ /**
+ * Render this extension after the next page is rendered
+ * or prepared when being handled by the area tree.
+ */
+ public static final int AFTER_PAGE = 1;
+
+ /**
+ * Render this extension at the end of the document once
+ * all pages have been fully rendered.
+ */
+ public static final int END_OF_DOC = 2;
+
+ /**
+ * Check if this tree extension is also resolveable so that
+ * the area tree can do id reference resolution when the
+ * extension is added to the area tree.
+ *
+ * @return true if this also implements resolveable
+ */
+ boolean isResolveable();
+
+ /**
+ * Get the mime type for the document that this area tree
+ * extension applies.
+ *
+ * @return the mime type of the document where this applies
+ */
+ String getMimeType();
+
+ /**
+ * Get the name of this extension.
+ *
+ * @return the name of this extension
+ */
+ String getName();
}
1.2 +6 -2 xml-fop/src/org/apache/fop/area/inline/Anchor.java
Index: Anchor.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/inline/Anchor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Anchor.java 22 Oct 2001 09:30:31 -0000 1.1
+++ Anchor.java 18 Sep 2002 13:50:14 -0000 1.2
@@ -1,12 +1,16 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
package org.apache.fop.area.inline;
+/**
+ * Anchor area for footnote or float.
+ * Not sure if this is needed.
+ */
public class Anchor extends InlineArea {
// has a keep with adjacent area
1.2 +23 -3 xml-fop/src/org/apache/fop/area/inline/Character.java
Index: Character.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/inline/Character.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Character.java 22 Oct 2001 09:30:31 -0000 1.1
+++ Character.java 18 Sep 2002 13:50:14 -0000 1.2
@@ -1,6 +1,6 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
@@ -9,18 +9,38 @@
import org.apache.fop.render.Renderer;
+/**
+ * Single character inline area.
+ * This inline area holds a single characater.
+ */
public class Character extends InlineArea {
- char character;
+ private char character;
+
+ /**
+ * Create a new characater inline area with the given character.
+ *
+ * @param ch the character for this inline area
+ */
public Character(char ch) {
character = ch;
}
// character info: font, char spacing, colour, baseline
+ /**
+ * Render this inline area.
+ *
+ * @param renderer the renderer to render this character area
+ */
public void render(Renderer renderer) {
renderer.renderCharacter(this);
}
+ /**
+ * Get the character for this inline character area.
+ *
+ * @return the character
+ */
public char getChar() {
return character;
}
1.3 +20 -4 xml-fop/src/org/apache/fop/area/inline/FilledArea.java
Index: FilledArea.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/inline/FilledArea.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FilledArea.java 7 Sep 2002 08:58:06 -0000 1.2
+++ FilledArea.java 18 Sep 2002 13:50:14 -0000 1.3
@@ -1,14 +1,12 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
package org.apache.fop.area.inline;
-import org.apache.fop.area.MinOptMax;
-
import java.util.List;
import java.util.ArrayList;
@@ -18,17 +16,35 @@
* When the renderer gets the child areas to render
* the inline areas are repeated to fill the ipd of
* this inline parent.
+ * This extends InlineParent so that the renderer will render
+ * this as a normal inline parent.
*/
public class FilledArea extends InlineParent {
private int unitWidth;
+ /**
+ * Create a new filled area.
+ */
public FilledArea() {
}
+ /**
+ * Set the unit width for the areas to fill the full width.
+ *
+ * @param w the unit width
+ */
public void setUnitWidth(int w) {
unitWidth = w;
}
+ /**
+ * Get the child areas for this filed area.
+ * This copies the references of the inline areas so that
+ * it fills the total width of the area a whole number of times
+ * for the unit width.
+ *
+ * @return the list of child areas copied to fill the width
+ */
public List getChildAreas() {
int units = (int)(getWidth() / unitWidth);
ArrayList newList = new ArrayList();
1.3 +26 -6 xml-fop/src/org/apache/fop/area/inline/ForeignObject.java
Index: ForeignObject.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/inline/ForeignObject.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ForeignObject.java 26 Oct 2001 09:27:00 -0000 1.2
+++ ForeignObject.java 18 Sep 2002 13:50:14 -0000 1.3
@@ -1,6 +1,6 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
@@ -12,22 +12,42 @@
import org.w3c.dom.Document;
// cacheable object
+/**
+ * Foreign object inline area.
+ * This inline area represents an instream-foreign object.
+ * This holds an xml document and the associated namespace.
+ */
public class ForeignObject extends Area {
- Document doc;
- String namespace;
- // dom object
- // height, width
+ private Document doc;
+ private String namespace;
+ /**
+ * Create a new foreign object with the given dom and namespace.
+ *
+ * @param d the xml document
+ * @param ns the namespace of the document
+ */
public ForeignObject(Document d, String ns) {
doc = d;
namespace = ns;
}
+ /**
+ * Get the document for this foreign object.
+ *
+ * @return the xml document
+ */
public Document getDocument() {
return doc;
}
+ /**
+ * Get the namespace of this foreign object.
+ *
+ * @return the namespace of this document
+ */
public String getNameSpace() {
return namespace;
}
}
+
1.4 +19 -7 xml-fop/src/org/apache/fop/area/inline/Image.java
Index: Image.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/inline/Image.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Image.java 6 Nov 2001 08:34:50 -0000 1.3
+++ Image.java 18 Sep 2002 13:50:14 -0000 1.4
@@ -1,6 +1,6 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
@@ -9,17 +9,29 @@
import org.apache.fop.area.Area;
-// cacheable object
-// image object, mime type, url
-// an image only needs to be loaded to get the size if not specified
-// and when rendering to the output
+/**
+ * Image area for external-graphic.
+ * This area holds information for rendering an image.
+ * The url of the image is used as a key to reference the image cache.
+ */
public class Image extends Area {
- String url;
+ private String url;
+ /**
+ * Create a new image with the given url.
+ *
+ * @param u the url of the image
+ */
public Image(String u) {
url = u;
}
+ /**
+ * Get the url of this image.
+ * This url is used as a key to locate the actual image data.
+ *
+ * @return the url of this image
+ */
public String getURL() {
return url;
}
1.12 +11 -12 xml-fop/src/org/apache/fop/area/inline/InlineArea.java
Index: InlineArea.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/inline/InlineArea.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- InlineArea.java 7 Sep 2002 08:58:06 -0000 1.11
+++ InlineArea.java 18 Sep 2002 13:50:14 -0000 1.12
@@ -8,11 +8,9 @@
package org.apache.fop.area.inline;
import org.apache.fop.area.Area;
-import org.apache.fop.area.MinOptMax;
import org.apache.fop.area.Trait;
import org.apache.fop.render.Renderer;
import org.apache.fop.traits.BorderProps;
-import org.apache.fop.fo.properties.VerticalAlign;
import java.util.ArrayList;
@@ -25,19 +23,24 @@
*/
public class InlineArea extends Area {
// int width;
- int height;
+ private int height;
protected int contentIPD = 0;
// offset position from top of parent area
int verticalPosition = 0;
// store properties in array list, need better solution
- ArrayList props = null;
+ private ArrayList props = null;
- // inline areas are expected to implement this method
- // to render themselves
+ /**
+ * Render this inline area.
+ * Inline areas that extend this class are expected
+ * to implement this method to render themselves in
+ * the renderer.
+ *
+ * @param renderer the renderer to render this inline area
+ */
public void render(Renderer renderer) {
-
}
public void setWidth(int w) {
@@ -85,10 +88,6 @@
iBP += ((BorderProps) t).width;
}
return iBP;
- }
-
- public MinOptMax getAllocationIPD() {
- return new MinOptMax(getAllocIPD());
}
public void setOffset(int v) {
1.5 +20 -6 xml-fop/src/org/apache/fop/area/inline/InlineParent.java
Index: InlineParent.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/inline/InlineParent.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- InlineParent.java 7 Sep 2002 08:58:06 -0000 1.4
+++ InlineParent.java 18 Sep 2002 13:50:14 -0000 1.5
@@ -1,6 +1,6 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
@@ -19,13 +19,20 @@
* This is an inline area that can have other inlines as children.
*/
public class InlineParent extends InlineArea {
+ /**
+ * The list of inline areas added to this inline parent.
+ */
protected ArrayList inlines = new ArrayList();
+ /**
+ * Create a new inline parent to add areas to.
+ */
public InlineParent() {
}
/**
* Render this area.
+ *
* @param renderer the renderer to render this area in
*/
public void render(Renderer renderer) {
@@ -34,14 +41,21 @@
/**
* Override generic Area method.
+ *
+ * @param childArea the child area to add
*/
public void addChild(Area childArea) {
- if (childArea instanceof InlineArea) {
- inlines.add(childArea);
- increaseIPD( ((InlineArea)childArea).getAllocIPD());
- }
+ if (childArea instanceof InlineArea) {
+ inlines.add(childArea);
+ increaseIPD(((InlineArea) childArea).getAllocIPD());
+ }
}
+ /**
+ * Get the child areas for this inline parent.
+ *
+ * @return the list of child areas
+ */
public List getChildAreas() {
return inlines;
}
1.4 +37 -6 xml-fop/src/org/apache/fop/area/inline/Leader.java
Index: Leader.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/inline/Leader.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Leader.java 22 Aug 2002 13:57:47 -0000 1.3
+++ Leader.java 18 Sep 2002 13:50:14 -0000 1.4
@@ -1,6 +1,6 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
@@ -10,7 +10,11 @@
import org.apache.fop.render.Renderer;
import org.apache.fop.fo.properties.RuleStyle;
-public class Leader extends Stretch {
+/**
+ * This is a leader inline area.
+ * This class is only used for leader with leader-pattern of rule.
+ */
+public class Leader extends InlineArea {
// pattern, length min opt max
@@ -19,29 +23,56 @@
// if space replaced with a space
// otherwise this is a holder for a line
- int ruleStyle = RuleStyle.SOLID;
- int ruleThickness = 1000;
+ private int ruleStyle = RuleStyle.SOLID;
+ private int ruleThickness = 1000;
+ /**
+ * Create a new leader area.
+ */
public Leader() {
-
}
+ /**
+ * Set the rule style of this leader area.
+ *
+ * @param style the rule style for the leader line
+ */
public void setRuleStyle(int style) {
ruleStyle = style;
}
+ /**
+ * Set the rule thickness of the rule in miilipoints.
+ *
+ * @param rt the rule thickness in millipoints
+ */
public void setRuleThickness(int rt) {
ruleThickness = rt;
}
+ /**
+ * Get the rule style of this leader.
+ *
+ * @return the rule style
+ */
public int getRuleStyle() {
return ruleStyle;
}
+ /**
+ * Get the rule thickness of the rule in miilipoints.
+ *
+ * @return the rule thickness in millipoints
+ */
public int getRuleThickness() {
return ruleThickness;
}
+ /**
+ * Render this leader in the current renderer.
+ *
+ * @param renderer the renderer to render this inline area
+ */
public void render(Renderer renderer) {
renderer.renderLeader(this);
}
1.4 +12 -3 xml-fop/src/org/apache/fop/area/inline/Space.java
Index: Space.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/inline/Space.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Space.java 23 Aug 2002 13:45:25 -0000 1.3
+++ Space.java 18 Sep 2002 13:50:14 -0000 1.4
@@ -1,6 +1,6 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
@@ -9,8 +9,17 @@
import org.apache.fop.render.Renderer;
-public class Space extends Stretch {
+/**
+ * Inline space area.
+ * This is used for adding a inline space to the output.
+ */
+public class Space extends InlineArea {
+ /**
+ * Render this inlien space area.
+ *
+ * @param renderer the renderer to render this inline area
+ */
public void render(Renderer renderer) {
renderer.renderInlineSpace(this);
}
1.5 +33 -3 xml-fop/src/org/apache/fop/area/inline/UnresolvedPageNumber.java
Index: UnresolvedPageNumber.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/org/apache/fop/area/inline/UnresolvedPageNumber.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- UnresolvedPageNumber.java 7 Sep 2002 08:58:06 -0000 1.4
+++ UnresolvedPageNumber.java 18 Sep 2002 13:50:14 -0000 1.5
@@ -1,6 +1,6 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
@@ -13,22 +13,47 @@
import java.util.List;
+/**
+ * Unresolveable page number area.
+ * This is a word area that resolves itself to a page number
+ * from an id reference.
+ */
public class UnresolvedPageNumber extends Word implements Resolveable {
private boolean resolved = false;
private String pageRefId;
+ /**
+ * Create a new unresolveable page number.
+ *
+ * @param id the id reference for resolving this
+ */
public UnresolvedPageNumber(String id) {
pageRefId = id;
word = "?";
}
+ /**
+ * Get the id references for this area.
+ *
+ * @return the id reference for this unresolved page number
+ */
public String[] getIDs() {
return new String[] {pageRefId};
}
+ /**
+ * Resolve this page number reference.
+ * This resolves the reference by getting the page number
+ * string from the first page in the list of pages that apply
+ * for the id reference. The word string is then set to the
+ * page number string.
+ *
+ * @param id the id reference being resolved
+ * @param pages the list of pages for the id reference
+ */
public void resolve(String id, List pages) {
resolved = true;
- if(pages != null) {
+ if (pages != null) {
PageViewport page = (PageViewport)pages.get(0);
String str = page.getPageNumber();
word = str;
@@ -41,6 +66,11 @@
}
}
+ /**
+ * Check if this is resolved.
+ *
+ * @return true when this has been resolved
+ */
public boolean isResolved() {
return resolved;
}
1.4 +52 -9 xml-fop/src/org/apache/fop/area/inline/Viewport.java
Index: Viewport.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/inline/Viewport.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Viewport.java 4 Jul 2002 14:08:19 -0000 1.3
+++ Viewport.java 18 Sep 2002 13:50:14 -0000 1.4
@@ -1,6 +1,6 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
@@ -13,38 +13,79 @@
import java.io.IOException;
import java.awt.geom.Rectangle2D;
+/**
+ * Inline viewport area.
+ * This is an inline-level viewport area for inline container,
+ * external graphic and instream foreign object. This viewport
+ * holds the area and positions it.
+ */
public class Viewport extends InlineArea {
// contents could be container, foreign object or image
- Area content;
- // an inline-level viewport area for graphic and instream foreign object
- boolean clip = false;
- // position relative to this area
- Rectangle2D contentPosition;
-
+ private Area content;
+ // clipping for the viewport
+ private boolean clip = false;
+ // position of the cild area relative to this area
+ private Rectangle2D contentPosition;
+
+ /**
+ * Create a new viewport area with the content area.
+ *
+ * @param child the child content area of this viewport
+ */
public Viewport(Area child) {
content = child;
}
+ /**
+ * Set the clip of this viewport.
+ *
+ * @param c true if this viewport should clip
+ */
public void setClip(boolean c) {
clip = c;
}
+ /**
+ * Get the clip of this viewport.
+ *
+ * @return true if this viewport should clip
+ */
public boolean getClip() {
return clip;
}
+ /**
+ * Set the position and size of the content of this viewport.
+ *
+ * @param cp the position and size to place the content
+ */
public void setContentPosition(Rectangle2D cp) {
contentPosition = cp;
}
+ /**
+ * Get the position and size of the content of this viewport.
+ *
+ * @return the position and size to place the content
+ */
public Rectangle2D getContentPosition() {
return contentPosition;
}
+ /**
+ * Get the content area for this viewport.
+ *
+ * @return the content area
+ */
public Area getContent() {
return content;
}
+ /**
+ * Render this inline area.
+ *
+ * @param renderer the renderer to render this inline area
+ */
public void render(Renderer renderer) {
renderer.renderViewport(this);
}
@@ -66,7 +107,9 @@
throws IOException, ClassNotFoundException {
if (in.readBoolean()) {
contentPosition = new Rectangle2D.Float(in.readFloat(),
- in.readFloat(), in.readFloat(),
in.readFloat());
+ in.readFloat(),
+ in.readFloat(),
+ in.readFloat());
}
clip = in.readBoolean();
content = (Area) in.readObject();
1.6 +5 -4 xml-fop/src/org/apache/fop/area/inline/Word.java
Index: Word.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/inline/Word.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Word.java 4 Sep 2002 11:43:41 -0000 1.5
+++ Word.java 18 Sep 2002 13:50:14 -0000 1.6
@@ -1,6 +1,6 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
@@ -12,8 +12,8 @@
public class Word extends InlineArea {
// character info: font, char spacing, colour, baseline
- String word;
- int iWSadjust = 0;
+ private String word;
+ private int iWSadjust = 0;
public void render(Renderer renderer) {
renderer.renderWord(this);
@@ -35,3 +35,4 @@
this.iWSadjust = iWSadjust;
}
}
+
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]