]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
move fo/flow/ExternalGraphic.getInlineArea() to layoutmgr/AddLMVisitor.getExternalGra...
authorWilliam Victor Mote <vmote@apache.org>
Sun, 24 Aug 2003 19:22:59 +0000 (19:22 +0000)
committerWilliam Victor Mote <vmote@apache.org>
Sun, 24 Aug 2003 19:22:59 +0000 (19:22 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196834 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/fo/flow/ExternalGraphic.java
src/java/org/apache/fop/layoutmgr/AddLMVisitor.java

index f5d5740d071a7ec55951c587eb54e33cddfa69d2..5fb3f8c319912b2b26e789d12e4d923728c9512b 100644 (file)
@@ -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
@@ -100,34 +95,6 @@ public class ExternalGraphic extends FObj {
         super(parent);
     }
 
-    /**
-     * 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;
+    }
+
+}
index 85f72ee1b4c8d937d5f4bc51a078cfcc57e12a7c..abd590ea02b627bbf74b187aee6d318e3b7144a4 100644 (file)
@@ -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());