]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Removed instances of InlineStackingLayoutManager. Created a new FO
authorSimon Pepping <spepping@apache.org>
Wed, 22 Dec 2004 08:54:10 +0000 (08:54 +0000)
committerSimon Pepping <spepping@apache.org>
Wed, 22 Dec 2004 08:54:10 +0000 (08:54 +0000)
node class, InlineLevel, a subclass of FObjMixed, a base class for
several inline-level FObj: Inline, Leader, Title. The
InlineLayoutManager constructor requires an FObj of this type.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198205 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/fo/FObjMixed.java
src/java/org/apache/fop/fo/flow/BidiOverride.java
src/java/org/apache/fop/fo/flow/Inline.java
src/java/org/apache/fop/fo/flow/InlineLevel.java [new file with mode: 0644]
src/java/org/apache/fop/fo/flow/Leader.java
src/java/org/apache/fop/fo/pagination/Title.java
src/java/org/apache/fop/layoutmgr/BidiLayoutManager.java
src/java/org/apache/fop/layoutmgr/InlineLayoutManager.java
src/java/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java
src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java

index 9cf9ccd70d6c4ba20843a5a7e7f8242c2c88ef69..9c338f4ca4b35ad2d7cf028f299e7c01f2baf2f2 100644 (file)
@@ -23,17 +23,17 @@ import java.util.List;
 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);
     }
 
@@ -66,11 +66,7 @@ public class FObjMixed extends FObj {
      * @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
     }
     
 }
index 5c156d7d41e7023799078c0679cec031b643a082..f7d6219ecd8f9cf36611a63ee09bc1260acd1929 100644 (file)
@@ -36,7 +36,7 @@ import org.apache.fop.fo.properties.CommonFont;
 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;
 
 /**
@@ -148,7 +148,7 @@ public class BidiOverride extends FObjMixed {
                 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);
index 9084d4ae908385b301a2171cb3933e7ca1294037..e39c2a8b6a81fe218468cf2cd4d0ed02d14dece0 100644 (file)
@@ -23,19 +23,12 @@ import java.util.List;
 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;
@@ -44,19 +37,14 @@ import org.apache.fop.layoutmgr.InlineLayoutManager;
 /**
  * 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;
@@ -64,10 +52,8 @@ public class Inline extends FObjMixed {
     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
@@ -87,17 +73,12 @@ public class Inline extends FObjMixed {
      * @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();
@@ -105,10 +86,8 @@ public class Inline extends FObjMixed {
         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();
     }
@@ -174,34 +153,6 @@ public class Inline extends FObjMixed {
         }
     }
 
-    /**
-     * 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.
      */
diff --git a/src/java/org/apache/fop/fo/flow/InlineLevel.java b/src/java/org/apache/fop/fo/flow/InlineLevel.java
new file mode 100644 (file)
index 0000000..5ce0a61
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ * 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);
+        }
+    }
+
+}
+
index 377a452b2b5ab2457ec6f8dd6b1b6bed9f428f04..3e245eec7e796ccc78546ed22ebb15b3177faf2b 100644 (file)
@@ -22,16 +22,9 @@ 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.fo.properties.CommonRelativePosition;
 import org.apache.fop.fo.properties.KeepProperty;
 import org.apache.fop.fo.properties.LengthRangeProperty;
@@ -44,19 +37,14 @@ import org.apache.fop.layoutmgr.LeaderLayoutManager;
  * 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;
@@ -70,9 +58,7 @@ public class Leader extends FObjMixed {
     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
 
@@ -87,17 +73,12 @@ public class Leader extends FObjMixed {
      * @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();
@@ -126,9 +107,7 @@ public class Leader extends FObjMixed {
             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();
     }
 
@@ -139,26 +118,6 @@ public class Leader extends FObjMixed {
         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.
index 0eb51e8d3d90c3744acc0b90817518c185405eda..b64a9beecb7c503645a0246501ea7099c24477eb 100644 (file)
@@ -22,31 +22,18 @@ package org.apache.fop.fo.pagination;
 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
 
     /**
@@ -57,14 +44,7 @@ public class Title extends FObjMixed {
     }
 
     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);
     }
 
     /**
index 39d9a2e9a6eef27a6a32ebf9634d0e3367356569..c20237ac2e0062256c45e2fd290ad8ea641fbde9 100644 (file)
@@ -34,7 +34,7 @@ public class BidiLayoutManager extends LeafNodeLayoutManager {
 
     private List children;
 
-    public BidiLayoutManager(BidiOverride node, InlineStackingLayoutManager cLM) {
+    public BidiLayoutManager(BidiOverride node, InlineLayoutManager cLM) {
         super(node);
         children = new ArrayList();
         setFObj(node);
index a3b8d403d2fd410669afd577d460c86e9b8cb97d..c2027067057b72451ac89496774773112676607b 100755 (executable)
@@ -23,8 +23,7 @@ import java.util.ListIterator;
 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;
@@ -37,7 +36,7 @@ import org.apache.fop.traits.SpaceVal;
  */
 public class InlineLayoutManager extends InlineStackingLayoutManager 
                                          implements InlineLevelLayoutManager {
-    private FObj fobj;
+    private InlineLevel fobj;
 
     private CommonMarginInline inlineProps = null;
     private CommonBorderPaddingBackground borderProps = null;
@@ -49,19 +48,8 @@ public class InlineLayoutManager extends InlineStackingLayoutManager
      *
      * @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;
     }
@@ -70,14 +58,9 @@ public class InlineLayoutManager extends InlineStackingLayoutManager
      * @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);
index 594e33cc23f08feeba89d9819210c25a23216c89..b3782629a40e98256a4a4e6a6dc64b39e839369c 100644 (file)
@@ -33,8 +33,9 @@ import org.apache.fop.area.inline.Space;
 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 {
 
@@ -85,7 +86,7 @@ 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);
     }
index 4af6295003104bdad147cd56d2a0313c510a39dd..74ceb07454fe02940b0a03bd2a30816d19be2400 100644 (file)
@@ -177,8 +177,8 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
 
         // 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);