vmote 2003/08/24 12:22:59
Modified: src/java/org/apache/fop/fo/flow ExternalGraphic.java
src/java/org/apache/fop/layoutmgr AddLMVisitor.java
Log:
move fo/flow/ExternalGraphic.getInlineArea() to
layoutmgr/AddLMVisitor.getExternalGraphicInlineArea()
Revision Changes Path
1.7 +16 -34 xml-fop/src/java/org/apache/fop/fo/flow/ExternalGraphic.java
Index: ExternalGraphic.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/ExternalGraphic.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ExternalGraphic.java 22 Aug 2003 17:42:41 -0000 1.6
+++ ExternalGraphic.java 24 Aug 2003 19:22:59 -0000 1.7
@@ -54,8 +54,6 @@
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.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 @@
}
/**
- * 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 @@
fotv.serveVisitor(this);
}
-}
+ public String getURL() {
+ return url;
+ }
+
+ public int getViewWidth() {
+ return viewWidth;
+ }
+
+ public boolean getClip() {
+ return clip;
+ }
+
+ public Rectangle2D getPlacement() {
+ return placement;
+ }
+}
1.5 +34 -2 xml-fop/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java
Index: AddLMVisitor.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AddLMVisitor.java 24 Aug 2003 18:52:19 -0000 1.4
+++ AddLMVisitor.java 24 Aug 2003 19:22:59 -0000 1.5
@@ -60,6 +60,8 @@
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.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 @@
* 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();
@@ -407,6 +411,34 @@
lm.setLead(node.getViewHeight());
currentLMList.add(lm);
}
+ }
+
+ /**
+ * 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) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]