import org.apache.fop.fo.pagination.PageSequence;
import org.apache.fop.fo.pagination.StaticContent;
import org.apache.fop.fo.pagination.Title;
+import org.apache.fop.area.AreaTreeHandler;
import org.apache.fop.layoutmgr.list.ListBlockLayoutManager;
import org.apache.fop.layoutmgr.list.ListItemLayoutManager;
makers.put(PageNumber.class, new PageNumberLayoutManagerMaker());
makers.put(PageNumberCitation.class,
new PageNumberCitationLayoutManagerMaker());
- makers.put(PageSequence.class, new PageSequenceLayoutManagerMaker());
makers.put(Table.class, new TableLayoutManagerMaker());
makers.put(TableBody.class, new /*TableBodyLayoutManager*/Maker());
makers.put(TableColumn.class, new /*TableColumnLayoutManager*/Maker());
return (LayoutManager) lms.get(0);
}
+ public PageSequenceLayoutManager makePageSequenceLayoutManager(
+ AreaTreeHandler ath, PageSequence ps) {
+ return new PageSequenceLayoutManager(ath, ps);
+ }
+
public static class Maker {
public void make(FONode node, List lms) {
// no layout manager
}
}
- public static class PageSequenceLayoutManagerMaker extends Maker {
- public void make(FONode node, List lms) {
- lms.add(new PageSequenceLayoutManager((PageSequence) node));
- }
- }
-
public static class TableLayoutManagerMaker extends Maker {
/*
import java.util.List;
/**
- * LayoutManager for a PageSequence.
+ * LayoutManager for a PageSequence. This class is instantiated by
+ * area.AreaTreeHandler for each fo:page-sequence found in the
+ * input document.
*/
public class PageSequenceLayoutManager extends AbstractLayoutManager {
+
+ /**
+ * AreaTreeHandler which activates the PSLM and controls
+ * the rendering of its pages.
+ */
+ private AreaTreeHandler areaTreeHandler;
+
+ /**
+ * fo:page-sequence formatting object being
+ * processed by this class
+ */
private PageSequence pageSeq;
+ /**
+ * Current page-viewport-area being filled by
+ * the PSLM.
+ */
+ private PageViewport curPV = null;
+
+ /**
+ * Zero-based index of column (Normal Flow) in span (of the PV)
+ * being filled. See XSL Rec description of fo:region-body
+ * and fop.Area package classes for more information.
+ */
+ private int curFlowIdx = -1;
+
/*
private static class BlockBreakPosition extends LeafPosition {
protected BreakPoss breakps;
private int startPageNum = 0;
private int currentPageNum = 0;
- /** Current page-viewport-area being filled. */
- private PageViewport curPV = null;
-
- /** Zero-based index of column (Normal Flow) in span being filled. */
- private int curFlowIdx = -1;
-
- /**
- * AreaTreeHandler which activates this PSLM.
- */
- private AreaTreeHandler areaTreeHandler;
-
- /**
- * AreaTreeModel that this PSLM sends pages to.
- */
- private AreaTreeModel areaTreeModel;
-
/**
* The single FlowLayoutManager object, which processes
* the single fo:flow of the fo:page-sequence
//private HashMap staticContentLMs = new HashMap(4);
/**
- * Constructor - activated by AreaTreeHandler for each
- * fo:page-sequence in the input FO stream
+ * Constructor
*
- * @param pageSeq the page-sequence formatting object
- */
- public PageSequenceLayoutManager(PageSequence pageSeq) {
- super(pageSeq);
- this.pageSeq = pageSeq;
- }
-
- /**
- * Set the AreaTreeHandler
- * @param areaTreeHandler the area tree handler object
+ * @param ath the area tree handler object
+ * @param pseq fo:page-sequence to process
*/
- public void setAreaTreeHandler(AreaTreeHandler areaTreeHandler) {
- this.areaTreeHandler = areaTreeHandler;
- areaTreeModel = areaTreeHandler.getAreaTreeModel();
+ public PageSequenceLayoutManager(AreaTreeHandler ath, PageSequence pseq) {
+ super(pseq);
+ this.areaTreeHandler = ath;
+ this.pageSeq = pseq;
}
/**
title = (LineArea) clm.getParentArea(null); // can improve
}
- areaTreeModel.startPageSequence(title);
+ areaTreeHandler.getAreaTreeModel().startPageSequence(title);
log.debug("Starting layout");
curPV = makeNewPage(false, true, false);
* @return the layout manager for the marker contents
*/
public Marker retrieveMarker(String name, int pos, int boundary) {
+ AreaTreeModel areaTreeModel = areaTreeHandler.getAreaTreeModel();
+
// get marker from the current markers on area tree
Marker mark = (Marker)curPV.getMarker(name, pos);
if (mark == null && boundary != EN_PAGE) {
if (sc == null) {
return;
}
-
+
RegionViewport rv = curPV.getPage().getRegionViewport(regionID);
StaticContentLayoutManager lm;
lm = (StaticContentLayoutManager)
layoutSideRegion(FO_REGION_START);
layoutSideRegion(FO_REGION_END);
// Queue for ID resolution and rendering
- areaTreeModel.addPage(curPV);
+ areaTreeHandler.getAreaTreeModel().addPage(curPV);
log.debug("page finished: " + curPV.getPageNumberString() + ", current num: " + currentPageNum);
curPV = null;
curFlowIdx = -1;