import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FONode;
import org.apache.fop.area.Area;
-import org.apache.fop.area.Resolvable;
import org.apache.fop.area.PageViewport;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.flow.RetrieveMarker;
public void addChildArea(Area childArea) {
}
- /**
- * Delegate getting the current page viewport to the parent layout manager.
- *
- * @see org.apache.fop.layoutmgr.LayoutManager
- */
- public PageViewport getCurrentPV() {
- return parentLM.getCurrentPV();
- }
-
- /**
- * Delegate resolving the id reference to the PSLM
- *
- * @see org.apache.fop.layoutmgr.LayoutManager
- */
- public PageViewport getFirstPVWithID(String ref) {
- return parentLM.getFirstPVWithID(ref);
- }
-
/**
* Add the id to the page.
* If the id string is not null then add the id to the current page.
*/
protected void addID(String foID) {
if (foID != null && foID.length() > 0) {
- addIDToPage(foID);
+ getPSLM().addIDToPage(foID);
}
}
- /**
- * Delegate adding id reference to the parent layout manager.
- *
- * @see org.apache.fop.layoutmgr.LayoutManager
- */
- public void addIDToPage(String id) {
- parentLM.addIDToPage(id);
- }
-
- /**
- * Delegate adding unresolved area to the parent layout manager.
- *
- * @see org.apache.fop.layoutmgr.LayoutManager
- */
- public void addUnresolvedArea(String id, Resolvable res) {
- parentLM.addUnresolvedArea(id, res);
- }
-
- /**
- * Delegate retrieve marker to the parent layout manager.
- *
- * @see org.apache.fop.layoutmgr.LayoutManager
- */
- public Marker retrieveMarker(String name, int pos, int boundary) {
- return parentLM.retrieveMarker(name, pos, boundary);
- }
-
- /**
- * Delegate getLayoutManagerMaker to the parent layout manager.
- *
- * @see org.apache.fop.layoutmgr.LayoutManager
- * @return the LayoutManagerMaker object.
- */
- public LayoutManagerMaker getLayoutManagerMaker() {
- return parentLM.getLayoutManagerMaker();
- }
-
/**
* Handles retrieve-marker nodes as they occur.
* @param foNode FO node to check
private FONode handleRetrieveMarker(FONode foNode) {
if (foNode instanceof RetrieveMarker) {
RetrieveMarker rm = (RetrieveMarker) foNode;
- Marker marker = retrieveMarker(rm.getRetrieveClassName(),
+ Marker marker = getPSLM().retrieveMarker(rm.getRetrieveClassName(),
rm.getRetrievePosition(),
rm.getRetrieveBoundary());
if (marker == null) {
FONode foNode = (FONode) theobj;
foNode = handleRetrieveMarker(foNode);
if (foNode != null) {
- getLayoutManagerMaker().
+ getPSLM().getLayoutManagerMaker().
makeLayoutManagers(foNode, newLMs);
}
}
return newLMs;
}
+ /**
+ * @see org.apache.fop.layoutmgr.PageSequenceLayoutManager#getPSLM
+ */
+ public PageSequenceLayoutManager getPSLM() {
+ return parentLM.getPSLM();
+ }
+
+ /**
+ * @see org.apache.fop.layoutmgr.PageSequenceLayoutManager#getCurrentPV
+ */
+ public PageViewport getCurrentPV() {
+ return getPSLM().getCurrentPV();
+ }
+
/**
* @see org.apache.fop.layoutmgr.LayoutManager#preLoadNext
*/
addChildLM(lm);
}
}
-
}
-
area.addTrait(Trait.EXTERNAL_LINK, fobj.getExternalDestination());
} else {
String idref = fobj.getInternalDestination();
- PageViewport page = parentLM.getFirstPVWithID(idref);
+ PageViewport page = getPSLM().getFirstPVWithID(idref);
if (page != null) {
area.addTrait(Trait.INTERNAL_LINK, page.getKey());
} else {
LinkResolver res = new LinkResolver(idref, area);
- parentLM.addUnresolvedArea(idref, res);
+ getPSLM().addUnresolvedArea(idref, res);
}
}
}
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.pagination.Title;
-import org.apache.fop.fo.flow.Marker;
import org.apache.fop.area.Area;
import org.apache.fop.area.LineArea;
import org.apache.fop.area.inline.InlineArea;
-import org.apache.fop.area.Resolvable;
-import org.apache.fop.area.PageViewport;
import java.util.LinkedList;
import java.util.List;
public void getWordChars(StringBuffer sbChars, Position bp1,
Position bp2) { }
- /** @see org.apache.fop.layoutmgr.LayoutManager */
- public PageViewport getCurrentPV() {
- return parentLM.getCurrentPV();
- }
-
- /** @see org.apache.fop.layoutmgr.LayoutManager */
- public PageViewport getFirstPVWithID(String ref) {
- return parentLM.getFirstPVWithID(ref);
- }
-
- /** @see org.apache.fop.layoutmgr.LayoutManager */
- public void addIDToPage(String id) {
- parentLM.addIDToPage(id);
- }
-
- /** @see org.apache.fop.layoutmgr.LayoutManager */
- public void addUnresolvedArea(String id, Resolvable res) {
- parentLM.addUnresolvedArea(id, res);
- }
-
- /** @see org.apache.fop.layoutmgr.LayoutManager */
- public Marker retrieveMarker(String name, int pos, int boundary) {
- return parentLM.retrieveMarker(name, pos, boundary);
- }
-
- /**
- * @see org.apache.fop.layoutmgr.LayoutManager
- * @return the LayoutManagerMaker object.
- */
- public LayoutManagerMaker getLayoutManagerMaker() {
- return parentLM.getLayoutManagerMaker();
- }
-
/**
* @see org.apache.fop.layoutmgr.LayoutManager#preLoadNext
*/
int alignment) {
return null;
}
-
+
+ public PageSequenceLayoutManager getPSLM() {
+ return parentLM.getPSLM();
+ }
}
import java.util.LinkedList;
import java.util.List;
-import org.apache.fop.fo.flow.Marker;
-
import org.apache.fop.area.Area;
-import org.apache.fop.area.Resolvable;
-import org.apache.fop.area.PageViewport;
import org.apache.fop.fo.FObj;
/**
*/
void initialize();
+ /**
+ * Get the active PageSequenceLayoutManager instance for this
+ * layout process.
+ */
+ PageSequenceLayoutManager getPSLM();
+
/**
* Generates inline areas.
* This is used to check if the layout manager generates inline
*/
void addAreas(PositionIterator posIter, LayoutContext context);
- /**
- * Get the PageViewport currently being generated
- *
- * @return the current PageViewport
- */
- PageViewport getCurrentPV();
-
/**
* Load next child LMs, up to child LM index pos
* @param pos index up to which child LMs are requested
*/
LinkedList getChangedKnuthElements(List oldList, /*int flaggedPenalty,*/
int alignment);
-
- /** @see PageSequenceLayoutManager#getFirstPVWithID(String) */
- PageViewport getFirstPVWithID(String ref);
-
- /** @see PageSequenceLayoutManager#addIDToPage(String) */
- void addIDToPage(String id);
-
- /** @see PageSequenceLayoutManager#addUnresolvedArea(String, Resolvable) */
- void addUnresolvedArea(String id, Resolvable res);
-
- /** @see PageSequenceLayoutManager#retrieveMarker(String, int, int) */
- Marker retrieveMarker(String name, int pos, int boundary);
-
- /** @see PageSequenceLayoutManager#getLayoutManagerMaker() */
- LayoutManagerMaker getLayoutManagerMaker();
-
+
public static final int FLAGGED_PENALTY = 50;
}
import org.apache.fop.hyphenation.Hyphenation;
import org.apache.fop.hyphenation.Hyphenator;
import org.apache.fop.area.LineArea;
-import org.apache.fop.area.Resolvable;
import java.util.ListIterator;
import java.util.Iterator;
}
setCurrentArea(null); // ?? necessary
}
-
- /**
- * Add an unresolved area.
- * If a child layout manager needs to add an unresolved area
- * for page reference or linking then this intercepts it for
- * line area handling.
- * A line area may need to have the inline areas adjusted
- * to properly fill the line area. This adds a resolver that
- * resolves the inline area and can do the necessary
- * adjustments to the line and inline areas.
- *
- * @param id the id reference of the resolvable
- * @param res the resolvable object
- */
- public void addUnresolvedArea(String id, Resolvable res) {
- // create a resolvable class that handles ipd
- // adjustment for the current line
-
- parentLM.addUnresolvedArea(id, res);
- }
-
}
public void addAreas(PositionIterator posIter, LayoutContext context) {
super.addAreas(posIter, context);
if (!resolved) {
- parentLM.addUnresolvedArea(fobj.getRefId(), (Resolvable) curArea);
+ getPSLM().addUnresolvedArea(fobj.getRefId(), (Resolvable) curArea);
}
}
* return a resolvable area
*/
private InlineArea getPageNumberCitationInlineArea(LayoutManager parentLM) {
- PageViewport page = parentLM.getFirstPVWithID(fobj.getRefId());
+ PageViewport page = getPSLM().getFirstPVWithID(fobj.getRefId());
InlineArea inline = null;
if (page != null) {
String str = page.getPageNumberString();
public InlineArea get(LayoutContext context) {
// get page string from parent, build area
TextArea inline = new TextArea();
- String str = parentLM.getCurrentPV().getPageNumberString();
+ String str = getCurrentPV().getPageNumberString();
int width = 0;
for (int count = 0; count < str.length(); count++) {
width += font.getCharWidth(str.charAt(count));
return curPV;
}
+ /**
+ * Provides access to this object
+ * @return this PageSequenceLayoutManager instance
+ */
+ public PageSequenceLayoutManager getPSLM() {
+ return this;
+ }
+
/**
* This returns the first PageViewport that contains an id trait
* matching the idref argument, or null if no such PV exists.