/*
-* $Id$
-* Copyright (C) 2002 The Apache Software Foundation. All rights reserved.
-* For details on use and redistribution please refer to the
-* LICENSE file included with these sources.
-*/
+ * $Id$
+ * Copyright (C) 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;
private int columnGap;
private int columnCount;
- /** Referenc inline progression dimension for the body. */
+ /** Reference inline progression dimension for the body. */
private int refIPD;
/**
super(BODY);
}
- // Number of columns when not spanning
+ /**
+ * Set the number of columns for blocks when not spanning
+ *
+ * @param colCount the number of columns
+ */
public void setColumnCount(int colCount) {
this.columnCount = colCount;
}
- // Number of columns when not spanning
+ /**
+ * Get the number of columns when not spanning
+ *
+ * @return the number of columns
+ */
public int getColumnCount() {
return this.columnCount;
}
- // A length (mpoints)
+ /**
+ * Set the column gap between columns
+ * The length is in millipoints.
+ *
+ * @param colGap the column gap in millipoints
+ */
public void setColumnGap(int colGap) {
this.columnGap = colGap;
}
+ /**
+ * Set the before float area.
+ *
+ * @param bf the before float area
+ */
public void setBeforeFloat(BeforeFloat bf) {
beforeFloat = bf;
}
+ /**
+ * Set the main reference area.
+ *
+ * @param mr the main reference area
+ */
public void setMainReference(MainReference mr) {
mainReference = mr;
}
+ /**
+ * Set the footnote area.
+ *
+ * @param foot the footnote area
+ */
public void setFootnote(Footnote foot) {
footnote = foot;
}
-
+ /**
+ * Get the before float area.
+ *
+ * @return the before float area
+ */
public BeforeFloat getBeforeFloat() {
return beforeFloat;
}
+ /**
+ * Get the main reference area.
+ *
+ * @return the main reference area
+ */
public MainReference getMainReference() {
return mainReference;
}
+ /**
+ * Get the footnote area.
+ *
+ * @return the footnote area
+ */
public Footnote getFootnote() {
return footnote;
}
+ /**
+ * Clone this object.
+ * This is only used to clone the current object, the child areas
+ * are assumed to be null and are not cloned.
+ *
+ * @return a shallow copy of this object
+ */
public Object clone() {
BodyRegion br = new BodyRegion();
br.setCTM(getCTM());
private static CTM s_CTM_lrtb = new CTM(1, 0, 0, 1, 0, 0);
private static CTM s_CTM_rltb = new CTM(-1, 0, 0, 1, 0, 0);
private static CTM s_CTM_tbrl = new CTM(0, 1, -1, 0, 0, 0);
+
/**
* Create the identity matrix
*/
/**
* Initialize a CTM from the passed arguments.
+ *
+ * @param a the x scale
+ * @param b the x shear
+ * @param c the y shear
+ * @param d the y scale
+ * @param e the x shift
+ * @param f the y shift
*/
public CTM(double a, double b, double c, double d, double e, double f) {
this.a = a;
/**
* Initialize a CTM to the identity matrix with a translation
- * specified by x and y.
+ * specified by x and y
+ *
+ * @param x the x shift
+ * @param y the y shift.
*/
public CTM(double x, double y) {
this.a = 1;
this.f = y;
}
+ /**
+ * Initialize a CTM with the values of another CTM.
+ *
+ * @param ctm another CTM
+ */
protected CTM(CTM ctm) {
this.a = ctm.a;
this.b = ctm.b;
* CTM is being set..
* @param bpd The block-progression dimension of the reference area whose
* CTM is being set.
+ * @return a new CTM with the required transform
*/
public static CTM getWMctm(int wm, int ipd, int bpd) {
CTM wmctm;
// recalculate the width and height
int x1t = (int)(inRect.getX() * a + inRect.getY() * c + e);
int y1t = (int)(inRect.getX() * b + inRect.getY() * d + f);
- int x2t = (int)((inRect.getX() + inRect.getWidth()) * a +
- (inRect.getY() + inRect.getHeight()) * c + e);
- int y2t = (int)((inRect.getX() + inRect.getWidth()) * b +
- (inRect.getY() + inRect.getHeight()) * d + f);
+ int x2t = (int)((inRect.getX() + inRect.getWidth()) * a
+ + (inRect.getY() + inRect.getHeight()) * c + e);
+ int y2t = (int)((inRect.getX() + inRect.getWidth()) * b
+ + (inRect.getY() + inRect.getHeight()) * d + f);
// Normalize with x1 < x2
if (x1t > x2t) {
int tmp = x2t;
return new Rectangle(x1t, y1t, x2t - x1t, y2t - y1t);
}
+ /**
+ * Get string for this transform.
+ *
+ * @return a string with the transform values
+ */
public String toString() {
- return "[" + a + " " + b + " " + c + " " + d + " " + e + " " +
- f + "]";
+ return "[" + a + " " + b + " " + c + " " + d + " " + e + " "
+ + f + "]";
}
+ /**
+ * Get an array containing the values of this transform.
+ * This creates and returns a new transform with the values in it.
+ *
+ * @return an array containing the transform values
+ */
public double[] toArray() {
return new double[]{a, b, c, d, e, f};
}
* Check prepared pages
* If a page is resolved it loads the page contents from
* the file.
+ *
+ * @param newpage the new page being added
* @return true if the current page should be rendered
* false if the renderer doesn't support out of order
* rendering and there are pending pages
for (Iterator iter = prepared.iterator(); iter.hasNext();) {
PageViewport p = (PageViewport)iter.next();
if (p.isResolved()) {
- if(p != newpage) {
+ if (p != newpage) {
try {
// load page from cache
String name = (String)pageMap.get(p);
}
}
}
- if(newpage != null && newpage.getPage() != null) {
+ if (newpage != null && newpage.getPage() != null) {
savePage(newpage);
}
return renderer.supportsOutOfOrder() || prepared.isEmpty();
/*
* $Id$
- * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
public Object clone() {
RegionViewport rv = new RegionViewport((Rectangle2D)viewArea.clone());
rv.region = (RegionReference)region.clone();
- if(props != null) {
+ if (props != null) {
rv.props = (HashMap)props.clone();
}
return rv;
/*
-* $Id$
-* Copyright (C) 2002 The Apache Software Foundation. All rights reserved.
-* For details on use and redistribution please refer to the
-* LICENSE file included with these sources.
-*/
+ * $Id$
+ * Copyright (C) 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;
/**
* Check prepared pages
+ *
+ * @param newpage the new page being added
* @return true if the current page should be rendered
* false if the renderer doesn't support out of order
* rendering and there are pending pages
/*
* $Id$
- * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
import java.util.List;
import java.util.ArrayList;
-// this is a reference area block area with 0 border and padding
+/**
+ * The span reference area.
+ * This is a reference area block area with 0 border and padding
+ * The span reference areas are stacked inside the main reference area.
+ */
public class Span extends Area {
// the list of flow reference areas in this span area
private List flowAreas;
private int height;
+ /**
+ * Create a span area with the number of columns for this span area.
+ *
+ * @param cols the number of columns in the span
+ */
public Span(int cols) {
flowAreas = new ArrayList(cols);
}
+ /**
+ * Add the flow area to this span area.
+ *
+ * @param flow the flow area to add
+ */
public void addFlow(Flow flow) {
flowAreas.add(flow);
}
+ /**
+ * Get the column count for this span area.
+ *
+ * @return the number of columns in this span area
+ */
public int getColumnCount() {
return flowAreas.size();
}
+ /**
+ * Get the height of this span area.
+ *
+ * @return the height of this span area
+ */
public int getHeight() {
return height;
}
+ /**
+ * Get the flow area for a particular column.
+ *
+ * @param count the column number for the flow
+ * @return the flow area for the requested column
+ */
public Flow getFlow(int count) {
return (Flow) flowAreas.get(count);
}
/*
-* $Id$
-* Copyright (C) 2002 The Apache Software Foundation. All rights reserved.
-* For details on use and redistribution please refer to the
-* LICENSE file included with these sources.
-*/
+ * $Id$
+ * Copyright (C) 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;
*/
public void endDocument() {
}
-}
\ No newline at end of file
+}
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
*/
public static final Integer PADDING_AFTER = new Integer(22);
- private static final Map shmTraitInfo = new HashMap();
+ private static final Map TRAIT_INFO = new HashMap();
private static class TraitInfo {
String sName;
static {
// Create a hashmap mapping trait code to name for external representation
- shmTraitInfo.put(ID_LINK, new TraitInfo("id-link", String.class));
- shmTraitInfo.put(INTERNAL_LINK,
+ TRAIT_INFO.put(ID_LINK, new TraitInfo("id-link", String.class));
+ TRAIT_INFO.put(INTERNAL_LINK,
new TraitInfo("internal-link", String.class));
- shmTraitInfo.put(EXTERNAL_LINK,
+ TRAIT_INFO.put(EXTERNAL_LINK,
new TraitInfo("external-link", String.class));
- shmTraitInfo.put(FONT_NAME,
+ TRAIT_INFO.put(FONT_NAME,
new TraitInfo("font-family", String.class));
- shmTraitInfo.put(FONT_SIZE,
+ TRAIT_INFO.put(FONT_SIZE,
new TraitInfo("font-size", Integer.class));
- shmTraitInfo.put(COLOR, new TraitInfo("color", String.class));
- shmTraitInfo.put(ID_AREA, new TraitInfo("id-area", String.class));
- shmTraitInfo.put(BACKGROUND,
+ TRAIT_INFO.put(COLOR, new TraitInfo("color", String.class));
+ TRAIT_INFO.put(ID_AREA, new TraitInfo("id-area", String.class));
+ TRAIT_INFO.put(BACKGROUND,
new TraitInfo("background", Background.class));
- shmTraitInfo.put(UNDERLINE,
+ TRAIT_INFO.put(UNDERLINE,
new TraitInfo("underline", Boolean.class));
- shmTraitInfo.put(OVERLINE,
+ TRAIT_INFO.put(OVERLINE,
new TraitInfo("overline", Boolean.class));
- shmTraitInfo.put(LINETHROUGH,
+ TRAIT_INFO.put(LINETHROUGH,
new TraitInfo("linethrough", Boolean.class));
- shmTraitInfo.put(OFFSET, new TraitInfo("offset", Integer.class));
- shmTraitInfo.put(SHADOW, new TraitInfo("shadow", Integer.class));
- shmTraitInfo.put(BORDER_START,
+ TRAIT_INFO.put(OFFSET, new TraitInfo("offset", Integer.class));
+ TRAIT_INFO.put(SHADOW, new TraitInfo("shadow", Integer.class));
+ TRAIT_INFO.put(BORDER_START,
new TraitInfo("border-start", BorderProps.class));
- shmTraitInfo.put(BORDER_END,
+ TRAIT_INFO.put(BORDER_END,
new TraitInfo("border-end", BorderProps.class));
- shmTraitInfo.put(BORDER_BEFORE,
+ TRAIT_INFO.put(BORDER_BEFORE,
new TraitInfo("border-before", BorderProps.class));
- shmTraitInfo.put(BORDER_AFTER,
+ TRAIT_INFO.put(BORDER_AFTER,
new TraitInfo("border-after", BorderProps.class));
- shmTraitInfo.put(PADDING_START,
+ TRAIT_INFO.put(PADDING_START,
new TraitInfo("padding-start", Integer.class));
- shmTraitInfo.put(PADDING_END,
+ TRAIT_INFO.put(PADDING_END,
new TraitInfo("padding-end", Integer.class));
- shmTraitInfo.put(PADDING_BEFORE,
+ TRAIT_INFO.put(PADDING_BEFORE,
new TraitInfo("padding-before", Integer.class));
- shmTraitInfo.put(PADDING_AFTER,
+ TRAIT_INFO.put(PADDING_AFTER,
new TraitInfo("padding-after", Integer.class));
}
* @return the trait name
*/
public static String getTraitName(Object traitCode) {
- Object obj = shmTraitInfo.get(traitCode);
+ Object obj = TRAIT_INFO.get(traitCode);
if (obj != null) {
return ((TraitInfo) obj).sName;
} else {
* @return the trait code object
*/
public static Object getTraitCode(String sTraitName) {
- Iterator iter = shmTraitInfo.entrySet().iterator();
+ Iterator iter = TRAIT_INFO.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next();
TraitInfo ti = (TraitInfo) entry.getValue();
* @return the class type for the trait
*/
private static Class getTraitClass(Object oTraitCode) {
- TraitInfo ti = (TraitInfo) shmTraitInfo.get(oTraitCode);
+ TraitInfo ti = (TraitInfo) TRAIT_INFO.get(oTraitCode);
return (ti != null ? ti.sClass : null);
}
// See what type of object it is
// Convert string value to an object of that type
Class tclass = getTraitClass(oCode);
- if (tclass == null)
+ if (tclass == null) {
return null;
+ }
if (tclass.equals(String.class)) {
return sTraitValue;
}
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
/*
* $Id$
- * Copyright (C) 2002 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2002-2003 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
public class InlineArea extends Area {
// int width;
private int height;
+ /**
+ * The content ipd of this inline area
+ */
protected int contentIPD = 0;
- // offset position from top of parent area
- int verticalPosition = 0;
+ /**
+ * offset position from top of parent area
+ */
+ protected int verticalPosition = 0;
/**
* Render this inline area.
return contentIPD;
}
+ /**
+ * Set the inline progression dimension of this inline area.
+ *
+ * @param ipd the inline progression dimension
+ */
public void setIPD(int ipd) {
this.contentIPD = ipd;
}
+ /**
+ * Get the inline progression dimension
+ *
+ * @return the inline progression dimension of this area
+ */
public int getIPD() {
return this.contentIPD;
}
+ /**
+ * Increase the inline progression dimensions of this area.
+ * This is used for inline parent areas that contain mulitple child areas.
+ *
+ * @param ipd the inline progression to increase by
+ */
public void increaseIPD(int ipd) {
this.contentIPD += ipd;
}
+ /**
+ * Set the height of this inline area.
+ *
+ * @param h the height value to set
+ */
public void setHeight(int h) {
height = h;
}
+ /**
+ * Get the height of this inline area.
+ *
+ * @return the height of the inline area
+ */
public int getHeight() {
return height;
}
+ /**
+ * Get the allocation inline progression dimension of this area.
+ * This adds the content, borders and the padding to find the
+ * total allocated IPD.
+ *
+ * @return the total IPD allocation for this area
+ */
public int getAllocIPD() {
// If start or end border or padding is non-zero, add to content IPD
int iBP = contentIPD;
import org.apache.fop.render.Renderer;
+/**
+ * A word inline area.
+ * This is really a collection character inline areas collected together
+ * into a single word.
+ */
public class Word extends InlineArea {
/**
* The word for this word area.