ca = new char[length];
System.arraycopy(tmp, 0, ca, 0, length);
}
- list.add(new TextLayoutManager(this, ca, textInfo));
+ LayoutManager lm = new TextLayoutManager(ca, textInfo);
+ lm.setFObj(this);
+ list.add(lm);
}
public CharIterator charIterator() {
public void addLayoutManager(List lms) {
if (children != null) {
- lms.add(new InlineStackingLayoutManager(this,
- new LMiter(children.listIterator())));
+ InlineStackingLayoutManager lm;
+ lm = new InlineStackingLayoutManager();
+ lm.setUserAgent(getUserAgent());
+ lm.setFObj(this);
+ lm.setLMiter(new LMiter(children.listIterator()));
+ lms.add(lm);
}
}
// use special layout manager to add the inline areas
// to the Title.
InlineStackingLayoutManager lm;
- lm = new InlineStackingLayoutManager(this,
- new LMiter(children.listIterator()));
+ lm = new InlineStackingLayoutManager();
lm.setUserAgent(getUserAgent());
+ lm.setFObj(this);
+ lm.setLMiter(new LMiter(children.listIterator()));
lm.init();
// get breaks then add areas to title
// add start and end properties for the link
public void addLayoutManager(List lms) {
setup();
- lms.add(new InlineStackingLayoutManager(this,
- new LMiter(children.listIterator())) {
+ InlineStackingLayoutManager lm;
+ lm = new InlineStackingLayoutManager() {
protected InlineParent createArea() {
InlineParent area = super.createArea();
setupLinkArea(parentLM, area);
return area;
}
- });
+ };
+ lm.setUserAgent(getUserAgent());
+ lm.setFObj(this);
+ lm.setLMiter(new LMiter(children.listIterator()));
+ lms.add(lm);
}
protected void setupLinkArea(LayoutManager parentLM, InlineParent area) {
for (int count = childList.size() - 1; count >= 0; count--) {
LayoutManager lm = (LayoutManager) childList.get(count);
if (lm.generatesInlineAreas()) {
- list.add( new BidiLayoutManager(this,
- (LeafNodeLayoutManager) lm));
+ LayoutManager blm = new BidiLayoutManager((LeafNodeLayoutManager) lm);
+ blm.setFObj(this);
+ list.add(blm);
} else {
list.add(lm);
}
class BidiLayoutManager extends LeafNodeLayoutManager {
List childs;
- BidiLayoutManager(FObj obj, LeafNodeLayoutManager cLM) {
- super(obj);
+ BidiLayoutManager(LeafNodeLayoutManager cLM) {
childs = new ArrayList();
/* for (int count = cLM.size() - 1; count >= 0; count--) {
InlineArea ia = cLM.get(count);
}
public void addLayoutManager(List list) {
- BlockLayoutManager blm = new BlockLayoutManager(this);
+ BlockLayoutManager blm = new BlockLayoutManager();
blm.setUserAgent(getUserAgent());
+ blm.setFObj(this);
TextInfo ti = propMgr.getTextLayoutProps(fontInfo);
blm.setBlockTextInfo(ti);
list.add(blm);
}
public void addLayoutManager(List list) {
- BlockContainerLayoutManager blm = new BlockContainerLayoutManager(this);
+ BlockContainerLayoutManager blm = new BlockContainerLayoutManager();
+ blm.setUserAgent(getUserAgent());
+ blm.setFObj(this);
blm.setOverflow(properties.get("overflow").getEnum());
list.add(blm);
}
public void addLayoutManager(List list) {
InlineArea inline = getInlineArea();
if (inline != null) {
- LeafNodeLayoutManager lm = new LeafNodeLayoutManager(this);
+ LeafNodeLayoutManager lm = new LeafNodeLayoutManager();
+ lm.setUserAgent(getUserAgent());
+ lm.setFObj(this);
lm.setCurrentArea(inline);
list.add(lm);
}
InlineArea area = getInlineArea();
if (area != null) {
setupID();
- LeafNodeLayoutManager lm = new LeafNodeLayoutManager(this);
+ LeafNodeLayoutManager lm = new LeafNodeLayoutManager();
+ lm.setUserAgent(getUserAgent());
+ lm.setFObj(this);
lm.setCurrentArea(area);
lm.setAlignment(properties.get("vertical-align").getEnum());
lm.setLead(viewHeight);
}
public void addLayoutManager(List list) {
- FlowLayoutManager lm = new FlowLayoutManager(this);
+ FlowLayoutManager lm = new FlowLayoutManager();
lm.setUserAgent(getUserAgent());
+ lm.setFObj(this);
list.add(lm);
}
import org.apache.fop.fo.properties.*;
import org.apache.fop.layout.*;
import org.apache.fop.apps.FOPException;
+import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.layoutmgr.LeafNodeLayoutManager;
import org.apache.fop.area.inline.InlineArea;
public void addLayoutManager(List lms) {
ArrayList childList = new ArrayList();
super.addLayoutManager(childList);
- lms.add(new ICLayoutManager(this, childList));
+ LayoutManager lm = new ICLayoutManager(childList);
+ lm.setUserAgent(getUserAgent());
+ lm.setFObj(this);
+ lms.add(lm);
}
public void handleAttrs(Attributes attlist) throws FOPException {
class ICLayoutManager extends LeafNodeLayoutManager {
List childrenLM;
- ICLayoutManager(FObj obj, List childLM) {
- super(obj);
+ ICLayoutManager(List childLM) {
childrenLM = childLM;
}
public void addLayoutManager(List list) {
areaCurrent = getInlineArea();
if(areaCurrent != null) {
- LeafNodeLayoutManager lm = new LeafNodeLayoutManager(this);
+ LeafNodeLayoutManager lm = new LeafNodeLayoutManager();
+ lm.setUserAgent(getUserAgent());
+ lm.setFObj(this);
lm.setCurrentArea(areaCurrent);
lm.setAlignment(properties.get("vertical-align").getEnum());
lm.setLead(areaCurrent.getHeight());
}
public void addLayoutManager(List list) {
- LeafNodeLayoutManager lm = new LeafNodeLayoutManager(this) {
+ LeafNodeLayoutManager lm = new LeafNodeLayoutManager() {
public InlineArea get(LayoutContext context) {
return getInlineArea();
}
}
}*/
};
+ lm.setUserAgent(getUserAgent());
+ lm.setFObj(this);
lm.setAlignment(properties.get("leader-alignment").getEnum());
list.add(lm);
}
return;
}
InlineStackingLayoutManager lm;
- lm = new InlineStackingLayoutManager(this,
- new LMiter(children.listIterator()));
+ lm = new InlineStackingLayoutManager();
lm.setUserAgent(getUserAgent());
+ lm.setFObj(this);
+ lm.setLMiter(new LMiter(children.listIterator()));
lm.init();
// get breaks then add areas to FilledArea
}
public void addLayoutManager(List list) {
- ListBlockLayoutManager blm = new ListBlockLayoutManager(this);
+ ListBlockLayoutManager blm = new ListBlockLayoutManager();
+ blm.setUserAgent(getUserAgent());
+ blm.setFObj(this);
list.add(blm);
}
public void addLayoutManager(List list) {
if(label != null && body != null) {
- ListItemLayoutManager blm = new ListItemLayoutManager(this);
+ ListItemLayoutManager blm = new ListItemLayoutManager();
+ blm.setUserAgent(getUserAgent());
+ blm.setFObj(this);
blm.setLabel(label.getItemLayoutManager());
blm.setBody(body.getItemLayoutManager());
list.add(blm);
}
public Item getItemLayoutManager() {
- Item item = new Item(this);
+ Item item = new Item();
+ item.setUserAgent(getUserAgent());
+ item.setFObj(this);
return item;
}
}
public Item getItemLayoutManager() {
- Item itemLabel = new Item(this);
+ Item itemLabel = new Item();
+ itemLabel.setUserAgent(getUserAgent());
+ itemLabel.setFObj(this);
return itemLabel;
}
import org.apache.fop.util.CharUtilities;
import org.apache.fop.apps.StructureHandler;
+import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.layoutmgr.LeafNodeLayoutManager;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.area.inline.InlineArea;
public void addLayoutManager(List lms) {
setup();
- lms.add(new LeafNodeLayoutManager(this) {
+ LayoutManager lm;
+ lm = new LeafNodeLayoutManager() {
public InlineArea get(LayoutContext context) {
// get page string from parent, build area
Word inline = new Word();
protected void offsetArea(LayoutContext context) {
curArea.setOffset(context.getBaseline());
}
- }
- );
+ };
+ lm.setUserAgent(getUserAgent());
+ lm.setFObj(this);
+ lms.add(lm);
}
public void setup() {
public void addLayoutManager(List lms) {
setup();
- lms.add(new LeafNodeLayoutManager(this) {
+ LayoutManager lm;
+ lm = new LeafNodeLayoutManager() {
public InlineArea get(LayoutContext context) {
return getInlineArea(parentLM);
}
protected void offsetArea(LayoutContext context) {
curArea.setOffset(context.getBaseline());
}
- }
- );
+ };
+ lm.setUserAgent(getUserAgent());
+ lm.setFObj(this);
+ lms.add(lm);
}
// if id can be resolved then simply return a word, otherwise
public StaticContentLayoutManager getLayoutManager() {
if (lm == null) {
- lm = new StaticContentLayoutManager(this);
+ lm = new StaticContentLayoutManager();
+ lm.setUserAgent(getUserAgent());
+ lm.setFObj(this);
}
return lm;
}
* Must override in subclasses if their content can be laid out.
*/
public void addLayoutManager(List list) {
- TableLayoutManager tlm = new TableLayoutManager(this);
+ TableLayoutManager tlm = new TableLayoutManager();
+ tlm.setUserAgent(getUserAgent());
+ tlm.setFObj(this);
tlm.setColumns(columns);
if(tableHeader != null) {
tlm.setTableHeader(tableHeader.getLayoutManager());
}
public Body getLayoutManager() {
- Body blm = new Body(this);
+ Body blm = new Body();
+ blm.setUserAgent(getUserAgent());
+ blm.setFObj(this);
return blm;
}
/**
*/
public void addLayoutManager(List list) {
- Cell clm = new Cell(this);
+ Cell clm = new Cell();
+ clm.setUserAgent(getUserAgent());
+ clm.setFObj(this);
list.add(clm);
}
public LayoutManager getLayoutManager() {
doSetup();
- return new Column(this);
+ Column clm = new Column();
+ clm.setUserAgent(getUserAgent());
+ clm.setFObj(this);
+ return clm;
}
public Length getColumnWidthAsLength() {
/**
*/
public void addLayoutManager(List list) {
- Row rlm = new Row(this);
+ Row rlm = new Row();
+ rlm.setUserAgent(getUserAgent());
+ rlm.setFObj(this);
list.add(rlm);
}
// This will layout pages and add them to the area tree
PageLayoutManager pageLM = new PageLayoutManager(areaTree, this);
pageLM.setUserAgent(getUserAgent());
+ pageLM.setFObj(this);
pageLM.setPageCounting(currentPageNumber, pageNumberGenerator);
// For now, skip the threading and just call run directly.
/*
* $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 abstract class AbstractLayoutManager implements LayoutManager {
protected FOUserAgent userAgent;
- protected LayoutManager parentLM;
+ protected LayoutManager parentLM = null;
protected FObj fobj;
protected String foID = null;
protected ListIterator childLMiter;
protected boolean bInited = false;
- protected LayoutPos curPos = new LayoutPos();
- static class LayoutPos {
- int lmIndex = 0;
- int subIndex = 0;
- }
-
- public AbstractLayoutManager(FObj fobj) {
- this(fobj, new LMiter(fobj.getChildren()));
+ /**
+ * Abstract layout manager.
+ */
+ public AbstractLayoutManager() {
}
- public AbstractLayoutManager(FObj fobj, ListIterator lmIter) {
- this.fobj = fobj;
+ /**
+ * Set the FO object for this layout manager
+ *
+ * @param fo the fo for this layout manager
+ */
+ public void setFObj(FObj fo) {
+ this.fobj = fo;
foID = fobj.getID();
- this.parentLM = null;
- childLMiter = lmIter;
+ childLMiter = new LMiter(fobj.getChildren());
}
/**
int overflow;
PropertyManager propManager;
- public BlockContainerLayoutManager(FObj fobj) {
- super(fobj);
+ public BlockContainerLayoutManager() {
}
public void setOverflow(int of) {
}
}
LineLayoutManager child;
- child = new LineLayoutManager(fobj, inlines, lineHeight,
+ child = new LineLayoutManager(lineHeight,
lead, follow);
child.setUserAgent(getUserAgent());
+ child.setFObj(fobj);
+ child.setLMiter(inlines.listIterator());
return child;
}
}
- public BlockLayoutManager(FObj fobj) {
- super(fobj);
+ public BlockLayoutManager() {
+ }
+
+ /**
+ * Set the FO object for this layout manager
+ *
+ * @param fo the fo for this layout manager
+ */
+ public void setFObj(FObj fo) {
+ super.setFObj(fo);
childLMiter = new BlockLMiter(childLMiter);
}
protected LayoutManager curChildLM = null;
protected BlockParent parentArea = null;
- public BlockStackingLayoutManager(FObj fobj) {
- super(fobj);
+ public BlockStackingLayoutManager() {
}
private BreakCost evaluateBreakCost(Area parent, Area child) {
*/
package org.apache.fop.layoutmgr;
+import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FOUserAgent;
import org.apache.fop.area.Area;
import org.apache.fop.area.Resolveable;
holder = area;
}
+ /**
+ * Set the FO object for this layout manager
+ *
+ * @param fo the fo for this layout manager
+ */
+ public void setFObj(FObj fo) {
+ }
+
public void fillArea(LayoutManager curLM) {
List childBreaks = new ArrayList();
* This is the top level layout manager.
* It is created by the PageSequence FO.
*/
- public FlowLayoutManager(FObj fobj) {
- super(fobj);
+ public FlowLayoutManager() {
}
public BreakPoss getNextBreakPoss(LayoutContext context) {
* @param fobj the formatting object that creates the area
* @param childLMiter the iterator for child areas
*/
- public InlineStackingLayoutManager(FObj fobj,
- ListIterator childLMiter) {
- super(fobj, childLMiter);
+ public InlineStackingLayoutManager() {
+ }
+
+ /**
+ * Set the FO object for this layout manager
+ *
+ * @param fo the fo for this layout manager
+ */
+ public void setFObj(FObj fo) {
+ this.fobj = fo;
+ foID = fobj.getID();
+ childLMiter = null;
+ }
+
+ /**
+ * Set the iterator.
+ *
+ * @param iter the iterator for this LM
+ */
+ public void setLMiter(ListIterator iter) {
+ childLMiter = iter;
}
/**
/*
* $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.
*/
package org.apache.fop.layoutmgr;
import org.apache.fop.fo.FOUserAgent;
+import org.apache.fop.fo.FObj;
import org.apache.fop.area.Area;
import org.apache.fop.area.Resolveable;
*/
public interface LayoutManager {
+ /**
+ * Set the FO object for this layout manager.
+ * For layout managers that are created without an FO
+ * this may not be called.
+ *
+ * @param obj the FO object for this layout manager
+ */
+ public void setFObj(FObj obj);
+
/**
* Set the user agent.
*
* Create a Leaf node layout mananger.
* @param fobj the fo object that created this manager
*/
- public LeafNodeLayoutManager(FObj fobj) {
- super(fobj);
+ public LeafNodeLayoutManager() {
}
/**
* @param l the default lead, from top to baseline
* @param f the default follow, from baseline to bottom
*/
- public LineLayoutManager(FObj fobj, List lms, int lh, int l, int f) {
- super(fobj, lms.listIterator());
+ public LineLayoutManager(int lh, int l, int f) {
lineHeight = lh;
lead = l;
follow = f;
* @param pageseq the page sequence fo
*/
public PageLayoutManager(AreaTree areaTree, PageSequence pageseq) {
- super(pageseq);
this.areaTree = areaTree;
pageSequence = pageseq;
}
private RegionReference region;
private List blockBreaks = new ArrayList();
- public StaticContentLayoutManager(FObj fobj) {
- super(fobj);
+ public StaticContentLayoutManager() {
}
public void setRegionReference(RegionReference region) {
* @param chars the characters
* @param textInfo the text information for doing layout
*/
- public TextLayoutManager(FObj fobj, char[] chars, TextInfo textInfo) {
- super(fobj);
+ public TextLayoutManager(char[] chars, TextInfo textInfo) {
this.chars = chars;
this.textInfo = textInfo;
this.vecAreaInfo = new ArrayList();
* Create a new Cell layout manager.
* @param fobj the formatting object for the cell
*/
- public Item(FObj fobj) {
- super(fobj);
+ public Item() {
}
protected void initProperties(PropertyManager propMgr) {
/**
* Create a new table layout manager.
*
- * @param fobj the table formatting object
*/
- public ListBlockLayoutManager(FObj fobj) {
- super(fobj);
+ public ListBlockLayoutManager() {
}
protected void initProperties(PropertyManager propMgr) {
/**
* Create a new list item layout manager.
*
- * @param fobj the list-item formatting object
*/
- public ListItemLayoutManager(FObj fobj) {
- super(fobj);
+ public ListItemLayoutManager() {
}
protected void initProperties(PropertyManager propMgr) {
*
* @param fobj the formatting object that created this manager
*/
- public Body(FObj fobj) {
- super(fobj);
+ public Body() {
}
/**
/**
* Create a new Caption layout manager.
*
- * @param fobj the formatting object that created this manager
*/
- public Caption(FObj fobj) {
- super(fobj);
+ public Caption() {
}
/**
/**
* Create a new Cell layout manager.
- * @param fobj the formatting object for the cell
*/
- public Cell(FObj fobj) {
- super(fobj);
+ public Cell() {
}
protected void initProperties(PropertyManager propMgr) {
package org.apache.fop.layoutmgr.table;
+import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyManager;
import org.apache.fop.layoutmgr.AbstractLayoutManager;
import org.apache.fop.layoutmgr.BreakPoss;
*
* @param fobj the table-column formatting object
*/
- public Column(TableColumn fobj) {
- super(fobj);
- columnWidth = fobj.getColumnWidth();
+ public Column() {
+ }
+
+ public void setFObj(FObj fobj) {
+ super.setFObj(fobj);
+ columnWidth = ((TableColumn)fobj).getColumnWidth();
}
protected void initProperties(PropertyManager propMgr) {
/**
* Create a new row layout manager.
*
- * @param fobj the table-row formatting object
*/
- public Row(FObj fobj) {
- super(fobj);
+ public Row() {
}
/**
/**
* Create a new table and caption layout manager.
*
- * @param fobj the table-and-caption formatting object
*/
- public TableAndCaptionLayoutManager(FObj fobj) {
- super(fobj);
+ public TableAndCaptionLayoutManager() {
}
/**
/**
* Create a new table layout manager.
*
- * @param fobj the table formatting object
*/
- public TableLayoutManager(FObj fobj) {
- super(fobj);
+ public TableLayoutManager() {
}
protected void initProperties(PropertyManager propMgr) {