aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache
diff options
context:
space:
mode:
authorKeiron Liddle <keiron@apache.org>2000-10-25 01:48:44 +0000
committerKeiron Liddle <keiron@apache.org>2000-10-25 01:48:44 +0000
commitac37c285a285d089136bab5519b87ca42ee221c0 (patch)
treeb278905851a4a944a739b75032690bb221ebc5e0 /src/org/apache
parentf9f5e2d3a4b1109a21a40bb408b7d34585dca503 (diff)
downloadxmlgraphics-fop-ac37c285a285d089136bab5519b87ca42ee221c0.tar.gz
xmlgraphics-fop-ac37c285a285d089136bab5519b87ca42ee221c0.zip
changed the SVGLengthProperty so that it is possible to tell
if the value is not present, needed for gradients git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193736 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache')
-rw-r--r--src/org/apache/fop/svg/A.java139
-rw-r--r--src/org/apache/fop/svg/Circle.java143
-rw-r--r--src/org/apache/fop/svg/Ellipse.java150
-rw-r--r--src/org/apache/fop/svg/Image.java145
-rw-r--r--src/org/apache/fop/svg/Line.java150
-rw-r--r--src/org/apache/fop/svg/LinearGradient.java195
-rw-r--r--src/org/apache/fop/svg/RadialGradient.java168
-rw-r--r--src/org/apache/fop/svg/Rect.java163
-rw-r--r--src/org/apache/fop/svg/SVG.java333
-rw-r--r--src/org/apache/fop/svg/SVGLengthProperty.java162
-rw-r--r--src/org/apache/fop/svg/SVGPropertyListMapping.java134
-rw-r--r--src/org/apache/fop/svg/Text.java243
-rw-r--r--src/org/apache/fop/svg/Use.java148
13 files changed, 1236 insertions, 1037 deletions
diff --git a/src/org/apache/fop/svg/A.java b/src/org/apache/fop/svg/A.java
index a3f9cd1db..1e881f407 100644
--- a/src/org/apache/fop/svg/A.java
+++ b/src/org/apache/fop/svg/A.java
@@ -1,36 +1,36 @@
-/*-- $Id$ --
+/*-- $Id$ --
============================================================================
The Apache Software License, Version 1.1
============================================================================
-
+
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
-
+
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
-
+
4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
-
+
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
-
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -41,12 +41,12 @@
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
-
+
*/
package org.apache.fop.svg;
@@ -67,62 +67,61 @@ import org.w3c.dom.svg.SVGElement;
*/
public class A extends SVGObj {
- /**
- * inner class for making A objects.
- */
- public static class Maker extends FObj.Maker {
-
- /**
- * make a A object.
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- *
- * @return the A object
- */
- public FObj make(FObj parent, PropertyList propertyList) throws FOPException
- {
- return new A(parent, propertyList);
- }
- }
-
- /**
- * returns the maker for this object.
- *
- * @return the maker for A objects
- */
- public static FObj.Maker maker() {
- return new A.Maker();
- }
-
- /**
- * constructs a A object (called by Maker).
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- */
- protected A(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
- this.name = "svg:a";
- }
-
- public SVGElement createGraphic()
- {
- String rf = this.properties.get("xlink:href").getString();
- SVGAElementImpl graphic;
- graphic = new SVGAElementImpl();
-// graphic.setTarget(new SVGAnimatedStringImpl(rf));
-
- int numChildren = this.children.size();
- for (int i = 0; i < numChildren; i++) {
- FONode child = (FONode) children.elementAt(i);
- if(child instanceof GraphicsCreator) {
- SVGElement impl = ((GraphicsCreator)child).createGraphic();
- graphic.appendChild(impl);
- } else if(child instanceof Defs) {
- }
- }
-
- return graphic;
- }
+ /**
+ * inner class for making A objects.
+ */
+ public static class Maker extends FObj.Maker {
+
+ /**
+ * make a A object.
+ *
+ * @param parent the parent formatting object
+ * @param propertyList the explicit properties of this object
+ *
+ * @return the A object
+ */
+ public FObj make(FObj parent,
+ PropertyList propertyList) throws FOPException {
+ return new A(parent, propertyList);
+ }
+ }
+
+ /**
+ * returns the maker for this object.
+ *
+ * @return the maker for A objects
+ */
+ public static FObj.Maker maker() {
+ return new A.Maker();
+ }
+
+ /**
+ * constructs a A object (called by Maker).
+ *
+ * @param parent the parent formatting object
+ * @param propertyList the explicit properties of this object
+ */
+ protected A(FObj parent, PropertyList propertyList) {
+ super(parent, propertyList);
+ this.name = "svg:a";
+ }
+
+ public SVGElement createGraphic() {
+ String rf = this.properties.get("xlink:href").getString();
+ SVGAElementImpl graphic;
+ graphic = new SVGAElementImpl();
+ // graphic.setTarget(new SVGAnimatedStringImpl(rf));
+
+ int numChildren = this.children.size();
+ for (int i = 0; i < numChildren; i++) {
+ FONode child = (FONode) children.elementAt(i);
+ if (child instanceof GraphicsCreator) {
+ SVGElement impl = ((GraphicsCreator) child).createGraphic();
+ graphic.appendChild(impl);
+ } else if (child instanceof Defs) {
+ }
+ }
+
+ return graphic;
+ }
}
diff --git a/src/org/apache/fop/svg/Circle.java b/src/org/apache/fop/svg/Circle.java
index 678fd4ba7..f32b467dd 100644
--- a/src/org/apache/fop/svg/Circle.java
+++ b/src/org/apache/fop/svg/Circle.java
@@ -1,36 +1,36 @@
-/*-- $Id$ --
+/*-- $Id$ --
============================================================================
The Apache Software License, Version 1.1
============================================================================
-
+
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
-
+
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
-
+
4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
-
+
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
-
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -41,12 +41,12 @@
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
-
+
*/
package org.apache.fop.svg;
@@ -71,58 +71,69 @@ import org.w3c.dom.svg.SVGElement;
*/
public class Circle extends SVGObj {
- /**
- * inner class for making Circle objects.
- */
- public static class Maker extends FObj.Maker {
-
- /**
- * make a Circle object.
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- *
- * @return the Circle object
- */
- public FObj make(FObj parent, PropertyList propertyList) throws FOPException
- {
- return new Circle(parent, propertyList);
- }
- }
-
- /**
- * returns the maker for this object.
- *
- * @return the maker for Circle objects
- */
- public static FObj.Maker maker() {
- return new Circle.Maker();
- }
-
- /**
- * constructs a Circle object (called by Maker).
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- */
- protected Circle(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
- this.name = "svg:circle";
- }
-
- public SVGElement createGraphic()
- {
- /* retrieve properties */
- SVGLength cx = ((SVGLengthProperty)this.properties.get("cx")).getSVGLength();
- SVGLength cy = ((SVGLengthProperty)this.properties.get("cy")).getSVGLength();
- SVGLength r = ((SVGLengthProperty)this.properties.get("r")).getSVGLength();
- SVGCircleElementImpl graph = new SVGCircleElementImpl();
- graph.setCx(new SVGAnimatedLengthImpl(cx));
- graph.setCy(new SVGAnimatedLengthImpl(cy));
- graph.setR(new SVGAnimatedLengthImpl(r));
- graph.setStyle(((SVGStyle)this.properties.get("style")).getStyle());
- graph.setTransform(((SVGTransform)this.properties.get("transform")).getTransform());
- graph.setId(this.properties.get("id").getString());
- return graph;
- }
+ /**
+ * inner class for making Circle objects.
+ */
+ public static class Maker extends FObj.Maker {
+
+ /**
+ * make a Circle object.
+ *
+ * @param parent the parent formatting object
+ * @param propertyList the explicit properties of this object
+ *
+ * @return the Circle object
+ */
+ public FObj make(FObj parent,
+ PropertyList propertyList) throws FOPException {
+ return new Circle(parent, propertyList);
+ }
+ }
+
+ /**
+ * returns the maker for this object.
+ *
+ * @return the maker for Circle objects
+ */
+ public static FObj.Maker maker() {
+ return new Circle.Maker();
+ }
+
+ /**
+ * constructs a Circle object (called by Maker).
+ *
+ * @param parent the parent formatting object
+ * @param propertyList the explicit properties of this object
+ */
+ protected Circle(FObj parent, PropertyList propertyList) {
+ super(parent, propertyList);
+ this.name = "svg:circle";
+ }
+
+ public SVGElement createGraphic() {
+ /* retrieve properties */
+ SVGLength cx = ((SVGLengthProperty) this.properties.get("cx")).
+ getSVGLength();
+ if (cx == null)
+ cx = new SVGLengthImpl();
+ SVGLength cy = ((SVGLengthProperty) this.properties.get("cy")).
+ getSVGLength();
+ if (cy == null)
+ cy = new SVGLengthImpl();
+ SVGLength r = ((SVGLengthProperty) this.properties.get("r")).
+ getSVGLength();
+ if (r == null)
+ r = new SVGLengthImpl();
+ SVGCircleElementImpl graph = new SVGCircleElementImpl();
+ graph.setCx(new SVGAnimatedLengthImpl(cx));
+ graph.setCy(new SVGAnimatedLengthImpl(cy));
+ graph.setR(new SVGAnimatedLengthImpl(r));
+ graph.setStyle(
+ ((SVGStyle) this.properties.get("style")).getStyle());
+ graph.setTransform(
+ ((SVGTransform) this.properties.get("transform")).
+ getTransform());
+ graph.setId(this.properties.get("id").getString());
+ return graph;
+ }
}
diff --git a/src/org/apache/fop/svg/Ellipse.java b/src/org/apache/fop/svg/Ellipse.java
index d1c4e5e3b..3c955b51a 100644
--- a/src/org/apache/fop/svg/Ellipse.java
+++ b/src/org/apache/fop/svg/Ellipse.java
@@ -1,36 +1,36 @@
-/*-- $Id$ --
+/*-- $Id$ --
============================================================================
The Apache Software License, Version 1.1
============================================================================
-
+
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
-
+
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
-
+
4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
-
+
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
-
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -41,12 +41,12 @@
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
-
+
*/
package org.apache.fop.svg;
@@ -69,60 +69,74 @@ import org.w3c.dom.svg.SVGElement;
*/
public class Ellipse extends SVGObj {
- /**
- * inner class for making Ellipse objects.
- */
- public static class Maker extends FObj.Maker {
-
- /**
- * make a Ellipse object.
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- *
- * @return the Ellipse object
- */
- public FObj make(FObj parent, PropertyList propertyList) throws FOPException
- {
- return new Ellipse(parent, propertyList);
- }
- }
-
- /**
- * returns the maker for this object.
- *
- * @return the maker for Ellipse objects
- */
- public static FObj.Maker maker() {
- return new Ellipse.Maker();
- }
-
- /**
- * constructs a Ellipse object (called by Maker).
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- */
- protected Ellipse(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
- this.name = "svg:ellipse";
- }
-
- public SVGElement createGraphic()
- {
- /* retrieve properties */
- SVGLength cx = ((SVGLengthProperty)this.properties.get("cx")).getSVGLength();
- SVGLength cy = ((SVGLengthProperty)this.properties.get("cy")).getSVGLength();
- SVGLength rx = ((SVGLengthProperty)this.properties.get("rx")).getSVGLength();
- SVGLength ry = ((SVGLengthProperty)this.properties.get("ry")).getSVGLength();
- SVGEllipseElementImpl graph = new SVGEllipseElementImpl();
- graph.setCx(new SVGAnimatedLengthImpl(cx));
- graph.setCy(new SVGAnimatedLengthImpl(cy));
- graph.setRx(new SVGAnimatedLengthImpl(rx));
- graph.setRy(new SVGAnimatedLengthImpl(ry));
- graph.setStyle(((SVGStyle)this.properties.get("style")).getStyle());
- graph.setTransform(((SVGTransform)this.properties.get("transform")).getTransform());
- graph.setId(this.properties.get("id").getString());
- return graph;
- }
+ /**
+ * inner class for making Ellipse objects.
+ */
+ public static class Maker extends FObj.Maker {
+
+ /**
+ * make a Ellipse object.
+ *
+ * @param parent the parent formatting object
+ * @param propertyList the explicit properties of this object
+ *
+ * @return the Ellipse object
+ */
+ public FObj make(FObj parent,
+ PropertyList propertyList) throws FOPException {
+ return new Ellipse(parent, propertyList);
+ }
+ }
+
+ /**
+ * returns the maker for this object.
+ *
+ * @return the maker for Ellipse objects
+ */
+ public static FObj.Maker maker() {
+ return new Ellipse.Maker();
+ }
+
+ /**
+ * constructs a Ellipse object (called by Maker).
+ *
+ * @param parent the parent formatting object
+ * @param propertyList the explicit properties of this object
+ */
+ protected Ellipse(FObj parent, PropertyList propertyList) {
+ super(parent, propertyList);
+ this.name = "svg:ellipse";
+ }
+
+ public SVGElement createGraphic() {
+ /* retrieve properties */
+ SVGLength cx = ((SVGLengthProperty) this.properties.get("cx")).
+ getSVGLength();
+ if (cx == null)
+ cx = new SVGLengthImpl();
+ SVGLength cy = ((SVGLengthProperty) this.properties.get("cy")).
+ getSVGLength();
+ if (cy == null)
+ cy = new SVGLengthImpl();
+ SVGLength rx = ((SVGLengthProperty) this.properties.get("rx")).
+ getSVGLength();
+ if (rx == null)
+ rx = new SVGLengthImpl();
+ SVGLength ry = ((SVGLengthProperty) this.properties.get("ry")).
+ getSVGLength();
+ if (ry == null)
+ ry = new SVGLengthImpl();
+ SVGEllipseElementImpl graph = new SVGEllipseElementImpl();
+ graph.setCx(new SVGAnimatedLengthImpl(cx));
+ graph.setCy(new SVGAnimatedLengthImpl(cy));
+ graph.setRx(new SVGAnimatedLengthImpl(rx));
+ graph.setRy(new SVGAnimatedLengthImpl(ry));
+ graph.setStyle(
+ ((SVGStyle) this.properties.get("style")).getStyle());
+ graph.setTransform(
+ ((SVGTransform) this.properties.get("transform")).
+ getTransform());
+ graph.setId(this.properties.get("id").getString());
+ return graph;
+ }
}
diff --git a/src/org/apache/fop/svg/Image.java b/src/org/apache/fop/svg/Image.java
index 1a02982e9..d9a2d8f91 100644
--- a/src/org/apache/fop/svg/Image.java
+++ b/src/org/apache/fop/svg/Image.java
@@ -1,36 +1,36 @@
-/*-- $Id$ --
+/*-- $Id$ --
============================================================================
The Apache Software License, Version 1.1
============================================================================
-
+
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
-
+
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
-
+
4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
-
+
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
-
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -41,12 +41,12 @@
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
-
+
*/
package org.apache.fop.svg;
@@ -61,6 +61,7 @@ import org.apache.fop.dom.svg.*;
import org.apache.fop.dom.svg.SVGArea;
import org.w3c.dom.svg.SVGElement;
+import org.w3c.dom.svg.SVGLength;
/**
* class representing svg:Image pseudo flow object.
@@ -68,55 +69,73 @@ import org.w3c.dom.svg.SVGElement;
*/
public class Image extends SVGObj {
- /**
- * inner class for making Image objects.
- */
- public static class Maker extends FObj.Maker {
-
- /**
- * make a Image object.
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- *
- * @return the Image object
- */
- public FObj make(FObj parent, PropertyList propertyList) throws FOPException
- {
- return new Image(parent, propertyList);
- }
- }
-
- /**
- * returns the maker for this object.
- *
- * @return the maker for Image objects
- */
- public static FObj.Maker maker() {
- return new Image.Maker();
- }
-
- /**
- * constructs a Image object (called by Maker).
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- */
- protected Image(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
- this.name = "svg:image";
- }
-
- public SVGElement createGraphic()
- {
- String link = this.properties.get("xlink:href").getString();
- float x = ((SVGLengthProperty)this.properties.get("x")).getSVGLength().getValue();
- float y = ((SVGLengthProperty)this.properties.get("y")).getSVGLength().getValue();
- float width = ((SVGLengthProperty)this.properties.get("width")).getSVGLength().getValue();
- float height = ((SVGLengthProperty)this.properties.get("height")).getSVGLength().getValue();
- SVGImageElementImpl graph = new SVGImageElementImpl(link, x, y, width, height);
- graph.setStyle(((SVGStyle)this.properties.get("style")).getStyle());
- graph.setId(this.properties.get("id").getString());
- return graph;
- }
+ /**
+ * inner class for making Image objects.
+ */
+ public static class Maker extends FObj.Maker {
+
+ /**
+ * make a Image object.
+ *
+ * @param parent the parent formatting object
+ * @param propertyList the explicit properties of this object
+ *
+ * @return the Image object
+ */
+ public FObj make(FObj parent,
+ PropertyList propertyList) throws FOPException {
+ return new Image(parent, propertyList);
+ }
+ }
+
+ /**
+ * returns the maker for this object.
+ *
+ * @return the maker for Image objects
+ */
+ public static FObj.Maker maker() {
+ return new Image.Maker();
+ }
+
+ /**
+ * constructs a Image object (called by Maker).
+ *
+ * @param parent the parent formatting object
+ * @param propertyList the explicit properties of this object
+ */
+ protected Image(FObj parent, PropertyList propertyList) {
+ super(parent, propertyList);
+ this.name = "svg:image";
+ }
+
+ public SVGElement createGraphic() {
+ String link = this.properties.get("xlink:href").getString();
+ SVGLength length;
+ length = ((SVGLengthProperty) this.properties.get("x")).
+ getSVGLength();
+ if (length == null)
+ length = new SVGLengthImpl();
+ float x = length.getValue();
+ length = ((SVGLengthProperty) this.properties.get("y")).
+ getSVGLength();
+ if (length == null)
+ length = new SVGLengthImpl();
+ float y = length.getValue();
+ length = ((SVGLengthProperty) this.properties.get("width")).
+ getSVGLength();
+ if (length == null)
+ length = new SVGLengthImpl();
+ float width = length.getValue();
+ length = ((SVGLengthProperty) this.properties.get("height")).
+ getSVGLength();
+ if (length == null)
+ length = new SVGLengthImpl();
+ float height = length.getValue();
+ SVGImageElementImpl graph =
+ new SVGImageElementImpl(link, x, y, width, height);
+ graph.setStyle(
+ ((SVGStyle) this.properties.get("style")).getStyle());
+ graph.setId(this.properties.get("id").getString());
+ return graph;
+ }
}
diff --git a/src/org/apache/fop/svg/Line.java b/src/org/apache/fop/svg/Line.java
index 7891f0e3b..a69aee426 100644
--- a/src/org/apache/fop/svg/Line.java
+++ b/src/org/apache/fop/svg/Line.java
@@ -1,36 +1,36 @@
-/*-- $Id$ --
+/*-- $Id$ --
============================================================================
The Apache Software License, Version 1.1
============================================================================
-
+
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
-
+
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
-
+
4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
-
+
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
-
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -41,12 +41,12 @@
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
-
+
*/
package org.apache.fop.svg;
@@ -71,60 +71,74 @@ import org.w3c.dom.svg.SVGElement;
*/
public class Line extends SVGObj {
- /**
- * inner class for making Line objects.
- */
- public static class Maker extends FObj.Maker {
-
- /**
- * make a Line object.
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- *
- * @return the Line object
- */
- public FObj make(FObj parent, PropertyList propertyList) throws FOPException
- {
- return new Line(parent, propertyList);
- }
- }
-
- /**
- * returns the maker for this object.
- *
- * @return the maker for Line objects
- */
- public static FObj.Maker maker() {
- return new Line.Maker();
- }
-
- /**
- * constructs a Line object (called by Maker).
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- */
- protected Line(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
- this.name = "svg:line";
- }
-
- public SVGElement createGraphic()
- {
- /* retrieve properties */
- SVGLength x1 = ((SVGLengthProperty)this.properties.get("x1")).getSVGLength();
- SVGLength x2 = ((SVGLengthProperty)this.properties.get("x2")).getSVGLength();
- SVGLength y1 = ((SVGLengthProperty)this.properties.get("y1")).getSVGLength();
- SVGLength y2 = ((SVGLengthProperty)this.properties.get("y2")).getSVGLength();
- SVGLineElementImpl graph = new SVGLineElementImpl();
- graph.setX1(new SVGAnimatedLengthImpl(x1));
- graph.setY1(new SVGAnimatedLengthImpl(y1));
- graph.setX2(new SVGAnimatedLengthImpl(x2));
- graph.setY2(new SVGAnimatedLengthImpl(y2));
- graph.setStyle(((SVGStyle)this.properties.get("style")).getStyle());
- graph.setTransform(((SVGTransform)this.properties.get("transform")).getTransform());
- graph.setId(this.properties.get("id").getString());
- return graph;
- }
+ /**
+ * inner class for making Line objects.
+ */
+ public static class Maker extends FObj.Maker {
+
+ /**
+ * make a Line object.
+ *
+ * @param parent the parent formatting object
+ * @param propertyList the explicit properties of this object
+ *
+ * @return the Line object
+ */
+ public FObj make(FObj parent,
+ PropertyList propertyList) throws FOPException {
+ return new Line(parent, propertyList);
+ }
+ }
+
+ /**
+ * returns the maker for this object.
+ *
+ * @return the maker for Line objects
+ */
+ public static FObj.Maker maker() {
+ return new Line.Maker();
+ }
+
+ /**
+ * constructs a Line object (called by Maker).
+ *
+ * @param parent the parent formatting object
+ * @param propertyList the explicit properties of this object
+ */
+ protected Line(FObj parent, PropertyList propertyList) {
+ super(parent, propertyList);
+ this.name = "svg:line";
+ }
+
+ public SVGElement createGraphic() {
+ /* retrieve properties */
+ SVGLength x1 = ((SVGLengthProperty) this.properties.get("x1")).
+ getSVGLength();
+ if (x1 == null)
+ x1 = new SVGLengthImpl();
+ SVGLength x2 = ((SVGLengthProperty) this.properties.get("x2")).
+ getSVGLength();
+ if (x2 == null)
+ x2 = new SVGLengthImpl();
+ SVGLength y1 = ((SVGLengthProperty) this.properties.get("y1")).
+ getSVGLength();
+ if (y1 == null)
+ y1 = new SVGLengthImpl();
+ SVGLength y2 = ((SVGLengthProperty) this.properties.get("y2")).
+ getSVGLength();
+ if (y2 == null)
+ y2 = new SVGLengthImpl();
+ SVGLineElementImpl graph = new SVGLineElementImpl();
+ graph.setX1(new SVGAnimatedLengthImpl(x1));
+ graph.setY1(new SVGAnimatedLengthImpl(y1));
+ graph.setX2(new SVGAnimatedLengthImpl(x2));
+ graph.setY2(new SVGAnimatedLengthImpl(y2));
+ graph.setStyle(
+ ((SVGStyle) this.properties.get("style")).getStyle());
+ graph.setTransform(
+ ((SVGTransform) this.properties.get("transform")).
+ getTransform());
+ graph.setId(this.properties.get("id").getString());
+ return graph;
+ }
}
diff --git a/src/org/apache/fop/svg/LinearGradient.java b/src/org/apache/fop/svg/LinearGradient.java
index b175a81e3..7452ca75f 100644
--- a/src/org/apache/fop/svg/LinearGradient.java
+++ b/src/org/apache/fop/svg/LinearGradient.java
@@ -1,36 +1,36 @@
-/*-- $Id$ --
+/*-- $Id$ --
============================================================================
The Apache Software License, Version 1.1
============================================================================
-
+
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
-
+
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
-
+
4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
-
+
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
-
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -41,12 +41,12 @@
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
-
+
*/
package org.apache.fop.svg;
@@ -56,6 +56,7 @@ import org.apache.fop.fo.*;
import org.apache.fop.layout.Area;
import org.apache.fop.layout.FontState;
import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.properties.*;
import org.apache.fop.dom.svg.*;
import org.apache.fop.dom.svg.SVGArea;
@@ -68,66 +69,112 @@ import org.w3c.dom.svg.*;
*/
public class LinearGradient extends SVGObj {
- /**
- * inner class for making LinearGradient objects.
- */
- public static class Maker extends FObj.Maker {
-
- /**
- * make a LinearGradient object.
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- *
- * @return the LinearGradient object
- */
- public FObj make(FObj parent, PropertyList propertyList) throws FOPException
- {
- return new LinearGradient(parent, propertyList);
- }
- }
-
- /**
- * returns the maker for this object.
- *
- * @return the maker for LinearGradient objects
- */
- public static FObj.Maker maker() {
- return new LinearGradient.Maker();
- }
-
- /**
- * constructs a LinearGradient object (called by Maker).
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- */
- protected LinearGradient(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
- this.name = "svg:linearGradient";
- }
-
- SVGLinearGradientElementImpl linear = new SVGLinearGradientElementImpl();
-
- protected void addChild(FONode child) {
- super.addChild(child);
- if(child instanceof Stop) {
- SVGStopElement sse = ((Stop)child).createStop();
- linear.appendChild(sse);
- }
- }
-
- public SVGElement createGraphic()
- {
- linear.setStyle(((SVGStyle)this.properties.get("style")).getStyle());
- linear.setTransform(((SVGTransform)this.properties.get("transform")).getTransform());
- linear.setId(this.properties.get("id").getString());
-
- linear.setX1(new SVGAnimatedLengthImpl(((SVGLengthProperty)this.properties.get("x1")).getSVGLength()));
- linear.setX2(new SVGAnimatedLengthImpl(((SVGLengthProperty)this.properties.get("x2")).getSVGLength()));
- linear.setY1(new SVGAnimatedLengthImpl(((SVGLengthProperty)this.properties.get("y1")).getSVGLength()));
- linear.setY2(new SVGAnimatedLengthImpl(((SVGLengthProperty)this.properties.get("y2")).getSVGLength()));
-// linear.setSpreadMethod(?);
- return linear;
- }
+ /**
+ * inner class for making LinearGradient objects.
+ */
+ public static class Maker extends FObj.Maker {
+
+ /**
+ * make a LinearGradient object.
+ *
+ * @param parent the parent formatting object
+ * @param propertyList the explicit properties of this object
+ *
+ * @return the LinearGradient object
+ */
+ public FObj make(FObj parent,
+ PropertyList propertyList) throws FOPException {
+ return new LinearGradient(parent, propertyList);
+ }
+ }
+
+ /**
+ * returns the maker for this object.
+ *
+ * @return the maker for LinearGradient objects
+ */
+ public static FObj.Maker maker() {
+ return new LinearGradient.Maker();
+ }
+
+ /**
+ * constructs a LinearGradient object (called by Maker).
+ *
+ * @param parent the parent formatting object
+ * @param propertyList the explicit properties of this object
+ */
+ protected LinearGradient(FObj parent, PropertyList propertyList) {
+ super(parent, propertyList);
+ this.name = "svg:linearGradient";
+ }
+
+ SVGLinearGradientElementImpl linear =
+ new SVGLinearGradientElementImpl();
+
+ protected void addChild(FONode child) {
+ super.addChild(child);
+ if (child instanceof Stop) {
+ SVGStopElement sse = ((Stop) child).createStop();
+ linear.appendChild(sse);
+ }
+ }
+
+ public SVGElement createGraphic() {
+ linear.setStyle(
+ ((SVGStyle) this.properties.get("style")).getStyle());
+ linear.setTransform(
+ ((SVGTransform) this.properties.get("transform")).
+ getTransform());
+ linear.setId(this.properties.get("id").getString());
+ String rf = this.properties.get("xlink:href").getString();
+ linear.setHref(new SVGAnimatedStringImpl(rf));
+
+ SVGLength lengthProp =
+ ((SVGLengthProperty) this.properties.get("x1")).
+ getSVGLength();
+ linear.setX1(lengthProp == null ? null :
+ new SVGAnimatedLengthImpl(lengthProp));
+ // if x2 is not specified then it should be 100%
+ lengthProp = ((SVGLengthProperty) this.properties.get("x2")).
+ getSVGLength();
+ linear.setX2(lengthProp == null ? null :
+ new SVGAnimatedLengthImpl(lengthProp));
+ lengthProp = ((SVGLengthProperty) this.properties.get("y1")).
+ getSVGLength();
+ linear.setY1(lengthProp == null ? null :
+ new SVGAnimatedLengthImpl(lengthProp));
+ lengthProp = ((SVGLengthProperty) this.properties.get("y2")).
+ getSVGLength();
+ linear.setY2(lengthProp == null ? null :
+ new SVGAnimatedLengthImpl(lengthProp));
+ switch ((this.properties.get("spreadMethod")).getEnum()) {
+ case SpreadMethod.PAD:
+ linear.setSpreadMethod( new SVGAnimatedEnumerationImpl(
+ SVGGradientElement.SVG_SPREADMETHOD_PAD));
+ break;
+ case SpreadMethod.REFLECT:
+ linear.setSpreadMethod( new SVGAnimatedEnumerationImpl(
+ SVGGradientElement.SVG_SPREADMETHOD_REFLECT));
+ break;
+ case SpreadMethod.REPEAT:
+ linear.setSpreadMethod( new SVGAnimatedEnumerationImpl(
+ SVGGradientElement.SVG_SPREADMETHOD_REPEAT));
+ break;
+ }
+ switch ((this.properties.get("gradientUnits")).getEnum()) {
+ case GradientUnits.USER_SPACE:
+ linear.setGradientUnits( new SVGAnimatedEnumerationImpl(
+ SVGUnitTypes.SVG_UNIT_TYPE_USERSPACE));
+ break;
+ case GradientUnits.USER_SPACE_ON_USE:
+ linear.setGradientUnits( new SVGAnimatedEnumerationImpl(
+ SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE));
+ break;
+ case GradientUnits.OBJECT_BOUNDING_BOX:
+ linear.setGradientUnits( new SVGAnimatedEnumerationImpl(
+ SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX));
+ break;
+ }
+ return linear;
+ }
}
diff --git a/src/org/apache/fop/svg/RadialGradient.java b/src/org/apache/fop/svg/RadialGradient.java
index ec941801d..475e8e7f9 100644
--- a/src/org/apache/fop/svg/RadialGradient.java
+++ b/src/org/apache/fop/svg/RadialGradient.java
@@ -1,36 +1,36 @@
-/*-- $Id$ --
+/*-- $Id$ --
============================================================================
The Apache Software License, Version 1.1
============================================================================
-
+
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
-
+
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
-
+
4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
-
+
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
-
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -41,12 +41,12 @@
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
-
+
*/
package org.apache.fop.svg;
@@ -68,66 +68,86 @@ import org.w3c.dom.svg.*;
*/
public class RadialGradient extends SVGObj {
- /**
- * inner class for making RadialGradient objects.
- */
- public static class Maker extends FObj.Maker {
-
- /**
- * make a RadialGradient object.
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- *
- * @return the RadialGradient object
- */
- public FObj make(FObj parent, PropertyList propertyList) throws FOPException
- {
- return new RadialGradient(parent, propertyList);
- }
- }
-
- /**
- * returns the maker for this object.
- *
- * @return the maker for RadialGradient objects
- */
- public static FObj.Maker maker() {
- return new RadialGradient.Maker();
- }
-
- SVGRadialGradientElementImpl radial = new SVGRadialGradientElementImpl();
-
- /**
- * constructs a RadialGradient object (called by Maker).
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- */
- protected RadialGradient(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
- this.name = "svg:radialGradient";
- }
-
- protected void addChild(FONode child) {
- super.addChild(child);
- if(child instanceof Stop) {
- SVGStopElement sse = ((Stop)child).createStop();
- radial.appendChild(sse);
- }
- }
-
- public SVGElement createGraphic()
- {
- radial.setStyle(((SVGStyle)this.properties.get("style")).getStyle());
- radial.setTransform(((SVGTransform)this.properties.get("transform")).getTransform());
- radial.setId(this.properties.get("id").getString());
-
- radial.setCx(new SVGAnimatedLengthImpl(((SVGLengthProperty)this.properties.get("cx")).getSVGLength()));
- radial.setCy(new SVGAnimatedLengthImpl(((SVGLengthProperty)this.properties.get("cy")).getSVGLength()));
- radial.setR(new SVGAnimatedLengthImpl(((SVGLengthProperty)this.properties.get("r")).getSVGLength()));
- radial.setFx(new SVGAnimatedLengthImpl(((SVGLengthProperty)this.properties.get("fx")).getSVGLength()));
- radial.setFy(new SVGAnimatedLengthImpl(((SVGLengthProperty)this.properties.get("fy")).getSVGLength()));
- return radial;
- }
+ /**
+ * inner class for making RadialGradient objects.
+ */
+ public static class Maker extends FObj.Maker {
+
+ /**
+ * make a RadialGradient object.
+ *
+ * @param parent the parent formatting object
+ * @param propertyList the explicit properties of this object
+ *
+ * @return the RadialGradient object
+ */
+ public FObj make(FObj parent,
+ PropertyList propertyList) throws FOPException {
+ return new RadialGradient(parent, propertyList);
+ }
+ }
+
+ /**
+ * returns the maker for this object.
+ *
+ * @return the maker for RadialGradient objects
+ */
+ public static FObj.Maker maker() {
+ return new RadialGradient.Maker();
+ }
+
+ SVGRadialGradientElementImpl radial =
+ new SVGRadialGradientElementImpl();
+
+ /**
+ * constructs a RadialGradient object (called by Maker).
+ *
+ * @param parent the parent formatting object
+ * @param propertyList the explicit properties of this object
+ */
+ protected RadialGradient(FObj parent, PropertyList propertyList) {
+ super(parent, propertyList);
+ this.name = "svg:radialGradient";
+ }
+
+ protected void addChild(FONode child) {
+ super.addChild(child);
+ if (child instanceof Stop) {
+ SVGStopElement sse = ((Stop) child).createStop();
+ radial.appendChild(sse);
+ }
+ }
+
+ public SVGElement createGraphic() {
+ radial.setStyle(
+ ((SVGStyle) this.properties.get("style")).getStyle());
+ radial.setTransform(
+ ((SVGTransform) this.properties.get("transform")).
+ getTransform());
+ radial.setId(this.properties.get("id").getString());
+ String rf = this.properties.get("xlink:href").getString();
+ radial.setHref(new SVGAnimatedStringImpl(rf));
+
+ SVGLength length = ((SVGLengthProperty) this.properties.get("cx")).
+ getSVGLength();
+ radial.setCx(length == null ? null :
+ new SVGAnimatedLengthImpl(length));
+ length = ((SVGLengthProperty) this.properties.get("cy")).
+ getSVGLength();
+ radial.setCy(length == null ? null :
+ new SVGAnimatedLengthImpl(length));
+ length = ((SVGLengthProperty) this.properties.get("r")).
+ getSVGLength();
+ radial.setR(length == null ? null :
+ new SVGAnimatedLengthImpl(length));
+ length = ((SVGLengthProperty) this.properties.get("fx")).
+ getSVGLength();
+ radial.setFx(length == null ? null :
+ new SVGAnimatedLengthImpl(length));
+ length = ((SVGLengthProperty) this.properties.get("fy")).
+ getSVGLength();
+ radial.setFy(length == null ? null :
+ new SVGAnimatedLengthImpl(length));
+ return radial;
+ }
}
diff --git a/src/org/apache/fop/svg/Rect.java b/src/org/apache/fop/svg/Rect.java
index 19579470b..49e3b741b 100644
--- a/src/org/apache/fop/svg/Rect.java
+++ b/src/org/apache/fop/svg/Rect.java
@@ -1,36 +1,36 @@
-/*-- $Id$ --
+/*-- $Id$ --
============================================================================
The Apache Software License, Version 1.1
============================================================================
-
+
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
-
+
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
-
+
4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
-
+
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
-
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -41,12 +41,12 @@
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
-
+
*/
package org.apache.fop.svg;
@@ -72,64 +72,83 @@ import org.w3c.dom.svg.SVGElement;
*/
public class Rect extends SVGObj {
- /**
- * inner class for making Rect objects.
- */
- public static class Maker extends FObj.Maker {
-
- /**
- * make a Rect object.
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- *
- * @return the Rect object
- */
- public FObj make(FObj parent, PropertyList propertyList)
- throws FOPException {
- return new Rect(parent, propertyList);
- }
- }
-
- /**
- * returns the maker for this object.
- *
- * @return the maker for Rect objects
- */
- public static FObj.Maker maker() {
- return new Rect.Maker();
- }
-
- /**
- * constructs a Rect object (called by Maker).
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- */
- protected Rect(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
- this.name = "svg:rect";
- }
-
- public SVGElement createGraphic()
- {
- /* retrieve properties */
- SVGLength width = ((SVGLengthProperty)this.properties.get("width")).getSVGLength();
- SVGLength height = ((SVGLengthProperty)this.properties.get("height")).getSVGLength();
- SVGLength x = ((SVGLengthProperty)this.properties.get("x")).getSVGLength();
- SVGLength y = ((SVGLengthProperty)this.properties.get("y")).getSVGLength();
- SVGLength rx = ((SVGLengthProperty)this.properties.get("rx")).getSVGLength();
- SVGLength ry = ((SVGLengthProperty)this.properties.get("ry")).getSVGLength();
- SVGRectElementImpl graph = new SVGRectElementImpl();
- graph.setX(new SVGAnimatedLengthImpl(x));
- graph.setY(new SVGAnimatedLengthImpl(y));
- graph.setRx(new SVGAnimatedLengthImpl(rx));
- graph.setRy(new SVGAnimatedLengthImpl(ry));
- graph.setWidth(new SVGAnimatedLengthImpl(width));
- graph.setHeight(new SVGAnimatedLengthImpl(height));
- graph.setStyle(((SVGStyle)this.properties.get("style")).getStyle());
- graph.setTransform(((SVGTransform)this.properties.get("transform")).getTransform());
- graph.setId(this.properties.get("id").getString());
- return graph;
- }
+ /**
+ * inner class for making Rect objects.
+ */
+ public static class Maker extends FObj.Maker {
+
+ /**
+ * make a Rect object.
+ *
+ * @param parent the parent formatting object
+ * @param propertyList the explicit properties of this object
+ *
+ * @return the Rect object
+ */
+ public FObj make(FObj parent,
+ PropertyList propertyList) throws FOPException {
+ return new Rect(parent, propertyList);
+ }
+ }
+
+ /**
+ * returns the maker for this object.
+ *
+ * @return the maker for Rect objects
+ */
+ public static FObj.Maker maker() {
+ return new Rect.Maker();
+ }
+
+ /**
+ * constructs a Rect object (called by Maker).
+ *
+ * @param parent the parent formatting object
+ * @param propertyList the explicit properties of this object
+ */
+ protected Rect(FObj parent, PropertyList propertyList) {
+ super(parent, propertyList);
+ this.name = "svg:rect";
+ }
+
+ public SVGElement createGraphic() {
+ /* retrieve properties */
+ SVGLength width =
+ ((SVGLengthProperty) this.properties.get("width")).
+ getSVGLength();
+ SVGLength height =
+ ((SVGLengthProperty) this.properties.get("height")).
+ getSVGLength();
+ SVGLength length = new SVGLengthImpl();
+ SVGLength lengthProp =
+ ((SVGLengthProperty) this.properties.get("x")).
+ getSVGLength();
+ SVGLength x = lengthProp == null ? length : lengthProp;
+ lengthProp = ((SVGLengthProperty) this.properties.get("y")).
+ getSVGLength();
+ length = new SVGLengthImpl();
+ SVGLength y = lengthProp == null ? length : lengthProp;
+ lengthProp = ((SVGLengthProperty) this.properties.get("rx")).
+ getSVGLength();
+ length = new SVGLengthImpl();
+ SVGLength rx = lengthProp == null ? length : lengthProp;
+ lengthProp = ((SVGLengthProperty) this.properties.get("ry")).
+ getSVGLength();
+ length = new SVGLengthImpl();
+ SVGLength ry = lengthProp == null ? length : lengthProp;
+ SVGRectElementImpl graph = new SVGRectElementImpl();
+ graph.setX(new SVGAnimatedLengthImpl(x));
+ graph.setY(new SVGAnimatedLengthImpl(y));
+ graph.setRx(new SVGAnimatedLengthImpl(rx));
+ graph.setRy(new SVGAnimatedLengthImpl(ry));
+ graph.setWidth(new SVGAnimatedLengthImpl(width));
+ graph.setHeight(new SVGAnimatedLengthImpl(height));
+ graph.setStyle(
+ ((SVGStyle) this.properties.get("style")).getStyle());
+ graph.setTransform(
+ ((SVGTransform) this.properties.get("transform")).
+ getTransform());
+ graph.setId(this.properties.get("id").getString());
+ return graph;
+ }
}
diff --git a/src/org/apache/fop/svg/SVG.java b/src/org/apache/fop/svg/SVG.java
index 24cc09c4c..4ecc8587a 100644
--- a/src/org/apache/fop/svg/SVG.java
+++ b/src/org/apache/fop/svg/SVG.java
@@ -1,36 +1,36 @@
-/*-- $Id$ --
+/*-- $Id$ --
============================================================================
The Apache Software License, Version 1.1
============================================================================
-
+
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
-
+
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
-
+
4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
-
+
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
-
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -41,12 +41,12 @@
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
-
+
*/
package org.apache.fop.svg;
@@ -61,6 +61,7 @@ import org.apache.fop.apps.FOPException;
import org.apache.fop.dom.svg.*;
import org.w3c.dom.svg.*;
+import org.w3c.dom.svg.SVGLength;
import org.apache.fop.dom.svg.SVGArea;
/**
@@ -68,146 +69,170 @@ import org.apache.fop.dom.svg.SVGArea;
*/
public class SVG extends FObj implements GraphicsCreator {
- /**
- * inner class for making SVG objects.
- */
- public static class Maker extends FObj.Maker {
-
- /**
- * make an SVG object.
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- *
- * @return the SVG object
- */
- public FObj make(FObj parent, PropertyList propertyList)
- throws FOPException {
- return new SVG(parent, propertyList);
- }
- }
-
- /**
- * returns the maker for this object.
- *
- * @return the maker for SVG objects
- */
- public static FObj.Maker maker() {
- return new SVG.Maker();
- }
-
- FontState fs;
- float width;
- float height;
-
- /**
- * constructs an SVG object (called by Maker).
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- */
- public SVG(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
- this.name = "svg:svg";
- }
-
- public SVGElement createGraphic()
- {
- SVGSVGElementImpl svgArea = null;
- SVGLength w = ((SVGLengthProperty)this.properties.get("width")).getSVGLength();
- SVGLength h = ((SVGLengthProperty)this.properties.get("height")).getSVGLength();
- svgArea = new SVGSVGElementImpl();
- SVGAnimatedLength sal;
- sal = new SVGAnimatedLengthImpl(w);
- sal.setBaseVal(w);
- svgArea.setWidth(sal);
- sal = new SVGAnimatedLengthImpl(h);
- sal.setBaseVal(h);
- svgArea.setHeight(sal);
- SVGLength x = ((SVGLengthProperty)this.properties.get("x")).getSVGLength();
- sal = new SVGAnimatedLengthImpl(x);
- sal.setBaseVal(x);
- svgArea.setX(sal);
- SVGLength y = ((SVGLengthProperty)this.properties.get("y")).getSVGLength();
- sal = new SVGAnimatedLengthImpl(y);
- sal.setBaseVal(y);
- svgArea.setY(sal);
-
- svgArea.setStyle(((SVGStyle)this.properties.get("style")).getStyle());
- svgArea.setTransform(((SVGTransform)this.properties.get("transform")).getTransform());
- svgArea.setId(this.properties.get("id").getString());
- int numChildren = this.children.size();
- for (int i = 0; i < numChildren; i++) {
- FONode fo = (FONode) children.elementAt(i);
- if(fo instanceof GraphicsCreator) {
- SVGElement impl = ((GraphicsCreator)fo).createGraphic();
- if(impl != null) {
- if(impl instanceof SVGElementImpl)
- ((SVGElementImpl)impl).setClassName(new SVGAnimatedStringImpl(((FObj)fo).getProperty("class").getString()));
- svgArea.appendChild((org.w3c.dom.Node)impl);
- }
-// } else if(fo instanceof Defs) {
-// svgArea.addDefs(((Defs)fo).createDefs());
- }
- Status status;
- }
- return svgArea;
- }
-
- /**
- * layout this formatting object.
- *
- * @param area the area to layout the object into
- *
- * @return the status of the layout
- */
- public Status layout(Area area) throws FOPException {
-
- if (!(area instanceof ForeignObjectArea)) {
- // this is an error
- throw new FOPException("SVG not in fo:instream-foreign-object");
- }
-
- if (this.marker == BREAK_AFTER) {
- return new Status(Status.OK);
- }
-
- if (this.marker == START) {
- /* retrieve properties */
- String id = this.properties.get("id").getString();
- String fontFamily = this.properties.get("font-family").getString();
- String fontStyle = this.properties.get("font-style").getString();
- String fontWeight = this.properties.get("font-weight").getString();
- int fontSize = this.properties.get("font-size").getLength().mvalue();
-
- this.fs = new FontState(area.getFontInfo(), fontFamily,
- fontStyle, fontWeight, fontSize);
-
- this.width = ((SVGLengthProperty)this.properties.get("width")).getSVGLength().getValue();
- this.height = ((SVGLengthProperty)this.properties.get("height")).getSVGLength().getValue();
-
- this.marker = 0;
- }
-
- /* create an SVG area */
- /* if width and height are zero, may want to get the bounds of the content. */
- SVGArea svg = new SVGArea(fs, width, height);
- SVGDocument doc = new SVGDocumentImpl();
- svg.setSVGDocument(doc);
- svg.start();
-
- /* add the SVG area to the containing area */
- ForeignObjectArea foa = (ForeignObjectArea)area;
- foa.setObject(svg);
- foa.setIntrinsicWidth(svg.getWidth());
- foa.setIntrinsicHeight(svg.getHeight());
-
- doc.appendChild((SVGSVGElement)createGraphic());
-
- /* finish off the SVG area */
- svg.end();
-
- /* return status */
- return new Status(Status.OK);
- }
+ /**
+ * inner class for making SVG objects.
+ */
+ public static class Maker extends FObj.Maker {
+
+ /**
+ * make an SVG object.
+ *
+ * @param parent the parent formatting object
+ * @param propertyList the explicit properties of this object
+ *
+ * @return the SVG object
+ */
+ public FObj make(FObj parent,
+ PropertyList propertyList) throws FOPException {
+ return new SVG(parent, propertyList);
+ }
+ }
+
+ /**
+ * returns the maker for this object.
+ *
+ * @return the maker for SVG objects
+ */
+ public static FObj.Maker maker() {
+ return new SVG.Maker();
+ }
+
+ FontState fs;
+ float width;
+ float height;
+
+ /**
+ * constructs an SVG object (called by Maker).
+ *
+ * @param parent the parent formatting object
+ * @param propertyList the explicit properties of this object
+ */
+ public SVG(FObj parent, PropertyList propertyList) {
+ super(parent, propertyList);
+ this.name = "svg:svg";
+ }
+
+ public SVGElement createGraphic() {
+ SVGSVGElementImpl svgArea = null;
+ SVGLength w = ((SVGLengthProperty) this.properties.get("width")).
+ getSVGLength();
+ SVGLength h = ((SVGLengthProperty) this.properties.get("height")).
+ getSVGLength();
+ svgArea = new SVGSVGElementImpl();
+ SVGAnimatedLength sal;
+ sal = new SVGAnimatedLengthImpl(w);
+ sal.setBaseVal(w);
+ svgArea.setWidth(sal);
+ sal = new SVGAnimatedLengthImpl(h);
+ sal.setBaseVal(h);
+ svgArea.setHeight(sal);
+ SVGLengthProperty lengthProp =
+ (SVGLengthProperty) this.properties.get("x");
+ SVGLength x = lengthProp == null ? new SVGLengthImpl() :
+ lengthProp.getSVGLength();
+ sal = new SVGAnimatedLengthImpl(x);
+ sal.setBaseVal(x);
+ svgArea.setX(sal);
+ lengthProp = (SVGLengthProperty) this.properties.get("y");
+ SVGLength y = lengthProp == null ? new SVGLengthImpl() :
+ lengthProp.getSVGLength();
+ sal = new SVGAnimatedLengthImpl(y);
+ sal.setBaseVal(y);
+ svgArea.setY(sal);
+
+ svgArea.setStyle(
+ ((SVGStyle) this.properties.get("style")).getStyle());
+ svgArea.setTransform(
+ ((SVGTransform) this.properties.get("transform")).
+ getTransform());
+ svgArea.setId(this.properties.get("id").getString());
+ int numChildren = this.children.size();
+ for (int i = 0; i < numChildren; i++) {
+ FONode fo = (FONode) children.elementAt(i);
+ if (fo instanceof GraphicsCreator) {
+ SVGElement impl = ((GraphicsCreator) fo).createGraphic();
+ if (impl != null) {
+ if (impl instanceof SVGElementImpl)
+ ((SVGElementImpl) impl).setClassName(
+ new SVGAnimatedStringImpl(
+ ((FObj) fo).getProperty(
+ "class").getString()));
+ svgArea.appendChild((org.w3c.dom.Node) impl);
+ }
+ // } else if(fo instanceof Defs) {
+ // svgArea.addDefs(((Defs)fo).createDefs());
+ }
+ Status status;
+ }
+ return svgArea;
+ }
+
+ /**
+ * layout this formatting object.
+ *
+ * @param area the area to layout the object into
+ *
+ * @return the status of the layout
+ */
+ public Status layout(Area area) throws FOPException {
+
+ if (!(area instanceof ForeignObjectArea)) {
+ // this is an error
+ throw new FOPException("SVG not in fo:instream-foreign-object");
+ }
+
+ if (this.marker == BREAK_AFTER) {
+ return new Status(Status.OK);
+ }
+
+ if (this.marker == START) {
+ /* retrieve properties */
+ String id = this.properties.get("id").getString();
+ String fontFamily =
+ this.properties.get("font-family").getString();
+ String fontStyle =
+ this.properties.get("font-style").getString();
+ String fontWeight =
+ this.properties.get("font-weight").getString();
+ int fontSize =
+ this.properties.get("font-size").getLength().mvalue();
+
+ this.fs = new FontState(area.getFontInfo(), fontFamily,
+ fontStyle, fontWeight, fontSize);
+ SVGLength length;
+ length = ((SVGLengthProperty) this.properties.get("width")).
+ getSVGLength();
+ if (length == null)
+ length = new SVGLengthImpl();
+ this.width = length.getValue();
+ length = ((SVGLengthProperty) this.properties.get("height")).
+ getSVGLength();
+ if (length == null)
+ length = new SVGLengthImpl();
+ this.height = length.getValue();
+
+ this.marker = 0;
+ }
+
+ /* create an SVG area */
+ /* if width and height are zero, may want to get the bounds of the content. */
+ SVGArea svg = new SVGArea(fs, width, height);
+ SVGDocument doc = new SVGDocumentImpl();
+ svg.setSVGDocument(doc);
+ svg.start();
+
+ /* add the SVG area to the containing area */
+ ForeignObjectArea foa = (ForeignObjectArea) area;
+ foa.setObject(svg);
+ foa.setIntrinsicWidth(svg.getWidth());
+ foa.setIntrinsicHeight(svg.getHeight());
+
+ doc.appendChild((SVGSVGElement) createGraphic());
+
+ /* finish off the SVG area */
+ svg.end();
+
+ /* return status */
+ return new Status(Status.OK);
+ }
}
diff --git a/src/org/apache/fop/svg/SVGLengthProperty.java b/src/org/apache/fop/svg/SVGLengthProperty.java
index e0c68d1a6..1d96f6ead 100644
--- a/src/org/apache/fop/svg/SVGLengthProperty.java
+++ b/src/org/apache/fop/svg/SVGLengthProperty.java
@@ -1,36 +1,36 @@
-/*-- $Id$ --
+/*-- $Id$ --
============================================================================
The Apache Software License, Version 1.1
============================================================================
-
+
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
-
+
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
-
+
4. The names "Fop" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
-
+
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
-
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -41,12 +41,12 @@
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
-
+
*/
package org.apache.fop.svg;
@@ -60,71 +60,75 @@ import org.apache.fop.dom.svg.*;
* a class representing all the length properties in SVG
*/
public class SVGLengthProperty extends Property {
-
- /**
- * inner class for making SVG Length objects.
- */
- public static class Maker extends Property.Maker {
-
- /**
- * whether this property is inherited or not.
- *
- * @return is this inherited?
- */
- public boolean isInherited() { return false; }
-
- /**
- * make an SVG Length property with the given value.
- *
- * @param propertyList the property list this is a member of
- * @param value the explicit string value of the property
- */
- public Property make(PropertyList propertyList, String value)
- throws FOPException {
- SVGLengthImpl len = new SVGLengthImpl();
- len.setValueAsString(value);
- return new SVGLengthProperty(propertyList, len);
- }
-
- /**
- * make an SVG Length property with the default value.
- *
- * @param propertyList the property list the property is a member of
- */
- public Property make(PropertyList propertyList) throws FOPException {
- return make(propertyList, "0pt");
- }
- }
-
- /**
- * returns the maker for this object.
- *
- * @return the maker for SVG Length objects
- */
- public static Property.Maker maker() {
- return new SVGLengthProperty.Maker();
- }
-
- /** the length as a Length object */
- protected SVGLengthImpl value;
-
- /**
- * construct an SVG length (called by the Maker).
- *
- * @param propertyList the property list this is a member of
- * @param explicitValue the explicit value as a Length object
- */
- protected SVGLengthProperty(PropertyList propertyList, SVGLengthImpl explicitValue) {
- this.propertyList = propertyList;
- this.value = explicitValue;
- }
-
- /**
- * get the length
- *
- * @return the length as a Length object
- */
- public SVGLengthImpl getSVGLength() {
- return this.value;
- }
+
+ /**
+ * inner class for making SVG Length objects.
+ */
+ public static class Maker extends Property.Maker {
+
+ /**
+ * whether this property is inherited or not.
+ *
+ * @return is this inherited?
+ */
+ public boolean isInherited() {
+ return false;
+ }
+
+ /**
+ * make an SVG Length property with the given value.
+ *
+ * @param propertyList the property list this is a member of
+ * @param value the explicit string value of the property
+ */
+ public Property make(PropertyList propertyList,
+ String value) throws FOPException {
+ SVGLengthImpl len = new SVGLengthImpl();
+ len.setValueAsString(value);
+ return new SVGLengthProperty(propertyList, len);
+ }
+
+ /**
+ * make an SVG Length property with the default value.
+ *
+ * @param propertyList the property list the property is a member of
+ */
+ public Property make(PropertyList propertyList)
+ throws FOPException {
+ return new SVGLengthProperty(propertyList, null);
+ }
+ }
+
+ /**
+ * returns the maker for this object.
+ *
+ * @return the maker for SVG Length objects
+ */
+ public static Property.Maker maker() {
+ return new SVGLengthProperty.Maker();
+ }
+
+ /** the length as a Length object */
+ protected SVGLengthImpl value;
+
+ /**
+ * construct an SVG length (called by the Maker).
+ *
+ * @param propertyList the property list this is a member of
+ * @param explicitValue the explicit value as a Length object
+ */
+ protected SVGLengthProperty(PropertyList propertyList,
+ SVGLengthImpl explicitValue) {
+ this.propertyList = propertyList;
+ this.value = explicitValue;
+ }
+
+ /**
+ * get the length
+ *
+ * @return the length as a Length object
+ */
+ public SVGLengthImpl getSVGLength() {
+ return this.value;
+ }
}
diff --git a/src/org/apache/fop/svg/SVGPropertyListMapping.java b/src/org/apache/fop/svg/SVGPropertyListMapping.java
index 6be973d17..f375e9a58 100644
--- a/src/org/apache/fop/svg/SVGPropertyListMapping.java
+++ b/src/org/apache/fop/svg/SVGPropertyListMapping.java
@@ -1,36 +1,36 @@
-/*-- $Id$ --
+/*-- $Id$ --
============================================================================
The Apache Software License, Version 1.1
============================================================================
-
+
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
-
+
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
-
+
4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
-
+
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
-
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -41,12 +41,12 @@
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
-
+
*/
package org.apache.fop.svg;
@@ -61,59 +61,61 @@ public class SVGPropertyListMapping implements PropertyListMapping {
public void addToBuilder(TreeBuilder builder) {
- String uri = SVGDocumentImpl.namespaceURI;
- Hashtable propertyTable = new Hashtable();
- propertyTable.put("height",SVGLengthProperty.maker());
- propertyTable.put("width",SVGLengthProperty.maker());
-
- propertyTable.put("x",SVGLengthProperty.maker());
- propertyTable.put("y",SVGLengthProperty.maker());
- propertyTable.put("x1",SVGLengthProperty.maker());
- propertyTable.put("x2",SVGLengthProperty.maker());
- propertyTable.put("y1",SVGLengthProperty.maker());
- propertyTable.put("y2",SVGLengthProperty.maker());
- propertyTable.put("rx",SVGLengthProperty.maker());
- propertyTable.put("ry",SVGLengthProperty.maker());
- propertyTable.put("dx",SVGLengthProperty.maker());
- propertyTable.put("dy",SVGLengthProperty.maker());
- propertyTable.put("cx",SVGLengthProperty.maker());
- propertyTable.put("cy",SVGLengthProperty.maker());
- propertyTable.put("r",SVGLengthProperty.maker());
- propertyTable.put("fx",SVGLengthProperty.maker());
- propertyTable.put("fy",SVGLengthProperty.maker());
- propertyTable.put("refX",SVGLengthProperty.maker());
- propertyTable.put("refY",SVGLengthProperty.maker());
- propertyTable.put("markerWidth",SVGLengthProperty.maker());
- propertyTable.put("markerHeight",SVGLengthProperty.maker());
- propertyTable.put("offset",SVGLengthProperty.maker());
-
-/* propertyTable.put("orient",SVGOrient.maker());*/
- propertyTable.put("xlink:href",HRef.maker());
- propertyTable.put("style",SVGStyle.maker());
- propertyTable.put("transform",SVGTransform.maker());
- propertyTable.put("d",SVGD.maker());
- propertyTable.put("points",SVGPoints.maker());
- propertyTable.put("viewBox",ViewBox.maker());
- propertyTable.put("xml:space",XMLSpace.maker());
-
- propertyTable.put("font-family",FontFamily.maker());
- propertyTable.put("font-style",FontStyle.maker());
- propertyTable.put("font-weight",FontWeight.maker());
- propertyTable.put("font-size",FontSize.maker());
- propertyTable.put("requiredFeatures", RequiredFeatures.maker());
- propertyTable.put("requiredExtensions", RequiredExtensions.maker());
- propertyTable.put("systemLanguage", SystemLanguage.maker());
-
- propertyTable.put("id",Id.maker()); // attribute for objects
- propertyTable.put("class",ElementClass.maker()); // class for styling
-
- builder.addPropertyList(uri, propertyTable);
- propertyTable = new Hashtable();
- propertyTable.put("x",SVGLengthListProperty.maker());
- propertyTable.put("y",SVGLengthListProperty.maker());
- propertyTable.put("dx",SVGLengthListProperty.maker());
- propertyTable.put("dy",SVGLengthListProperty.maker());
- builder.addElementPropertyList(uri, "tref", propertyTable);
- builder.addElementPropertyList(uri, "tspan", propertyTable);
+ String uri = SVGDocumentImpl.namespaceURI;
+ Hashtable propertyTable = new Hashtable();
+ propertyTable.put("height",SVGLengthProperty.maker());
+ propertyTable.put("width",SVGLengthProperty.maker());
+
+ propertyTable.put("x",SVGLengthProperty.maker());
+ propertyTable.put("y",SVGLengthProperty.maker());
+ propertyTable.put("x1",SVGLengthProperty.maker());
+ propertyTable.put("x2",SVGLengthProperty.maker());
+ propertyTable.put("y1",SVGLengthProperty.maker());
+ propertyTable.put("y2",SVGLengthProperty.maker());
+ propertyTable.put("rx",SVGLengthProperty.maker());
+ propertyTable.put("ry",SVGLengthProperty.maker());
+ propertyTable.put("dx",SVGLengthProperty.maker());
+ propertyTable.put("dy",SVGLengthProperty.maker());
+ propertyTable.put("cx",SVGLengthProperty.maker());
+ propertyTable.put("cy",SVGLengthProperty.maker());
+ propertyTable.put("r",SVGLengthProperty.maker());
+ propertyTable.put("fx",SVGLengthProperty.maker());
+ propertyTable.put("fy",SVGLengthProperty.maker());
+ propertyTable.put("refX",SVGLengthProperty.maker());
+ propertyTable.put("refY",SVGLengthProperty.maker());
+ propertyTable.put("markerWidth",SVGLengthProperty.maker());
+ propertyTable.put("markerHeight",SVGLengthProperty.maker());
+ propertyTable.put("offset",SVGLengthProperty.maker());
+
+ /* propertyTable.put("orient",SVGOrient.maker());*/
+ propertyTable.put("xlink:href",HRef.maker());
+ propertyTable.put("style",SVGStyle.maker());
+ propertyTable.put("transform",SVGTransform.maker());
+ propertyTable.put("d",SVGD.maker());
+ propertyTable.put("points",SVGPoints.maker());
+ propertyTable.put("viewBox",ViewBox.maker());
+ propertyTable.put("xml:space",XMLSpace.maker());
+ propertyTable.put("spreadMethod",SpreadMethod.maker());
+ propertyTable.put("gradientUnits",GradientUnits.maker());
+
+ propertyTable.put("font-family",FontFamily.maker());
+ propertyTable.put("font-style",FontStyle.maker());
+ propertyTable.put("font-weight",FontWeight.maker());
+ propertyTable.put("font-size",FontSize.maker());
+ propertyTable.put("requiredFeatures", RequiredFeatures.maker());
+ propertyTable.put("requiredExtensions", RequiredExtensions.maker());
+ propertyTable.put("systemLanguage", SystemLanguage.maker());
+
+ propertyTable.put("id",Id.maker()); // attribute for objects
+ propertyTable.put("class",ElementClass.maker()); // class for styling
+
+ builder.addPropertyList(uri, propertyTable);
+ propertyTable = new Hashtable();
+ propertyTable.put("x",SVGLengthListProperty.maker());
+ propertyTable.put("y",SVGLengthListProperty.maker());
+ propertyTable.put("dx",SVGLengthListProperty.maker());
+ propertyTable.put("dy",SVGLengthListProperty.maker());
+ builder.addElementPropertyList(uri, "tref", propertyTable);
+ builder.addElementPropertyList(uri, "tspan", propertyTable);
}
}
diff --git a/src/org/apache/fop/svg/Text.java b/src/org/apache/fop/svg/Text.java
index 35e6ac964..7984eb03c 100644
--- a/src/org/apache/fop/svg/Text.java
+++ b/src/org/apache/fop/svg/Text.java
@@ -1,36 +1,36 @@
-/*-- $Id$ --
+/*-- $Id$ --
============================================================================
The Apache Software License, Version 1.1
============================================================================
-
+
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
-
+
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
-
+
4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
-
+
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
-
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -41,12 +41,12 @@
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
-
+
*/
package org.apache.fop.svg;
@@ -66,7 +66,8 @@ import org.apache.fop.dom.svg.SVGTextElementImpl;
import org.apache.fop.dom.svg.SVGArea;
import org.apache.fop.dom.CharacterDataImpl;
-import org.w3c.dom.svg.SVGElement;
+import org.w3c.dom.svg.*;
+import org.w3c.dom.svg.SVGLength;
import org.w3c.dom.CharacterData;
/**
@@ -75,110 +76,114 @@ import org.w3c.dom.CharacterData;
*/
public class Text extends SVGObj {
- /**
- * inner class for making SVG Text objects.
- */
- public static class Maker extends FObj.Maker {
-
- /**
- * make an SVG Text object.
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- *
- * @return the SVG Text object
- */
- public FObj make(FObj parent, PropertyList propertyList)
- throws FOPException {
- return new Text(parent, propertyList);
- }
- }
-
- /**
- * returns the maker for this object.
- *
- * @return the maker for SVG Text objects
- */
- public static FObj.Maker maker() {
- return new Text.Maker();
- }
-
- /**
- * the string of text to display
- */
- Vector textList = new Vector();
-
- /**
- * constructs an SVG Text object (called by Maker).
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- */
- protected Text(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
- this.name = "svg:text";
- }
-
- SVGTextElementImpl textGraph = new SVGTextElementImpl();
-
- /**
- * add characters to the string to display.
- *
- * @param data array of characters
- * @param start start offset in character array
- * @param length number of characters to add
- */
- protected void addCharacters(char data[], int start, int length)
- {
- textList.addElement(new String(data, start, length - start));
- }
-
- /**
- * The children need to be added in order so that the text data
- * is also added in order.
- */
- protected void addChild(FONode child) {
- super.addChild(child);
- if(child instanceof TextElement) {
- TextElement te = (TextElement)child;
- SVGElement graph = te.createTextElement();
- textList.addElement(graph);
- } else {
- // error
- }
- }
-
- public SVGElement createGraphic()
- {
- int numChildren = this.textList.size();
- for (int i = 0; i < numChildren; i++) {
- Object obj = textList.elementAt(i);
- if(obj instanceof SVGElement) {
- SVGElement child = (SVGElement)obj;
- textGraph.appendChild(child);
- } else if(obj instanceof String) {
- String str = (String)obj;
- CharacterData cd = new CharacterDataImpl();
- cd.setData(str);
- textGraph.appendChild(cd);
- }
-// System.out.println(child);
- }
- /* retrieve properties */
- textGraph.x = ((SVGLengthProperty)this.properties.get("x")).getSVGLength().getValue();
- textGraph.y = ((SVGLengthProperty)this.properties.get("y")).getSVGLength().getValue();
-// textGraph.textList = textList;
- textGraph.setStyle(((SVGStyle)this.properties.get("style")).getStyle());
- textGraph.setTransform(((SVGTransform)this.properties.get("transform")).getTransform());
- textGraph.setId(this.properties.get("id").getString());
- switch((this.properties.get("xml:space")).getEnum()) {
- case XMLSpace.DEFAULT:
- textGraph.setXMLspace("default");
- break;
- case XMLSpace.PRESERVE:
- textGraph.setXMLspace("preserve");
- break;
- }
- return textGraph;
- }
+ /**
+ * inner class for making SVG Text objects.
+ */
+ public static class Maker extends FObj.Maker {
+
+ /**
+ * make an SVG Text object.
+ *
+ * @param parent the parent formatting object
+ * @param propertyList the explicit properties of this object
+ *
+ * @return the SVG Text object
+ */
+ public FObj make(FObj parent,
+ PropertyList propertyList) throws FOPException {
+ return new Text(parent, propertyList);
+ }
+ }
+
+ /**
+ * returns the maker for this object.
+ *
+ * @return the maker for SVG Text objects
+ */
+ public static FObj.Maker maker() {
+ return new Text.Maker();
+ }
+
+ /**
+ * the string of text to display
+ */
+ Vector textList = new Vector();
+
+ /**
+ * constructs an SVG Text object (called by Maker).
+ *
+ * @param parent the parent formatting object
+ * @param propertyList the explicit properties of this object
+ */
+ protected Text(FObj parent, PropertyList propertyList) {
+ super(parent, propertyList);
+ this.name = "svg:text";
+ }
+
+ SVGTextElementImpl textGraph = new SVGTextElementImpl();
+
+ /**
+ * add characters to the string to display.
+ *
+ * @param data array of characters
+ * @param start start offset in character array
+ * @param length number of characters to add
+ */
+ protected void addCharacters(char data[], int start, int length) {
+ textList.addElement(new String(data, start, length - start));
+ }
+
+ /**
+ * The children need to be added in order so that the text data
+ * is also added in order.
+ */
+ protected void addChild(FONode child) {
+ super.addChild(child);
+ if (child instanceof TextElement) {
+ TextElement te = (TextElement) child;
+ SVGElement graph = te.createTextElement();
+ textList.addElement(graph);
+ } else {
+ // error
+ }
+ }
+
+ public SVGElement createGraphic() {
+ int numChildren = this.textList.size();
+ for (int i = 0; i < numChildren; i++) {
+ Object obj = textList.elementAt(i);
+ if (obj instanceof SVGElement) {
+ SVGElement child = (SVGElement) obj;
+ textGraph.appendChild(child);
+ } else if (obj instanceof String) {
+ String str = (String) obj;
+ CharacterData cd = new CharacterDataImpl();
+ cd.setData(str);
+ textGraph.appendChild(cd);
+ }
+ // System.out.println(child);
+ }
+ /* retrieve properties */
+ SVGLength prop;
+ prop = ((SVGLengthProperty) this.properties.get("x")).getSVGLength();
+ textGraph.x = prop == null ? 0 : prop.getValue();
+ prop = ((SVGLengthProperty) this.properties.get("y")).getSVGLength();
+ textGraph.y = prop == null ? 0 : prop.getValue();
+ // textGraph.textList = textList;
+ textGraph.setStyle(
+ ((SVGStyle) this.properties.get("style")).getStyle());
+ textGraph.setTransform(
+ ((SVGTransform) this.properties.get("transform")).
+ getTransform());
+ textGraph.setId(this.properties.get("id").getString());
+ switch ((this.properties.get("xml:space")).getEnum()) {
+ case XMLSpace.DEFAULT:
+ textGraph.setXMLspace("default");
+ break;
+ case XMLSpace.PRESERVE:
+ textGraph.setXMLspace("preserve");
+ break;
+ }
+ return textGraph;
+ }
}
diff --git a/src/org/apache/fop/svg/Use.java b/src/org/apache/fop/svg/Use.java
index b8efe193c..3254a13d0 100644
--- a/src/org/apache/fop/svg/Use.java
+++ b/src/org/apache/fop/svg/Use.java
@@ -1,36 +1,36 @@
-/*-- $Id$ --
+/*-- $Id$ --
============================================================================
The Apache Software License, Version 1.1
============================================================================
-
+
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
-
+
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
-
+
4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
-
+
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
-
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -41,12 +41,12 @@
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
-
+
*/
package org.apache.fop.svg;
@@ -61,62 +61,82 @@ import org.apache.fop.dom.svg.*;
import org.apache.fop.dom.svg.SVGArea;
import org.w3c.dom.svg.SVGElement;
+import org.w3c.dom.svg.SVGLength;
/**
*
*/
public class Use extends SVGObj {
- /**
- * inner class for making Use objects.
- */
- public static class Maker extends FObj.Maker {
-
- /**
- * make a Use object.
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- *
- * @return the Use object
- */
- public FObj make(FObj parent, PropertyList propertyList) throws FOPException
- {
- return new Use(parent, propertyList);
- }
- }
-
- /**
- * returns the maker for this object.
- *
- * @return the maker for Use objects
- */
- public static FObj.Maker maker() {
- return new Use.Maker();
- }
-
- /**
- * constructs a Use object (called by Maker).
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- */
- protected Use(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
- this.name = "svg:use";
- }
-
- public SVGElement createGraphic()
- {
- String str = this.properties.get("xlink:href").getString();
- SVGUseElementImpl graph = new SVGUseElementImpl(str);
- graph.setStyle(((SVGStyle)this.properties.get("style")).getStyle());
- graph.setTransform(((SVGTransform)this.properties.get("transform")).getTransform());
- graph.setId(this.properties.get("id").getString());
- graph.setX(new SVGAnimatedLengthImpl(((SVGLengthProperty)this.properties.get("x")).getSVGLength()));
- graph.setY(new SVGAnimatedLengthImpl(((SVGLengthProperty)this.properties.get("y")).getSVGLength()));
- graph.setWidth(new SVGAnimatedLengthImpl(((SVGLengthProperty)this.properties.get("width")).getSVGLength()));
- graph.setHeight(new SVGAnimatedLengthImpl(((SVGLengthProperty)this.properties.get("height")).getSVGLength()));
- return graph;
- }
+ /**
+ * inner class for making Use objects.
+ */
+ public static class Maker extends FObj.Maker {
+
+ /**
+ * make a Use object.
+ *
+ * @param parent the parent formatting object
+ * @param propertyList the explicit properties of this object
+ *
+ * @return the Use object
+ */
+ public FObj make(FObj parent,
+ PropertyList propertyList) throws FOPException {
+ return new Use(parent, propertyList);
+ }
+ }
+
+ /**
+ * returns the maker for this object.
+ *
+ * @return the maker for Use objects
+ */
+ public static FObj.Maker maker() {
+ return new Use.Maker();
+ }
+
+ /**
+ * constructs a Use object (called by Maker).
+ *
+ * @param parent the parent formatting object
+ * @param propertyList the explicit properties of this object
+ */
+ protected Use(FObj parent, PropertyList propertyList) {
+ super(parent, propertyList);
+ this.name = "svg:use";
+ }
+
+ public SVGElement createGraphic() {
+ String str = this.properties.get("xlink:href").getString();
+ SVGUseElementImpl graph = new SVGUseElementImpl(str);
+ graph.setStyle(
+ ((SVGStyle) this.properties.get("style")).getStyle());
+ graph.setTransform(
+ ((SVGTransform) this.properties.get("transform")).
+ getTransform());
+ graph.setId(this.properties.get("id").getString());
+ SVGLength length;
+ length = ((SVGLengthProperty) this.properties.get("x")).
+ getSVGLength();
+ if (length == null)
+ length = new SVGLengthImpl();
+ graph.setX(new SVGAnimatedLengthImpl(length));
+ length = ((SVGLengthProperty) this.properties.get("y")).
+ getSVGLength();
+ if (length == null)
+ length = new SVGLengthImpl();
+ graph.setY(new SVGAnimatedLengthImpl(length));
+ length = ((SVGLengthProperty) this.properties.get("width")).
+ getSVGLength();
+ if (length == null)
+ length = new SVGLengthImpl();
+ graph.setWidth(new SVGAnimatedLengthImpl(length));
+ length = ((SVGLengthProperty) this.properties.get("height")).
+ getSVGLength();
+ if (length == null)
+ length = new SVGLengthImpl();
+ graph.setHeight(new SVGAnimatedLengthImpl(length));
+ return graph;
+ }
}