jeremias2005/01/03 05:06:27
Modified:src/java/org/apache/fop/fo/flow ExternalGraphic.java
InstreamForeignObject.java
src/java/org/apache/fop/datatypes PercentBase.java
LengthBase.java
src/java/org/apache/fop/fo FObj.java
Removed: src/java/org/apache/fop/fo IntrinsicSizeAccess.java
Log:
Access to intrinsic image size for eg/ifo through getLayoutDimension()
instead of through separate interface.
Added a todo item about replacing the use of propertyList along with a
reference to the related post on fop-dev.
Made the LayoutDimension keys a subclass of Avalon Framework's Enum to make
the thing more debugger-friendly and more type-safe.
Revision ChangesPath
1.51 +16 -7
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.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- ExternalGraphic.java 28 Dec 2004 18:03:12 - 1.50
+++ ExternalGraphic.java 3 Jan 2005 13:06:27 - 1.51
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 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.
@@ -18,16 +18,13 @@
package org.apache.fop.fo.flow;
-// Java
-import java.util.List;
-
import org.xml.sax.Locator;
import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
+import org.apache.fop.datatypes.PercentBase;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.IntrinsicSizeAccess;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonAccessibility;
@@ -39,14 +36,13 @@
import org.apache.fop.fo.properties.LengthRangeProperty;
import org.apache.fop.image.FopImage;
import org.apache.fop.image.ImageFactory;
-import org.apache.fop.layoutmgr.ExternalGraphicLayoutManager;
/**
* External graphic formatting object.
* This FO node handles the external graphic. It creates an image
* inline area that can be added to the area tree.
*/
-public class ExternalGraphic extends FObj implements IntrinsicSizeAccess {
+public class ExternalGraphic extends FObj {
// The value of properties relevant for fo:external-graphic.
private CommonAccessibility commonAccessibility;
@@ -272,6 +268,19 @@
return FO_EXTERNAL_GRAPHIC;
}
+/**
+ * @see
org.apache.fop.fo.FObj#getLayoutDimension(org.apache.fop.datatypes.PercentBase.DimensionType)
+ */
+public Number getLayoutDimension(PercentBase.LayoutDimension key) {
+if (key == PercentBase.IMAGE_INTRINSIC_WIDTH) {
+return new Integer(getIntrinsicWidth());
+} else if (key == PercentBase.IMAGE_INTRINSIC_HEIGHT) {
+return new Integer(getIntrinsicHeight());
+} else {
+return super.getLayoutDimension(key);
+}
+}
+
/**
* Preloads the image so the intrinsic size is available.
*/
1.39 +16 -3
xml-fop/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java
Index: InstreamForeignObject.java
===
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- InstreamForeignObject.java28 Dec 2004 18:03:12 - 1.38
+++ InstreamForeignObject.java3 Jan 2005 13:06:27 - 1.39
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 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.
@@ -24,9 +24,9 @@
import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
+import org.apache.fop.datatypes.PercentBase;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.IntrinsicSizeAccess;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.XMLObj;
@@ -43,7 +43,7 @@
* This is an atomic inline object that contains
* xml data.
*/
-public class InstreamForeignObject extends FObj implements
IntrinsicSizeAccess {
+public class InstreamForeignObject extends FObj {
// The value of properties relevant for