aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/java/org/apache/fop/fo/XMLObj.java9
-rw-r--r--src/java/org/apache/fop/fo/flow/AbstractGraphics.java15
-rw-r--r--src/java/org/apache/fop/fo/flow/ExternalGraphic.java12
-rw-r--r--src/java/org/apache/fop/fo/flow/InstreamForeignObject.java13
-rw-r--r--src/java/org/apache/fop/image/AbstractFopImage.java6
-rw-r--r--src/java/org/apache/fop/image/FopImage.java10
-rw-r--r--status.xml3
7 files changed, 65 insertions, 3 deletions
diff --git a/src/java/org/apache/fop/fo/XMLObj.java b/src/java/org/apache/fop/fo/XMLObj.java
index e2b459192..f7d140732 100644
--- a/src/java/org/apache/fop/fo/XMLObj.java
+++ b/src/java/org/apache/fop/fo/XMLObj.java
@@ -27,6 +27,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.batik.dom.util.XMLSupport;
import org.apache.fop.apps.FOPException;
+import org.apache.fop.datatypes.Length;
import org.apache.fop.util.ContentHandlerFactory.ObjectBuiltListener;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -94,6 +95,14 @@ public abstract class XMLObj extends FONode implements ObjectBuiltListener {
public Point2D getDimension(Point2D view) {
return null;
}
+
+ /**
+ * Retrieve the intrinsic alignment-adjust of the child element.
+ * @return the intrinsic alignment-adjust.
+ */
+ public Length getIntrinsicAlignmentAdjust() {
+ return null;
+ }
/** @see org.apache.fop.fo.FONode#getLocalName() */
public String getLocalName() {
diff --git a/src/java/org/apache/fop/fo/flow/AbstractGraphics.java b/src/java/org/apache/fop/fo/flow/AbstractGraphics.java
index 853e438fa..f48052009 100644
--- a/src/java/org/apache/fop/fo/flow/AbstractGraphics.java
+++ b/src/java/org/apache/fop/fo/flow/AbstractGraphics.java
@@ -236,6 +236,12 @@ public abstract class AbstractGraphics extends FObj {
* @return the "alignment-adjust" property
*/
public Length getAlignmentAdjust() {
+ if (alignmentAdjust.getEnum() == EN_AUTO) {
+ final Length intrinsicAlignmentAdjust = this.getIntrinsicAlignmentAdjust();
+ if (intrinsicAlignmentAdjust != null) {
+ return intrinsicAlignmentAdjust;
+ }
+ }
return alignmentAdjust;
}
@@ -261,12 +267,17 @@ public abstract class AbstractGraphics extends FObj {
}
/**
- * @return the graphics intrinsic width
+ * @return the graphics intrinsic width in millipoints
*/
public abstract int getIntrinsicWidth();
/**
- * @return the graphics intrinsic height
+ * @return the graphics intrinsic height in millipoints
*/
public abstract int getIntrinsicHeight();
+
+ /**
+ * @return the graphics intrinsic alignment-adjust
+ */
+ public abstract Length getIntrinsicAlignmentAdjust();
}
diff --git a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java b/src/java/org/apache/fop/fo/flow/ExternalGraphic.java
index 632812270..3ca8cf777 100644
--- a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java
+++ b/src/java/org/apache/fop/fo/flow/ExternalGraphic.java
@@ -21,6 +21,7 @@ package org.apache.fop.fo.flow;
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
@@ -44,6 +45,7 @@ public class ExternalGraphic extends AbstractGraphics {
private String url;
private int intrinsicWidth;
private int intrinsicHeight;
+ private Length intrinsicAlignmentAdjust;
/**
* Create a new External graphic node.
@@ -75,6 +77,7 @@ public class ExternalGraphic extends AbstractGraphics {
}
this.intrinsicWidth = fopimage.getIntrinsicWidth();
this.intrinsicHeight = fopimage.getIntrinsicHeight();
+ this.intrinsicAlignmentAdjust = fopimage.getIntrinsicAlignmentAdjust();
}
//TODO Report to caller so he can decide to throw an exception
}
@@ -135,5 +138,12 @@ public class ExternalGraphic extends AbstractGraphics {
public int getIntrinsicHeight() {
return this.intrinsicHeight;
}
-
+
+ /**
+ * @see org.apache.fop.fo.flow.AbstractGraphics#getIntrinsicAlignmentAdjust()
+ */
+ public Length getIntrinsicAlignmentAdjust() {
+ return this.intrinsicAlignmentAdjust;
+ }
+
}
diff --git a/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java b/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java
index fc8dd4bc9..b201b95b1 100644
--- a/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java
+++ b/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java
@@ -21,6 +21,7 @@ package org.apache.fop.fo.flow;
import java.awt.geom.Point2D;
import org.apache.fop.apps.FOPException;
+import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.XMLObj;
@@ -40,6 +41,8 @@ public class InstreamForeignObject extends AbstractGraphics {
//Additional value
private Point2D intrinsicDimensions;
+ private Length intrinsicAlignmentAdjust;
+
/**
* constructs an instream-foreign-object object (called by Maker).
*
@@ -98,6 +101,7 @@ public class InstreamForeignObject extends AbstractGraphics {
log.error("Intrinsic dimensions of "
+ " instream-foreign-object could not be determined");
}
+ intrinsicAlignmentAdjust = child.getIntrinsicAlignmentAdjust();
}
}
@@ -124,6 +128,15 @@ public class InstreamForeignObject extends AbstractGraphics {
return 0;
}
}
+
+ /**
+ * @see org.apache.fop.fo.flow.AbstractGraphics#getIntrinsicAlignmentAdjust()
+ */
+ public Length getIntrinsicAlignmentAdjust()
+ {
+ prepareIntrinsicSize();
+ return intrinsicAlignmentAdjust;
+ }
/** @see org.apache.fop.fo.FONode#addChildNode(org.apache.fop.fo.FONode) */
protected void addChildNode(FONode child) throws FOPException {
diff --git a/src/java/org/apache/fop/image/AbstractFopImage.java b/src/java/org/apache/fop/image/AbstractFopImage.java
index 4d49034a7..97f176712 100644
--- a/src/java/org/apache/fop/image/AbstractFopImage.java
+++ b/src/java/org/apache/fop/image/AbstractFopImage.java
@@ -29,6 +29,7 @@ import java.awt.Color;
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.fop.datatypes.Length;
/**
* Base class to implement the FopImage interface.
@@ -257,6 +258,11 @@ public abstract class AbstractFopImage implements FopImage {
public int getIntrinsicHeight() {
return (int)(getHeight() * 72000 / getVerticalResolution());
}
+
+ /** @see org.apache.fop.image.FopImage#getIntrinsicAlignmentAdjust() */
+ public Length getIntrinsicAlignmentAdjust() {
+ return this.imageInfo.alignmentAdjust;
+ }
/** @see org.apache.fop.image.FopImage#getHorizontalResolution() */
public double getHorizontalResolution() {
diff --git a/src/java/org/apache/fop/image/FopImage.java b/src/java/org/apache/fop/image/FopImage.java
index 0db6a95a0..30f3c8258 100644
--- a/src/java/org/apache/fop/image/FopImage.java
+++ b/src/java/org/apache/fop/image/FopImage.java
@@ -24,6 +24,8 @@ import java.awt.color.ColorSpace;
import java.awt.color.ICC_Profile;
import java.awt.Color;
+import org.apache.fop.datatypes.Length;
+
/**
* Fop image interface for loading images.
*
@@ -90,6 +92,12 @@ public interface FopImage {
int getIntrinsicHeight();
/**
+ * @return the intrinsic alignment-adjust value or NULL if the image does
+ * not have one.
+ */
+ Length getIntrinsicAlignmentAdjust();
+
+ /**
* @return the horizontal bitmap resolution (in dpi)
*/
double getHorizontalResolution();
@@ -193,6 +201,8 @@ public interface FopImage {
public String mimeType;
/** implementation-specific String (ex. the namespace for XML-based images) */
public String str;
+ /** intrinsic alignment-adjust or null if there is none */
+ public Length alignmentAdjust;
}
}
diff --git a/status.xml b/status.xml
index 81d8e6751..d155da934 100644
--- a/status.xml
+++ b/status.xml
@@ -28,6 +28,9 @@
<changes>
<release version="FOP Trunk">
+ <action context="code" dev="AD" type="add" fixes-bug="42785" due-to="Max Berger">
+ Support alignment-adjust for images.
+ </action>
<action context="code" dev="AD" type="add" fixes-bug="41044" due-to="Richard Wheeldon">
Partial application of the patch in Bugzilla 41044:
* addition of a generic PropertyCache to be used by all Property