git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193480 13f79535-47bb-0310-9956-ffa450edef68tags/pre-columns
@@ -0,0 +1,128 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
/** | |||
* class representing svg:a pseudo flow object. | |||
* | |||
*/ | |||
public class A extends FObj { | |||
/** | |||
* 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"; | |||
} | |||
/** | |||
* 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 the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a line to the SVGArea */ | |||
// ((SVGArea) area).addGraphic(new AGraphic(x1, y1, x2, y2)); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:a outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -0,0 +1,128 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
/** | |||
* class representing svg:altGlyph pseudo flow object. | |||
* | |||
*/ | |||
public class AltGlyph extends FObj { | |||
/** | |||
* inner class for making AltGlyph objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make a AltGlyph object. | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
* | |||
* @return the AltGlyph object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) throws FOPException | |||
{ | |||
return new AltGlyph(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for AltGlyph objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new AltGlyph.Maker(); | |||
} | |||
/** | |||
* constructs a AltGlyph object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected AltGlyph(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:altGlyph"; | |||
} | |||
/** | |||
* 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 the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a line to the SVGArea */ | |||
// ((SVGArea) area).addGraphic(new AltGlyphGraphic(x1, y1, x2, y2)); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:altGlyph outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -0,0 +1,128 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
/** | |||
* class representing svg:Animate pseudo flow object. | |||
* | |||
*/ | |||
public class Animate extends FObj { | |||
/** | |||
* inner class for making Animate objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make a Animate object. | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
* | |||
* @return the Animate object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) throws FOPException | |||
{ | |||
return new Animate(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for Animate objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new Animate.Maker(); | |||
} | |||
/** | |||
* constructs a Animate object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected Animate(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:animate"; | |||
} | |||
/** | |||
* 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 the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a line to the SVGArea */ | |||
// ((SVGArea) area).addGraphic(new AnimateGraphic(x1, y1, x2, y2)); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:animate outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -0,0 +1,128 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
/** | |||
* class representing svg:AnimateColor pseudo flow object. | |||
* | |||
*/ | |||
public class AnimateColor extends FObj { | |||
/** | |||
* inner class for making AnimateColor objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make a AnimateColor object. | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
* | |||
* @return the AnimateColor object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) throws FOPException | |||
{ | |||
return new AnimateColor(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for AnimateColor objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new AnimateColor.Maker(); | |||
} | |||
/** | |||
* constructs a AnimateColor object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected AnimateColor(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:animateColor"; | |||
} | |||
/** | |||
* 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 the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a AnimateColor to the SVGArea */ | |||
// ((SVGArea) area).addGraphic(new AnimateColorGraphic(x1, y1, x2, y2)); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:animateColor outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -0,0 +1,128 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
/** | |||
* class representing svg:AnimateMotion pseudo flow object. | |||
* | |||
*/ | |||
public class AnimateMotion extends FObj { | |||
/** | |||
* inner class for making AnimateMotion objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make a AnimateMotion object. | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
* | |||
* @return the AnimateMotion object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) throws FOPException | |||
{ | |||
return new AnimateMotion(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for AnimateMotion objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new AnimateMotion.Maker(); | |||
} | |||
/** | |||
* constructs a AnimateMotion object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected AnimateMotion(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:animateMotion"; | |||
} | |||
/** | |||
* 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 the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a AnimateMotion to the SVGArea */ | |||
// ((SVGArea) area).addGraphic(new AnimateMotionGraphic(x1, y1, x2, y2)); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:animateMotion outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -0,0 +1,128 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
/** | |||
* class representing svg:AnimateTransform pseudo flow object. | |||
* | |||
*/ | |||
public class AnimateTransform extends FObj { | |||
/** | |||
* inner class for making AnimateTransform objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make a AnimateTransform object. | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
* | |||
* @return the AnimateTransform object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) throws FOPException | |||
{ | |||
return new AnimateTransform(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for AnimateTransform objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new AnimateTransform.Maker(); | |||
} | |||
/** | |||
* constructs a AnimateTransform object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected AnimateTransform(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:animateTransform"; | |||
} | |||
/** | |||
* 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 the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a line to the SVGArea */ | |||
// ((SVGArea) area).addGraphic(new AnimateTransformGraphic(x1, y1, x2, y2)); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:animateTransform outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -0,0 +1,148 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
import org.apache.fop.fo.*; | |||
import org.apache.fop.layout.Area; | |||
import org.apache.fop.layout.FontState; | |||
import org.apache.fop.apps.FOPException; | |||
import java.util.*; | |||
import org.apache.fop.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
import org.w3c.dom.svg.SVGLength; | |||
/** | |||
* class representing svg:Circle pseudo flow object. | |||
* | |||
*/ | |||
public class Circle extends FObj implements GraphicsCreator { | |||
/** | |||
* 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 GraphicImpl 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(cx); | |||
graph.setCy(cy); | |||
graph.setR(r); | |||
graph.setStyle(((SVGStyle)this.properties.get("style")).getStyle()); | |||
graph.setTransform(((SVGTransform)this.properties.get("transform")).oldgetTransform()); | |||
graph.setId(this.properties.get("id").getString()); | |||
return graph; | |||
} | |||
/** | |||
* 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 the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a line to the SVGArea */ | |||
((SVGArea) area).addGraphic(createGraphic()); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:circle outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -0,0 +1,149 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
/** | |||
* class representing svg:ClipPath pseudo flow object. | |||
* | |||
*/ | |||
public class ClipPath extends FObj implements GraphicsCreator { | |||
/** | |||
* inner class for making ClipPath objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make a ClipPath object. | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
* | |||
* @return the ClipPath object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) throws FOPException | |||
{ | |||
return new ClipPath(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for ClipPath objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new ClipPath.Maker(); | |||
} | |||
/** | |||
* constructs a ClipPath object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected ClipPath(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:clipPath"; | |||
} | |||
SVGClipPathElementImpl clippath = new SVGClipPathElementImpl(); | |||
protected void addChild(FONode child) { | |||
super.addChild(child); | |||
if(child instanceof GraphicsCreator) { | |||
GraphicsCreator gc = (GraphicsCreator)child; | |||
GraphicImpl graph = gc.createGraphic(); | |||
clippath.addElement(graph); | |||
graph.setParent(clippath); | |||
} else { | |||
// error | |||
} | |||
} | |||
public GraphicImpl createGraphic() | |||
{ | |||
clippath.setStyle(((SVGStyle)this.properties.get("style")).getStyle()); | |||
clippath.setId(this.properties.get("id").getString()); | |||
return clippath; | |||
} | |||
/** | |||
* 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 the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a line to the SVGArea */ | |||
((SVGArea) area).addGraphic(createGraphic()); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:clipPath outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -0,0 +1,128 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
/** | |||
* | |||
*/ | |||
public class Cursor extends FObj { | |||
/** | |||
* inner class for making Cursor objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make a Cursor object. | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
* | |||
* @return the Cursor object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) throws FOPException | |||
{ | |||
return new Cursor(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for Cursor objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new Cursor.Maker(); | |||
} | |||
/** | |||
* constructs a Cursor object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected Cursor(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:cursor"; | |||
} | |||
/** | |||
* 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 { | |||
/* retrieve properties */ | |||
/* if the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a line to the SVGArea */ | |||
((SVGArea) area).addGraphic(new SVGCursorElementImpl()); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:cursor outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -0,0 +1,155 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
import org.apache.fop.fo.*; | |||
import org.apache.fop.layout.Area; | |||
import org.apache.fop.layout.FontState; | |||
import org.apache.fop.apps.FOPException; | |||
import java.util.*; | |||
import org.w3c.dom.svg.SVGElement; | |||
import org.apache.fop.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
/** | |||
* class representing svg:Defs pseudo flow object. | |||
* | |||
*/ | |||
public class Defs extends FObj { | |||
/** | |||
* inner class for making Defs objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make a Defs object. | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
* | |||
* @return the Defs object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) throws FOPException | |||
{ | |||
return new Defs(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for Defs objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new Defs.Maker(); | |||
} | |||
/** | |||
* constructs a Defs object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected Defs(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:defs"; | |||
} | |||
Hashtable defs = new Hashtable(); | |||
public Hashtable createDefs() | |||
{ | |||
int numChildren = this.children.size(); | |||
for (int i = 0; i < numChildren; i++) { | |||
FONode child = (FONode) children.elementAt(i); | |||
if(child instanceof GraphicsCreator) { | |||
GraphicImpl gi = ((GraphicsCreator)child).createGraphic(); | |||
if(gi instanceof SVGElement) { | |||
String id = ((SVGElement)gi).getId(); | |||
if(!id.equals("")) { | |||
defs.put(id, gi); | |||
} else { | |||
// no id | |||
System.err.println("WARNING No ID for defs element : " + gi); | |||
} | |||
} | |||
} | |||
} | |||
return defs; | |||
} | |||
/** | |||
* 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 the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a line to the SVGArea */ | |||
((SVGArea) area).addDefs(createDefs()); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:defs outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -22,7 +22,7 @@ | |||
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 | |||
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. | |||
@@ -48,37 +48,73 @@ | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
import org.apache.fop.fo.*; | |||
import org.apache.fop.layout.Area; | |||
import org.apache.fop.layout.FontState; | |||
import org.apache.fop.apps.FOPException; | |||
/** | |||
* class representing a rectangle in an SVG Area | |||
* class representing svg:Desc pseudo flow object. | |||
* | |||
*/ | |||
public class RectGraphic extends Graphic { | |||
public class Desc extends FObj { | |||
/** | |||
* inner class for making Desc objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** x-coordinate of corner */ | |||
public int x; | |||
/** | |||
* make a Desc object. | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
* | |||
* @return the Desc object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) throws FOPException | |||
{ | |||
return new Desc(parent, propertyList); | |||
} | |||
} | |||
/** y-coordinate of corner */ | |||
public int y; | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for Desc objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new Desc.Maker(); | |||
} | |||
/** width of rectangle */ | |||
public int width; | |||
/** | |||
* the desc string | |||
*/ | |||
protected String text = ""; | |||
/** height of rectangle */ | |||
public int height; | |||
/** | |||
* constructs a Desc object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected Desc(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:desc"; | |||
} | |||
/** | |||
* construct a rectangle graphic. | |||
* | |||
* @param x x-coordinate of corner | |||
* @param y y-coordinate of corner | |||
* @param width width of rectangle | |||
* @param height height of rectangle | |||
*/ | |||
public RectGraphic(int x, int y, int width, int height) { | |||
this.x = x; | |||
this.y = y; | |||
this.width = width; | |||
this.height = height; | |||
} | |||
/** | |||
* 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) { | |||
this.text += new String(data, start, length - start); | |||
} | |||
} |
@@ -0,0 +1,149 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
import org.w3c.dom.svg.SVGLength; | |||
/** | |||
* class representing svg:Ellipse pseudo flow object. | |||
* | |||
*/ | |||
public class Ellipse extends FObj implements GraphicsCreator { | |||
/** | |||
* 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 GraphicImpl 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(cx); | |||
graph.setCy(cy); | |||
graph.setRx(rx); | |||
graph.setRy(ry); | |||
graph.setStyle(((SVGStyle)this.properties.get("style")).getStyle()); | |||
graph.setTransform(((SVGTransform)this.properties.get("transform")).oldgetTransform()); | |||
graph.setId(this.properties.get("id").getString()); | |||
return graph; | |||
} | |||
/** | |||
* 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 the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a line to the SVGArea */ | |||
((SVGArea) area).addGraphic(createGraphic()); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:ellipse outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -0,0 +1,129 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
/** | |||
* class representing svg:Filter pseudo flow object. | |||
* | |||
*/ | |||
public class Filter extends FObj { | |||
/** | |||
* inner class for making Filter objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make a Filter object. | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
* | |||
* @return the Filter object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) throws FOPException | |||
{ | |||
return new Filter(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for Filter objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new Filter.Maker(); | |||
} | |||
/** | |||
* constructs a Filter object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected Filter(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:filter"; | |||
} | |||
/** | |||
* 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 { | |||
/* retrieve properties */ | |||
/* if the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a line to the SVGArea */ | |||
((SVGArea) area).addGraphic(new SVGFilterElementImpl()); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:filter outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -0,0 +1,129 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
/** | |||
* class representing svg:Font pseudo flow object. | |||
* | |||
*/ | |||
public class Font extends FObj { | |||
/** | |||
* inner class for making Font objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make a Font object. | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
* | |||
* @return the Font object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) throws FOPException | |||
{ | |||
return new Font(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for Font objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new Font.Maker(); | |||
} | |||
/** | |||
* constructs a Font object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected Font(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:font"; | |||
} | |||
/** | |||
* 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 { | |||
/* retrieve properties */ | |||
/* if the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a line to the SVGArea */ | |||
((SVGArea) area).addGraphic(new SVGFontElementImpl()); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:font outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -0,0 +1,149 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
/** | |||
* class representing svg:G pseudo flow object. | |||
* | |||
*/ | |||
public class G extends FObj implements GraphicsCreator { | |||
/** | |||
* inner class for making G objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make a G object. | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
* | |||
* @return the G object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) throws FOPException | |||
{ | |||
return new G(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for G objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new G.Maker(); | |||
} | |||
/** | |||
* constructs a G object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected G(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:g"; | |||
} | |||
SVGGElementImpl ggraphic = new SVGGElementImpl(); | |||
public GraphicImpl createGraphic() | |||
{ | |||
ggraphic.setTransform(((SVGTransform)this.properties.get("transform")).oldgetTransform()); | |||
ggraphic.setStyle(((SVGStyle)this.properties.get("style")).getStyle()); | |||
ggraphic.setId(this.properties.get("id").getString()); | |||
int numChildren = this.children.size(); | |||
for (int i = 0; i < numChildren; i++) { | |||
FONode child = (FONode) children.elementAt(i); | |||
if(child instanceof GraphicsCreator) { | |||
GraphicImpl impl = ((GraphicsCreator)child).createGraphic(); | |||
ggraphic.addGraphic(impl); | |||
} else if(child instanceof Defs) { | |||
// System.out.println(child); | |||
ggraphic.addDefs(((Defs)child).createDefs()); | |||
} | |||
} | |||
return ggraphic; | |||
} | |||
/** | |||
* 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 the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a G to the SVGArea */ | |||
((SVGArea) area).addGraphic(createGraphic()); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:g outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -0,0 +1,129 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
/** | |||
* class representing svg:Glyph pseudo flow object. | |||
* | |||
*/ | |||
public class Glyph extends FObj { | |||
/** | |||
* inner class for making Glyph objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make a Glyph object. | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
* | |||
* @return the Glyph object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) throws FOPException | |||
{ | |||
return new Glyph(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for Glyph objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new Glyph.Maker(); | |||
} | |||
/** | |||
* constructs a Glyph object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected Glyph(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:glyph"; | |||
} | |||
/** | |||
* 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 { | |||
/* retrieve properties */ | |||
/* if the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a line to the SVGArea */ | |||
((SVGArea) area).addGraphic(new SVGGlyphElementImpl()); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:glyph outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -48,11 +48,14 @@ | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
import org.apache.fop.dom.svg.*; | |||
/** | |||
* base class for SVG graphic objects. | |||
* | |||
* Graphic objects include rectangles, lines and text | |||
*/ | |||
public abstract class Graphic {} | |||
public interface GraphicsCreator { | |||
public GraphicImpl createGraphic(); | |||
} |
@@ -0,0 +1,128 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
/** | |||
* | |||
*/ | |||
public class HKern extends FObj { | |||
/** | |||
* inner class for making HKern objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make a HKern object. | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
* | |||
* @return the HKern object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) throws FOPException | |||
{ | |||
return new HKern(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for HKern objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new HKern.Maker(); | |||
} | |||
/** | |||
* constructs a HKern object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected HKern(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:hkern"; | |||
} | |||
/** | |||
* 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 { | |||
/* retrieve properties */ | |||
/* if the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a line to the SVGArea */ | |||
((SVGArea) area).addGraphic(new SVGHKernElementImpl()); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:hkern outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -0,0 +1,140 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
/** | |||
* class representing svg:Image pseudo flow object. | |||
* | |||
*/ | |||
public class Image extends FObj implements GraphicsCreator { | |||
/** | |||
* 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 GraphicImpl 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; | |||
} | |||
/** | |||
* 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 the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a Image to the SVGArea */ | |||
((SVGArea) area).addGraphic(createGraphic()); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:image outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -54,80 +54,98 @@ package org.apache.fop.svg; | |||
// FOP | |||
import org.apache.fop.fo.*; | |||
import org.apache.fop.messaging.MessageHandler; | |||
import org.apache.fop.fo.properties.*; | |||
//import org.apache.fop.fo.properties.*; | |||
import org.apache.fop.layout.Area; | |||
import org.apache.fop.layout.FontState; | |||
import org.apache.fop.apps.FOPException; | |||
import org.w3c.dom.svg.SVGLength; | |||
import org.apache.fop.dom.svg.*; | |||
//import org.apache.fop.dom.svg.Graphic; | |||
import org.apache.fop.dom.svg.SVGLineElementImpl; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
/** | |||
* class representing svg:line pseudo flow object. | |||
*/ | |||
public class Line extends FObj { | |||
public class Line extends FObj implements GraphicsCreator { | |||
/** | |||
* 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); | |||
} | |||
} | |||
/** | |||
* inner class for making Line objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for Line objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new Line.Maker(); | |||
} | |||
/** | |||
* make a Line object. | |||
* constructs a Line object (called by Maker). | |||
* | |||
* @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); | |||
protected Line(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:line"; | |||
} | |||
} | |||
/** | |||
* 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"; | |||
} | |||
/** | |||
* 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 { | |||
public GraphicImpl 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(x1); | |||
graph.setY1(y1); | |||
graph.setX2(x2); | |||
graph.setY2(y2); | |||
graph.setStyle(((SVGStyle)this.properties.get("style")).getStyle()); | |||
graph.setTransform(((SVGTransform)this.properties.get("transform")).oldgetTransform()); | |||
graph.setId(this.properties.get("id").getString()); | |||
return graph; | |||
} | |||
/* retrieve properties */ | |||
int x1 = this.properties.get("x1").getLength().mvalue(); | |||
int x2 = this.properties.get("x2").getLength().mvalue(); | |||
int y1 = this.properties.get("y1").getLength().mvalue(); | |||
int y2 = this.properties.get("y2").getLength().mvalue(); | |||
/* if the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a line to the SVGArea */ | |||
((SVGArea) area).addGraphic(new LineGraphic(x1, y1, x2, y2)); | |||
} else { | |||
/* otherwise generate a warning */ | |||
/** | |||
* 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 the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a line to the SVGArea */ | |||
((SVGArea) area).addGraphic(createGraphic()); | |||
} else { | |||
/* otherwise generate a warning */ | |||
MessageHandler.errorln("WARNING: svg:line outside svg:svg"); | |||
} | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -0,0 +1,133 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
import org.w3c.dom.svg.*; | |||
/** | |||
* class representing svg:LinearGradient pseudo flow object. | |||
* | |||
*/ | |||
public class LinearGradient extends FObj implements GraphicsCreator { | |||
/** | |||
* 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 GraphicImpl createGraphic() | |||
{ | |||
linear.setStyle(((SVGStyle)this.properties.get("style")).getStyle()); | |||
linear.setTransform(((SVGTransform)this.properties.get("transform")).oldgetTransform()); | |||
linear.setId(this.properties.get("id").getString()); | |||
linear.setX1(((SVGLengthProperty)this.properties.get("x1")).getSVGLength()); | |||
linear.setX2(((SVGLengthProperty)this.properties.get("x2")).getSVGLength()); | |||
linear.setY1(((SVGLengthProperty)this.properties.get("y1")).getSVGLength()); | |||
linear.setY2(((SVGLengthProperty)this.properties.get("y2")).getSVGLength()); | |||
// linear.setSpreadMethod(?); | |||
return linear; | |||
} | |||
} |
@@ -0,0 +1,129 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
/** | |||
* class representing svg:Marker pseudo flow object. | |||
* | |||
*/ | |||
public class Marker extends FObj { | |||
/** | |||
* inner class for making Marker objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make a Marker object. | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
* | |||
* @return the Marker object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) throws FOPException | |||
{ | |||
return new Marker(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for Marker objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new Marker.Maker(); | |||
} | |||
/** | |||
* constructs a Marker object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected Marker(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:marker"; | |||
} | |||
/** | |||
* 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 { | |||
/* retrieve properties */ | |||
/* if the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a line to the SVGArea */ | |||
((SVGArea) area).addGraphic(new SVGMarkerElementImpl()); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:marker outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -0,0 +1,146 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
/** | |||
* class representing svg:Mask pseudo flow object. | |||
* | |||
*/ | |||
public class Mask extends FObj { | |||
/** | |||
* inner class for making Mask objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make a Mask object. | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
* | |||
* @return the Mask object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) throws FOPException | |||
{ | |||
return new Mask(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for Mask objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new Mask.Maker(); | |||
} | |||
/** | |||
* constructs a Mask object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected Mask(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:mask"; | |||
} | |||
SVGMaskElementImpl mask = new SVGMaskElementImpl(); | |||
protected void addChild(FONode child) { | |||
super.addChild(child); | |||
if(child instanceof GraphicsCreator) { | |||
GraphicsCreator gc = (GraphicsCreator)child; | |||
GraphicImpl graph = gc.createGraphic(); | |||
mask.addElement(graph); | |||
graph.setParent(mask); | |||
} else { | |||
// error | |||
} | |||
} | |||
public GraphicImpl createGraphic() | |||
{ | |||
mask.setStyle(((SVGStyle)this.properties.get("style")).getStyle()); | |||
mask.setId(this.properties.get("id").getString()); | |||
return mask; | |||
} | |||
/** | |||
* 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 the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:mask outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -0,0 +1,129 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
/** | |||
* | |||
*/ | |||
public class MissingGlyph extends FObj { | |||
/** | |||
* inner class for making MissingGlyph objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make a MissingGlyph object. | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
* | |||
* @return the MissingGlyph object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) throws FOPException | |||
{ | |||
return new MissingGlyph(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for MissingGlyph objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new MissingGlyph.Maker(); | |||
} | |||
/** | |||
* constructs a MissingGlyph object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected MissingGlyph(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:missing-glyph"; | |||
} | |||
/** | |||
* 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 { | |||
/* retrieve properties */ | |||
/* if the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a line to the SVGArea */ | |||
((SVGArea) area).addGraphic(new SVGMissingGlyphElementImpl()); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:missing-glyph outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -0,0 +1,140 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
import org.apache.fop.fo.*; | |||
import org.apache.fop.layout.Area; | |||
import org.apache.fop.layout.FontState; | |||
import org.apache.fop.apps.FOPException; | |||
import java.util.*; | |||
import org.apache.fop.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
/** | |||
* class representing svg:Path pseudo flow object. | |||
* | |||
*/ | |||
public class Path extends FObj implements GraphicsCreator { | |||
/** | |||
* inner class for making Path objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make a Path object. | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
* | |||
* @return the Path object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) throws FOPException | |||
{ | |||
return new Path(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for Path objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new Path.Maker(); | |||
} | |||
/** | |||
* constructs a Path object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected Path(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:path"; | |||
} | |||
public GraphicImpl createGraphic() | |||
{ | |||
Vector pd = ((SVGD)this.properties.get("d")).getPath(); | |||
SVGPathElementImpl graph = new SVGPathElementImpl(pd); | |||
graph.setStyle(((SVGStyle)this.properties.get("style")).getStyle()); | |||
graph.setTransform(((SVGTransform)this.properties.get("transform")).oldgetTransform()); | |||
graph.setId(this.properties.get("id").getString()); | |||
return graph; | |||
} | |||
/** | |||
* 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 the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a Path to the SVGArea */ | |||
((SVGArea) area).addGraphic(createGraphic()); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:path outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -50,30 +50,12 @@ | |||
*/ | |||
package org.apache.fop.svg; | |||
/** | |||
* class representing text in an SVG Area | |||
*/ | |||
public class TextGraphic extends Graphic { | |||
/** x-coordinate of text */ | |||
public int x; | |||
/** y-coordinate of text */ | |||
public int y; | |||
/** the text string itself */ | |||
public String s; | |||
/** | |||
* construct a text graphic | |||
* | |||
* @param x x-coordinate of text | |||
* @param y y-coordinate of text | |||
* @param s the text string | |||
*/ | |||
public TextGraphic(int x, int y, String s) { | |||
this.x = x; | |||
this.y = y; | |||
this.s = s; | |||
} | |||
public class PathPoint { | |||
public float x; | |||
public float y; | |||
public PathPoint(float p1, float p2) | |||
{ | |||
x = p1; | |||
y = p2; | |||
} | |||
} |
@@ -0,0 +1,130 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
/** | |||
* class representing svg:Pattern pseudo flow object. | |||
* | |||
*/ | |||
public class Pattern extends FObj { | |||
/** | |||
* inner class for making Pattern objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make a Pattern object. | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
* | |||
* @return the Pattern object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) throws FOPException | |||
{ | |||
return new Pattern(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for Pattern objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new Pattern.Maker(); | |||
} | |||
/** | |||
* constructs a Pattern object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected Pattern(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:pattern"; | |||
} | |||
/** | |||
* 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 { | |||
/* retrieve properties */ | |||
/* if the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a Pattern to the SVGArea */ | |||
((SVGArea) area).addGraphic(new SVGPatternElementImpl()); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:pattern outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -0,0 +1,140 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
import org.apache.fop.fo.*; | |||
import org.apache.fop.layout.Area; | |||
import org.apache.fop.layout.FontState; | |||
import org.apache.fop.apps.FOPException; | |||
import java.util.*; | |||
import org.apache.fop.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
/** | |||
* | |||
*/ | |||
public class Polygon extends FObj implements GraphicsCreator { | |||
/** | |||
* inner class for making Polygon objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make a Polygon object. | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
* | |||
* @return the Polygon object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) throws FOPException | |||
{ | |||
return new Polygon(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for Polygon objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new Polygon.Maker(); | |||
} | |||
/** | |||
* constructs a Polygon object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected Polygon(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:polygon"; | |||
} | |||
public GraphicImpl createGraphic() | |||
{ | |||
Vector points = ((SVGPoints)this.properties.get("points")).getPoints(); | |||
SVGPolygonElementImpl graph = new SVGPolygonElementImpl(points); | |||
graph.setStyle(((SVGStyle)this.properties.get("style")).getStyle()); | |||
graph.setTransform(((SVGTransform)this.properties.get("transform")).oldgetTransform()); | |||
graph.setId(this.properties.get("id").getString()); | |||
return graph; | |||
} | |||
/** | |||
* 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 the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a line to the SVGArea */ | |||
((SVGArea) area).addGraphic(createGraphic()); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:polygon outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -0,0 +1,140 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
import org.apache.fop.fo.*; | |||
import org.apache.fop.layout.Area; | |||
import org.apache.fop.layout.FontState; | |||
import org.apache.fop.apps.FOPException; | |||
import java.util.*; | |||
import org.apache.fop.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
/** | |||
* class representing svg:Polyline pseudo flow object. | |||
* | |||
*/ | |||
public class Polyline extends FObj implements GraphicsCreator { | |||
/** | |||
* inner class for making Polyline objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make a Polyline object. | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
* | |||
* @return the Polyline object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) throws FOPException | |||
{ | |||
return new Polyline(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for Polyline objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new Polyline.Maker(); | |||
} | |||
/** | |||
* constructs a Polyline object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected Polyline(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:polyline"; | |||
} | |||
public GraphicImpl createGraphic() | |||
{ | |||
Vector points = ((SVGPoints)this.properties.get("points")).getPoints(); | |||
SVGPolylineElementImpl graph = new SVGPolylineElementImpl(points); | |||
graph.setStyle(((SVGStyle)this.properties.get("style")).getStyle()); | |||
graph.setTransform(((SVGTransform)this.properties.get("transform")).oldgetTransform()); | |||
graph.setId(this.properties.get("id").getString()); | |||
return graph; | |||
} | |||
/** | |||
* 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 the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a Polyline to the SVGArea */ | |||
((SVGArea) area).addGraphic(createGraphic()); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:polyline outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -0,0 +1,157 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
import org.w3c.dom.svg.*; | |||
/** | |||
* class representing svg:RadialGradient pseudo flow object. | |||
* | |||
*/ | |||
public class RadialGradient extends FObj implements GraphicsCreator { | |||
/** | |||
* 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 GraphicImpl createGraphic() | |||
{ | |||
radial.setStyle(((SVGStyle)this.properties.get("style")).getStyle()); | |||
radial.setTransform(((SVGTransform)this.properties.get("transform")).oldgetTransform()); | |||
radial.setId(this.properties.get("id").getString()); | |||
radial.setCx(((SVGLengthProperty)this.properties.get("cx")).getSVGLength()); | |||
radial.setCy(((SVGLengthProperty)this.properties.get("cy")).getSVGLength()); | |||
radial.setR(((SVGLengthProperty)this.properties.get("r")).getSVGLength()); | |||
radial.setFx(((SVGLengthProperty)this.properties.get("fx")).getSVGLength()); | |||
radial.setFy(((SVGLengthProperty)this.properties.get("fy")).getSVGLength()); | |||
return radial; | |||
} | |||
/** | |||
* 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 { | |||
/* retrieve properties */ | |||
/* if the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a RadialGradient to the SVGArea */ | |||
((SVGArea) area).addGraphic(radial); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:radialGradient outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -54,20 +54,27 @@ package org.apache.fop.svg; | |||
// FOP | |||
import org.apache.fop.fo.*; | |||
import org.apache.fop.messaging.MessageHandler; | |||
import org.apache.fop.fo.properties.*; | |||
//import org.apache.fop.fo.properties.*; | |||
import org.apache.fop.layout.Area; | |||
import org.apache.fop.layout.FontState; | |||
import org.apache.fop.apps.FOPException; | |||
import org.apache.fop.dom.svg.*; | |||
//import org.apache.fop.dom.svg.Graphic; | |||
import org.apache.fop.dom.svg.SVGRectElementImpl; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
import org.w3c.dom.svg.SVGLength; | |||
/** | |||
* class representing svg:rect pseudo flow object. | |||
*/ | |||
public class Rect extends FObj { | |||
public class Rect extends FObj implements GraphicsCreator { | |||
/** | |||
* inner class for making Rect objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* inner class for making Rect objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make a Rect object. | |||
@@ -78,56 +85,68 @@ public class Rect extends FObj { | |||
* @return the Rect object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) | |||
throws FOPException { | |||
return new Rect(parent, 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() { | |||
/** | |||
* 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) { | |||
/** | |||
* 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"; | |||
} | |||
} | |||
/** | |||
* 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 { | |||
public GraphicImpl 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(); | |||
SVGRectElementImpl graph = new SVGRectElementImpl(); | |||
graph.setX(x); | |||
graph.setY(y); | |||
graph.setWidth(width); | |||
graph.setHeight(height); | |||
graph.setStyle(((SVGStyle)this.properties.get("style")).getStyle()); | |||
graph.setTransform(((SVGTransform)this.properties.get("transform")).oldgetTransform()); | |||
graph.setId(this.properties.get("id").getString()); | |||
return graph; | |||
} | |||
/* retrieve properties */ | |||
int width = this.properties.get("width").getLength().mvalue(); | |||
int height = this.properties.get("height").getLength().mvalue(); | |||
int x = this.properties.get("x").getLength().mvalue(); | |||
int y = this.properties.get("y").getLength().mvalue(); | |||
/** | |||
* 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 the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a rectangle to the SVGArea */ | |||
((SVGArea) area).addGraphic(new RectGraphic(x, y, width, height)); | |||
/* add a rectangle to the SVGArea */ | |||
((SVGArea) area).addGraphic(createGraphic()); | |||
} else { | |||
/* otherwise generate a warning */ | |||
/* otherwise generate a warning */ | |||
MessageHandler.errorln("WARNING: svg:rect outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} | |||
} |
@@ -59,15 +59,18 @@ import org.apache.fop.layout.BlockArea; | |||
import org.apache.fop.layout.FontState; | |||
import org.apache.fop.apps.FOPException; | |||
import org.apache.fop.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
/** | |||
* class representing svg:svg pseudo flow object. | |||
*/ | |||
public class SVG extends FObj { | |||
public class SVG extends FObj implements GraphicsCreator { | |||
/** | |||
* inner class for making SVG objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* inner class for making SVG objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make an SVG object. | |||
@@ -78,150 +81,209 @@ public class SVG extends FObj { | |||
* @return the SVG object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) | |||
throws FOPException { | |||
return new SVG(parent, 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() { | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for SVG objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new SVG.Maker(); | |||
} | |||
FontState fs; | |||
int breakBefore; | |||
int breakAfter; | |||
int width; | |||
int height; | |||
int spaceBefore; | |||
int spaceAfter; | |||
/** | |||
* 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) { | |||
} | |||
FontState fs; | |||
int breakBefore; | |||
int breakAfter; | |||
float width; | |||
float height; | |||
int spaceBefore; | |||
int spaceAfter; | |||
/** | |||
* 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"; | |||
} | |||
/** | |||
* 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 { | |||
} | |||
/* protected void addChild(FONode child) { | |||
super.addChild(child); | |||
if(svgArea != null) { | |||
Status status; | |||
try { | |||
if ((status = child.layout(svgArea)).isIncomplete()) { | |||
} | |||
} catch(FOPException fope) { | |||
fope.printStackTrace(); | |||
} | |||
} | |||
}*/ | |||
SVGArea svgArea = null; | |||
public GraphicImpl createGraphic() | |||
{ | |||
this.width = ((SVGLengthProperty)this.properties.get("width")).getSVGLength().getValue(); | |||
this.height = ((SVGLengthProperty)this.properties.get("height")).getSVGLength().getValue(); | |||
svgArea = new SVGArea(null, width, height); | |||
svgArea.setStyle(((SVGStyle)this.properties.get("style")).getStyle()); | |||
svgArea.setTransform(((SVGTransform)this.properties.get("transform")).oldgetTransform()); | |||
// 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) { | |||
GraphicImpl impl = ((GraphicsCreator)fo).createGraphic(); | |||
svgArea.addGraphic(impl); | |||
} else if(fo instanceof Defs) { | |||
svgArea.addDefs(((Defs)fo).createDefs()); | |||
} | |||
Status status; | |||
/* try { | |||
if ((status = fo.layout(svgArea)).isIncomplete()) { | |||
// return null; | |||
} | |||
} catch(FOPException fope) { | |||
fope.printStackTrace(); | |||
}*/ | |||
} | |||
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 SVGArea) { | |||
((SVGArea) area).addGraphic(createGraphic()); | |||
return new Status(Status.OK); | |||
} | |||
if (this.marker == BREAK_AFTER) { | |||
return new Status(Status.OK); | |||
return new Status(Status.OK); | |||
} | |||
if (this.marker == START) { | |||
/* retrieve properties */ | |||
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, | |||
/* 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.breakBefore = this.properties.get("break-before").getEnum(); | |||
this.breakAfter = this.properties.get("break-after").getEnum(); | |||
this.width = this.properties.get("width").getLength().mvalue(); | |||
this.height = this.properties.get("height").getLength().mvalue(); | |||
this.spaceBefore = | |||
this.breakBefore = this.properties.get("break-before").getEnum(); | |||
this.breakAfter = this.properties.get("break-after").getEnum(); | |||
Property prop = this.properties.get("width"); | |||
// if(prop instanceof SVGLengthProperty) | |||
this.width = ((SVGLengthProperty)this.properties.get("width")).getSVGLength().getValue(); | |||
// else | |||
// this.width = 0; | |||
prop = this.properties.get("height"); | |||
// if(prop instanceof SVGLengthProperty) | |||
this.height = ((SVGLengthProperty)this.properties.get("height")).getSVGLength().getValue(); | |||
// else | |||
// this.height = 0; | |||
this.spaceBefore = | |||
this.properties.get("space-before.optimum").getLength().mvalue(); | |||
this.spaceAfter = | |||
this.spaceAfter = | |||
this.properties.get("space-after.optimum").getLength().mvalue(); | |||
/* if the SVG is embedded in a block area */ | |||
if (area instanceof BlockArea) { | |||
/* if the SVG is embedded in a block area */ | |||
if (area instanceof BlockArea) { | |||
/* temporarily end the block area */ | |||
area.end(); | |||
} | |||
this.marker = 0; | |||
} | |||
this.marker = 0; | |||
if (breakBefore == BreakBefore.PAGE) { | |||
if (breakBefore == BreakBefore.PAGE || ((this.height * 1000 + area.getHeight()) > area.getMaxHeight())) { | |||
return new Status(Status.FORCE_PAGE_BREAK); | |||
} | |||
} | |||
if (breakBefore == BreakBefore.ODD_PAGE) { | |||
if (breakBefore == BreakBefore.ODD_PAGE) { | |||
return new Status(Status.FORCE_PAGE_BREAK_ODD); | |||
} | |||
} | |||
if (breakBefore == BreakBefore.EVEN_PAGE) { | |||
if (breakBefore == BreakBefore.EVEN_PAGE) { | |||
return new Status(Status.FORCE_PAGE_BREAK_EVEN); | |||
} | |||
} | |||
} | |||
/* if there is a space-before */ | |||
if (spaceBefore != 0) { | |||
/* add a display space */ | |||
area.addDisplaySpace(spaceBefore); | |||
/* add a display space */ | |||
area.addDisplaySpace(spaceBefore); | |||
} | |||
/* create an SVG area */ | |||
SVGArea svgArea = new SVGArea(fs, width, height); | |||
svgArea.start(); | |||
SVGArea svg = new SVGArea(fs, width, height); | |||
svg.setStyle(((SVGStyle)this.properties.get("style")).getStyle()); | |||
svg.setTransform(((SVGTransform)this.properties.get("transform")).oldgetTransform()); | |||
svg.start(); | |||
/* add the SVG area to the containing area */ | |||
area.addChild(svgArea); | |||
area.addChild(svg); | |||
/* iterate over the child formatting objects and lay them out | |||
into the SVG area */ | |||
int numChildren = this.children.size(); | |||
for (int i = 0; i < numChildren; i++) { | |||
FONode fo = (FONode) children.elementAt(i); | |||
Status status; | |||
if ((status = fo.layout(svgArea)).isIncomplete()) { | |||
FONode fo = (FONode) children.elementAt(i); | |||
Status status; | |||
if ((status = fo.layout(svg)).isIncomplete()) { | |||
return status; | |||
} | |||
} | |||
} | |||
/* finish off the SVG area */ | |||
svgArea.end(); | |||
svg.end(); | |||
/* increase the height of the containing area accordingly */ | |||
area.increaseHeight(svgArea.getHeight()); | |||
area.increaseHeight(svg.getHeight()); | |||
/* if there is a space-after */ | |||
if (spaceAfter != 0) { | |||
/* add a display space */ | |||
area.addDisplaySpace(spaceAfter); | |||
/* add a display space */ | |||
area.addDisplaySpace(spaceAfter); | |||
} | |||
/* if the SVG is embedded in a block area */ | |||
if (area instanceof BlockArea) { | |||
/* re-start the block area */ | |||
area.start(); | |||
/* re-start the block area */ | |||
area.start(); | |||
} | |||
if (breakAfter == BreakAfter.PAGE) { | |||
this.marker = BREAK_AFTER; | |||
return new Status(Status.FORCE_PAGE_BREAK); | |||
this.marker = BREAK_AFTER; | |||
return new Status(Status.FORCE_PAGE_BREAK); | |||
} | |||
if (breakAfter == BreakAfter.ODD_PAGE) { | |||
this.marker = BREAK_AFTER; | |||
return new Status(Status.FORCE_PAGE_BREAK_ODD); | |||
this.marker = BREAK_AFTER; | |||
return new Status(Status.FORCE_PAGE_BREAK_ODD); | |||
} | |||
if (breakAfter == BreakAfter.EVEN_PAGE) { | |||
this.marker = BREAK_AFTER; | |||
return new Status(Status.FORCE_PAGE_BREAK_EVEN); | |||
this.marker = BREAK_AFTER; | |||
return new Status(Status.FORCE_PAGE_BREAK_EVEN); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} | |||
} |
@@ -0,0 +1,129 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
import org.apache.fop.fo.*; | |||
import org.apache.fop.datatypes.*; | |||
import org.apache.fop.apps.FOPException; | |||
import java.util.*; | |||
/** | |||
* | |||
*/ | |||
public class SVGD 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 { | |||
return new SVGD(propertyList, new PathData(value)); | |||
} | |||
/** | |||
* 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, ""); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for SVG Length objects | |||
*/ | |||
public static Property.Maker maker() { | |||
return new SVGD.Maker(); | |||
} | |||
protected PathData style; | |||
/** | |||
* 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 SVGD(PropertyList propertyList, PathData explicitValue) { | |||
this.propertyList = propertyList; | |||
this.style = explicitValue; | |||
} | |||
/** | |||
* get the length | |||
* | |||
* @return the length as a Length object | |||
*/ | |||
public Vector getPath() | |||
{ | |||
return this.style.getPath(); | |||
} | |||
} |
@@ -55,11 +55,55 @@ import org.apache.fop.fo.ElementMapping; | |||
public class SVGElementMapping implements ElementMapping { | |||
public void addToBuilder(FOTreeBuilder builder) { | |||
String uri = "http://www.w3.org/Graphics/SVG/SVG-19990812.dtd"; | |||
builder.addMapping(uri, "svg", SVG.maker()); | |||
builder.addMapping(uri, "rect", Rect.maker()); | |||
builder.addMapping(uri, "line", Line.maker()); | |||
builder.addMapping(uri, "text", Text.maker()); | |||
} | |||
public void addToBuilder(FOTreeBuilder builder) { | |||
String uri = "http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/svg-20000303-stylable.dtd"; | |||
builder.addMapping(uri, "svg", SVG.maker()); | |||
builder.addMapping(uri, "rect", Rect.maker()); | |||
builder.addMapping(uri, "line", Line.maker()); | |||
builder.addMapping(uri, "text", Text.maker()); | |||
builder.addMapping(uri, "desc", Desc.maker()); | |||
builder.addMapping(uri, "title", Title.maker()); | |||
builder.addMapping(uri, "circle", Circle.maker()); | |||
builder.addMapping(uri, "ellipse", Ellipse.maker()); | |||
builder.addMapping(uri, "g", G.maker()); | |||
builder.addMapping(uri, "polyline", Polyline.maker()); | |||
builder.addMapping(uri, "polygon", Polygon.maker()); | |||
builder.addMapping(uri, "defs", Defs.maker()); | |||
builder.addMapping(uri, "path", Path.maker()); | |||
builder.addMapping(uri, "use", Use.maker()); | |||
builder.addMapping(uri, "tspan", TSpan.maker()); | |||
builder.addMapping(uri, "tref", TRef.maker()); | |||
builder.addMapping(uri, "image", Image.maker()); | |||
// elements in progress | |||
builder.addMapping(uri, "textPath", TextPath.maker()); | |||
builder.addMapping(uri, "clipPath", ClipPath.maker()); | |||
builder.addMapping(uri, "mask", Mask.maker()); | |||
builder.addMapping(uri, "linearGradient", LinearGradient.maker()); | |||
builder.addMapping(uri, "radialGradient", RadialGradient.maker()); | |||
builder.addMapping(uri, "stop", Stop.maker()); | |||
// elements below will not work | |||
builder.addMapping(uri, "a", A.maker()); | |||
builder.addMapping(uri, "pattern", Pattern.maker()); | |||
builder.addMapping(uri, "marker", Marker.maker()); | |||
builder.addMapping(uri, "switch", Switch.maker()); | |||
builder.addMapping(uri, "animate", Animate.maker()); | |||
builder.addMapping(uri, "altGlyph", AltGlyph.maker()); | |||
builder.addMapping(uri, "font", Font.maker()); | |||
builder.addMapping(uri, "glyph", Glyph.maker()); | |||
builder.addMapping(uri, "missing-glyph", MissingGlyph.maker()); | |||
builder.addMapping(uri, "hkern", HKern.maker()); | |||
builder.addMapping(uri, "vkern", VKern.maker()); | |||
builder.addMapping(uri, "symbol", Symbol.maker()); | |||
builder.addMapping(uri, "set", Set.maker()); | |||
builder.addMapping(uri, "animateMotion", AnimateMotion.maker()); | |||
builder.addMapping(uri, "animateColor", AnimateColor.maker()); | |||
builder.addMapping(uri, "animateTransform", AnimateTransform.maker()); | |||
builder.addMapping(uri, "style", Style.maker()); | |||
builder.addMapping(uri, "cursor", Cursor.maker()); | |||
builder.addMapping(uri, "filter", Filter.maker()); | |||
} | |||
} |
@@ -0,0 +1,132 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
import java.util.*; | |||
// FOP | |||
import org.apache.fop.fo.*; | |||
import org.apache.fop.datatypes.*; | |||
import org.apache.fop.apps.FOPException; | |||
import org.apache.fop.dom.svg.*; | |||
/** | |||
* a class representing all the length properties in SVG | |||
*/ | |||
public class SVGLengthListProperty 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 { | |||
SVGLengthListImpl len = new SVGLengthListImpl(); | |||
len.setValueAsString(value); | |||
return new SVGLengthListProperty(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 SVGLengthListProperty.Maker(); | |||
} | |||
/** the length as a Length object */ | |||
protected SVGLengthListImpl 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 SVGLengthListProperty(PropertyList propertyList, SVGLengthListImpl explicitValue) { | |||
this.propertyList = propertyList; | |||
this.value = explicitValue; | |||
} | |||
/** | |||
* get the length | |||
* | |||
* @return the length as a Length object | |||
*/ | |||
public /*SVGLengthList*/Vector getSVGLengthList() { | |||
return this.value.valueList(); | |||
} | |||
} |
@@ -0,0 +1,130 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
import org.apache.fop.fo.*; | |||
import org.apache.fop.datatypes.*; | |||
import org.apache.fop.apps.FOPException; | |||
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; | |||
} | |||
} |
@@ -0,0 +1,129 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
import org.apache.fop.fo.*; | |||
import org.apache.fop.datatypes.*; | |||
import org.apache.fop.apps.FOPException; | |||
import java.util.*; | |||
/** | |||
* | |||
*/ | |||
public class SVGPoints 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 { | |||
return new SVGPoints(propertyList, new PointsData(value)); | |||
} | |||
/** | |||
* 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, ""); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for SVG Length objects | |||
*/ | |||
public static Property.Maker maker() { | |||
return new SVGPoints.Maker(); | |||
} | |||
protected PointsData style; | |||
/** | |||
* 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 SVGPoints(PropertyList propertyList, PointsData explicitValue) { | |||
this.propertyList = propertyList; | |||
this.style = explicitValue; | |||
} | |||
/** | |||
* get the length | |||
* | |||
* @return the length as a Length object | |||
*/ | |||
public Vector getPoints() | |||
{ | |||
return this.style.getPoints(); | |||
} | |||
} |
@@ -50,20 +50,23 @@ | |||
*/ | |||
package org.apache.fop.svg; | |||
import java.util.*; | |||
// FOP | |||
import org.apache.fop.fo.*; | |||
import org.apache.fop.datatypes.*; | |||
import org.apache.fop.apps.FOPException; | |||
import org.apache.fop.dom.svg.*; | |||
/** | |||
* a class representing all the length properties in SVG | |||
*/ | |||
public class SVGLength extends Property { | |||
public class SVGStringProperty extends Property { | |||
/** | |||
* inner class for making SVG Length objects. | |||
*/ | |||
public static class Maker extends Property.Maker { | |||
/** | |||
* inner class for making SVG Length objects. | |||
*/ | |||
public static class Maker extends Property.Maker { | |||
/** | |||
* whether this property is inherited or not. | |||
@@ -79,49 +82,49 @@ public class SVGLength extends Property { | |||
* @param value the explicit string value of the property | |||
*/ | |||
public Property make(PropertyList propertyList, String value) | |||
throws FOPException { | |||
return new SVGLength(propertyList, new Length(value)); | |||
throws FOPException { | |||
return new SVGStringProperty(propertyList, value); | |||
} | |||
/** | |||
* 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"); | |||
return make(propertyList, ""); | |||
} | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for SVG Length objects | |||
*/ | |||
public static Property.Maker maker() { | |||
return new SVGLength.Maker(); | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for SVG Length objects | |||
*/ | |||
public static Property.Maker maker() { | |||
return new SVGStringProperty.Maker(); | |||
} | |||
/** the length as a Length object */ | |||
protected Length value; | |||
/** the length as a Length object */ | |||
protected String 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 SVGLength(PropertyList propertyList, Length explicitValue) { | |||
/** | |||
* 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 SVGStringProperty(PropertyList propertyList, String explicitValue) { | |||
this.propertyList = propertyList; | |||
this.value = explicitValue; | |||
} | |||
} | |||
/** | |||
* get the length | |||
* | |||
* @return the length as a Length object | |||
*/ | |||
public Length getLength() { | |||
return this.value; | |||
} | |||
/** | |||
* get the length | |||
* | |||
* @return the length as a Length object | |||
*/ | |||
public String getString() { | |||
return this.value; | |||
} | |||
} |
@@ -0,0 +1,129 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
import org.apache.fop.fo.*; | |||
import org.apache.fop.datatypes.*; | |||
import org.apache.fop.apps.FOPException; | |||
import java.util.*; | |||
/** | |||
* | |||
*/ | |||
public class SVGStyle 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 { | |||
return new SVGStyle(propertyList, new StyleData(value)); | |||
} | |||
/** | |||
* 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, ""); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for SVG Length objects | |||
*/ | |||
public static Property.Maker maker() { | |||
return new SVGStyle.Maker(); | |||
} | |||
protected StyleData style; | |||
/** | |||
* 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 SVGStyle(PropertyList propertyList, StyleData explicitValue) { | |||
this.propertyList = propertyList; | |||
this.style = explicitValue; | |||
} | |||
/** | |||
* get the length | |||
* | |||
* @return the length as a Length object | |||
*/ | |||
public Hashtable getStyle() | |||
{ | |||
return this.style.getStyle(); | |||
} | |||
} |
@@ -0,0 +1,126 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
import org.apache.fop.fo.*; | |||
import org.apache.fop.datatypes.*; | |||
import org.apache.fop.apps.FOPException; | |||
import java.util.*; | |||
/** | |||
* | |||
*/ | |||
public class SVGTransform 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 { | |||
return new SVGTransform(propertyList, new TransformData(value)); | |||
} | |||
/** | |||
* 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, ""); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for SVG Length objects | |||
*/ | |||
public static Property.Maker maker() { | |||
return new SVGTransform.Maker(); | |||
} | |||
protected TransformData trans; | |||
/** | |||
* | |||
* @param propertyList the property list this is a member of | |||
* @param explicitValue the explicit value as a Length object | |||
*/ | |||
protected SVGTransform(PropertyList propertyList, TransformData explicitValue) { | |||
this.propertyList = propertyList; | |||
this.trans = explicitValue; | |||
} | |||
/** | |||
* | |||
* @return the length as a Length object | |||
*/ | |||
public Vector oldgetTransform() { | |||
return this.trans.oldgetTransform(); | |||
} | |||
} |
@@ -0,0 +1,130 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
/** | |||
* class representing svg:Set pseudo flow object. | |||
* | |||
*/ | |||
public class Set extends FObj { | |||
/** | |||
* inner class for making Set objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make a Set object. | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
* | |||
* @return the Set object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) throws FOPException | |||
{ | |||
return new Set(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for Set objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new Set.Maker(); | |||
} | |||
/** | |||
* constructs a Set object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected Set(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:set"; | |||
} | |||
/** | |||
* 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 { | |||
/* retrieve properties */ | |||
/* if the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a Set to the SVGArea */ | |||
((SVGArea) area).addGraphic(new SVGSetElementImpl()); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:set outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -0,0 +1,120 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
import org.w3c.dom.svg.*; | |||
import org.w3c.dom.svg.SVGLength; | |||
/** | |||
* class representing svg:Stop pseudo flow object. | |||
* | |||
*/ | |||
public class Stop extends FObj { | |||
/** | |||
* inner class for making Stop objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make a Stop object. | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
* | |||
* @return the Stop object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) throws FOPException | |||
{ | |||
return new Stop(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for Stop objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new Stop.Maker(); | |||
} | |||
/** | |||
* constructs a Stop object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected Stop(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:stop"; | |||
} | |||
public SVGStopElement createStop() | |||
{ | |||
SVGStopElementImpl sse = new SVGStopElementImpl(); | |||
sse.setStyle(((SVGStyle)this.properties.get("style")).getStyle()); | |||
SVGLength offset = ((SVGLengthProperty)this.properties.get("offset")).getSVGLength(); | |||
sse.setOffset(offset.getValue()); // what about percentages | |||
sse.setId(this.properties.get("id").getString()); | |||
return sse; | |||
} | |||
} |
@@ -0,0 +1,129 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
/** | |||
* class representing svg:Style pseudo flow object. | |||
* | |||
*/ | |||
public class Style extends FObj { | |||
/** | |||
* inner class for making Style objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make a Style object. | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
* | |||
* @return the Style object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) throws FOPException | |||
{ | |||
return new Style(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for Style objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new Style.Maker(); | |||
} | |||
/** | |||
* constructs a Style object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected Style(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:style"; | |||
} | |||
/** | |||
* 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 { | |||
/* retrieve properties */ | |||
/* if the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a Style to the SVGArea */ | |||
((SVGArea) area).addGraphic(new SVGStyleElementImpl()); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:style outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -0,0 +1,131 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
/** | |||
* | |||
*/ | |||
public class Switch extends FObj { | |||
/** | |||
* 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 Switch(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for Switch objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new Switch.Maker(); | |||
} | |||
/** | |||
* constructs a Switch object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected Switch(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:switch"; | |||
} | |||
/** | |||
* 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 { | |||
/* retrieve properties */ | |||
String sr = this.properties.get("system-required").getString(); | |||
String sl = this.properties.get("system-language").getString(); | |||
/* if the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a line to the SVGArea */ | |||
((SVGArea) area).addGraphic(new SVGSwitchElementImpl(sr, sl)); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:switch outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -0,0 +1,128 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
/** | |||
* | |||
*/ | |||
public class Symbol extends FObj { | |||
/** | |||
* inner class for making Symbol objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make a Symbol object. | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
* | |||
* @return the Symbol object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) throws FOPException | |||
{ | |||
return new Symbol(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for Symbol objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new Symbol.Maker(); | |||
} | |||
/** | |||
* constructs a Symbol object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected Symbol(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:symbol"; | |||
} | |||
/** | |||
* 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 { | |||
/* retrieve properties */ | |||
/* if the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a line to the SVGArea */ | |||
((SVGArea) area).addGraphic(new SVGSymbolElementImpl()); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:symbol outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -0,0 +1,155 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
/** | |||
* | |||
*/ | |||
public class TRef extends FObj implements TextElement { | |||
/** | |||
* 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 TRef(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for TRef objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new TRef.Maker(); | |||
} | |||
/** | |||
* constructs a TRef object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected TRef(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:tref"; | |||
} | |||
public GraphicImpl createTextElement() | |||
{ | |||
SVGTRefElementImpl tref = new SVGTRefElementImpl(); | |||
tref.setStyle(((SVGStyle)this.properties.get("style")).getStyle()); | |||
// tref.dx = ((SVGLengthProperty)this.properties.get("dx")).getSVGLength().mvalue(); | |||
// tref.dy = ((SVGLengthProperty)this.properties.get("dy")).getSVGLength().mvalue(); | |||
// tref.x = ((SVGLengthProperty)this.properties.get("x")).getSVGLength().mvalue(); | |||
// tref.y = ((SVGLengthProperty)this.properties.get("y")).getSVGLength().mvalue(); | |||
Property prop; | |||
prop = this.properties.get("x"); | |||
// bit of a hack, but otherwise the svg:text x element could be | |||
// returned which is not a list | |||
if(prop instanceof SVGLengthListProperty) | |||
tref.xlist = ((SVGLengthListProperty)prop).getSVGLengthList(); | |||
prop = this.properties.get("y"); | |||
if(prop instanceof SVGLengthListProperty) | |||
tref.ylist = ((SVGLengthListProperty)prop).getSVGLengthList(); | |||
prop = this.properties.get("dx"); | |||
if(prop instanceof SVGLengthListProperty) | |||
tref.dxlist = ((SVGLengthListProperty)prop).getSVGLengthList(); | |||
prop = this.properties.get("dy"); | |||
if(prop instanceof SVGLengthListProperty) | |||
tref.dylist = ((SVGLengthListProperty)prop).getSVGLengthList(); | |||
// tref.dxlist = ((SVGLengthProperty)this.properties.get("dx")).getSVGLength().valueList(); | |||
tref.ref = this.properties.get("xlink:href").getString(); | |||
tref.setId(this.properties.get("id").getString()); | |||
return tref; | |||
} | |||
/** | |||
* 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 the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a line to the SVGArea */ | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:tref outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -0,0 +1,170 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
/** | |||
* class representing svg:tspan pseudo flow object. | |||
* | |||
*/ | |||
public class TSpan extends FObj implements TextElement { | |||
/** | |||
* inner class for making tspan 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 TSpan(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for Line objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new TSpan.Maker(); | |||
} | |||
SVGTSpanElementImpl tspan = new SVGTSpanElementImpl(); | |||
String text = ""; | |||
/** | |||
* 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) | |||
{ | |||
this.text += new String(data, start, length - start); | |||
tspan.str = this.text.trim(); | |||
} | |||
/** | |||
* constructs a TSpan object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected TSpan(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:tspan"; | |||
} | |||
public GraphicImpl createTextElement() | |||
{ | |||
tspan.setStyle(((SVGStyle)this.properties.get("style")).getStyle()); | |||
// tspan.dx = ((SVGLengthProperty)this.properties.get("dx")).getSVGLength().mvalue(); | |||
// tspan.dy = ((SVGLengthProperty)this.properties.get("dy")).getSVGLength().mvalue(); | |||
// tspan.x = ((SVGLengthListProperty)this.properties.get("x")).getSVGLength().mvalue(); | |||
// tspan.y = ((SVGLengthProperty)this.properties.get("y")).getSVGLength().mvalue(); | |||
Property prop; | |||
prop = this.properties.get("x"); | |||
// bit of a hack, but otherwise the svg:text x element coud be | |||
// returned which is not a list | |||
if(prop instanceof SVGLengthListProperty) | |||
tspan.xlist = ((SVGLengthListProperty)prop).getSVGLengthList(); | |||
prop = this.properties.get("y"); | |||
if(prop instanceof SVGLengthListProperty) | |||
tspan.ylist = ((SVGLengthListProperty)prop).getSVGLengthList(); | |||
prop = this.properties.get("dx"); | |||
if(prop instanceof SVGLengthListProperty) | |||
tspan.dxlist = ((SVGLengthListProperty)prop).getSVGLengthList(); | |||
prop = this.properties.get("dy"); | |||
if(prop instanceof SVGLengthListProperty) | |||
tspan.dylist = ((SVGLengthListProperty)prop).getSVGLengthList(); | |||
// tspan.xlist = ((SVGLengthListProperty)this.properties.get("x")).getSVGLengthList(); | |||
// tspan.dxlist = ((SVGLengthProperty)this.properties.get("dx")).getSVGLength().valueList(); | |||
tspan.setId(this.properties.get("id").getString()); | |||
return tspan; | |||
} | |||
/** | |||
* 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 the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a line to the SVGArea */ | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:tspan outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -54,20 +54,26 @@ package org.apache.fop.svg; | |||
// FOP | |||
import org.apache.fop.fo.*; | |||
import org.apache.fop.messaging.MessageHandler; | |||
import org.apache.fop.fo.properties.*; | |||
import org.apache.fop.layout.Area; | |||
import org.apache.fop.layout.FontState; | |||
import org.apache.fop.apps.FOPException; | |||
import java.util.*; | |||
import org.apache.fop.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGTextElementImpl; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
/** | |||
* class representing svg:text pseudo flow object. | |||
* | |||
*/ | |||
public class Text extends FObjMixed { | |||
public class Text extends FObjMixed implements GraphicsCreator { | |||
/** | |||
* inner class for making SVG Text objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* inner class for making SVG Text objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make an SVG Text object. | |||
@@ -78,70 +84,93 @@ public class Text extends FObjMixed { | |||
* @return the SVG Text object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) | |||
throws FOPException { | |||
return new Text(parent, 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() { | |||
/** | |||
* 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 | |||
*/ | |||
protected String text = ""; | |||
/** | |||
* 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) { | |||
} | |||
/** | |||
* 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"; | |||
} | |||
/** | |||
* 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) { | |||
this.text += new String(data, start, length); | |||
} | |||
/** | |||
* 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 { | |||
/* retrieve properties */ | |||
int x = this.properties.get("x").getLength().mvalue(); | |||
int y = this.properties.get("y").getLength().mvalue(); | |||
} | |||
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).trim()); | |||
} | |||
protected void addChild(FONode child) { | |||
super.addChild(child); | |||
if(child instanceof TextElement) { | |||
TextElement te = (TextElement)child; | |||
GraphicImpl graph = te.createTextElement(); | |||
textList.addElement(graph); | |||
graph.setParent(textGraph); | |||
} else { | |||
// error | |||
} | |||
} | |||
public GraphicImpl createGraphic() | |||
{ | |||
/* 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")).oldgetTransform()); | |||
textGraph.setId(this.properties.get("id").getString()); | |||
return textGraph; | |||
} | |||
/** | |||
* 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 the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add the text to the SVGArea */ | |||
((SVGArea) area).addGraphic(new TextGraphic(x, y, text)); | |||
/* add the text to the SVGArea */ | |||
((SVGArea) area).addGraphic(createGraphic()); | |||
} else { | |||
/* otherwise generate a warning */ | |||
/* otherwise generate a warning */ | |||
MessageHandler.errorln("WARNING: svg:text outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} | |||
} |
@@ -51,35 +51,10 @@ | |||
package org.apache.fop.svg; | |||
import org.apache.fop.dom.svg.*; | |||
/** | |||
* class representing a line in an SVG Area | |||
* | |||
*/ | |||
public class LineGraphic extends Graphic { | |||
/** x-coordinate of start */ | |||
public int x1; | |||
/** y-coordinate of start */ | |||
public int y1; | |||
/** x-coordinate of end */ | |||
public int x2; | |||
/** y-coordinate of end */ | |||
public int y2; | |||
/** | |||
* construct a line graphic | |||
* | |||
* @param x1 x-coordinate of start | |||
* @param y1 y-coordinate of start | |||
* @param x2 x-coordinate of end | |||
* @param y2 y-coordinate of end | |||
*/ | |||
public LineGraphic(int x1, int y1, int x2, int y2) { | |||
this.x1 = x1; | |||
this.y1 = y1; | |||
this.x2 = x2; | |||
this.y2 = y2; | |||
} | |||
public interface TextElement { | |||
public GraphicImpl createTextElement(); | |||
} |
@@ -0,0 +1,142 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
/** | |||
* class representing svg:TextPath pseudo flow object. | |||
* | |||
*/ | |||
public class TextPath extends FObj implements TextElement { | |||
/** | |||
* inner class for making TextPath objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make a TextPath object. | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
* | |||
* @return the TextPath object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) throws FOPException | |||
{ | |||
return new TextPath(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for TextPath objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new TextPath.Maker(); | |||
} | |||
/** | |||
* constructs a TextPath object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected TextPath(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:textPath"; | |||
} | |||
String text = ""; | |||
protected void addCharacters(char data[], int start, int length) | |||
{ | |||
text += new String(data, start, length - start); | |||
} | |||
public GraphicImpl createTextElement() | |||
{ | |||
SVGTextPathElementImpl graph = null; | |||
String link = this.properties.get("xlink:href").getString(); | |||
graph = new SVGTextPathElementImpl(link, text.trim()); | |||
graph.setId(this.properties.get("id").getString()); | |||
return graph; | |||
} | |||
/** | |||
* 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 the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a TextPath to the SVGArea */ | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:textPath outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -0,0 +1,131 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
import org.apache.fop.fo.*; | |||
import org.apache.fop.datatypes.*; | |||
import org.apache.fop.apps.FOPException; | |||
import java.util.*; | |||
/** | |||
* | |||
*/ | |||
public class TextProperty 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 { | |||
return new TextProperty(propertyList, value); | |||
} | |||
/** | |||
* 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, ""); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for SVG Length objects | |||
*/ | |||
public static Property.Maker maker() { | |||
return new TextProperty.Maker(); | |||
} | |||
/** the length as a Length object */ | |||
protected String str; | |||
/** | |||
* 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 TextProperty(PropertyList propertyList, String s) | |||
{ | |||
this.propertyList = propertyList; | |||
this.str = s; | |||
} | |||
/** | |||
* get the length | |||
* | |||
* @return the length as a Length object | |||
*/ | |||
public String getString() | |||
{ | |||
return this.str; | |||
} | |||
} |
@@ -22,7 +22,7 @@ | |||
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 | |||
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. | |||
@@ -48,48 +48,72 @@ | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
import org.apache.fop.render.Renderer; | |||
import org.apache.fop.layout.FontState; | |||
import org.apache.fop.fo.*; | |||
import org.apache.fop.layout.Area; | |||
import org.apache.fop.layout.FontState; | |||
import org.apache.fop.apps.FOPException; | |||
/** | |||
* class representing an SVG area in which the SVG graphics sit | |||
* | |||
*/ | |||
public class SVGArea extends Area { | |||
public class Title extends FObj { | |||
/** | |||
* inner class for making Title objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make a Title object. | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
* | |||
* @return the Title object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) throws FOPException | |||
{ | |||
return new Title(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for Title objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new Title.Maker(); | |||
} | |||
/** | |||
* construct an SVG area | |||
* | |||
* @param fontState the font state | |||
* @param width the width of the area | |||
* @param height the height of the area | |||
*/ | |||
public SVGArea(FontState fontState, int width, int height) { | |||
super(fontState, width, height); | |||
currentHeight = height; | |||
contentRectangleWidth = width; | |||
} | |||
/** | |||
* the title string | |||
*/ | |||
protected String text = ""; | |||
/** | |||
* add a graphic. | |||
* | |||
* Graphics include SVG Rectangles, Lines and Text | |||
* | |||
* @param graphic the Graphic to add | |||
*/ | |||
public void addGraphic(Graphic graphic) { | |||
this.children.addElement(graphic); | |||
} | |||
/** | |||
* constructs a Title object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected Title(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:title"; | |||
} | |||
/** | |||
* render the SVG. | |||
* | |||
* @param renderer the Renderer to use | |||
*/ | |||
public void render(Renderer renderer) { | |||
renderer.renderSVGArea(this); | |||
} | |||
/** | |||
* 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) { | |||
this.text += new String(data, start, length - start); | |||
} | |||
} |
@@ -0,0 +1,137 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
/** | |||
* | |||
*/ | |||
public class Use extends FObj implements GraphicsCreator { | |||
/** | |||
* 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 GraphicImpl 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")).oldgetTransform()); | |||
graph.setId(this.properties.get("id").getString()); | |||
return graph; | |||
} | |||
/** | |||
* 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 the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a line to the SVGArea */ | |||
((SVGArea) area).addGraphic(createGraphic()); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:use outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |
@@ -0,0 +1,129 @@ | |||
/*-- $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 | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
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 | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.svg; | |||
// FOP | |||
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.dom.svg.*; | |||
import org.apache.fop.dom.svg.SVGArea; | |||
/** | |||
* | |||
*/ | |||
public class VKern extends FObj { | |||
/** | |||
* inner class for making VKern objects. | |||
*/ | |||
public static class Maker extends FObj.Maker { | |||
/** | |||
* make a VKern object. | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
* | |||
* @return the VKern object | |||
*/ | |||
public FObj make(FObj parent, PropertyList propertyList) throws FOPException | |||
{ | |||
return new VKern(parent, propertyList); | |||
} | |||
} | |||
/** | |||
* returns the maker for this object. | |||
* | |||
* @return the maker for VKern objects | |||
*/ | |||
public static FObj.Maker maker() { | |||
return new VKern.Maker(); | |||
} | |||
/** | |||
* constructs a VKern object (called by Maker). | |||
* | |||
* @param parent the parent formatting object | |||
* @param propertyList the explicit properties of this object | |||
*/ | |||
protected VKern(FObj parent, PropertyList propertyList) { | |||
super(parent, propertyList); | |||
this.name = "svg:vkern"; | |||
} | |||
/** | |||
* 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 { | |||
/* retrieve properties */ | |||
/* if the area this is being put into is an SVGArea */ | |||
if (area instanceof SVGArea) { | |||
/* add a VKern to the SVGArea */ | |||
((SVGArea) area).addGraphic(new SVGVKernElementImpl()); | |||
} else { | |||
/* otherwise generate a warning */ | |||
System.err.println("WARNING: svg:vkern outside svg:svg"); | |||
} | |||
/* return status */ | |||
return new Status(Status.OK); | |||
} | |||
} |