import org.xml.sax.Locator;
import org.apache.fop.apps.FOPException;
-import org.apache.fop.layoutmgr.InlineStackingLayoutManager;
/**
* Base class for representation of mixed content formatting objects
- * (i.e., those that can contain both child FO's and text nodes/PCDATA)
+ * (i.e., those that can contain both child FO's and text nodes/PCDATA).
+ * It should not be instantiated directly.
*/
public class FObjMixed extends FObj {
/**
* @param parent FONode that is the parent of this object
*/
- public FObjMixed(FONode parent) {
+ protected FObjMixed(FONode parent) {
super(parent);
}
* @see org.apache.fop.fo.FONode#addLayoutManager(List)
*/
public void addLayoutManager(List list) {
- if (getChildNodes() != null) {
- InlineStackingLayoutManager lm;
- lm = new InlineStackingLayoutManager(this);
- list.add(lm);
- }
+ // no layout manager
}
}
import org.apache.fop.fo.properties.CommonRelativePosition;
import org.apache.fop.fo.properties.SpaceProperty;
import org.apache.fop.layoutmgr.BidiLayoutManager;
-import org.apache.fop.layoutmgr.InlineStackingLayoutManager;
+import org.apache.fop.layoutmgr.InlineLayoutManager;
import org.apache.fop.layoutmgr.LayoutManager;
/**
LayoutManager lm = (LayoutManager) childList.get(count);
if (lm.generatesInlineAreas()) {
LayoutManager blm = new BidiLayoutManager(this,
- (InlineStackingLayoutManager) lm);
+ (InlineLayoutManager) lm);
list.add(blm);
} else {
list.add(lm);
import org.xml.sax.Locator;
import org.apache.fop.apps.FOPException;
-import org.apache.fop.datatypes.ColorType;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.CharIterator;
import org.apache.fop.fo.FONode;
-import org.apache.fop.fo.FObjMixed;
import org.apache.fop.fo.InlineCharIterator;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
-import org.apache.fop.fo.properties.CommonAccessibility;
-import org.apache.fop.fo.properties.CommonAural;
-import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
-import org.apache.fop.fo.properties.CommonFont;
-import org.apache.fop.fo.properties.CommonMarginInline;
import org.apache.fop.fo.properties.CommonRelativePosition;
import org.apache.fop.fo.properties.KeepProperty;
import org.apache.fop.fo.properties.LengthRangeProperty;
/**
* Class modelling the fo:inline formatting object.
*/
-public class Inline extends FObjMixed {
+public class Inline extends InlineLevel {
// The value of properties relevant for fo:inline.
- private CommonAccessibility commonAccessibility;
- private CommonAural commonAural;
- private CommonBorderPaddingBackground commonBorderPaddingBackground;
- private CommonFont commonFont;
- private CommonMarginInline commonMarginInline;
+ // See also superclass InlineLevel
private CommonRelativePosition commonRelativePosition;
private Length alignmentAdjust;
private int alignmentBaseline;
private Length baselineShift;
private LengthRangeProperty blockProgressionDimension;
- private ColorType color;
private int dominantBaseline;
private Length height;
private String id;
private KeepProperty keepTogether;
private KeepProperty keepWithNext;
private KeepProperty keepWithPrevious;
- private Length lineHeight;
private int textDecoration;
private int verticalAlign;
- private int visibility;
private Length width;
private int wrapOption;
// End of property values
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
public void bind(PropertyList pList) throws FOPException {
- commonAccessibility = pList.getAccessibilityProps();
- commonAural = pList.getAuralProps();
- commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
- commonFont = pList.getFontProps();
- commonMarginInline = pList.getMarginInlineProps();
+ super.bind(pList);
commonRelativePosition = pList.getRelativePositionProps();
alignmentAdjust = pList.get(PR_ALIGNMENT_ADJUST).getLength();
alignmentBaseline = pList.get(PR_ALIGNMENT_BASELINE).getEnum();
baselineShift = pList.get(PR_BASELINE_SHIFT).getLength();
blockProgressionDimension = pList.get(PR_BLOCK_PROGRESSION_DIMENSION).getLengthRange();
- color = pList.get(PR_COLOR).getColorType();
dominantBaseline = pList.get(PR_DOMINANT_BASELINE).getEnum();
height = pList.get(PR_HEIGHT).getLength();
id = pList.get(PR_ID).getString();
keepTogether = pList.get(PR_KEEP_TOGETHER).getKeep();
keepWithNext = pList.get(PR_KEEP_WITH_NEXT).getKeep();
keepWithPrevious = pList.get(PR_KEEP_WITH_PREVIOUS).getKeep();
- lineHeight = pList.get(PR_LINE_HEIGHT).getLength();
textDecoration = pList.get(PR_TEXT_DECORATION).getEnum();
verticalAlign = pList.get(PR_VERTICAL_ALIGN).getEnum();
- visibility = pList.get(PR_VISIBILITY).getEnum();
width = pList.get(PR_WIDTH).getLength();
wrapOption = pList.get(PR_WRAP_OPTION).getEnum();
}
}
}
- /**
- * Return the Common Margin Properties-Inline.
- */
- public CommonMarginInline getCommonMarginInline() {
- return commonMarginInline;
- }
-
- /**
- * Return the Common Border, Padding, and Background Properties.
- */
- public CommonBorderPaddingBackground getCommonBorderPaddingBackground() {
- return commonBorderPaddingBackground;
- }
-
- /**
- * Return the Common Font Properties.
- */
- public CommonFont getCommonFont() {
- return commonFont;
- }
-
- /**
- * Return the "color" property.
- */
- public ColorType getColor() {
- return color;
- }
-
/**
* Return the "id" property.
*/
--- /dev/null
+/*
+ * Copyright 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.fo.flow;
+
+import java.util.List;
+
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.datatypes.ColorType;
+import org.apache.fop.datatypes.Length;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.FObjMixed;
+import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.properties.CommonAccessibility;
+import org.apache.fop.fo.properties.CommonAural;
+import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
+import org.apache.fop.fo.properties.CommonFont;
+import org.apache.fop.fo.properties.CommonMarginInline;
+import org.apache.fop.layoutmgr.InlineLayoutManager;
+
+/**
+ * Class modelling the commonalities of several inline-level
+ * formatting objects. It should not be instantiated directly.
+ */
+public class InlineLevel extends FObjMixed {
+ protected CommonBorderPaddingBackground commonBorderPaddingBackground;
+ protected CommonAccessibility commonAccessibility;
+ protected CommonMarginInline commonMarginInline;
+ protected CommonAural commonAural;
+ protected CommonFont commonFont;
+ protected ColorType color;
+ protected Length lineHeight;
+ protected int visibility;
+ // End of property values
+
+ /**
+ * @param parent FONode that is the parent of this object
+ */
+ protected InlineLevel(FONode parent) {
+ super(parent);
+ }
+
+ /**
+ * @see org.apache.fop.fo.FObj#bind(PropertyList)
+ */
+ public void bind(PropertyList pList) throws FOPException {
+ commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
+ commonAccessibility = pList.getAccessibilityProps();
+ commonMarginInline = pList.getMarginInlineProps();
+ commonAural = pList.getAuralProps();
+ commonFont = pList.getFontProps();
+ color = pList.get(PR_COLOR).getColorType();
+ lineHeight = pList.get(PR_LINE_HEIGHT).getLength();
+ visibility = pList.get(PR_VISIBILITY).getEnum();
+ }
+
+ /**
+ * Return the Common Margin Properties-Inline.
+ */
+ public CommonMarginInline getCommonMarginInline() {
+ return commonMarginInline;
+ }
+
+ /**
+ * Return the Common Border, Padding, and Background Properties.
+ */
+ public CommonBorderPaddingBackground getCommonBorderPaddingBackground() {
+ return commonBorderPaddingBackground;
+ }
+
+ /**
+ * Return the Common Font Properties.
+ */
+ public CommonFont getCommonFont() {
+ return commonFont;
+ }
+
+ /**
+ * Return the "color" property.
+ */
+ public ColorType getColor() {
+ return color;
+ }
+
+ /**
+ * @see org.apache.fop.fo.FONode#addLayoutManager(List)
+ */
+ public void addLayoutManager(List list) {
+ if (getChildNodes() != null) {
+ InlineLayoutManager lm;
+ lm = new InlineLayoutManager(this);
+ list.add(lm);
+ }
+ }
+
+}
+
import java.util.List;
import org.apache.fop.apps.FOPException;
-import org.apache.fop.datatypes.ColorType;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
-import org.apache.fop.fo.FObjMixed;
import org.apache.fop.fo.PropertyList;
-import org.apache.fop.fo.properties.CommonAccessibility;
-import org.apache.fop.fo.properties.CommonAural;
-import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
-import org.apache.fop.fo.properties.CommonFont;
-import org.apache.fop.fo.properties.CommonMarginInline;
import org.apache.fop.fo.properties.CommonRelativePosition;
import org.apache.fop.fo.properties.KeepProperty;
import org.apache.fop.fo.properties.LengthRangeProperty;
* The following patterns are treated: rule, space, dots and use-content.
* @todo implement validateChildNode()
*/
-public class Leader extends FObjMixed {
+public class Leader extends InlineLevel {
// The value of properties relevant for fo:leader.
- private CommonAccessibility commonAccessibility;
- private CommonAural commonAural;
- private CommonBorderPaddingBackground commonBorderPaddingBackground;
- private CommonFont commonFont;
- private CommonMarginInline commonMarginInline;
+ // See also superclass InlineLevel
private CommonRelativePosition commonRelativePosition;
private Length alignmentAdjust;
private int alignmentBaseline;
private int verticalAlign;
private Length baselineShift;
- private ColorType color;
private int dominantBaseline;
private Length textDepth;
private Length textAltitude;
private int ruleStyle;
private Length ruleThickness;
// private ToBeImplementedProperty letterSpacing;
- private Length lineHeight;
// private ToBeImplementedProperty textShadow;
- private int visibility;
private SpaceProperty wordSpacing;
// End of property values
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
public void bind(PropertyList pList) throws FOPException {
- commonAccessibility = pList.getAccessibilityProps();
- commonAural = pList.getAuralProps();
- commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
- commonFont = pList.getFontProps();
- commonMarginInline = pList.getMarginInlineProps();
+ super.bind(pList);
commonRelativePosition = pList.getRelativePositionProps();
alignmentAdjust = pList.get(PR_ALIGNMENT_ADJUST).getLength();
alignmentBaseline = pList.get(PR_ALIGNMENT_BASELINE).getEnum();
verticalAlign = pList.get(PR_VERTICAL_ALIGN).getEnum();
baselineShift = pList.get(PR_BASELINE_SHIFT).getLength();
- color = pList.get(PR_COLOR).getColorType();
dominantBaseline = pList.get(PR_DOMINANT_BASELINE).getEnum();
textDepth = pList.get(PR_TEXT_DEPTH).getLength();
textAltitude = pList.get(PR_TEXT_ALTITUDE).getLength();
break;
}
// letterSpacing = pList.get(PR_LETTER_SPACING);
- lineHeight = pList.get(PR_LINE_HEIGHT).getLength();
// textShadow = pList.get(PR_TEXT_SHADOW);
- visibility = pList.get(PR_VISIBILITY).getEnum();
wordSpacing = pList.get(PR_WORD_SPACING).getSpace();
}
checkId(id);
}
- /**
- * Return the Common Margin Properties-Inline.
- */
- public CommonMarginInline getCommonMarginInline() {
- return commonMarginInline;
- }
-
- /**
- * Return the Common Border, Padding, and Background Properties.
- */
- public CommonBorderPaddingBackground getCommonBorderPaddingBackground() {
- return commonBorderPaddingBackground;
- }
-
- /**
- * Return the Common Font Properties.
- */
- public CommonFont getCommonFont() {
- return commonFont;
- }
/**
* Return the "id" property.
import org.xml.sax.Locator;
import org.apache.fop.apps.FOPException;
-import org.apache.fop.datatypes.ColorType;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
-import org.apache.fop.fo.FObjMixed;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
-import org.apache.fop.fo.properties.CommonAccessibility;
-import org.apache.fop.fo.properties.CommonAural;
-import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
-import org.apache.fop.fo.properties.CommonFont;
-import org.apache.fop.fo.properties.CommonMarginInline;
+import org.apache.fop.fo.flow.InlineLevel;
/**
* Class modelling the fo:title object.
*/
-public class Title extends FObjMixed {
+public class Title extends InlineLevel {
// The value of properties relevant for fo:title.
- private CommonAccessibility commonAccessibility;
- private CommonAural commonAural;
- private CommonBorderPaddingBackground commonBorderPaddingBackground;
- private CommonFont commonFont;
- private CommonMarginInline commonMarginInline;
- private ColorType color;
- private Length lineHeight;
- private int visibility;
+ // See also superclass InlineLevel
// End of property values
/**
}
public void bind(PropertyList pList) throws FOPException {
- commonAccessibility = pList.getAccessibilityProps();
- commonAural = pList.getAuralProps();
- commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
- commonFont = pList.getFontProps();
- commonMarginInline = pList.getMarginInlineProps();
- color = pList.get(PR_COLOR).getColorType();
- lineHeight = pList.get(PR_LINE_HEIGHT).getLength();
- visibility = pList.get(PR_VISIBILITY).getEnum();
+ super.bind(pList);
}
/**
private List children;
- public BidiLayoutManager(BidiOverride node, InlineStackingLayoutManager cLM) {
+ public BidiLayoutManager(BidiOverride node, InlineLayoutManager cLM) {
super(node);
children = new ArrayList();
setFObj(node);
import java.util.LinkedList;
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.InlineLevel;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
import org.apache.fop.fo.properties.CommonMarginInline;
import org.apache.fop.fo.properties.SpaceProperty;
*/
public class InlineLayoutManager extends InlineStackingLayoutManager
implements InlineLevelLayoutManager {
- private FObj fobj;
+ private InlineLevel fobj;
private CommonMarginInline inlineProps = null;
private CommonBorderPaddingBackground borderProps = null;
*
* @param node the formatting object that creates the area
*/
- public InlineLayoutManager(Inline node) {
- super(node);
- fobj = node;
- }
-
- /**
- * Create an inline layout manager.
- * This is used for fo's that create areas that
- * contain inline areas.
- *
- * @param node the formatting object that creates the area
- */
- public InlineLayoutManager(Leader node) {
+ // The node should be FObjMixed
+ public InlineLayoutManager(InlineLevel node) {
super(node);
fobj = node;
}
* @see org.apache.fop.layoutmgr.AbstractLayoutManager#initProperties()
*/
protected void initProperties() {
- // fobj can be either an Inline or a Leader
- if (fobj instanceof Inline) {
- inlineProps = ((Inline) fobj).getCommonMarginInline();
- borderProps = ((Inline) fobj).getCommonBorderPaddingBackground();
- } else {
- inlineProps = ((Leader) fobj).getCommonMarginInline();
- borderProps = ((Leader) fobj).getCommonBorderPaddingBackground();
- }
+ inlineProps = fobj.getCommonMarginInline();
+ borderProps = fobj.getCommonBorderPaddingBackground();
+
int iPad = borderProps.getPadding(CommonBorderPaddingBackground.BEFORE, false);
iPad += borderProps.getBorderWidth(CommonBorderPaddingBackground.BEFORE,
false);
import org.apache.fop.traits.MinOptMax;
/**
- * LayoutManager for objects which stack children in the inline direction,
- * such as Inline or Line
+ * Class modelling the commonalities of layoutmanagers for objects
+ * which stack children in the inline direction, such as Inline or
+ * Line. It should not be instantiated directly.
*/
public class InlineStackingLayoutManager extends AbstractLayoutManager {
*
* @param node the formatting object that creates the area
*/
- public InlineStackingLayoutManager(FObj node) {
+ protected InlineStackingLayoutManager(FObj node) {
super(node);
extraBPD = new MinOptMax(0);
}
// use special layout manager to add the inline areas
// to the Title.
- InlineStackingLayoutManager lm;
- lm = new InlineStackingLayoutManager(foTitle);
+ InlineLayoutManager lm;
+ lm = new InlineLayoutManager(foTitle);
clm.addChildLM(lm);
clm.fillArea(lm);