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;
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() {
* @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;
}
}
/**
- * @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();
}
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;
private String url;
private int intrinsicWidth;
private int intrinsicHeight;
+ private Length intrinsicAlignmentAdjust;
/**
* Create a new External graphic node.
}
this.intrinsicWidth = fopimage.getIntrinsicWidth();
this.intrinsicHeight = fopimage.getIntrinsicHeight();
+ this.intrinsicAlignmentAdjust = fopimage.getIntrinsicAlignmentAdjust();
}
//TODO Report to caller so he can decide to throw an exception
}
public int getIntrinsicHeight() {
return this.intrinsicHeight;
}
-
+
+ /**
+ * @see org.apache.fop.fo.flow.AbstractGraphics#getIntrinsicAlignmentAdjust()
+ */
+ public Length getIntrinsicAlignmentAdjust() {
+ return this.intrinsicAlignmentAdjust;
+ }
+
}
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;
//Additional value
private Point2D intrinsicDimensions;
+ private Length intrinsicAlignmentAdjust;
+
/**
* constructs an instream-foreign-object object (called by Maker).
*
log.error("Intrinsic dimensions of "
+ " instream-foreign-object could not be determined");
}
+ intrinsicAlignmentAdjust = child.getIntrinsicAlignmentAdjust();
}
}
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 {
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.
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() {
import java.awt.color.ICC_Profile;
import java.awt.Color;
+import org.apache.fop.datatypes.Length;
+
/**
* Fop image interface for loading images.
*
*/
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)
*/
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;
}
}
<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