spepping 2004/12/22 00:54:11 Modified: src/java/org/apache/fop/fo/flow BidiOverride.java Inline.java Leader.java src/java/org/apache/fop/fo FObjMixed.java src/java/org/apache/fop/fo/pagination Title.java src/java/org/apache/fop/layoutmgr BidiLayoutManager.java InlineLayoutManager.java InlineStackingLayoutManager.java PageSequenceLayoutManager.java Added: src/java/org/apache/fop/fo/flow InlineLevel.java Log: Removed instances of InlineStackingLayoutManager. Created a new FO 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. Revision Changes Path 1.24 +2 -2 xml-fop/src/java/org/apache/fop/fo/flow/BidiOverride.java Index: BidiOverride.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/BidiOverride.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- BidiOverride.java 28 Oct 2004 10:00:21 -0000 1.23 +++ BidiOverride.java 22 Dec 2004 08:54:10 -0000 1.24 @@ -36,7 +36,7 @@ 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 @@ 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); 1.36 +3 -52 xml-fop/src/java/org/apache/fop/fo/flow/Inline.java Index: Inline.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Inline.java,v retrieving revision 1.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- Inline.java 13 Nov 2004 20:37:17 -0000 1.35 +++ Inline.java 22 Dec 2004 08:54:10 -0000 1.36 @@ -23,19 +23,12 @@ 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 @@ /** * 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 @@ 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 @@ * @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 @@ 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(); } @@ -172,34 +151,6 @@ } else { blockOrInlineItemFound = true; } - } - - /** - * 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; } /** 1.50 +3 -44 xml-fop/src/java/org/apache/fop/fo/flow/Leader.java Index: Leader.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Leader.java,v retrieving revision 1.49 retrieving revision 1.50 diff -u -r1.49 -r1.50 --- Leader.java 24 Nov 2004 21:07:29 -0000 1.49 +++ Leader.java 22 Dec 2004 08:54:10 -0000 1.50 @@ -22,16 +22,9 @@ 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 @@ * 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 @@ 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 @@ * @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 @@ 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 @@ 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. 1.1 xml-fop/src/java/org/apache/fop/fo/flow/InlineLevel.java Index: InlineLevel.java =================================================================== /* * 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: InlineLevel.java,v 1.1 2004/12/22 08:54:10 spepping Exp $ */ 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); } } } 1.44 +4 -8 xml-fop/src/java/org/apache/fop/fo/FObjMixed.java Index: FObjMixed.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FObjMixed.java,v retrieving revision 1.43 retrieving revision 1.44 diff -u -r1.43 -r1.44 --- FObjMixed.java 28 Oct 2004 10:00:19 -0000 1.43 +++ FObjMixed.java 22 Dec 2004 08:54:10 -0000 1.44 @@ -23,17 +23,17 @@ 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 @@ * @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 } } 1.31 +5 -25 xml-fop/src/java/org/apache/fop/fo/pagination/Title.java Index: Title.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/Title.java,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- Title.java 29 Oct 2004 11:19:37 -0000 1.30 +++ Title.java 22 Dec 2004 08:54:10 -0000 1.31 @@ -22,31 +22,18 @@ 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 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); } /** 1.8 +2 -2 xml-fop/src/java/org/apache/fop/layoutmgr/BidiLayoutManager.java Index: BidiLayoutManager.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/BidiLayoutManager.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- BidiLayoutManager.java 20 Oct 2004 13:41:06 -0000 1.7 +++ BidiLayoutManager.java 22 Dec 2004 08:54:10 -0000 1.8 @@ -34,7 +34,7 @@ private List children; - public BidiLayoutManager(BidiOverride node, InlineStackingLayoutManager cLM) { + public BidiLayoutManager(BidiOverride node, InlineLayoutManager cLM) { super(node); children = new ArrayList(); setFObj(node); 1.4 +8 -25 xml-fop/src/java/org/apache/fop/layoutmgr/InlineLayoutManager.java Index: InlineLayoutManager.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/InlineLayoutManager.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- InlineLayoutManager.java 13 Nov 2004 20:37:17 -0000 1.3 +++ InlineLayoutManager.java 22 Dec 2004 08:54:10 -0000 1.4 @@ -23,8 +23,7 @@ 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 @@ */ 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 @@ * * @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 @@ * @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); 1.19 +4 -3 xml-fop/src/java/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java Index: InlineStackingLayoutManager.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- InlineStackingLayoutManager.java 10 Dec 2004 10:12:21 -0000 1.18 +++ InlineStackingLayoutManager.java 22 Dec 2004 08:54:10 -0000 1.19 @@ -33,8 +33,9 @@ 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 @@ * * @param node the formatting object that creates the area */ - public InlineStackingLayoutManager(FObj node) { + protected InlineStackingLayoutManager(FObj node) { super(node); extraBPD = new MinOptMax(0); } 1.19 +3 -3 xml-fop/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java Index: PageSequenceLayoutManager.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- PageSequenceLayoutManager.java 16 Dec 2004 23:59:13 -0000 1.18 +++ PageSequenceLayoutManager.java 22 Dec 2004 08:54:10 -0000 1.19 @@ -177,8 +177,8 @@ // 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);
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]