diff options
author | Maximilian Berger <maxberger@apache.org> | 2008-06-14 22:20:42 +0000 |
---|---|---|
committer | Maximilian Berger <maxberger@apache.org> | 2008-06-14 22:20:42 +0000 |
commit | 2ad567b2f6e4f9f5db847c11742ddf8ca331db83 (patch) | |
tree | 196ee70827e48609930bb69c506d10705b3becbd /src/java/org | |
parent | caab9b0408a6ad1734f1996673fad20caf53423f (diff) | |
download | xmlgraphics-fop-2ad567b2f6e4f9f5db847c11742ddf8ca331db83.tar.gz xmlgraphics-fop-2ad567b2f6e4f9f5db847c11742ddf8ca331db83.zip |
removed double storage of 'fobj'
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@667893 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org')
3 files changed, 20 insertions, 38 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java index e90927699..76002da2f 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java @@ -39,16 +39,14 @@ import org.apache.fop.layoutmgr.TraitSetter; */ public abstract class AbstractGraphicsLayoutManager extends LeafNodeLayoutManager { - /** The graphics object this LM deals with */ - protected AbstractGraphics fobj; - /** - * Constructor - * @param node the formatting object that creates this area + * Constructor. + * + * @param node + * the formatting object that creates this area */ public AbstractGraphicsLayoutManager(AbstractGraphics node) { super(node); - fobj = node; } /** @@ -57,6 +55,7 @@ public abstract class AbstractGraphicsLayoutManager extends LeafNodeLayoutManage * @return the viewport inline area */ private Viewport getInlineArea() { + final AbstractGraphics fobj = (AbstractGraphics)this.fobj; Dimension intrinsicSize = new Dimension( fobj.getIntrinsicWidth(), fobj.getIntrinsicHeight()); @@ -113,6 +112,7 @@ public abstract class AbstractGraphicsLayoutManager extends LeafNodeLayoutManage /** {@inheritDoc} */ protected AlignmentContext makeAlignmentContext(LayoutContext context) { + final AbstractGraphics fobj = (AbstractGraphics)this.fobj; return new AlignmentContext( get(context).getAllocBPD() , fobj.getAlignmentAdjust() @@ -128,7 +128,7 @@ public abstract class AbstractGraphicsLayoutManager extends LeafNodeLayoutManage * the viewport. * @return the appropriate area */ - abstract Area getChildArea(); + protected abstract Area getChildArea(); // --------- Property Resolution related functions --------- // @@ -138,31 +138,14 @@ public abstract class AbstractGraphicsLayoutManager extends LeafNodeLayoutManage public int getBaseLength(int lengthBase, FObj fobj) { switch (lengthBase) { case LengthBase.IMAGE_INTRINSIC_WIDTH: - return getIntrinsicWidth(); + return ((AbstractGraphics)fobj).getIntrinsicWidth(); case LengthBase.IMAGE_INTRINSIC_HEIGHT: - return getIntrinsicHeight(); + return ((AbstractGraphics)fobj).getIntrinsicHeight(); case LengthBase.ALIGNMENT_ADJUST: return get(null).getBPD(); default: // Delegate to super class return super.getBaseLength(lengthBase, fobj); } } - - /** - * Returns the intrinsic width of the e-g. - * @return the width of the element - */ - protected int getIntrinsicWidth() { - return fobj.getIntrinsicWidth(); - } - - /** - * Returns the intrinsic height of the e-g. - * @return the height of the element - */ - protected int getIntrinsicHeight() { - return fobj.getIntrinsicHeight(); - } - } diff --git a/src/java/org/apache/fop/layoutmgr/inline/ExternalGraphicLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/ExternalGraphicLayoutManager.java index ab05d60c3..d7bff5a5c 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/ExternalGraphicLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/ExternalGraphicLayoutManager.java @@ -29,20 +29,20 @@ import org.apache.fop.fo.flow.ExternalGraphic; */ public class ExternalGraphicLayoutManager extends AbstractGraphicsLayoutManager { - private ExternalGraphic fobj; - /** - * Constructor - * @param node the fo:external-graphic formatting object that creates the area + * Constructor. + * + * @param node + * the fo:external-graphic formatting object that creates the + * area */ public ExternalGraphicLayoutManager(ExternalGraphic node) { super(node); - fobj = node; } /** {@inheritDoc} */ protected Area getChildArea() { - return new Image(fobj.getSrc()); + return new Image(((ExternalGraphic) fobj).getSrc()); } } diff --git a/src/java/org/apache/fop/layoutmgr/inline/InstreamForeignObjectLM.java b/src/java/org/apache/fop/layoutmgr/inline/InstreamForeignObjectLM.java index e7da50a9a..5f9365f83 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/InstreamForeignObjectLM.java +++ b/src/java/org/apache/fop/layoutmgr/inline/InstreamForeignObjectLM.java @@ -29,20 +29,19 @@ import org.apache.fop.fo.flow.InstreamForeignObject; */ public class InstreamForeignObjectLM extends AbstractGraphicsLayoutManager { - private InstreamForeignObject fobj; - /** - * Constructor - * @param node the formatting object that creates this area + * Constructor. + * + * @param node + * the formatting object that creates this area */ public InstreamForeignObjectLM(InstreamForeignObject node) { super(node); - fobj = node; } /** {@inheritDoc} */ protected Area getChildArea() { - XMLObj child = (XMLObj) fobj.getChildXMLObj(); + XMLObj child = ((InstreamForeignObject) fobj).getChildXMLObj(); org.w3c.dom.Document doc = child.getDOMDocument(); String ns = child.getNamespaceURI(); |