if (parent != null && parent instanceof FObj) {
if (((FObj)parent).getIsOutOfLineFODescendant() == true) {
isOutOfLineFODescendant = true;
- } else if ("fo:float".equals(getName())
- || "fo:footnote".equals(getName())
- || "fo:footnote-body".equals(getName())) {
- isOutOfLineFODescendant = true;
+ } else {
+ int foID = getNameId();
+ if (foID == FO_FLOAT || foID == FO_FOOTNOTE
+ || foID == FO_FOOTNOTE_BODY) {
+ isOutOfLineFODescendant = true;
+ }
}
}
PropertyList parentPL = null;
if (parentFO != null) {
- parentPL = parentFO.getPropertiesForNamespace(FOElementMapping.URI);
+ parentPL = parentFO.getPropertiesForNamespace(FO_URI);
}
- propertyList = new PropertyList(this, parentPL, FOElementMapping.URI);
+ propertyList = new PropertyList(this, parentPL, FO_URI);
propertyList.addAttributesToList(attlist);
propMgr = new PropertyManager(propertyList);
setWritingMode();
* @return true if a member, false if not
*/
protected boolean isBlockItem(String nsURI, String lName) {
- return (nsURI == FOElementMapping.URI &&
+ return (nsURI == FO_URI &&
(lName.equals("block")
|| lName.equals("table")
|| lName.equals("table-and-caption")
* @return true if a member, false if not
*/
protected boolean isInlineItem(String nsURI, String lName) {
- return (nsURI == FOElementMapping.URI &&
+ return (nsURI == FO_URI &&
(lName.equals("bidi-override")
|| lName.equals("character")
|| lName.equals("external-graphic")
* @return true if a member, false if not
*/
protected boolean isNeutralItem(String nsURI, String lName) {
- return (nsURI == FOElementMapping.URI &&
+ return (nsURI == FO_URI &&
(lName.equals("multi-switch")
|| lName.equals("multi-properties")
|| lName.equals("wrapper")
package org.apache.fop.fo.flow;
+// Java
+import java.util.List;
+
// XML
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.OneCharIterator;
-import org.apache.fop.layoutmgr.AddLMVisitor;
-import org.apache.fop.fo.LMVisited;
+import org.apache.fop.layoutmgr.CharacterLayoutManager;
/**
* This class represents the flow object 'fo:character'. Its use is defined by
* Overrides may be specified in an implementation-specific manner." (6.6.3)
*
*/
-public class Character extends FObj implements LMVisited {
+public class Character extends FObj {
/** constant indicating that the character is OK */
public static final int OK = 0;
}
/**
- * 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) {
- aLMV.serveCharacter(this);
+ public void addLayoutManager(List list) {
+ String str = getProperty(PR_CHARACTER).getString();
+ if (str.length() == 1) {
+ CharacterLayoutManager lm = new CharacterLayoutManager(this);
+ list.add(lm);
+ }
}
/**
// XML
import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
+import org.xml.sax.Locator;
import org.xml.sax.SAXParseException;
// FOP
import org.apache.fop.fo.FObj;
/**
- * Class modelling the fo:footnote-body object. See Sec. 6.10.4 of the XSL-FO
- * Standard.
+ * Class modelling the fo:footnote-body object.
*/
public class FootnoteBody extends FObj {
- private int align;
- private int alignLast;
- private int lineHeight;
- private int startIndent;
- private int endIndent;
- private int textIndent;
-
/**
* @param parent FONode that is the parent of this object
*/
getFOInputHandler().startFootnoteBody(this);
}
+ /**
+ * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
+ * XSL Content Model: (%block;)+
+ */
+ protected void validateChildNode(Locator loc, String nsURI, String localName)
+ throws SAXParseException {
+ if (!isBlockItem(nsURI, localName)) {
+ invalidChildError(loc, nsURI, localName);
+ }
+ }
+
+ /**
+ * Make sure content model satisfied, if so then tell the
+ * StructureRenderer that we are at the end of the flow.
+ * @see org.apache.fop.fo.FONode#end
+ */
protected void endOfNode() throws SAXParseException {
- super.endOfNode();
+ if (childNodes == null) {
+ missingChildElementError("(%block;)+");
+ }
getFOInputHandler().endFootnoteBody(this);
}
-
+
+ /**
+ * @see org.apache.fop.fo.FObj#getName()
+ */
public String getName() {
return "fo:footnote-body";
}
import org.apache.fop.area.Trait;
import org.apache.fop.area.inline.FilledArea;
import org.apache.fop.area.inline.ForeignObject;
-import org.apache.fop.area.inline.Image;
import org.apache.fop.area.inline.InlineArea;
-import org.apache.fop.area.inline.InlineParent;
import org.apache.fop.area.inline.Space;
import org.apache.fop.area.inline.Viewport;
import org.apache.fop.area.inline.TextArea;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.XMLObj;
import org.apache.fop.fo.flow.Block;
-import org.apache.fop.fo.flow.Character;
import org.apache.fop.fo.flow.Inline;
import org.apache.fop.fo.flow.InstreamForeignObject;
import org.apache.fop.fo.flow.Leader;
return leaderArea;
}
- public void serveCharacter(Character node) {
- InlineArea inline = getCharacterInlineArea(node);
- if (inline != null) {
- LeafNodeLayoutManager lm = new LeafNodeLayoutManager(node);
- lm.setCurrentArea(inline);
- currentLMList.add(lm);
- }
- }
-
- public InlineArea getCharacterInlineArea(Character node) {
- String str = node.getProperty(Constants.PR_CHARACTER).getString();
- if (str.length() == 1) {
- org.apache.fop.area.inline.Character ch =
- new org.apache.fop.area.inline.Character(
- str.charAt(0));
- return ch;
- }
- return null;
- }
-
public void serveInstreamForeignObject(InstreamForeignObject node) {
Viewport areaCurrent = getInstreamForeignObjectInlineArea(node);
if (areaCurrent != null) {
--- /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.fo.flow.Character;
+import org.apache.fop.area.inline.InlineArea;
+
+/**
+ * LayoutManager for the fo:character formatting object
+ */
+public class CharacterLayoutManager extends LeafNodeLayoutManager {
+
+ /**
+ * Constructor
+ *
+ * @param node the fo:character formatting object
+ * @todo better null checking of node
+ */
+ public CharacterLayoutManager(Character node) {
+ super(node);
+ InlineArea inline = getCharacterInlineArea(node);
+ setCurrentArea(inline);
+ }
+
+ private InlineArea getCharacterInlineArea(Character node) {
+ String str = node.getProperty(Character.PR_CHARACTER).getString();
+ org.apache.fop.area.inline.Character ch =
+ new org.apache.fop.area.inline.Character(str.charAt(0));
+ return ch;
+ }
+}
+