diff options
author | William Victor Mote <vmote@apache.org> | 2003-08-24 19:22:59 +0000 |
---|---|---|
committer | William Victor Mote <vmote@apache.org> | 2003-08-24 19:22:59 +0000 |
commit | d1fbbb88d11183344ab8d658f6b29b7cfda0d06d (patch) | |
tree | 018d4713d5b0284b956e3f16d5dd0a07649de7ec /src/java | |
parent | efffa4ddf06da014d41b8cc893d5fcfc7ba45584 (diff) | |
download | xmlgraphics-fop-d1fbbb88d11183344ab8d658f6b29b7cfda0d06d.tar.gz xmlgraphics-fop-d1fbbb88d11183344ab8d658f6b29b7cfda0d06d.zip |
move fo/flow/ExternalGraphic.getInlineArea() to layoutmgr/AddLMVisitor.getExternalGraphicInlineArea()
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196834 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r-- | src/java/org/apache/fop/fo/flow/ExternalGraphic.java | 50 | ||||
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/AddLMVisitor.java | 34 |
2 files changed, 49 insertions, 35 deletions
diff --git a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java b/src/java/org/apache/fop/fo/flow/ExternalGraphic.java index f5d5740d0..5fb3f8c31 100644 --- a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java +++ b/src/java/org/apache/fop/fo/flow/ExternalGraphic.java @@ -54,8 +54,6 @@ package org.apache.fop.fo.flow; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; import org.apache.fop.fo.FOTreeVisitor; -import org.apache.fop.fo.properties.CommonBorderAndPadding; -import org.apache.fop.fo.properties.CommonBackground; import org.apache.fop.fo.properties.TextAlign; import org.apache.fop.fo.properties.Overflow; import org.apache.fop.fo.properties.DisplayAlign; @@ -63,9 +61,6 @@ import org.apache.fop.fo.properties.Scaling; import org.apache.fop.image.ImageFactory; import org.apache.fop.image.FopImage; import org.apache.fop.area.inline.InlineArea; -import org.apache.fop.layoutmgr.TraitSetter; -import org.apache.fop.area.inline.Image; -import org.apache.fop.area.inline.Viewport; import org.apache.fop.datatypes.Length; // Java @@ -101,34 +96,6 @@ public class ExternalGraphic extends FObj { } /** - * Get the inline area for this external grpahic. - * This creates the image area and puts it inside a viewport. - * - * @return the viewport containing the image area - */ - public InlineArea getInlineArea() { - setup(); - if (url == null) { - return null; - } - Image imArea = new Image(url); - Viewport vp = new Viewport(imArea); - vp.setWidth(viewWidth); - vp.setHeight(viewHeight); - vp.setClip(clip); - vp.setContentPosition(placement); - vp.setOffset(0); - - // Common Border, Padding, and Background Properties - CommonBorderAndPadding bap = propMgr.getBorderAndPadding(); - CommonBackground bProps = propMgr.getBackgroundProps(); - TraitSetter.addBorders(vp, bap); - TraitSetter.addBackground(vp, bProps); - - return vp; - } - - /** * Setup this image. * This gets the sizes for the image and the dimensions and clipping. */ @@ -286,5 +253,20 @@ public class ExternalGraphic extends FObj { fotv.serveVisitor(this); } -} + public String getURL() { + return url; + } + public int getViewWidth() { + return viewWidth; + } + + public boolean getClip() { + return clip; + } + + public Rectangle2D getPlacement() { + return placement; + } + +} diff --git a/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java b/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java index 85f72ee1b..abd590ea0 100644 --- a/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java +++ b/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java @@ -60,6 +60,8 @@ import org.apache.fop.area.inline.InlineParent; import org.apache.fop.area.inline.FilledArea; import org.apache.fop.area.inline.Space; import org.apache.fop.area.inline.Word; +import org.apache.fop.area.inline.Image; +import org.apache.fop.area.inline.Viewport; import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.FObj; @@ -89,6 +91,8 @@ import org.apache.fop.fo.flow.TableRow; import org.apache.fop.fo.pagination.Flow; import org.apache.fop.fo.properties.LeaderPattern; +import org.apache.fop.fo.properties.CommonBorderAndPadding; +import org.apache.fop.fo.properties.CommonBackground; import org.apache.fop.layoutmgr.BidiLayoutManager; import org.apache.fop.layoutmgr.LayoutProcessor; @@ -396,7 +400,7 @@ public class AddLMVisitor extends FOTreeVisitor { * created viewport/image area. */ public void serveVisitor(ExternalGraphic node) { - InlineArea area = node.getInlineArea(); + InlineArea area = getExternalGraphicInlineArea(node); if (area != null) { node.setupID(); LeafNodeLayoutManager lm = new LeafNodeLayoutManager(); @@ -409,6 +413,34 @@ public class AddLMVisitor extends FOTreeVisitor { } } + /** + * Get the inline area for this external grpahic. + * This creates the image area and puts it inside a viewport. + * + * @return the viewport containing the image area + */ + public InlineArea getExternalGraphicInlineArea(ExternalGraphic node) { + node.setup(); + if (node.getURL() == null) { + return null; + } + Image imArea = new Image(node.getURL()); + Viewport vp = new Viewport(imArea); + vp.setWidth(node.getViewWidth()); + vp.setHeight(node.getViewHeight()); + vp.setClip(node.getClip()); + vp.setContentPosition(node.getPlacement()); + vp.setOffset(0); + + // Common Border, Padding, and Background Properties + CommonBorderAndPadding bap = node.getPropertyManager().getBorderAndPadding(); + CommonBackground bProps = node.getPropertyManager().getBackgroundProps(); + TraitSetter.addBorders(vp, bap); + TraitSetter.addBackground(vp, bProps); + + return vp; + } + public void serveVisitor(BlockContainer node) { BlockContainerLayoutManager blm = new BlockContainerLayoutManager(); blm.setUserAgent(node.getUserAgent()); |