set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xalan-2.4.1.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\batik.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\avalon-framework-4.1.4.jar
-set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\commons-io-dev-20040206.jar
+set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\commons-io-1.0.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\commons-logging-1.0.3.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jimi-1.0.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jai_core.jar
/**
* @see org.apache.fop.fo.FObj#addLayoutManager(List)
- */
+ */
public void addLayoutManager(List list) {
if (getURL() != null) {
ExternalGraphicLayoutManager lm = new ExternalGraphicLayoutManager(this);
/**
* Make sure content model satisfied, if so then tell the
- * StructureRenderer that we are at the end of the flow.
+ * FOInputHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#end
*/
protected void endOfNode() throws SAXParseException {
/**
* Make sure content model satisfied, if so then tell the
- * StructureRenderer that we are at the end of the flow.
+ * FOInputHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#end
*/
protected void endOfNode() throws SAXParseException {
/**
* Make sure content model satisfied, if so then tell the
- * StructureRenderer that we are at the end of the flow.
+ * FOInputHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#end
*/
protected void endOfNode() throws SAXParseException {
/**
* Make sure content model satisfied, if so then tell the
- * StructureRenderer that we are at the end of the flow.
+ * FOInputHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#end
*/
protected void endOfNode() throws SAXParseException {
package org.apache.fop.fo.flow;
+// Java
+import java.util.List;
+
+// FOP
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
-import org.apache.fop.layoutmgr.AddLMVisitor;
import org.apache.fop.fo.FObjMixed;
import org.apache.fop.fo.properties.PercentLength;
import org.apache.fop.fonts.Font;
-import org.apache.fop.fo.LMVisited;
+import org.apache.fop.layoutmgr.LeaderLayoutManager;
/**
- * Class modelling fo:leader object. See Sec. 6.6.9 of the XSL-FO Standard.
+ * Class modelling fo:leader object.
* The main property of fo:leader is leader-pattern.
* The following patterns are treated: rule, space, dots and use-content.
*/
-public class Leader extends FObjMixed implements LMVisited {
+public class Leader extends FObjMixed {
private int ruleStyle;
private int ruleThickness;
}
+ /**
+ * @todo check need for each of these accessors (should be LM instead?)
+ */
public int getLength(int propId, int dim) {
int length;
Length maxlength = propertyList.get(propId).getLength();
if (maxlength instanceof PercentLength) {
- length = (int)(((PercentLength)maxlength).value()
- * dim);
+ length = (int)(((PercentLength)maxlength).value() * dim);
} else {
length = maxlength.getValue();
}
return patternWidth;
}
- public String getName() {
- return "fo:leader";
- }
-
/**
- * This is a hook for the AddLMVisitor class to be able to access
- * this object.
- * @param aLMV the AddLMVisitor object that can access this object.
+ * @see org.apache.fop.fo.FObj#addLayoutManager(List)
*/
- public void acceptVisitor(AddLMVisitor aLMV) {
+ public void addLayoutManager(List list) {
setup();
- aLMV.serveLeader(this);
+ LeaderLayoutManager lm = new LeaderLayoutManager(this);
+ list.add(lm);
}
-
+
+ /**
+ * @see org.apache.fop.fo.FObj#getName()
+ */
+ public String getName() {
+ return "fo:leader";
+ }
+
/**
* @see org.apache.fop.fo.FObj#getNameId()
*/
// XML
import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
import org.xml.sax.SAXParseException;
// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.layoutmgr.list.ListBlockLayoutManager;
-import org.apache.fop.fo.properties.CommonAccessibility;
-import org.apache.fop.fo.properties.CommonAural;
-import org.apache.fop.fo.properties.CommonBackground;
-import org.apache.fop.fo.properties.CommonBorderAndPadding;
-import org.apache.fop.fo.properties.CommonMarginBlock;
-import org.apache.fop.fo.properties.CommonRelativePosition;
/**
* Class modelling the fo:list-block object. See Sec. 6.8.2 of the XSL-FO
private int spaceAfter;
private int spaceBetweenListRows = 0;
private ColorType backgroundColor;
+
+ // used for child node validation
+ private boolean hasListItem = false;
/**
* @param parent FONode that is the parent of this object
getFOInputHandler().startList(this);
}
+ /**
+ * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
+ * XSL Content Model: marker* (list-item)+
+ */
+ protected void validateChildNode(Locator loc, String nsURI, String localName)
+ throws SAXParseException {
+ if (nsURI == FO_URI && localName.equals("marker")) {
+ if (hasListItem) {
+ nodesOutOfOrderError(loc, "fo:marker", "fo:list-item");
+ }
+ } else if (nsURI == FO_URI && localName.equals("list-item")) {
+ hasListItem = true;
+ } else {
+ invalidChildError(loc, nsURI, localName);
+ }
+ }
+
+ /**
+ * Make sure content model satisfied, if so then tell the
+ * FOInputHandler that we are at the end of the flow.
+ * @see org.apache.fop.fo.FONode#end
+ */
+ protected void endOfNode() throws SAXParseException {
+ if (!hasListItem) {
+ missingChildElementError("marker* (list-item)+");
+ }
+ getFOInputHandler().endList(this);
+ }
+
/**
* @return false (ListBlock does not generate inline areas)
*/
list.add(lm);
}
- protected void endOfNode() throws SAXParseException {
- super.endOfNode();
- getFOInputHandler().endList(this);
- }
-
public String getName() {
return "fo:list-block";
}
/**
* Make sure content model satisfied, if so then tell the
- * StructureRenderer that we are at the end of the flow.
+ * FOInputHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#end
*/
protected void endOfNode() throws SAXParseException {
/**
* Make sure content model satisfied, if so then tell the
- * StructureRenderer that we are at the end of the flow.
+ * FOInputHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#end
*/
protected void endOfNode() throws SAXParseException {
import java.util.List;
import java.util.ListIterator;
-import org.apache.fop.area.Trait;
-import org.apache.fop.area.inline.FilledArea;
-import org.apache.fop.area.inline.InlineArea;
-import org.apache.fop.area.inline.Space;
-import org.apache.fop.area.inline.TextArea;
-import org.apache.fop.datatypes.Length;
-import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.flow.Inline;
-import org.apache.fop.fo.flow.Leader;
import org.apache.fop.fo.flow.Wrapper;
-import org.apache.fop.traits.MinOptMax;
import org.apache.fop.fo.LMVisited;
/**
}
}
}
-
- public void serveLeader(final Leader node) {
- LeafNodeLayoutManager lm = new LeafNodeLayoutManager(node) {
- public InlineArea get(LayoutContext context) {
- return getLeaderInlineArea(node, this);
- }
-
- protected MinOptMax getAllocationIPD(int refIPD) {
- return getLeaderAllocIPD(node, refIPD);
- }
-
- /*protected void offsetArea(LayoutContext context) {
- if(leaderPattern == LeaderPattern.DOTS) {
- curArea.setOffset(context.getBaseline());
- }
- }*/
- };
- lm.setAlignment(node.getProperty(Constants.PR_LEADER_ALIGNMENT).getEnum());
- currentLMList.add(lm);
- }
-
- public MinOptMax getLeaderAllocIPD(Leader node, int ipd) {
- // length of the leader
- int opt = node.getLength(Constants.PR_LEADER_LENGTH | Constants.CP_OPTIMUM, ipd);
- int min = node.getLength(Constants.PR_LEADER_LENGTH | Constants.CP_MINIMUM, ipd);
- int max = node.getLength(Constants.PR_LEADER_LENGTH | Constants.CP_MAXIMUM, ipd);
-
- return new MinOptMax(min, opt, max);
- }
-
- private InlineArea getLeaderInlineArea(Leader node, LayoutManager parentLM) {
- InlineArea leaderArea = null;
-
- if (node.getLeaderPattern() == Constants.LeaderPattern.RULE) {
- org.apache.fop.area.inline.Leader leader = new org.apache.fop.area.inline.Leader();
- leader.setRuleStyle(node.getRuleStyle());
- leader.setRuleThickness(node.getRuleThickness());
- leaderArea = leader;
- } else if (node.getLeaderPattern() == Constants.LeaderPattern.SPACE) {
- leaderArea = new Space();
- } else if (node.getLeaderPattern() == Constants.LeaderPattern.DOTS) {
- TextArea t = new TextArea();
- char dot = '.'; // userAgent.getLeaderDotCharacter();
-
- t.setTextArea("" + dot);
- t.addTrait(Trait.FONT_NAME, node.getFontState().getFontName());
- t.addTrait(Trait.FONT_SIZE,
- new Integer(node.getFontState().getFontSize()));
- // set offset of dot within inline parent
- t.setOffset(node.getFontState().getAscender());
- int width = node.getFontState().getCharWidth(dot);
- Space spacer = null;
- if (node.getPatternWidth() > width) {
- spacer = new Space();
- spacer.setWidth(node.getPatternWidth() - width);
- width = node.getPatternWidth();
- }
- FilledArea fa = new FilledArea();
- fa.setUnitWidth(width);
- fa.addChild(t);
- if (spacer != null) {
- fa.addChild(spacer);
- }
- fa.setHeight(node.getFontState().getAscender());
-
- leaderArea = fa;
- } else if (node.getLeaderPattern() == Constants.LeaderPattern.USECONTENT) {
- if (node.getChildNodes() == null) {
- node.getLogger().error("Leader use-content with no content");
- return null;
- }
- InlineStackingLayoutManager lm;
- lm = new InlineStackingLayoutManager(node);
- lm.setLMiter(new LMiter(lm, node.getChildNodes()));
- lm.initialize();
-
- // get breaks then add areas to FilledArea
- FilledArea fa = new FilledArea();
-
- ContentLayoutManager clm = new ContentLayoutManager(fa);
- clm.setParent(parentLM);
- clm.setUserAgent(node.getUserAgent());
- lm.setParent(clm);
-
- clm.fillArea(lm);
- int width = clm.getStackingSize();
- Space spacer = null;
- if (node.getPatternWidth() > width) {
- spacer = new Space();
- spacer.setWidth(node.getPatternWidth() - width);
- width = node.getPatternWidth();
- }
- fa.setUnitWidth(width);
- if (spacer != null) {
- fa.addChild(spacer);
- }
- leaderArea = fa;
- }
- return leaderArea;
- }
}
--- /dev/null
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.layoutmgr;
+
+import org.apache.fop.area.Trait;
+import org.apache.fop.area.inline.FilledArea;
+import org.apache.fop.area.inline.InlineArea;
+import org.apache.fop.area.inline.Space;
+import org.apache.fop.area.inline.TextArea;
+import org.apache.fop.datatypes.Length;
+import org.apache.fop.fo.Constants;
+import org.apache.fop.fo.flow.Inline;
+import org.apache.fop.fo.flow.Leader;
+import org.apache.fop.fonts.Font;
+import org.apache.fop.traits.MinOptMax;
+
+/**
+ * LayoutManager for the fo:leader formatting object
+ */
+public class LeaderLayoutManager extends LeafNodeLayoutManager {
+
+ Leader ldrNode;
+ Font font = null;
+
+ /**
+ * Constructor
+ *
+ * @param node the formatting object that creates this area
+ * @todo better null checking of font object
+ */
+ public LeaderLayoutManager(Leader node) {
+ super(node);
+ ldrNode = node;
+ font = node.getFontState();
+ setAlignment(node.getProperty(PR_LEADER_ALIGNMENT).getEnum());
+ }
+
+ public InlineArea get(LayoutContext context) {
+ return getLeaderInlineArea();
+ }
+
+ protected MinOptMax getAllocationIPD(int refIPD) {
+ return getLeaderAllocIPD(refIPD);
+ }
+
+ private MinOptMax getLeaderAllocIPD(int ipd) {
+ // length of the leader
+ int opt = ldrNode.getLength(PR_LEADER_LENGTH | CP_OPTIMUM, ipd);
+ int min = ldrNode.getLength(PR_LEADER_LENGTH | CP_MINIMUM, ipd);
+ int max = ldrNode.getLength(PR_LEADER_LENGTH | CP_MAXIMUM, ipd);
+ return new MinOptMax(min, opt, max);
+ }
+
+ private InlineArea getLeaderInlineArea() {
+ InlineArea leaderArea = null;
+
+ if (ldrNode.getLeaderPattern() == LeaderPattern.RULE) {
+ org.apache.fop.area.inline.Leader leader =
+ new org.apache.fop.area.inline.Leader();
+ leader.setRuleStyle(ldrNode.getRuleStyle());
+ leader.setRuleThickness(ldrNode.getRuleThickness());
+ leaderArea = leader;
+ } else if (ldrNode.getLeaderPattern() == LeaderPattern.SPACE) {
+ leaderArea = new Space();
+ } else if (ldrNode.getLeaderPattern() == LeaderPattern.DOTS) {
+ TextArea t = new TextArea();
+ char dot = '.'; // userAgent.getLeaderDotCharacter();
+
+ t.setTextArea("" + dot);
+ t.addTrait(Trait.FONT_NAME, font.getFontName());
+ t.addTrait(Trait.FONT_SIZE, new Integer(font.getFontSize()));
+ // set offset of dot within inline parent
+ t.setOffset(font.getAscender());
+ int width = font.getCharWidth(dot);
+ Space spacer = null;
+ if (ldrNode.getPatternWidth() > width) {
+ spacer = new Space();
+ spacer.setWidth(ldrNode.getPatternWidth() - width);
+ width = ldrNode.getPatternWidth();
+ }
+ FilledArea fa = new FilledArea();
+ fa.setUnitWidth(width);
+ fa.addChild(t);
+ if (spacer != null) {
+ fa.addChild(spacer);
+ }
+ fa.setHeight(font.getAscender());
+
+ leaderArea = fa;
+ } else if (ldrNode.getLeaderPattern() == LeaderPattern.USECONTENT) {
+ if (ldrNode.getChildNodes() == null) {
+ ldrNode.getLogger().error("Leader use-content with no content");
+ return null;
+ }
+ InlineStackingLayoutManager lm;
+ lm = new InlineStackingLayoutManager(ldrNode);
+ lm.setLMiter(new LMiter(lm, ldrNode.getChildNodes()));
+ lm.initialize();
+
+ // get breaks then add areas to FilledArea
+ FilledArea fa = new FilledArea();
+
+ ContentLayoutManager clm = new ContentLayoutManager(fa);
+ clm.setParent(this);
+ clm.setUserAgent(ldrNode.getUserAgent());
+ lm.setParent(clm);
+
+ clm.fillArea(lm);
+ int width = clm.getStackingSize();
+ Space spacer = null;
+ if (ldrNode.getPatternWidth() > width) {
+ spacer = new Space();
+ spacer.setWidth(ldrNode.getPatternWidth() - width);
+ width = ldrNode.getPatternWidth();
+ }
+ fa.setUnitWidth(width);
+ if (spacer != null) {
+ fa.addChild(spacer);
+ }
+ leaderArea = fa;
+ }
+ return leaderArea;
+ }
+}
import org.apache.fop.fonts.Font;
/**
- * LayoutManager for the fo:basic-link formatting object
+ * LayoutManager for the fo:page-number-citation formatting object
*/
public class PageNumberCitationLayoutManager extends LeafNodeLayoutManager {
* Constructor
*
* @param node the formatting object that creates this area
- * @todo better null checking font
+ * @todo better null checking of font object
*/
public PageNumberCitationLayoutManager(PageNumberCitation node) {
super(node);