diff options
author | Keiron Liddle <keiron@apache.org> | 2001-05-17 07:48:06 +0000 |
---|---|---|
committer | Keiron Liddle <keiron@apache.org> | 2001-05-17 07:48:06 +0000 |
commit | c824ede99cb449252823876b6224f6ed75e799cd (patch) | |
tree | 771770e0d8604c5511de0249b4072817fc483736 | |
parent | f89f05c27124377ec9497b30d4d75874a2bec67b (diff) | |
download | xmlgraphics-fop-c824ede99cb449252823876b6224f6ed75e799cd.tar.gz xmlgraphics-fop-c824ede99cb449252823876b6224f6ed75e799cd.zip |
FOP now uses Batik to render svg
This is handled for awt - using batik to render to a graphic
and pdf.
Pdf still requires better image support.
The elements and properties are generated from the svgelements.xml
document.
The version of batik is 17/05/2001 cvs.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194250 13f79535-47bb-0310-9956-ffa450edef68
163 files changed, 3710 insertions, 21344 deletions
@@ -13,7 +13,7 @@ if [ "$JAVA_HOME" = "" ] ; then exit 1 fi LIBDIR=lib -LOCALCLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/classes.zip:$LIBDIR/ant.jar:$LIBDIR/w3c.jar:$LIBDIR/buildtools.jar:$LIBDIR/xerces-1.2.3.jar:$LIBDIR/xalan-2.0.0.jar:$LIBDIR/xalanj1compat.jar:$LIBDIR/bsf.jar:$LIBDIR/jimi-1.0.jar +LOCALCLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/classes.zip:$LIBDIR/ant.jar:$LIBDIR/batik.jar:$LIBDIR/buildtools.jar:$LIBDIR/xerces-1.2.3.jar:$LIBDIR/xalan-2.0.0.jar:$LIBDIR/xalanj1compat.jar:$LIBDIR/bsf.jar:$LIBDIR/jimi-1.0.jar ANT_HOME=$LIBDIR echo @@ -205,6 +205,7 @@ Sometimes ant gives out this warnings, but the build is finished without any pro <property name="properties.dir" value="org/apache/fop/fo/properties"/> <property name="fonts.dir" value="org/apache/fop/render/pdf/fonts"/> + <property name="svg.dir" value="org/apache/fop/svg"/> <property name="replacestring" value="org/apache/fop"/> <property name="ignore_this" value="ignore_this.java"/> <property name="jimi" value="JimiImage.java"/> @@ -220,12 +221,16 @@ Sometimes ant gives out this warnings, but the build is finished without any pro <property name="xslt" value="org.apache.xalan.xslt.Process"/> <property name="src.properties.xsl" value="${src.codegen}/properties.xsl"/> + <property name="src.propmaker.xsl" value="${src.codegen}/propmaker.xsl"/> <property name="foproperties.xml" value="${build.codegen}/foproperties.xml"/> <property name="colorkw.xml" value="${build.codegen}/colorkw.xml"/> <property name="svgproperties.xml" value="${build.codegen}/svgproperties.xml"/> <property name="extproperties.xml" value="${build.codegen}/extproperties.xml"/> <property name="allprops.xml" value="${build.codegen}/allprops.xml"/> + <property name="svgelements.xml" value="${build.codegen}/svgelements.xml"/> + <property name="elements.xsl" value="${build.codegen}/elements.xsl"/> + <property name="properties.xsl" value="${build.codegen}/properties.xsl"/> <property name="propmap.xsl" value="${build.codegen}/propmap.xsl"/> <property name="enumgen.xsl" value="${build.codegen}/enumgen.xsl"/> @@ -334,6 +339,7 @@ Sometimes ant gives out this warnings, but the build is finished without any pro <mkdir dir="${build.src}"/> <mkdir dir="${build.src}/${properties.dir}"/> <mkdir dir="${build.src}/${fonts.dir}"/> + <mkdir dir="${build.src}/${svg.dir}"/> <mkdir dir="${build.dest}/conf"/> <mkdir dir="${build.dest}/hyph"/> <copy todir="${build.dest}/conf" filtering="yes"> @@ -424,6 +430,10 @@ Sometimes ant gives out this warnings, but the build is finished without any pro <!-- generate the java files from xml resources --> <echo message="Generating the java files from xml resources"/> + <xslt infile="${svgelements.xml}" xsltfile="${src.propmaker.xsl}" + dependent="${propinc.xsl}" + outfile="${svgproperties.xml}" smart="yes"/> + <xslt infile="${allprops.xml}" xsltfile="${genconst.xsl}" dependent="${foproperties.xml},${svgproperties.xml},${extproperties.xml},${colorkw.xml}" outfile="${build.src}/${replacestring}/fo/properties/Constants.java" smart="yes"/> @@ -438,7 +448,6 @@ Sometimes ant gives out this warnings, but the build is finished without any pro dependent="${propinc.xsl}" outfile="${build.src}/${replacestring}/fo/properties/foenums_${ignore_this}" smart="yes"/> - <xslt infile="${svgproperties.xml}" xsltfile="${properties.xsl}" dependent="${propinc.xsl}" outfile="${build.src}/${replacestring}/fo/properties/svg_${ignore_this}" smart="yes"/> @@ -460,6 +469,9 @@ Sometimes ant gives out this warnings, but the build is finished without any pro outfile="${build.src}/${replacestring}/fo/properties/extenums_${ignore_this}" smart="yes"/> + <xslt infile="${svgelements.xml}" xsltfile="${elements.xsl}" + outfile="${build.src}/${replacestring}/svg/ele_${ignore_this}" smart="yes"/> + <xslt infile="${charlist.xml}" xsltfile="${charlist.xsl}" outfile="${build.src}/${replacestring}/render/pdf/CodePointMapping.java" smart="yes"/> diff --git a/docs/examples/svg/makedoc.sh b/docs/examples/svg/makedoc.sh index f77f7a853..344f61af4 100755 --- a/docs/examples/svg/makedoc.sh +++ b/docs/examples/svg/makedoc.sh @@ -14,7 +14,7 @@ if [ "$JAVA_HOME" = "" ] ; then fi LIBDIR=../../../lib/ -LOCALCLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/classes.zip:$LIBDIR/ant.jar:$LIBDIR/w3c.jar:$LIBDIR/buildtools.jar:$LIBDIR/xerces-1.2.3.jar:$LIBDIR/xalan-2.0.0.jar:$LIBDIR/xalanj1compat.jar:$LIBDIR/bsf.jar:$LIBDIR/jimi-1.0.jar:$LIBDIR/../build/fop.jar +LOCALCLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/classes.zip:$LIBDIR/ant.jar:$LIBDIR/batik.jar:$LIBDIR/buildtools.jar:$LIBDIR/xerces-1.2.3.jar:$LIBDIR/xalan-2.0.0.jar:$LIBDIR/xalanj1compat.jar:$LIBDIR/bsf.jar:$LIBDIR/jimi-1.0.jar:$LIBDIR/../build/fop.jar ANT_HOME=$LIBDIR echo Building with classpath $CLASSPATH:$LOCALCLASSPATH @@ -1,3 +1,3 @@ #!/bin/sh -java -cp fop.jar:lib/w3c.jar:lib/xalan-2.0.0.jar:lib/xerces-1.2.3.jar:lib/jimi-1.0.jar org.apache.fop.apps.Fop "$@" +java -cp build/fop.jar:lib/batik.jar:lib/xalan-2.0.0.jar:lib/xerces-1.2.3.jar:lib/jimi-1.0.jar org.apache.fop.apps.Fop "$@" diff --git a/lib/batik.jar b/lib/batik.jar Binary files differnew file mode 100644 index 000000000..90de37c96 --- /dev/null +++ b/lib/batik.jar diff --git a/lib/w3c.jar b/lib/w3c.jar Binary files differdeleted file mode 100644 index 88faff7d8..000000000 --- a/lib/w3c.jar +++ /dev/null diff --git a/src/codegen/elements.dtd b/src/codegen/elements.dtd new file mode 100644 index 000000000..2ae37e2eb --- /dev/null +++ b/src/codegen/elements.dtd @@ -0,0 +1,20 @@ +<!-- $Id$ --> +<!-- +DTD for svgelements.xml +--> + +<!DOCTYPE elements [ +<!ELEMENT elements (commonAttributes+, element+) > +<!ATTLIST elements + prefix CDATA #REQUIRED + ns CDATA #REQUIRED> +<!ELEMENT element (tagname, attributes) > +<!ELEMENT tagname (#PCDATA) > +<!ELEMENT attributes ((attribute | includeAttributes)+) > +<!ELEMENT commonAttributes ((attribute | includeAttributes)+) > +<!ATTLIST commonAttributes + ref CDATA #REQUIRED> +<!ELEMENT attribute (#PCDATA) > +<!ELEMENT includeAttributes (#PCDATA) > +<!ATTLIST includeAttributes + ref CDATA #REQUIRED> diff --git a/src/codegen/elements.xsl b/src/codegen/elements.xsl new file mode 100644 index 000000000..9c0e3cdd7 --- /dev/null +++ b/src/codegen/elements.xsl @@ -0,0 +1,146 @@ +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:lxslt="http://xml.apache.org/xslt" + xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect" + extension-element-prefixes="redirect"> + +<xsl:output method="text" /> + +<xsl:template name="capfirst"> + <xsl:param name="str"/> + <xsl:variable name="lcletters" select="'abcdefghijklmnopqrstuvwxyz'" /> + <xsl:variable name="ucletters" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" /> + <xsl:value-of select="concat(translate(substring($str, 1, 1), + $lcletters, $ucletters), substring($str, 2))"/> +</xsl:template> + +<xsl:template name="makeClassName"> + <xsl:param name="propstr"/> + <xsl:choose> + <xsl:when test="contains($propstr, '-')"> + <xsl:call-template name="capfirst"> + <xsl:with-param name="str" select="substring-before($propstr, '-')"/> + </xsl:call-template> + <xsl:call-template name="makeClassName"> + <xsl:with-param name="propstr" select="substring-after($propstr, '-')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="capfirst"> + <xsl:with-param name="str" select="$propstr"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template match="attributes"><xsl:apply-templates/></xsl:template> + +<xsl:template match="includeAttributes"> +<xsl:variable name="attr-ref"> + <xsl:value-of select="@ref"/> +</xsl:variable> +<xsl:for-each select="/elements/commonAttributes"> + <xsl:choose> + <xsl:when test="@ref = $attr-ref"> + <xsl:apply-templates/> + </xsl:when> + </xsl:choose> +</xsl:for-each> +</xsl:template> + +<xsl:template match="attribute">"<xsl:apply-templates/>"<xsl:if test="not(position()=last())">, </xsl:if></xsl:template> + +<xsl:template match="elements"> + <xsl:apply-templates select="element"/> +</xsl:template> + +<xsl:template match="tagname"> + <xsl:apply-templates/> +</xsl:template> + +<xsl:template match="element"> + +<xsl:variable name="name"> + <xsl:apply-templates select="tagname"/> +</xsl:variable> + +<xsl:variable name="classname"> + <xsl:choose> + <xsl:when test="class-name"> + <xsl:value-of select="class-name"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="makeClassName"> + <xsl:with-param name="propstr" select="$name"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> +</xsl:variable> + +<redirect:write select="concat('@org/apache/fop@/svg/', $classname, '.java')"> +package org.apache.fop.svg; + +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.batik.dom.svg.*; + +import org.w3c.dom.svg.SVGElement; +import org.w3c.dom.svg.SVGDocument; +import org.w3c.dom.Element; + +public class <xsl:value-of select="$classname"/> extends SVGObj { + + /** + * inner class for making <xsl:apply-templates select="tagname"/> objects. + */ + public static class Maker extends FObj.Maker { + + /** + * make a <xsl:apply-templates select="tagname"/> object. + * + * @param parent the parent formatting object + * @param propertyList the explicit properties of this object + * + * @return the <xsl:apply-templates select="tagname"/> object + */ + public FObj make(FObj parent, + PropertyList propertyList) throws FOPException { + return new <xsl:value-of select="$classname"/>(parent, propertyList); + } + } + + /** + * returns the maker for this object. + * + * @return the maker for <xsl:apply-templates select="tagname"/> objects + */ + public static FObj.Maker maker() { + return new <xsl:value-of select="$classname"/>.Maker(); + } + + /** + * constructs a <xsl:apply-templates select="tagname"/> object (called by Maker). + * + * @param parent the parent formatting object + * @param propertyList the explicit properties of this object + */ + protected <xsl:value-of select="$classname"/>(FObj parent, PropertyList propertyList) { + super(parent, propertyList); + this.name = "<xsl:value-of select="//@prefix"/>:<xsl:value-of select="$name"/>"; + tagName = "<xsl:value-of select="$name"/>"; + props = new String[] {<xsl:apply-templates select="attributes"/>}; + } + +<xsl:if test="@addText"> + protected void addCharacters(char data[], int start, int length) { + this.children.addElement(new String(data, start, length - start)); + } +</xsl:if> +} +</redirect:write> +</xsl:template> + +</xsl:stylesheet> diff --git a/src/codegen/propmaker.xsl b/src/codegen/propmaker.xsl new file mode 100644 index 000000000..bf9d1671a --- /dev/null +++ b/src/codegen/propmaker.xsl @@ -0,0 +1,25 @@ +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:lxslt="http://xml.apache.org/xslt" + xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect" + extension-element-prefixes="redirect"> + +<xsl:output method="xml" /> + +<xsl:template match="elements"> +<property-list family="SVG"> + <generic-property-list> + <xsl:apply-templates select="*//attribute"/> + </generic-property-list> +</property-list> +</xsl:template> + +<xsl:template match="*//attribute"> + <property> + <name><xsl:apply-templates/></name> + <use-generic ispropclass="true">SVGStringProperty</use-generic> + </property> +</xsl:template> + + +</xsl:stylesheet> diff --git a/src/codegen/svgelements.xml b/src/codegen/svgelements.xml new file mode 100644 index 000000000..ddc384112 --- /dev/null +++ b/src/codegen/svgelements.xml @@ -0,0 +1,1355 @@ +<?xml version="1.0" ?> +<!-- + +This file provides all the information for the svg elements and +attributes. The information corresponds to the svg dtd. + +This information is used to create the code for the svg elements +and the property mappings. + +--> +<elements prefix="svg" ns="http://www.w3.org/2000/svg"> + <commonAttributes ref="stdAttrs"> + <attribute>id</attribute> + <attribute>class</attribute> + </commonAttributes> + <commonAttributes ref="langSpaceAttrs"> + <attribute>xml:lang</attribute> + <attribute>xml:space</attribute> + </commonAttributes> + <commonAttributes ref="testAttrs"> + <attribute>requiredFeatures</attribute> + <attribute>requiredExtensions</attribute> + <attribute>systemLanguage</attribute> + </commonAttributes> + <commonAttributes ref="xlinkRefAttrs"> + <attribute>xmlns:xlink</attribute> + <attribute>xlink:type</attribute> + <attribute>xlink:role</attribute> + <attribute>xlink:arcrole</attribute> + <attribute>xlink:title</attribute> + <attribute>xlink:show</attribute> + <attribute>xlink:actuate</attribute> + </commonAttributes> + <commonAttributes ref="graphicsElementEvents"> + <attribute>onfocusin</attribute> + <attribute>onfocusout</attribute> + <attribute>onactivate</attribute> + <attribute>onclick</attribute> + <attribute>onmousedown</attribute> + <attribute>onmouseup</attribute> + <attribute>onmouseover</attribute> + <attribute>onmousemove</attribute> + <attribute>onmouseout</attribute> + <attribute>onload</attribute> + </commonAttributes> + <commonAttributes ref="documentEvents"> + <attribute>onunload</attribute> + <attribute>onabort</attribute> + <attribute>onerror</attribute> + <attribute>onresize</attribute> + <attribute>onscroll</attribute> + <attribute>onzoom</attribute> + </commonAttributes> + <commonAttributes ref="animationEvents"> + <attribute>onbegin</attribute> + <attribute>onend</attribute> + <attribute>onrepeat</attribute> + </commonAttributes> + <commonAttributes ref="PresentationAttributes-All"> + <includeAttributes ref="PresentationAttributes-Containers"/> + <includeAttributes ref="PresentationAttributes-feFlood"/> + <includeAttributes ref="PresentationAttributes-FillStroke"/> + <includeAttributes ref="PresentationAttributes-FontSpecification"/> + <includeAttributes ref="PresentationAttributes-Gradients"/> + <includeAttributes ref="PresentationAttributes-Graphics"/> + <includeAttributes ref="PresentationAttributes-Images"/> + <includeAttributes ref="PresentationAttributes-LightingEffects"/> + <includeAttributes ref="PresentationAttributes-Markers"/> + <includeAttributes ref="PresentationAttributes-TextContentElements"/> + <includeAttributes ref="PresentationAttributes-TextElements"/> + <includeAttributes ref="PresentationAttributes-Viewports"/> + </commonAttributes> + <commonAttributes ref="PresentationAttributes-Containers"> + <attribute>enable-background</attribute> + </commonAttributes> + <commonAttributes ref="PresentationAttributes-feFlood"> + <attribute>flood-color</attribute> + <attribute>flood-opacity</attribute> + </commonAttributes> + <commonAttributes ref="PresentationAttributes-FillStroke"> + <attribute>fill</attribute> + <attribute>fill-opacity</attribute> + <attribute>fill-rule</attribute> + <attribute>stroke</attribute> + <attribute>stroke-dasharray</attribute> + <attribute>stroke-dashoffset</attribute> + <attribute>stroke-linecap</attribute> + <attribute>stroke-linejoin</attribute> + <attribute>stroke-miterlimit</attribute> + <attribute>stroke-opacity</attribute> + <attribute>stroke-width</attribute> + </commonAttributes> + <commonAttributes ref="PresentationAttributes-FontSpecification"> + <attribute>font-family</attribute> + <attribute>font-size</attribute> + <attribute>font-size-adjust</attribute> + <attribute>font-stretch</attribute> + <attribute>font-style</attribute> + <attribute>font-variant</attribute> + <attribute>font-weight</attribute> + </commonAttributes> + <commonAttributes ref="PresentationAttributes-Gradients"> + <attribute>stop-color</attribute> + <attribute>stop-opacity</attribute> + </commonAttributes> + <commonAttributes ref="PresentationAttributes-Graphics"> + <attribute>clip-path</attribute> + <attribute>clip-rule</attribute> + <attribute>color</attribute> + <attribute>color-interpolation</attribute> + <attribute>color-rendering</attribute> + <attribute>cursor</attribute> + <attribute>display</attribute> + <attribute>filter</attribute> + <attribute>image-rendering</attribute> + <attribute>mask</attribute> + <attribute>opacity</attribute> + <attribute>pointer-events</attribute> + <attribute>space-rendering</attribute> + <attribute>text-rendering</attribute> + <attribute>visibility</attribute> + </commonAttributes> + <commonAttributes ref="PresentationAttributes-Images"> + <attribute>color-profile</attribute> + </commonAttributes> + <commonAttributes ref="PresentationAttributes-LightingEffects"> + <attribute>lighting-color</attribute> + </commonAttributes> + <commonAttributes ref="PresentationAttributes-Markers"> + <attribute>marker-start</attribute> + <attribute>marker-mid</attribute> + <attribute>marker-end</attribute> + </commonAttributes> + <commonAttributes ref="PresentationAttributes-TextContentElements"> + <attribute>alignment-baseline</attribute> + <attribute>baseline-shift</attribute> + <attribute>direction</attribute> + <attribute>glyph-orientation-horizontal</attribute> + <attribute>glyph-orientation-vertical</attribute> + <attribute>kerning</attribute> + <attribute>letter-spacing</attribute> + <attribute>text-decoration</attribute> + <attribute>unicode-bidi</attribute> + <attribute>word-spacing</attribute> + </commonAttributes> + <commonAttributes ref="PresentationAttributes-TextElements"> + <attribute>writing-mode</attribute> + <attribute>text-anchor</attribute> + <attribute>dominant-baseline</attribute> + </commonAttributes> + <commonAttributes ref="PresentationAttributes-Viewports"> + <attribute>clip</attribute> + <attribute>overflow</attribute> + </commonAttributes> + <commonAttributes ref="filter_primitive_attributes"> + <attribute>x</attribute> + <attribute>y</attribute> + <attribute>width</attribute> + <attribute>height</attribute> + <attribute>result</attribute> + </commonAttributes> + <commonAttributes ref="filter_primitive_attributes_with_in"> + <includeAttributes ref="filter_primitive_attributes"/> + <attribute>in</attribute> + </commonAttributes> + <commonAttributes ref="component_transfer_function_attributes"> + <attribute>type</attribute> + <attribute>tableValues</attribute> + <attribute>slope</attribute> + <attribute>intercept</attribute> + <attribute>amplitude</attribute> + <attribute>exponent</attribute> + <attribute>offset</attribute> + </commonAttributes> + <commonAttributes ref="animElementAttrs"> + <includeAttributes ref="xlinkRefAttrs"/> + <attribute>xlink:href</attribute> + </commonAttributes> + <commonAttributes ref="animAttributeAttrs"> + <attribute>attributeName</attribute> + <attribute>attributeType</attribute> + </commonAttributes> + <commonAttributes ref="animTargetAttrs"> + <includeAttributes ref="xlinkRefAttrs"/> + <attribute>xlink:href</attribute> + <attribute>attributeName</attribute> + <attribute>attributeType</attribute> + </commonAttributes> + <commonAttributes ref="animTimingAttrs"> + <attribute>begin</attribute> + <attribute>dur</attribute> + <attribute>end</attribute> + <attribute>min</attribute> + <attribute>max</attribute> + <attribute>restart</attribute> + <attribute>repeatCount</attribute> + <attribute>repeatDur</attribute> + <attribute>fill</attribute> + </commonAttributes> + <commonAttributes ref="animValueAttrs"> + <attribute>calcMode</attribute> + <attribute>values</attribute> + <attribute>keyTimes</attribute> + <attribute>keySplines</attribute> + <attribute>from</attribute> + <attribute>to</attribute> + <attribute>by</attribute> + </commonAttributes> + <commonAttributes ref="animAdditionAttrs"> + <attribute>additive</attribute> + <attribute>accumulate</attribute> + </commonAttributes> + <element> + <tagname>a</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <attribute>xmlns:xlink</attribute> + <attribute>xlink:type</attribute> + <attribute>xlink:role</attribute> + <attribute>xlink:arcrole</attribute> + <attribute>xlink:title</attribute> + <attribute>xlink:show</attribute> + <attribute>xlink:actuate</attribute> + <attribute>xlink:href</attribute> + <includeAttributes ref="testAttrs"/> + <includeAttributes ref="langSpaceAttrs"/> + <attribute>externalResourcesRequired</attribute> + <attribute>class</attribute> + <attribute>style</attribute> + <includeAttributes ref="PresentationAttributes-All"/> + <attribute>transform</attribute> + <includeAttributes ref="graphicsElementEvents"/> + <attribute>target</attribute> + </attributes> + </element> + <element> + <tagname>circle</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="testAttrs"/> + <includeAttributes ref="langSpaceAttrs"/> + <attribute>externalResourcesRequired</attribute> + <attribute>class</attribute> + <attribute>style</attribute> + <includeAttributes ref="PresentationAttributes-FillStroke"/> + <includeAttributes ref="PresentationAttributes-Graphics"/> + <attribute>transform</attribute> + <includeAttributes ref="graphicsElementEvents"/> + <attribute>cx</attribute> + <attribute>cy</attribute> + <attribute>r</attribute> + </attributes> + </element> + <element> + <tagname>altGlyph</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="xlinkRefAttrs"/> + <includeAttributes ref="testAttrs"/> + <includeAttributes ref="langSpaceAttrs"/> + <attribute>xlink:href</attribute> + <attribute>glyphRef</attribute> + <attribute>format</attribute> + <attribute>externalResourcesRequired</attribute> + <attribute>class</attribute> + <attribute>style</attribute> + <includeAttributes ref="PresentationAttributes-FillStroke"/> + <includeAttributes ref="PresentationAttributes-FontSpecification"/> + <includeAttributes ref="PresentationAttributes-Graphics"/> + <includeAttributes ref="PresentationAttributes-TextContentElements"/> + <includeAttributes ref="graphicsElementEvents"/> + <attribute>x</attribute> + <attribute>y</attribute> + <attribute>dx</attribute> + <attribute>dy</attribute> + <attribute>rotate</attribute> + </attributes> + </element> + <element> + <tagname>altGlyphDef</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + </attributes> + </element> + <element> + <tagname>altGlyphItem</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + </attributes> + </element> + <element> + <tagname>animate</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="testAttrs"/> + <attribute>externalResourcesRequired</attribute> + <includeAttributes ref="animationEvents"/> + <includeAttributes ref="animElementAttrs"/> + <includeAttributes ref="animAttributeAttrs"/> + <includeAttributes ref="animTimingAttrs"/> + <includeAttributes ref="animValueAttrs"/> + <includeAttributes ref="animAdditionAttrs"/> + </attributes> + </element> + <element> + <tagname>animateColor</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="testAttrs"/> + <attribute>externalResourcesRequired</attribute> + <includeAttributes ref="animationEvents"/> + <includeAttributes ref="animElementAttrs"/> + <includeAttributes ref="animAttributeAttrs"/> + <includeAttributes ref="animTimingAttrs"/> + <includeAttributes ref="animValueAttrs"/> + <includeAttributes ref="animAdditionAttrs"/> + </attributes> + </element> + <element> + <tagname>animateMotion</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="testAttrs"/> + <attribute>externalResourcesRequired</attribute> + <includeAttributes ref="animationEvents"/> + <includeAttributes ref="animElementAttrs"/> + <includeAttributes ref="animTimingAttrs"/> + <attribute>calcMode</attribute> + <attribute>values</attribute> + <attribute>keyTimes</attribute> + <attribute>keySplines</attribute> + <attribute>from</attribute> + <attribute>to</attribute> + <attribute>by</attribute> + <includeAttributes ref="animAdditionAttrs"/> + <attribute>path</attribute> + <attribute>keyPoints</attribute> + <attribute>rotate</attribute> + <attribute>origin</attribute> + </attributes> + </element> + <element> + <tagname>animateTransform</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="testAttrs"/> + <attribute>externalResourcesRequired</attribute> + <includeAttributes ref="animationEvents"/> + <includeAttributes ref="animElementAttrs"/> + <includeAttributes ref="animAttributeAttrs"/> + <includeAttributes ref="animTimingAttrs"/> + <includeAttributes ref="animValueAttrs"/> + <includeAttributes ref="animAdditionAttrs"/> + <attribute>type</attribute> + </attributes> + </element> + <element> + <tagname>clipPath</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="testAttrs"/> + <includeAttributes ref="langSpaceAttrs"/> + <attribute>externalResourcesRequired</attribute> + <attribute>class</attribute> + <attribute>style</attribute> + <includeAttributes ref="PresentationAttributes-FillStroke"/> + <includeAttributes ref="PresentationAttributes-FontSpecification"/> + <includeAttributes ref="PresentationAttributes-Graphics"/> + <includeAttributes ref="PresentationAttributes-TextContentElements"/> + <includeAttributes ref="PresentationAttributes-TextElements"/> + <attribute>transform</attribute> + <attribute>clipPathUnits</attribute> + </attributes> + </element> + <element> + <tagname>color-profile</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="xlinkRefAttrs"/> + <attribute>xlink:href</attribute> + <attribute>local</attribute> + <attribute>name</attribute> + <attribute>rendering-intent</attribute> + </attributes> + </element> + <element> + <tagname>cursor</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="xlinkRefAttrs"/> + <attribute>xlink:href</attribute> + <includeAttributes ref="testAttrs"/> + <attribute>externalResourcesRequired</attribute> + <attribute>x</attribute> + <attribute>y</attribute> + </attributes> + </element> + <element> + <tagname>defs</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="testAttrs"/> + <includeAttributes ref="langSpaceAttrs"/> + <includeAttributes ref="PresentationAttributes-All"/> + <includeAttributes ref="graphicsElementEvents"/> + <attribute>externalResourcesRequired</attribute> + <attribute>class</attribute> + <attribute>style</attribute> + <attribute>transform</attribute> + </attributes> + </element> + <element addText="true"> + <tagname>desc</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="langSpaceAttrs"/> + <includeAttributes ref="StructuredText"/> + <attribute>class</attribute> + <attribute>style</attribute> + </attributes> + </element> + <element> + <tagname>ellipse</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="testAttrs"/> + <includeAttributes ref="langSpaceAttrs"/> + <attribute>externalResourcesRequired</attribute> + <attribute>class</attribute> + <attribute>style</attribute> + <includeAttributes ref="PresentationAttributes-FillStroke"/> + <includeAttributes ref="PresentationAttributes-Graphics"/> + <attribute>transform</attribute> + <includeAttributes ref="graphicsElementEvents"/> + <attribute>cx</attribute> + <attribute>cy</attribute> + <attribute>rx</attribute> + <attribute>ry</attribute> + </attributes> + </element> + <element> + <tagname>feBlend</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="filter_primitive_attributes_with_in"/> + <attribute>in2</attribute> + <attribute>mode</attribute> + </attributes> + </element> + <element> + <tagname>feColorMatrix</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="filter_primitive_attributes_with_in"/> + <attribute>type</attribute> + <attribute>values</attribute> + </attributes> + </element> + <element> + <tagname>feComponentTransfer</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="filter_primitive_attributes_with_in"/> + </attributes> + </element> + <element> + <tagname>feComposite</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="filter_primitive_attributes_with_in"/> + <attribute>in2</attribute> + <attribute>operator</attribute> + <attribute>k1</attribute> + <attribute>k2</attribute> + <attribute>k3</attribute> + <attribute>k4</attribute> + </attributes> + </element> + <element> + <tagname>feConvolveMatrix</tagname> + <attributes> + <includeAttributes ref="filter_primitive_attributes_with_in"/> + <attribute>order</attribute> + <attribute>kernelMatrix</attribute> + <attribute>divisor</attribute> + <attribute>bias</attribute> + <attribute>targetX</attribute> + <attribute>targetY</attribute> + <attribute>edgeMode</attribute> + <attribute>kernelUnitLength</attribute> + <attribute>preserveAlpha</attribute> + </attributes> + </element> + <element> + <tagname>feDistantLight</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <attribute>azimuth</attribute> + <attribute>elevation</attribute> + </attributes> + </element> + <element> + <tagname>feDiffuseLighting</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <attribute>class</attribute> + <attribute>style</attribute> + <includeAttributes ref="PresentationAttributes-LightingEffects"/> + <includeAttributes ref="filter_primitive_attributes_with_in"/> + <attribute>surfaceScale</attribute> + <attribute>diffuseConstant</attribute> + </attributes> + </element> + <element> + <tagname>feDisplacementMap</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="filter_primitive_attributes_with_in"/> + <attribute>in2</attribute> + <attribute>scale</attribute> + <attribute>xChannelSelector</attribute> + <attribute>yChannelSelector</attribute> + </attributes> + </element> + <element> + <tagname>feFlood</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="filter_primitive_attributes_with_in"/> + <attribute>class</attribute> + <attribute>style</attribute> + <includeAttributes ref="PresentationAttributes-feFlood"/> + </attributes> + </element> + <element> + <tagname>feFuncR</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="component_transfer_function_attributes"/> + </attributes> + </element> + <element> + <tagname>feFuncG</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="component_transfer_function_attributes"/> + </attributes> + </element> + <element> + <tagname>feFuncB</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="component_transfer_function_attributes"/> + </attributes> + </element> + <element> + <tagname>feFuncA</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="component_transfer_function_attributes"/> + </attributes> + </element> + <element> + <tagname>feGaussianBlur</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="filter_primitive_attributes_with_in"/> + <attribute>stdDeviation</attribute> + </attributes> + </element> + <element> + <tagname>feOffset</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + </attributes> + </element> + <element> + <tagname>fePointLight</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <attribute>x</attribute> + <attribute>y</attribute> + <attribute>z</attribute> + </attributes> + </element> + <element> + <tagname>feImage</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="xlinkRefAttrs"/> + <attribute>xlink:href</attribute> + <includeAttributes ref="langSpaceAttrs"/> + <attribute>externalResourcesRequired</attribute> + <attribute>class</attribute> + <attribute>style</attribute> + <includeAttributes ref="PresentationAttributes-All"/> + <attribute>transform</attribute> + <includeAttributes ref="filter_primitive_attributes"/> + </attributes> + </element> + <element> + <tagname>feMerge</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="filter_primitive_attributes"/> + </attributes> + </element> + <element> + <tagname>feMergeNode</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <attribute>in</attribute> + </attributes> + </element> + <element> + <tagname>feMorphology</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="filter_primitive_attributes_with_in"/> + <attribute>operator</attribute> + <attribute>radius</attribute> + </attributes> + </element> + <element> + <tagname>feOffset</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="filter_primitive_attributes_with_in"/> + <attribute>dx</attribute> + <attribute>dy</attribute> + </attributes> + </element> + <element> + <tagname>feSpecularLighting</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <attribute>class</attribute> + <attribute>style</attribute> + <includeAttributes ref="PresentationAttributes-LightingEffects"/> + <includeAttributes ref="filter_primitive_attributes_with_in"/> + <attribute>surfaceScale</attribute> + <attribute>specularConstant</attribute> + <attribute>specularExponent</attribute> + </attributes> + </element> + <element> + <tagname>feSpotLight</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <attribute>x</attribute> + <attribute>y</attribute> + <attribute>z</attribute> + <attribute>pointsAtX</attribute> + <attribute>pointsAtY</attribute> + <attribute>pointsAtZ</attribute> + <attribute>specularExponent</attribute> + <attribute>limitingConeAngle</attribute> + </attributes> + </element> + <element> + <tagname>feTile</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="filter_primitive_attributes_with_in"/> + </attributes> + </element> + <element> + <tagname>feTurbulence</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="filter_primitive_attributes"/> + <attribute>baseFrequency</attribute> + <attribute>numOctaves</attribute> + <attribute>seed</attribute> + <attribute>stitchTiles</attribute> + <attribute>type</attribute> + </attributes> + </element> + <element> + <tagname>filter</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="xlinkRefAttrs"/> + <attribute>xlink:href</attribute> + <includeAttributes ref="langSpaceAttrs"/> + <attribute>externalResourcesRequired</attribute> + <attribute>class</attribute> + <attribute>style</attribute> + <includeAttributes ref="PresentationAttributes-All"/> + <attribute>filterUnits</attribute> + <attribute>primitiveUnits</attribute> + <attribute>x</attribute> + <attribute>y</attribute> + <attribute>width</attribute> + <attribute>height</attribute> + <attribute>filterRes</attribute> + </attributes> + </element> + <element> + <tagname>font</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <attribute>externalResourcesRequired</attribute> + <attribute>class</attribute> + <attribute>style</attribute> + <includeAttributes ref="PresentationAttributes-All"/> + <attribute>horiz-origin-x</attribute> + <attribute>horiz-origin-y</attribute> + <attribute>horiz-adv-x</attribute> + <attribute>vert-origin-x</attribute> + <attribute>vert-origin-y</attribute> + <attribute>vert-adv-y</attribute> + </attributes> + </element> + <element> + <tagname>font-face</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <attribute>font-family</attribute> + <attribute>font-style</attribute> + <attribute>font-variant</attribute> + <attribute>font-weight</attribute> + <attribute>font-stretch</attribute> + <attribute>font-size</attribute> + <attribute>unicode-range</attribute> + <attribute>units-per-em</attribute> + <attribute>panose-1</attribute> + <attribute>stemv</attribute> + <attribute>stemh</attribute> + <attribute>slope</attribute> + <attribute>cap-height</attribute> + <attribute>x-height</attribute> + <attribute>accent-height</attribute> + <attribute>ascent</attribute> + <attribute>descent</attribute> + <attribute>widths</attribute> + <attribute>bbox</attribute> + <attribute>ideographic</attribute> + <attribute>alphabetic</attribute> + <attribute>mathematical</attribute> + <attribute>hanging</attribute> + <attribute>v-ideographic</attribute> + <attribute>v-alphabetic</attribute> + <attribute>v-mathematical</attribute> + <attribute>v-hanging</attribute> + <attribute>underline-position</attribute> + <attribute>underline-thickness</attribute> + <attribute>strikethrough-position</attribute> + <attribute>strikethrough-thickness</attribute> + <attribute>overline-position</attribute> + <attribute>overline-thickness</attribute> + </attributes> + </element> + <element> + <tagname>font-face-src</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + </attributes> + </element> + <element> + <tagname>font-face-uri</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="xlinkRefAttrs"/> + <attribute>xlink:href</attribute> + </attributes> + </element> + <element> + <tagname>font-face-format</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <attribute>string</attribute> + </attributes> + </element> + <element> + <tagname>font-face-name</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <attribute>name</attribute> + </attributes> + </element> + <element> + <tagname>foreignObject</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="testAttrs"/> + <includeAttributes ref="langSpaceAttrs"/> + <attribute>externalResourcesRequired</attribute> + <attribute>class</attribute> + <attribute>style</attribute> + <includeAttributes ref="PresentationAttributes-All"/> + <attribute>transform</attribute> + <includeAttributes ref="graphicsElementEvents"/> + <attribute>x</attribute> + <attribute>y</attribute> + <attribute>width</attribute> + <attribute>height</attribute> + <includeAttributes ref="StructuredText"/> + </attributes> + </element> + <element> + <tagname>definition-src</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="xlinkRefAttrs"/> + <attribute>xlink:href</attribute> + </attributes> + </element> + <element> + <tagname>g</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="testAttrs"/> + <includeAttributes ref="langSpaceAttrs"/> + <includeAttributes ref="PresentationAttributes-All"/> + <includeAttributes ref="graphicsElementEvents"/> + <attribute>externalResourcesRequired</attribute> + <attribute>style</attribute> + <attribute>transform</attribute> + <attribute>class</attribute> + </attributes> + </element> + <element> + <tagname>glyph</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <attribute>class</attribute> + <attribute>style</attribute> + <includeAttributes ref="PresentationAttributes-All"/> + <attribute>unicode</attribute> + <attribute>glyph-name</attribute> + <attribute>d</attribute> + <attribute>orientation</attribute> + <attribute>arabic-form</attribute> + <attribute>lang</attribute> + <attribute>horiz-adv-x</attribute> + <attribute>vert-origin-x</attribute> + <attribute>vert-origin-y</attribute> + <attribute>vert-adv-y</attribute> + </attributes> + </element> + <element> + <tagname>glyphRef</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="xlinkRefAttrs"/> + <attribute>xlink:href</attribute> + <attribute>class</attribute> + <attribute>style</attribute> + <includeAttributes ref="PresentationAttributes-FontSpecification"/> + <attribute>glyphRef</attribute> + <attribute>format</attribute> + <attribute>x</attribute> + <attribute>y</attribute> + <attribute>dx</attribute> + <attribute>dy</attribute> + </attributes> + </element> + <element> + <tagname>hkern</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <attribute>u1</attribute> + <attribute>g1</attribute> + <attribute>u2</attribute> + <attribute>g2</attribute> + <attribute>k</attribute> + </attributes> + </element> + <element> + <tagname>image</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="xlinkRefAttrs"/> + <includeAttributes ref="testAttrs"/> + <includeAttributes ref="langSpaceAttrs"/> + <includeAttributes ref="PresentationAttributes-Graphics"/> + <includeAttributes ref="PresentationAttributes-Images"/> + <includeAttributes ref="PresentationAttributes-Viewports"/> + <includeAttributes ref="graphicsElementEvents"/> + <attribute>externalResourcesRequired</attribute> + <attribute>class</attribute> + <attribute>style</attribute> + <attribute>transform</attribute> + <attribute>preserveAspectRatio</attribute> + <attribute>xlink:href</attribute> + <attribute>x</attribute> + <attribute>y</attribute> + <attribute>width</attribute> + <attribute>height</attribute> + </attributes> + </element> + <element> + <tagname>line</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="testAttrs"/> + <includeAttributes ref="langSpaceAttrs"/> + <attribute>externalResourcesRequired</attribute> + <attribute>class</attribute> + <attribute>style</attribute> + <includeAttributes ref="PresentationAttributes-FillStroke"/> + <includeAttributes ref="PresentationAttributes-Graphics"/> + <includeAttributes ref="PresentationAttributes-Markers"/> + <attribute>transform</attribute> + <includeAttributes ref="graphicsElementEvents"/> + <attribute>x1</attribute> + <attribute>x2</attribute> + <attribute>y1</attribute> + <attribute>y2</attribute> + </attributes> + </element> + <element> + <tagname>linearGradient</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="xlinkRefAttrs"/> + <attribute>xlink:href</attribute> + <attribute>externalResourcesRequired</attribute> + <attribute>class</attribute> + <attribute>style</attribute> + <includeAttributes ref="PresentationAttributes-Gradients"/> + <attribute>gradientUnits</attribute> + <attribute>gradientTransform</attribute> + <attribute>class</attribute> + <attribute>x1</attribute> + <attribute>y1</attribute> + <attribute>x2</attribute> + <attribute>y2</attribute> + <attribute>spreadMethod</attribute> + </attributes> + </element> + <element> + <tagname>marker</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="langSpaceAttrs"/> + <attribute>externalResourcesRequired</attribute> + <attribute>class</attribute> + <attribute>style</attribute> + <includeAttributes ref="PresentationAttributes-All"/> + <attribute>viewBox</attribute> + <attribute>preserveAspectRatio</attribute> + <attribute>refX</attribute> + <attribute>refY</attribute> + <attribute>markerUnits</attribute> + <attribute>markerWidth</attribute> + <attribute>markerHeight</attribute> + <attribute>orient</attribute> + </attributes> + </element> + <element> + <tagname>mask</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="testAttrs"/> + <includeAttributes ref="langSpaceAttrs"/> + <attribute>externalResourcesRequired</attribute> + <attribute>class</attribute> + <attribute>style</attribute> + <includeAttributes ref="PresentationAttributes-All"/> + <attribute>transform</attribute> + <attribute>maskUnits</attribute> + <attribute>maskContentUnits</attribute> + <attribute>x</attribute> + <attribute>y</attribute> + <attribute>width</attribute> + <attribute>height</attribute> + </attributes> + </element> + <element> + <tagname>metadata</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + </attributes> + </element> + <element> + <tagname>missing-glyph</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <attribute>class</attribute> + <attribute>style</attribute> + <includeAttributes ref="PresentationAttributes-All"/> + <attribute>d</attribute> + <attribute>horiz-adv-x</attribute> + <attribute>vert-origin-x</attribute> + <attribute>vert-origin-y</attribute> + <attribute>vert-adv-y</attribute> + </attributes> + </element> + <element> + <tagname>mpath</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="xlinkRefAttrs"/> + <attribute>xlink:href</attribute> + <attribute>externalResourcesRequired</attribute> + </attributes> + </element> + <element> + <tagname>path</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="testAttrs"/> + <includeAttributes ref="langSpaceAttrs"/> + <includeAttributes ref="PresentationAttributes-FillStroke"/> + <includeAttributes ref="PresentationAttributes-Graphics"/> + <includeAttributes ref="PresentationAttributes-Markers"/> + <includeAttributes ref="graphicsElementEvents"/> + <attribute>externalResourcesRequired</attribute> + <attribute>style</attribute> + <attribute>transform</attribute> + <attribute>class</attribute> + <attribute>d</attribute> + <attribute>pathLength</attribute> + </attributes> + </element> + <element> + <tagname>pattern</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="xlinkRefAttrs"/> + <includeAttributes ref="testAttrs"/> + <includeAttributes ref="langSpaceAttrs"/> + <attribute>externalResourcesRequired</attribute> + <attribute>class</attribute> + <attribute>style</attribute> + <includeAttributes ref="PresentationAttributes-All"/> + <attribute>viewBox</attribute> + <attribute>preserveAspectRatio</attribute> + <attribute>xlink:href</attribute> + <attribute>width</attribute> + <attribute>height</attribute> + <attribute>x</attribute> + <attribute>y</attribute> + <attribute>patternUnits</attribute> + <attribute>patternContentUnits</attribute> + <attribute>patternTransform</attribute> + </attributes> + </element> + <element> + <tagname>polygon</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="testAttrs"/> + <includeAttributes ref="langSpaceAttrs"/> + <attribute>externalResourceRequired</attribute> + <attribute>class</attribute> + <attribute>style</attribute> + <includeAttributes ref="PresentationAttributes-FillStroke"/> + <includeAttributes ref="PresentationAttributes-Graphics"/> + <includeAttributes ref="PresentationAttributes-Markers"/> + <attribute>transform</attribute> + <includeAttributes ref="graphicsElementEvents"/> + <attribute>points</attribute> + </attributes> + </element> + <element> + <tagname>polyline</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="testAttrs"/> + <includeAttributes ref="langSpaceAttrs"/> + <attribute>externalResourceRequired</attribute> + <attribute>class</attribute> + <attribute>style</attribute> + <includeAttributes ref="PresentationAttributes-FillStroke"/> + <includeAttributes ref="PresentationAttributes-Graphics"/> + <includeAttributes ref="PresentationAttributes-Markers"/> + <attribute>transform</attribute> + <includeAttributes ref="graphicsElementEvents"/> + <attribute>points</attribute> + </attributes> + </element> + <element> + <tagname>radialGradient</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="xlinkRefAttrs"/> + <attribute>externalResourcesRequired</attribute> + <attribute>style</attribute> + <attribute>class</attribute> + <includeAttributes ref="PresentationAttributes-Gradients"/> + <attribute>gradientTransform</attribute> + <attribute>xlink:href</attribute> + <attribute>cx</attribute> + <attribute>cy</attribute> + <attribute>r</attribute> + <attribute>fx</attribute> + <attribute>fy</attribute> + <attribute>gradientUnits</attribute> + <attribute>spreadMethod</attribute> + </attributes> + </element> + <element> + <tagname>rect</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="testAttrs"/> + <includeAttributes ref="langSpaceAttrs"/> + <attribute>externalResourcesRequired</attribute> + <attribute>class</attribute> + <attribute>style</attribute> + <includeAttributes ref="PresentationAttributes-FillStroke"/> + <includeAttributes ref="PresentationAttributes-Graphics"/> + <attribute>transform</attribute> + <includeAttributes ref="graphicsElementEvents"/> + <attribute>x</attribute> + <attribute>y</attribute> + <attribute>width</attribute> + <attribute>height</attribute> + <attribute>rx</attribute> + <attribute>ry</attribute> + </attributes> + </element> + <element> + <tagname>set</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="testAttrs"/> + <attribute>externalResourcesRequired</attribute> + <includeAttributes ref="animationEvents"/> + <includeAttributes ref="animElementAttrs"/> + <includeAttributes ref="animAttributeAttrs"/> + <includeAttributes ref="animTimingAttrs"/> + <attribute>to</attribute> + </attributes> + </element> + <element> + <tagname>script</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="xlinkRefAttrs"/> + <attribute>xlink:href</attribute> + <attribute>externalResourcesRequired</attribute> + <attribute>type</attribute> + </attributes> + </element> + <element> + <tagname>stop</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <attribute>class</attribute> + <attribute>style</attribute> + <includeAttributes ref="PresentationAttributes-Gradients"/> + <attribute>offset</attribute> + </attributes> + </element> + <element addText="true"> + <tagname>style</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <attribute>xml:space</attribute> + <attribute>type</attribute> + <attribute>media</attribute> + <attribute>title</attribute> + </attributes> + </element> + <element> + <tagname>svg</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="testAttrs"/> + <includeAttributes ref="langSpaceAttrs"/> + <includeAttributes ref="PresentationAttributes-All"/> + <includeAttributes ref="graphicsElementEvents"/> + <includeAttributes ref="documentEvents"/> + <attribute>externalResourcesRequired</attribute> + <attribute>class</attribute> + <attribute>style</attribute> + <attribute>viewBox</attribute> + <attribute>preserveAspectRatio</attribute> + <attribute>zoomAndPan</attribute> + <attribute>x</attribute> + <attribute>y</attribute> + <attribute>width</attribute> + <attribute>height</attribute> + <attribute>contentScriptType</attribute> + <attribute>contentStyleType</attribute> + </attributes> + </element> + <element> + <tagname>switch</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="testAttrs"/> + <includeAttributes ref="langSpaceAttrs"/> + <includeAttributes ref="PresentationAttributes-all"/> + <includeAttributes ref="graphicsElementEvents"/> + <attribute>externalResourcesRequired</attribute> + <attribute>class</attribute> + <attribute>style</attribute> + <attribute>transform</attribute> + </attributes> + </element> + <element> + <tagname>symbol</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="langSpaceAttrs"/> + <attribute>externalResourcesRequired</attribute> + <includeAttributes ref="PresentationAttributes-All"/> + <includeAttributes ref="graphicsElementEvents"/> + <attribute>class</attribute> + <attribute>style</attribute> + <attribute>viewBox</attribute> + <attribute>preserveAspectRatio</attribute> + </attributes> + </element> + <element> + <tagname>tref</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="xlinkRefAttrs"/> + <attribute>xlink:href</attribute> + <includeAttributes ref="testAttrs"/> + <includeAttributes ref="langSpaceAttrs"/> + <attribute>externalResourcesRequired</attribute> + <attribute>class</attribute> + <attribute>style</attribute> + <includeAttributes ref="PresentationAttributes-FillStroke"/> + <includeAttributes ref="PresentationAttributes-FontSpecification"/> + <includeAttributes ref="PresentationAttributes-Graphics"/> + <includeAttributes ref="PresentationAttributes-TextContentElements"/> + <includeAttributes ref="graphicsElementEvents"/> + <attribute>x</attribute> + <attribute>y</attribute> + <attribute>dx</attribute> + <attribute>dy</attribute> + <attribute>rotate</attribute> + <attribute>textLength</attribute> + <attribute>lengthAdjust</attribute> + </attributes> + </element> + <element addText="true"> + <tagname>tspan</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="testAttrs"/> + <includeAttributes ref="langSpaceAttrs"/> + <attribute>externalResourcesRequired</attribute> + <attribute>class</attribute> + <attribute>style</attribute> + <includeAttributes ref="PresentationAttributes-FillStroke"/> + <includeAttributes ref="PresentationAttributes-FontSpecification"/> + <includeAttributes ref="PresentationAttributes-Graphics"/> + <includeAttributes ref="PresentationAttributes-TextContentElements"/> + <includeAttributes ref="graphicsElementEvents"/> + <attribute>x</attribute> + <attribute>y</attribute> + <attribute>dx</attribute> + <attribute>dy</attribute> + <attribute>rotate</attribute> + <attribute>textLength</attribute> + <attribute>lengthAdjust</attribute> + </attributes> + </element> + <element addText="true"> + <tagname>text</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="testAttrs"/> + <includeAttributes ref="langSpaceAttrs"/> + <attribute>externalResourcesRequired</attribute> + <attribute>class</attribute> + <attribute>style</attribute> + <includeAttributes ref="PresentationAttributes-FillStroke"/> + <includeAttributes ref="PresentationAttributes-FontSpecification"/> + <includeAttributes ref="PresentationAttributes-Graphics"/> + <includeAttributes ref="PresentationAttributes-TextContentElements"/> + <includeAttributes ref="PresentationAttributes-TextElements"/> + <attribute>transform</attribute> + <includeAttributes ref="graphicsElementEvents"/> + <attribute>x</attribute> + <attribute>y</attribute> + <attribute>textLength</attribute> + <attribute>lengthAdjust</attribute> + </attributes> + </element> + <element addText="true"> + <tagname>textPath</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="xlinkRefAttrs"/> + <attribute>xlink:href</attribute> + <includeAttributes ref="langSpaceAttrs"/> + <includeAttributes ref="testAttrs"/> + <attribute>externalResourcesRequired</attribute> + <attribute>class</attribute> + <attribute>style</attribute> + <includeAttributes ref="PresentationAttributes-FillStroke"/> + <includeAttributes ref="PresentationAttributes-FontSpecification"/> + <includeAttributes ref="PresentationAttributes-Graphics"/> + <includeAttributes ref="PresentationAttributes-TextContentElements"/> + <includeAttributes ref="graphicsElementEvents"/> + <attribute>startOffset</attribute> + <attribute>textLength</attribute> + <attribute>lengthAdjust</attribute> + <attribute>method</attribute> + <attribute>spacing</attribute> + </attributes> + </element> + <element addText="true"> + <tagname>title</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="langSpaceAttrs"/> + <includeAttributes ref="StructuredText"/> + <attribute>class</attribute> + <attribute>style</attribute> + </attributes> + </element> + <element> + <tagname>use</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <includeAttributes ref="xlinkRefAttrs"/> + <includeAttributes ref="testAttrs"/> + <includeAttributes ref="langSpaceAttrs"/> + <includeAttributes ref="PresentationAttributes-All"/> + <includeAttributes ref="graphicsElementEvents"/> + <attribute>externalResourcesRequired</attribute> + <attribute>class</attribute> + <attribute>style</attribute> + <attribute>transform</attribute> + <attribute>xlink:href</attribute> + <attribute>x</attribute> + <attribute>y</attribute> + <attribute>width</attribute> + <attribute>height</attribute> + </attributes> + </element> + <element> + <tagname>vkern</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <attribute>u1</attribute> + <attribute>g1</attribute> + <attribute>u2</attribute> + <attribute>g2</attribute> + <attribute>k</attribute> + </attributes> + </element> + <element> + <tagname>view</tagname> + <attributes> + <includeAttributes ref="stdAttrs"/> + <attribute>externalResourcesRequired</attribute> + <attribute>viewBox</attribute> + <attribute>preserveAspectRatio</attribute> + <attribute>zoomAndPan</attribute> + <attribute>viewTarget</attribute> + </attributes> + </element> +</elements> diff --git a/src/codegen/svgproperties.xml b/src/codegen/svgproperties.xml deleted file mode 100644 index 1a689e871..000000000 --- a/src/codegen/svgproperties.xml +++ /dev/null @@ -1,259 +0,0 @@ -<?xml version="1.0" ?> -<property-list family="SVG"> - <generic-property-list> - <!-- SVG Properties. All use generic maker and have no overrides! --> - <property> - <name>width</name> - <use-generic ispropclass="true">SVGLengthProperty</use-generic> - </property> - <property> - <name>height</name> - <use-generic ispropclass="true">SVGLengthProperty</use-generic> - </property> - <property> - <name>x</name> - <use-generic ispropclass="true">SVGLengthProperty</use-generic> - </property> - <property> - <name>y</name> - <use-generic ispropclass="true">SVGLengthProperty</use-generic> - </property> - <property> - <name>x1</name> - <use-generic ispropclass="true">SVGLengthProperty</use-generic> - </property> - <property> - <name>y1</name> - <use-generic ispropclass="true">SVGLengthProperty</use-generic> - </property> - <property> - <name>x2</name> - <use-generic ispropclass="true">SVGLengthProperty</use-generic> - </property> - <property> - <name>y2</name> - <use-generic ispropclass="true">SVGLengthProperty</use-generic> - </property> - <property> - <name>rx</name> - <use-generic ispropclass="true">SVGLengthProperty</use-generic> - </property> - <property> - <name>ry</name> - <use-generic ispropclass="true">SVGLengthProperty</use-generic> - </property> - <property> - <name>dx</name> - <use-generic ispropclass="true">SVGLengthProperty</use-generic> - </property> - <property> - <name>dy</name> - <use-generic ispropclass="true">SVGLengthProperty</use-generic> - </property> - <property> - <name>cx</name> - <use-generic ispropclass="true">SVGLengthProperty</use-generic> - </property> - <property> - <name>cy</name> - <use-generic ispropclass="true">SVGLengthProperty</use-generic> - </property> - <property> - <name>r</name> - <use-generic ispropclass="true">SVGLengthProperty</use-generic> - </property> - <property> - <name>fx</name> - <use-generic ispropclass="true">SVGLengthProperty</use-generic> - </property> - <property> - <name>fy</name> - <use-generic ispropclass="true">SVGLengthProperty</use-generic> - </property> - <property> - <name>refX</name> - <use-generic ispropclass="true">SVGLengthProperty</use-generic> - </property> - <property> - <name>refY</name> - <use-generic ispropclass="true">SVGLengthProperty</use-generic> - </property> - <property> - <name>markerWidth</name> - <use-generic ispropclass="true">SVGLengthProperty</use-generic> - </property> - <property> - <name>markerHeight</name> - <use-generic ispropclass="true">SVGLengthProperty</use-generic> - </property> - <property> - <name>offset</name> - <use-generic ispropclass="true">SVGLengthProperty</use-generic> - </property> - - <property> - <name>style</name> - <use-generic ispropclass="true">SVGStyle</use-generic> - </property> - <property> - <name>transform</name> - <use-generic ispropclass="true">SVGTransform</use-generic> - </property> - <property> - <name>gradientTransform</name> - <use-generic ispropclass="true">SVGTransform</use-generic> - </property> - <property> - <name>d</name> - <use-generic ispropclass="true">SVGD</use-generic> - </property> - <property> - <name>points</name> - <use-generic ispropclass="true">SVGPoints</use-generic> - </property> - - <property type="ref" family="fo"> - <name>font-family</name> - </property> - <property type="ref" family="fo"> - <name>font-style</name> - </property> - <property type="ref" family="fo"> - <name>font-weight</name> - </property> - <property type="ref" family="fo"> - <name>font-size</name> - </property> - <property type="ref" family="fo"> - <name>id</name> - </property> - - <property> - <name>xlink:href</name> - <class-name>HRef</class-name> - <inherited>false</inherited> - <datatype>String</datatype> - <default></default> - </property> - <property> - <name>requiredFeatures</name> - <class-name>RequiredFeatures</class-name> - <inherited>false</inherited> - <datatype>String</datatype> - <default>notpresent</default> - </property> - <property> - <name>requiredExtensions</name> - <class-name>RequiredExtensions</class-name> - <inherited>false</inherited> - <datatype>String</datatype> - <default>notpresent</default> - </property> - <property> - <name>systemLanguage</name> - <class-name>SystemLanguage</class-name> - <inherited>false</inherited> - <datatype>String</datatype> - <default>notpresent</default> - </property> - <property> - <name>class</name> - <class-name>ElementClass</class-name> - <inherited>false</inherited> - <datatype>String</datatype> - <default></default> - </property> - <property> - <name>xml:space</name> - <class-name>XMLSpace</class-name> - <inherited>true</inherited> - <datatype>Enum</datatype> - <enumeration> - <value const="PRESERVE">preserve</value> - <value const="DEFAULT">default</value> - </enumeration> - <default>default</default> - </property> - <property> - <name>spreadMethod</name> - <class-name>SpreadMethod</class-name> - <inherited>false</inherited> - <datatype>Enum</datatype> - <enumeration> - <value const="PAD">pad</value> - <value const="REFLECT">reflect</value> - <value const="REPEAT">repeat</value> - </enumeration> - <default>pad</default> - </property> - <property> - <name>gradientUnits</name> - <use-generic>GenericUnits</use-generic> - </property> - <property> - <name>patternUnits</name> - <use-generic>GenericUnits</use-generic> - </property> - <property> - <name>patternContentUnits</name> - <use-generic>GenericUnits</use-generic> - </property> - <property> - <name>clipPathUnits</name> - <use-generic>GenericUnits</use-generic> - </property> - <property type="generic"> - <name>GenericUnits</name> - <class-name>GenericUnits</class-name> - <inherited>false</inherited> - <datatype>Enum</datatype> - <enumeration> - <value const="USER_SPACE_ON_USE">userSpaceOnUse</value> - <value const="OBJECT_BOUNDING_BOX">objectBoundingBox</value> - </enumeration> - <default>userSpaceOnUse</default> - </property> - <property> - <name>viewBox</name> - <class-name>ViewBox</class-name> - <inherited>false</inherited> - <datatype>String</datatype> - <default></default> - </property> - <property> - <name>text-anchor</name> - <class-name>TextAnchor</class-name> - <inherited>true</inherited> - <datatype>Enum</datatype> - <enumeration> - <value const="START">start</value> - <value const="MIDDLE">middle</value> - <value const="END">end</value> - <value const="INHERIT">inherit</value> - </enumeration> - <default>start</default> - </property> - </generic-property-list> - - <element-property-list> - <localname>tref</localname> - <localname>tspan</localname> - <property> - <name>x</name> - <use-generic ispropclass="true">SVGLengthListProperty</use-generic> - </property> - <property> - <name>y</name> - <use-generic ispropclass="true">SVGLengthListProperty</use-generic> - </property> - <property> - <name>dx</name> - <use-generic ispropclass="true">SVGLengthListProperty</use-generic> - </property> - <property> - <name>dy</name> - <use-generic ispropclass="true">SVGLengthListProperty</use-generic> - </property> - </element-property-list> - -</property-list> diff --git a/src/org/apache/fop/datatypes/PathData.java b/src/org/apache/fop/datatypes/PathData.java deleted file mode 100644 index bdb91cf63..000000000 --- a/src/org/apache/fop/datatypes/PathData.java +++ /dev/null @@ -1,302 +0,0 @@ -/*-- $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.datatypes; - -import org.apache.fop.fo.Property; -import org.apache.fop.svg.PathPoint; -import org.apache.fop.dom.svg.*; -import org.w3c.dom.svg.*; - -import java.util.*; -/** - * a PathData quantity in XSL - * This class parses the string of path data and create a list of - * object commands. It is up to renderers (or whatever) to interpret - * the command properly. - * eg. m at the start is an absolute moveto. - * - * - * @author Keiron Liddle <keiron@aftexsw.com> - */ -public class PathData { - Vector table = new Vector(); - - /** - * set the PathData given a particular String specifying PathData and units - */ - public PathData (String len) - { - convert(len); - } - - protected void convert(String len) - { - StringTokenizer st = new StringTokenizer(len, "MmLlHhVvCcSsQqTtAaZz", true); - /* - * If there are two numbers and no spaces then it is assumed that all - * numbers are the same number of chars (3), otherwise there is an error - * not mentioned in spec. - */ - while(st.hasMoreTokens()) { - String str = st.nextToken(); - int pos; - if(str.equals("M")) { - float[][] vals = getPoints(2, st); - if(vals != null) { - for(int count = 0; count < vals.length; count++) { - addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_MOVETO_ABS, vals[count])); - } - } - } else if(str.equals("m")) { - // if first element treat as M - // otherwise treat as implicit lineto, this is handled by renderers - float[][] vals = getPoints(2, st); - if(vals != null) { - for(int count = 0; count < vals.length; count++) { - addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_MOVETO_REL, vals[count])); - } - } - } else if(str.equals("L")) { - float[][] vals = getPoints(2, st); - if(vals != null) { - for(int count = 0; count < vals.length; count++) { - addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_LINETO_ABS, vals[count])); - } - } - } else if(str.equals("l")) { - float[][] vals = getPoints(2, st); - if(vals != null) { - for(int count = 0; count < vals.length; count++) { - addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_LINETO_REL, vals[count])); - } - } - } else if(str.equals("H")) { - float[][] vals = getPoints(1, st); - if(vals != null) { - for(int count = 0; count < vals.length; count++) { - addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS, vals[count])); - } - } - } else if(str.equals("h")) { - float[][] vals = getPoints(1, st); - if(vals != null) { - for(int count = 0; count < vals.length; count++) { - addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL, vals[count])); - } - } - } else if(str.equals("V")) { - float[][] vals = getPoints(1, st); - if(vals != null) { - for(int count = 0; count < vals.length; count++) { - addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS, vals[count])); - } - } - } else if(str.equals("v")) { - float[][] vals = getPoints(1, st); - if(vals != null) { - for(int count = 0; count < vals.length; count++) { - addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL, vals[count])); - } - } - } else if(str.equals("C")) { - float[][] vals = getPoints(6, st); - if(vals != null) { - for(int count = 0; count < vals.length; count++) { - addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS, vals[count])); - } - } - } else if(str.equals("c")) { - float[][] vals = getPoints(6, st); - if(vals != null) { - for(int count = 0; count < vals.length; count++) { - addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL, vals[count])); - } - } - } else if(str.equals("S")) { - float[][] vals = getPoints(4, st); - if(vals != null) { - for(int count = 0; count < vals.length; count++) { - addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS, vals[count])); - } - } - } else if(str.equals("s")) { - float[][] vals = getPoints(4, st); - if(vals != null) { - for(int count = 0; count < vals.length; count++) { - addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL, vals[count])); - } - } - } else if(str.equals("Q")) { - float[][] vals = getPoints(4, st); - if(vals != null) { - for(int count = 0; count < vals.length; count++) { - addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS, vals[count])); - } - } - } else if(str.equals("q")) { - float[][] vals = getPoints(4, st); - if(vals != null) { - for(int count = 0; count < vals.length; count++) { - addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL, vals[count])); - } - } - } else if(str.equals("T")) { - float[][] vals = getPoints(2, st); - if(vals != null) { - for(int count = 0; count < vals.length; count++) { - addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS, vals[count])); - } - } - } else if(str.equals("t")) { - float[][] vals = getPoints(2, st); - if(vals != null) { - for(int count = 0; count < vals.length; count++) { - addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL, vals[count])); - } - } - } else if(str.equals("A")) { - float[][] vals = getPoints(7, st); - if(vals != null) { - for(int count = 0; count < vals.length; count++) { - addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_ARC_ABS, vals[count])); - } - } - } else if(str.equals("a")) { - float[][] vals = getPoints(7, st); - if(vals != null) { - for(int count = 0; count < vals.length; count++) { - addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_ARC_REL, vals[count])); - } - } - } else if(str.equals("Z") || str.equals("z")) { - addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_CLOSEPATH, null)); - } - } - } - - public Vector getPath() - { - return table; - } - - public String toString() - { - return ""; - } - - float[][] getPoints(int num, StringTokenizer st) - { - float[] set; - String str; - int pos; - float[][] ret = null; - if(st.hasMoreTokens()) { - str = st.nextToken(); - str = str.trim(); -// pos = str.indexOf(" "); -/* if((str.indexOf(" ") == -1) && (str.indexOf(",") == -1) && (str.indexOf("-") == -1)) { - int length = str.length(); - if((length % num) != 0) { - // invalid number comb - } else { - // how do we determine the length of a single number? - } - } else {*/ - { - StringTokenizer pointtok = new StringTokenizer(str, " ,-\n\r\t", true); - int count = 0; - Vector values = new Vector(); - set = new float[num]; - boolean neg; - while(pointtok.hasMoreTokens()) { - String point = null; - String delim = pointtok.nextToken(); - if(delim.equals("-")) { - neg = true; - if(pointtok.hasMoreTokens()) { - point = pointtok.nextToken(); - } else { - break; - } - } else { - neg = false; - if(delim.equals(" ") || delim.equals(",") || delim.equals("\r") || delim.equals("\n") || delim.equals("\t")) { - continue; - } - point = delim; - } - - float pd = Float.valueOf(point).floatValue(); - if(neg) - pd = -pd; - set[count] = pd; - count++; - if(count == num) { - values.addElement(set); - set = new float[num]; - count = 0; - } - } - count = 0; - ret = new float[values.size()][]; - for(Enumeration e = values.elements(); e.hasMoreElements(); ) { - ret[count++] = (float[])e.nextElement(); - } - } - } - return ret; - } - - protected void addSVGPathSeg(SVGPathSeg pc) - { - table.addElement(pc); - } -} diff --git a/src/org/apache/fop/datatypes/StyleData.java b/src/org/apache/fop/datatypes/StyleData.java deleted file mode 100644 index c1c2548bc..000000000 --- a/src/org/apache/fop/datatypes/StyleData.java +++ /dev/null @@ -1,81 +0,0 @@ -/*-- $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.datatypes; - -import org.apache.fop.fo.Property; -import org.apache.fop.messaging.MessageHandler; - -import org.apache.fop.dom.svg.*; -import org.apache.fop.dom.css.*; - -import org.w3c.dom.css.*; - -import java.util.*; -/** - * a StyleData quantity in XSL - * - * @author Keiron Liddle <keiron@aftexsw.com> - */ -public class StyleData { - CSSStyleDeclaration styleDec = new CSSStyleDeclarationImpl(); - - /** - * set the StyleData given a particular String specifying StyleData and units - */ - public StyleData (String str) { - styleDec.setCssText(str); - } - - public CSSStyleDeclaration getStyle() - { - return styleDec; - } -} diff --git a/src/org/apache/fop/datatypes/TransformData.java b/src/org/apache/fop/datatypes/TransformData.java deleted file mode 100644 index 067712b37..000000000 --- a/src/org/apache/fop/datatypes/TransformData.java +++ /dev/null @@ -1,228 +0,0 @@ -/*-- $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.datatypes; - -import org.apache.fop.fo.Property; -import org.apache.fop.messaging.MessageHandler; - -import org.apache.fop.dom.svg.*; -import org.apache.fop.dom.svg.SVGTransformImpl; - -import org.w3c.dom.svg.*; - -import java.util.*; -/** - * a TransformData quantity in XSL - * - * @author Keiron Liddle <keiron@aftexsw.com> - * modified Nov 14,2000 Mike Crowe <crowe@psilongbeach.com> - */ -public class TransformData { - SVGAnimatedTransformListImpl trans; - - /** - * set the TransformData given a particular String specifying TransformData and units - */ - public TransformData (String len) { - convert(len); - } - - - /** - * The following is taken from CR-SVG-20000802 7.6, Transform Attribute - * The value of the transform attribute is a <transform-list>, which is - * defined as a list of transform definitions, which are applied in the - * order provided. The individual transform definitions are separated by - * whitespace and/or a comma. The available types of transform - * definitions include: - * - * matrix(<a> <b> <c> <d> <e> <f>), which specifies a transformation in the - * form of a transformation matrix of six values. - * matrix(a,b,c,d,e,f) is equivalent to applying the transformation matrix - * [a b c d e f]. - * - * translate(<tx> [<ty>]), which specifies a translation by tx and ty. - * - * scale(<sx> [<sy>]), which specifies a scale operation by sx and sy. If <sy> - * is not provided, it is assumed to be equal to <sx>. - * - * rotate(<rotate-angle> [<cx> <cy>]), which specifies a rotation by - * <rotate-angle> degrees about a given point. - * If optional parameters <cx> and <cy> are not supplied, the rotate is about - * the origin of the current user coordinate system. The - * operation corresponds to the matrix [cos(a) sin(a) -sin(a) cos(a) 0 0]. - * If optional parameters <cx> and <cy> are supplied, the rotate is about the - * point (<cx>, <cy>). The operation represents the - * equivalent of the following specification: translate(<cx>, <cy>) - * rotate(<rotate-angle>) translate(-<cx>, -<cy>). - * - * skewX(<skew-angle>), which specifies a skew transformation along the - * x-axis. - * skewY(<skew-angle>), which specifies a skew transformation along the - * y-axis. - */ - protected void convert(String len) { - Vector list = new Vector(); - StringTokenizer st = new StringTokenizer(len, "()"); - // need to check for unbalanced brackets - while (st.hasMoreTokens()) { - String str = st.nextToken(); - String type = str.trim(); - String value; - if (st.hasMoreTokens()) { - value = st.nextToken().trim(); - SVGTransform transform = new SVGTransformImpl(); - - if (type.equals("matrix")) { - SVGMatrix matrix = new SVGMatrixImpl(); - StringTokenizer mt = - new StringTokenizer(value, " ,\r\n-", true); - if (mt.hasMoreTokens()) - matrix.setA(extractValue(mt)); - if (mt.hasMoreTokens()) - matrix.setB(extractValue(mt)); - if (mt.hasMoreTokens()) - matrix.setC(extractValue(mt)); - if (mt.hasMoreTokens()) - matrix.setD(extractValue(mt)); - if (mt.hasMoreTokens()) - matrix.setE(extractValue(mt)); - if (mt.hasMoreTokens()) - matrix.setF(extractValue(mt)); - transform.setMatrix(matrix); - list.addElement(transform); - } else if (type.equals("translate")) { - float xlen = 0; - float ylen = 0; - StringTokenizer mt = - new StringTokenizer(value, " ,\r\n-", true); - if (mt.hasMoreTokens()) - xlen = extractValue(mt); - if (mt.hasMoreTokens()) - ylen = extractValue(mt); - - transform.setTranslate(xlen, ylen); - list.addElement(transform); - } else if (type.equals("scale")) { - float xlen = 0; - float ylen = 0; - StringTokenizer mt = - new StringTokenizer(value, " ,\r\n-", true); - - if (mt.hasMoreTokens()) - xlen = extractValue(mt); - if (mt.hasMoreTokens()) - ylen = extractValue(mt); - else - ylen = xlen; - - transform.setScale(xlen, ylen); - list.addElement(transform); - } else if (type.equals("rotate")) { - SVGAngleImpl angle = new SVGAngleImpl(); - angle.setValueAsString(value); - - transform.setRotate(angle.getValue(), 0, 0); - list.addElement(transform); - } else if (type.equals("skewX")) { - SVGAngleImpl angle = new SVGAngleImpl(); - angle.setValueAsString(value); - - transform.setSkewX(angle.getValue()); - list.addElement(transform); - } else if (type.equals("skewY")) { - SVGAngleImpl angle = new SVGAngleImpl(); - angle.setValueAsString(value); - - transform.setSkewY(angle.getValue()); - list.addElement(transform); - - } else { - MessageHandler.errorln( - "WARNING: Unknown Transform type : " + type); - } - - } - } - if (list != null) { - SVGTransformList stl = new SVGTransformListImpl(); - for (Enumeration e = list.elements(); e.hasMoreElements();) { - stl.appendItem((SVGTransform) e.nextElement()); - } - trans = new SVGAnimatedTransformListImpl(); - trans.setBaseVal(stl); - } - } - - private float extractValue(StringTokenizer mt) { - String tok = mt.nextToken(); - boolean neg = false; - while (tok.equals(" ") || tok.equals(",") || tok.equals("\n") || - tok.equals("\r") || tok.equals("-")) { - if (tok.equals("-")) { - neg = true; - } - if (!mt.hasMoreTokens()) - break; - tok = mt.nextToken(); - } - if (neg) - tok = "-" + tok; - SVGLengthImpl length = new SVGLengthImpl(); - length.setValueAsString(tok); - return(length.getValue()); - } - - - public SVGAnimatedTransformList getTransform() { - return trans; - } -} diff --git a/src/org/apache/fop/dom/CharacterDataImpl.java b/src/org/apache/fop/dom/CharacterDataImpl.java deleted file mode 100644 index ed7d39e68..000000000 --- a/src/org/apache/fop/dom/CharacterDataImpl.java +++ /dev/null @@ -1,114 +0,0 @@ -/*-- $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.dom; - -import org.apache.fop.datatypes.*; -import org.apache.fop.messaging.*; -import org.apache.fop.dom.svg.*; - -import org.w3c.dom.*; - -import java.util.*; - -/** - * - * - */ -public class CharacterDataImpl extends NodeImpl implements CharacterData { - String str; - - public CharacterDataImpl() - { - } - - public String getData() - { - return str; - } - - public void setData(String s) - { - str = s; - } - - public void insertData(int i, String s) - { - } - - public void deleteData(int i, int j) - { - } - - public int getLength() - { - return str.length(); - } - - public void appendData(String s) - { - str = str + s; - } - - public void replaceData(int i, int j, String s) - { - } - - public String substringData(int i, int j) - { - return str.substring(i, j); - } - - public String toString() - { - return "Character Data: " + str; - } -} diff --git a/src/org/apache/fop/dom/ElementImpl.java b/src/org/apache/fop/dom/ElementImpl.java deleted file mode 100644 index 9e10b6daa..000000000 --- a/src/org/apache/fop/dom/ElementImpl.java +++ /dev/null @@ -1,173 +0,0 @@ -/*-- $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.dom; - -import org.apache.fop.datatypes.*; - -import org.w3c.dom.*; - -import java.util.*; - -/** - * - * - */ -public class ElementImpl extends NodeImpl implements Element { - - public Node replaceChild(Node n, Node no) - { - return null; - } - - public String getAttribute(String name) - { - return null; - } - - public void setAttribute(String name, String value) throws DOMException - { - } - - public void removeAttribute(String name) throws DOMException - { - } - - public Attr getAttributeNode(String name) - { - return null; - } - - public Attr setAttributeNode(Attr newAttr) - throws DOMException - { - return null; - } - - public Attr removeAttributeNode(Attr oldAttr) - throws DOMException - { - return null; - } - - public NodeList getElementsByTagName(String name) - { - NodeList nl = getChildNodes(); - Vector eles = new Vector(); - for(int count = 0; count < nl.getLength(); count++) { - Node el = (Node)nl.item(count); - if(el instanceof Element) { - if(name.equals(((Element)el).getTagName())) { - eles.addElement(el); - } - NodeList subtags = ((Element)el).getElementsByTagName(name); - for(int c = 0; c < subtags.getLength(); c++) { - Node node = (Node)subtags.item(c); - eles.addElement(node); - } - } - } - NodeList val = new NodeListImpl(eles); - return val; - } - - public String getAttributeNS(String namespaceURI, - String localName) - { - return null; - } - - public void setAttributeNS(String namespaceURI, - String qualifiedName, - String value) - throws DOMException - { - } - - public void removeAttributeNS(String namespaceURI, - String localName) - throws DOMException - { - } - - public Attr getAttributeNodeNS(String namespaceURI, - String localName) - { - return null; - } - - public Attr setAttributeNodeNS(Attr newAttr) - throws DOMException - { - return null; - } - - public NodeList getElementsByTagNameNS(String namespaceURI, - String localName) - { - return null; - } - - public boolean hasAttributeNS (String namespaceURI, - String localName) - { - return false; - } - - public boolean hasAttribute (String name) - { - return false; - } - - public boolean hasAttributes() - { - return false; - } -} diff --git a/src/org/apache/fop/dom/NodeImpl.java b/src/org/apache/fop/dom/NodeImpl.java deleted file mode 100644 index 7a2c263d6..000000000 --- a/src/org/apache/fop/dom/NodeImpl.java +++ /dev/null @@ -1,238 +0,0 @@ -/*-- $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.dom; - -import org.apache.fop.datatypes.*; - -import org.w3c.dom.*; - -import java.util.*; - -/** - * - * - */ -public class NodeImpl implements Node { - protected Vector childs = new Vector(); - Node parent = null; - protected Document ownerDoc; - - public Node replaceChild(Node n, Node no) - { - return null; - } - - public String getNodeName() - { - return null; - } - - public short getNodeType() - { - return 0; - } - - public Node getParentNode() - { - return parent; - } - - public NodeList getChildNodes() - { - return new NodeListImpl(childs); - } - - public Node getFirstChild() - { - if(childs.size() > 0) { - return (Node)childs.elementAt(0); - } - return null; - } - - public Node getLastChild() - { - if(childs.size() > 0) { - return (Node)childs.elementAt(childs.size() - 1); - } - return null; - } - - public Node getPreviousSibling() - { - int ind = ((NodeImpl)parent).childs.indexOf(this); - if(ind > 0) { - return (Node)((NodeImpl)parent).childs.elementAt(ind - 1); - } - return null; - } - - public Node getNextSibling() - { - int ind = ((NodeImpl)parent).childs.indexOf(this); - if(ind + 1 < ((NodeImpl)parent).childs.size()) { - return (Node)((NodeImpl)parent).childs.elementAt(ind + 1); - } - return null; - } - - public NamedNodeMap getAttributes() - { - return null; - } - - public Document getOwnerDocument() - { - return ownerDoc; - } - - void setOwnerDocument(Document doc) - { - ownerDoc = doc; - NodeList nl = getChildNodes(); - for(int count = 0; count < nl.getLength(); count++) { - Node n = nl.item(count); - if(n instanceof ElementImpl) { - ((ElementImpl)n).setOwnerDocument(ownerDoc); - } - } - } - - public Node insertBefore(Node newChild, - Node refChild) - throws DOMException - { - return null; - } - - public Node removeChild(Node oldChild) - throws DOMException - { - return null; - } - - public Node appendChild(Node newChild) - throws DOMException - { - childs.addElement(newChild); - if(newChild instanceof ElementImpl) { - ElementImpl ele = (ElementImpl)newChild; - ele.parent = this; - ele.setOwnerDocument(ownerDoc); - } - return newChild; - } - - public boolean hasChildNodes() - { - return childs.size() > 0; - } - - public Node cloneNode(boolean deep) - { - return null; - } - - public void normalize() - { - } - - public boolean supports(String feature, - String version) - { - return false; - } - - public boolean isSupported(String feature, - String version) - { - return false; - } - - - public String getNamespaceURI() - { - return ""; - } - - public String getPrefix() - { - return "svg"; - } - - public void setPrefix(String prefix) throws DOMException - { - } - - public String getLocalName() - { - return null; - } - - public String getNodeValue() throws DOMException - { - return null; - } - - public void setNodeValue(String nodeValue) throws DOMException - { - } - - public String getTagName() - { - return null; - } - - public boolean hasAttributes() - { - return false; - } -} diff --git a/src/org/apache/fop/dom/NodeListImpl.java b/src/org/apache/fop/dom/NodeListImpl.java deleted file mode 100644 index 8a800eaf9..000000000 --- a/src/org/apache/fop/dom/NodeListImpl.java +++ /dev/null @@ -1,86 +0,0 @@ -/*-- $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.dom; - -import org.apache.fop.datatypes.*; - -import org.w3c.dom.*; - -import java.util.*; - -/** - * - * - */ -class NodeListImpl implements NodeList -{ - Vector vect = null; - - NodeListImpl(Vector v) - { - vect = v; - } - - public int getLength() - { - return vect.size(); - } - - public Node item(int i) - { - return (Node)vect.elementAt(i); - } - - public String toString() - { - return vect.toString(); - } -} diff --git a/src/org/apache/fop/dom/css/CSSPrimitiveValueImpl.java b/src/org/apache/fop/dom/css/CSSPrimitiveValueImpl.java deleted file mode 100644 index 484925726..000000000 --- a/src/org/apache/fop/dom/css/CSSPrimitiveValueImpl.java +++ /dev/null @@ -1,116 +0,0 @@ -/*-- $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.dom.css; - -import org.w3c.dom.css.*; - -/** - * - * - */ -public class CSSPrimitiveValueImpl extends CSSValueImpl implements CSSPrimitiveValue { - short primType = CSS_UNKNOWN; - float floatVal = 0; - String strVal = null; - - public CSSPrimitiveValueImpl() - { - type = CSS_PRIMITIVE_VALUE; - } - - public short getPrimitiveType() - { - return primType; - } - - public void setFloatValue(short unitType, - float floatValue) - { - primType = unitType; - this.floatVal = floatValue; - } - - public float getFloatValue(short unitType) - { - return this.floatVal; - } - - public void setStringValue(short stringType, - String stringValue) - { - strVal = stringValue; - } - - public String getStringValue() - { - return strVal; - } - - public Counter getCounterValue() - { - return null; - } - - public Rect getRectValue() - { - return null; - } - - public RGBColor getRGBColorValue() - { - if(primType == CSSPrimitiveValue.CSS_RGBCOLOR) { - } else { - // throw a DOMException - } - return null; - } -} diff --git a/src/org/apache/fop/dom/css/CSSStyleDeclarationImpl.java b/src/org/apache/fop/dom/css/CSSStyleDeclarationImpl.java deleted file mode 100644 index 194add272..000000000 --- a/src/org/apache/fop/dom/css/CSSStyleDeclarationImpl.java +++ /dev/null @@ -1,394 +0,0 @@ -/*-- $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.dom.css; - -import org.apache.fop.datatypes.*; -import org.apache.fop.messaging.*; -import org.apache.fop.dom.svg.*; - -import org.w3c.dom.css.*; -import org.w3c.dom.svg.*; - -import java.util.*; - -/** - * - * - */ -public class CSSStyleDeclarationImpl implements CSSStyleDeclaration { - Hashtable table = new Hashtable(); - - public CSSStyleDeclarationImpl() { - } - - public String removeProperty(String str) { - return null; - } - - public String getCssText() { - return null; - } - - public void setCssText(String str) { - try { - parseStyleText(str); - } catch (Exception e) { - e.printStackTrace(); - } - } - - protected void parseStyleText(String len) { - StringTokenizer st = new StringTokenizer(len, ";"); - while (st.hasMoreTokens()) { - String str = st.nextToken(); - int pos; - pos = str.indexOf(":"); - if (pos != -1) { - String type = str.substring(0, pos).trim(); - String value = str.substring(pos + 1, str.length()).trim(); - if (type.equals("stroke-width")) { - CSSPrimitiveValue primval = new LengthValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("stroke")) { - CSSPrimitiveValue primval = new RGBColorValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("color")) { - CSSPrimitiveValue primval = new RGBColorValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("stroke-linecap")) { - CSSPrimitiveValue primval = new StringValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("stroke-linejoin")) { - CSSPrimitiveValue primval = new StringValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("stroke-miterlimit")) { - CSSPrimitiveValue primval = new LengthValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("stroke-dasharray")) { - // array of space or comma separated numbers - if (!value.equals("none")) { - CSSValueListImpl list = new CSSValueListImpl(); - StringTokenizer array = - new StringTokenizer(value, " ,"); - while (array.hasMoreTokens()) { - CSSPrimitiveValue primval = new LengthValue(); - primval.setCssText(array.nextToken()); - list.addValue(primval); - } - table.put(type, list); - } else { - CSSPrimitiveValue primval = new StringValue(); - primval.setCssText(value); - table.put(type, primval); - } - } else if (type.equals("stroke-dashoffset")) { - CSSPrimitiveValue primval = new LengthValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("stroke-opacity")) { - CSSPrimitiveValue primval = new LengthValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("fill")) { - CSSPrimitiveValue primval = new RGBColorValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("fill-rule")) { - // nonzero - CSSPrimitiveValue primval = new StringValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("font")) { - CSSPrimitiveValue primval = new StringValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("font-size")) { - CSSPrimitiveValue primval = new LengthValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("font-family")) { - CSSPrimitiveValue primval = new StringValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("font-weight")) { - CSSPrimitiveValue primval = new StringValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("font-style")) { - CSSPrimitiveValue primval = new StringValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("font-variant")) { - CSSPrimitiveValue primval = new StringValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("font-stretch")) { - CSSPrimitiveValue primval = new StringValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("font-size-adjust")) { - CSSPrimitiveValue primval = new StringValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("letter-spacing")) { - CSSPrimitiveValue primval = new LengthValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("word-spacing")) { - CSSPrimitiveValue primval = new LengthValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("text-decoration")) { - CSSPrimitiveValue primval = new StringValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("mask")) { - CSSPrimitiveValue primval = new URIValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("fill-opacity")) { - CSSPrimitiveValue primval = new LengthValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("opacity")) { - CSSPrimitiveValue primval = new LengthValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("filter")) { - // table.put(type, new Filter(value)); - } else if (type.equals("stop-color")) { - CSSPrimitiveValue primval = new RGBColorValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("stop-opacity")) { - CSSPrimitiveValue primval = new LengthValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("overflow")) { - CSSPrimitiveValue primval = new StringValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("clip-rule")) { - CSSPrimitiveValue primval = new StringValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("clip-path")) { - CSSPrimitiveValue primval = new URIValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("clip")) { - CSSPrimitiveValue primval = new URIValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("marker-start")) { - CSSPrimitiveValue primval = new URIValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("marker-mid")) { - CSSPrimitiveValue primval = new URIValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("marker-end")) { - CSSPrimitiveValue primval = new URIValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("text-antialiasing")) { - // boolean - } else if (type.equals("stroke-antialiasing")) { - // boolean - } else if (type.equals("writing-mode")) { - } else if (type.equals("glyph-orientation-vertical")) { - } else if (type.equals("glyph-orientation-horizontal")) { - } else if (type.equals("direction")) { - } else if (type.equals("unicode-bidi")) { - } else if (type.equals("text-anchor")) { - CSSPrimitiveValue primval = new StringValue(); - primval.setCssText(value); - table.put(type, primval); - } else if (type.equals("dominant-baseline")) { - } else if (type.equals("baseline-identifier")) { - } else if (type.equals("baseline-shift")) { - } else if (type.equals("font-size-adjust")) { - } else { - MessageHandler.logln( - "WARNING: Unknown style element : " + type); - } - } else { - if (!"".equals(str.trim())) - MessageHandler.errorln( - "ERROR: Invalid style element " + str); - } - } - } - - public String getPropertyValue(String str) { - return getPropertyCSSValue(str).getCssText(); - } - - public void setProperty(String a, String b, String c) { - } - - public String item(int n) { - return null; - } - - public CSSRule getParentRule() { - return null; - } - - public String getPropertyPriority(String str) { - return null; - } - - public CSSValue getPropertyCSSValue(String str) { - return (CSSValue) table.get(str); - } - - public int getLength() { - return table.size(); - } - - class RGBColorValue extends CSSPrimitiveValueImpl { - RGBColor col = null; - - public void setCssText(String str) { - super.setCssText(str); - if (str.startsWith("url(")) { - primType = CSS_URI; - } else if (str.equals("currentColor")) { - primType = CSS_STRING; - } else if (!str.equals("none")) { - float red; - float green; - float blue; - ColorType ct = new ColorType(str); - red = ct.red(); - green = ct.green(); - blue = ct.blue(); - col = new RGBColorImpl(red, green, blue); - primType = CSS_RGBCOLOR; - } else { - primType = CSS_STRING; - } - } - - public RGBColor getRGBColorValue() { - if (primType != CSS_RGBCOLOR) { - // throw exception - } - return col; - } - } - - /* - * This should probably be moved to dom.svg... - */ - class LengthValue extends CSSPrimitiveValueImpl { - - public void setCssText(String str) { - super.setCssText(str); - SVGLength length = new SVGLengthImpl(str); - floatVal = length.getValue(); - switch (length.getUnitType()) { - case SVGLength.SVG_LENGTHTYPE_IN: - primType = CSS_IN; - break; - case SVGLength.SVG_LENGTHTYPE_CM: - primType = CSS_CM; - break; - case SVGLength.SVG_LENGTHTYPE_MM: - primType = CSS_MM; - break; - case SVGLength.SVG_LENGTHTYPE_PT: - primType = CSS_PT; - break; - case SVGLength.SVG_LENGTHTYPE_PC: - primType = CSS_PC; - break; - case SVGLength.SVG_LENGTHTYPE_EMS: - primType = CSS_EMS; - break; - case SVGLength.SVG_LENGTHTYPE_PX: - primType = CSS_PX; - break; - case SVGLength.SVG_LENGTHTYPE_PERCENTAGE: - primType = CSS_PERCENTAGE; - break; - case SVGLength.SVG_LENGTHTYPE_NUMBER: - primType = CSS_NUMBER; - break; - } - } - } - - class StringValue extends CSSPrimitiveValueImpl { - - public void setCssText(String str) { - super.setCssText(str); - primType = CSS_STRING; - } - } - - class URIValue extends CSSPrimitiveValueImpl { - - public void setCssText(String str) { - super.setCssText(str); - primType = CSS_URI; - } - } -} diff --git a/src/org/apache/fop/dom/css/CSSStyleRuleImpl.java b/src/org/apache/fop/dom/css/CSSStyleRuleImpl.java deleted file mode 100644 index 5d6e37a35..000000000 --- a/src/org/apache/fop/dom/css/CSSStyleRuleImpl.java +++ /dev/null @@ -1,323 +0,0 @@ -/*-- $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.dom.css; - -//import org.apache.fop.dom.svg.*; -import org.w3c.dom.svg.*; - -import org.w3c.dom.css.*; -import org.w3c.dom.*; -import org.w3c.dom.stylesheets.*; - -import java.util.*; - -/** - * - * - */ -public class CSSStyleRuleImpl implements CSSStyleRule { - String seltext; - String cssText; - CSSStyleDeclaration style; - CSSStyleSheet styleSheet; - Vector selectors = new Vector(); - - public CSSStyleRuleImpl(CSSStyleSheet styleSheet) - { - this.styleSheet = styleSheet; - } - - public String getSelectorText() - { - return seltext; - } - - /** - * Selectors are comma separated values (except for attributes) - * of all the selectors for the style. - */ - public void setSelectorText(String selectorText) - { - seltext = selectorText; - parseSelector(); - } - - protected void parseSelector() - { - // need to handle "," in attribute selectors - StringTokenizer st = new StringTokenizer(seltext, ","); - while(st.hasMoreTokens()) { - String sel = st.nextToken().trim(); - StringTokenizer subt = new StringTokenizer(sel, " \t\n\r"); - Selector last = null; - Selector current = null; - int compoundstate = 0; - while(subt.hasMoreTokens()) { - String str = subt.nextToken().trim(); - current = new Selector(); - boolean compounding = false; - if(str.equals("*")) { - // all - current.type = Selector.ALL; - current.value = "*"; - } else if(str.equals(">")) { - // child of - compoundstate = 1; - compounding = true; - } else if(str.equals("+")) { - // precedent of - compoundstate = 2; - compounding = true; - } else if(str.startsWith("#")) { - // id - current.type = Selector.ID; - current.value = str.substring(1); - } else if(str.startsWith(".")) { - // class - current.type = Selector.CLASS; - current.value = str.substring(1); - } else if(str.startsWith("[")) { - // attribute - current.type = Selector.ATTRIBUTE; - current.value = str.substring(1, str.length() - 1); - } else { - // tag - current.type = Selector.TAG; - if(str.indexOf(":") != -1) { - current.type = Selector.TAG_FIRST_CHILD; - int pos = str.indexOf(":"); - current.value = str.substring(0, pos); - current.subValue = str.substring(pos + 1); - } else if(str.indexOf("#") != -1) { - current.type = Selector.TAG_ID; - int pos = str.indexOf("#"); - current.value = str.substring(0, pos); - current.subValue = str.substring(pos + 1); - } else if(str.indexOf(".") != -1) { - current.type = Selector.TAG_CLASS; - int pos = str.indexOf("."); - current.value = str.substring(0, pos); - current.subValue = str.substring(pos + 1); - } else { - current.value = str; - } - } - if(!compounding) { - switch(compoundstate) { - case 0: - if(last != null) { - Selector compound = new Selector(); - compound.type = Selector.DESCENDANT; - compound.last = last; - compound.current = current; - current = compound; - compoundstate = 0; - } - break; - case 1: - { - Selector compound = new Selector(); - compound.type = Selector.CHILD; - compound.last = last; - compound.current = current; - current = compound; - compoundstate = 0; - } - break; - case 2: - { - Selector compound = new Selector(); - compound.type = Selector.PRECEDENT; - compound.last = last; - compound.current = current; - current = compound; - compoundstate = 0; - } - break; - } - last = current; - } - } - if(current != null) - selectors.addElement(current); - } - } - - public CSSStyleDeclaration getStyle() - { - return style; - } - - public String getCssText() - { - return cssText; - } - - public void setCssText(String cssText) - { - this.cssText = cssText; - style = new CSSStyleDeclarationImpl(); - style.setCssText(cssText); - } - - public short getType() - { - return STYLE_RULE; - } - - public CSSStyleSheet getParentStyleSheet() - { - return styleSheet; - } - - public CSSRule getParentRule() - { - return null; - } - - /** - * This should probably be elsewhere, in dom.svg - */ - public boolean matches(SVGElement el) - { - for(Enumeration e = selectors.elements(); e.hasMoreElements(); ) { - Selector sel = (Selector)e.nextElement(); - if(matches(el, sel)) - return true; - } - return false; - } - - protected boolean matches(SVGElement el, Selector sel) - { - short type = sel.type; - if(el == null) - return false; - switch(type) { - case Selector.ALL: - return true; -// break; - case Selector.ID: - return el.getId().equals(sel.value); -// break; - case Selector.CLASS: - return ((SVGStylable)el).getClassName().getBaseVal().equals(sel.value); -// break; - case Selector.ATTRIBUTE: -//System.out.println(sel.value + ":" + el.getAttribute(sel.value)); -// return el.getAttribute(sel.value); - break; - case Selector.TAG: - return sel.value.equals(el.getTagName()); -// break; - case Selector.TAG_FIRST_CHILD: - if(el.getParentNode() != null) - return (el.getParentNode().getFirstChild() == el); - break; - case Selector.TAG_ID: - return sel.value.equals(el.getTagName()) - && sel.subValue.equals(el.getId()); -// break; - case Selector.TAG_CLASS: - return sel.value.equals(el.getTagName()) - && sel.subValue.equals(((SVGStylable)el).getClassName().getBaseVal()); -// break; - case Selector.DESCENDANT: - if(el.getParentNode() instanceof SVGElement) { - if(!matches(el, sel.current)) - return false; - SVGElement parent = (SVGElement)el.getParentNode(); - while(parent != null) { - if(matches(parent, sel.last)) - return true; - if(parent.getParentNode() instanceof SVGElement) { - parent = (SVGElement)parent.getParentNode(); - } else { - return false; - } - } - } - return false; -// break; - case Selector.CHILD: - return matches(el, sel.current) - && matches((SVGElement)el.getParentNode(), sel.last); -// break; - case Selector.PRECEDENT: - return matches(el, sel.current) - && matches((SVGElement)el.getPreviousSibling(), sel.last); -// break; - } - return false; - } -} - -class Selector { - final static short NONE = -1; - final static short ALL = 0; - final static short ID = 1; - final static short CLASS = 2; - final static short ATTRIBUTE = 3; - final static short TAG = 4; - final static short DESCENDANT = 5; - final static short CHILD = 6; - final static short PRECEDENT = 7; - final static short TAG_FIRST_CHILD = 8; - final static short TAG_ID = 9; - final static short TAG_CLASS = 10; - short type = NONE; - String value = ""; - String subValue = ""; - // pre- simple selector in compound selectors - Selector last = null; - Selector current = null; -} diff --git a/src/org/apache/fop/dom/css/CSSStyleSheetImpl.java b/src/org/apache/fop/dom/css/CSSStyleSheetImpl.java deleted file mode 100644 index 97ee8ef3f..000000000 --- a/src/org/apache/fop/dom/css/CSSStyleSheetImpl.java +++ /dev/null @@ -1,194 +0,0 @@ -/*-- $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.dom.css; - -import org.w3c.dom.css.*; -import org.w3c.dom.*; -import org.w3c.dom.stylesheets.*; - -import java.util.*; - -/** - * - * - */ -public class CSSStyleSheetImpl implements CSSStyleSheet { - Vector rules = new Vector(); - - public CSSStyleSheetImpl(String sheet) - { - parseSheet(sheet); - } - - protected void parseSheet(String str) - { - // get each rule and insert it - // rule ends with } - // need to ignore comments - String newStr = str; - int pos1; - int pos2; - pos1 = newStr.indexOf("/*"); - pos2 = newStr.indexOf("*/"); - while((pos1 != -1) && (pos2 != -1)) { - newStr = newStr.substring(0, pos1) + newStr.substring(pos2 + 2, newStr.length()); - pos1 = newStr.indexOf("/*"); - pos2 = newStr.indexOf("*/"); - } - StringTokenizer st = new StringTokenizer(newStr, "}"); - while(st.hasMoreTokens()) { - String rule = st.nextToken() + "}"; - insertRule(rule, rules.size()); - } - } - - public CSSRule getOwnerRule() - { - // since this is for a style element - return null; - } - - public CSSRuleList getCssRules() - { - return new CSSRuleListImpl(rules); - } - - public int insertRule(String rule, - int index) - throws DOMException - { - CSSRule r = parseRule(rule); - if(r != null) - rules.addElement(r); - return 0; - } - - public void deleteRule(int index) - throws DOMException - { - rules.removeElementAt(index); - } - - public String getType() - { - return "text/css"; - } - - public boolean getDisabled() - { - return false; - } - - public void setDisabled(boolean disabled) - { - } - - public Node getOwnerNode() - { - // return the style element - return null; - } - - public StyleSheet getParentStyleSheet() - { - return null; - } - - public String getHref() - { - return null; - } - - public String getTitle() - { - return null; - } - - public MediaList getMedia() - { - return null; - } - - protected CSSRule parseRule(String str) - { - // a rule is "selectors {style}" - // a list of selectors followed by the style statement in brackets - int pos1 = str.indexOf("{"); - int pos2 = str.indexOf("}"); - if(pos1 == -1 || pos2 == -1) - return null; - String sel = str.substring(0, pos1); - String style = str.substring(pos1 + 1, pos2); - CSSStyleRule rule = new CSSStyleRuleImpl(this); - rule.setSelectorText(sel); - rule.setCssText(style); - return rule; - } -} - -class CSSRuleListImpl implements CSSRuleList { - Vector rules; - CSSRuleListImpl(Vector v) - { - rules = v; - } - - public int getLength() - { - return rules.size(); - } - - public CSSRule item(int pos) - { - return (CSSRule)rules.elementAt(pos); - } -} diff --git a/src/org/apache/fop/dom/css/CSSValueImpl.java b/src/org/apache/fop/dom/css/CSSValueImpl.java deleted file mode 100644 index 9b7b2986c..000000000 --- a/src/org/apache/fop/dom/css/CSSValueImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -/*-- $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.dom.css; - -import org.w3c.dom.css.*; - -/** - * - * - */ -public class CSSValueImpl implements CSSValue { - String text; - short type; - - public CSSValueImpl() - { - } - - public void setCssText(String str) - { - text = str; - } - - public String getCssText() - { - return text; - } - - public short getValueType() - { - return type; - } -} diff --git a/src/org/apache/fop/dom/css/CSSValueListImpl.java b/src/org/apache/fop/dom/css/CSSValueListImpl.java deleted file mode 100644 index 91053618b..000000000 --- a/src/org/apache/fop/dom/css/CSSValueListImpl.java +++ /dev/null @@ -1,80 +0,0 @@ -/*-- $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.dom.css; - -import org.w3c.dom.css.*; - -import java.util.Vector; - -/** - * - * - */ -public class CSSValueListImpl extends CSSValueImpl implements CSSValueList { - Vector values = new Vector(); - - public CSSValueListImpl() { - type = CSS_VALUE_LIST; - } - - public int getLength() { - return values.size(); - } - - public CSSValue item(int index) { - return (CSSValue) values.elementAt(index); - } - - void addValue(CSSValue val) { - values.addElement(val); - } -} diff --git a/src/org/apache/fop/dom/css/RGBColorImpl.java b/src/org/apache/fop/dom/css/RGBColorImpl.java deleted file mode 100644 index b937df46e..000000000 --- a/src/org/apache/fop/dom/css/RGBColorImpl.java +++ /dev/null @@ -1,89 +0,0 @@ -/*-- $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.dom.css; - -import org.w3c.dom.css.*; - -/** - * - * - */ -public class RGBColorImpl implements RGBColor { - CSSPrimitiveValue red; - CSSPrimitiveValue green; - CSSPrimitiveValue blue; - - public RGBColorImpl(float r, float g, float b) - { - red = new CSSPrimitiveValueImpl(); - red.setFloatValue(CSSPrimitiveValue.CSS_NUMBER, r); - green = new CSSPrimitiveValueImpl(); - green.setFloatValue(CSSPrimitiveValue.CSS_NUMBER, g); - blue = new CSSPrimitiveValueImpl(); - blue.setFloatValue(CSSPrimitiveValue.CSS_NUMBER, b); - } - - public CSSPrimitiveValue getRed() - { - return red; - } - - public CSSPrimitiveValue getGreen() - { - return green; - } - - public CSSPrimitiveValue getBlue() - { - return blue; - } -} diff --git a/src/org/apache/fop/dom/stylesheets/StyleSheetListImpl.java b/src/org/apache/fop/dom/stylesheets/StyleSheetListImpl.java deleted file mode 100644 index ebd0ccb46..000000000 --- a/src/org/apache/fop/dom/stylesheets/StyleSheetListImpl.java +++ /dev/null @@ -1,79 +0,0 @@ -/*-- $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.dom.stylesheets; - -import org.w3c.dom.stylesheets.*; - -import java.util.*; - -/** - * - * - */ -public class StyleSheetListImpl implements StyleSheetList { - Vector sheets = new Vector(); - - public StyleSheetListImpl(Vector sheets) - { - this.sheets = sheets; - } - - public int getLength() - { - return sheets.size(); - } - - public StyleSheet item(int pos) - { - return (StyleSheet)sheets.elementAt(pos); - } -} diff --git a/src/org/apache/fop/dom/svg/GraphicElement.java b/src/org/apache/fop/dom/svg/GraphicElement.java deleted file mode 100644 index 682bdad1e..000000000 --- a/src/org/apache/fop/dom/svg/GraphicElement.java +++ /dev/null @@ -1,257 +0,0 @@ -/*-- $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.dom.svg; - -import java.util.Enumeration; - -import org.apache.fop.datatypes.*; - -import org.w3c.dom.svg.*; -import org.w3c.dom.*; -import org.w3c.dom.events.*; - -/** - * base class for SVG graphic objects. - * - * Graphic objects include rectangles, lines and text - * - */ -public abstract class GraphicElement extends SVGElementImpl implements SVGTransformable, -SVGLangSpace, SVGTests, EventTarget { - protected SVGStringList reqFeatures; - protected SVGStringList reqExtensions; - protected SVGStringList sysLanguage; - SVGAnimatedTransformList transform; - String xmlspace = "default"; - - public SVGElement getNearestViewportElement() { - Node node = getParentNode(); - while (node != null) { - if (node instanceof SVGGElement) { - return (SVGElement) node; - } else if (node instanceof SVGSVGElement) { - return (SVGElement) node; - } - node = getParentNode(); - } - return null; - } - - public SVGElement getFarthestViewportElement() { - Node node = getParentNode(); - SVGElement viewport = null; - while (node != null) { - if (node instanceof SVGGElement) { - viewport = (SVGElement) node; - } else if (node instanceof SVGSVGElement) { - viewport = (SVGElement) node; - } - node = getParentNode(); - } - return viewport; - } - - public SVGAnimatedTransformList getTransform() { - if (transform != null) { - return transform; - } - SVGTransformList stl = new SVGTransformListImpl(); - SVGTransform transform = new SVGTransformImpl(); - stl.appendItem(transform); - SVGAnimatedTransformListImpl atl = - new SVGAnimatedTransformListImpl(); - atl.setBaseVal(stl); - return atl; - } - - public void setTransform(SVGAnimatedTransformList transform) { - this.transform = transform; - } - - public SVGRect getBBox() { - return null; - } - - /** - * Returns the transformation matrix from current user units (i.e., after - * application of the transform attribute) to the viewport coordinate system - * for the nearestViewportElement. - */ - public SVGMatrix getCTM() { - return transform.getBaseVal().consolidate().getMatrix(); - } - - /** - * Returns the transformation matrix from current user units (i.e., after - * application of the transform attribute) to the parent user agent's notice - * of a "pixel". For display devices, ideally this represents a physical - * screen pixel. For other devices or environments where physical pixel sizes - * are not known, then an algorithm similar to the CSS2 definition of a "pixel" - * can be used instead. - * This is the matrix that converts from the user space to the position - * on the screen. - */ - public SVGMatrix getScreenCTM() { - if (transform == null) { - return new SVGMatrixImpl(); - } - Node node = getParentNode(); - SVGMatrix matrix = null; - if (node != null && node instanceof SVGTransformable) { - matrix = ((SVGTransformable) node).getScreenCTM(); - } - if (matrix != null) { - matrix = transform.getBaseVal().consolidate().getMatrix(). - multiply(matrix); - } else { - matrix = transform.getBaseVal().consolidate().getMatrix(); - } - return matrix; - } - - public SVGMatrix getTransformToElement(SVGElement element) - throws SVGException { - return null; - } - - public String getXMLlang() { - return null; - } - - public void setXMLlang(String xmllang) { - } - - public String getXMLspace() { - return xmlspace; - } - - public void setXMLspace(String xmlspace) { - this.xmlspace = xmlspace; - } - - public SVGStringList getRequiredFeatures() { - return reqFeatures; - } - - public void setRequiredFeatures(SVGStringList requiredFeatures) - throws DOMException { - reqFeatures = requiredFeatures; - } - - public SVGStringList getRequiredExtensions() { - return reqExtensions; - } - - public void setRequiredExtensions(SVGStringList requiredExtensions) - throws DOMException { - reqExtensions = requiredExtensions; - } - - public boolean hasExtension (String extension) { - return false; - } - - public SVGStringList getSystemLanguage() { - return sysLanguage; - } - - public void setSystemLanguage(SVGStringList systemLanguage) { - sysLanguage = systemLanguage; - } - - public void addEventListener(String type, EventListener listener, - boolean useCapture) { - } - - public void removeEventListener(String type, - EventListener listener, boolean useCapture) { - } - - public boolean dispatchEvent(Event evt)// throws EventException - { - return false; - } - - /** - * Convenience method for implementations of SVGTransformable - * that have children that represents the bounding box - */ - protected SVGRect getChildrenBBox() { - float minX = 10000000; // a big number - float maxX = -10000000; // a low number - float minY = 10000000; // a big number - float maxY = -10000000; // a low number - NodeList nl = getChildNodes(); - // can width and height be negative?? - for (int count = 0; count < nl.getLength(); count++) { - Node n = nl.item(count); - if (n instanceof SVGTransformable) { - SVGRect r = ((SVGTransformable) n).getBBox(); - if (r != null) { - if (minX > r.getX()) - minX = r.getX(); - if (minY > r.getY()) - minY = r.getY(); - if (maxX < r.getX() + r.getWidth()) - maxX = r.getX() + r.getWidth(); - if (maxY > r.getY() + r.getHeight()) - maxY = r.getY() + r.getHeight(); - } - } - } - SVGRect rect = new SVGRectImpl(); - rect.setX(minX); - rect.setY(minY); - rect.setWidth(maxX - minX); - rect.setHeight(maxY - minY); - return rect; - } -} diff --git a/src/org/apache/fop/dom/svg/GraphicImpl.java b/src/org/apache/fop/dom/svg/GraphicImpl.java deleted file mode 100644 index 72dfc5c4a..000000000 --- a/src/org/apache/fop/dom/svg/GraphicImpl.java +++ /dev/null @@ -1,76 +0,0 @@ -/*-- $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.dom.svg; - -import org.apache.fop.datatypes.*; - -import java.util.*; - -import org.w3c.dom.svg.SVGElement; - -/** - * base class for SVG graphic objects. - * - * Graphic objects include rectangles, lines and text - * - */ -// use this so that the SVGArea can also hold style, defs and transform etc. -public interface GraphicImpl { - public Hashtable oldgetStyle(); - public void setParent(SVGElement g); - public SVGElement getGraphicParent(); - public Vector oldgetTransform(); // ?? - public Hashtable getDefs(); - public SVGElement locateDef(String str); - public void setStyle(Hashtable st); - public void addDefs(Hashtable st); - public void setTransform(Vector tr); // ?? -} diff --git a/src/org/apache/fop/dom/svg/SVGAElementImpl.java b/src/org/apache/fop/dom/svg/SVGAElementImpl.java deleted file mode 100644 index 66206068e..000000000 --- a/src/org/apache/fop/dom/svg/SVGAElementImpl.java +++ /dev/null @@ -1,81 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; - -/** - * class representing a line in an SVG Area - * - */ -public class SVGAElementImpl extends SVGURIReferenceImpl implements SVGAElement { - SVGAnimatedString target; - - public SVGAElementImpl() - { - } - - public void setTarget(SVGAnimatedString str) - { - target = str; - } - - public SVGAnimatedString getTarget() - { - return target; - } - - public SVGRect getBBox() - { - return getChildrenBBox(); - } -} diff --git a/src/org/apache/fop/dom/svg/SVGAltGlyphElementImpl.java b/src/org/apache/fop/dom/svg/SVGAltGlyphElementImpl.java deleted file mode 100644 index f1bec3848..000000000 --- a/src/org/apache/fop/dom/svg/SVGAltGlyphElementImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -/*-- $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.dom.svg; - -/** - * class representing a line in an SVG Area - * - */ -public class SVGAltGlyphElementImpl extends SVGElementImpl { - public SVGAltGlyphElementImpl() - { - } -} diff --git a/src/org/apache/fop/dom/svg/SVGAngleImpl.java b/src/org/apache/fop/dom/svg/SVGAngleImpl.java deleted file mode 100644 index ec7d44daa..000000000 --- a/src/org/apache/fop/dom/svg/SVGAngleImpl.java +++ /dev/null @@ -1,205 +0,0 @@ -/*-- $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.dom.svg; - -import org.apache.fop.fo.Property; - -import java.util.*; -import java.text.*; - -import org.w3c.dom.svg.*; - -/** - * SVG Angle. - * - * @author Keiron Liddle <keiron@aftexsw.com> - * modified Nov 14,2000 Mike Crowe <crowe@psilongbeach.com>, Fop internal - * representation of angles is in degrees, added convert before doing any trig - * function - */ -public class SVGAngleImpl implements SVGAngle { - float value = 0; - short unitType = SVG_ANGLETYPE_UNKNOWN; - - public SVGAngleImpl() { - } - - public short getUnitType() { - return unitType; - } - - public float getValue() { - return value; - } - - public void setValue(float value) { - this.value = value; - } - - public float getValueInSpecifiedUnits() { - switch (unitType) { - case SVG_ANGLETYPE_UNKNOWN: - throw new SVGExceptionImpl( - SVGException.SVG_WRONG_TYPE_ERR, "unknown unit type"); - // break; - case SVG_ANGLETYPE_UNSPECIFIED: - throw new SVGExceptionImpl( - SVGException.SVG_WRONG_TYPE_ERR, "unknown unit type"); - // break; - case SVG_ANGLETYPE_DEG: - break; - case SVG_ANGLETYPE_RAD: - break; - case SVG_ANGLETYPE_GRAD: - break; - } - return 0; - } - - public void setValueInSpecifiedUnits(float valueInSpecifiedUnits) { - switch (unitType) { - case SVG_ANGLETYPE_UNKNOWN: - throw new SVGExceptionImpl( - SVGException.SVG_WRONG_TYPE_ERR, "unknown unit type"); - // break; - case SVG_ANGLETYPE_UNSPECIFIED: - throw new SVGExceptionImpl( - SVGException.SVG_WRONG_TYPE_ERR, "unknown unit type"); - // break; - case SVG_ANGLETYPE_DEG: - break; - case SVG_ANGLETYPE_RAD: - break; - case SVG_ANGLETYPE_GRAD: - break; - } - } - - public String getValueAsString() { - NumberFormat nf = NumberFormat.getInstance(); - return nf.format(value); - } - - /** - *The following is from CR-SVG-20000802 4.1 Basic Data Types; - * <angle>: An angle value is a <number> optionally followed - * immediately with an angle unit identifier. Angle unit identifiers are: - * deg: degrees m - * grad: grads m - * rad: radians m - * For properties defined in [CSS2], an angle unit identifier must be - * provided. For SVG-specific attributes and properties, the angle unit - * identifier is optional. If not provided, the angle value is assumed to be - * in degrees. - */ - public void setValueAsString(String valueAsString) { - NumberFormat nf = NumberFormat.getInstance(); - try { - value = nf.parse(valueAsString).floatValue(); - if (valueAsString.indexOf("grad") != -1) { - value = (float)(value * 360.0 / 400.0); - } else if (valueAsString.indexOf("rad") != -1) { - value = (float)(value * 180.0 / Math.PI); - } - } catch (ParseException pe) { - value = 0; - } - } - - public float getAnimatedValue() { - return 0; - } - - public void newValueSpecifiedUnits (short unitType, - float valueInSpecifiedUnits) throws SVGException { - switch (unitType) { - case SVG_ANGLETYPE_UNKNOWN: - throw new SVGExceptionImpl( - SVGException.SVG_WRONG_TYPE_ERR, "unknown unit type"); - // break; - case SVG_ANGLETYPE_UNSPECIFIED: - throw new SVGExceptionImpl( - SVGException.SVG_WRONG_TYPE_ERR, "unknown unit type"); - // break; - case SVG_ANGLETYPE_DEG: - value = (float)(valueInSpecifiedUnits * Math.PI / 90.0); - break; - case SVG_ANGLETYPE_RAD: - value = valueInSpecifiedUnits; - break; - case SVG_ANGLETYPE_GRAD: - value = (float)(valueInSpecifiedUnits * Math.PI / 90.0); - break; - } - this.unitType = unitType; - } - - public void convertToSpecifiedUnits (short unitType) - throws SVGException { - switch (unitType) { - case SVG_ANGLETYPE_UNKNOWN: - throw new SVGExceptionImpl( - SVGException.SVG_WRONG_TYPE_ERR, "unknown unit type"); - // break; - case SVG_ANGLETYPE_UNSPECIFIED: - throw new SVGExceptionImpl( - SVGException.SVG_WRONG_TYPE_ERR, "unknown unit type"); - // break; - case SVG_ANGLETYPE_DEG: - break; - case SVG_ANGLETYPE_RAD: - break; - case SVG_ANGLETYPE_GRAD: - break; - } - this.unitType = unitType; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGAnimateColorElementImpl.java b/src/org/apache/fop/dom/svg/SVGAnimateColorElementImpl.java deleted file mode 100644 index e39f1bf5b..000000000 --- a/src/org/apache/fop/dom/svg/SVGAnimateColorElementImpl.java +++ /dev/null @@ -1,63 +0,0 @@ -/*-- $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.dom.svg; - -/** - * - * - */ -public class SVGAnimateColorElementImpl extends SVGElementImpl { - - public SVGAnimateColorElementImpl() - { - } -} diff --git a/src/org/apache/fop/dom/svg/SVGAnimateElementImpl.java b/src/org/apache/fop/dom/svg/SVGAnimateElementImpl.java deleted file mode 100644 index 6c45033d2..000000000 --- a/src/org/apache/fop/dom/svg/SVGAnimateElementImpl.java +++ /dev/null @@ -1,63 +0,0 @@ -/*-- $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.dom.svg; - -/** - * - * - */ -public class SVGAnimateElementImpl extends SVGElementImpl { - - public SVGAnimateElementImpl() - { - } -} diff --git a/src/org/apache/fop/dom/svg/SVGAnimateMotionElementImpl.java b/src/org/apache/fop/dom/svg/SVGAnimateMotionElementImpl.java deleted file mode 100644 index a6c98546e..000000000 --- a/src/org/apache/fop/dom/svg/SVGAnimateMotionElementImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -/*-- $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.dom.svg; - -/** - * - */ -public class SVGAnimateMotionElementImpl extends SVGElementImpl { - - public SVGAnimateMotionElementImpl() - { - } -} diff --git a/src/org/apache/fop/dom/svg/SVGAnimateTransformElementImpl.java b/src/org/apache/fop/dom/svg/SVGAnimateTransformElementImpl.java deleted file mode 100644 index 99512eedf..000000000 --- a/src/org/apache/fop/dom/svg/SVGAnimateTransformElementImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -/*-- $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.dom.svg; - -/** - * - */ -public class SVGAnimateTransformElementImpl extends SVGElementImpl { - - public SVGAnimateTransformElementImpl() - { - } -} diff --git a/src/org/apache/fop/dom/svg/SVGAnimatedEnumerationImpl.java b/src/org/apache/fop/dom/svg/SVGAnimatedEnumerationImpl.java deleted file mode 100644 index 585e390aa..000000000 --- a/src/org/apache/fop/dom/svg/SVGAnimatedEnumerationImpl.java +++ /dev/null @@ -1,80 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; - -import org.w3c.dom.DOMException; - -public class SVGAnimatedEnumerationImpl implements SVGAnimatedEnumeration { - short baseval = 0; - - public SVGAnimatedEnumerationImpl(short base) - { - baseval = base; - } - - public short getBaseVal( ) - { - return baseval; - } - - public void setBaseVal(short baseVal) - { - this.baseval = baseVal; - } - - public short getAnimVal( ) - { - return baseval; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGAnimatedLengthImpl.java b/src/org/apache/fop/dom/svg/SVGAnimatedLengthImpl.java deleted file mode 100644 index 3e21499fb..000000000 --- a/src/org/apache/fop/dom/svg/SVGAnimatedLengthImpl.java +++ /dev/null @@ -1,78 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; - -public class SVGAnimatedLengthImpl implements SVGAnimatedLength { - SVGLength len = null; - - public SVGAnimatedLengthImpl(SVGLength l) - { - len = l; - } - - public SVGLength getBaseVal( ) - { - return len; - } - - public void setBaseVal( SVGLength baseVal ) - { - len = baseVal; - } - - public SVGLength getAnimVal( ) - { - return len; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGAnimatedLengthListImpl.java b/src/org/apache/fop/dom/svg/SVGAnimatedLengthListImpl.java deleted file mode 100644 index 0c1feb8fa..000000000 --- a/src/org/apache/fop/dom/svg/SVGAnimatedLengthListImpl.java +++ /dev/null @@ -1,79 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; - -/** - * a length quantity in XSL - */ -public class SVGAnimatedLengthListImpl extends SVGListImpl implements SVGAnimatedLengthList { - SVGLengthList baseVal; - - public SVGAnimatedLengthListImpl() - { - } - - public SVGLengthList getBaseVal( ) - { - return baseVal; - } - - public void setBaseVal(SVGLengthList baseVal) - { - this.baseVal = baseVal; - } - - public SVGLengthList getAnimVal( ) - { - return baseVal; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGAnimatedNumberImpl.java b/src/org/apache/fop/dom/svg/SVGAnimatedNumberImpl.java deleted file mode 100644 index bc3a0b626..000000000 --- a/src/org/apache/fop/dom/svg/SVGAnimatedNumberImpl.java +++ /dev/null @@ -1,84 +0,0 @@ -/*-- $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.dom.svg; - -import org.apache.fop.fo.Property; - -import java.util.*; - -import org.w3c.dom.svg.*; - -/** - * - */ -public class SVGAnimatedNumberImpl implements SVGAnimatedNumber { - float base = 0; - - public SVGAnimatedNumberImpl(float b) - { - base = b; - } - - public float getBaseVal() - { - return base; - } - - public void setBaseVal(float baseVal) - { - base = baseVal; - } - - public float getAnimVal() - { - return base; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGAnimatedRectImpl.java b/src/org/apache/fop/dom/svg/SVGAnimatedRectImpl.java deleted file mode 100644 index 5ddc97a62..000000000 --- a/src/org/apache/fop/dom/svg/SVGAnimatedRectImpl.java +++ /dev/null @@ -1,78 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; - -public class SVGAnimatedRectImpl implements SVGAnimatedRect { - SVGRect rect = null; - - public SVGAnimatedRectImpl(SVGRect r) - { - rect = r; - } - - public SVGRect getBaseVal( ) - { - return rect; - } - - public void setBaseVal( SVGRect baseVal ) - { - rect = baseVal; - } - - public SVGRect getAnimVal( ) - { - return rect; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGAnimatedStringImpl.java b/src/org/apache/fop/dom/svg/SVGAnimatedStringImpl.java deleted file mode 100644 index b65ad9960..000000000 --- a/src/org/apache/fop/dom/svg/SVGAnimatedStringImpl.java +++ /dev/null @@ -1,78 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; - -public class SVGAnimatedStringImpl implements SVGAnimatedString { - String str = null; - - public SVGAnimatedStringImpl(String l) - { - str = l; - } - - public String getBaseVal( ) - { - return str; - } - - public void setBaseVal( String baseVal ) - { - str = baseVal; - } - - public String getAnimVal( ) - { - return str; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGAnimatedTransformListImpl.java b/src/org/apache/fop/dom/svg/SVGAnimatedTransformListImpl.java deleted file mode 100644 index 5144008c5..000000000 --- a/src/org/apache/fop/dom/svg/SVGAnimatedTransformListImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -/*-- $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.dom.svg; - -import java.util.*; - -import org.w3c.dom.svg.*; -import org.w3c.dom.*; - -/** - * Transform List - */ -public class SVGAnimatedTransformListImpl implements SVGAnimatedTransformList { - SVGTransformList base; - - public SVGAnimatedTransformListImpl() - { - } - - public SVGTransformList getBaseVal( ) - { - return base; - } - - public void setBaseVal(SVGTransformList baseVal ) - { - base = baseVal; - } - - public SVGTransformList getAnimVal() - { - return null; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGCircleElementImpl.java b/src/org/apache/fop/dom/svg/SVGCircleElementImpl.java deleted file mode 100644 index 8a3ee7e71..000000000 --- a/src/org/apache/fop/dom/svg/SVGCircleElementImpl.java +++ /dev/null @@ -1,114 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; - -/** - * - */ -public class SVGCircleElementImpl extends GraphicElement implements SVGCircleElement { - private SVGAnimatedLength cx; - private SVGAnimatedLength cy; - private SVGAnimatedLength r; - - /** - */ - public SVGCircleElementImpl() - { - } - - public SVGRect getBBox() - { - SVGRect rect = new SVGRectImpl(); - rect.setX(cx.getBaseVal().getValue() - r.getBaseVal().getValue()); - rect.setY(cy.getBaseVal().getValue() - r.getBaseVal().getValue()); - rect.setWidth(2 * r.getBaseVal().getValue()); - rect.setHeight(2 * r.getBaseVal().getValue()); - return rect; - } - - public SVGAnimatedLength getCx( ) - { - return cx; - } - - public void setCx( SVGAnimatedLength cx ) - { - this.cx = cx; - } - - public SVGAnimatedLength getCy( ) - { - return cy; - } - - public void setCy( SVGAnimatedLength cy ) - { - this.cy = cy; - } - - public SVGAnimatedLength getR( ) - { - return r; - } - - public void setR( SVGAnimatedLength r ) - { - this.r = r; - } - - public String getTagName() - { - return "circle"; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGClipPathElementImpl.java b/src/org/apache/fop/dom/svg/SVGClipPathElementImpl.java deleted file mode 100644 index 77c333bad..000000000 --- a/src/org/apache/fop/dom/svg/SVGClipPathElementImpl.java +++ /dev/null @@ -1,83 +0,0 @@ -/*-- $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.dom.svg; - -import java.util.Vector; - -import org.w3c.dom.svg.*; - -/** - * - */ -public class SVGClipPathElementImpl extends GraphicElement implements SVGClipPathElement { - public Vector elements = new Vector(); - SVGAnimatedEnumeration units; - - public void addElement(SVGElement g) - { - elements.addElement(g); - } - - public SVGClipPathElementImpl() - { - } - - public SVGAnimatedEnumeration getClipPathUnits( ) - { - return units; - } - - public void setClipPathUnits(SVGAnimatedEnumeration clipPathUnits) - { - units = clipPathUnits; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGCursorElementImpl.java b/src/org/apache/fop/dom/svg/SVGCursorElementImpl.java deleted file mode 100644 index b777e2fc3..000000000 --- a/src/org/apache/fop/dom/svg/SVGCursorElementImpl.java +++ /dev/null @@ -1,86 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; - -/** - * - */ -public class SVGCursorElementImpl extends SVGURIReferenceImpl implements SVGCursorElement { - SVGAnimatedLength x; - SVGAnimatedLength y; - - public SVGCursorElementImpl() - { - } - - public SVGAnimatedLength getX( ) - { - return x; - } - - public void setX( SVGAnimatedLength x ) - { - this.x = x; - } - - public SVGAnimatedLength getY( ) - { - return y; - } - - public void setY( SVGAnimatedLength y ) - { - this.y = y; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGDefsElementImpl.java b/src/org/apache/fop/dom/svg/SVGDefsElementImpl.java deleted file mode 100644 index 79766a989..000000000 --- a/src/org/apache/fop/dom/svg/SVGDefsElementImpl.java +++ /dev/null @@ -1,64 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; - -/** - * class representing a line in an SVG Area - */ -public class SVGDefsElementImpl extends GraphicElement implements SVGDefsElement { - - public SVGDefsElementImpl() - { - } -} diff --git a/src/org/apache/fop/dom/svg/SVGDescElementImpl.java b/src/org/apache/fop/dom/svg/SVGDescElementImpl.java deleted file mode 100644 index 7784b94fd..000000000 --- a/src/org/apache/fop/dom/svg/SVGDescElementImpl.java +++ /dev/null @@ -1,64 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; - -/** - * class representing a line in an SVG Area - */ -public class SVGDescElementImpl extends GraphicElement implements SVGDescElement { - - public SVGDescElementImpl() - { - } -} diff --git a/src/org/apache/fop/dom/svg/SVGDocumentImpl.java b/src/org/apache/fop/dom/svg/SVGDocumentImpl.java deleted file mode 100644 index 66e613507..000000000 --- a/src/org/apache/fop/dom/svg/SVGDocumentImpl.java +++ /dev/null @@ -1,213 +0,0 @@ -/*-- $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.dom.svg; - -import java.util.*; - -import org.apache.fop.dom.ElementImpl; - -import org.w3c.dom.svg.*; -import org.w3c.dom.*; -import org.w3c.dom.events.*; - -/** - * - */ -public class SVGDocumentImpl extends ElementImpl implements SVGDocument { - String title; - public static final String namespaceURI = "http://www.w3.org/2000/svg"; - - public SVGDocumentImpl() - { - ownerDoc = this; - } - - public String getTitle() - { - return title; - } - - public void setTitle(String title) - { - this.title = title; - } - - public String getNamespaceURI() - { - return namespaceURI; - } - - public String getReferrer() - { - return null; - } - - public String getDomain() - { - return null; - } - - public String getURL() - { - return ""; - } - - public SVGSVGElement getRootElement() - { - if(childs.size() > 0) - return (SVGSVGElement)childs.elementAt(0); - return null; - } - - public Element getElementById(String elementId) - { - SVGSVGElement svg = getRootElement(); - return findChild(svg, elementId); - } - - protected Element findChild(Node ele, String id) - { - NodeList nl = ele.getChildNodes(); - for(int count = 0; count < nl.getLength(); count++) { - Node n = nl.item(count); - if(n instanceof SVGElement) { - if(id.equals(((SVGElement)n).getId())) { - return (Element)n; - } - } - if(n != null) { - Element el = findChild(n, id); - if(el != null) { - return el; - } - } - } - return null; - } - - public Event createEvent(String eventType) - throws DOMException - { - return null; - } - - public DOMImplementation getImplementation() - { - return null; - } - - public EntityReference createEntityReference(String str) - { - return null; - } - - public DocumentFragment createDocumentFragment() - { - return null; - } - - public Text createTextNode(String str) - { - return null; - } - - public Element createElement(String str) - { - return null; - } - - public Element createElementNS(String namespaceURI, - String qualifiedName){ - return null; - } - - public ProcessingInstruction createProcessingInstruction(String s1, String s2) - { - return null; - } - - public DocumentType getDoctype() - { - return null; - } - - public CDATASection createCDATASection(String str) - { - return null; - } - - public Comment createComment(String str) - { - return null; - } - - public Attr createAttribute(String str) - { - return null; - } - - public Attr createAttributeNS(String namespaceURI, - String qualifiedName) - throws DOMException - { - return null; - } - - public Element getDocumentElement() - { - return null; - } - - public Node importNode(Node importedNode, boolean deep) - { - return null; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGElementImpl.java b/src/org/apache/fop/dom/svg/SVGElementImpl.java deleted file mode 100644 index 6fe052d79..000000000 --- a/src/org/apache/fop/dom/svg/SVGElementImpl.java +++ /dev/null @@ -1,199 +0,0 @@ -/*-- $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.dom.svg; - -import org.apache.fop.dom.stylesheets.*; -import org.apache.fop.dom.css.*; -import org.apache.fop.datatypes.*; -import org.apache.fop.dom.ElementImpl; - -import org.w3c.dom.css.*; -import org.w3c.dom.svg.*; -import org.w3c.dom.*; -import org.w3c.dom.stylesheets.*; - -import java.util.*; - -public abstract class SVGElementImpl extends ElementImpl implements SVGElement { - String idString = ""; - CSSStyleDeclaration styleDec; - SVGSVGElement ownerSvg; - SVGAnimatedString className = new SVGAnimatedStringImpl(""); - - public String getId() - { - return idString; - } - - public String getNamespaceURI() - { - return SVGDocumentImpl.namespaceURI; - } - - public void setId(String id) - { - idString = id; - } - - public SVGSVGElement getOwnerSVGElement( ) - { - return ownerSvg; - } - - public SVGElement getViewportElement( ) - { - return null; - } - - public SVGAnimatedString getClassName( ) - { - return className; - } - - public void setClassName( SVGAnimatedString className ) - { - this.className = className; - } - - public CSSValue getPresentationAttribute ( String name ) - { - CSSStyleDeclaration style; - CSSValue val = null; - - style = getStyle(); - if(style != null) { - val = style.getPropertyCSSValue(name); - } - - if(val == null) { - // this checks for the style selector matching - // everytime a property is requested, this is bad, slow - - // get "style" element style for this - SVGSVGElement svg = getOwnerSVGElement(); - // maybe - // val = svg.getComputedStyle(this, name); - StyleSheetList list = svg.getStyleSheets(); - for(int count = 0; count < list.getLength(); count++) { - CSSRuleList rlist = ((CSSStyleSheet)list.item(count)).getCssRules(); - for(int c = 0; c < rlist.getLength(); c++) { - CSSRule rule = rlist.item(c); - if(rule.getType() == CSSRule.STYLE_RULE) { - if(((CSSStyleRuleImpl)rule).matches(this)) { - style = ((CSSStyleRule)rule).getStyle(); - val = style.getPropertyCSSValue(name); -// break; - } - } - } -// if(val != null) { -// break; -// } - } - } - if(val == null) { - // get element parents style - Node par = getParentNode(); - if(par instanceof SVGStylable) { - val = ((SVGStylable)par).getPresentationAttribute(name); - } - } - return val; - } - - public CSSValue getAnimatedPresentationAttribute ( String name ) - { - return getPresentationAttribute(name); - } - - public CSSStyleDeclaration getStyle( ) - { - return styleDec; - } - - public void setStyle(CSSStyleDeclaration dec) - { - styleDec = dec; - } - - public SVGAnimatedBoolean getExternalResourcesRequired( ) - { - return null; - } - - public void setExternalResourcesRequired( SVGAnimatedBoolean externalResourcesRequired ) - { - } - - public Node appendChild(Node newChild) - throws DOMException - { - Node nChild = super.appendChild(newChild); - if(newChild instanceof SVGElementImpl) { - SVGElementImpl ele = (SVGElementImpl)newChild; - if(ownerSvg != null) - ele.setOwnerSVG(ownerSvg); - } - return nChild; - } - - public void setOwnerSVG(SVGSVGElement owner) - { - ownerSvg = owner; - NodeList nl = getChildNodes(); - for(int count = 0; count < nl.getLength(); count++) { - Node n = nl.item(count); - if(n instanceof SVGElementImpl) { - ((SVGElementImpl)n).setOwnerSVG(owner); - } - } - } -} diff --git a/src/org/apache/fop/dom/svg/SVGEllipseElementImpl.java b/src/org/apache/fop/dom/svg/SVGEllipseElementImpl.java deleted file mode 100644 index b92234fe8..000000000 --- a/src/org/apache/fop/dom/svg/SVGEllipseElementImpl.java +++ /dev/null @@ -1,115 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; -import org.w3c.dom.*; -import org.w3c.dom.events.*; - -/** - * - */ -public class SVGEllipseElementImpl extends GraphicElement implements SVGEllipseElement { - private SVGAnimatedLength cx; - private SVGAnimatedLength cy; - private SVGAnimatedLength rx; - private SVGAnimatedLength ry; - - /** - */ - public SVGEllipseElementImpl() - { - } - - public SVGRect getBBox() - { - SVGRect rect = new SVGRectImpl(); - rect.setX(cx.getBaseVal().getValue() - rx.getBaseVal().getValue()); - rect.setY(cy.getBaseVal().getValue() - ry.getBaseVal().getValue()); - rect.setWidth(2 * rx.getBaseVal().getValue()); - rect.setHeight(2 * ry.getBaseVal().getValue()); - return rect; - } - - public SVGAnimatedLength getCx( ) - { - return cx; - } - public void setCx( SVGAnimatedLength cx ) - { - this.cx = cx; - } - public SVGAnimatedLength getCy( ) - { - return cy; - } - public void setCy( SVGAnimatedLength cy ) - { - this.cy = cy; - } - public SVGAnimatedLength getRx( ) - { - return rx; - } - public void setRx( SVGAnimatedLength rx ) - { - this.rx = rx; - } - public SVGAnimatedLength getRy( ) - { - return ry; - } - public void setRy( SVGAnimatedLength ry ) - { - this.ry = ry; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGExceptionImpl.java b/src/org/apache/fop/dom/svg/SVGExceptionImpl.java deleted file mode 100644 index d1104ebea..000000000 --- a/src/org/apache/fop/dom/svg/SVGExceptionImpl.java +++ /dev/null @@ -1,68 +0,0 @@ -/*-- $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.dom.svg; - -import org.apache.fop.fo.Property; - -import java.util.*; -import java.text.*; - -import org.w3c.dom.svg.*; - -/** - * - */ -public class SVGExceptionImpl extends SVGException { - public SVGExceptionImpl(short code, String message) - { - super(code, message); - } -} diff --git a/src/org/apache/fop/dom/svg/SVGFilterElementImpl.java b/src/org/apache/fop/dom/svg/SVGFilterElementImpl.java deleted file mode 100644 index 497f6b879..000000000 --- a/src/org/apache/fop/dom/svg/SVGFilterElementImpl.java +++ /dev/null @@ -1,140 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; - -/** - * - */ -public class SVGFilterElementImpl extends SVGURIReferenceImpl implements SVGFilterElement { - - public SVGFilterElementImpl() - { - } - - public SVGAnimatedEnumeration getFilterUnits( ) - { - return null; - } - - public void setFilterUnits( SVGAnimatedEnumeration filterUnits ) - { - } - - public SVGAnimatedEnumeration getPrimitiveUnits( ) - { - return null; - } - - public void setPrimitiveUnits( SVGAnimatedEnumeration filterUnits ) - { - } - - public SVGAnimatedLength getX( ) - { - return null; - } - - public void setX( SVGAnimatedLength x ) - { - } - - public SVGAnimatedLength getY( ) - { - return null; - } - - public void setY( SVGAnimatedLength y ) - { - } - - public SVGAnimatedLength getWidth( ) - { - return null; - } - - public void setWidth( SVGAnimatedLength width ) - { - } - - public SVGAnimatedLength getHeight( ) - { - return null; - } - - public void setHeight( SVGAnimatedLength height ) - { - } - - public SVGAnimatedInteger getFilterResX( ) - { - return null; - } - - public SVGAnimatedInteger getFilterResY( ) - { - return null; - } - - public void setFilterResX( SVGAnimatedInteger filterResX ) - { - } - - public void setFilterResY( SVGAnimatedInteger filterResY ) - { - } - - public void setFilterRes ( int filterResX, int filterResY ) - { - } -} diff --git a/src/org/apache/fop/dom/svg/SVGFontElementImpl.java b/src/org/apache/fop/dom/svg/SVGFontElementImpl.java deleted file mode 100644 index dd45ce697..000000000 --- a/src/org/apache/fop/dom/svg/SVGFontElementImpl.java +++ /dev/null @@ -1,64 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; - -/** - * - */ -public class SVGFontElementImpl extends SVGElementImpl implements SVGFontElement { - - public SVGFontElementImpl() - { - } -} diff --git a/src/org/apache/fop/dom/svg/SVGGElementImpl.java b/src/org/apache/fop/dom/svg/SVGGElementImpl.java deleted file mode 100644 index 95330d4a7..000000000 --- a/src/org/apache/fop/dom/svg/SVGGElementImpl.java +++ /dev/null @@ -1,75 +0,0 @@ -/*-- $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.dom.svg; - -import org.apache.fop.layout.*; - -import java.util.*; - -import org.w3c.dom.svg.*; -import org.w3c.dom.*; - -/** - * - */ -public class SVGGElementImpl extends GraphicElement implements SVGGElement { - - /** - */ - public SVGGElementImpl() - { - } - - public SVGRect getBBox() - { - return getChildrenBBox(); - } -} diff --git a/src/org/apache/fop/dom/svg/SVGGlyphElementImpl.java b/src/org/apache/fop/dom/svg/SVGGlyphElementImpl.java deleted file mode 100644 index 98938085a..000000000 --- a/src/org/apache/fop/dom/svg/SVGGlyphElementImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -/*-- $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.dom.svg; - -/** - * - */ -public class SVGGlyphElementImpl extends SVGElementImpl { - - public SVGGlyphElementImpl() - { - } -} diff --git a/src/org/apache/fop/dom/svg/SVGGradientElementImpl.java b/src/org/apache/fop/dom/svg/SVGGradientElementImpl.java deleted file mode 100644 index 57f6748fb..000000000 --- a/src/org/apache/fop/dom/svg/SVGGradientElementImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; - -/** - * - */ -public class SVGGradientElementImpl extends SVGURIReferenceImpl implements SVGGradientElement { - /* - SVG_SPREADMETHOD_UNKNOWN; - SVG_SPREADMETHOD_PAD; - SVG_SPREADMETHOD_REFLECT; - SVG_SPREADMETHOD_REPEAT; - */ - SVGAnimatedEnumeration spreadMethod = - new SVGAnimatedEnumerationImpl(SVG_SPREADMETHOD_UNKNOWN); - SVGAnimatedEnumeration units = - new SVGAnimatedEnumerationImpl(SVG_UNIT_TYPE_UNKNOWN); - SVGAnimatedTransformList gradientTransform; - - public SVGGradientElementImpl() { - } - - public SVGAnimatedEnumeration getGradientUnits() { - return units; - } - - public void setGradientUnits(SVGAnimatedEnumeration gradientUnits) { - units = gradientUnits; - } - - public SVGAnimatedTransformList getGradientTransform() { - return gradientTransform; - } - - public void setGradientTransform( - SVGAnimatedTransformList gradientTransform) { - this.gradientTransform = gradientTransform; - } - - public SVGAnimatedEnumeration getSpreadMethod() { - return spreadMethod; - } - - public void setSpreadMethod(SVGAnimatedEnumeration spreadMethod) { - this.spreadMethod = spreadMethod; - } - - public SVGAnimatedBoolean getExternalResourcesRequired() { - return null; - } - - public void setExternalResourcesRequired( - SVGAnimatedBoolean externalResourcesRequired) { - } -} diff --git a/src/org/apache/fop/dom/svg/SVGHKernElementImpl.java b/src/org/apache/fop/dom/svg/SVGHKernElementImpl.java deleted file mode 100644 index 28a563270..000000000 --- a/src/org/apache/fop/dom/svg/SVGHKernElementImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -/*-- $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.dom.svg; - -/** - * - */ -public class SVGHKernElementImpl extends SVGElementImpl { - - public SVGHKernElementImpl() - { - } -} diff --git a/src/org/apache/fop/dom/svg/SVGImageElementImpl.java b/src/org/apache/fop/dom/svg/SVGImageElementImpl.java deleted file mode 100644 index 1cb4ccb2b..000000000 --- a/src/org/apache/fop/dom/svg/SVGImageElementImpl.java +++ /dev/null @@ -1,76 +0,0 @@ -/*-- $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.dom.svg; - -import org.apache.fop.datatypes.*; - -import org.w3c.dom.svg.*; - -/** - * - */ -public class SVGImageElementImpl extends GraphicElement implements SVGTransformable { - public String link; - public float x; - public float y; - public float width; - public float height; - - public SVGImageElementImpl(String l, float x, float y, float w, float h) - { - link = l; - this.x = x; - this.y = y; - width = w; - height = h; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGLengthImpl.java b/src/org/apache/fop/dom/svg/SVGLengthImpl.java deleted file mode 100644 index 83f1c6c69..000000000 --- a/src/org/apache/fop/dom/svg/SVGLengthImpl.java +++ /dev/null @@ -1,191 +0,0 @@ -/*-- $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.dom.svg; - -import org.apache.fop.fo.Property; -import org.apache.fop.messaging.MessageHandler; - -import java.util.*; - -import org.w3c.dom.svg.*; - -/** - * a length quantity in SVG - */ -public class SVGLengthImpl implements SVGLength { - short unitType = SVG_LENGTHTYPE_UNKNOWN; - protected float millipoints = 0; - protected float fontsize = 12; //?? - - public short getUnitType() { - return unitType; - } - - public float getValue() { - return millipoints; - } - - public void setValue(float value) { - millipoints = value; - } - - public float getValueInSpecifiedUnits() { - return 0; - } - - public void setValueInSpecifiedUnits(float valueInSpecifiedUnits) { - } - - public String getValueAsString() { - return null; - } - - public void setValueAsString(String valueAsString) { - convert(valueAsString); - } - - public float getAnimatedValue() { - return 0; - } - - public void newValueSpecifiedUnits(short unitType, - float valueInSpecifiedUnits) throws SVGException { - this.unitType = unitType; - millipoints = valueInSpecifiedUnits; - } - - public void convertToSpecifiedUnits(short unitType) - throws SVGException { - } - - /** - * set the length given a particular String specifying length and units - */ - public SVGLengthImpl (String len) { - convert(len); - } - - public SVGLengthImpl() { - } - - protected void convert(String len) { - int l = len.length(); - - if (l == 0) { - System.err.println("WARNING: empty length"); - this.millipoints = 0; - } else { - float dvalue = getFloatValue(len, l); - this.millipoints = dvalue; - } - } - - protected float getFloatValue(String len, int l) { - int assumed_resolution = 1; // points/pixel - - float dvalue; - try { - if (len.endsWith("in")) { - dvalue = Float.valueOf( - len.substring(0, (l - 2))).floatValue(); - dvalue = dvalue * 72; - unitType = SVG_LENGTHTYPE_IN; - } else if (len.endsWith("cm")) { - dvalue = Float.valueOf( - len.substring(0, (l - 2))).floatValue(); - dvalue = dvalue * 28.35f; - unitType = SVG_LENGTHTYPE_CM; - } else if (len.endsWith("mm")) { - dvalue = Float.valueOf( - len.substring(0, (l - 2))).floatValue(); - dvalue = dvalue * 2.84f; - unitType = SVG_LENGTHTYPE_MM; - } else if (len.endsWith("pt")) { - dvalue = Float.valueOf( - len.substring(0, (l - 2))).floatValue(); - // dvalue = dvalue; - unitType = SVG_LENGTHTYPE_PT; - } else if (len.endsWith("pc")) { - dvalue = Float.valueOf( - len.substring(0, (l - 2))).floatValue(); - dvalue = dvalue * 12; - unitType = SVG_LENGTHTYPE_PC; - } else if (len.endsWith("em")) { - dvalue = Float.valueOf( - len.substring(0, (l - 2))).floatValue(); - dvalue = dvalue * fontsize; - unitType = SVG_LENGTHTYPE_EMS; - } else if (len.endsWith("px")) { - dvalue = Float.valueOf( - len.substring(0, (l - 2))).floatValue(); - dvalue = dvalue * assumed_resolution; - unitType = SVG_LENGTHTYPE_PX; - } else if (len.endsWith("%")) { - dvalue = Float.valueOf( - len.substring(0, (l - 1))).floatValue() / 100f; - unitType = SVG_LENGTHTYPE_PERCENTAGE; - } else { - dvalue = Float.valueOf(len).floatValue(); - unitType = SVG_LENGTHTYPE_NUMBER; - } - } catch (Exception e) { - dvalue = 0; - unitType = SVG_LENGTHTYPE_UNKNOWN; - MessageHandler.errorln("ERROR: unknown length units in " + len); - } - return dvalue; - } - - public String toString() { - String s = millipoints + "mpt"; - return s; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGLengthListImpl.java b/src/org/apache/fop/dom/svg/SVGLengthListImpl.java deleted file mode 100644 index a3e5466ff..000000000 --- a/src/org/apache/fop/dom/svg/SVGLengthListImpl.java +++ /dev/null @@ -1,197 +0,0 @@ -/*-- $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.dom.svg; - -import org.apache.fop.fo.Property; -import org.apache.fop.messaging.MessageHandler; - -import java.util.*; - -import org.w3c.dom.svg.*; -import org.w3c.dom.*; - -/** - * a length quantity in XSL - */ -public class SVGLengthListImpl extends SVGListImpl implements SVGLengthList { - protected float fontsize = 12; - - public void setValueAsString(String valueAsString) { - convert(valueAsString); - } - - /** - * set the length given a particular String specifying length and units - */ - public SVGLengthListImpl (String len) { - convert(len); - } - - public SVGLengthListImpl () { - } - - /** - * set the length given a particular String specifying length and units, - * and the font-size (necessary for an em) - */ - public SVGLengthListImpl (String len, int fontsize) { - this.fontsize = fontsize; - convert(len); - } - - protected void convert(String len) { - int l = len.length(); - - if (l == 0) { - // MessageHandler.errorln("WARNING: empty length"); - } else { - // could be an array of points, as in for svg:text - int pos; - pos = len.trim().indexOf(" "); - if (pos != -1) { - StringTokenizer st = new StringTokenizer(len.trim()); - while (st.hasMoreTokens()) { - String val = st.nextToken(); - float dvalue = getFloatValue(val, val.length()); - float intValue = dvalue; - SVGLengthImpl impl = new SVGLengthImpl(); - impl.setValue(intValue); - appendItem(impl); - } - } else { - float dvalue = getFloatValue(len, l); - SVGLengthImpl impl = new SVGLengthImpl(); - impl.setValue(dvalue); - appendItem(impl); - } - } - } - - protected float getFloatValue(String len, int l) { - int assumed_resolution = 1; // points/pixel - - float dvalue; - try { - if (len.endsWith("in")) { - dvalue = Float.valueOf( - len.substring(0, (l - 2))).floatValue(); - dvalue = dvalue * 72; - } else if (len.endsWith("cm")) { - dvalue = Float.valueOf( - len.substring(0, (l - 2))).floatValue(); - dvalue = dvalue * 28.35f; - } else if (len.endsWith("mm")) { - dvalue = Float.valueOf( - len.substring(0, (l - 2))).floatValue(); - dvalue = dvalue * 2.84f; - } else if (len.endsWith("pt")) { - dvalue = Float.valueOf( - len.substring(0, (l - 2))).floatValue(); - dvalue = dvalue; - } else if (len.endsWith("pc")) { - dvalue = Float.valueOf( - len.substring(0, (l - 2))).floatValue(); - dvalue = dvalue * 12; - } else if (len.endsWith("em")) { - dvalue = Float.valueOf( - len.substring(0, (l - 2))).floatValue(); - dvalue = dvalue * fontsize; - } else if (len.endsWith("px")) { - dvalue = Float.valueOf( - len.substring(0, (l - 2))).floatValue(); - dvalue = dvalue * assumed_resolution; - } else if (len.endsWith("%")) { - dvalue = Float.valueOf( - len.substring(0, (l - 1))).floatValue() / 100f; //?? - } else { - dvalue = Float.valueOf(len).floatValue(); - } - } catch (Exception e) { - dvalue = 0; - MessageHandler.errorln("ERROR: unknown length units in " + len); - } - return dvalue; - } - - public SVGLength initialize (SVGLength newItem) throws SVGException { - return null; - } - - public SVGLength createItem() { - return new SVGLengthImpl(); - } - - public SVGLength getItem(int index) throws DOMException { - Object obj = list.elementAt(index); - return (SVGLength) obj; - } - - public SVGLength removeItem(int index) throws DOMException { - Object obj = list.elementAt(index); - list.removeElementAt(index); - return (SVGLength) obj; - } - - public SVGLength appendItem(SVGLength newItem) throws SVGException { - list.addElement(newItem); - return null; - } - - public SVGLength replaceItem(SVGLength newItem, - int index) throws DOMException, SVGException { - return null; - } - - public SVGLength insertItemBefore(SVGLength newItem, - int index) throws SVGException { - return null; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGLineElementImpl.java b/src/org/apache/fop/dom/svg/SVGLineElementImpl.java deleted file mode 100644 index 34168c864..000000000 --- a/src/org/apache/fop/dom/svg/SVGLineElementImpl.java +++ /dev/null @@ -1,135 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; -import org.w3c.dom.*; -import org.w3c.dom.events.*; - -/** - * class representing a line in an SVG Area - */ -public class SVGLineElementImpl extends GraphicElement implements SVGLineElement { - /** x-coordinate of start */ - protected SVGAnimatedLength x1; - - /** y-coordinate of start */ - protected SVGAnimatedLength y1; - - /** x-coordinate of end */ - protected SVGAnimatedLength x2; - - /** y-coordinate of end */ - protected SVGAnimatedLength 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 SVGLineElementImpl() - { - } - - public SVGRect getBBox() - { - SVGRect rect = new SVGRectImpl(); - rect.setX(Math.min(x1.getBaseVal().getValue(), x2.getBaseVal().getValue())); - rect.setY(Math.min(y1.getBaseVal().getValue(), y2.getBaseVal().getValue())); - rect.setWidth(Math.abs(x1.getBaseVal().getValue() - x2.getBaseVal().getValue())); - rect.setHeight(Math.abs(y1.getBaseVal().getValue() - y2.getBaseVal().getValue())); - return rect; - } - - public SVGAnimatedLength getX1( ) - { - return x1; - } - - public void setX1( SVGAnimatedLength x1 ) - { - this.x1 = x1; - } - - public SVGAnimatedLength getY1( ) - { - return y1; - } - - public void setY1( SVGAnimatedLength y1 ) - { - this.y1 = y1; - } - - public SVGAnimatedLength getX2( ) - { - return x2; - } - - public void setX2( SVGAnimatedLength x2 ) - { - this.x2 = x2; - } - - public SVGAnimatedLength getY2( ) - { - return y2; - } - - public void setY2( SVGAnimatedLength y2 ) - { - this.y2 = y2; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGLinearGradientElementImpl.java b/src/org/apache/fop/dom/svg/SVGLinearGradientElementImpl.java deleted file mode 100644 index 3c38b9afd..000000000 --- a/src/org/apache/fop/dom/svg/SVGLinearGradientElementImpl.java +++ /dev/null @@ -1,110 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; - -/** - * - */ -public class SVGLinearGradientElementImpl extends SVGGradientElementImpl - implements SVGLinearGradientElement { - - SVGAnimatedLength x1; - SVGAnimatedLength x2; - SVGAnimatedLength y1; - SVGAnimatedLength y2; - - public SVGLinearGradientElementImpl() - { - } - - public SVGAnimatedLength getX1() - { - return x1; - } - - public void setX1(SVGAnimatedLength x1) - { - this.x1 = x1; - } - - public SVGAnimatedLength getY1() - { - return y1; - } - - public void setY1(SVGAnimatedLength y1) - { - this.y1 = y1; - } - - public SVGAnimatedLength getX2() - { - return x2; - } - - public void setX2(SVGAnimatedLength x2) - { - this.x2 = x2; - } - - public SVGAnimatedLength getY2() - { - return y2; - } - - public void setY2(SVGAnimatedLength y2) - { - this.y2 = y2; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGListImpl.java b/src/org/apache/fop/dom/svg/SVGListImpl.java deleted file mode 100644 index c7aaa3e93..000000000 --- a/src/org/apache/fop/dom/svg/SVGListImpl.java +++ /dev/null @@ -1,120 +0,0 @@ -/*-- $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.dom.svg; - -import java.util.*; - -import org.w3c.dom.svg.*; -import org.w3c.dom.*; - -/** - * - */ -public class SVGListImpl { - Vector list = new Vector(); - - public int getNumberOfItems() { - return list.size(); - } - - public void clear() { - list.removeAllElements(); - } - - /* public Object initialize ( Object newItem ) - throws SVGException - { - return null; - } - - public Object createItem() - { - return null; - } - - public Object getItem(int index) - throws DOMException - { - Object obj = list.elementAt(index); - return obj; - } - - public Object insertItemBefore(Object newItem, int index) - throws SVGException - { - return null; - } - - public Object replaceItem(Object newItem, int index) - throws DOMException, SVGException - { - return null; - } - - public Object removeItem(int index) - throws DOMException - { - Object obj = list.elementAt(index); - list.removeElementAt(index); - return obj; - } - - public Object appendItem(Object newItem) - throws SVGException - { - list.addElement(newItem); - return null; - }*/ - - public String toString() { - return list.toString(); - } -} diff --git a/src/org/apache/fop/dom/svg/SVGMarkerElementImpl.java b/src/org/apache/fop/dom/svg/SVGMarkerElementImpl.java deleted file mode 100644 index 0d7b8fc49..000000000 --- a/src/org/apache/fop/dom/svg/SVGMarkerElementImpl.java +++ /dev/null @@ -1,148 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; - -/** - * - */ -public class SVGMarkerElementImpl extends GraphicElement implements SVGMarkerElement { - SVGAnimatedEnumeration units; - SVGAnimatedEnumeration otype; - - public SVGMarkerElementImpl() - { - } - - public SVGAnimatedEnumeration getMarkerUnits( ) - { - return units; - } - - public SVGAnimatedEnumeration getOrientType( ) - { - return otype; - } - - public SVGAnimatedAngle getOrientAngle( ) - { - return null; - } - - public SVGAnimatedLength getRefX( ) - { - return null; - } - - public void setRefX(SVGAnimatedLength refX) - { - } - - public SVGAnimatedLength getRefY( ) - { - return null; - } - - public void setRefY( SVGAnimatedLength refY ) - { - } - - public SVGAnimatedLength getMarkerWidth( ) - { - return null; - } - - public void setMarkerWidth( SVGAnimatedLength markerWidth ) - { - } - - public SVGAnimatedLength getMarkerHeight( ) - { - return null; - } - - public void setMarkerHeight( SVGAnimatedLength markerHeight ) - { - } - - public void setOrientToAuto ( ) - { - } - - public void setOrientToAngle ( SVGAngle angle ) - throws SVGException - { - } - - public SVGAnimatedRect getViewBox( ) - { - return null; - } - - public void setViewBox( SVGAnimatedRect viewBox ) - { - } - - public SVGAnimatedPreserveAspectRatio getPreserveAspectRatio( ) - { - return null; - } - - public void setPreserveAspectRatio( SVGAnimatedPreserveAspectRatio preserveAspectRatio ) - { - } - - public void setMarkerUnits( SVGAnimatedEnumeration markerUnits ) - { - } -} diff --git a/src/org/apache/fop/dom/svg/SVGMaskElementImpl.java b/src/org/apache/fop/dom/svg/SVGMaskElementImpl.java deleted file mode 100644 index c9efa34b8..000000000 --- a/src/org/apache/fop/dom/svg/SVGMaskElementImpl.java +++ /dev/null @@ -1,97 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; - -import java.util.Vector; - -/** - * - */ -public class SVGMaskElementImpl extends GraphicElement implements SVGMaskElement { - public Vector elements = new Vector(); - - public void addElement(SVGElement g) - { - elements.addElement(g); - } - - public SVGMaskElementImpl() - { - } - - public SVGAnimatedEnumeration getMaskUnits( ) - { - return null; - } - - public SVGAnimatedLength getX( ) - { - return null; - } - - public SVGAnimatedLength getY( ) - { - return null; - } - - public SVGAnimatedLength getWidth( ) - { - return null; - } - - public SVGAnimatedLength getHeight( ) - { - return null; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGMatrixImpl.java b/src/org/apache/fop/dom/svg/SVGMatrixImpl.java deleted file mode 100644 index 6e764724f..000000000 --- a/src/org/apache/fop/dom/svg/SVGMatrixImpl.java +++ /dev/null @@ -1,235 +0,0 @@ -/*-- $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.dom.svg; - -import org.apache.fop.fo.Property; - -import java.util.*; - -import org.w3c.dom.svg.*; - -/** - * @author Keiron Liddle <keiron@aftexsw.com> - */ -public class SVGMatrixImpl implements SVGMatrix { - float a = 1.0f; - float b = 0.0f; - float c = 0.0f; - float d = 1.0f; - float e = 0.0f; - float f = 0.0f; - - public SVGMatrixImpl() { - } - - public float getA() { - return a; - } - - public void setA(float a) { - this.a = a; - } - - public float getB() { - return b; - } - - public void setB(float b) { - this.b = b; - } - - public float getC() { - return c; - } - - public void setC(float c) { - this.c = c; - } - - public float getD() { - return d; - } - - public void setD(float d) { - this.d = d; - } - - public float getE() { - return e; - } - - public void setE(float e) { - this.e = e; - } - - public float getF() { - return f; - } - - public void setF(float f) { - this.f = f; - } - - public SVGMatrix multiply (SVGMatrix secondMatrix) throws SVGException { - SVGMatrix mat = new SVGMatrixImpl(); - mat.setA(a * secondMatrix.getA() + b * secondMatrix.getC()); - mat.setB(a * secondMatrix.getB() + b * secondMatrix.getD()); - mat.setC(c * secondMatrix.getA() + d * secondMatrix.getC()); - mat.setD(c * secondMatrix.getB() + d * secondMatrix.getD()); - // e,f? - mat.setE(a * e + c * f + secondMatrix.getE()); - mat.setF(b * f + d * f + secondMatrix.getF()); - return mat; - } - - public SVGMatrix inverse () throws SVGException { - SVGMatrix mat = new SVGMatrixImpl(); - double det = Math.abs(a * d - b * c); - if (det == 0) { - // throw exception - throw new SVGExceptionImpl( - SVGException.SVG_MATRIX_NOT_INVERTABLE, - "Matrix: " + toString() + " could not be inverted"); - } - mat.setA((float)(d / det)); - mat.setB((float)(b / det)); - mat.setC((float)(-c / det)); - mat.setD((float)(a / det)); - // e,f? - mat.setE(-e); - mat.setF(-f); - return mat; - } - - public SVGMatrix translate (float x, float y) throws SVGException { - SVGMatrix matrix = new SVGMatrixImpl(); - matrix.setA(a); - matrix.setB(b); - matrix.setC(c); - matrix.setD(d); - matrix.setE(e + x); - matrix.setF(f + y); - return matrix; - } - - public SVGMatrix scale(float scaleFactor) throws SVGException { - SVGMatrix matrix = new SVGMatrixImpl(); - matrix.setA(a * scaleFactor); - matrix.setB(b); - matrix.setC(c); - matrix.setD(d * scaleFactor); - matrix.setE(e); - matrix.setF(f); - return matrix; - } - - public SVGMatrix scaleNonUniform(float scaleFactorX, - float scaleFactorY) throws SVGException { - SVGMatrix matrix = new SVGMatrixImpl(); - matrix.setA(a * scaleFactorX); - matrix.setB(b); - matrix.setC(c); - matrix.setD(d * scaleFactorY); - matrix.setE(e); - matrix.setF(f); - return matrix; - } - - public SVGMatrix rotate (float angle) throws SVGException { - angle = (float)(angle * Math.PI / 180f); - SVGMatrix matrix = new SVGMatrixImpl(); - matrix.setA((float) Math.cos(angle)); - matrix.setB((float) Math.sin(angle)); - matrix.setC((float) - Math.sin(angle)); - matrix.setD((float) Math.cos(angle)); - return multiply(matrix); - } - - public SVGMatrix rotateFromVector(float x, - float y) throws SVGException { - return null; - } - - public SVGMatrix flipX() { - return null; - } - - public SVGMatrix flipY() { - return null; - } - - public SVGMatrix skewX(float angle) throws SVGException { - angle = (float)(angle * Math.PI / 180f); - - SVGMatrix matrix = new SVGMatrixImpl(); - matrix.setA(1); - matrix.setB(0); - matrix.setC((float) Math.tan(angle)); - matrix.setD(1); - return multiply(matrix); - } - - public SVGMatrix skewY(float angle) throws SVGException { - angle = (float)(angle * Math.PI / 180f); - - SVGMatrix matrix = new SVGMatrixImpl(); - matrix.setA(1); - matrix.setB((float) Math.tan(angle)); - matrix.setC(0); - matrix.setD(1); - return multiply(matrix); - } - - public String toString() { - return "[" + getA() + " " + getB() + " " + getC() + " " + - getD() + " " + getE() + " " + getF() + "]"; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGMissingGlyphElementImpl.java b/src/org/apache/fop/dom/svg/SVGMissingGlyphElementImpl.java deleted file mode 100644 index 976a5468b..000000000 --- a/src/org/apache/fop/dom/svg/SVGMissingGlyphElementImpl.java +++ /dev/null @@ -1,61 +0,0 @@ -/*-- $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.dom.svg; - -/** - * - */ -public class SVGMissingGlyphElementImpl extends SVGElementImpl { - - public SVGMissingGlyphElementImpl() { - } -} diff --git a/src/org/apache/fop/dom/svg/SVGPathElementImpl.java b/src/org/apache/fop/dom/svg/SVGPathElementImpl.java deleted file mode 100644 index 6834d288e..000000000 --- a/src/org/apache/fop/dom/svg/SVGPathElementImpl.java +++ /dev/null @@ -1,301 +0,0 @@ -/*-- $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.dom.svg; - -import java.util.*; - -import org.w3c.dom.svg.*; - -/** - * TODO: implement properly - */ -public class SVGPathElementImpl extends GraphicElement implements SVGPathElement { - - public Vector pathElements; - - /** - * construct a line graphic - */ - public SVGPathElementImpl(Vector v) { - this.pathElements = v; - } - - public SVGAnimatedNumber getPathLength() { - return null; - } - - public SVGRect getBBox() { - float minX = 10000000; // a big number - float maxX = -10000000; // a low number - float minY = 10000000; // a big number - float maxY = -10000000; // a low number - // the bounds of a path is always within the end points and - // the control points, so adjust the min and max to be these extremes - float lastx = 0; - float lasty = 0; - float lastmovex = 0; - float lastmovey = 0; - float[] cxs; - float tempx; - float tempy; - float lastcx = 0; - float lastcy = 0; - for (Enumeration e = pathElements.elements(); - e.hasMoreElements();) { - SVGPathSegImpl pc = (SVGPathSegImpl) e.nextElement(); - float[] vals = pc.getValues(); - switch (pc.getPathSegType()) { - case SVGPathSeg.PATHSEG_MOVETO_ABS: - lastx = vals[0]; - lasty = vals[1]; - break; - case SVGPathSeg.PATHSEG_MOVETO_REL: - break; - case SVGPathSeg.PATHSEG_LINETO_ABS: - lastx = vals[0]; - lasty = vals[1]; - break; - case SVGPathSeg.PATHSEG_LINETO_REL: - lastx += vals[0]; - lasty += vals[1]; - break; - case SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS: - lasty = vals[0]; - break; - case SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL: - lasty += vals[0]; - break; - case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS: - lastx = vals[0]; - break; - case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL: - lastx += vals[0]; - break; - case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS: - lastx = vals[4]; - lasty = vals[5]; - lastcx = vals[2]; - lastcy = vals[3]; - break; - case SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL: - break; - case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: - break; - case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL: - break; - case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS: - break; - case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL: - break; - case SVGPathSeg.PATHSEG_ARC_ABS: - break; - case SVGPathSeg.PATHSEG_ARC_REL: - break; - case SVGPathSeg.PATHSEG_CLOSEPATH: - break; - } - if (lastx < minX) { - minX = lastx; - } - if (lastx > maxX) { - maxX = lastx; - } - if (lasty < minY) { - minY = lasty; - } - if (lasty > minX) { - maxY = lasty; - } - } - SVGRect rect = new SVGRectImpl(); - rect.setX(minX); - rect.setY(minY); - rect.setWidth(maxX - minX); - rect.setHeight(maxY - minY); - return rect; - } - - public void setPathLength(SVGAnimatedNumber length) { - } - - public SVGPathSegList getPathSegList() { - return null; - } - - public SVGPathSegList getNormalizedPathSegList() { - return null; - } - - public float getTotalLength() { - return 0; - } - - public SVGPoint getPointAtLength(float distance) throws SVGException { - return null; - } - - public int getPathSegAtLength(float distance) throws SVGException { - return 0; - } - - public short getPathSegType() { - return 0; - } - - public String getPathSegTypeAsLetter() { - return null; - } - - public SVGPathSegClosePath createSVGPathSegClosePath () { - return null; - } - - public SVGPathSegMovetoAbs createSVGPathSegMovetoAbs (float x, - float y) { - return null; - } - - public SVGPathSegMovetoRel createSVGPathSegMovetoRel (float x, - float y) { - return null; - } - - public SVGPathSegLinetoAbs createSVGPathSegLinetoAbs (float x, - float y) { - return null; - } - - public SVGPathSegLinetoRel createSVGPathSegLinetoRel (float x, - float y) { - return null; - } - - public SVGPathSegCurvetoCubicAbs createSVGPathSegCurvetoCubicAbs ( - float x, float y, float x1, float y1, float x2, float y2) { - return null; - } - - public SVGPathSegCurvetoCubicRel createSVGPathSegCurvetoCubicRel ( - float x, float y, float x1, float y1, float x2, float y2) { - return null; - } - - public SVGPathSegCurvetoQuadraticAbs createSVGPathSegCurvetoQuadraticAbs ( - float x, float y, float x1, float y1) { - return null; - } - - public SVGPathSegCurvetoQuadraticRel createSVGPathSegCurvetoQuadraticRel ( - float x, float y, float x1, float y1) { - return null; - } - - public SVGPathSegArcAbs createSVGPathSegArcAbs (float x, float y, - float r1, float r2, float angle, boolean largeArcFlag, - boolean sweepFlag) { - return null; - } - - public SVGPathSegArcRel createSVGPathSegArcRel (float x, float y, - float r1, float r2, float angle, boolean largeArcFlag, - boolean sweepFlag) { - return null; - } - - public SVGPathSegLinetoHorizontalAbs createSVGPathSegLinetoHorizontalAbs ( - float x) { - return null; - } - - public SVGPathSegLinetoHorizontalRel createSVGPathSegLinetoHorizontalRel ( - float x) { - return null; - } - - public SVGPathSegLinetoVerticalAbs createSVGPathSegLinetoVerticalAbs ( - float y) { - return null; - } - - public SVGPathSegLinetoVerticalRel createSVGPathSegLinetoVerticalRel ( - float y) { - return null; - } - - public SVGPathSegCurvetoCubicSmoothAbs createSVGPathSegCurvetoCubicSmoothAbs ( - float x, float y, float x2, float y2) { - return null; - } - - public SVGPathSegCurvetoCubicSmoothRel createSVGPathSegCurvetoCubicSmoothRel ( - float x, float y, float x2, float y2) { - return null; - } - - public SVGPathSegCurvetoQuadraticSmoothAbs createSVGPathSegCurvetoQuadraticSmoothAbs ( - float x, float y) { - return null; - } - - public SVGPathSegCurvetoQuadraticSmoothRel createSVGPathSegCurvetoQuadraticSmoothRel ( - float x, float y) { - return null; - } - - public SVGPathSegList getAnimatedPathSegList() { - return null; - } - - public SVGPathSegList getAnimatedNormalizedPathSegList() { - return null; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGPathSegImpl.java b/src/org/apache/fop/dom/svg/SVGPathSegImpl.java deleted file mode 100644 index eb68a8258..000000000 --- a/src/org/apache/fop/dom/svg/SVGPathSegImpl.java +++ /dev/null @@ -1,185 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; - -public class SVGPathSegImpl implements SVGPathSeg { - float[] values; - short commandType; - public SVGPathSegImpl(short type, float[] vals) - { - commandType = type; - values = vals; - } - - public float[] getValues() - { - return values; - } - - public short getPathSegType( ) - { - return commandType; - } - - public void setPathSegType( short pathSegType ) - { - } - - public String getPathSegTypeAsLetter( ) - { - return null; - } - - public void setPathSegTypeAsLetter( String pathSegTypeAsLetter ) - { - } - -/* public float getX( ) - { - return 0; - } - - public void setX( float x ) - { - } - - public float getY( ) - { - return 0; - } - - public void setY( float y ) - { - } - - public float getX1( ) - { - return 0; - } - - public void setX1( float x1 ) - { - } - - public float getY1( ) - { - return 0; - } - - public void setY1( float y1 ) - { - } - - public float getX2( ) - { - return 0; - } - - public void setX2( float x2 ) - { - } - - public float getY2( ) - { - return 0; - } - - public void setY2( float y2 ) - { - } - - public float getR1( ) - { - return 0; - } - - public void setR1( float r1 ) - { - } - - public float getR2( ) - { - return 0; - } - - public void setR2( float r2 ) - { - } - - public float getAngle( ) - { - return 0; - } - - public void setAngle( float angle ) - { - } - - public boolean getLargeArcFlag( ) - { - return false; - } - - public void setLargeArcFlag( boolean largeArcFlag ) - { - } - - public boolean getSweepFlag( ) - { - return false; - } - - public void setSweepFlag( boolean sweepFlag ) - { - }*/ -} diff --git a/src/org/apache/fop/dom/svg/SVGPatternElementImpl.java b/src/org/apache/fop/dom/svg/SVGPatternElementImpl.java deleted file mode 100644 index 446482206..000000000 --- a/src/org/apache/fop/dom/svg/SVGPatternElementImpl.java +++ /dev/null @@ -1,151 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; - -/** - * - */ -public class SVGPatternElementImpl extends SVGURIReferenceImpl implements SVGPatternElement { - SVGAnimatedEnumeration patternUnits; - SVGAnimatedTransformList patternTransform; - SVGAnimatedLength x; - SVGAnimatedLength y; - SVGAnimatedLength width; - SVGAnimatedLength height; - SVGAnimatedRect viewBox; - SVGAnimatedPreserveAspectRatio preserveAspectRatio; - - public SVGPatternElementImpl() { - } - - public SVGAnimatedEnumeration getPatternUnits( ) - { - return patternUnits; - } - - public void setPatternUnits( SVGAnimatedEnumeration patternUnits ) - { - this.patternUnits = patternUnits; - } - - public SVGAnimatedTransformList getPatternTransform( ) - { - return patternTransform; - } - - public void setPatternTransform( SVGAnimatedTransformList patternTransform ) - { - this.patternTransform = patternTransform; - } - - public SVGAnimatedLength getX( ) - { - return x; - } - - public void setX( SVGAnimatedLength x ) - { - this.x = x; - } - - public SVGAnimatedLength getY( ) - { - return y; - } - - public void setY( SVGAnimatedLength y ) - { - this.y = y; - } - - public SVGAnimatedLength getWidth( ) - { - return width; - } - - public void setWidth( SVGAnimatedLength width ) - { - this.width = width; - } - - public SVGAnimatedLength getHeight( ) - { - return height; - } - - public void setHeight( SVGAnimatedLength height ) - { - this.height = height; - } - - public SVGAnimatedRect getViewBox( ) - { - return viewBox; - } - - public void setViewBox( SVGAnimatedRect viewBox ) - { - this.viewBox = viewBox; - } - - public SVGAnimatedPreserveAspectRatio getPreserveAspectRatio( ) - { - return preserveAspectRatio; - } - - public void setPreserveAspectRatio( SVGAnimatedPreserveAspectRatio preserveAspectRatio) - { - this.preserveAspectRatio = preserveAspectRatio; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGPolygonElementImpl.java b/src/org/apache/fop/dom/svg/SVGPolygonElementImpl.java deleted file mode 100644 index a247c1267..000000000 --- a/src/org/apache/fop/dom/svg/SVGPolygonElementImpl.java +++ /dev/null @@ -1,96 +0,0 @@ -/*-- $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.dom.svg; - -import java.util.*; - -import org.w3c.dom.svg.*; - -/** - * - */ -public class SVGPolygonElementImpl extends GraphicElement implements SVGPolygonElement { - - public Vector points; - - public SVGPolygonElementImpl(Vector p) { - this.points = p; - } - - public SVGPointList getPoints() { - return null; - } - - public SVGPointList getAnimatedPoints() { - return null; - } - - public SVGRect getBBox() { - float minX = 10000000; // a big number - float maxX = -10000000; // a low number - float minY = 10000000; // a big number - float maxY = -10000000; // a low number - for (Enumeration e = points.elements(); e.hasMoreElements();) { - e.nextElement(); - } - SVGRect rect = new SVGRectImpl(); - rect.setX(minX); - rect.setY(minY); - rect.setWidth(maxX - minX); - rect.setHeight(maxY - minY); - return rect; - } - - public String getTagName() { - return "polygon"; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGPolylineElementImpl.java b/src/org/apache/fop/dom/svg/SVGPolylineElementImpl.java deleted file mode 100644 index 88e774406..000000000 --- a/src/org/apache/fop/dom/svg/SVGPolylineElementImpl.java +++ /dev/null @@ -1,76 +0,0 @@ -/*-- $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.dom.svg; - -import java.util.*; - -import org.w3c.dom.svg.*; - -/** - * - */ -public class SVGPolylineElementImpl extends GraphicElement implements SVGPolylineElement { - - public Vector points; - - public SVGPolylineElementImpl(Vector p) { - this.points = p; - } - - public SVGPointList getPoints() { - return null; - } - - public SVGPointList getAnimatedPoints() { - return null; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGRadialGradientElementImpl.java b/src/org/apache/fop/dom/svg/SVGRadialGradientElementImpl.java deleted file mode 100644 index 978b6bd40..000000000 --- a/src/org/apache/fop/dom/svg/SVGRadialGradientElementImpl.java +++ /dev/null @@ -1,119 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; - -/** - * - */ -public class SVGRadialGradientElementImpl extends SVGGradientElementImpl implements SVGRadialGradientElement { - SVGAnimatedLength cx; - SVGAnimatedLength cy; - SVGAnimatedLength r; - SVGAnimatedLength fx; - SVGAnimatedLength fy; - - public SVGRadialGradientElementImpl() - { - } - - public SVGAnimatedLength getCx() - { - return cx; - } - - public void setCx(SVGAnimatedLength cx) - { - this.cx = cx; - } - - public SVGAnimatedLength getCy() - { - return cy; - } - - public void setCy(SVGAnimatedLength cy) - { - this.cy = cy; - } - - public SVGAnimatedLength getR() - { - return r; - } - - public void setR(SVGAnimatedLength r) - { - this.r = r; - } - - public SVGAnimatedLength getFx() - { - return fx; - } - - public void setFx(SVGAnimatedLength fx) - { - this.fx = fx; - } - - public SVGAnimatedLength getFy() - { - return fy; - } - - public void setFy(SVGAnimatedLength fy) - { - this.fy = fy; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGRectElementImpl.java b/src/org/apache/fop/dom/svg/SVGRectElementImpl.java deleted file mode 100644 index fe01baa51..000000000 --- a/src/org/apache/fop/dom/svg/SVGRectElementImpl.java +++ /dev/null @@ -1,223 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; -import org.w3c.dom.*; -import org.w3c.dom.events.*; - -/** - * class representing a rectangle in an SVG Area - */ -public class SVGRectElementImpl extends GraphicElement implements SVGRectElement { - - /** x-coordinate of corner */ - private SVGAnimatedLength x; - - /** y-coordinate of corner */ - private SVGAnimatedLength y; - private SVGAnimatedLength rx; - private SVGAnimatedLength ry; - - /** width of rectangle */ - private SVGAnimatedLength width; - - /** height of rectangle */ - private SVGAnimatedLength height; - - /** - * 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 SVGRectElementImpl() { - } - - public SVGRect getBBox() - { - SVGMatrix matrix = getScreenCTM(); - double minx = 10000; - double maxx = -10000; - double miny = 10000; - double maxy = -10000; - double[] tl = new double[2]; - double[] tr = new double[2]; - double[] bl = new double[2]; - double[] br = new double[2]; - double[] res = new double[2]; - tl[0] = x.getBaseVal().getValue(); - tl[1] = y.getBaseVal().getValue(); - res[0] = matrix.getA() * tl[0] + matrix.getB() * tl[1] + matrix.getE(); - res[1] = matrix.getC() * tl[0] + matrix.getD() * tl[1] + matrix.getF(); - if(res[0] > maxx) - maxx = res[0]; - if(res[0] < minx) - minx = res[0]; - if(res[1] > maxy) - maxy = res[1]; - if(res[1] < miny) - miny = res[1]; - - tl[0] = x.getBaseVal().getValue() + width.getBaseVal().getValue(); - tl[1] = y.getBaseVal().getValue(); - res[0] = matrix.getA() * tl[0] + matrix.getB() * tl[1] + matrix.getE(); - res[1] = matrix.getC() * tl[0] + matrix.getD() * tl[1] + matrix.getF(); - if(res[0] > maxx) - maxx = res[0]; - if(res[0] < minx) - minx = res[0]; - if(res[1] > maxy) - maxy = res[1]; - if(res[1] < miny) - miny = res[1]; - - tl[0] = x.getBaseVal().getValue(); - tl[1] = y.getBaseVal().getValue() + height.getBaseVal().getValue(); - res[0] = matrix.getA() * tl[0] + matrix.getB() * tl[1] + matrix.getE(); - res[1] = matrix.getC() * tl[0] + matrix.getD() * tl[1] + matrix.getF(); - if(res[0] > maxx) - maxx = res[0]; - if(res[0] < minx) - minx = res[0]; - if(res[1] > maxy) - maxy = res[1]; - if(res[1] < miny) - miny = res[1]; - - tl[0] = x.getBaseVal().getValue() + width.getBaseVal().getValue(); - tl[1] = y.getBaseVal().getValue() + height.getBaseVal().getValue(); - res[0] = matrix.getA() * tl[0] + matrix.getB() * tl[1] + matrix.getE(); - res[1] = matrix.getC() * tl[0] + matrix.getD() * tl[1] + matrix.getF(); - if(res[0] > maxx) - maxx = res[0]; - if(res[0] < minx) - minx = res[0]; - if(res[1] > maxy) - maxy = res[1]; - if(res[1] < miny) - miny = res[1]; - - SVGRect rect = new SVGRectImpl(); - rect.setX((float)minx); - rect.setY((float)miny); - rect.setWidth((float)(maxx - minx)); - rect.setHeight((float)(maxy - miny)); - return rect; - } - - public SVGAnimatedLength getX( ) - { - return x; - } - - public void setX( SVGAnimatedLength x ) - { - this.x = x; - } - - public SVGAnimatedLength getY( ) - { - return y; - } - - public void setY( SVGAnimatedLength y ) - { - this.y = y; - } - - public SVGAnimatedLength getWidth( ) - { - return width; - } - - public void setWidth( SVGAnimatedLength width ) - { - this.width = width; - } - - public SVGAnimatedLength getHeight( ) - { - return height; - } - - public void setHeight( SVGAnimatedLength height ) - { - this.height = height; - } - - public SVGAnimatedLength getRx( ) - { - return rx; - } - - public void setRx( SVGAnimatedLength rx ) - { - this.rx = rx; - } - - public SVGAnimatedLength getRy( ) - { - return ry; - } - - public void setRy( SVGAnimatedLength ry ) - { - this.ry = ry; - } - - public String getTagName() - { - return "rect"; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGRectImpl.java b/src/org/apache/fop/dom/svg/SVGRectImpl.java deleted file mode 100644 index b8f64a259..000000000 --- a/src/org/apache/fop/dom/svg/SVGRectImpl.java +++ /dev/null @@ -1,111 +0,0 @@ -/*-- $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.dom.svg; - -import org.apache.fop.fo.Property; - -import java.util.*; - -import org.w3c.dom.svg.*; - -/** - * - */ -public class SVGRectImpl implements SVGRect { - float x; - float y; - float width; - float height; - - public SVGRectImpl() - { - } - - public float getX( ) - { - return x; - } - - public void setX(float x ) - { - this.x = x; - } - - public float getY( ) - { - return y; - } - - public void setY(float y ) - { - this.y = y; - } - - public float getWidth( ) - { - return width; - } - - public void setWidth(float width ) - { - this.width = width; - } - - public float getHeight( ) - { - return height; - } - - public void setHeight(float height ) - { - this.height = height; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGSVGElementImpl.java b/src/org/apache/fop/dom/svg/SVGSVGElementImpl.java deleted file mode 100644 index 5c7c52182..000000000 --- a/src/org/apache/fop/dom/svg/SVGSVGElementImpl.java +++ /dev/null @@ -1,368 +0,0 @@ -/*-- $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.dom.svg; - -import org.apache.fop.dom.stylesheets.StyleSheetListImpl; -import org.apache.fop.fo.Property; - -import java.util.*; - -import org.w3c.dom.events.Event; -import org.w3c.dom.Element; -import org.w3c.dom.css.RGBColor; -import org.w3c.dom.css.CSSStyleDeclaration; -import org.w3c.dom.stylesheets.StyleSheetList; -import org.w3c.dom.stylesheets.StyleSheet; -import org.w3c.dom.NodeList; -import org.w3c.dom.views.DocumentView; -import org.w3c.dom.svg.*; -import org.w3c.dom.css.*; -import org.w3c.dom.*; - -/** - * - */ -public class SVGSVGElementImpl extends GraphicElement implements SVGSVGElement { - SVGAnimatedLength x; - SVGAnimatedLength y; - SVGAnimatedLength width; - SVGAnimatedLength height; - // This will be null if the user supplied no viewBox attribute - SVGAnimatedRect viewBox; - - public SVGSVGElementImpl() { - } - - public SVGAnimatedLength getX() { - return x; - } - - public SVGAnimatedLength getY() { - return y; - } - - public SVGAnimatedLength getWidth() { - return width; - } - - public SVGAnimatedLength getHeight() { - return height; - } - - public void setWidth(SVGAnimatedLength w) { - width = w; - } - - public void setHeight(SVGAnimatedLength h) { - height = h; - } - - public void setX(SVGAnimatedLength x) { - this.x = x; - } - - public void setY(SVGAnimatedLength y) { - this.y = y; - } - - public SVGAnimatedRect getViewBox() - { - return viewBox; - } - - public void setViewBox(SVGAnimatedRect viewBox) - { - this.viewBox = viewBox; - } - - public SVGRect getViewport() { - return null; - } - - public SVGRect getBBox() { - return getChildrenBBox(); - } - - public String getContentScriptType() { - return null; - } - - public void setContentScriptType(String contentScriptType) { - } - - public String getContentStyleType() { - return null; - } - - public void setContentStyleType(String contentStyleType) { - } - - /* public CSSValue getPresentationAttribute ( String name ) - { - CSSStyleDeclaration style; - style = getStyle(); - CSSValue val; - val = style.getPropertyCSSValue(name); - if(val == null) { - // get "style" element style for this - } - if(val == null) { - // get element parents style - Node par = getParentNode(); - if(par instanceof SVGStylable) { - val = ((SVGStylable)par).getPresentationAttribute(name); - } - } - return val; - }*/ - - public SVGPoint getCurrentTranslate() { - return null; - } - - public void setCurrentTranslate(SVGPoint currentTranslate) { - } - - public SVGViewSpec getCurrentView() { - return null; - } - - public void deSelectAll() { - } - - public NodeList getIntersectionList (SVGRect rect, - SVGElement referenceElement) { - return null; - } - - public NodeList getEnclosureList (SVGRect rect, - SVGElement referenceElement) { - return null; - } - - public boolean checkIntersection (SVGElement element, SVGRect rect) { - return false; - } - - public boolean checkEnclosure (SVGElement element, SVGRect rect) { - return false; - } - - public float getPixelUnitToMillimeterX() { - return 0; - } - - public float getPixelUnitToMillimeterY() { - return 0; - } - - public float getScreenPixelToMillimeterX() { - return 0; - } - - public float getScreenPixelToMillimeterY() { - return 0; - } - - public boolean getUseCurrentView() { - return true; - } - - public void setUseCurrentView(boolean useCurrentView) { - } - - public float getCurrentScale() { - return 0; - } - - public void setCurrentScale(float currentScale) { - } - - public int suspendRedraw (int max_wait_milliseconds) { - return 0; - } - - public void unsuspendRedraw (int suspend_handle_id) { - } - - public void unsuspendRedrawAll () { - } - - public void forceRedraw () { - } - - public void pauseAnimations () { - } - - public void unpauseAnimations () { - } - - public boolean animationsPaused () { - return true; - } - - public float getCurrentTime() { - return 0; - } - - public void setCurrentTime (float seconds) { - } - - public SVGLength createSVGLength () { - return new SVGLengthImpl(); - } - - public SVGAngle createSVGAngle () { - return new SVGAngleImpl(); - } - - public SVGPoint createSVGPoint () { - return null; - } - - public SVGMatrix createSVGMatrix () { - return new SVGMatrixImpl(); - } - - public SVGRect createSVGRect () { - return new SVGRectImpl(); - } - - public SVGTransform createSVGTransform () { - return new SVGTransformImpl(); - } - - public SVGTransform createSVGTransformFromMatrix (SVGMatrix matrix) { - SVGTransform trans = new SVGTransformImpl(); - trans.setMatrix(matrix); - return trans; - } - - public RGBColor createRGBColor () { - return null; - } - - public SVGICCColor createSVGICCColor () { - return null; - } - - public Element getElementById (String elementId) { - return null; - } - - public short getZoomAndPan() { - return 0; - } - - public void setZoomAndPan(short zoomAndPan) { - } - - public SVGAnimatedPreserveAspectRatio getPreserveAspectRatio() { - return null; - } - - public CSSStyleDeclaration getComputedStyle(Element el, String str) { - return null; - } - - public CSSStyleDeclaration getOverrideStyle(Element el, String str) { - return null; - } - - public StyleSheetList getStyleSheets() { - NodeList nl = getElementsByTagName("style"); - Vector shs = new Vector(); - for (int count = 0; count < nl.getLength(); count++) { - Node el = (Node) nl.item(count); - SVGStyleElementImpl sse = (SVGStyleElementImpl) el; - StyleSheet sheet = sse.getStyleSheet(); - shs.addElement(sheet); - } - return new StyleSheetListImpl(shs); - } - - public Event createEvent(String str) { - return null; - } - - public SVGNumber createSVGNumber () { - return null;//new SVGNumberImpl(); - } - - public String createSVGString () { - return new String(); - } - - public DocumentView getDocument() { - return null; - } - - public Node appendChild(Node newChild) throws DOMException { - Node nChild = super.appendChild(newChild); - if (newChild instanceof SVGElementImpl) { - SVGElementImpl ele = (SVGElementImpl) newChild; - ele.setOwnerSVG(this); - } - setOwnerSVG(this); - return nChild; - } - - public void setOwnerSVG(SVGSVGElement owner) { - ownerSvg = owner; - NodeList nl = getChildNodes(); - for (int count = 0; count < nl.getLength(); count++) { - Node n = nl.item(count); - if (n instanceof SVGElementImpl) { - ((SVGElementImpl) n).setOwnerSVG(this); - } - } - } -} diff --git a/src/org/apache/fop/dom/svg/SVGSetElementImpl.java b/src/org/apache/fop/dom/svg/SVGSetElementImpl.java deleted file mode 100644 index e259d2170..000000000 --- a/src/org/apache/fop/dom/svg/SVGSetElementImpl.java +++ /dev/null @@ -1,64 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; - -/** - * - */ -public class SVGSetElementImpl extends GraphicElement {// implements SVGSetElement { - - public SVGSetElementImpl() - { - } -} diff --git a/src/org/apache/fop/dom/svg/SVGStopElementImpl.java b/src/org/apache/fop/dom/svg/SVGStopElementImpl.java deleted file mode 100644 index de0592809..000000000 --- a/src/org/apache/fop/dom/svg/SVGStopElementImpl.java +++ /dev/null @@ -1,75 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; - -/** - * - */ -public class SVGStopElementImpl extends SVGElementImpl implements SVGStopElement { - SVGAnimatedNumber offset; - - public SVGStopElementImpl() - { - } - - public SVGAnimatedNumber getOffset() - { - return offset; - } - - public void setOffset(SVGAnimatedNumber offset) - { - this.offset = offset; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGStringListImpl.java b/src/org/apache/fop/dom/svg/SVGStringListImpl.java deleted file mode 100644 index e4eccf139..000000000 --- a/src/org/apache/fop/dom/svg/SVGStringListImpl.java +++ /dev/null @@ -1,109 +0,0 @@ -/*-- $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.dom.svg; - -import org.apache.fop.dom.svg.*; -import org.w3c.dom.svg.*; -import org.w3c.dom.*; - -import java.util.*; - -/** - * - */ -public class SVGStringListImpl extends SVGListImpl implements SVGStringList { - public SVGStringListImpl(String str) { - parseString(str); - } - - void parseString(String str) { - StringTokenizer st = new StringTokenizer(str, ", \n\r\t:;"); - while (st.hasMoreTokens()) { - String item = st.nextToken(); - appendItem(item); - } - } - - public String initialize (String newItem) throws SVGException { - return null; - } - - public String createItem() { - return new String(); - } - - public String getItem(int index) throws DOMException { - Object obj = list.elementAt(index); - return (String) obj; - } - - public String removeItem(int index) throws DOMException { - Object obj = list.elementAt(index); - list.removeElementAt(index); - return (String) obj; - } - - public String appendItem(String newItem) throws SVGException { - list.addElement(newItem); - return null; - } - - public String replaceItem(String newItem, - int index) throws DOMException, SVGException { - return null; - } - - public String insertItemBefore(String newItem, - int index) throws SVGException { - return null; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGStyleElementImpl.java b/src/org/apache/fop/dom/svg/SVGStyleElementImpl.java deleted file mode 100644 index 3fedd5edb..000000000 --- a/src/org/apache/fop/dom/svg/SVGStyleElementImpl.java +++ /dev/null @@ -1,109 +0,0 @@ -/*-- $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.dom.svg; - -import org.apache.fop.dom.css.*; - -import org.w3c.dom.svg.*; -import org.w3c.dom.css.*; -import org.w3c.dom.stylesheets.*; - -/** - * - */ -public class SVGStyleElementImpl extends GraphicElement implements SVGStyleElement { - String type; - CSSStyleSheet styleSheet; - - public SVGStyleElementImpl(String str) - { - styleSheet = new CSSStyleSheetImpl(str); - } - - public String getType() - { - return type; - } - - public void setType(String type) - { - this.type = type; - } - - public String getMedia( ) - { - return null; - } - - public void setMedia( String media ) - { - } - - public String getTitle( ) - { - return null; - } - - public void setTitle( String title ) - { - } - - public StyleSheet getStyleSheet() - { - return styleSheet; - } - - public String getTagName() - { - return "style"; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGSwitchElementImpl.java b/src/org/apache/fop/dom/svg/SVGSwitchElementImpl.java deleted file mode 100644 index be4ecacab..000000000 --- a/src/org/apache/fop/dom/svg/SVGSwitchElementImpl.java +++ /dev/null @@ -1,69 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; - -/** - * - */ -public class SVGSwitchElementImpl extends GraphicElement implements SVGSwitchElement { - - public SVGSwitchElementImpl() { - } - - public SVGRect getBBox() - { - // is this valid since only one will be rendered? - return getChildrenBBox(); - } -} diff --git a/src/org/apache/fop/dom/svg/SVGSymbolElementImpl.java b/src/org/apache/fop/dom/svg/SVGSymbolElementImpl.java deleted file mode 100644 index 5cc318de5..000000000 --- a/src/org/apache/fop/dom/svg/SVGSymbolElementImpl.java +++ /dev/null @@ -1,86 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; - -/** - * - */ -public class SVGSymbolElementImpl extends GraphicElement implements SVGSymbolElement { - SVGAnimatedRect viewBox; - SVGAnimatedPreserveAspectRatio preserveAspectRatio; - - public SVGSymbolElementImpl() - { - } - - public SVGAnimatedRect getViewBox() - { - return viewBox; - } - - public void setViewBox(SVGAnimatedRect viewBox) - { - this.viewBox = viewBox; - } - - public SVGAnimatedPreserveAspectRatio getPreserveAspectRatio( ) - { - return preserveAspectRatio; - } - - public void setPreserveAspectRatio(SVGAnimatedPreserveAspectRatio preserveAspectRatio) - { - this.preserveAspectRatio = preserveAspectRatio; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGTRefElementImpl.java b/src/org/apache/fop/dom/svg/SVGTRefElementImpl.java deleted file mode 100644 index 205b84b00..000000000 --- a/src/org/apache/fop/dom/svg/SVGTRefElementImpl.java +++ /dev/null @@ -1,154 +0,0 @@ -/*-- $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.dom.svg; - -import java.util.Vector; - -import org.w3c.dom.svg.*; - -/** - * - */ -public class SVGTRefElementImpl extends SVGTSpanElementImpl implements SVGTRefElement { - public String ref; - - String xlinkType; - String xlinkRole; - String xlinkTitle; - String xlinkShow; - String xlinkActuate; - String xlinkArcRole; - SVGAnimatedString href; - - public SVGTRefElementImpl() - { - } - - public String getXlinkType( ) - { - return xlinkType; - } - - public void setXlinkType( String xlinkType ) - { - this.xlinkType = xlinkType; - } - - public String getXlinkRole( ) - { - return xlinkRole; - } - - public void setXlinkRole( String xlinkRole ) - { - this.xlinkRole = xlinkRole; - } - - public String getXlinkTitle( ) - { - return xlinkTitle; - } - - public void setXlinkTitle( String xlinkTitle ) - { - this.xlinkTitle = xlinkTitle; - } - - public String getXlinkArcRole() - { - return xlinkArcRole; - } - - public void setXlinkArcRole(String xlinkArcRole) - { - this.xlinkArcRole = xlinkArcRole; - } - - public String getXlinkShow( ) - { - return xlinkShow; - } - - public void setXlinkShow( String xlinkShow ) - { - this.xlinkShow = xlinkShow; - } - - public String getXlinkActuate( ) - { - return xlinkActuate; - } - - public void setXlinkActuate( String xlinkActuate ) - { - this.xlinkActuate = xlinkActuate; - } - - public SVGAnimatedString getHref( ) - { - return href; - } - - public void setHref( SVGAnimatedString href ) - { - this.href = href; - } - - public SVGAnimatedBoolean getExternalResourcesRequired() - { - return null; - } - - public void setExternalResourcesRequired(SVGAnimatedBoolean externalResourcesRequired) - { - } -} diff --git a/src/org/apache/fop/dom/svg/SVGTSpanElementImpl.java b/src/org/apache/fop/dom/svg/SVGTSpanElementImpl.java deleted file mode 100644 index 209c693ee..000000000 --- a/src/org/apache/fop/dom/svg/SVGTSpanElementImpl.java +++ /dev/null @@ -1,95 +0,0 @@ -/*-- $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.dom.svg; - -import java.util.*; - -import org.w3c.dom.svg.*; - -/** - * - */ -public class SVGTSpanElementImpl extends SVGTextContentElementImpl implements SVGTSpanElement { - public String str; - public int dx = 0; - public int dy = 0; - public SVGAnimatedLengthList xlist = null; - public SVGAnimatedLengthList ylist = null; - public SVGAnimatedLengthList dxlist = null; - public SVGAnimatedLengthList dylist = null; - - /** - * - */ - public SVGTSpanElementImpl() { - } - - public SVGAnimatedLengthList getX() { - return xlist; - } - - public SVGAnimatedLengthList getY() { - return ylist; - } - - public SVGAnimatedLengthList getDx() { - return dxlist; - } - - public SVGAnimatedLengthList getDy() { - return dylist; - } - - public SVGAnimatedNumberList getRotate() { - return null; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGTextContentElementImpl.java b/src/org/apache/fop/dom/svg/SVGTextContentElementImpl.java deleted file mode 100644 index ebf0ca5a7..000000000 --- a/src/org/apache/fop/dom/svg/SVGTextContentElementImpl.java +++ /dev/null @@ -1,120 +0,0 @@ -/*-- $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.dom.svg; - -import java.util.*; - -import org.w3c.dom.svg.*; - -/** - * class representing text in an SVG Area - * - */ -public class SVGTextContentElementImpl extends GraphicElement implements SVGTextContentElement { - - public SVGTextContentElementImpl() - { - } - - public SVGAnimatedLength getTextLength( ) - { - return null; - } - - public SVGAnimatedEnumeration getLengthAdjust( ) - { - return null; - } - - public int getNumberOfChars ( ) - { - return 0; - } - - public float getComputedTextLength ( ) - { - return 0; - } - - public float getSubStringLength ( int charnum, int nchars) - { - return 0; - } - - public SVGPoint getStartPositionOfChar ( int charnum ) - { - return null; - } - - public SVGPoint getEndPositionOfChar ( int charnum ) - { - return null; - } - - public SVGRect getExtentOfChar ( int charnum ) - { - return null; - } - - public float getRotationOfChar ( int charnum ) - { - return 0; - } - - public int getCharNumAtPosition ( SVGPoint point ) - { - return 0; - } - - public void selectSubString ( int charnum, int nchars ) - { - } -} diff --git a/src/org/apache/fop/dom/svg/SVGTextElementImpl.java b/src/org/apache/fop/dom/svg/SVGTextElementImpl.java deleted file mode 100644 index cf8490214..000000000 --- a/src/org/apache/fop/dom/svg/SVGTextElementImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -/*-- $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.dom.svg; - -import java.util.*; - -import org.w3c.dom.svg.*; -import org.apache.fop.fo.EnumProperty; - -/** - * class representing text in an SVG Area - * - */ -public class SVGTextElementImpl extends SVGTextContentElementImpl { - - /** x-coordinate of text */ - public float x; - - /** y-coordinate of text */ - public float y; - - /** alignment of text */ - public EnumProperty anchor; - - /** vector of text elements, strings, tspan, tref */ - public Vector textList; - - /** - * construct a text element - */ - public SVGTextElementImpl() - { - } -} diff --git a/src/org/apache/fop/dom/svg/SVGTextPathElementImpl.java b/src/org/apache/fop/dom/svg/SVGTextPathElementImpl.java deleted file mode 100644 index 0394d1f4c..000000000 --- a/src/org/apache/fop/dom/svg/SVGTextPathElementImpl.java +++ /dev/null @@ -1,66 +0,0 @@ -/*-- $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.dom.svg; - -/** - * - */ -public class SVGTextPathElementImpl extends SVGElementImpl { - public String pathLink; - public String str; - - public SVGTextPathElementImpl(String s, String con) - { - pathLink = s; - str = con; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGTitleElementImpl.java b/src/org/apache/fop/dom/svg/SVGTitleElementImpl.java deleted file mode 100644 index 935cbf693..000000000 --- a/src/org/apache/fop/dom/svg/SVGTitleElementImpl.java +++ /dev/null @@ -1,63 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; - -/** - * class representing a line in an SVG Area - */ -public class SVGTitleElementImpl extends GraphicElement implements SVGTitleElement { - public SVGTitleElementImpl() - { - } -} diff --git a/src/org/apache/fop/dom/svg/SVGTransformImpl.java b/src/org/apache/fop/dom/svg/SVGTransformImpl.java deleted file mode 100644 index db2f6ef11..000000000 --- a/src/org/apache/fop/dom/svg/SVGTransformImpl.java +++ /dev/null @@ -1,121 +0,0 @@ -/*-- $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.dom.svg; - -import org.apache.fop.fo.Property; - -import java.util.*; - -import org.w3c.dom.svg.*; - -/** - * - */ -public class SVGTransformImpl implements SVGTransform { - short type; - SVGMatrix matrix = new SVGMatrixImpl(); - - public SVGTransformImpl() - { - } - - public short getType( ) - { - return type; - } - - public SVGMatrix getMatrix( ) - { - return matrix; - } - - public float getAngle( ) - { - return 0.0f; - } - - public void setMatrix ( SVGMatrix matrix ) - { - this.matrix = matrix; - } - - public void setTranslate ( float tx, float ty ) - throws SVGException - { - matrix.setE(tx); - matrix.setF(ty); - } - - public void setScale ( float sx, float sy ) - throws SVGException - { - matrix.setA(sx); - matrix.setD(sy); - } - - public void setRotate (float angle, float cx, float cy) - throws SVGException - { - matrix = matrix.rotate(angle); - } - - public void setSkewX ( float angle ) - throws SVGException - { - matrix = matrix.skewX(angle); - } - - public void setSkewY ( float angle ) - throws SVGException - { - matrix = matrix.skewY(angle); - } -} diff --git a/src/org/apache/fop/dom/svg/SVGTransformListImpl.java b/src/org/apache/fop/dom/svg/SVGTransformListImpl.java deleted file mode 100644 index 480cf560e..000000000 --- a/src/org/apache/fop/dom/svg/SVGTransformListImpl.java +++ /dev/null @@ -1,115 +0,0 @@ -/*-- $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.dom.svg; - -import java.util.*; - -import org.w3c.dom.svg.*; -import org.w3c.dom.*; - -/** - * Transform List - */ -public class SVGTransformListImpl extends SVGListImpl implements SVGTransformList { - public SVGTransform createSVGTransformFromMatrix (SVGMatrix matrix) - throws SVGException { - SVGTransform st = new SVGTransformImpl(); - st.setMatrix(matrix); - return st; - } - - public SVGTransform consolidate() { - SVGMatrix matrix = new SVGMatrixImpl(); - for (int count = 0; count < getNumberOfItems(); count++) { - SVGMatrix mat = ((SVGTransform) getItem(count)).getMatrix(); - matrix = matrix.multiply(mat); - } - SVGTransform trans = new SVGTransformImpl(); - trans.setMatrix(matrix); - return trans; - } - - public SVGTransform initialize (SVGTransform newItem) - throws SVGException { - return null; - } - - public SVGTransform createItem() { - return new SVGTransformImpl(); - } - - public SVGTransform getItem(int index) throws DOMException { - Object obj = list.elementAt(index); - return (SVGTransform) obj; - } - - public SVGTransform removeItem(int index) throws DOMException { - Object obj = list.elementAt(index); - list.removeElementAt(index); - return (SVGTransform) obj; - } - - public SVGTransform appendItem(SVGTransform newItem) - throws SVGException { - list.addElement(newItem); - return null; - } - - public SVGTransform replaceItem(SVGTransform newItem, - int index) throws DOMException, SVGException { - return null; - } - - public SVGTransform insertItemBefore(SVGTransform newItem, - int index) throws SVGException { - return null; - } -} diff --git a/src/org/apache/fop/dom/svg/SVGURIReferenceImpl.java b/src/org/apache/fop/dom/svg/SVGURIReferenceImpl.java deleted file mode 100644 index edf9a3ad0..000000000 --- a/src/org/apache/fop/dom/svg/SVGURIReferenceImpl.java +++ /dev/null @@ -1,143 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; - -public class SVGURIReferenceImpl extends GraphicElement implements SVGURIReference { - String xlinkType; - String xlinkRole; - String xlinkTitle; - String xlinkShow; - String xlinkActuate; - String xlinkArcRole; - SVGAnimatedString href; - - public String getXlinkType( ) - { - return xlinkType; - } - - public void setXlinkType( String xlinkType ) - { - this.xlinkType = xlinkType; - } - - public String getXlinkRole( ) - { - return xlinkRole; - } - - public void setXlinkRole( String xlinkRole ) - { - this.xlinkRole = xlinkRole; - } - - public String getXlinkTitle( ) - { - return xlinkTitle; - } - - public void setXlinkTitle( String xlinkTitle ) - { - this.xlinkTitle = xlinkTitle; - } - - public String getXlinkArcRole() - { - return xlinkArcRole; - } - - public void setXlinkArcRole(String xlinkArcRole) - { - this.xlinkArcRole = xlinkArcRole; - } - - public String getXlinkShow( ) - { - return xlinkShow; - } - - public void setXlinkShow( String xlinkShow ) - { - this.xlinkShow = xlinkShow; - } - - public String getXlinkActuate( ) - { - return xlinkActuate; - } - - public void setXlinkActuate( String xlinkActuate ) - { - this.xlinkActuate = xlinkActuate; - } - - public SVGAnimatedString getHref( ) - { - return href; - } - - public void setHref( SVGAnimatedString href ) - { - this.href = href; - } - - public SVGAnimatedBoolean getExternalResourcesRequired() - { - return null; - } - - public void setExternalResourcesRequired(SVGAnimatedBoolean externalResourcesRequired) - { - } -} diff --git a/src/org/apache/fop/dom/svg/SVGUseElementImpl.java b/src/org/apache/fop/dom/svg/SVGUseElementImpl.java deleted file mode 100644 index 6de276cbf..000000000 --- a/src/org/apache/fop/dom/svg/SVGUseElementImpl.java +++ /dev/null @@ -1,194 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; - -/** - * Use Element - * - */ -public class SVGUseElementImpl extends GraphicElement implements SVGUseElement { - public String link; - String xlinkArcRole; - SVGAnimatedLength x; - SVGAnimatedLength y; - SVGAnimatedLength width; - SVGAnimatedLength height; - - public SVGUseElementImpl(String s) - { - link = s; - } - - public String getXlinkType( ) - { - return null; - } - - public void setXlinkType( String xlinkType ) - { - } - - public String getXlinkRole( ) - { - return null; - } - - public void setXlinkRole( String xlinkRole ) - { - } - - public String getXlinkTitle( ) - { - return null; - } - - public void setXlinkTitle( String xlinkTitle ) - { - } - - public String getXlinkArcRole() - { - return xlinkArcRole; - } - - public void setXlinkArcRole(String xlinkArcRole) - { - this.xlinkArcRole = xlinkArcRole; - } - - public String getXlinkShow( ) - { - return null; - } - - public void setXlinkShow( String xlinkShow ) - { - } - - public String getXlinkActuate( ) - { - return null; - } - - public void setXlinkActuate( String xlinkActuate ) - { - } - - public SVGAnimatedString getHref( ) - { - return null; - } - - public void setHref( SVGAnimatedString href ) - { - } - - public SVGAnimatedLength getX( ) - { - return x; - } - - public void setX( SVGAnimatedLength x ) - { - this.x = x; - } - - public SVGAnimatedLength getY( ) - { - return y; - } - - public void setY( SVGAnimatedLength y ) - { - this.y = y; - } - - public SVGAnimatedLength getWidth( ) - { - return width; - } - - public void setWidth( SVGAnimatedLength width ) - { - this.width = width; - } - - public SVGAnimatedLength getHeight( ) - { - return height; - } - - public void setHeight( SVGAnimatedLength height ) - { - this.height = height; - } - - public SVGElementInstance getInstanceRoot( ) - { - return null; - } - - public SVGElementInstance getAnimatedInstanceRoot( ) - { - return null; - } - -/* public SVGAnimatedBoolean getExternalResourcesRequired( ) - { - } - - public void setExternalResourcesRequired( SVGAnimatedBoolean externalResourcesRequired ) - { - }*/ -} diff --git a/src/org/apache/fop/dom/svg/SVGVKernElementImpl.java b/src/org/apache/fop/dom/svg/SVGVKernElementImpl.java deleted file mode 100644 index befa97e76..000000000 --- a/src/org/apache/fop/dom/svg/SVGVKernElementImpl.java +++ /dev/null @@ -1,65 +0,0 @@ -/*-- $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.dom.svg; - -import org.w3c.dom.svg.*; - -/** - * - * - */ -public class SVGVKernElementImpl extends SVGElementImpl implements SVGVKernElement { - - public SVGVKernElementImpl() - { - } -} diff --git a/src/org/apache/fop/fo/SVGTreeBuilder.java b/src/org/apache/fop/fo/SVGTreeBuilder.java index efd8e752b..c65a08b56 100644 --- a/src/org/apache/fop/fo/SVGTreeBuilder.java +++ b/src/org/apache/fop/fo/SVGTreeBuilder.java @@ -52,7 +52,7 @@ package org.apache.fop.fo; // FOP import org.apache.fop.fo.*; -import org.apache.fop.dom.svg.*; +import org.apache.fop.svg.*; import org.apache.fop.layout.AreaTree; import org.apache.fop.messaging.MessageHandler; import org.apache.fop.apps.FOPException; @@ -297,9 +297,10 @@ public class SVGTreeBuilder extends DefaultHandler implements TreeBuilder { */ public SVGDocument getSVGDocument() { - SVGDocumentImpl doc = new SVGDocumentImpl(); + SVGDocument doc = null; +/* doc = new SVGDocumentImpl(); SVGSVGElement svg = (SVGSVGElement)((org.apache.fop.svg.SVG)rootFObj).createGraphic(); - doc.appendChild(svg); + doc.appendChild(svg);*/ return doc; } } diff --git a/src/org/apache/fop/pdf/PDFDocument.java b/src/org/apache/fop/pdf/PDFDocument.java index d96654a3e..542107a6a 100644 --- a/src/org/apache/fop/pdf/PDFDocument.java +++ b/src/org/apache/fop/pdf/PDFDocument.java @@ -919,11 +919,13 @@ public class PDFDocument { contents, pagewidth, pageheight); + if(currentPage != null) { Enumeration enum=currentPage.getIDList().elements(); while ( enum.hasMoreElements() ) { String id=enum.nextElement().toString(); idReferences.setInternalGoToPageReference(id,page.referencePDF()); } + } /* add it to the list of objects */ this.objects.addElement(page); diff --git a/src/org/apache/fop/render/PrintRenderer.java b/src/org/apache/fop/render/PrintRenderer.java index efc9b8d56..21094a881 100644 --- a/src/org/apache/fop/render/PrintRenderer.java +++ b/src/org/apache/fop/render/PrintRenderer.java @@ -26,7 +26,7 @@ import org.apache.fop.datatypes.*; //import org.apache.fop.datatypes.IDReferences; import org.apache.fop.render.pdf.FontSetup; -import org.apache.fop.dom.svg.*; +import org.apache.fop.svg.SVGArea; // Java import java.io.IOException; diff --git a/src/org/apache/fop/render/Renderer.java b/src/org/apache/fop/render/Renderer.java index 5fcf18d16..adc268a9a 100644 --- a/src/org/apache/fop/render/Renderer.java +++ b/src/org/apache/fop/render/Renderer.java @@ -51,7 +51,7 @@ package org.apache.fop.render; // FOP -import org.apache.fop.dom.svg.SVGArea; +import org.apache.fop.svg.SVGArea; import org.apache.fop.image.ImageArea; import org.apache.fop.apps.FOPException; import org.apache.fop.layout.*; diff --git a/src/org/apache/fop/render/awt/AWTRenderer.java b/src/org/apache/fop/render/awt/AWTRenderer.java index 2d0790baa..79dabb579 100644 --- a/src/org/apache/fop/render/awt/AWTRenderer.java +++ b/src/org/apache/fop/render/awt/AWTRenderer.java @@ -15,14 +15,20 @@ import org.apache.fop.messaging.MessageHandler; import org.apache.fop.datatypes.*; import org.apache.fop.image.*; import org.apache.fop.svg.*; -import org.apache.fop.dom.svg.*; -import org.apache.fop.dom.svg.SVGArea; import org.apache.fop.render.pdf.*; import org.apache.fop.viewer.*; import org.apache.fop.apps.*; import org.w3c.dom.svg.*; +import org.apache.batik.bridge.*; +import org.apache.batik.swing.svg.*; +import org.apache.batik.swing.gvt.*; +import org.apache.batik.gvt.*; +import org.apache.batik.gvt.renderer.*; +import org.apache.batik.gvt.filter.*; +import org.apache.batik.gvt.event.*; + import java.awt.*; import java.awt.Image; import java.awt.image.*; @@ -629,8 +635,13 @@ public class AWTRenderer implements Renderer, Printable, Pageable { Enumeration e = area.getChildren().elements(); while (e.hasMoreElements()) { - org.apache.fop.layout.Box b = - (org.apache.fop.layout.Box) e.nextElement(); + org.apache.fop.layout.Box b = (org.apache.fop.layout.Box) e.nextElement(); + if(b instanceof InlineArea) { + InlineArea ia = (InlineArea)b; + this.currentYPosition = ry - ia.getYOffset(); + } else { + this.currentYPosition = ry - area.getPlacementOffset(); + } b.render(this); } @@ -662,26 +673,65 @@ public class AWTRenderer implements Renderer, Printable, Pageable { this.currentXPosition += area.getContentWidth(); } - public void renderSVGArea(SVGArea area) { - int x = this.currentAreaContainerXPosition; + int x = this.currentXPosition; int y = this.currentYPosition; int w = area.getContentWidth(); int h = area.getHeight(); - Enumeration e = area.getChildren().elements(); - while (e.hasMoreElements()) { - Object o = e.nextElement(); - if (o instanceof GraphicImpl) { - renderElement(area, (GraphicImpl) o, x, y, null); - } - } +// this.currentYPosition -= h; - this.currentYPosition -= h; + SVGDocument doc = area.getSVGDocument(); + + UserAgent userAgent = new MUserAgent(new AffineTransform()); + + GVTBuilder builder = new GVTBuilder(); + GraphicsNodeRenderContext rc = getRenderContext(); + BridgeContext ctx = new BridgeContext(userAgent, rc); + GraphicsNode root; + graphics.translate(x / 1000f, pageHeight - y / 1000f); + graphics.setRenderingHints(rc.getRenderingHints()); + try { + root = builder.build(ctx, doc); + root.paint(graphics, rc); + } catch(Exception e) { + e.printStackTrace(); + } + graphics.translate(-x / 1000f, y / 1000f - pageHeight); + this.currentXPosition += area.getContentWidth(); } + public GraphicsNodeRenderContext getRenderContext() { + GraphicsNodeRenderContext nodeRenderContext = null; + if (nodeRenderContext == null) { + RenderingHints hints = new RenderingHints(null); + hints.put(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + + hints.put(RenderingHints.KEY_INTERPOLATION, + RenderingHints.VALUE_INTERPOLATION_BILINEAR); + + FontRenderContext fontRenderContext = + new FontRenderContext(new AffineTransform(), true, true); + + TextPainter textPainter = new StrokingTextPainter(); + + GraphicsNodeRableFactory gnrFactory = + new ConcreteGraphicsNodeRableFactory(); + + nodeRenderContext = + new GraphicsNodeRenderContext(new AffineTransform(), + null, + hints, + fontRenderContext, + textPainter, + gnrFactory); + } + + return nodeRenderContext; + } public void setProducer(String producer) { @@ -782,540 +832,121 @@ public class AWTRenderer implements Renderer, Printable, Pageable { } } + public void renderForeignObjectArea(ForeignObjectArea area) { + area.getObject().render(this); + } - - public void renderElement(SVGArea svgarea, GraphicImpl area, - int posx, int posy, Vector parentTransforms) { - int x = posx; - int y = posy; - Hashtable style = area.oldgetStyle(); - DrawingInstruction di = createInstruction(area, style); - - Object o = null; - Vector v = area.oldgetTransform(); - v = (v == null) ? new Vector() : v; - Vector trans = new Vector(v); - parentTransforms = (parentTransforms == null) ? new Vector() : - parentTransforms; - - if (parentTransforms != null) { - trans.addAll(0, parentTransforms); + protected class MUserAgent implements UserAgent { + AffineTransform currentTransform = null; + /** + * Creates a new SVGUserAgent. + */ + protected MUserAgent(AffineTransform at) { + currentTransform = at; } - float red = (float) graphics.getColor().getRed(); - float green = (float) graphics.getColor().getGreen(); - float blue = (float) graphics.getColor().getBlue(); - Color c = null; - - ColorType ct = null; - try { - o = style.get("fill"); - if (o != null && o instanceof ColorType) { - ct = (ColorType) o; - c = new Color((int)(ct.red() * 255f), - (int)(ct.green() * 255f), (int)(ct.blue() * 255f)); - } - o = style.get("stroke"); - if (c == null && o != null && o instanceof ColorType) { - ct = (ColorType) o; - c = new Color((int)(ct.red() * 255f), - (int)(ct.green() * 255f), (int)(ct.blue() * 255f)); - } - } catch (Exception ex) { - MessageHandler.errorln("Can't set color: R G B : " + - (int)(ct.red() * 255f) + " " + - (int)(ct.green() * 255f) + " " + - (int)(ct.blue() * 255f)); - c = Color.pink; + /** + * Displays an error message. + */ + public void displayError(String message) { + System.err.println(message); } - - if (c == null) { - c = new Color((int) red, (int) green, (int) blue); + + /** + * Displays an error resulting from the specified Exception. + */ + public void displayError(Exception ex) { + ex.printStackTrace(System.err); } - Color oldColor = graphics.getColor(); - if (area instanceof SVGLineElement) { - graphics.setColor(c); - SVGLineElementImpl lg = (SVGLineElementImpl) area; - - float x1 = lg.getX1().getBaseVal().getValue() * 1000 + posx; - float y1 = posy - lg.getY1().getBaseVal().getValue() * 1000 ; - float x2 = lg.getX2().getBaseVal().getValue() * 1000 + posx; - float y2 = posy - lg.getY2().getBaseVal().getValue() * 1000; - // TODO: - // The thickness of contour protect. - int th = 1; - o = style.get("stroke-width"); - if (o != null) - th = (int)((SVGLengthImpl) o).getValue(); - Line2D.Double aLine = new Line2D.Double(x1 / 1000f, - pageHeight - y1 / 1000f, x2 / 1000f, - pageHeight - y2 / 1000f); - drawShape(transformShape(trans, aLine), di); - graphics.setColor(oldColor); - } else if (area instanceof SVGRectElement) { - graphics.setColor(c); - SVGRectElement rg = (SVGRectElement) area; - float rectx = rg.getX().getBaseVal().getValue() * 1000 + posx; - float recty = posy - rg.getY().getBaseVal().getValue() * 1000; - float rx = rg.getRx().getBaseVal().getValue() * 1000; - float ry = rg.getRy().getBaseVal().getValue() * 1000; - float rw = rg.getWidth().getBaseVal().getValue() * 1000; - float rh = rg.getHeight().getBaseVal().getValue() * 1000; - - // TODO: - // rx and ry are roundings. - // RoundRectangle2D.Double - Rectangle aRectangle = new Rectangle(); - aRectangle.setRect(rectx / 1000d, - pageHeight - recty / 1000d, rw / 1000d, rh / 1000d); - drawShape(transformShape(trans, aRectangle), di); - graphics.setColor(oldColor); - } else if (area instanceof SVGCircleElement) { - graphics.setColor(c); - SVGCircleElement cg = (SVGCircleElement) area; - float cx = cg.getCx().getBaseVal().getValue() * 1000 + posx; - float cy = posy - cg.getCy().getBaseVal().getValue() * 1000; - float r = cg.getR().getBaseVal().getValue(); - Ellipse2D.Double anEllipse = - new Ellipse2D.Double(cx / 1000d - r, - pageHeight - cy / 1000d - r, r * 2d, r * 2d); - drawShape(transformShape(trans, anEllipse), di); - graphics.setColor(oldColor); - } else if (area instanceof SVGEllipseElement) { - graphics.setColor(c); - SVGEllipseElement cg = (SVGEllipseElement) area; - float cx = cg.getCx().getBaseVal().getValue() * 1000 + posx; - float cy = posy - cg.getCy().getBaseVal().getValue() * 1000; - float rx = cg.getRx().getBaseVal().getValue(); - float ry = cg.getRy().getBaseVal().getValue(); - Ellipse2D.Double anEllipse = - new Ellipse2D.Double(cx / 1000d - rx, - pageHeight - cy / 1000d - ry, rx * 2d, ry * 2d); - drawShape(transformShape(trans, anEllipse), di); - graphics.setColor(oldColor); - } else if (area instanceof SVGImageElementImpl) { - SVGImageElementImpl ig = (SVGImageElementImpl) area; - renderImage(ig.link, ig.x + posx / 1000f, - pageHeight - (posy / 1000f - ig.y), ig.width, - ig.height, trans); - } else if (area instanceof SVGUseElementImpl) { - SVGUseElementImpl ug = (SVGUseElementImpl) area; - String ref = ug.link; - ref = ref.substring(1, ref.length()); - GraphicImpl graph = null; - // graph = area.locateDef(ref); - if (graph != null) { - // probably not the best way to do this, should be able - // to render without the style being set. - // GraphicImpl parent = graph.getGraphicParent(); - // graph.setParent(area); - // need to clip (if necessary) to the use area - // the style of the linked element is as if is was - // a direct descendant of the use element. - - renderElement(svgarea, graph, posx, posy, trans); - // graph.setParent(parent); - } - } else if (area instanceof SVGPolylineElementImpl) { - graphics.setColor(c); - Vector points = ((SVGPolylineElementImpl) area).points; - PathPoint p = null; - Point2D.Double p1 = null; - Point2D.Double p2 = null; - if (points.size() > 0) { - p = (PathPoint) points.elementAt(0); - double xc = p.x * 1000f + posx; - double yc = posy - p.y * 1000f; - p1 = new Point2D.Double(xc / 1000f, - pageHeight - yc / 1000f); - - int[] xarr = {(int) xc}; - int[] yarr = {(int) yc}; - graphics.drawPolyline(xarr, yarr, 1); - } - Line2D.Double aLine; - for (int i = 1; i < points.size(); i++) { - p = (PathPoint) points.elementAt(i); - p2 = new Point2D.Double(p.x + posx / 1000f, - pageHeight - (posy - p.y * 1000f) / 1000f); - aLine = new Line2D.Double(p1, p2); - graphics.draw(transformShape(trans, aLine)); - p1 = p2; - } - graphics.setColor(oldColor); - } else if (area instanceof SVGPolygonElementImpl) { - graphics.setColor(c); - java.awt.Polygon aPolygon = - convertPolygon(((SVGPolygonElementImpl) area), - posx, posy); - drawShape(transformShape(trans, aPolygon), di); - graphics.setColor(oldColor); - } else if (area instanceof SVGGElementImpl) { - renderGArea(svgarea, (SVGGElementImpl) area, x, y, - parentTransforms); - } else if (area instanceof SVGPathElementImpl) { - graphics.setColor(c); - GeneralPath path = - convertPath((SVGPathElementImpl) area, posx, posy); - drawShape(transformShape(trans, path), di); - graphics.setColor(oldColor); - } else if (area instanceof SVGTextElementImpl) { - MessageHandler.errorln("SVGTextElementImpl is not implemented yet."); - // renderText(svgarea, (SVGTextElementImpl)area, 0, 0, di); - } else if (area instanceof SVGArea) { - // the x and y pos will be wrong! - Enumeration e = ((SVGArea) area).getChildren().elements(); - while (e.hasMoreElements()) { - Object el = e.nextElement(); - if (o instanceof GraphicImpl) { - renderElement((SVGArea) area, (GraphicImpl) el, x, - y, parentTransforms); - } - } + /** + * Displays a message in the User Agent interface. + * The given message is typically displayed in a status bar. + */ + public void displayMessage(String message) { + System.out.println(message); } - // should be done with some cleanup code, so only - // required values are reset. - } // renderElement - - - public void renderGArea(SVGArea svgarea, SVGGElementImpl area, - int posx, int posy, Vector v) { + /** + * Returns a customized the pixel to mm factor. + */ + public float getPixelToMM() { + return 0.264583333333333333333f; // 72 dpi + } + /** + * Returns the language settings. + */ + public String getLanguages() { + return "en";//userLanguages; + } - Vector trans = null; - // trans = new Vector(area.oldgetTransform()); - // trans.addAll(0, v); - /* Enumeration e = area.getChildren().elements(); - while (e.hasMoreElements()) { - Object o = e.nextElement(); - if(o instanceof GraphicImpl) { - renderElement(svgarea, (GraphicImpl)o, posx, posy, trans); - } - }*/ - } - public void renderGArea(SVGArea svgarea, SVGGElementImpl area, - int posx, int posy) { - renderGArea(svgarea, area, posx, posy, new Vector()); - } + /** + * Returns the user stylesheet uri. + * @return null if no user style sheet was specified. + */ + public String getUserStyleSheetURI() { + return null;//userStyleSheetURI; + } + /** + * Returns the class name of the XML parser. + */ + public String getXMLParserClassName() { + String parserClassName = + System.getProperty("org.xml.sax.parser"); + if (parserClassName == null) { + parserClassName = "org.apache.xerces.parsers.SAXParser"; + } + return parserClassName;//application.getXMLParserClassName(); + } - /** - * Applies SVGTransform to the shape and gets the transformed shape. - * The type of the new shape may be different to the original type. - */ - public Shape transformShape(Vector trans, Shape shape) { - if (trans == null || trans.size() == 0) { - return shape; + /** + * Opens a link in a new component. + * @param doc The current document. + * @param uri The document URI. + */ + public void openLink(SVGAElement elt) + { + //application.openLink(uri); } - AffineTransform at; - for (int i = trans.size() - 1; i >= 0; i--) { - org.w3c.dom.svg.SVGTransform t = - (org.w3c.dom.svg.SVGTransform) trans.elementAt(i); - SVGMatrix matrix = t.getMatrix(); - at = new AffineTransform(matrix.getA(), matrix.getB(), - matrix.getC(), matrix.getD(), matrix.getE(), - matrix.getF()); - shape = at.createTransformedShape(shape); + public Point getClientAreaLocationOnScreen() + { + return new Point(0, 0); } - return shape; - } + public void setSVGCursor(java.awt.Cursor cursor) + { + } - /** - * Mapps a SVG-Polygon to a AWT-Polygon. - */ - public java.awt.Polygon convertPolygon(SVGPolygonElementImpl svgpl, - int x, int y) { - java.awt.Polygon aPolygon = new java.awt.Polygon(); - Vector points = svgpl.points; - - PathPoint p; - for (int i = 0; i < points.size(); i++) { - p = (PathPoint) points.elementAt(i); - aPolygon.addPoint((int)(x / 1000f + p.x), - pageHeight - (int)(y / 1000f - p.y)); + public AffineTransform getTransform() + { + return currentTransform; } - return aPolygon; - } + public Dimension2D getViewportSize() + { + return new Dimension(100, 100); + } - // TODO: other attributes of DrawingInstruction protect too. - protected DrawingInstruction createInstruction(GraphicImpl area, - Hashtable style) { - DrawingInstruction di = new DrawingInstruction(); - Object sp; - sp = style.get("fill"); - if (sp != null && !(sp instanceof String && sp.equals("none"))) { - di.fill = true; + public EventDispatcher getEventDispatcher() + { + return null; } - // ... - return di; - } - // Draws a shape. - // TODO: other attributes of DrawingInstruction protect too. - protected void drawShape(Shape s, DrawingInstruction di) { - if (di.fill) { - graphics.fill(s); - } else { - graphics.draw(s); + public boolean supportExtension(String str) + { + return false; } - } - /** - * Mapps a SVG-Path to a AWT-GeneralPath. - */ - public GeneralPath convertPath(SVGPathElementImpl svgpath, float x, - float y) { - Vector points = svgpath.pathElements; - GeneralPath path = new GeneralPath(); - - float lastx = 0; - float lasty = 0; - SVGPathSegImpl pathmoveto = null; - - for (Enumeration e = points.elements(); e.hasMoreElements();) { - SVGPathSegImpl pc = (SVGPathSegImpl) e.nextElement(); - float[] vals = pc.getValues(); - float lastcx = 0; - float lastcy = 0; - switch (pc.getPathSegType()) { - case SVGPathSeg.PATHSEG_MOVETO_ABS: - lastx = vals[0]; - lasty = vals[1]; - pathmoveto = pc; - path.moveTo(lastx + x / 1000f, - pageHeight - y / 1000f + lasty); - break; - case SVGPathSeg.PATHSEG_MOVETO_REL: - if (pathmoveto == null) { - lastx = vals[0]; - lasty = vals[1]; - path.moveTo(lastx + x / 1000f, - pageHeight - y / 1000f + lasty); - pathmoveto = pc; - } else { - lastx += vals[0]; - lasty += vals[1]; - path.lineTo(lastx + x / 1000f, - pageHeight - y / 1000f + lasty); - - } - break; - case SVGPathSeg.PATHSEG_LINETO_ABS: - lastx = vals[0]; - lasty = vals[1]; - path.lineTo(lastx + x / 1000f, - pageHeight - y / 1000f + lasty); - break; - case SVGPathSeg.PATHSEG_LINETO_REL: - lastx += vals[0]; - lasty += vals[1]; - path.lineTo(lastx + x / 1000f, - pageHeight - y / 1000f + lasty); - break; - case SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS: - lasty = vals[0]; - path.lineTo(lastx + x / 1000f, - pageHeight - y / 1000f + lasty); - break; - case SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL: - lasty += vals[0]; - path.lineTo(lastx + x / 1000f, - pageHeight - y / 1000f + lasty); - break; - case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS: - lastx = vals[0]; - path.lineTo(lastx + x / 1000f, - pageHeight - y / 1000f + lasty); - break; - case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL: - lastx += vals[0]; - path.lineTo(lastx + x / 1000f, - pageHeight - y / 1000f + lasty); - break; - case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS: - lastx = vals[4]; - lasty = vals[5]; - lastcx = vals[2]; - lastcy = vals[3]; - path.curveTo(x / 1000f + vals[0], - pageHeight - y / 1000f + vals[1], - x / 1000f + lastcx, - pageHeight - y / 1000f + lastcy, - x / 1000f + lastx, - pageHeight - y / 1000f + lasty); - break; - case SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL: - path.curveTo(x / 1000f + vals[0] + lastx, - pageHeight - y / 1000f + vals[1] + lasty, - x / 1000f + lastx + vals[2], - pageHeight - y / 1000f + lasty + vals[3], - x / 1000f + lastx + vals[4], - pageHeight - y / 1000f + lasty + vals[5]); - lastcx = vals[2] + lastx; - lastcy = vals[3] + lasty; - lastx += vals[4]; - lasty += vals[5]; - break; - case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: - if (lastcx == 0) - lastcx = lastx; - if (lastcy == 0) - lastcy = lasty; - lastx = vals[2]; - lasty = vals[3]; - path.curveTo(x / 1000f + lastcx, - pageHeight - y / 1000f + lastcy, - x / 1000f + vals[0], - pageHeight - y / 1000f + vals[1], - x / 1000f + lastx, - pageHeight - y / 1000f + lasty); - break; - case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL: - if (lastcx == 0) - lastcx = lastx; - if (lastcy == 0) - lastcy = lasty; - path.curveTo(x / 1000f + lastcx, - pageHeight - y / 1000f + lastcy, - x / 1000f + lastx + vals[0], - pageHeight - y / 1000f + lasty + vals[1], - x / 1000f + lastx + vals[2], - pageHeight - y / 1000f + lasty + vals[3]); - lastx += vals[2]; - lasty += vals[3]; - break; - case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS: - if (lastcx == 0) - lastcx = lastx; - if (lastcy == 0) - lastcy = lasty; - lastx = vals[0]; - lasty = vals[1]; - lastcx = 0; - lastcy = 0; - path.quadTo(x / 1000f + lastcx, - pageHeight - y / 1000f + lastcy, - x / 1000f + lastx, - pageHeight - y / 1000f + lasty); - break; - case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL: - if (lastcx == 0) - lastcx = lastx; - if (lastcy == 0) - lastcy = lasty; - - path.quadTo(x / 1000f + lastcx , - pageHeight - y / 1000f + lastcy, - x / 1000f + lastx + vals[0], - pageHeight - y / 1000f + lasty + vals[1]); - - lastx += vals[0]; - lasty += vals[1]; - lastcx = 0; - lastcy = 0; - break; - case SVGPathSeg.PATHSEG_ARC_ABS: - { - // Arc2D.Double arc = new Arc2D.Double(); - // arc.setAngles(current point, end point); .... - double rx = vals[0]; - double ry = vals[1]; - double theta = vals[2]; - boolean largearcflag = (vals[3] == 1.0); - boolean sweepflag = (vals[4] == 1.0); - - double cx = lastx; - double cy = lasty; - - path.curveTo(x / 1000f + lastx, - pageHeight - y / 1000f + lasty, - x / 1000f + vals[0], - pageHeight - y / 1000f + vals[1], - x / 1000f + vals[5], - pageHeight - y / 1000f + vals[6]); - - lastcx = 0; //?? - lastcy = 0; //?? - lastx = vals[5]; - lasty = vals[6]; - } - break; - case SVGPathSeg.PATHSEG_ARC_REL: - { - double rx = vals[0]; - double ry = vals[1]; - double theta = vals[2]; - boolean largearcflag = (vals[3] == 1.0); - boolean sweepflag = (vals[4] == 1.0); - - path.curveTo(x / 1000f + lastx, - pageHeight - y / 1000f + lasty, - x / 1000f + (vals[0] + lastx), - pageHeight - y / 1000f + (vals[1] + lasty), - x / 1000f + (vals[5] + lastx), - pageHeight - y / 1000f + (vals[6] + lasty)); - lastcx = 0; //?? - lastcy = 0; //?? - lastx += vals[5]; - lasty += vals[6]; - } - break; - case SVGPathSeg.PATHSEG_CLOSEPATH: - path.closePath(); - break; - - - } // switch - } // for points.elements() - - return path; - } // convertPath - /* - if(di == null) { - currentStream.add("S\n"); - } else { - if(di.fill) { - if(di.stroke) { - if(!di.nonzero) - currentStream.add("B*\n"); - else - currentStream.add("B\n"); - } else { - if(!di.nonzero) - currentStream.add("f*\n"); - else - currentStream.add("f\n"); - } - } else { - // if(di.stroke) - currentStream.add("S\n"); - } - } - */ - - /* - * by pdfrenderer übernommen. - * - */ - class DrawingInstruction { - boolean stroke = false; - boolean nonzero = false; // non-zero fill rule "f*", "B*" operator - boolean fill = false; - int linecap = 0; // butt - int linejoin = 0; // miter - int miterwidth = 8; - } + public boolean hasFeature(String str) + { + return false; + } - public void renderForeignObjectArea(ForeignObjectArea area) { - area.getObject().render(this); + public void registerExtension(BridgeExtension be) + { + } } - } - - - diff --git a/src/org/apache/fop/render/mif/MIFRenderer.java b/src/org/apache/fop/render/mif/MIFRenderer.java index 6ae5ffe33..07fa3e12a 100644 --- a/src/org/apache/fop/render/mif/MIFRenderer.java +++ b/src/org/apache/fop/render/mif/MIFRenderer.java @@ -67,7 +67,7 @@ import org.apache.fop.fo.*; import org.apache.fop.layout.*; import org.apache.fop.layout.inline.*; import org.apache.fop.datatypes.*; -import org.apache.fop.svg.PathPoint; +import org.apache.fop.svg.*; import org.apache.fop.mif.*; import org.apache.fop.layout.*; import org.apache.fop.image.*; @@ -77,12 +77,6 @@ import org.w3c.dom.svg.*; import org.w3c.dom.css.*; import org.w3c.dom.svg.SVGLength; -import org.apache.fop.dom.svg.*; -import org.apache.fop.dom.svg.SVGRectElementImpl; -import org.apache.fop.dom.svg.SVGTextElementImpl; -import org.apache.fop.dom.svg.SVGLineElementImpl; -import org.apache.fop.dom.svg.SVGArea; - // Java import java.io.IOException; import java.io.OutputStream; diff --git a/src/org/apache/fop/render/pcl/PCLRenderer.java b/src/org/apache/fop/render/pcl/PCLRenderer.java index e38e12745..e3f3972db 100755 --- a/src/org/apache/fop/render/pcl/PCLRenderer.java +++ b/src/org/apache/fop/render/pcl/PCLRenderer.java @@ -21,7 +21,7 @@ import org.apache.fop.layout.*; import org.apache.fop.layout.inline.*; import org.apache.fop.image.*; -import org.apache.fop.dom.svg.SVGArea; +import org.apache.fop.svg.SVGArea; import org.w3c.dom.svg.SVGSVGElement; @@ -538,9 +538,6 @@ System.out.println("PCLRenderer.renderSVGArea(" + area + ")"); // TODO - translate and clip to viewbox - PCLSVGRenderer svgRenderer = - new PCLSVGRenderer(this, area.getFontState(), currentFontName, currentFontSize, currentXPosition, currentYPosition, pageHeight, xoffset); - svgRenderer.renderSVG(svg, x, y); //currentStream.add(svgRenderer.getString()); //currentStream.add("Q\n"); diff --git a/src/org/apache/fop/render/pcl/PCLSVGRenderer.java b/src/org/apache/fop/render/pcl/PCLSVGRenderer.java deleted file mode 100755 index 5543faa58..000000000 --- a/src/org/apache/fop/render/pcl/PCLSVGRenderer.java +++ /dev/null @@ -1,1400 +0,0 @@ -/* $Id$ - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. - * For details on use and redistribution please refer to the - * LICENSE file included with these sources." - */ - -//package com.eastpoint.chrysalis; -package org.apache.fop.render.pcl; - -// FOP -import org.apache.fop.messaging.MessageHandler; -import org.apache.fop.fo.properties.*; -import org.apache.fop.svg.PathPoint; -import org.apache.fop.pdf.PDFColor; -import org.apache.fop.layout.*; -import org.apache.fop.image.*; - -import org.w3c.dom.*; -import org.w3c.dom.svg.*; -import org.w3c.dom.css.*; - -import org.apache.fop.dom.svg.*; - -// Java -import java.util.Enumeration; -import java.util.Vector; - -/** - * Renderer that renders SVG to PCL - */ -public class PCLSVGRenderer -{ - FontState fontState; - - /** the current stream to add PCL commands to */ - PCLStream currentStream; - - /** the current (internal) font name */ - protected String currentFontName; - - /** the current font size in millipoints */ - protected int currentFontSize; - - /** the current vertical position in millipoints from bottom */ - protected int currentYPosition = 0; - - /** the current horizontal position in millipoints from left */ - protected int currentXPosition = 0; - - /** the current colour for use in svg */ - private PDFColor currentColour = new PDFColor(0, 0, 0); - - private PCLRenderer renderer; - - final boolean debug = false; - - private int pageHeight; - private int rendxoffset; - - /** - * create the SVG renderer - */ - public PCLSVGRenderer(PCLRenderer rend, FontState fs, String font, int size, int xpos, int ypos, int ph, int xo) - { - renderer = rend; - currentFontName = font; - currentFontSize = size; - currentYPosition = ypos; - currentXPosition = xpos; - fontState = fs; - - currentStream = rend.currentStream; - - pageHeight = ph; - rendxoffset = xo; - } - - /** - * Renders an SVG element in an SVG document. - * This renders each of the child elements. - */ - protected void renderSVG(SVGSVGElement svg, int x, int y) { - NodeList nl = svg.getChildNodes(); - for (int count = 0; count < nl.getLength(); count++) { - Node n = nl.item(count); - if (n instanceof SVGElement) { - renderElement((SVGElement) n, x, y); - } - } - } - - public void renderGArea(SVGGElement area, int posx, int posy) { - NodeList nl = area.getChildNodes(); - for (int count = 0; count < nl.getLength(); count++) { - Node n = nl.item(count); - if (n instanceof SVGElement) { - renderElement((SVGElement) n, posx, posy); - } - } - } - - /** - * Handles the SVG switch element. - * The switch determines which of its child elements should be rendered - * according to the required extensions, required features and system language. - */ - protected void handleSwitchElement(int posx, int posy, - SVGSwitchElement ael) { - SVGStringList relist = ael.getRequiredExtensions(); - SVGStringList rflist = ael.getRequiredFeatures(); - SVGStringList sllist = ael.getSystemLanguage(); - NodeList nl = ael.getChildNodes(); - choices: - for (int count = 0; count < nl.getLength(); count++) { - org.w3c.dom.Node n = nl.item(count); - // only render the first child that has a valid - // test data - if (n instanceof GraphicElement) { - GraphicElement graphic = (GraphicElement) n; - SVGStringList grelist = graphic.getRequiredExtensions(); - // if null it evaluates to true - if (grelist != null) { - if (grelist.getNumberOfItems() == 0) { - if ((relist != null) && - relist.getNumberOfItems() != 0) { - continue choices; - } - } - for (int i = 0; i < grelist.getNumberOfItems(); i++) { - String str = (String) grelist.getItem(i); - if (relist == null) { - // use default extension set - // currently no extensions are supported - // if(!(str.equals("http:// ??"))) { - continue choices; - // } - } else { - } - } - } - SVGStringList grflist = graphic.getRequiredFeatures(); - if (grflist != null) { - if (grflist.getNumberOfItems() == 0) { - if ((rflist != null) && - rflist.getNumberOfItems() != 0) { - continue choices; - } - } - for (int i = 0; i < grflist.getNumberOfItems(); i++) { - String str = (String) grflist.getItem(i); - if (rflist == null) { - // use default feature set - if (!(str.equals("org.w3c.svg.static") || - str.equals("org.w3c.dom.svg.all"))) { - continue choices; - } - } else { - boolean found = false; - for (int j = 0; - j < rflist.getNumberOfItems(); j++) { - if (rflist.getItem(j).equals(str)) { - found = true; - break; - } - } - if (!found) - continue choices; - } - } - } - SVGStringList gsllist = graphic.getSystemLanguage(); - if (gsllist != null) { - if (gsllist.getNumberOfItems() == 0) { - if ((sllist != null) && - sllist.getNumberOfItems() != 0) { - continue choices; - } - } - for (int i = 0; i < gsllist.getNumberOfItems(); i++) { - String str = (String) gsllist.getItem(i); - if (sllist == null) { - // use default feature set - if (!(str.equals("en"))) { - continue choices; - } - } else { - boolean found = false; - for (int j = 0; - j < sllist.getNumberOfItems(); j++) { - if (sllist.getItem(j).equals(str)) { - found = true; - break; - } - } - if (!found) - continue choices; - } - } - } - renderElement((SVGElement) n, posx, posy); - // only render the first valid one - break; - } - } - } - - protected void addLine(float x1, float y1, float x2, float y2, PDFColor sc, float sw) - { -if ( debug ) -System.out.println("PCLSVGRenderer.addLine(" + x1 + ", " + y1 + ", " + x2 + ", " + y2 + ", " + sc + ", " + sw + ")"); - if ( x1 == x2 ) - { - addRect(x1 - sw/2, y1, sw, y2 - y1 + 1, 0, 0, sc, null, 0); - } - else if ( y1 == y2 || (Math.abs(y1 - y2) <= 0.24) ) // 72/300=0.24 - { - addRect(x1, y1 - sw/2, x2 - x1 + 1, sw, 0, 0, sc, null, 0); - } - else if ( sc != null ) - { - // Do something for these? - - // Convert dimensions to pixels. - float cfact = 300f / 72f; // 300 dpi, 1pt=1/72in - int ix1 = (int)(x1 * cfact); - int iy1 = (int)(y1 * cfact); - int ix2 = (int)(x2 * cfact); - int iy2 = (int)(y2 * cfact); - int isw = (int)(sw * cfact); - int origix; - - // Normalize - if ( iy1 > iy2 ) - { - int tmp = ix1; - ix1 = ix2; - ix2 = tmp; - tmp = iy1; - iy1 = iy2; - iy2 = tmp; - } - if ( ix1 > ix2 ) - { - origix = ix2; - ix1 -=ix2; - ix2 = 0; - } - else - { - origix = ix1; - ix2 -= ix1; - ix1 = 0; - } - - // Convert line width to a pixel run length. -//System.out.println("PCLRenderer.addLine(" + ix1 + ", " + iy1 + ", " + ix2 + ", " + iy2 + ", " + isw + ")"); - int runlen = (int)Math.sqrt(Math.pow(isw, 2) * (1 + Math.pow((ix1 - ix2) / (iy1 - iy2), 2))); -//System.out.println("PCLRenderer.addLine: runlen = " + runlen); - - // Set Transparency modes and select shading. - currentStream.add("\033*v0n1O\033*c" + (int)(100 - ((0.3f * sc.red() + 0.59f * sc.green() + 0.11f * sc.blue()) * 100f)) + "G\033*v2T"); - - // Draw the line. - int d, dx, dy; - int Aincr, Bincr; - int xincr = 1; - int x, y; - - - dx = Math.abs(ix2 - ix1); - dy = iy2 - iy1; - - if ( origix < 0 ) - MessageHandler.errorln("PCLSVGRenderer.addLine() WARNING: Horizontal position out of bounds."); - - if ( dx > dy ) - { - xincr = dx / dy; - - // Move to starting position. - currentStream.add("\033*p" + origix + "x" + iy1 + "Y"); - x = ix1 - runlen / 2; - iy2 += (isw / 2); - // Start raster graphics - currentStream.add("\033*t300R\033*r" + dx + "s1A\033*b1M"); - } - else - { - // Move to starting position. - currentStream.add("\033*p" + (origix - runlen / 2) + "x" + iy1 + "Y"); - x = ix1; - // Start raster graphics - currentStream.add("\033*t300R\033*r1A\033*b1M"); - } - - if ( ix1 > ix2 ) - xincr *= -1; - d = 2 * dx - dy; - Aincr = 2 * (dx - dy); - Bincr = 2 * dx; - - y = iy1; - - xferLineBytes(x, runlen, null, -1); - - for ( y = iy1 + 1 ; y <= iy2 ; y++ ) - { - if ( d >= 0 ) - { - x += xincr; - d += Aincr; - } - else - d += Bincr; - xferLineBytes(x, runlen, null, -1); - } - - // End raster graphics - currentStream.add("\033*rB"); - // Return to regular print mode. - currentStream.add("\033*v0t0n0O"); - } - } - - private void xferLineBytes(int startpos, int bitcount, Vector save, int start2) - { -//System.out.println("PCLRenderer.xferLineBytes(" + startpos + ", " + bitcount + ")"); - int curbitpos = 0; - if ( start2 > 0 && start2 <= (startpos + bitcount) ) - { - bitcount += (start2 - startpos); - start2 = 0; - } - - char bytes[] = new char[((start2>startpos?start2:startpos) + bitcount) / 4 + 2]; - int dlen = 0; - byte dbyte = 0; - int bytepos = 0; - - do - { - int bits2set; - if ( startpos < 0 ) - { - bits2set = bitcount + startpos; - startpos = 0; - } - else - bits2set = bitcount; - - byte bittype = 0; - do - { - if ( bytepos > 0 ) - { - int inc = startpos - curbitpos; - if ( (inc) >= (8 - bytepos) ) - { - curbitpos += (8 - bytepos); - bytepos = 0; - bytes[dlen++] = (char)0; - bytes[dlen++] = (char)dbyte; - dbyte = 0; - } - else - { - bytepos += inc; - dbyte = (byte)(dbyte ^ (byte)(Math.pow(2, 8 - bytepos) - 1)); - curbitpos += inc; - } - } - - // Set runs of whole bytes. - int setbytes = (startpos - curbitpos) / 8; - if ( setbytes > 0 ) - { - curbitpos += setbytes * 8; - while ( setbytes > 0 ) - { - if ( setbytes > 256 ) - { - bytes[dlen++] = 0xFF; - setbytes -= 256; - } - else - { - bytes[dlen++] = (char)((setbytes - 1) & 0xFF); - setbytes = 0; - } - bytes[dlen++] = (char)bittype; - } - } - // move to position in the first byte. - if ( curbitpos < startpos ) - { - if ( bytepos == 0 ) - dbyte = bittype; - bytepos += startpos - curbitpos; - dbyte = (byte)(dbyte ^ (byte)(Math.pow(2, 8 - bytepos) - 1)); - curbitpos += bytepos; - startpos += bits2set; - } - else - { - startpos += bits2set; - } - - if ( bittype == 0 ) - bittype = (byte)0xFF; - else - bittype = 7; - } while ( bittype != 7 ); - - if ( start2 > 0 ) - { - startpos = start2; - start2 = -1; - } - else - startpos = -1; - } while ( startpos >= 0 ); - if ( bytepos > 0 ) - { - bytes[dlen++] = (char)0; - bytes[dlen++] = (char)dbyte; - } - if ( save == null ) - { - currentStream.add("\033*b" + dlen + "W"); - currentStream.add(new String(bytes, 0, dlen)); - } - else - { - String line = "\033*b" + dlen + "W" + new String(bytes, 0, dlen); - currentStream.add(line); - save.addElement(line); - } - } - - /** - * add a filled rectangle to the current stream - * - * @param x the x position of left edge in millipoints - * @param y the y position of top edge in millipoints - * @param w the width in millipoints - * @param h the height in millipoints - * @param r the red component of edges - * @param g the green component of edges - * @param b the blue component of edges - * @param fr the red component of the fill - * @param fg the green component of the fill - * @param fb the blue component of the fill - */ - protected void addRect(float x, float y, float w, float h, float rx, float ry, - PDFColor fc, PDFColor sc, float sw) - { -if ( debug ) -System.out.println("PCLSVGRenderer.addRect(" + x + ", " + y + ", " + w + ", " + h + ", " + rx + ", " + ry + ", " + fc + ", " + sc + ", " + sw + ")"); - - if ( x < 0 || y < 0 ) - MessageHandler.errorln("PCLSVGRenderer.addRect() WARNING: Position out of bounds."); - - if ( rx == 0 || ry == 0 ) - { - if ( fc != null ) - { - int fillshade = (int)(100 - ((0.3f * fc.red() + 0.59f * fc.green() + 0.11f * fc.blue()) * 100f)); - currentStream.add("\033*v0n1O\033&a" + (x * 10) + "h" + ((y * 10)) + "V" - + "\033*c" + (w * 10) + "h" + (h * 10) + "v" + fillshade + "g2P\033*v0n0O"); - } - if ( sc != null && sw > 0 ) - { - String lend = "v" + String.valueOf((int)(100 - ((0.3f * sc.red() + 0.59f * sc.green() + 0.11f * sc.blue()) * 100f))) + "g2P"; - currentStream.add("\033*v0n1O"); - currentStream.add("\033&a" + ((x - sw/2) * 10) + "h" + (((y - sw/2)) * 10) + "V" - + "\033*c" + ((w + sw) * 10) + "h" + ((sw) * 10) + lend); - currentStream.add("\033&a" + ((x - sw/2) * 10) + "h" + (((y - sw/2)) * 10) + "V" - + "\033*c" + ((sw) * 10) + "h" + ((h + sw) * 10) + lend); - currentStream.add("\033&a" + ((x + w - sw/2) * 10) + "h" + (((y - sw/2)) * 10) + "V" - + "\033*c" + ((sw) * 10) + "h" + ((h + sw) * 10) + lend); - currentStream.add("\033&a" + ((x - sw/2) * 10) + "h" + (((y + h - sw/2)) * 10) + "V" - + "\033*c" + ((w + sw) * 10) + "h" + ((sw) * 10) + lend); - currentStream.add("\033*v0n0O"); - } - } - else - { - // Convert dimensions to pixels. - float cfact = 300f / 72f; // 300 dpi, 1pt=1/72in - int ix = (int)(x * cfact); - int iy = (int)(y * cfact); - int iw = (int)(w * cfact); - int ih = (int)(h * cfact); - int irx = (int)(rx * cfact); - int iry = (int)(ry * cfact); - int isw = (int)(sw * cfact); - int longwidth = 0; - int pass = 0; - PDFColor thecolor = null; - - do - { - if ( pass == 0 && fc != null ) - { - thecolor = fc; - } - else if ( pass == 1 && sc != null ) - { - int iswdiv2 = isw / 2; - thecolor = sc; - ix -= iswdiv2; - iy -= iswdiv2; - irx += iswdiv2; - iry += iswdiv2; - iw += isw; - ih += isw; - longwidth = (int)(isw * 1.414); - } - else - thecolor = null; - - - if ( thecolor != null ) - { - int tx = 0; - int ty = iry; - long a = irx; - long b = iry; - long Asquared = (long)Math.pow(a, 2); - long TwoAsquared = 2 * Asquared; - long Bsquared = (long)Math.pow(b, 2); - long TwoBsquared = 2 * Bsquared; - long d = Bsquared - Asquared * b + Asquared / 4; - long dx = 0; - long dy = TwoAsquared * b; - int rectlen = iw - 2 * irx; - Vector bottomlines = new Vector(); - - int x0 = tx; - - // Set Transparency modes and select shading. - currentStream.add("\033*v0n1O\033*c" + (int)(100 - ((0.3f * thecolor.red() + 0.59f * thecolor.green() + 0.11f * thecolor.blue()) * 100f)) + "G\033*v2T"); - // Move to starting position. - currentStream.add("\033*p" + ix + "x" + iy + "Y"); - // Start raster graphics - currentStream.add("\033*t300R\033*r" + iw + "s1A\033*b1M"); - - while ( dx < dy ) - { - if ( d > 0 ) - { - if ( pass == 0 || ty > (iry - isw) ) - xferLineBytes(irx - x0, rectlen + 2 * x0, bottomlines, -1); - else - xferLineBytes(irx - x0, longwidth, bottomlines, iw - irx + x0 - longwidth); - x0 = tx + 1; - ty--; - dy -= TwoAsquared; - d -= dy; - } - tx++; - dx += TwoBsquared; - d += Bsquared + dx; - } - - d += (3 * (Asquared - Bsquared) / 2 - (dx + dy)) / 2; - - while ( ty > 0 ) - { - if ( pass == 0 || ty >= (iry - isw) ) - xferLineBytes(irx - tx, rectlen + 2 * tx, bottomlines, -1); - else - xferLineBytes(irx - tx, isw, bottomlines, iw - irx + tx - isw); - - if ( d < 0 ) - { - tx++; - dx += TwoBsquared; - d += dx; - } - ty--; - dy -= TwoAsquared; - d += Asquared - dy; - } - - // Draw the middle part of the rectangle - int midlen = ih - 2 * iry; - if ( midlen > 0 ) - { - if ( pass == 0 ) - xferLineBytes(0, iw, null, -1); - else - xferLineBytes(0, isw, null, iw - isw); - currentStream.add("\033*b3M"); - for ( int countr = midlen - 1 ; countr > 0 ; countr-- ) - currentStream.add("\033*b0W"); - currentStream.add("\033*b1M"); - } - - // Draw the bottom. - for ( int countr = bottomlines.size() - 1 ; countr >= 0 ; countr-- ) - currentStream.add((String)bottomlines.elementAt(countr)); - - // End raster graphics - currentStream.add("\033*rB"); - // Return to regular print mode. - currentStream.add("\033*v0t0n0O"); - } - pass++; - } while ( pass < 2 ); - } - } - - // Add a polyline or polygon. Does not support fills yet!!! - protected void addPolyline(Vector points, int posx, int posy, PDFColor fc, PDFColor sc, float sw, boolean close) - { - PathPoint pc; - float lastx = 0; - float lasty = 0; - float curx = 0; - float cury = 0; - float startx = 0; - float starty = 0; - Enumeration e = points.elements(); - if(e.hasMoreElements()) - { - pc = (PathPoint)e.nextElement(); - lastx = rendxoffset / 10 + pc.x + posx / 1000; - lasty = ((pageHeight / 10) - posy/1000) + pc.y; - startx = lastx; - starty = lasty; - //currentStream.add(lastx + " " + lasty + " m\n"); - } - while(e.hasMoreElements()) - { - pc = (PathPoint)e.nextElement(); - curx = rendxoffset / 10 + pc.x + posx / 1000; - cury = ((pageHeight / 10) - posy/1000) + pc.y; - addLine(lastx, lasty, curx, cury, sc, sw); - lastx = curx; - lasty = cury; - //currentStream.add(lastx + " " + lasty + " l\n"); - } - if(close) - { - addLine(lastx, lasty, startx, starty, sc, sw); - //currentStream.add("h\n"); - } - //doDrawing(di); - } - - public void renderImage(String href, float x, float y, float width, float height) - { - if ( x < 0 || y < 0 ) - MessageHandler.errorln("PCLSVGRenderer.renderImage() WARNING: Position out of bounds."); - - try - { - if ( href.indexOf(":") == -1 ) - href = "file:" + href; - FopImage img = FopImageFactory.Make(href); - if(img != null) - { - if ( img instanceof SVGImage ) - { - SVGSVGElement svg = ((SVGImage)img).getSVGDocument().getRootElement(); - renderSVG(svg, (int)x * 1000, (int)y * 1000); - } - else - { - currentStream.add("\033&a" + (x * 10) + "h" + (y * 10) + "V"); - renderer.printBMP(img, (int)x, (int)y, (int)width, (int)height); - } - - } - } - catch(Exception e) - { - MessageHandler.errorln("could not add image to SVG: " + href); - } - } - - /** - * A symbol has a viewbox and preserve aspect ratio. - */ - protected void renderSymbol(SVGSymbolElement symbol, int x, int y) { - NodeList nl = symbol.getChildNodes(); - for (int count = 0; count < nl.getLength(); count++) { - Node n = nl.item(count); - if (n instanceof SVGElement) { - renderElement((SVGElement) n, x, y); - } - } - } - - /** - * Main rendering selection. - * This applies any transform ans style and then calls the appropriate - * rendering method depending on the type of the element. - */ - public void renderElement(SVGElement area, int posx, int posy) - { -if ( debug ) -System.out.println("PCLRenderer.renderElement(" + fontState + ", " + area + ", " + posx + ", " + posy + ")"); - int x = posx; - int y = posy; - SVGStylable style = null; - if ( area instanceof SVGStylable ) - style = (SVGStylable)area; - PDFColor fillColour = null; - PDFColor strokeColour = null; - float strokeWidth = 1; - - //currentStream.add("q\n"); - //if( area instanceof SVGTransformable ) - //{ - // SVGTransformable tf = (SVGTransformable)area; - // SVGAnimatedTransformList trans = tf.getTransform(); - // SVGRect bbox = tf.getBBox(); - // if(trans != null) { - // applyTransform(trans, bbox); - // } - //} - - if(style != null) - { - CSSValue sp; - sp = style.getPresentationAttribute("fill"); - if (sp != null) - { - if (sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) - { - if (((CSSPrimitiveValue) sp).getPrimitiveType() == CSSPrimitiveValue.CSS_RGBCOLOR) - { - RGBColor col = ((CSSPrimitiveValue) sp).getRGBColorValue(); - CSSPrimitiveValue val; - val = col.getRed(); - float red = val.getFloatValue(CSSPrimitiveValue.CSS_NUMBER); - val = col.getGreen(); - float green = val.getFloatValue(CSSPrimitiveValue.CSS_NUMBER); - val = col.getBlue(); - float blue = val.getFloatValue(CSSPrimitiveValue.CSS_NUMBER); - fillColour = new PDFColor(red, green, blue); - currentColour = fillColour; - } - else if ( ((CSSPrimitiveValue) sp).getPrimitiveType() == CSSPrimitiveValue.CSS_STRING) - { - String str = ((CSSPrimitiveValue) sp).getCssText(); - if ( str.equals("none") ) - { - fillColour = null; - } - else if ( str.equals("currentColor") ) - { - fillColour = currentColour; - } - } - } - } - else - { - fillColour = new PDFColor(0, 0, 0); - } - sp = style.getPresentationAttribute("stroke"); - if ( sp != null ) - { - if ( sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE ) - { - if ( ((CSSPrimitiveValue) sp).getPrimitiveType() == CSSPrimitiveValue.CSS_RGBCOLOR ) - { - RGBColor col = ((CSSPrimitiveValue) sp).getRGBColorValue(); - CSSPrimitiveValue val; - val = col.getRed(); - float red = val.getFloatValue(CSSPrimitiveValue.CSS_NUMBER); - val = col.getGreen(); - float green = val.getFloatValue(CSSPrimitiveValue.CSS_NUMBER); - val = col.getBlue(); - float blue = val.getFloatValue(CSSPrimitiveValue.CSS_NUMBER); - strokeColour = new PDFColor(red, green, blue); - } - else if ( ((CSSPrimitiveValue) sp).getPrimitiveType() == CSSPrimitiveValue.CSS_STRING ) - { - String str = ((CSSPrimitiveValue) sp).getCssText(); - if (str.equals("none")) - { - strokeColour = null; - } - } - } - } - else - { - strokeColour = new PDFColor(0, 0, 0); - } - sp = style.getPresentationAttribute("stroke-width"); - if ( sp != null ) - { - if ( sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE ) - { - strokeWidth = ((CSSPrimitiveValue) sp).getFloatValue(CSSPrimitiveValue.CSS_PT); - } - } - } - - if (area instanceof SVGRectElement) - { - SVGRectElement rg = (SVGRectElement)area; - float rectx = rendxoffset / 10 + rg.getX().getBaseVal().getValue() + posx / 1000; - float recty = ((pageHeight / 10) - posy/1000) + rg.getY().getBaseVal().getValue(); - float rx = rg.getRx().getBaseVal().getValue(); - float ry = rg.getRy().getBaseVal().getValue(); - float rw = rg.getWidth().getBaseVal().getValue(); - float rh = rg.getHeight().getBaseVal().getValue(); - addRect(rectx, recty, rw, rh, rx, ry, fillColour, strokeColour, strokeWidth); - } - else if (area instanceof SVGLineElement) - { - SVGLineElement lg = (SVGLineElement)area; - float x1 = rendxoffset / 10 + lg.getX1().getBaseVal().getValue() + posx / 1000; - float y1 = ((pageHeight / 10) - posy/1000) + lg.getY1().getBaseVal().getValue(); - float x2 = rendxoffset / 10 + lg.getX2().getBaseVal().getValue() + posx / 1000; - float y2 = ((pageHeight / 10) - posy/1000) + lg.getY2().getBaseVal().getValue(); - addLine(x1,y1,x2,y2, strokeColour, strokeWidth); - } - else if (area instanceof SVGTextElementImpl) - { - //currentStream.add("BT\n"); - //renderText((SVGTextElementImpl)area, rendxoffset + posx / 1000f, ((float)(pageHeight / 10) - posy/1000f)); - //currentStream.add("ET\n"); - SVGTextRenderer str = new SVGTextRenderer(fontState, (SVGTextElementImpl)area, rendxoffset / 10 + posx / 1000f, ((float)(pageHeight / 10) - posy/1000f)); - str.renderText((SVGTextElementImpl)area); - } - else if (area instanceof SVGCircleElement) - { - SVGCircleElement cg = (SVGCircleElement)area; - float cx = rendxoffset / 10 + cg.getCx().getBaseVal().getValue() + posx / 1000; - float cy = ((pageHeight / 10) - posy/1000) + cg.getCy().getBaseVal().getValue(); - float r = cg.getR().getBaseVal().getValue(); - //addCircle(cx,cy,r, di); - addRect(cx - r, cy - r, 2 * r, 2 * r, r, r, fillColour, strokeColour, strokeWidth); - } - else if (area instanceof SVGEllipseElement) - { - SVGEllipseElement cg = (SVGEllipseElement)area; - float cx = rendxoffset / 10 + cg.getCx().getBaseVal().getValue() + posx / 1000; - float cy = ((pageHeight / 10) - posy/1000) + cg.getCy().getBaseVal().getValue(); - float rx = cg.getRx().getBaseVal().getValue(); - float ry = cg.getRy().getBaseVal().getValue(); - //addEllipse(cx,cy,rx,ry, di); - addRect(cx - rx, cy - ry, 2 * rx, 2 * ry, rx, ry, fillColour, strokeColour, strokeWidth); - } - else if (area instanceof SVGPathElementImpl) - { - //addPath(((SVGPathElementImpl)area).pathElements, posx, posy, di); - } - else if (area instanceof SVGPolylineElementImpl) - { - addPolyline(((SVGPolylineElementImpl)area).points, posx, posy, fillColour, strokeColour, strokeWidth, false); - } - else if (area instanceof SVGPolygonElementImpl) - { - addPolyline(((SVGPolylineElementImpl)area).points, posx, posy, fillColour, strokeColour, strokeWidth, true); - } - else if (area instanceof SVGGElementImpl) - { - renderGArea((SVGGElementImpl)area, x, y); - } - else if(area instanceof SVGUseElementImpl) - { - SVGUseElementImpl ug = (SVGUseElementImpl) area; - String ref = ug.link; - // ref = ref.substring(1, ref.length()); - SVGElement graph = null; - graph = locateDef(ref, ug); - if (graph != null) { - // probably not the best way to do this, should be able - // to render without the style being set. - // SVGElement parent = graph.getGraphicParent(); - // graph.setParent(area); - // need to clip (if necessary) to the use area - // the style of the linked element is as if it was - // a direct descendant of the use element. - - // scale to the viewBox - - if (graph instanceof SVGSymbolElement) { - //currentStream.write("q\n"); - SVGSymbolElement symbol = (SVGSymbolElement) graph; - SVGRect view = symbol.getViewBox().getBaseVal(); - float usex = ug.getX().getBaseVal().getValue(); - float usey = ug.getY().getBaseVal().getValue(); - float usewidth = ug.getWidth().getBaseVal().getValue(); - float useheight = - ug.getHeight().getBaseVal().getValue(); - float scaleX; - float scaleY; - scaleX = usewidth / view.getWidth(); - scaleY = useheight / view.getHeight(); - //currentStream.write(usex + " " + usey + " m\n"); - //currentStream.write((usex + usewidth) + " " + - // usey + " l\n"); - //currentStream.write((usex + usewidth) + " " + - // (usey + useheight) + " l\n"); - //currentStream.write(usex + " " + - // (usey + useheight) + " l\n"); - //currentStream.write("h\n"); - //currentStream.write("W\n"); - //currentStream.write("n\n"); - //currentStream.write(scaleX + " 0 0 " + scaleY + - // " " + usex + " " + usey + " cm\n"); - renderSymbol(symbol, posx, posy); - //currentStream.write("Q\n"); - } else { - renderElement(graph, posx, posy); - } - // graph.setParent(parent); - } - else - { - MessageHandler.logln("Use Element: " + ref + " not found"); - } - } - else if (area instanceof SVGImageElementImpl) - { - SVGImageElementImpl ig = (SVGImageElementImpl)area; - renderImage(ig.link, ig.x, ig.y, ig.width, ig.height); - } - else if (area instanceof SVGSVGElement) - { - //currentStream.write("q\n"); - SVGSVGElement svgel = (SVGSVGElement) area; - float svgx = 0; - if (svgel.getX() != null) - svgx = svgel.getX().getBaseVal().getValue(); - float svgy = 0; - if (svgel.getY() != null) - svgy = svgel.getY().getBaseVal().getValue(); - //currentStream.write(1 + " 0 0 " + 1 + " " + svgx + " " + - // svgy + " cm\n"); - renderSVG(svgel, (int)(x + 1000 * svgx), - (int)(y + 1000 * svgy)); - //currentStream.write("Q\n"); - // } else if (area instanceof SVGSymbolElement) { - // 'symbol' element is not rendered (except by 'use') - } - else if (area instanceof SVGAElement) - { - SVGAElement ael = (SVGAElement)area; - org.w3c.dom.NodeList nl = ael.getChildNodes(); - for ( int count = 0 ; count < nl.getLength() ; count++ ) - { - org.w3c.dom.Node n = nl.item(count); - if ( n instanceof SVGElement ) - { - if ( n instanceof GraphicElement ) - { - SVGRect rect = ((GraphicElement)n).getBBox(); - if ( rect != null ) - { -/* currentAnnotList = this.pdfDoc.makeAnnotList(); - currentPage.setAnnotList(currentAnnotList); - String dest = linkSet.getDest(); - int linkType = linkSet.getLinkType(); - currentAnnotList.addLink( - this.pdfDoc.makeLink(lrect.getRectangle(), dest, linkType)); - currentAnnotList = null; -*/ } - } - renderElement((SVGElement)n, posx, posy); - } - } - } - else if ( area instanceof SVGSwitchElement ) - { - handleSwitchElement(posx, posy, (SVGSwitchElement)area); - } - // should be done with some cleanup code, so only - // required values are reset. - //currentStream.add("Q\n"); - } - - /** - * Adds an svg string to the output. - * This handles the escaping of special pdf chars and deals with - * whitespace. - */ - protected float addSVGStr(FontState fs, float currentX, String str, - boolean spacing) { - boolean inbetween = false; - boolean addedspace = false; - StringBuffer pdf = new StringBuffer(); - for (int i = 0; i < str.length(); i++) { - char ch = str.charAt(i); - switch (ch) - { - case '\t': - case ' ': - if (spacing) { - pdf = pdf.append(' '); - currentX += fs.width(' ') / 1000f; - } else { - if (inbetween && !addedspace) { - addedspace = true; - pdf = pdf.append(' '); - currentX += fs.width(' ') / 1000f; - } - } - break; - case '\n': - case '\r': - if (spacing) { - pdf = pdf.append(' '); - currentX += fs.width(' ') / 1000f; - } - break; - default: - addedspace = false; - pdf = pdf.append(ch); - currentX += fs.width(ch) / 1000f; - inbetween = true; - break; - } - } - currentStream.add(pdf.toString()); - return currentX; - } - - /** - * Locates a defined element in an svg document. - * Either gets the element defined by its "id" in the current - * SVGDocument, or if the uri reference is to an external - * document it loads the document and returns the element. - */ - protected SVGElement locateDef(String ref, SVGElement currentElement) { - int pos; - ref = ref.trim(); - pos = ref.indexOf("#"); - if (pos == 0) { - // local doc - Document doc = currentElement.getOwnerDocument(); - Element ele = - doc.getElementById(ref.substring(1, ref.length())); - if (ele instanceof SVGElement) { - return (SVGElement) ele; - } - } else if (pos != -1) { - String href = ref.substring(0, pos); - if (href.indexOf(":") == -1) { - href = "file:" + href; - } - try { - // this is really only to get a cached svg image - FopImage img = FopImageFactory.Make(href); - if (img instanceof SVGImage) { - SVGDocument doc = ((SVGImage) img).getSVGDocument(); - Element ele = doc.getElementById( - ref.substring(pos + 1, ref.length())); - if (ele instanceof SVGElement) { - return (SVGElement) ele; - } - } - } catch (Exception e) { - MessageHandler.errorln(e.toString()); - } - } - return null; - } - - /** - * This class is used to handle the rendering of svg text. - * This is so that it can deal with the recursive rendering - * of text markup, while keeping track of the state and position. - */ - class SVGTextRenderer { - FontState fs; - String transstr; - float currentX; - float currentY; - float baseX; - float baseY; - SVGMatrix matrix; - float x; - float y; - - SVGTextRenderer(FontState fontState, SVGTextElementImpl tg, - float x, float y) { - fs = fontState; - - //PDFNumber pdfNumber = new PDFNumber(); - SVGTransformList trans = tg.getTransform().getBaseVal(); - matrix = trans.consolidate().getMatrix(); - //transstr = (pdfNumber.doubleOut(matrix.getA()) + " " + - // pdfNumber.doubleOut(matrix.getB()) + " " + - // pdfNumber.doubleOut(matrix.getC()) + " " + - // pdfNumber.doubleOut(-matrix.getD()) + " "); - this.x = x; - this.y = y; - } - - void renderText(SVGTextElementImpl te) { - float xoffset = 0; - - if (te.anchor.getEnum() != TextAnchor.START) { - // This is a bit of a hack: The code below will update - // the current position, so all I have to do is to - // prevent that the code will write anything to the - // PCL stream... - currentStream.setDoOutput(false); - - _renderText (te, 0f, true); - - float width = currentX - te.x; - currentStream.setDoOutput(true); - - if (te.anchor.getEnum() == TextAnchor.END) { - xoffset = -width; - } else if (te.anchor.getEnum() == TextAnchor.MIDDLE) { - xoffset = -width/2; - } - } - - _renderText (te, xoffset, false); - } - - void _renderText(SVGTextElementImpl te, float xoffset, boolean getWidthOnly) - { - //DrawingInstruction di = applyStyle(te, te); - //if (di.fill) { - // if (di.stroke) { - // currentStream.write("2 Tr\n"); - // } else { - // currentStream.write("0 Tr\n"); - // } - //} else if (di.stroke) { - // currentStream.write("1 Tr\n"); - //} - updateFont(te, fs); - - float tx = te.x; - float ty = te.y; - currentX = x + tx + xoffset; - currentY = y + ty; - baseX = currentX; - baseY = currentY; - NodeList nodel = te.getChildNodes(); - // Vector list = te.textList; - for (int count = 0; count < nodel.getLength(); count++) { - Object o = nodel.item(count); - //applyStyle(te, te); - if ( o instanceof CharacterData ) - { - String str = ((CharacterData) o).getData(); - //currentStream.write(transstr + - // (currentX + matrix.getE()) + " " + - // (baseY + matrix.getF()) + " Tm " + "("); - boolean spacing = "preserve".equals(te.getXMLspace()); - //currentX = addSVGStr(fs, currentX, str, spacing); - //currentStream.write(") Tj\n"); - currentStream.add("\033&a" + (currentX + matrix.getE())*10 + "h" + (baseY + matrix.getF())*10 + "V"); - currentX = addSVGStr(fs, currentX, str, spacing); - } - else if ( o instanceof SVGTextPathElementImpl ) - { - SVGTextPathElementImpl tpg = (SVGTextPathElementImpl) o; - String ref = tpg.str; - SVGElement graph = null; - graph = locateDef(ref, tpg); - if (graph instanceof SVGPathElementImpl) { - // probably not the best way to do this, should be able - // to render without the style being set. - // GraphicImpl parent = graph.getGraphicParent(); - // graph.setParent(tpg); - // set text path?? - // how should this work - // graph.setParent(parent); - } - } else if (o instanceof SVGTRefElementImpl) { - SVGTRefElementImpl trg = (SVGTRefElementImpl) o; - String ref = trg.ref; - SVGElement element = locateDef(ref, trg); - if (element instanceof SVGTextElementImpl) { - // GraphicImpl parent = graph.getGraphicParent(); - // graph.setParent(trg); - SVGTextElementImpl tele = - (SVGTextElementImpl) element; - // the style should be from tele, but it needs to be placed as a child - // of trg to work - //di = applyStyle(trg, trg); - //if (di.fill) { - // if (di.stroke) { - // currentStream.write("2 Tr\n"); - // } else { - // currentStream.write("0 Tr\n"); - // } - //} else if (di.stroke) { - // currentStream.write("1 Tr\n"); - //} - boolean changed = false; - FontState oldfs = fs; - changed = updateFont(te, fs); - NodeList nl = tele.getChildNodes(); - boolean spacing = - "preserve".equals(trg.getXMLspace()); - renderTextNodes(spacing, nl, - trg.getX().getBaseVal(), - trg.getY().getBaseVal(), - trg.getDx().getBaseVal(), - trg.getDy().getBaseVal()); - - if (changed) { - fs = oldfs; - //currentStream.write("/" + - // fs.getFontName() + " " + - // fs.getFontSize() / 1000f + " Tf\n"); - } - // graph.setParent(parent); - } - } else if (o instanceof SVGTSpanElementImpl) { - SVGTSpanElementImpl tsg = (SVGTSpanElementImpl) o; - //applyStyle(tsg, tsg); - boolean changed = false; - FontState oldfs = fs; - changed = updateFont(tsg, fs); - boolean spacing = "preserve".equals(tsg.getXMLspace()); - renderTextNodes(spacing, tsg.getChildNodes(), - tsg.getX().getBaseVal(), - tsg.getY().getBaseVal(), - tsg.getDx().getBaseVal(), - tsg.getDy().getBaseVal()); - - // currentX += fs.width(' ') / 1000f; - if (changed) { - fs = oldfs; - //currentStream.write("/" + fs.getFontName() + - // " " + fs.getFontSize() / 1000f + " Tf\n"); - } - } else { - MessageHandler.errorln("Error: unknown text element " + o); - } - } - } - - void renderTextNodes(boolean spacing, NodeList nl, - SVGLengthList xlist, SVGLengthList ylist, - SVGLengthList dxlist, SVGLengthList dylist) { - boolean inbetween = false; - boolean addedspace = false; - int charPos = 0; - float xpos = currentX; - float ypos = currentY; - - for (int count = 0; count < nl.getLength(); count++) { - Node n = nl.item(count); - if (n instanceof CharacterData) { - //StringBuffer pdf = new StringBuffer(); - String str = ((CharacterData) n).getData(); - for (int i = 0; i < str.length(); i++) { - char ch = str.charAt(i); - xpos = currentX; - ypos = currentY; - if (ylist.getNumberOfItems() > charPos) { - ypos = baseY + (ylist.getItem(charPos)). - getValue(); - } - if (dylist.getNumberOfItems() > charPos) { - ypos = ypos + (dylist.getItem(charPos)). - getValue(); - } - if (xlist.getNumberOfItems() > charPos) { - xpos = baseX + (xlist.getItem(charPos)). - getValue(); - } - if (dxlist.getNumberOfItems() > charPos) { - xpos = xpos + (dxlist.getItem(charPos)). - getValue(); - } - - switch (ch) { - case '\t': - case ' ': - if (spacing) { - currentX = xpos + fs.width(' ') / - 1000f; - currentY = ypos; - charPos++; - } else { - if (inbetween && !addedspace) { - addedspace = true; - currentX = xpos + fs.width(' ') - / 1000f; - currentY = ypos; - charPos++; - } - } - break; - case '\n': - case '\r': - if (spacing) { - currentX = xpos + fs.width(' ') / - 1000f; - currentY = ypos; - charPos++; - } - break; - default: - addedspace = false; - //pdf = pdf.append(transstr + - // (xpos + matrix.getE()) + - // " " + (ypos + - // matrix.getF()) + " Tm " + - // "(" + ch + ") Tj\n"); - currentStream.add("\033&a" + (xpos + matrix.getE())*10 + "h" + (ypos + matrix.getF())*10 + "V" + ch); - currentX = xpos + fs.width(ch) / 1000f; - currentY = ypos; - charPos++; - inbetween = true; - break; - } - //currentStream.write(pdf.toString()); - } - } - } - } - - protected boolean updateFont(SVGStylable style, FontState fs) { - boolean changed = false; - String fontFamily = fs.getFontFamily(); - CSSValue sp = style.getPresentationAttribute("font-family"); - if (sp != null && - sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { - if (((CSSPrimitiveValue) sp).getPrimitiveType() == - CSSPrimitiveValue.CSS_STRING) { - fontFamily = sp.getCssText(); - } - } - if (!fontFamily.equals(fs.getFontFamily())) { - changed = true; - } - String fontStyle = fs.getFontStyle(); - sp = style.getPresentationAttribute("font-style"); - if (sp != null && - sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { - if (((CSSPrimitiveValue) sp).getPrimitiveType() == - CSSPrimitiveValue.CSS_STRING) { - fontStyle = sp.getCssText(); - } - } - if (!fontStyle.equals(fs.getFontStyle())) { - changed = true; - } - String fontWeight = fs.getFontWeight(); - sp = style.getPresentationAttribute("font-weight"); - if (sp != null && - sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { - if (((CSSPrimitiveValue) sp).getPrimitiveType() == - CSSPrimitiveValue.CSS_STRING) { - fontWeight = sp.getCssText(); - } - } - if (!fontWeight.equals(fs.getFontWeight())) { - changed = true; - } - float newSize = fs.getFontSize() / 1000f; - sp = style.getPresentationAttribute("font-size"); - if (sp != null && - sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { - // if(((CSSPrimitiveValue)sp).getPrimitiveType() == CSSPrimitiveValue.CSS_NUMBER) { - newSize = ((CSSPrimitiveValue) sp).getFloatValue( - CSSPrimitiveValue.CSS_PT); - // } - } - if (fs.getFontSize() / 1000f != newSize) { - changed = true; - } - if (changed) { - try { - fs = new FontState(fs.getFontInfo(), fontFamily, - fontStyle, fontWeight, (int)(newSize * 1000), - FontVariant.NORMAL); - } catch (Exception fope) { - } - this.fs = fs; - - //currentStream.write("/" + fs.getFontName() + " " + - // newSize + " Tf\n"); - renderer.setFont(fs.getFontName(), newSize * 1000); - } else { - if (!currentFontName.equals(fs.getFontName()) || - currentFontSize != fs.getFontSize()) { - // currentFontName = fs.getFontName(); - // currentFontSize = fs.getFontSize(); - //currentStream.write("/" + fs.getFontName() + " " + - // (fs.getFontSize() / 1000) + " Tf\n"); - renderer.setFont(fs.getFontName(), fs.getFontSize()); - } - } - return changed; - } - } -} diff --git a/src/org/apache/fop/render/pdf/PDFRenderer.java b/src/org/apache/fop/render/pdf/PDFRenderer.java index b524a7358..bd0d5761b 100644 --- a/src/org/apache/fop/render/pdf/PDFRenderer.java +++ b/src/org/apache/fop/render/pdf/PDFRenderer.java @@ -14,15 +14,26 @@ import org.apache.fop.image.FopImage; import org.apache.fop.apps.FOPException; import org.apache.fop.fo.properties.*; import org.apache.fop.layout.inline.*; +import org.apache.fop.datatypes.*; +import org.apache.fop.svg.*; import org.apache.fop.pdf.*; import org.apache.fop.layout.*; import org.apache.fop.image.*; import org.apache.fop.extensions.*; import org.apache.fop.datatypes.IDReferences; -import org.w3c.dom.svg.*; +import org.apache.batik.bridge.*; +import org.apache.batik.swing.svg.*; +import org.apache.batik.swing.gvt.*; +import org.apache.batik.gvt.*; +import org.apache.batik.gvt.renderer.*; +import org.apache.batik.gvt.filter.*; +import org.apache.batik.gvt.event.*; -import org.apache.fop.dom.svg.*; +import org.w3c.dom.*; +import org.w3c.dom.svg.*; +import org.w3c.dom.css.*; +import org.w3c.dom.svg.SVGLength; // Java import java.io.IOException; @@ -30,6 +41,12 @@ import java.io.OutputStream; import java.util.Enumeration; import java.util.Vector; import java.util.Hashtable; +import java.awt.geom.AffineTransform; +import java.awt.geom.Dimension2D; +import java.awt.Point; +import java.awt.RenderingHints; +import java.awt.font.FontRenderContext; +import java.awt.Dimension; /** * Renderer that renders areas to PDF @@ -295,6 +312,7 @@ public class PDFRenderer extends PrintRenderer { case Overflow.HIDDEN: break; } + area.getObject().render(this); currentStream.add("Q\n"); currentStream.add("BT\n"); @@ -356,20 +374,67 @@ public class PDFRenderer extends PrintRenderer { } // transform so that the coordinates (0,0) is from the top left // and positive is down and to the right. (0,0) is where the - // viewBox puts it. - currentStream.add(sx + " 0 0 " + sy + " " + xOffset / 1000f + - " " + yOffset / 1000f + " cm\n"); + // viewBox puts it. + currentStream.add(sx + " 0 0 " + sy + " " + + xOffset / 1000f + " " + yOffset / 1000f + " cm\n"); + - SVGRenderer svgRenderer = - new SVGRenderer(area.getFontState(), pdfDoc, + SVGDocument doc = area.getSVGDocument(); + + UserAgent userAgent = new MUserAgent(new AffineTransform()); + + GVTBuilder builder = new GVTBuilder(); + GraphicsNodeRenderContext rc = getRenderContext(); + BridgeContext ctx = new BridgeContext(userAgent, rc); + GraphicsNode root; + //System.out.println("creating PDFGraphics2D"); + PDFGraphics2D graphics = new PDFGraphics2D(true, area.getFontState(), pdfDoc, currentFontName, currentFontSize, currentXPosition, currentYPosition); - svgRenderer.renderSVG(svg, 0, 0); - currentStream.add(svgRenderer.getString()); + graphics.setGraphicContext(new org.apache.batik.ext.awt.g2d.GraphicContext()); + graphics.setRenderingHints(rc.getRenderingHints()); + try { + root = builder.build(ctx, doc); + root.paint(graphics, rc); + currentStream.add(graphics.getString()); + } catch(Exception e) { + e.printStackTrace(); + } currentStream.add("Q\n"); } + public GraphicsNodeRenderContext getRenderContext() { + GraphicsNodeRenderContext nodeRenderContext = null; + if (nodeRenderContext == null) { + RenderingHints hints = new RenderingHints(null); + hints.put(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + + hints.put(RenderingHints.KEY_INTERPOLATION, + RenderingHints.VALUE_INTERPOLATION_BILINEAR); + + FontRenderContext fontRenderContext = + new FontRenderContext(new AffineTransform(), true, true); + + TextPainter textPainter = new StrokingTextPainter(); + + GraphicsNodeRableFactory gnrFactory = + new ConcreteGraphicsNodeRableFactory(); + + nodeRenderContext = + new GraphicsNodeRenderContext(new AffineTransform(), + null, + hints, + fontRenderContext, + textPainter, + gnrFactory); + nodeRenderContext.setTextPainter(textPainter); + } + + return nodeRenderContext; + } + /** * render inline area to PDF * @@ -709,4 +774,118 @@ public class PDFRenderer extends PrintRenderer { renderOutline((Outline) e.nextElement()); } } + + protected class MUserAgent implements UserAgent { + AffineTransform currentTransform = null; + /** + * Creates a new SVGUserAgent. + */ + protected MUserAgent(AffineTransform at) { + currentTransform = at; + } + + /** + * Displays an error message. + */ + public void displayError(String message) { + System.err.println(message); + } + + /** + * Displays an error resulting from the specified Exception. + */ + public void displayError(Exception ex) { + ex.printStackTrace(System.err); + } + + /** + * Displays a message in the User Agent interface. + * The given message is typically displayed in a status bar. + */ + public void displayMessage(String message) { + System.out.println(message); + } + + /** + * Returns a customized the pixel to mm factor. + */ + public float getPixelToMM() { + return 0.264583333333333333333f; // 72 dpi + } + + /** + * Returns the language settings. + */ + public String getLanguages() { + return "en";//userLanguages; + } + + /** + * Returns the user stylesheet uri. + * @return null if no user style sheet was specified. + */ + public String getUserStyleSheetURI() { + return null;//userStyleSheetURI; + } + + /** + * Returns the class name of the XML parser. + */ + public String getXMLParserClassName() { + String parserClassName = + System.getProperty("org.xml.sax.parser"); + if (parserClassName == null) { + parserClassName = "org.apache.xerces.parsers.SAXParser"; + } + return parserClassName;//application.getXMLParserClassName(); + } + + /** + * Opens a link in a new component. + * @param doc The current document. + * @param uri The document URI. + */ + public void openLink(SVGAElement elt) + { + //application.openLink(uri); + } + + public Point getClientAreaLocationOnScreen() + { + return new Point(0, 0); + } + + public void setSVGCursor(java.awt.Cursor cursor) + { + } + + public AffineTransform getTransform() + { + return currentTransform; + } + + public Dimension2D getViewportSize() + { + return new Dimension(100, 100); + } + + public EventDispatcher getEventDispatcher() + { + return null; + } + + public boolean supportExtension(String str) + { + return false; + } + + public boolean hasFeature(String str) + { + return false; + } + + public void registerExtension(BridgeExtension be) + { + } + } } diff --git a/src/org/apache/fop/render/pdf/SVGRenderer.java b/src/org/apache/fop/render/pdf/SVGRenderer.java deleted file mode 100644 index f56d4a553..000000000 --- a/src/org/apache/fop/render/pdf/SVGRenderer.java +++ /dev/null @@ -1,2759 +0,0 @@ -/*-- $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.render.pdf; - -// FOP -import org.apache.fop.messaging.MessageHandler; -import org.apache.fop.image.ImageArea; -import org.apache.fop.image.FopImage; -import org.apache.fop.apps.FOPException; -import org.apache.fop.fo.properties.*; -import org.apache.fop.layout.*; -import org.apache.fop.datatypes.*; -import org.apache.fop.svg.PathPoint; -import org.apache.fop.pdf.*; -import org.apache.fop.layout.*; -import org.apache.fop.image.*; - -import org.w3c.dom.*; -import org.w3c.dom.svg.*; -import org.w3c.dom.css.*; -import org.w3c.dom.svg.SVGLength; - -import org.apache.fop.dom.svg.*; -import org.apache.fop.dom.svg.SVGRectElementImpl; -import org.apache.fop.dom.svg.SVGTextElementImpl; -import org.apache.fop.dom.svg.SVGLineElementImpl; -import org.apache.fop.dom.svg.SVGArea; - -// Java -import java.io.IOException; -import java.io.StringWriter; -import java.util.Enumeration; -import java.awt.Rectangle; -import java.util.Vector; -import java.util.Hashtable; - -/** - * Renderer that renders SVG to PDF - */ -public class SVGRenderer { - - /** the PDF Document being created */ - protected PDFDocument pdfDoc; - - protected FontState fontState; - - /** the /Resources object of the PDF document being created */ - // protected PDFResources pdfResources; - - /** the current stream to add PDF commands to */ - StringWriter currentStream = new StringWriter(); - - /** the current (internal) font name */ - protected String currentFontName; - - /** the current font size in millipoints */ - protected int currentFontSize; - - /** the current vertical position in millipoints from bottom */ - protected int currentYPosition = 0; - - /** the current horizontal position in millipoints from left */ - protected int currentXPosition = 0; - - /** the current colour for use in svg */ - private PDFColor currentColour = new PDFColor(0, 0, 0); - - // The toRadians() and toDegrees() methods of the Math class are not available in JDK 1.1, so reproduce here - /** - * Converts an angle measured in degrees to the equivalent angle - * measured in radians. - * - * @param angdeg an angle, in degrees - * @return the measurement of the angle <code>angdeg</code> - * in radians. - * @since JDK1.2 - */ - public static double toRadians(double angdeg) { - return angdeg / 180.0 * Math.PI; - } - /** - * Converts an angle measured in radians to the equivalent angle - * measured in degrees. - * - * @param angrad an angle, in radians - * @return the measurement of the angle <code>angrad</code> - * in degrees. - * @since JDK1.2 - */ - public static double toDegrees(double angrad) { - return angrad * 180.0 / Math.PI; - } - - /** - * create the SVG renderer - */ - public SVGRenderer(FontState fs, PDFDocument doc, String font, - int size, int xpos, int ypos) { - pdfDoc = doc; - currentFontName = font; - currentFontSize = size; - currentYPosition = ypos; - currentXPosition = xpos; - fontState = fs; - } - - public String getString() { - return currentStream.toString(); - } - - /** - * Renders an SVG element in an SVG document. - * This renders each of the child elements. - */ - protected void renderSVG(SVGSVGElement svg, int x, int y) { - NodeList nl = svg.getChildNodes(); - for (int count = 0; count < nl.getLength(); count++) { - Node n = nl.item(count); - if (n instanceof SVGElement) { - renderElement((SVGElement) n, x, y); - } - } - } - - public void renderGArea(SVGGElement area, int posx, int posy) { - NodeList nl = area.getChildNodes(); - for (int count = 0; count < nl.getLength(); count++) { - Node n = nl.item(count); - if (n instanceof SVGElement) { - renderElement((SVGElement) n, posx, posy); - } - } - } - - /** - * Handles the SVG switch element. - * The switch determines which of its child elements should be rendered - * according to the required extensions, required features and system language. - */ - protected void handleSwitchElement(int posx, int posy, - SVGSwitchElement ael) { - SVGStringList relist = ael.getRequiredExtensions(); - SVGStringList rflist = ael.getRequiredFeatures(); - SVGStringList sllist = ael.getSystemLanguage(); - NodeList nl = ael.getChildNodes(); - choices: - for (int count = 0; count < nl.getLength(); count++) { - org.w3c.dom.Node n = nl.item(count); - // only render the first child that has a valid - // test data - if (n instanceof GraphicElement) { - GraphicElement graphic = (GraphicElement) n; - SVGStringList grelist = graphic.getRequiredExtensions(); - // if null it evaluates to true - if (grelist != null) { - if (grelist.getNumberOfItems() == 0) { - if ((relist != null) && - relist.getNumberOfItems() != 0) { - continue choices; - } - } - for (int i = 0; i < grelist.getNumberOfItems(); i++) { - String str = (String) grelist.getItem(i); - if (relist == null) { - // use default extension set - // currently no extensions are supported - // if(!(str.equals("http:// ??"))) { - continue choices; - // } - } else { - } - } - } - SVGStringList grflist = graphic.getRequiredFeatures(); - if (grflist != null) { - if (grflist.getNumberOfItems() == 0) { - if ((rflist != null) && - rflist.getNumberOfItems() != 0) { - continue choices; - } - } - for (int i = 0; i < grflist.getNumberOfItems(); i++) { - String str = (String) grflist.getItem(i); - if (rflist == null) { - // use default feature set - if (!(str.equals("org.w3c.svg.static") || - str.equals("org.w3c.dom.svg.all"))) { - continue choices; - } - } else { - boolean found = false; - for (int j = 0; - j < rflist.getNumberOfItems(); j++) { - if (rflist.getItem(j).equals(str)) { - found = true; - break; - } - } - if (!found) - continue choices; - } - } - } - SVGStringList gsllist = graphic.getSystemLanguage(); - if (gsllist != null) { - if (gsllist.getNumberOfItems() == 0) { - if ((sllist != null) && - sllist.getNumberOfItems() != 0) { - continue choices; - } - } - for (int i = 0; i < gsllist.getNumberOfItems(); i++) { - String str = (String) gsllist.getItem(i); - if (sllist == null) { - // use default feature set - if (!(str.equals("en"))) { - continue choices; - } - } else { - boolean found = false; - for (int j = 0; - j < sllist.getNumberOfItems(); j++) { - if (sllist.getItem(j).equals(str)) { - found = true; - break; - } - } - if (!found) - continue choices; - } - } - } - renderElement((SVGElement) n, posx, posy); - // only render the first valid one - break; - } - } - } - - /** - * add a line to the current stream - * - * @param x1 the start x location in millipoints - * @param y1 the start y location in millipoints - * @param x2 the end x location in millipoints - * @param y2 the end y location in millipoints - * @param th the thickness in millipoints - * @param r the red component - * @param g the green component - * @param b the blue component - */ - protected void addLine(float x1, float y1, float x2, float y2, - DrawingInstruction di) { - String str; - PDFNumber pdfNumber = new PDFNumber(); - str = "" + pdfNumber.doubleOut(x1) + " " + pdfNumber.doubleOut(y1) + " m " + pdfNumber.doubleOut(x2) + " " + pdfNumber.doubleOut(y2) + " l"; - if (di != null && di.fill) - currentStream.write(str + " f\n"); // ?? - currentStream.write(str + " S\n"); - } - - /** - * Add an SVG circle - * Uses bezier curves to approximate the shape of a circle. - */ - protected void addCircle(float cx, float cy, float r, - DrawingInstruction di) { - PDFNumber pdfNumber = new PDFNumber(); - String str; - str = "" + pdfNumber.doubleOut(cx) + " " + pdfNumber.doubleOut((cy - r)) + " m\n" + "" + - pdfNumber.doubleOut((cx + 21 * r / 40f)) + " " + pdfNumber.doubleOut((cy - r)) + " " + - pdfNumber.doubleOut((cx + r)) + " " + pdfNumber.doubleOut((cy - 21 * r / 40f)) + " " + - pdfNumber.doubleOut((cx + r)) + " " + pdfNumber.doubleOut(cy) + " c\n" + "" + pdfNumber.doubleOut((cx + r)) + " " + - pdfNumber.doubleOut((cy + 21 * r / 40f)) + " " + pdfNumber.doubleOut((cx + 21 * r / 40f)) + - " " + pdfNumber.doubleOut((cy + r)) + " " + pdfNumber.doubleOut(cx) + " " + pdfNumber.doubleOut((cy + r)) + " c\n" + - "" + pdfNumber.doubleOut((cx - 21 * r / 40f)) + " " + pdfNumber.doubleOut((cy + r)) + " " + - pdfNumber.doubleOut(cx - r) + " " + pdfNumber.doubleOut(cy + 21 * r / 40f) + " " + - pdfNumber.doubleOut(cx - r) + " " + pdfNumber.doubleOut(cy) + " c\n" + "" + pdfNumber.doubleOut(cx - r) + " " + - pdfNumber.doubleOut(cy - 21 * r / 40f) + " " + pdfNumber.doubleOut(cx - 21 * r / 40f) + - " " + pdfNumber.doubleOut(cy - r) + " " + pdfNumber.doubleOut(cx) + " " + pdfNumber.doubleOut(cy - r) + " c\n"; - - currentStream.write(str); - doDrawing(di); - } - - /** - * Add an SVG ellips - * Uses bezier curves to approximate the shape of an ellipse. - */ - protected void addEllipse(float cx, float cy, float rx, float ry, - DrawingInstruction di) { - PDFNumber pdfNumber = new PDFNumber(); - String str; - str = "" + pdfNumber.doubleOut(cx) + " " + pdfNumber.doubleOut(cy - ry) + " m\n" + "" + - pdfNumber.doubleOut(cx + 21 * rx / 40f) + " " + pdfNumber.doubleOut(cy - ry) + " " + - pdfNumber.doubleOut(cx + rx) + " " + pdfNumber.doubleOut(cy - 21 * ry / 40f) + " " + - pdfNumber.doubleOut(cx + rx) + " " + pdfNumber.doubleOut(cy) + " c\n" + "" + pdfNumber.doubleOut(cx + rx) + " " + - pdfNumber.doubleOut(cy + 21 * ry / 40f) + " " + pdfNumber.doubleOut(cx + 21 * rx / 40f) + - " " + pdfNumber.doubleOut(cy + ry) + " " + pdfNumber.doubleOut(cx) + " " + pdfNumber.doubleOut(cy + ry) + - " c\n" + "" + pdfNumber.doubleOut(cx - 21 * rx / 40f) + " " + pdfNumber.doubleOut(cy + ry) + - " " + pdfNumber.doubleOut(cx - rx) + " " + pdfNumber.doubleOut(cy + 21 * ry / 40f) + " " + - pdfNumber.doubleOut(cx - rx) + " " + pdfNumber.doubleOut(cy) + " c\n" + "" + pdfNumber.doubleOut(cx - rx) + " " + - pdfNumber.doubleOut(cy - 21 * ry / 40f) + " " + pdfNumber.doubleOut(cx - 21 * rx / 40f) + - " " + pdfNumber.doubleOut(cy - ry) + " " + pdfNumber.doubleOut(cx) + " " + pdfNumber.doubleOut(cy - ry) + " c\n"; - currentStream.write(str); - doDrawing(di); - } - - /** - * add an SVG rectangle to the current stream. - * If there are curved edges then these are rendered using bezier curves. - * - * @param x the x position of left edge - * @param y the y position of top edge - * @param w the width - * @param h the height - * @param rx the x radius curved edge - * @param ry the y radius curved edge - */ - protected void addRect(float x, float y, float w, float h, - float rx, float ry, DrawingInstruction di) { - PDFNumber pdfNumber = new PDFNumber(); - String str = ""; - if (rx == 0.0 && ry == 0.0) { - str = "" + pdfNumber.doubleOut(x) + " " + pdfNumber.doubleOut(y) + " " + pdfNumber.doubleOut(w) + " " + pdfNumber.doubleOut(h) + " re\n"; - } else { - if (ry == 0.0) - ry = rx; - if (rx > w / 2.0f) - rx = w / 2.0f; - if (ry > h / 2.0f) - ry = h / 2.0f; - str = "" + pdfNumber.doubleOut(x + rx) + " " + pdfNumber.doubleOut(y) + " m\n"; - str += "" + pdfNumber.doubleOut(x + w - rx) + " " + pdfNumber.doubleOut(y) + " l\n"; - str += "" + pdfNumber.doubleOut(x + w - 19 * rx / 40) + " " + pdfNumber.doubleOut(y) + " " + - pdfNumber.doubleOut(x + w) + " " + pdfNumber.doubleOut(y + 19 * ry / 40) + " " + - pdfNumber.doubleOut(x + w) + " " + pdfNumber.doubleOut(y + ry) + " c\n"; - str += "" + pdfNumber.doubleOut(x + w) + " " + pdfNumber.doubleOut(y + h - ry) + " l\n"; - str += "" + pdfNumber.doubleOut(x + w) + " " + pdfNumber.doubleOut(y + h - 19 * ry / 40) + " " + - pdfNumber.doubleOut(x + w - 19 * rx / 40) + " " + pdfNumber.doubleOut(y + h) + " " + - pdfNumber.doubleOut(x + w - rx) + " " + pdfNumber.doubleOut(y + h) + " c\n"; - str += "" + pdfNumber.doubleOut(x + rx) + " " + pdfNumber.doubleOut(y + h) + " l\n"; - str += "" + pdfNumber.doubleOut(x + 19 * rx / 40) + " " + pdfNumber.doubleOut(y + h) + " " + pdfNumber.doubleOut(x) + - " " + pdfNumber.doubleOut(y + h - 19 * ry / 40) + " " + pdfNumber.doubleOut(x) + " " + - pdfNumber.doubleOut(y + h - ry) + " c\n"; - str += "" + pdfNumber.doubleOut(x) + " " + pdfNumber.doubleOut(y + ry) + " l\n"; - str += "" + pdfNumber.doubleOut(x) + " " + pdfNumber.doubleOut(y + 19 * ry / 40) + " " + - pdfNumber.doubleOut(x + 19 * rx / 40) + " " + pdfNumber.doubleOut(y) + " " + pdfNumber.doubleOut(x + rx) + - " " + pdfNumber.doubleOut(y) + " c\n"; - } - currentStream.write(str); - doDrawing(di); - } - - /** - * Adds an SVG path to the current streem. - * An SVG path is made up of a list of drawing instructions that are rendered - * out in order. - * Arcs don't work. - */ - protected void addPath(Vector points, int posx, int posy, - DrawingInstruction di) { - PDFNumber pdfNumber = new PDFNumber(); - SVGPathSegImpl pathmoveto = null; - float lastx = 0; - float lasty = 0; - float lastmovex = 0; - float lastmovey = 0; - float[] cxs; - float tempx; - float tempy; - float lastcx = 0; - float lastcy = 0; - for (Enumeration e = points.elements(); e.hasMoreElements();) { - SVGPathSegImpl pc = (SVGPathSegImpl) e.nextElement(); - float[] vals = pc.getValues(); - switch (pc.getPathSegType()) { - case SVGPathSeg.PATHSEG_MOVETO_ABS: - pathmoveto = pc; - lastx = vals[0]; - lasty = vals[1]; - currentStream.write(pdfNumber.doubleOut(lastx) + " " + pdfNumber.doubleOut(lasty) + " m\n"); - lastcx = 0; - lastcy = 0; - lastmovex = lastx; - lastmovey = lasty; - break; - case SVGPathSeg.PATHSEG_MOVETO_REL: - // the test cases seem to interprete this command differently - // it seems if there is an 'm' then the current path is closed - // then the point is move to a place relative to the point - // after doing the close - if (pathmoveto == null) { - lastx += vals[0]; - lasty += vals[1]; - pathmoveto = pc; - currentStream.write(pdfNumber.doubleOut(lastx) + " " + pdfNumber.doubleOut(lasty) + " m\n"); - } else { - lastx += vals[0]; - lasty += vals[1]; - pathmoveto = pc; - currentStream.write(pdfNumber.doubleOut(lastx) + " " + pdfNumber.doubleOut(lasty) + " l\n"); - } - lastmovex = lastx; - lastmovey = lasty; - lastcx = 0; - lastcy = 0; - break; - case SVGPathSeg.PATHSEG_LINETO_ABS: - lastx = vals[0]; - lasty = vals[1]; - currentStream.write(pdfNumber.doubleOut(lastx) + " " + pdfNumber.doubleOut(lasty) + " l\n"); - lastcx = 0; - lastcy = 0; - break; - case SVGPathSeg.PATHSEG_LINETO_REL: - lastx += vals[0]; - lasty += vals[1]; - currentStream.write(pdfNumber.doubleOut(lastx) + " " + pdfNumber.doubleOut(lasty) + " l\n"); - lastcx = 0; - lastcy = 0; - break; - case SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS: - lasty = vals[0]; - currentStream.write(pdfNumber.doubleOut(lastx) + " " + pdfNumber.doubleOut(lasty) + " l\n"); - lastcx = 0; - lastcy = 0; - break; - case SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL: - lasty += vals[0]; - currentStream.write(pdfNumber.doubleOut(lastx) + " " + pdfNumber.doubleOut(lasty) + " l\n"); - lastcx = 0; - lastcy = 0; - break; - case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS: - lastx = vals[0]; - currentStream.write(pdfNumber.doubleOut(lastx) + " " + pdfNumber.doubleOut(lasty) + " l\n"); - lastcx = 0; - lastcy = 0; - break; - case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL: - lastx += vals[0]; - currentStream.write(pdfNumber.doubleOut(lastx) + " " + pdfNumber.doubleOut(lasty) + " l\n"); - lastcx = 0; - lastcy = 0; - break; - case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS: - lastx = vals[4]; - lasty = vals[5]; - lastcx = vals[2]; - lastcy = vals[3]; - currentStream.write(pdfNumber.doubleOut(vals[0]) + " " + pdfNumber.doubleOut(vals[1]) + - " " + pdfNumber.doubleOut(vals[2]) + " " + pdfNumber.doubleOut(vals[3]) + " " + - pdfNumber.doubleOut(lastx) + " " + pdfNumber.doubleOut(lasty) + " c\n"); - break; - case SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL: - currentStream.write(pdfNumber.doubleOut(vals[0] + lastx) + " " + - pdfNumber.doubleOut(vals[1] + lasty) + " " + - pdfNumber.doubleOut(vals[2] + lastx) + " " + - pdfNumber.doubleOut(vals[3] + lasty) + " " + - pdfNumber.doubleOut(vals[4] + lastx) + " " + - pdfNumber.doubleOut(vals[5] + lasty) + " c\n"); - lastcx = vals[2] + lastx; - lastcy = vals[3] + lasty; - lastx += vals[4]; - lasty += vals[5]; - break; - case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: - if (lastcx == 0) { - lastcx = lastx; - } - if (lastcy == 0) { - lastcy = lasty; - } - lastcx = lastx + (lastx - lastcx); - lastcy = lasty + (lasty - lastcy); - lastx = vals[2]; - lasty = vals[3]; - currentStream.write(pdfNumber.doubleOut(lastcx) + " " + pdfNumber.doubleOut(lastcy) + " " + - pdfNumber.doubleOut(vals[0]) + " " + pdfNumber.doubleOut(vals[1]) + " " + - pdfNumber.doubleOut(lastx) + " " + pdfNumber.doubleOut(lasty) + " c\n"); - lastcx = vals[0]; - lastcy = vals[1]; - break; - case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL: - if (lastcx == 0) { - lastcx = lastx; - } - if (lastcy == 0) { - lastcy = lasty; - } - lastcx = lastx + (lastx - lastcx); - lastcy = lasty + (lasty - lastcy); - currentStream.write(pdfNumber.doubleOut(lastcx) + " " + pdfNumber.doubleOut(lastcy) + " " + - pdfNumber.doubleOut(vals[0] + lastx) + " " + - pdfNumber.doubleOut(vals[1] + lasty) + " " + - pdfNumber.doubleOut(vals[2] + lastx) + " " + - pdfNumber.doubleOut(vals[3] + lasty) + " c\n"); - lastcx = (vals[0] + lastx); - lastcy = (vals[1] + lasty); - lastx += vals[2]; - lasty += vals[3]; - break; - case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS: - if (lastcx == 0) { - lastcx = lastx; - } - if (lastcy == 0) { - lastcy = lasty; - } - tempx = lastx; - tempy = lasty; - lastx = vals[2]; - lasty = vals[3]; - currentStream.write(pdfNumber.doubleOut(vals[0]) + " " + pdfNumber.doubleOut(vals[1]) + " " + - pdfNumber.doubleOut(lastx) + " " + pdfNumber.doubleOut(lasty) + " y\n"); - cxs = calculateLastControl(tempx, tempy, lastx, lasty, -tempx + vals[0], -tempy + vals[1]); - lastcx = cxs[0]; - lastcy = cxs[1]; - break; - case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL: - if (lastcx == 0) { - lastcx = lastx; - } - if (lastcy == 0) { - lastcy = lasty; - } - currentStream.write(pdfNumber.doubleOut(vals[0] + lastx) + " " + pdfNumber.doubleOut(vals[1] + lasty) + " " + - pdfNumber.doubleOut(vals[2] + lastx) + " " + - pdfNumber.doubleOut(vals[3] + lasty) + " y\n"); - cxs = calculateLastControl(lastx, lasty, lastx + vals[2], lasty + vals[3], vals[0], vals[1]); - lastcx = cxs[0]; - lastcy = cxs[1]; - lastx += vals[2]; - lasty += vals[3]; - break; - case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: - if (lastcx == 0) { - lastcx = lastx; - } - if (lastcy == 0) { - lastcy = lasty; - } - tempx = lastx; - tempy = lasty; - lastcx = lastx + (lastx - lastcx); - lastcy = lasty + (lasty - lastcy); - lastx = vals[0]; - lasty = vals[1]; - currentStream.write(pdfNumber.doubleOut(lastcx) + " " + pdfNumber.doubleOut(lastcy) + " " + - pdfNumber.doubleOut(lastx) + " " + pdfNumber.doubleOut(lasty) + " y\n"); - cxs = calculateLastControl(tempx, tempy, lastx, lasty, -tempx + lastcx, -tempy + lastcy); - lastcx = cxs[0]; - lastcy = cxs[1]; - break; - case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: - if (lastcx == 0) { - lastcx = lastx; - } - if (lastcy == 0) { - lastcy = lasty; - } - lastcx = lastx + (lastx - lastcx); - lastcy = lasty + (lasty - lastcy); - currentStream.write(pdfNumber.doubleOut(lastcx) + " " + pdfNumber.doubleOut(lastcy) + " " + - pdfNumber.doubleOut(vals[0] + lastx) + " " + - pdfNumber.doubleOut(vals[1] + lasty) + " y\n"); - cxs = calculateLastControl(lastx, lasty, lastx + vals[0], lasty + vals[1], -lastx + lastcx, -lasty + lastcy); - lastcx = cxs[0]; - lastcy = cxs[1]; - lastx += vals[0]; - lasty += vals[1]; - break; - case SVGPathSeg.PATHSEG_ARC_ABS: - { - addArc(lastx, lasty, vals[0], vals[1], vals[2], (vals[3] != 0.0), (vals[4] != 0.0), - vals[5], vals[6]); - lastcx = 0; //?? - lastcy = 0; //?? - lastx = vals[5]; - lasty = vals[6]; - } - break; - case SVGPathSeg.PATHSEG_ARC_REL: - { - addArc(lastx, lasty, vals[0], vals[1], vals[2], (vals[3] != 0.0), (vals[4] != 0.0), - lastx + vals[5], lasty + vals[6]); - lastcx = 0; //?? - lastcy = 0; //?? - lastx += vals[5]; - lasty += vals[6]; - } - break; - case SVGPathSeg.PATHSEG_CLOSEPATH: - currentStream.write("h\n"); - pathmoveto = null; - lastx = lastmovex; - lasty = lastmovey; - break; - } - } - doDrawing(di); - } - - /** - * Calculate the last control point for a bezier curve. - * This is used to find the last control point for a curve where - * only the first control point is specified. - * The control point is a reflection of the first control point - * which results in an even smooth curve. The curve is symmetrical. - */ - protected float[] calculateLastControl(float x1, float y1, float x2, float y2, float relx, float rely) - { - float vals[] = new float[2]; - relx = -relx; - rely = -rely; - float dist = (float)Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); - float costheta = (float)(x2 - x1) / dist; - float sinetheta = (float)(y2 - y1) / dist; - float temp = relx; - relx = relx * costheta + rely * sinetheta; - rely = -temp * sinetheta + rely * costheta; - relx = -relx; - temp = relx; - relx = relx * costheta - rely * sinetheta; - rely = temp * sinetheta + rely * costheta; - vals[0] = x2 - relx; - vals[1] = y2 - rely; - return vals; - } - - protected void addArc(double startx, double starty, double rx, double ry, - double angle, - boolean largeArcFlag, - boolean sweepFlag, - double x, double y) - { - PDFNumber pdfNumber = new PDFNumber(); - if((startx == x) && (starty == y)) { - return; - } - // Ensure radii are valid - if (rx == 0 || ry == 0) { - currentStream.write(pdfNumber.doubleOut(x) + " " + pdfNumber.doubleOut(y) + " l\n"); - return; - } - if(rx < 0) - rx = -rx; - if(ry < 0) - ry = -ry; - // Convert angle from degrees to radians - angle = toRadians(angle % 360.0); - - double x0 = startx; - double y0 = starty; - // Compute the half distance between the current and the final point - double dx2 = (x0 - x) / 2.0; - double dy2 = (y0 - y) / 2.0; - - double cosAngle = Math.cos(angle); - double sinAngle = Math.sin(angle); - - // Step 1 : Compute (x1, y1) - double x1 = (cosAngle * dx2 + sinAngle * dy2); - double y1 = (-sinAngle * dx2 + cosAngle * dy2); - - double Prx = rx * rx; - double Pry = ry * ry; - double Px1 = x1 * x1; - double Py1 = y1 * y1; - // check that radii are large enough - double radiiCheck = Px1/Prx + Py1/Pry; - if (radiiCheck > 1) { - rx = Math.sqrt(radiiCheck) * rx; - ry = Math.sqrt(radiiCheck) * ry; - Prx = rx * rx; - Pry = ry * ry; - } - - // Step 2 : Compute (cx1, cy1) - double sign = (largeArcFlag == sweepFlag) ? -1 : 1; - double sq = ((Prx*Pry)-(Prx*Py1)-(Pry*Px1)) / ((Prx*Py1)+(Pry*Px1)); - sq = (sq < 0) ? 0 : sq; - double coef = (sign * Math.sqrt(sq)); - double cx1 = coef * ((rx * y1) / ry); - double cy1 = coef * -((ry * x1) / rx); - - // Step 3 : Compute (cx, cy) from (cx1, cy1) - double sx2 = (x0 + x) / 2.0; - double sy2 = (y0 + y) / 2.0; - double cx = sx2 + (cosAngle * cx1 - sinAngle * cy1); - double cy = sy2 + (sinAngle * cx1 + cosAngle * cy1); - - // Step 4 : Compute the angleStart (angle1) and the angleExtent (dangle) - double ux = (x1 - cx1) / rx; - double uy = (y1 - cy1) / ry; - double vx = (-x1 - cx1) / rx; - double vy = (-y1 - cy1) / ry; - double p, n; - // Compute the angle start - n = Math.sqrt((ux * ux) + (uy * uy)); - p = ux; // (1 * ux) + (0 * uy) - sign = (uy < 0) ? -1d : 1d; - double angleStart = toDegrees(sign * Math.acos(p / n)); - - // Compute the angle extent - n = Math.sqrt((ux * ux + uy * uy) * (vx * vx + vy * vy)); - p = ux * vx + uy * vy; - sign = (ux * vy - uy * vx < 0) ? -1d : 1d; - double angleExtent = toDegrees(sign * Math.acos(p / n)); - if(!sweepFlag && angleExtent > 0) { - angleExtent -= 360f; - } else if (sweepFlag && angleExtent < 0) { - angleExtent += 360f; - } - angleExtent %= 360f; - angleStart %= 360f; - - // arc attempt with lines -// System.out.println("start:" + angleStart + " : " + angleExtent + " sweep:" + sweepFlag); - double newx = startx; - double newy = starty; - double currentAngle = angleStart + angle; - boolean wrap = (sweepFlag ? angleStart > angleExtent : angleStart < angleExtent); - boolean wrapped = false; - -/* newx = Math.cos(toRadians(angle)) * rx * Math.cos(toRadians(currentAngle)) - Math.sin(toRadians(angle)) * ry * Math.sin(toRadians(currentAngle)) + cx; - newy = Math.sin(toRadians(angle)) * rx * Math.cos(toRadians(currentAngle)) + Math.cos(toRadians(angle)) * ry * Math.sin(toRadians(currentAngle)) + cy; - System.out.println("ox:" + startx + " oy: " + starty + " nx:" + newx + " ny:" + newy); - newx = Math.cos(toRadians(angle)) * rx * Math.cos(toRadians(angleStart + angleExtent)) - Math.sin(toRadians(angle)) * ry * Math.sin(toRadians(angleStart + angleExtent)) + cx; - newy = Math.sin(toRadians(angle)) * rx * Math.cos(toRadians(angleStart + angleExtent)) + Math.cos(toRadians(angle)) * ry * Math.sin(toRadians(angleStart + angleExtent)) + cy; - System.out.println("ox:" + x + " oy: " + y + " nx:" + newx + " ny:" + newy);*/ - - while(true) { - newx = Math.cos(toRadians(angle)) * rx * Math.cos(toRadians(currentAngle)) - Math.sin(toRadians(angle)) * ry * Math.sin(toRadians(currentAngle)) + cx; - newy = Math.sin(toRadians(angle)) * rx * Math.cos(toRadians(currentAngle)) + Math.cos(toRadians(angle)) * ry * Math.sin(toRadians(currentAngle)) + cy; - currentStream.write(pdfNumber.doubleOut(newx) + " " + pdfNumber.doubleOut(newy) + " l\n"); - currentAngle = (currentAngle + (sweepFlag ? 1 : -1) * 5.0); - if((sweepFlag && currentAngle > (angleStart + angleExtent)) || (!sweepFlag && currentAngle < (angleStart + angleExtent))) { - break; - } - } - currentStream.write(pdfNumber.doubleOut(x) + " " + pdfNumber.doubleOut(y) + " l\n"); - } - - /** - * Adds an SVG polyline or polygon. - * A polygon is merely a closed polyline. - * This is made up from a set of points that straight lines are drawn between. - */ - protected void addPolyline(Vector points, DrawingInstruction di, - boolean close) { - PDFNumber pdfNumber = new PDFNumber(); - PathPoint pc; - float lastx = 0; - float lasty = 0; - Enumeration e = points.elements(); - if (e.hasMoreElements()) { - pc = (PathPoint) e.nextElement(); - lastx = pc.x; - lasty = pc.y; - currentStream.write(pdfNumber.doubleOut(lastx) + " " + pdfNumber.doubleOut(lasty) + " m\n"); - } - while (e.hasMoreElements()) { - pc = (PathPoint) e.nextElement(); - lastx = pc.x; - lasty = pc.y; - currentStream.write(pdfNumber.doubleOut(lastx) + " " + pdfNumber.doubleOut(lasty) + " l\n"); - } - if (close) - currentStream.write("h\n"); - doDrawing(di); - } - - /** - * Writes the drawing instruction out to the current stream - * depending on what type of drawing is required. - */ - protected void doDrawing(DrawingInstruction di) { - if (di == null) { - currentStream.write("S\n"); - } else { - if (di.fill) { - if (di.stroke) { - if (!di.nonzero) - currentStream.write("B*\n"); - else - currentStream.write("B\n"); - } else { - if (!di.nonzero) - currentStream.write("f*\n"); - else - currentStream.write("f\n"); - } - } else { - // if(di.stroke) - currentStream.write("S\n"); - } - } - } - - /** - * Renders an svg image to the current stream. - * This uses the FopImageFactory to load the image and then renders it. - */ - public void renderImage(String href, float x, float y, float width, - float height) { - try { - if (href.indexOf(":") == -1) { - href = "file:" + href; - } - FopImage img = FopImageFactory.Make(href); - PDFNumber pdfNumber = new PDFNumber(); - if (img instanceof SVGImage) { - SVGSVGElement svg = - ((SVGImage) img).getSVGDocument().getRootElement(); - currentStream.write("q\n" + pdfNumber.doubleOut(width / - svg.getWidth().getBaseVal().getValue()) + " 0 0 " + - pdfNumber.doubleOut(height / - svg.getHeight().getBaseVal().getValue()) + " 0 0 cm\n"); - renderSVG(svg, (int) x * 1000, (int) y * 1000); - currentStream.write("Q\n"); - // renderSVG(svg); - } else if (img != null) { - int xObjectNum = this.pdfDoc.addImage(img); - currentStream.write("q\n1 0 0 -1 0 " + - pdfNumber.doubleOut(2 * y + height) + " cm\n" + pdfNumber.doubleOut(width) + " 0 0 " + - pdfNumber.doubleOut(height) + " " + pdfNumber.doubleOut(x) + " " + pdfNumber.doubleOut(y) + " cm\n" + "/Im" + - xObjectNum + " Do\nQ\n"); - // img.close(); - } - } catch (Exception e) { - MessageHandler.errorln("could not add image to SVG: " + href); - } - } - - /** - * A symbol has a viewbox and preserve aspect ratio. - */ - protected void renderSymbol(SVGSymbolElement symbol, int x, int y) { - NodeList nl = symbol.getChildNodes(); - for (int count = 0; count < nl.getLength(); count++) { - Node n = nl.item(count); - if (n instanceof SVGElement) { - renderElement((SVGElement) n, x, y); - } - } - } - - /** - * Handles the construction of an SVG gradient. - * This gets the gradient element and creates the pdf info - * in the pdf document. - * The type of gradient is determined by what class the gradient element is. - */ - protected void handleGradient(String sp, DrawingInstruction di, - boolean fill, SVGElement area) { - // should be a url to a gradient - String url = (String) sp; - if (url.startsWith("url(")) { - String address; - int b1 = url.indexOf("("); - int b2 = url.indexOf(")"); - address = url.substring(b1 + 1, b2); - SVGElement gi = null; - gi = locateDef(address, area); - if (gi instanceof SVGLinearGradientElement) { - SVGLinearGradientElement linear = - (SVGLinearGradientElement) gi; - handleLinearGradient(linear, di, fill, area); - } else if (gi instanceof SVGRadialGradientElement) { - SVGRadialGradientElement radial = - (SVGRadialGradientElement) gi; - handleRadialGradient(radial, di, fill, area); - } else if (gi instanceof SVGPatternElement) { - SVGPatternElement pattern = (SVGPatternElement) gi; - handlePattern(pattern, di, fill, area); - } else { - MessageHandler.errorln("WARNING Invalid fill reference :" + - gi + ":" + address); - } - } - } - - protected void handlePattern(SVGPatternElement pattern, - DrawingInstruction di, boolean fill, SVGElement area) { - SVGAnimatedLength x, y, width, height; - short pattUnits = SVGUnitTypes.SVG_UNIT_TYPE_UNKNOWN; - NodeList stops = null; - x = pattern.getX(); - y = pattern.getY(); - width = pattern.getWidth(); - height = pattern.getHeight(); - NodeList nl = pattern.getChildNodes(); - SVGPatternElement ref = (SVGPatternElement) locateDef( - pattern.getHref().getBaseVal(), pattern); - while (ref != null) { - if (x == null) { - x = ref.getX(); - pattUnits = ref.getPatternUnits().getBaseVal(); - } - if (y == null) { - y = ref.getY(); - } - if (width == null) { - width = ref.getWidth(); - } - if (height == null) { - height = ref.getHeight(); - } - if (nl.getLength() == 0) { - nl = ref.getChildNodes(); - } - ref = (SVGPatternElement) locateDef( - ref.getHref().getBaseVal(), ref); - } - if (x == null) { - SVGLength length = new SVGLengthImpl(); - length.newValueSpecifiedUnits( - SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 0); - x = new SVGAnimatedLengthImpl(length); - } - if (y == null) { - SVGLength length = new SVGLengthImpl(); - length.newValueSpecifiedUnits( - SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 0); - y = new SVGAnimatedLengthImpl(length); - } - if (width == null) { - SVGLength length = new SVGLengthImpl(); - length.newValueSpecifiedUnits( - SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 1); - width = new SVGAnimatedLengthImpl(length); - } - if (height == null) { - SVGLength length = new SVGLengthImpl(); - length.newValueSpecifiedUnits( - SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 1); - height = new SVGAnimatedLengthImpl(length); - } - - StringWriter realStream = currentStream; - currentStream = new StringWriter(); - - currentStream.write("q\n"); - // this makes the pattern the right way up, since it is outside the original - // transform around the whole svg document - currentStream.write("1 0 0 -1 0 " + - height.getBaseVal().getValue() + " cm\n"); - for (int count = 0; count < nl.getLength(); count++) { - Node n = nl.item(count); - if (n instanceof SVGElement) { - renderElement((SVGElement) n, 0, 0); - } - } - currentStream.write("Q\n"); - - double xval = x.getBaseVal().getValue() + currentXPosition / 1000f; - double yval = -y.getBaseVal().getValue() + currentYPosition / 1000f; - if (area instanceof GraphicElement) { - SVGRect bbox = ((GraphicElement) area).getBBox(); - if (bbox != null) { - // xval += bbox.getX(); - // yval -= bbox.getY(); - } - } - double widthval = width.getBaseVal().getValue(); - double heightval = height.getBaseVal().getValue(); - Vector bbox = new Vector(); - bbox.addElement(new Double(0)); - bbox.addElement(new Double(0)); - bbox.addElement(new Double(widthval)); - bbox.addElement(new Double(heightval)); - Vector translate = new Vector(); - // combine with pattern transform - translate.addElement(new Double(1)); - translate.addElement(new Double(0)); - translate.addElement(new Double(0)); - translate.addElement(new Double(1)); - translate.addElement(new Double(xval)); - translate.addElement(new Double(yval)); - // need to handle PDFResources - PDFPattern myPat = - this.pdfDoc.makePattern(1, null, 1, 1, bbox, widthval, - heightval, translate, null, currentStream.getBuffer()); - - currentStream = realStream; - currentStream.write(myPat.getColorSpaceOut(fill)); - if (fill) - di.fill = true; - else - di.stroke = true; - } - - protected void handleLinearGradient( - SVGLinearGradientElement linear, DrawingInstruction di, - boolean fill, SVGElement area) { - // first get all the gradient values - // if values not present follow the href - // the gradient units will be where the vals are specified - // the spread method will be where there are stop elements - SVGAnimatedLength ax1, ax2, ay1, ay2; - short spread = SVGGradientElement.SVG_SPREADMETHOD_UNKNOWN; - short gradUnits = SVGUnitTypes.SVG_UNIT_TYPE_UNKNOWN; - NodeList stops = null; - ax1 = linear.getX1(); - ax2 = linear.getX2(); - ay1 = linear.getY1(); - ay2 = linear.getY2(); - stops = linear.getChildNodes(); - SVGLinearGradientElement ref = (SVGLinearGradientElement) locateDef( - linear.getHref().getBaseVal(), linear); - while (ref != null) { - if (ax1 == null) { - ax1 = ref.getX1(); - gradUnits = ref.getGradientUnits().getBaseVal(); - } - if (ax2 == null) { - ax2 = ref.getX2(); - } - if (ay1 == null) { - ay1 = ref.getY1(); - } - if (ay2 == null) { - ay2 = ref.getY2(); - } - if (stops.getLength() == 0) { - stops = ref.getChildNodes(); - } - ref = (SVGLinearGradientElement) locateDef( - ref.getHref().getBaseVal(), ref); - } - if (ax1 == null) { - SVGLength length = new SVGLengthImpl(); - length.newValueSpecifiedUnits( - SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 0); - ax1 = new SVGAnimatedLengthImpl(length); - } - if (ax2 == null) { - // if x2 is not specified then it should be 100% - SVGLength length = new SVGLengthImpl(); - length.newValueSpecifiedUnits( - SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 1); - ax2 = new SVGAnimatedLengthImpl(length); - } - if (ay1 == null) { - SVGLength length = new SVGLengthImpl(); - length.newValueSpecifiedUnits( - SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 0); - ay1 = new SVGAnimatedLengthImpl(length); - } - if (ay2 == null) { - SVGLength length = new SVGLengthImpl(); - length.newValueSpecifiedUnits( - SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 0); - ay2 = new SVGAnimatedLengthImpl(length); - } - SVGAnimatedTransformList an = linear.getGradientTransform(); - SVGMatrix transform = null; - if(an != null) - transform = an.getBaseVal().consolidate().getMatrix(); - Vector theCoords = null; - if (gradUnits == SVGUnitTypes.SVG_UNIT_TYPE_UNKNOWN) - gradUnits = linear.getGradientUnits().getBaseVal(); - // spread: pad (normal), reflect, repeat - spread = linear.getSpreadMethod().getBaseVal(); - if (gradUnits == SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE) { - if (area instanceof SVGTransformable) { - SVGTransformable tf = (SVGTransformable) area; - double x1, y1, x2, y2; - x1 = ax1.getBaseVal().getValue(); - y1 = -ay1.getBaseVal().getValue(); - x2 = ax2.getBaseVal().getValue(); - y2 = -ay2.getBaseVal().getValue(); - SVGMatrix matrix = tf.getScreenCTM(); - if(transform != null) - matrix = matrix.multiply(transform); - double oldx = x1; - x1 = matrix.getA() * x1 + matrix.getC() * y1 + - matrix.getE(); - y1 = matrix.getB() * oldx + matrix.getD() * y1 - - matrix.getF(); - oldx = x2; - x2 = matrix.getA() * x2 + matrix.getC() * y2 + - matrix.getE(); - y2 = matrix.getB() * oldx + matrix.getD() * y2 - - matrix.getF(); - theCoords = new Vector(); - if (spread == SVGGradientElement.SVG_SPREADMETHOD_REFLECT) { - } else if (spread == - SVGGradientElement.SVG_SPREADMETHOD_REFLECT) { - } else { - theCoords.addElement( - new Double(currentXPosition / 1000f + x1)); - theCoords.addElement( - new Double(currentYPosition / 1000f + y1)); - theCoords.addElement( - new Double(currentXPosition / 1000f + x2)); - theCoords.addElement( - new Double(currentYPosition / 1000f + y2)); - } - } - } else if (area instanceof GraphicElement) { - SVGRect rect = ((GraphicElement) area).getBBox(); - if (rect != null) { - theCoords = new Vector(); - SVGLength val; - val = ax1.getBaseVal(); - if (val.getUnitType() == - SVGLength.SVG_LENGTHTYPE_PERCENTAGE || gradUnits == - SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { - theCoords.addElement( - new Double(currentXPosition / 1000f + - rect.getX() + - val.getValue() * rect.getWidth())); - } else { - theCoords.addElement( - new Double(currentXPosition / 1000f + - val.getValue())); - } - val = ay1.getBaseVal(); - if (val.getUnitType() == - SVGLength.SVG_LENGTHTYPE_PERCENTAGE || gradUnits == - SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { - theCoords.addElement( - new Double(currentYPosition / 1000f - - rect.getY() - - val.getValue() * rect.getHeight())); - } else { - theCoords.addElement( - new Double(currentYPosition / 1000f - - val.getValue())); - } - val = ax2.getBaseVal(); - if (val.getUnitType() == - SVGLength.SVG_LENGTHTYPE_PERCENTAGE || gradUnits == - SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { - theCoords.addElement( - new Double(currentXPosition / 1000f + - rect.getX() + - val.getValue() * rect.getWidth())); - } else { - theCoords.addElement( - new Double(currentXPosition / 1000f + - val.getValue())); - } - val = ay2.getBaseVal(); - if (val.getUnitType() == - SVGLength.SVG_LENGTHTYPE_PERCENTAGE || gradUnits == - SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { - theCoords.addElement( - new Double(currentYPosition / 1000f - - rect.getY() - - val.getValue() * rect.getHeight())); - } else { - theCoords.addElement( - new Double(currentYPosition / 1000f - - val.getValue())); - } - } - } - if (theCoords == null) { - theCoords = new Vector(); - theCoords.addElement( new Double(currentXPosition / 1000f + - ax1.getBaseVal().getValue())); - theCoords.addElement( new Double(currentYPosition / 1000f - - ay1.getBaseVal().getValue())); - theCoords.addElement( new Double(currentXPosition / 1000f + - ax2.getBaseVal().getValue())); - theCoords.addElement( new Double(currentYPosition / 1000f - - ay2.getBaseVal().getValue())); - } - - Vector theExtend = new Vector(); - theExtend.addElement(new Boolean(true)); - theExtend.addElement(new Boolean(true)); - - Vector theDomain = new Vector(); - theDomain.addElement(new Double(0)); - theDomain.addElement(new Double(1)); - - Vector theEncode = new Vector(); - theEncode.addElement(new Double(0)); - theEncode.addElement(new Double(1)); - theEncode.addElement(new Double(0)); - theEncode.addElement(new Double(1)); - - Vector theBounds = new Vector(); - theBounds.addElement(new Double(0)); - theBounds.addElement(new Double(1)); - - Vector theFunctions = new Vector(); - - NodeList nl = stops; - Vector someColors = new Vector(); - float lastoffset = 0; - Vector lastVector = null; - SVGStopElementImpl stop; - if (nl.getLength() == 0) { - // the color should be "none" - if (fill) - di.fill = false; - else - di.stroke = false; - return; - } else if (nl.getLength() == 1) { - stop = (SVGStopElementImpl) nl.item(0); - CSSValue cv = stop.getPresentationAttribute("stop-color"); - if (cv == null) { - // maybe using color - cv = stop.getPresentationAttribute("color"); - } - if (cv == null) { - // problems - MessageHandler.errorln("no stop-color or color in stop element"); - return; - } - PDFColor color = new PDFColor(0, 0, 0); - if (cv != null && - cv.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { - if (((CSSPrimitiveValue) cv).getPrimitiveType() == - CSSPrimitiveValue.CSS_RGBCOLOR) { - RGBColor col = - ((CSSPrimitiveValue) cv).getRGBColorValue(); - CSSPrimitiveValue val; - val = col.getRed(); - float red = val.getFloatValue( - CSSPrimitiveValue.CSS_NUMBER); - val = col.getGreen(); - float green = val.getFloatValue( - CSSPrimitiveValue.CSS_NUMBER); - val = col.getBlue(); - float blue = val.getFloatValue( - CSSPrimitiveValue.CSS_NUMBER); - color = new PDFColor(red, green, blue); - } - } - currentStream.write(color.getColorSpaceOut(fill)); - if (fill) - di.fill = true; - else - di.stroke = true; - return; - } - for (int count = 0; count < nl.getLength(); count++) { - stop = (SVGStopElementImpl) nl.item(count); - CSSValue cv = stop.getPresentationAttribute("stop-color"); - if (cv == null) { - // maybe using color - cv = stop.getPresentationAttribute("color"); - } - if (cv == null) { - // problems - MessageHandler.errorln("no stop-color or color in stop element"); - continue; - } - PDFColor color = new PDFColor(0, 0, 0); - if (cv != null && - cv.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { - if (((CSSPrimitiveValue) cv).getPrimitiveType() == - CSSPrimitiveValue.CSS_RGBCOLOR) { - RGBColor col = - ((CSSPrimitiveValue) cv).getRGBColorValue(); - CSSPrimitiveValue val; - val = col.getRed(); - float red = val.getFloatValue( - CSSPrimitiveValue.CSS_NUMBER); - val = col.getGreen(); - float green = val.getFloatValue( - CSSPrimitiveValue.CSS_NUMBER); - val = col.getBlue(); - float blue = val.getFloatValue( - CSSPrimitiveValue.CSS_NUMBER); - color = new PDFColor(red, green, blue); - currentColour = color; - } - } - float offset = stop.getOffset().getBaseVal(); - Vector colVector = color.getVector(); - // create bounds from last to offset - if (lastVector != null) { - Vector theCzero = lastVector; - Vector theCone = colVector; - PDFFunction myfunc = - this.pdfDoc.makeFunction(2, theDomain, null, - theCzero, theCone, 1.0); - theFunctions.addElement(myfunc); - } - lastoffset = offset; - lastVector = colVector; - someColors.addElement(color); - } - ColorSpace aColorSpace = new ColorSpace(ColorSpace.DEVICE_RGB); - /* PDFFunction myfunky = this.pdfDoc.makeFunction(3, - theDomain, null, - theFunctions, null, - theEncode); - PDFShading myShad = null; - myShad = this.pdfDoc.makeShading( - 2, aColorSpace, - null, null, false, - theCoords, null, myfunky,theExtend); - PDFPattern myPat = this.pdfDoc.makePattern(2, myShad, null, null, null);*/ - PDFPattern myPat = this.pdfDoc.createGradient(false, aColorSpace, - someColors, null, theCoords); - currentStream.write(myPat.getColorSpaceOut(fill)); - if (fill) - di.fill = true; - else - di.stroke = true; - } - - protected void handleRadialGradient( - SVGRadialGradientElement radial, DrawingInstruction di, - boolean fill, SVGElement area) { - // first get all the gradient values - // if values not present follow the href - // the gradient units will be where the vals are specified - SVGAnimatedLength acx, acy, ar, afx, afy; - short gradUnits = radial.getGradientUnits().getBaseVal(); - NodeList stops = null; - acx = radial.getCx(); - acy = radial.getCy(); - ar = radial.getR(); - afx = radial.getFx(); - afy = radial.getFy(); - stops = radial.getChildNodes(); - SVGRadialGradientElement ref = (SVGRadialGradientElement) locateDef( - radial.getHref().getBaseVal(), radial); - while (ref != null) { - if (acx == null) { - acx = ref.getCx(); - gradUnits = ref.getGradientUnits().getBaseVal(); - } - if (acy == null) { - acy = ref.getCy(); - } - if (ar == null) { - ar = ref.getR(); - } - if (afx == null) { - afx = ref.getFx(); - } - if (afy == null) { - afy = ref.getFy(); - } - if (stops.getLength() == 0) { - stops = ref.getChildNodes(); - } - ref = (SVGRadialGradientElement) locateDef( - ref.getHref().getBaseVal(), ref); - } - if (acx == null) { - SVGLength length = new SVGLengthImpl(); - length.newValueSpecifiedUnits( - SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 0.5f); - acx = new SVGAnimatedLengthImpl(length); - } - if (acy == null) { - SVGLength length = new SVGLengthImpl(); - length.newValueSpecifiedUnits( - SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 0.5f); - acy = new SVGAnimatedLengthImpl(length); - } - if (ar == null) { - SVGLength length = new SVGLengthImpl(); - length.newValueSpecifiedUnits( - SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 1); - ar = new SVGAnimatedLengthImpl(length); - } - if (afx == null) { - SVGLength length = new SVGLengthImpl(); - length.newValueSpecifiedUnits( - SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 0.5f); - afx = new SVGAnimatedLengthImpl(length); - } - if (afy == null) { - SVGLength length = new SVGLengthImpl(); - length.newValueSpecifiedUnits( - SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 0.5f); - afy = new SVGAnimatedLengthImpl(length); - } - ColorSpace aColorSpace = new ColorSpace(ColorSpace.DEVICE_RGB); - org.w3c.dom.NodeList nl = stops; - SVGStopElementImpl stop; - if (nl.getLength() == 0) { - // the color should be "none" - if (fill) - di.fill = false; - else - di.stroke = false; - return; - } else if (nl.getLength() == 1) { - stop = (SVGStopElementImpl) nl.item(0); - CSSValue cv = stop.getPresentationAttribute("stop-color"); - if (cv == null) { - // maybe using color - cv = stop.getPresentationAttribute("color"); - } - if (cv == null) { - // problems - MessageHandler.errorln("no stop-color or color in stop element"); - return; - } - PDFColor color = new PDFColor(0, 0, 0); - if (cv != null && - cv.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { - if (((CSSPrimitiveValue) cv).getPrimitiveType() == - CSSPrimitiveValue.CSS_RGBCOLOR) { - RGBColor col = - ((CSSPrimitiveValue) cv).getRGBColorValue(); - CSSPrimitiveValue val; - val = col.getRed(); - float red = val.getFloatValue( - CSSPrimitiveValue.CSS_NUMBER); - val = col.getGreen(); - float green = val.getFloatValue( - CSSPrimitiveValue.CSS_NUMBER); - val = col.getBlue(); - float blue = val.getFloatValue( - CSSPrimitiveValue.CSS_NUMBER); - color = new PDFColor(red, green, blue); - } - } - currentStream.write(color.getColorSpaceOut(fill)); - if (fill) - di.fill = true; - else - di.stroke = true; - return; - } - Hashtable table = null; - Vector someColors = new Vector(); - Vector theCoords = null; - Vector theBounds = new Vector(); - // the coords should be relative to the current object - // check value types, eg. % - if (gradUnits == SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE) { - if (area instanceof SVGTransformable) { - SVGTransformable tf = (SVGTransformable) area; - double x1, y1, x2, y2; - x1 = acx.getBaseVal().getValue(); - y1 = -acy.getBaseVal().getValue(); - x2 = afx.getBaseVal().getValue(); - y2 = -afy.getBaseVal().getValue(); - SVGMatrix matrix = tf.getScreenCTM(); - double oldx = x1; - x1 = matrix.getA() * x1 + matrix.getB() * y1 + - matrix.getE(); - y1 = matrix.getC() * oldx + matrix.getD() * y1 + - matrix.getF(); - oldx = x2; - x2 = matrix.getA() * x2 + matrix.getB() * y2 + - matrix.getE(); - y2 = matrix.getC() * oldx + matrix.getD() * y2 + - matrix.getF(); - theCoords = new Vector(); - // if(spread == SVGGradientElement.SVG_SPREADMETHOD_REFLECT) { - // } else if(spread== SVGGradientElement.SVG_SPREADMETHOD_REFLECT) { - // } else { - theCoords.addElement( - new Double(currentXPosition / 1000f + x1)); - // the y val needs to be adjust by 2 * R * rotation - // depending on if this value is from an x or y coord - // before transformation - theCoords.addElement( - new Double(currentYPosition / 1000f - y1 + - (matrix.getC() - matrix.getD()) * 2 * - ar.getBaseVal().getValue())); - theCoords.addElement(new Double(0)); - theCoords.addElement( - new Double(currentXPosition / 1000f + x2)); - theCoords.addElement( - new Double(currentYPosition / 1000f - y2 + - (matrix.getC() - matrix.getD()) * 2 * - ar.getBaseVal().getValue())); - theCoords.addElement( - new Double(ar.getBaseVal().getValue())); - // } - } - } else if (gradUnits == - SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX && - area instanceof GraphicElement) { - SVGRect rect = ((GraphicElement) area).getBBox(); - if (rect != null) { - theCoords = new Vector(); - SVGLength val; - val = acx.getBaseVal(); - if (val.getUnitType() == - SVGLength.SVG_LENGTHTYPE_PERCENTAGE || gradUnits == - SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { - theCoords.addElement( - new Double(currentXPosition / 1000f + - rect.getX() + - val.getValue() * rect.getWidth())); - } else { - theCoords.addElement( - new Double(currentXPosition / 1000f + - val.getValue())); - } - val = acy.getBaseVal(); - if (val.getUnitType() == - SVGLength.SVG_LENGTHTYPE_PERCENTAGE || gradUnits == - SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { - theCoords.addElement( - new Double(currentYPosition / 1000f - - rect.getY() - - val.getValue() * rect.getHeight())); - } else { - theCoords.addElement( - new Double(currentYPosition / 1000f - - val.getValue())); - } - theCoords.addElement(new Double(0)); - val = afx.getBaseVal(); - if (val.getUnitType() == - SVGLength.SVG_LENGTHTYPE_PERCENTAGE || gradUnits == - SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { - theCoords.addElement( - new Double(currentXPosition / 1000f + - rect.getX() + - val.getValue() * rect.getWidth())); - } else { - theCoords.addElement( - new Double(currentXPosition / 1000f + - val.getValue())); - } - val = afy.getBaseVal(); - if (val.getUnitType() == - SVGLength.SVG_LENGTHTYPE_PERCENTAGE || gradUnits == - SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { - theCoords.addElement( - new Double(currentYPosition / 1000f - - rect.getY() - - val.getValue() * rect.getHeight())); - } else { - theCoords.addElement( - new Double(currentYPosition / 1000f - - val.getValue())); - } - val = ar.getBaseVal(); - if (val.getUnitType() == - SVGLength.SVG_LENGTHTYPE_PERCENTAGE || gradUnits == - SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { - theCoords.addElement( - new Double(val.getValue() * rect.getHeight())); - } else { - theCoords.addElement(new Double(val.getValue())); - } - } - } - if (theCoords == null) { - // percentage values are expressed according to the viewport. - SVGElement vp = - ((GraphicElement) area).getNearestViewportElement(); - if (area instanceof GraphicElement) { - SVGRect rect = ((GraphicElement) area).getBBox(); - if (rect != null) { - theCoords = new Vector(); - SVGLength val = acx.getBaseVal(); - if (val.getUnitType() == - SVGLength.SVG_LENGTHTYPE_PERCENTAGE || - gradUnits == - SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { - theCoords.addElement( - new Double(currentXPosition / 1000f + - rect.getX() + - val.getValue() * rect.getWidth())); - } else { - theCoords.addElement( - new Double(currentXPosition / 1000f + - val.getValue())); - } - val = acy.getBaseVal(); - if (val.getUnitType() == - SVGLength.SVG_LENGTHTYPE_PERCENTAGE || - gradUnits == - SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { - theCoords.addElement( - new Double(currentYPosition / 1000f - - rect.getY() - - val.getValue() * rect.getHeight())); - } else { - theCoords.addElement( - new Double(currentYPosition / 1000f - - val.getValue())); - } - theCoords.addElement(new Double(0)); - val = afx.getBaseVal(); - if (val.getUnitType() == - SVGLength.SVG_LENGTHTYPE_PERCENTAGE || - gradUnits == - SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { - theCoords.addElement( - new Double(currentXPosition / 1000f + - rect.getX() + - val.getValue() * rect.getWidth())); - } else { - theCoords.addElement( - new Double(currentXPosition / 1000f + - val.getValue())); - } - val = afy.getBaseVal(); - if (val.getUnitType() == - SVGLength.SVG_LENGTHTYPE_PERCENTAGE || - gradUnits == - SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { - theCoords.addElement( - new Double(currentYPosition / 1000f - - rect.getY() - - val.getValue() * rect.getHeight())); - } else { - theCoords.addElement( - new Double(currentYPosition / 1000f - - val.getValue())); - } - val = ar.getBaseVal(); - if (val.getUnitType() == - SVGLength.SVG_LENGTHTYPE_PERCENTAGE || - gradUnits == - SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { - theCoords.addElement( new Double(val.getValue() * - rect.getHeight())); - } else { - theCoords.addElement(new Double(val.getValue())); - } - } - } - } - if (theCoords == null) { - theCoords = new Vector(); - theCoords.addElement( new Double(currentXPosition / 1000f + - acx.getBaseVal().getValue())); - theCoords.addElement( new Double(currentYPosition / 1000f - - acy.getBaseVal().getValue())); - theCoords.addElement(new Double(0)); - theCoords.addElement( new Double(currentXPosition / 1000f + - afx.getBaseVal().getValue())); // Fx - theCoords.addElement( - new Double(currentYPosition / 1000f - - afy.getBaseVal().getValue())); // Fy - theCoords.addElement( - new Double(ar.getBaseVal().getValue())); - } - float lastoffset = 0; - for (int count = 0; count < nl.getLength(); count++) { - stop = (SVGStopElementImpl) nl.item(count); - CSSValue cv = stop.getPresentationAttribute("stop-color"); - if (cv == null) { - // maybe using color - cv = stop.getPresentationAttribute("color"); - } - if (cv == null) { - // problems - MessageHandler.errorln("no stop-color or color in stop element"); - continue; - } - PDFColor color = new PDFColor(0, 0, 0); - if (cv != null && - cv.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { - if (((CSSPrimitiveValue) cv).getPrimitiveType() == - CSSPrimitiveValue.CSS_RGBCOLOR) { - RGBColor col = - ((CSSPrimitiveValue) cv).getRGBColorValue(); - CSSPrimitiveValue val; - val = col.getRed(); - float red = val.getFloatValue( - CSSPrimitiveValue.CSS_NUMBER); - val = col.getGreen(); - float green = val.getFloatValue( - CSSPrimitiveValue.CSS_NUMBER); - val = col.getBlue(); - float blue = val.getFloatValue( - CSSPrimitiveValue.CSS_NUMBER); - color = new PDFColor(red, green, blue); - } - } - float offset = stop.getOffset().getBaseVal(); - // create bounds from last to offset - lastoffset = offset; - someColors.addElement(color); - } - PDFPattern myPat = this.pdfDoc.createGradient(true, aColorSpace, - someColors, theBounds, theCoords); - - currentStream.write(myPat.getColorSpaceOut(fill)); - if (fill) - di.fill = true; - else - di.stroke = true; - } - - /* - * This sets up the style for drawing objects. - * Should only set style for elements that have changes. - * - */ - // need mask drawing - class DrawingInstruction { - boolean stroke = false; - boolean nonzero = false; // non-zero fill rule "f*", "B*" operator - boolean fill = false; - int linecap = 0; // butt - int linejoin = 0; // miter - int miterwidth = 8; - } - protected DrawingInstruction applyStyle(SVGElement area, - SVGStylable style) { - DrawingInstruction di = new DrawingInstruction(); - CSSValue sp; - sp = style.getPresentationAttribute("fill"); - if (sp != null) { - if (sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { - if (((CSSPrimitiveValue) sp).getPrimitiveType() == - CSSPrimitiveValue.CSS_RGBCOLOR) { - RGBColor col = - ((CSSPrimitiveValue) sp).getRGBColorValue(); - CSSPrimitiveValue val; - val = col.getRed(); - float red = val.getFloatValue( - CSSPrimitiveValue.CSS_NUMBER); - val = col.getGreen(); - float green = val.getFloatValue( - CSSPrimitiveValue.CSS_NUMBER); - val = col.getBlue(); - float blue = val.getFloatValue( - CSSPrimitiveValue.CSS_NUMBER); - PDFColor fillColour = new PDFColor(red, green, blue); - currentColour = fillColour; - currentStream.write(fillColour.getColorSpaceOut(true)); - di.fill = true; - } else if ( ((CSSPrimitiveValue) sp).getPrimitiveType() == - CSSPrimitiveValue.CSS_URI) { - // gradient - String str = ((CSSPrimitiveValue) sp).getCssText(); - handleGradient(str, di, true, area); - } else if ( ((CSSPrimitiveValue) sp).getPrimitiveType() == - CSSPrimitiveValue.CSS_STRING) { - String str = ((CSSPrimitiveValue) sp).getCssText(); - if (str.equals("none")) { - di.fill = false; - } else if (str.equals("currentColor")) { - currentStream.write( - currentColour.getColorSpaceOut(true)); - di.fill = true; - // } else { - // handleGradient(str, true, area); - } - } - } - } else { - PDFColor fillColour = new PDFColor(0, 0, 0); - currentStream.write(fillColour.getColorSpaceOut(true)); - } - sp = style.getPresentationAttribute("fill-rule"); - if (sp != null) { - if (sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { - if (((CSSPrimitiveValue) sp).getPrimitiveType() == - CSSPrimitiveValue.CSS_STRING) { - if (sp.getCssText().equals("nonzero")) { - di.nonzero = true; - } - } - } - } else { - } - sp = style.getPresentationAttribute("stroke"); - if (sp != null) { - if (sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { - if (((CSSPrimitiveValue) sp).getPrimitiveType() == - CSSPrimitiveValue.CSS_RGBCOLOR) { - RGBColor col = - ((CSSPrimitiveValue) sp).getRGBColorValue(); - CSSPrimitiveValue val; - val = col.getRed(); - float red = val.getFloatValue( - CSSPrimitiveValue.CSS_NUMBER); - val = col.getGreen(); - float green = val.getFloatValue( - CSSPrimitiveValue.CSS_NUMBER); - val = col.getBlue(); - float blue = val.getFloatValue( - CSSPrimitiveValue.CSS_NUMBER); - PDFColor fillColour = new PDFColor(red, green, blue); - currentStream.write( - fillColour.getColorSpaceOut(false)); - di.stroke = true; - } else if ( ((CSSPrimitiveValue) sp).getPrimitiveType() == - CSSPrimitiveValue.CSS_URI) { - // gradient - String str = ((CSSPrimitiveValue) sp).getCssText(); - handleGradient(str, di, false, area); - } else if ( ((CSSPrimitiveValue) sp).getPrimitiveType() == - CSSPrimitiveValue.CSS_STRING) { - String str = ((CSSPrimitiveValue) sp).getCssText(); - if (str.equals("none")) { - di.stroke = false; - // } else { - // handleGradient(str, false, area); - } - } - } - } else { - PDFColor fillColour = new PDFColor(0, 0, 0); - currentStream.write(fillColour.getColorSpaceOut(false)); - } - sp = style.getPresentationAttribute("stroke-linecap"); - if (sp != null) { - if (sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { - if (((CSSPrimitiveValue) sp).getPrimitiveType() == - CSSPrimitiveValue.CSS_STRING) { - String str = sp.getCssText(); - // butt, round ,square - if (str.equals("butt")) { - currentStream.write(0 + " J\n"); - } else if (str.equals("round")) { - currentStream.write(1 + " J\n"); - } else if (str.equals("square")) { - currentStream.write(2 + " J\n"); - } - } - } - } else { - } - sp = style.getPresentationAttribute("stroke-linejoin"); - if (sp != null) { - if (sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { - if (((CSSPrimitiveValue) sp).getPrimitiveType() == - CSSPrimitiveValue.CSS_STRING) { - String str = sp.getCssText(); - if (str.equals("miter")) { - currentStream.write(0 + " j\n"); - } else if (str.equals("round")) { - currentStream.write(1 + " j\n"); - } else if (str.equals("bevel")) { - currentStream.write(2 + " j\n"); - } - } - } - } else { - } - sp = style.getPresentationAttribute("stroke-miterlimit"); - if (sp != null) { - if (sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { - float width; - width = ((CSSPrimitiveValue) sp).getFloatValue( - CSSPrimitiveValue.CSS_PT); - PDFNumber pdfNumber = new PDFNumber(); - currentStream.write(pdfNumber.doubleOut(width) + " M\n"); - } - } else { - } - sp = style.getPresentationAttribute("stroke-width"); - if (sp != null) { - if (sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { - float width; - width = ((CSSPrimitiveValue) sp).getFloatValue( - CSSPrimitiveValue.CSS_PT); - PDFNumber pdfNumber = new PDFNumber(); - currentStream.write(pdfNumber.doubleOut(width) + " w\n"); - } - } - sp = style.getPresentationAttribute("stroke-dasharray"); - if (sp != null) { - if (sp.getValueType() == CSSValue.CSS_VALUE_LIST) { - currentStream.write("[ "); - CSSValueList list = (CSSValueList) sp; - for (int count = 0; count < list.getLength(); count++) { - CSSValue val = list.item(count); - if (val.getValueType() == - CSSValue.CSS_PRIMITIVE_VALUE) { - currentStream.write( - ((CSSPrimitiveValue) val).getFloatValue( - CSSPrimitiveValue.CSS_NUMBER) + " "); - } - } - currentStream.write("] "); - sp = style.getPresentationAttribute("stroke-dashoffset"); - if (sp != null && sp.getValueType() == - CSSValue.CSS_PRIMITIVE_VALUE) { - currentStream.write( - ((CSSPrimitiveValue) sp).getFloatValue( - CSSPrimitiveValue.CSS_NUMBER) + " d\n"); - } else { - currentStream.write("0 d\n"); - } - } - } - sp = style.getPresentationAttribute("clip-path"); - if (sp != null) { - String clipurl; - if (sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { - if (((CSSPrimitiveValue) sp).getPrimitiveType() == - CSSPrimitiveValue.CSS_URI) { - clipurl = ((CSSPrimitiveValue) sp).getCssText(); - if (clipurl.startsWith("url(")) { - int b1 = clipurl.indexOf("("); - int b2 = clipurl.indexOf(")"); - clipurl = clipurl.substring(b1 + 1, b2); - } - // get def of mask and set mask - SVGElement graph = null; - graph = locateDef(clipurl, area); - if (graph != null) { - MessageHandler.logln("clip path: " + graph); - // render the clip path elements and make it the clip - // renderElement(svgarea, graph, posx, posy); - } - } - } - } - sp = style.getPresentationAttribute("mask"); - if (sp != null) { - String maskurl; - if (sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { - if (((CSSPrimitiveValue) sp).getPrimitiveType() == - CSSPrimitiveValue.CSS_URI) { - maskurl = ((CSSPrimitiveValue) sp).getCssText(); - // System.out.println("mask: " + maskurl); - // get def of mask and set mask - if (maskurl.startsWith("url(")) { - int b1 = maskurl.indexOf("("); - int b2 = maskurl.indexOf(")"); - maskurl = maskurl.substring(b1 + 1, b2); - } - SVGElement graph = null; - graph = locateDef(maskurl, area); - if (graph != null) { - MessageHandler.logln("mask: " + graph); - // SVGElement parent = graph.getGraphicParent(); - // graph.setParent(area); - // renderElement(svgarea, graph, posx, posy); - // graph.setParent(parent); - } - } - } - } - return di; - } - - protected void applyTransform(SVGAnimatedTransformList trans) { - PDFNumber pdfNumber = new PDFNumber(); - SVGTransformList list = trans.getBaseVal(); - for (int count = 0; count < list.getNumberOfItems(); count++) { - SVGMatrix matrix = - ((SVGTransform) list.getItem(count)).getMatrix(); - currentStream.write(pdfNumber.doubleOut(matrix.getA(), 5) + - " " + pdfNumber.doubleOut(matrix.getB(), 5) + " " + - pdfNumber.doubleOut(matrix.getC(), 5) + " " + - pdfNumber.doubleOut(matrix.getD(), 5) + " " + - pdfNumber.doubleOut(matrix.getE(), 5) + " " + - pdfNumber.doubleOut(matrix.getF(), 5) + " cm\n"); - } - } - - /** - * Main rendering selection. - * This applies any transform and style and then calls the appropriate - * rendering method depending on the type of element. - */ - public void renderElement(SVGElement area, int posx, int posy) { - int x = posx; - int y = posy; - // CSSStyleDeclaration style = null; - // if(area instanceof SVGStylable) - // style = ((SVGStylable)area).getStyle(); - DrawingInstruction di = null; - - currentStream.write("q\n"); - if (area instanceof SVGTransformable) { - SVGTransformable tf = (SVGTransformable) area; - SVGAnimatedTransformList trans = tf.getTransform(); - if (trans != null) { - applyTransform(trans); - } - } - - if (area instanceof SVGStylable) { - di = applyStyle(area, (SVGStylable) area); - } - - if (area instanceof SVGRectElement) { - SVGRectElement rg = (SVGRectElement) area; - float rectx = rg.getX().getBaseVal().getValue(); - float recty = rg.getY().getBaseVal().getValue(); - float rx = rg.getRx().getBaseVal().getValue(); - float ry = rg.getRy().getBaseVal().getValue(); - float rw = rg.getWidth().getBaseVal().getValue(); - float rh = rg.getHeight().getBaseVal().getValue(); - addRect(rectx, recty, rw, rh, rx, ry, di); - } else if (area instanceof SVGLineElement) { - SVGLineElement lg = (SVGLineElement) area; - float x1 = lg.getX1().getBaseVal().getValue(); - float y1 = lg.getY1().getBaseVal().getValue(); - float x2 = lg.getX2().getBaseVal().getValue(); - float y2 = lg.getY2().getBaseVal().getValue(); - addLine(x1, y1, x2, y2, di); - } else if (area instanceof SVGTextElementImpl) { - // currentStream.add("q\n"); - // currentStream.add(1 + " " + 0 + " " + 0 + " " + 1 + " " + 0 + " " + 0 + " cm\n"); - currentStream.write("BT\n"); - renderText((SVGTextElementImpl) area, 0, 0, di); - currentStream.write("ET\n"); - // currentStream.add("Q\n"); - } else if (area instanceof SVGCircleElement) { - SVGCircleElement cg = (SVGCircleElement) area; - float cx = cg.getCx().getBaseVal().getValue(); - float cy = cg.getCy().getBaseVal().getValue(); - float r = cg.getR().getBaseVal().getValue(); - addCircle(cx, cy, r, di); - } else if (area instanceof SVGEllipseElement) { - SVGEllipseElement cg = (SVGEllipseElement) area; - float cx = cg.getCx().getBaseVal().getValue(); - float cy = cg.getCy().getBaseVal().getValue(); - float rx = cg.getRx().getBaseVal().getValue(); - float ry = cg.getRy().getBaseVal().getValue(); - addEllipse(cx, cy, rx, ry, di); - } else if (area instanceof SVGPathElementImpl) { - addPath(((SVGPathElementImpl) area).pathElements, posx, - posy, di); - } else if (area instanceof SVGPolylineElementImpl) { - addPolyline(((SVGPolylineElementImpl) area).points, di, false); - } else if (area instanceof SVGPolygonElementImpl) { - addPolyline(((SVGPolygonElementImpl) area).points, di, true); - } else if (area instanceof SVGGElementImpl) { - renderGArea((SVGGElementImpl) area, x, y); - } else if (area instanceof SVGUseElementImpl) { - SVGUseElementImpl ug = (SVGUseElementImpl) area; - String ref = ug.link; - // ref = ref.substring(1, ref.length()); - SVGElement graph = null; - graph = locateDef(ref, ug); - if (graph != null) { - // probably not the best way to do this, should be able - // to render without the style being set. - // SVGElement parent = graph.getGraphicParent(); - // graph.setParent(area); - // need to clip (if necessary) to the use area - // the style of the linked element is as if it was - // a direct descendant of the use element. - - // scale to the viewBox - - if (graph instanceof SVGSymbolElement) { - currentStream.write("q\n"); - SVGSymbolElement symbol = (SVGSymbolElement) graph; - SVGRect view = symbol.getViewBox().getBaseVal(); - float usex = ug.getX().getBaseVal().getValue(); - float usey = ug.getY().getBaseVal().getValue(); - float usewidth = ug.getWidth().getBaseVal().getValue(); - float useheight = - ug.getHeight().getBaseVal().getValue(); - float scaleX; - float scaleY; - scaleX = usewidth / view.getWidth(); - scaleY = useheight / view.getHeight(); - currentStream.write(usex + " " + usey + " m\n"); - currentStream.write((usex + usewidth) + " " + - usey + " l\n"); - currentStream.write((usex + usewidth) + " " + - (usey + useheight) + " l\n"); - currentStream.write(usex + " " + - (usey + useheight) + " l\n"); - currentStream.write("h\n"); - currentStream.write("W\n"); - currentStream.write("n\n"); - currentStream.write(scaleX + " 0 0 " + scaleY + - " " + usex + " " + usey + " cm\n"); - renderSymbol(symbol, posx, posy); - currentStream.write("Q\n"); - } else { - renderElement(graph, posx, posy); - } - // graph.setParent(parent); - } - else { - MessageHandler.logln("Use Element: " + ref + " not found"); - } - } else if (area instanceof SVGImageElementImpl) { - SVGImageElementImpl ig = (SVGImageElementImpl) area; - renderImage(ig.link, ig.x, ig.y, ig.width, ig.height); - } else if (area instanceof SVGSVGElement) { - currentStream.write("q\n"); - SVGSVGElement svgel = (SVGSVGElement) area; - float svgx = 0; - if (svgel.getX() != null) - svgx = svgel.getX().getBaseVal().getValue(); - float svgy = 0; - if (svgel.getY() != null) - svgy = svgel.getY().getBaseVal().getValue(); - currentStream.write(1 + " 0 0 " + 1 + " " + svgx + " " + - svgy + " cm\n"); - renderSVG(svgel, (int)(x + 1000 * svgx), - (int)(y + 1000 * svgy)); - currentStream.write("Q\n"); - // } else if (area instanceof SVGSymbolElement) { - // 'symbol' element is not rendered (except by 'use') - } else if (area instanceof SVGAElement) { - SVGAElement ael = (SVGAElement) area; - org.w3c.dom.NodeList nl = ael.getChildNodes(); - for (int count = 0; count < nl.getLength(); count++) { - org.w3c.dom.Node n = nl.item(count); - if (n instanceof SVGElement) { - if (n instanceof GraphicElement) { - SVGRect rect = ((GraphicElement) n).getBBox(); - if (rect != null) { - /* currentAnnotList = this.pdfDoc.makeAnnotList(); - currentPage.setAnnotList(currentAnnotList); - String dest = linkSet.getDest(); - int linkType = linkSet.getLinkType(); - currentAnnotList.addLink( - this.pdfDoc.makeLink(lrect.getRectangle(), dest, linkType)); - currentAnnotList = null; - */ } - } - renderElement((SVGElement) n, posx, posy); - } - } - } else if (area instanceof SVGSwitchElement) { - handleSwitchElement(posx, posy, (SVGSwitchElement) area); - } - // should be done with some cleanup code, so only - // required values are reset. - currentStream.write("Q\n"); - } - - /** - * Todo: underline, linethrough, textpath - */ - public void renderText(SVGTextElementImpl tg, float x, float y, - DrawingInstruction di) { - SVGTextRenderer str = new SVGTextRenderer(fontState, tg, x, y); - str.renderText(tg); - } - - /** - * Adds an svg string to the output. - * This handles the escaping of special pdf chars and deals with - * whitespace. - */ - protected float addSVGStr(FontState fs, float currentX, String str, boolean spacing) { - boolean inbetween = false; - boolean addedspace = false; - StringBuffer pdf = new StringBuffer(); - Font f = (Font) fs.getFontInfo().getFonts().get(fs.getFontName()); - boolean useMultiByte = false; - if (f instanceof CIDFont) - useMultiByte=true; - String startText = useMultiByte ? "<" : "("; - String endText = useMultiByte ? ">" : ")"; - - pdf.append(startText); - - if ( useMultiByte ) { - String enc = ((CIDFont)f).getCharEncoding(); - try { - str = new String(str.getBytes(enc), "8859_1"); - } catch (java.io.UnsupportedEncodingException ex) { } - } - - for (int i = 0; i < str.length(); i++) { - char ch = fs.mapChar(str.charAt(i)); - if ( useMultiByte ) { - switch ( str.charAt( i )) - { - case '\t': - case ' ': - if (spacing) { - pdf = pdf.append( endText ); - - pdf = pdf.append( startText ); - currentX += fs.width(fs.mapChar(' ')) / 1000f; - } else { - if (inbetween && !addedspace) { - addedspace = true; - pdf = pdf.append( endText ); - pdf = pdf.append(" "); - pdf = pdf.append(Float.toString(-fs.width(fs.mapChar(' ')))); - pdf = pdf.append(" "); - pdf = pdf.append( startText ); - currentX += fs.width(fs.mapChar(' ')) / 1000f; - } - } - break; - case '\n': - case '\r': - if (spacing) { - pdf = pdf.append( endText ); - pdf = pdf.append(" "); - pdf = pdf.append(Float.toString(-fs.width(fs.mapChar(' ')))); - pdf = pdf.append(" "); - pdf = pdf.append( startText ); - currentX += fs.width(fs.mapChar(' ')) / 1000f; - } - break; - default: - pdf = pdf.append(getUnicodeString( ch)); - currentX += fs.width(ch) / 1000f; - inbetween = true; - addedspace = false; - break; - } - } else if (ch > 127) { - pdf = pdf.append("\\"); - pdf = pdf.append(Integer.toOctalString((int) ch)); - currentX += fs.width(ch) / 1000f; - inbetween = true; - addedspace = false; - } else { - switch (ch) { - case '(' : - pdf = pdf.append("\\("); - currentX += fs.width(ch) / 1000f; - inbetween = true; - addedspace = false; - break; - case ')' : - pdf = pdf.append("\\)"); - currentX += fs.width(ch) / 1000f; - inbetween = true; - addedspace = false; - break; - case '\\' : - pdf = pdf.append("\\\\"); - currentX += fs.width(ch) / 1000f; - inbetween = true; - addedspace = false; - break; - case '\t': - case ' ': - if (spacing) { - pdf = pdf.append(' '); - currentX += fs.width(' ') / 1000f; - } else { - if (inbetween && !addedspace) { - addedspace = true; - pdf = pdf.append(' '); - currentX += fs.width(' ') / 1000f; - } - } - break; - case '\n': - case '\r': - if (spacing) { - pdf = pdf.append(' '); - currentX += fs.width(' ') / 1000f; - } - break; - default: - addedspace = false; - pdf = pdf.append(ch); - currentX += fs.width(ch) / 1000f; - inbetween = true; - break; - } - } - } - pdf.append(endText); - currentStream.write(pdf.toString()); - return currentX; - } - - /** - * Locates a defined element in an svg document. - * Either gets the element defined by its "id" in the current - * SVGDocument, or if the uri reference is to an external - * document it loads the document and returns the element. - */ - protected SVGElement locateDef(String ref, SVGElement currentElement) { - int pos; - ref = ref.trim(); - pos = ref.indexOf("#"); - if (pos == 0) { - // local doc - Document doc = currentElement.getOwnerDocument(); - Element ele = - doc.getElementById(ref.substring(1, ref.length())); - if (ele instanceof SVGElement) { - return (SVGElement) ele; - } - } else if (pos != -1) { - String href = ref.substring(0, pos); - if (href.indexOf(":") == -1) { - href = "file:" + href; - } - try { - // this is really only to get a cached svg image - FopImage img = FopImageFactory.Make(href); - if (img instanceof SVGImage) { - SVGDocument doc = ((SVGImage) img).getSVGDocument(); - Element ele = doc.getElementById( - ref.substring(pos + 1, ref.length())); - if (ele instanceof SVGElement) { - return (SVGElement) ele; - } - } - } catch (Exception e) { - MessageHandler.errorln(e.toString()); - } - } - return null; - } - - /** - * This class is used to handle the rendering of svg text. - * This is so that it can deal with the recursive rendering - * of text markup, while keeping track of the state and position. - */ - class SVGTextRenderer { - FontState fs; - String transstr; - float currentX; - float currentY; - float baseX; - float baseY; - SVGMatrix matrix; - float x; - float y; - - SVGTextRenderer(FontState fontState, SVGTextElementImpl tg, - float x, float y) { - fs = fontState; - - PDFNumber pdfNumber = new PDFNumber(); - SVGTransformList trans = tg.getTransform().getBaseVal(); - matrix = trans.consolidate().getMatrix(); - transstr = (pdfNumber.doubleOut(matrix.getA()) + " " + - pdfNumber.doubleOut(matrix.getB()) + " " + - pdfNumber.doubleOut(matrix.getC()) + " " + - pdfNumber.doubleOut(-matrix.getD()) + " "); - this.x = x; - this.y = y; - } - - void renderText(SVGTextElementImpl te) { - float xoffset = 0; - - if (te.anchor.getEnum() != TextAnchor.START) { - // This is a bit of a hack: The code below will update - // the current position, so all I have to do is to - // prevent that the code will write anything to the - // PDF stream... - StringWriter oldStream = currentStream; - currentStream = new StringWriter (); - FontState saveFS = fs; - _renderText (te, 0f, true); - - float width = currentX - te.x; - currentStream = oldStream; - fs = saveFS; - - if (te.anchor.getEnum() == TextAnchor.END) { - xoffset = -width; - } else if (te.anchor.getEnum() == TextAnchor.MIDDLE) { - xoffset = -width/2; - } - } - - _renderText (te, xoffset, false); - } - - void _renderText(SVGTextElementImpl te, float xoffset, boolean getWidthOnly) { - DrawingInstruction di = applyStyle(te, te); - if (di.fill) { - if (di.stroke) { - currentStream.write("2 Tr\n"); - } else { - currentStream.write("0 Tr\n"); - } - } else if (di.stroke) { - currentStream.write("1 Tr\n"); - } - updateFont(te, fs); - - float tx = te.x; - float ty = te.y; - currentX = x + tx + xoffset; - currentY = y + ty; - baseX = currentX; - baseY = currentY; - NodeList nodel = te.getChildNodes(); - // Vector list = te.textList; - for (int count = 0; count < nodel.getLength(); count++) { - Object o = nodel.item(count); - applyStyle(te, te); - if (o instanceof CharacterData) { - String str = ((CharacterData) o).getData(); - currentStream.write(transstr + - (currentX + matrix.getE()) + " " + - (baseY + matrix.getF()) + " Tm [" ); - boolean spacing = "preserve".equals(te.getXMLspace()); - currentX = addSVGStr(fs, currentX, str, spacing); - currentStream.write(" ] TJ\n"); - } else if (o instanceof SVGTextPathElementImpl) { - SVGTextPathElementImpl tpg = (SVGTextPathElementImpl) o; - String ref = tpg.str; - SVGElement graph = null; - graph = locateDef(ref, tpg); - if (graph instanceof SVGPathElementImpl) { - // probably not the best way to do this, should be able - // to render without the style being set. - // GraphicImpl parent = graph.getGraphicParent(); - // graph.setParent(tpg); - // set text path?? - // how should this work - // graph.setParent(parent); - } - } else if (o instanceof SVGTRefElementImpl) { - SVGTRefElementImpl trg = (SVGTRefElementImpl) o; - String ref = trg.ref; - SVGElement element = locateDef(ref, trg); - if (element instanceof SVGTextElementImpl) { - // GraphicImpl parent = graph.getGraphicParent(); - // graph.setParent(trg); - SVGTextElementImpl tele = - (SVGTextElementImpl) element; - // the style should be from tele, but it needs to be placed as a child - // of trg to work - di = applyStyle(trg, trg); - if (di.fill) { - if (di.stroke) { - currentStream.write("2 Tr\n"); - } else { - currentStream.write("0 Tr\n"); - } - } else if (di.stroke) { - currentStream.write("1 Tr\n"); - } - boolean changed = false; - FontState oldfs = fs; - changed = updateFont(te, fs); - NodeList nl = tele.getChildNodes(); - boolean spacing = - "preserve".equals(trg.getXMLspace()); - renderTextNodes(spacing, nl, - trg.getX().getBaseVal(), - trg.getY().getBaseVal(), - trg.getDx().getBaseVal(), - trg.getDy().getBaseVal()); - - if (changed) { - fs = oldfs; - currentStream.write("/" + - fs.getFontName() + " " + - fs.getFontSize() / 1000f + " Tf\n"); - } - // graph.setParent(parent); - } - } else if (o instanceof SVGTSpanElementImpl) { - SVGTSpanElementImpl tsg = (SVGTSpanElementImpl) o; - applyStyle(tsg, tsg); - boolean changed = false; - FontState oldfs = fs; - changed = updateFont(tsg, fs); - boolean spacing = "preserve".equals(tsg.getXMLspace()); - renderTextNodes(spacing, tsg.getChildNodes(), - tsg.getX().getBaseVal(), - tsg.getY().getBaseVal(), - tsg.getDx().getBaseVal(), - tsg.getDy().getBaseVal()); - - // currentX += fs.width(' ') / 1000f; - if (changed) { - fs = oldfs; - currentStream.write("/" + fs.getFontName() + - " " + fs.getFontSize() / 1000f + " Tf\n"); - } - } else { - MessageHandler.errorln("Error: unknown text element " + o); - } - } - } - - void renderTextNodes(boolean spacing, NodeList nl, - SVGLengthList xlist, SVGLengthList ylist, - SVGLengthList dxlist, SVGLengthList dylist) { - boolean inbetween = false; - boolean addedspace = false; - int charPos = 0; - float xpos = currentX; - float ypos = currentY; - - for (int count = 0; count < nl.getLength(); count++) { - Node n = nl.item(count); - if (n instanceof CharacterData) { - StringBuffer pdf = new StringBuffer(); - String str = ((CharacterData) n).getData(); - for (int i = 0; i < str.length(); i++) { - char ch = str.charAt(i); - xpos = currentX; - ypos = currentY; - if (ylist.getNumberOfItems() > charPos) { - ypos = baseY + (ylist.getItem(charPos)). - getValue(); - } - if (dylist.getNumberOfItems() > charPos) { - ypos = ypos + (dylist.getItem(charPos)). - getValue(); - } - if (xlist.getNumberOfItems() > charPos) { - xpos = baseX + (xlist.getItem(charPos)). - getValue(); - } - if (dxlist.getNumberOfItems() > charPos) { - xpos = xpos + (dxlist.getItem(charPos)). - getValue(); - } - if (ch > 127) { - pdf = pdf.append(transstr + - (xpos + matrix.getE()) + " " + - (ypos + matrix.getF()) + " Tm " + - "(" + "\\" + - Integer.toOctalString((int) ch) + - ") Tj\n"); - currentX = xpos + fs.width(ch) / 1000f; - currentY = ypos; - charPos++; - inbetween = true; - addedspace = false; - } else { - switch (ch) { - case '(' : - pdf = pdf.append(transstr + - (xpos + matrix.getE()) + - " " + (ypos + - matrix.getF()) + " Tm " + - "(" + "\\(" + ") Tj\n"); - currentX = xpos + fs.width(ch) / 1000f; - currentY = ypos; - charPos++; - inbetween = true; - addedspace = false; - break; - case ')' : - pdf = pdf.append(transstr + - (xpos + matrix.getE()) + - " " + (ypos + - matrix.getF()) + " Tm " + - "(" + "\\)" + ") Tj\n"); - currentX = xpos + fs.width(ch) / 1000f; - currentY = ypos; - charPos++; - inbetween = true; - addedspace = false; - break; - case '\\' : - pdf = pdf.append(transstr + - (xpos + matrix.getE()) + - " " + (ypos + - matrix.getF()) + " Tm " + - "(" + "\\\\" + ") Tj\n"); - currentX = xpos + fs.width(ch) / 1000f; - currentY = ypos; - charPos++; - inbetween = true; - addedspace = false; - break; - case '\t': - case ' ': - if (spacing) { - currentX = xpos + fs.width(' ') / - 1000f; - currentY = ypos; - charPos++; - } else { - if (inbetween && !addedspace) { - addedspace = true; - currentX = xpos + fs.width(' ') - / 1000f; - currentY = ypos; - charPos++; - } - } - break; - case '\n': - case '\r': - if (spacing) { - currentX = xpos + fs.width(' ') / - 1000f; - currentY = ypos; - charPos++; - } - break; - default: - addedspace = false; - pdf = pdf.append(transstr + - (xpos + matrix.getE()) + - " " + (ypos + - matrix.getF()) + " Tm " + - "(" + ch + ") Tj\n"); - currentX = xpos + fs.width(ch) / 1000f; - currentY = ypos; - charPos++; - inbetween = true; - break; - } - } - currentStream.write(pdf.toString()); - } - } - } - } - - protected boolean updateFont(SVGStylable style, FontState fs) { - boolean changed = false; - String fontFamily = fs.getFontFamily(); - CSSValue sp = style.getPresentationAttribute("font-family"); - if (sp != null && - sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { - if (((CSSPrimitiveValue) sp).getPrimitiveType() == - CSSPrimitiveValue.CSS_STRING) { - fontFamily = sp.getCssText(); - } - } - if (!fontFamily.equals(fs.getFontFamily())) { - changed = true; - } - String fontStyle = fs.getFontStyle(); - sp = style.getPresentationAttribute("font-style"); - if (sp != null && - sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { - if (((CSSPrimitiveValue) sp).getPrimitiveType() == - CSSPrimitiveValue.CSS_STRING) { - fontStyle = sp.getCssText(); - } - } - if (!fontStyle.equals(fs.getFontStyle())) { - changed = true; - } - String fontWeight = fs.getFontWeight(); - sp = style.getPresentationAttribute("font-weight"); - if (sp != null && - sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { - if (((CSSPrimitiveValue) sp).getPrimitiveType() == - CSSPrimitiveValue.CSS_STRING) { - fontWeight = sp.getCssText(); - } - } - if (!fontWeight.equals(fs.getFontWeight())) { - changed = true; - } - float newSize = fs.getFontSize() / 1000f; - sp = style.getPresentationAttribute("font-size"); - if (sp != null && - sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { - // if(((CSSPrimitiveValue)sp).getPrimitiveType() == CSSPrimitiveValue.CSS_NUMBER) { - newSize = ((CSSPrimitiveValue) sp).getFloatValue( - CSSPrimitiveValue.CSS_PT); - // } - } - if (fs.getFontSize() / 1000f != newSize) { - changed = true; - } - if (changed) { - try { - // FIX-ME: should get the font-variant property - fs = new FontState(fs.getFontInfo(), fontFamily, - fontStyle, fontWeight, (int)(newSize * 1000), - FontVariant.NORMAL); - } catch (Exception fope) { - } - this.fs = fs; - - currentStream.write("/" + fs.getFontName() + " " + - newSize + " Tf\n"); - } else { - if (!currentFontName.equals(fs.getFontName()) || - currentFontSize != fs.getFontSize()) { - // currentFontName = fs.getFontName(); - // currentFontSize = fs.getFontSize(); - currentStream.write("/" + fs.getFontName() + " " + - (fs.getFontSize() / 1000f) + " Tf\n"); - } - } - return changed; - } - } - - /** - * Convert a char to a multibyte hex representation - */ - private String getUnicodeString(char c) { - - StringBuffer buf = new StringBuffer(4); - - byte[] uniBytes = null; - try { - char[] a = {c}; - uniBytes = new String(a).getBytes("UnicodeBigUnmarked"); - } catch (Exception e) { - // This should never fail - } - - for (int i = 0; i < uniBytes.length; i++) { - int b = (uniBytes[i] < 0) ? (int)(256 + uniBytes[i]) : - (int) uniBytes[i]; - - String hexString = Integer.toHexString(b); - if (hexString.length() == 1) - buf = buf.append("0"+hexString); - else - buf = buf.append(hexString); - } - - return buf.toString(); - - } - - -} diff --git a/src/org/apache/fop/render/txt/TXTRenderer.java b/src/org/apache/fop/render/txt/TXTRenderer.java index 98ffe018d..32efcd893 100755 --- a/src/org/apache/fop/render/txt/TXTRenderer.java +++ b/src/org/apache/fop/render/txt/TXTRenderer.java @@ -21,7 +21,8 @@ import org.apache.fop.pdf.PDFPathPaint; import org.apache.fop.pdf.PDFColor; import org.apache.fop.image.*; -import org.apache.fop.dom.svg.SVGArea; +import org.apache.fop.svg.SVGArea; + import org.w3c.dom.svg.SVGSVGElement; // Java diff --git a/src/org/apache/fop/render/xml/XMLRenderer.java b/src/org/apache/fop/render/xml/XMLRenderer.java index 767ccab04..d0044ebf1 100644 --- a/src/org/apache/fop/render/xml/XMLRenderer.java +++ b/src/org/apache/fop/render/xml/XMLRenderer.java @@ -53,8 +53,6 @@ package org.apache.fop.render.xml; // FOP import org.apache.fop.svg.*; import org.apache.fop.messaging.MessageHandler; -import org.apache.fop.dom.svg.*; -import org.apache.fop.dom.svg.SVGArea; import org.apache.fop.render.Renderer; import org.apache.fop.image.ImageArea; import org.apache.fop.layout.*; diff --git a/src/org/apache/fop/svg/A.java b/src/org/apache/fop/svg/A.java deleted file mode 100644 index 1e881f407..000000000 --- a/src/org/apache/fop/svg/A.java +++ /dev/null @@ -1,127 +0,0 @@ -/*-- $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.w3c.dom.svg.SVGElement; - -/** - * class representing svg:a pseudo flow object. - * - */ -public class A extends SVGObj { - - /** - * inner class for making A objects. - */ - public static class Maker extends FObj.Maker { - - /** - * make a A object. - * - * @param parent the parent formatting object - * @param propertyList the explicit properties of this object - * - * @return the A object - */ - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new A(parent, propertyList); - } - } - - /** - * returns the maker for this object. - * - * @return the maker for A objects - */ - public static FObj.Maker maker() { - return new A.Maker(); - } - - /** - * constructs a A object (called by Maker). - * - * @param parent the parent formatting object - * @param propertyList the explicit properties of this object - */ - protected A(FObj parent, PropertyList propertyList) { - super(parent, propertyList); - this.name = "svg:a"; - } - - public SVGElement createGraphic() { - String rf = this.properties.get("xlink:href").getString(); - SVGAElementImpl graphic; - graphic = new SVGAElementImpl(); - // graphic.setTarget(new SVGAnimatedStringImpl(rf)); - - int numChildren = this.children.size(); - for (int i = 0; i < numChildren; i++) { - FONode child = (FONode) children.elementAt(i); - if (child instanceof GraphicsCreator) { - SVGElement impl = ((GraphicsCreator) child).createGraphic(); - graphic.appendChild(impl); - } else if (child instanceof Defs) { - } - } - - return graphic; - } -} diff --git a/src/org/apache/fop/svg/AltGlyph.java b/src/org/apache/fop/svg/AltGlyph.java deleted file mode 100644 index 86739386e..000000000 --- a/src/org/apache/fop/svg/AltGlyph.java +++ /dev/null @@ -1,106 +0,0 @@ -/*-- $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 SVGObj { - - /** - * 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"; - } -} diff --git a/src/org/apache/fop/svg/Animate.java b/src/org/apache/fop/svg/Animate.java deleted file mode 100644 index b1f79b7ca..000000000 --- a/src/org/apache/fop/svg/Animate.java +++ /dev/null @@ -1,106 +0,0 @@ -/*-- $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 SVGObj { - - /** - * 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"; - } -} diff --git a/src/org/apache/fop/svg/AnimateColor.java b/src/org/apache/fop/svg/AnimateColor.java deleted file mode 100644 index b25f20198..000000000 --- a/src/org/apache/fop/svg/AnimateColor.java +++ /dev/null @@ -1,106 +0,0 @@ -/*-- $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 SVGObj { - - /** - * 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"; - } -} diff --git a/src/org/apache/fop/svg/AnimateMotion.java b/src/org/apache/fop/svg/AnimateMotion.java deleted file mode 100644 index facb011d5..000000000 --- a/src/org/apache/fop/svg/AnimateMotion.java +++ /dev/null @@ -1,106 +0,0 @@ -/*-- $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 SVGObj { - - /** - * 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"; - } -} diff --git a/src/org/apache/fop/svg/AnimateTransform.java b/src/org/apache/fop/svg/AnimateTransform.java deleted file mode 100644 index a569c535a..000000000 --- a/src/org/apache/fop/svg/AnimateTransform.java +++ /dev/null @@ -1,106 +0,0 @@ -/*-- $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 SVGObj { - - /** - * 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"; - } -} diff --git a/src/org/apache/fop/svg/Circle.java b/src/org/apache/fop/svg/Circle.java deleted file mode 100644 index f32b467dd..000000000 --- a/src/org/apache/fop/svg/Circle.java +++ /dev/null @@ -1,139 +0,0 @@ -/*-- $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; -import org.w3c.dom.svg.SVGElement; - -/** - * class representing svg:Circle pseudo flow object. - * - */ -public class Circle extends SVGObj { - - /** - * inner class for making Circle objects. - */ - public static class Maker extends FObj.Maker { - - /** - * make a Circle object. - * - * @param parent the parent formatting object - * @param propertyList the explicit properties of this object - * - * @return the Circle object - */ - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new Circle(parent, propertyList); - } - } - - /** - * returns the maker for this object. - * - * @return the maker for Circle objects - */ - public static FObj.Maker maker() { - return new Circle.Maker(); - } - - /** - * constructs a Circle object (called by Maker). - * - * @param parent the parent formatting object - * @param propertyList the explicit properties of this object - */ - protected Circle(FObj parent, PropertyList propertyList) { - super(parent, propertyList); - this.name = "svg:circle"; - } - - public SVGElement createGraphic() { - /* retrieve properties */ - SVGLength cx = ((SVGLengthProperty) this.properties.get("cx")). - getSVGLength(); - if (cx == null) - cx = new SVGLengthImpl(); - SVGLength cy = ((SVGLengthProperty) this.properties.get("cy")). - getSVGLength(); - if (cy == null) - cy = new SVGLengthImpl(); - SVGLength r = ((SVGLengthProperty) this.properties.get("r")). - getSVGLength(); - if (r == null) - r = new SVGLengthImpl(); - SVGCircleElementImpl graph = new SVGCircleElementImpl(); - graph.setCx(new SVGAnimatedLengthImpl(cx)); - graph.setCy(new SVGAnimatedLengthImpl(cy)); - graph.setR(new SVGAnimatedLengthImpl(r)); - graph.setStyle( - ((SVGStyle) this.properties.get("style")).getStyle()); - graph.setTransform( - ((SVGTransform) this.properties.get("transform")). - getTransform()); - graph.setId(this.properties.get("id").getString()); - return graph; - } -} diff --git a/src/org/apache/fop/svg/ClipPath.java b/src/org/apache/fop/svg/ClipPath.java deleted file mode 100644 index 65b5562a0..000000000 --- a/src/org/apache/fop/svg/ClipPath.java +++ /dev/null @@ -1,142 +0,0 @@ -/*-- $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.fo.properties.*; - -import org.apache.fop.dom.svg.*; -import org.apache.fop.dom.svg.SVGArea; - -import org.w3c.dom.svg.SVGElement; -import org.w3c.dom.svg.*; - -/** - * class representing svg:ClipPath pseudo flow object. - * - */ -public class ClipPath extends SVGObj { - - /** - * 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; - SVGElement graph = gc.createGraphic(); - clippath.addElement(graph); - // graph.setParent(clippath); - } else { - // error - } - } - - public SVGElement createGraphic() { - clippath.setStyle( - ((SVGStyle) this.properties.get("style")).getStyle()); - clippath.setId(this.properties.get("id").getString()); - switch ((this.properties.get("clipPathUnits")).getEnum()) { - case GenericUnits.Enums.USER_SPACE_ON_USE: - clippath.setClipPathUnits( new SVGAnimatedEnumerationImpl( - SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE)); - break; - case GenericUnits.Enums.OBJECT_BOUNDING_BOX: - clippath.setClipPathUnits( new SVGAnimatedEnumerationImpl( - SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)); - break; - } - return clippath; - } -} diff --git a/src/org/apache/fop/svg/Cursor.java b/src/org/apache/fop/svg/Cursor.java deleted file mode 100644 index 1507ce04b..000000000 --- a/src/org/apache/fop/svg/Cursor.java +++ /dev/null @@ -1,105 +0,0 @@ -/*-- $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 SVGObj { - - /** - * 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"; - } -} diff --git a/src/org/apache/fop/svg/Defs.java b/src/org/apache/fop/svg/Defs.java deleted file mode 100644 index 8ee14015e..000000000 --- a/src/org/apache/fop/svg/Defs.java +++ /dev/null @@ -1,135 +0,0 @@ -/*-- $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.*; - -import org.apache.fop.dom.svg.*; -import org.apache.fop.dom.svg.SVGArea; -/** - * class representing svg:Defs pseudo flow object. - * - */ -public class Defs extends SVGObj { - - /** - * 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 SVGElement createGraphic() - { - SVGDefsElement defs = new SVGDefsElementImpl(); - int numChildren = this.children.size(); - for (int i = 0; i < numChildren; i++) { - FONode child = (FONode) children.elementAt(i); - if(child instanceof GraphicsCreator) { - SVGElement gi = ((GraphicsCreator)child).createGraphic(); - if(gi instanceof SVGElement) { - defs.appendChild((SVGElement)gi); -// 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; - } -} diff --git a/src/org/apache/fop/svg/Desc.java b/src/org/apache/fop/svg/Desc.java deleted file mode 100644 index 8bf382ccf..000000000 --- a/src/org/apache/fop/svg/Desc.java +++ /dev/null @@ -1,120 +0,0 @@ -/*-- $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; - -/** - * class representing svg:Desc pseudo flow object. - * - */ -public class Desc extends SVGObj { - - /** - * inner class for making Desc objects. - */ - public static class Maker extends FObj.Maker { - - /** - * 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); - } - } - - /** - * returns the maker for this object. - * - * @return the maker for Desc objects - */ - public static FObj.Maker maker() { - return new Desc.Maker(); - } - - /** - * the desc string - */ - protected String text = ""; - - /** - * 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"; - } - - /** - * 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); - } -} diff --git a/src/org/apache/fop/svg/Ellipse.java b/src/org/apache/fop/svg/Ellipse.java deleted file mode 100644 index 3c955b51a..000000000 --- a/src/org/apache/fop/svg/Ellipse.java +++ /dev/null @@ -1,142 +0,0 @@ -/*-- $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; -import org.w3c.dom.svg.SVGElement; - -/** - * class representing svg:Ellipse pseudo flow object. - * - */ -public class Ellipse extends SVGObj { - - /** - * inner class for making Ellipse objects. - */ - public static class Maker extends FObj.Maker { - - /** - * make a Ellipse object. - * - * @param parent the parent formatting object - * @param propertyList the explicit properties of this object - * - * @return the Ellipse object - */ - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new Ellipse(parent, propertyList); - } - } - - /** - * returns the maker for this object. - * - * @return the maker for Ellipse objects - */ - public static FObj.Maker maker() { - return new Ellipse.Maker(); - } - - /** - * constructs a Ellipse object (called by Maker). - * - * @param parent the parent formatting object - * @param propertyList the explicit properties of this object - */ - protected Ellipse(FObj parent, PropertyList propertyList) { - super(parent, propertyList); - this.name = "svg:ellipse"; - } - - public SVGElement createGraphic() { - /* retrieve properties */ - SVGLength cx = ((SVGLengthProperty) this.properties.get("cx")). - getSVGLength(); - if (cx == null) - cx = new SVGLengthImpl(); - SVGLength cy = ((SVGLengthProperty) this.properties.get("cy")). - getSVGLength(); - if (cy == null) - cy = new SVGLengthImpl(); - SVGLength rx = ((SVGLengthProperty) this.properties.get("rx")). - getSVGLength(); - if (rx == null) - rx = new SVGLengthImpl(); - SVGLength ry = ((SVGLengthProperty) this.properties.get("ry")). - getSVGLength(); - if (ry == null) - ry = new SVGLengthImpl(); - SVGEllipseElementImpl graph = new SVGEllipseElementImpl(); - graph.setCx(new SVGAnimatedLengthImpl(cx)); - graph.setCy(new SVGAnimatedLengthImpl(cy)); - graph.setRx(new SVGAnimatedLengthImpl(rx)); - graph.setRy(new SVGAnimatedLengthImpl(ry)); - graph.setStyle( - ((SVGStyle) this.properties.get("style")).getStyle()); - graph.setTransform( - ((SVGTransform) this.properties.get("transform")). - getTransform()); - graph.setId(this.properties.get("id").getString()); - return graph; - } -} diff --git a/src/org/apache/fop/svg/Filter.java b/src/org/apache/fop/svg/Filter.java deleted file mode 100644 index a2dc40f08..000000000 --- a/src/org/apache/fop/svg/Filter.java +++ /dev/null @@ -1,106 +0,0 @@ -/*-- $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 SVGObj { - - /** - * 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"; - } -} diff --git a/src/org/apache/fop/svg/Font.java b/src/org/apache/fop/svg/Font.java deleted file mode 100644 index bffe59043..000000000 --- a/src/org/apache/fop/svg/Font.java +++ /dev/null @@ -1,106 +0,0 @@ -/*-- $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 SVGObj { - - /** - * 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"; - } -} diff --git a/src/org/apache/fop/svg/G.java b/src/org/apache/fop/svg/G.java deleted file mode 100644 index 81e949e50..000000000 --- a/src/org/apache/fop/svg/G.java +++ /dev/null @@ -1,135 +0,0 @@ -/*-- $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.SVGElement; - -/** - * class representing svg:G pseudo flow object. - * - */ -public class G extends SVGObj { - - /** - * 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 SVGElement createGraphic() - { - ggraphic.setTransform(((SVGTransform)this.properties.get("transform")).getTransform()); - ggraphic.setStyle(((SVGStyle)this.properties.get("style")).getStyle()); - ggraphic.setId(this.properties.get("id").getString()); - ggraphic.setClassName(new SVGAnimatedStringImpl(this.properties.get("class").getString())); - int numChildren = this.children.size(); - for (int i = 0; i < numChildren; i++) { - FONode child = (FONode) children.elementAt(i); - if(child instanceof GraphicsCreator) { - SVGElement impl = ((GraphicsCreator)child).createGraphic(); - if(impl != null) { - if(impl instanceof SVGElementImpl) - ((SVGElementImpl)impl).setClassName(new SVGAnimatedStringImpl(((FObj)child).getProperty("class").getString())); - ggraphic.appendChild(impl); - } - } else if(child instanceof Defs) { -// System.out.println(child); -// ggraphic.addDefs(((Defs)child).createDefs()); - } - } - return ggraphic; - } -} diff --git a/src/org/apache/fop/svg/Glyph.java b/src/org/apache/fop/svg/Glyph.java deleted file mode 100644 index 8fb8b59a6..000000000 --- a/src/org/apache/fop/svg/Glyph.java +++ /dev/null @@ -1,106 +0,0 @@ -/*-- $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 SVGObj { - - /** - * 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"; - } -} diff --git a/src/org/apache/fop/svg/GraphicsCreator.java b/src/org/apache/fop/svg/GraphicsCreator.java index 139bf7b8a..295a80006 100644 --- a/src/org/apache/fop/svg/GraphicsCreator.java +++ b/src/org/apache/fop/svg/GraphicsCreator.java @@ -51,13 +51,12 @@ package org.apache.fop.svg; -import org.apache.fop.dom.svg.*; - import org.w3c.dom.svg.SVGElement; +import org.w3c.dom.*; /** * */ public interface GraphicsCreator { - public SVGElement createGraphic(); + public void addGraphic(Document doc, Element parent); } diff --git a/src/org/apache/fop/svg/HKern.java b/src/org/apache/fop/svg/HKern.java deleted file mode 100644 index 7632c9930..000000000 --- a/src/org/apache/fop/svg/HKern.java +++ /dev/null @@ -1,105 +0,0 @@ -/*-- $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 SVGObj { - - /** - * 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"; - } -} diff --git a/src/org/apache/fop/svg/Image.java b/src/org/apache/fop/svg/Image.java deleted file mode 100644 index 8fa6b9803..000000000 --- a/src/org/apache/fop/svg/Image.java +++ /dev/null @@ -1,144 +0,0 @@ -/*-- $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.SVGElement; -import org.w3c.dom.svg.SVGLength; - -/** - * class representing svg:Image pseudo flow object. - * - */ -public class Image extends SVGObj { - - /** - * inner class for making Image objects. - */ - public static class Maker extends FObj.Maker { - - /** - * make a Image object. - * - * @param parent the parent formatting object - * @param propertyList the explicit properties of this object - * - * @return the Image object - */ - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new Image(parent, propertyList); - } - } - - /** - * returns the maker for this object. - * - * @return the maker for Image objects - */ - public static FObj.Maker maker() { - return new Image.Maker(); - } - - /** - * constructs a Image object (called by Maker). - * - * @param parent the parent formatting object - * @param propertyList the explicit properties of this object - */ - protected Image(FObj parent, PropertyList propertyList) { - super(parent, propertyList); - this.name = "svg:image"; - } - - public SVGElement createGraphic() { - String link = this.properties.get("xlink:href").getString(); - SVGLength length; - length = ((SVGLengthProperty) this.properties.get("x")). - getSVGLength(); - if (length == null) - length = new SVGLengthImpl(); - float x = length.getValue(); - length = ((SVGLengthProperty) this.properties.get("y")). - getSVGLength(); - if (length == null) - length = new SVGLengthImpl(); - float y = length.getValue(); - length = ((SVGLengthProperty) this.properties.get("width")). - getSVGLength(); - if (length == null) - length = new SVGLengthImpl(); - float width = length.getValue(); - length = ((SVGLengthProperty) this.properties.get("height")). - getSVGLength(); - if (length == null) - length = new SVGLengthImpl(); - float height = length.getValue(); - SVGImageElementImpl graph = - new SVGImageElementImpl(link, x, y, width, height); - graph.setStyle( - ((SVGStyle) this.properties.get("style")).getStyle()); - graph.setTransform( - ((SVGTransform) this.properties.get("transform")). - getTransform()); - graph.setId(this.properties.get("id").getString()); - return graph; - } -} diff --git a/src/org/apache/fop/svg/Line.java b/src/org/apache/fop/svg/Line.java deleted file mode 100644 index a69aee426..000000000 --- a/src/org/apache/fop/svg/Line.java +++ /dev/null @@ -1,144 +0,0 @@ -/*-- $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.messaging.MessageHandler; -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.SVGLineElementImpl; -import org.apache.fop.dom.svg.SVGArea; - -import org.w3c.dom.svg.SVGElement; - -/** - * class representing svg:line pseudo flow object. - */ -public class Line extends SVGObj { - - /** - * inner class for making Line objects. - */ - public static class Maker extends FObj.Maker { - - /** - * make a Line object. - * - * @param parent the parent formatting object - * @param propertyList the explicit properties of this object - * - * @return the Line object - */ - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new Line(parent, propertyList); - } - } - - /** - * returns the maker for this object. - * - * @return the maker for Line objects - */ - public static FObj.Maker maker() { - return new Line.Maker(); - } - - /** - * constructs a Line object (called by Maker). - * - * @param parent the parent formatting object - * @param propertyList the explicit properties of this object - */ - protected Line(FObj parent, PropertyList propertyList) { - super(parent, propertyList); - this.name = "svg:line"; - } - - public SVGElement createGraphic() { - /* retrieve properties */ - SVGLength x1 = ((SVGLengthProperty) this.properties.get("x1")). - getSVGLength(); - if (x1 == null) - x1 = new SVGLengthImpl(); - SVGLength x2 = ((SVGLengthProperty) this.properties.get("x2")). - getSVGLength(); - if (x2 == null) - x2 = new SVGLengthImpl(); - SVGLength y1 = ((SVGLengthProperty) this.properties.get("y1")). - getSVGLength(); - if (y1 == null) - y1 = new SVGLengthImpl(); - SVGLength y2 = ((SVGLengthProperty) this.properties.get("y2")). - getSVGLength(); - if (y2 == null) - y2 = new SVGLengthImpl(); - SVGLineElementImpl graph = new SVGLineElementImpl(); - graph.setX1(new SVGAnimatedLengthImpl(x1)); - graph.setY1(new SVGAnimatedLengthImpl(y1)); - graph.setX2(new SVGAnimatedLengthImpl(x2)); - graph.setY2(new SVGAnimatedLengthImpl(y2)); - graph.setStyle( - ((SVGStyle) this.properties.get("style")).getStyle()); - graph.setTransform( - ((SVGTransform) this.properties.get("transform")). - getTransform()); - graph.setId(this.properties.get("id").getString()); - return graph; - } -} diff --git a/src/org/apache/fop/svg/LinearGradient.java b/src/org/apache/fop/svg/LinearGradient.java deleted file mode 100644 index 2f4be86ae..000000000 --- a/src/org/apache/fop/svg/LinearGradient.java +++ /dev/null @@ -1,179 +0,0 @@ -/*-- $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.fo.properties.*; - -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 SVGObj { - - /** - * inner class for making LinearGradient objects. - */ - public static class Maker extends FObj.Maker { - - /** - * make a LinearGradient object. - * - * @param parent the parent formatting object - * @param propertyList the explicit properties of this object - * - * @return the LinearGradient object - */ - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new LinearGradient(parent, propertyList); - } - } - - /** - * returns the maker for this object. - * - * @return the maker for LinearGradient objects - */ - public static FObj.Maker maker() { - return new LinearGradient.Maker(); - } - - /** - * constructs a LinearGradient object (called by Maker). - * - * @param parent the parent formatting object - * @param propertyList the explicit properties of this object - */ - protected LinearGradient(FObj parent, PropertyList propertyList) { - super(parent, propertyList); - this.name = "svg:linearGradient"; - } - - SVGLinearGradientElementImpl linear = - new SVGLinearGradientElementImpl(); - - protected void addChild(FONode child) { - super.addChild(child); - if (child instanceof Stop) { - SVGStopElement sse = ((Stop) child).createStop(); - linear.appendChild(sse); - } - } - - public SVGElement createGraphic() { - linear.setStyle( - ((SVGStyle) this.properties.get("style")).getStyle()); - linear.setTransform( - ((SVGTransform) this.properties.get("transform")). - getTransform()); - linear.setGradientTransform( - ((SVGTransform) this.properties.get("gradientTransform")). - getTransform()); - linear.setId(this.properties.get("id").getString()); - String rf = this.properties.get("xlink:href").getString(); - linear.setHref(new SVGAnimatedStringImpl(rf)); - - SVGLength lengthProp = - ((SVGLengthProperty) this.properties.get("x1")). - getSVGLength(); - linear.setX1(lengthProp == null ? null : - new SVGAnimatedLengthImpl(lengthProp)); - // if x2 is not specified then it should be 100% - lengthProp = ((SVGLengthProperty) this.properties.get("x2")). - getSVGLength(); - linear.setX2(lengthProp == null ? null : - new SVGAnimatedLengthImpl(lengthProp)); - lengthProp = ((SVGLengthProperty) this.properties.get("y1")). - getSVGLength(); - linear.setY1(lengthProp == null ? null : - new SVGAnimatedLengthImpl(lengthProp)); - lengthProp = ((SVGLengthProperty) this.properties.get("y2")). - getSVGLength(); - linear.setY2(lengthProp == null ? null : - new SVGAnimatedLengthImpl(lengthProp)); - switch ((this.properties.get("spreadMethod")).getEnum()) { - case SpreadMethod.PAD: - linear.setSpreadMethod( new SVGAnimatedEnumerationImpl( - SVGGradientElement.SVG_SPREADMETHOD_PAD)); - break; - case SpreadMethod.REFLECT: - linear.setSpreadMethod( new SVGAnimatedEnumerationImpl( - SVGGradientElement.SVG_SPREADMETHOD_REFLECT)); - break; - case SpreadMethod.REPEAT: - linear.setSpreadMethod( new SVGAnimatedEnumerationImpl( - SVGGradientElement.SVG_SPREADMETHOD_REPEAT)); - break; - } - switch ((this.properties.get("gradientUnits")).getEnum()) { - case GenericUnits.Enums.USER_SPACE_ON_USE: - linear.setGradientUnits( new SVGAnimatedEnumerationImpl( - SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE)); - break; - case GenericUnits.Enums.OBJECT_BOUNDING_BOX: - linear.setGradientUnits( new SVGAnimatedEnumerationImpl( - SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)); - break; - } - return linear; - } -} diff --git a/src/org/apache/fop/svg/Marker.java b/src/org/apache/fop/svg/Marker.java deleted file mode 100644 index 7fd2887d6..000000000 --- a/src/org/apache/fop/svg/Marker.java +++ /dev/null @@ -1,106 +0,0 @@ -/*-- $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 SVGObj { - - /** - * 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"; - } -} diff --git a/src/org/apache/fop/svg/Mask.java b/src/org/apache/fop/svg/Mask.java deleted file mode 100644 index 451de833a..000000000 --- a/src/org/apache/fop/svg/Mask.java +++ /dev/null @@ -1,131 +0,0 @@ -/*-- $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.w3c.dom.svg.SVGElement; - -/** - * class representing svg:Mask pseudo flow object. - * - */ -public class Mask extends SVGObj { - - /** - * 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; - SVGElement graph = gc.createGraphic(); - if(graph != null) { - mask.addElement(graph); -// graph.setParent(mask); - } - } else { - // error - } - } - - public SVGElement createGraphic() - { - mask.setStyle(((SVGStyle)this.properties.get("style")).getStyle()); - mask.setId(this.properties.get("id").getString()); - return mask; - } -} diff --git a/src/org/apache/fop/svg/MissingGlyph.java b/src/org/apache/fop/svg/MissingGlyph.java deleted file mode 100644 index 5065e2b16..000000000 --- a/src/org/apache/fop/svg/MissingGlyph.java +++ /dev/null @@ -1,105 +0,0 @@ -/*-- $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 SVGObj { - - /** - * 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"; - } -} diff --git a/src/org/apache/fop/svg/PDFDocumentGraphics2D.java b/src/org/apache/fop/svg/PDFDocumentGraphics2D.java new file mode 100644 index 000000000..37bc930fd --- /dev/null +++ b/src/org/apache/fop/svg/PDFDocumentGraphics2D.java @@ -0,0 +1,120 @@ +/***************************************************************************** + * Copyright (C) The Apache Software Foundation. All rights reserved. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * + *****************************************************************************/ + +package org.apache.fop.svg; + +import org.apache.fop.pdf.*; +import org.apache.fop.layout.*; +import org.apache.fop.fonts.*; +import org.apache.fop.render.pdf.*; +import org.apache.fop.image.*; +import org.apache.fop.datatypes.ColorSpace; + +import org.apache.batik.ext.awt.g2d.*; + +import java.text.AttributedCharacterIterator; +import java.awt.*; +import java.awt.Font; +import java.awt.Image; +import java.awt.image.*; +import java.awt.font.*; +import java.awt.geom.*; +import java.awt.image.renderable.*; +import java.io.*; + +import java.util.Map; + +/** + * This concrete implementation of <tt>AbstractGraphics2D</tt> is a + * simple help to programmers to get started with their own + * implementation of <tt>Graphics2D</tt>. + * <tt>DefaultGraphics2D</tt> implements all the abstract methods + * is <tt>AbstractGraphics2D</tt> and makes it easy to start + * implementing a <tt>Graphic2D</tt> piece-meal. + * + * @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a> + * @version $Id$ + * @see org.apache.batik.ext.awt.g2d.AbstractGraphics2D + */ +public class PDFDocumentGraphics2D extends PDFGraphics2D { + OutputStream stream; + + PDFStream pdfStream; + int width; + int height; + + /** + * Create a new PDFGraphics2D with the given pdf document info. + * This is used to create a Graphics object for use inside an already + * existing document. + * Maybe this could be handled as a subclass (PDFDocumentGraphics2d) + */ + public PDFDocumentGraphics2D(boolean textAsShapes, OutputStream stream, int width, int height) + { + super(textAsShapes); + standalone = true; + this.stream = stream; + this.pdfDoc = new PDFDocument(); + this.pdfDoc.setProducer("FOP SVG Renderer"); + pdfStream = this.pdfDoc.makeStream(); + this.width = width; + this.height = height; + + currentFontName = ""; + currentFontSize = 0; + currentYPosition = 0; + currentXPosition = 0; +// fontState = fs; + + currentStream.write("1 0 0 -1 0 " + height + " cm\n"); + + // end part + /* + FontSetup.addToResources(this.pdfDoc, fontInfo); + */ + + } + + public void finish() throws IOException + { + pdfStream.add(getString()); + PDFResources pdfResources = this.pdfDoc.getResources(); + PDFPage currentPage = this.pdfDoc.makePage(pdfResources, pdfStream, + width, + height, null); + this.pdfDoc.output(stream); + + } + + public String getString() { + return currentStream.toString(); + } + + public void setGraphicContext(GraphicContext c) + { + gc = c; + } + + /** + * This constructor supports the create method + */ + public PDFDocumentGraphics2D(PDFDocumentGraphics2D g){ + super(g); + } + + /** + * Creates a new <code>Graphics</code> object that is + * a copy of this <code>Graphics</code> object. + * @return a new graphics context that is a copy of + * this graphics context. + */ + public Graphics create(){ + return new PDFDocumentGraphics2D(this); + } + +} diff --git a/src/org/apache/fop/svg/PDFGraphics2D.java b/src/org/apache/fop/svg/PDFGraphics2D.java new file mode 100644 index 000000000..a625d90d7 --- /dev/null +++ b/src/org/apache/fop/svg/PDFGraphics2D.java @@ -0,0 +1,780 @@ +/***************************************************************************** + * Copyright (C) The Apache Software Foundation. All rights reserved. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * + *****************************************************************************/ + +package org.apache.fop.svg; + +import org.apache.fop.pdf.*; +import org.apache.fop.layout.*; +import org.apache.fop.fonts.*; +import org.apache.fop.render.pdf.*; +import org.apache.fop.image.*; +import org.apache.fop.datatypes.ColorSpace; + +import org.apache.batik.ext.awt.g2d.*; + +import java.text.AttributedCharacterIterator; +import java.awt.*; +import java.awt.Font; +import java.awt.Image; +import java.awt.image.*; +import java.awt.font.*; +import java.awt.geom.*; +import java.awt.image.renderable.*; +import java.io.*; + +import java.util.Map; + +/** + * This concrete implementation of <tt>AbstractGraphics2D</tt> is a + * simple help to programmers to get started with their own + * implementation of <tt>Graphics2D</tt>. + * <tt>DefaultGraphics2D</tt> implements all the abstract methods + * is <tt>AbstractGraphics2D</tt> and makes it easy to start + * implementing a <tt>Graphic2D</tt> piece-meal. + * + * @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a> + * @version $Id$ + * @see org.apache.batik.ext.awt.g2d.AbstractGraphics2D + */ +public class PDFGraphics2D extends AbstractGraphics2D { + protected PDFDocument pdfDoc; + + protected FontState fontState; + + boolean standalone = false; + + /** the PDF Document being created */ + //protected PDFDocument pdfDoc; + + //protected FontState fontState; + + /** the current stream to add PDF commands to */ + StringWriter currentStream = new StringWriter(); + + /** the current (internal) font name */ + protected String currentFontName; + + /** the current font size in millipoints */ + protected int currentFontSize; + + /** the current vertical position in millipoints from bottom */ + protected int currentYPosition = 0; + + /** the current horizontal position in millipoints from left */ + protected int currentXPosition = 0; + + /** the current colour for use in svg */ + PDFColor currentColour = new PDFColor(0, 0, 0); + + FontInfo fontInfo; + + /** + * Create a new PDFGraphics2D with the given pdf document info. + * This is used to create a Graphics object for use inside an already + * existing document. + */ + public PDFGraphics2D(boolean textAsShapes, FontState fs, + PDFDocument doc, String font, int size, int xpos, int ypos) { + super(textAsShapes); + pdfDoc = doc; + currentFontName = font; + currentFontSize = size; + currentYPosition = ypos; + currentXPosition = xpos; + fontState = fs; + } + + public PDFGraphics2D(boolean textAsShapes) { + super(textAsShapes); + } + + public String getString() { + return currentStream.toString(); + } + + public void setGraphicContext(GraphicContext c) { + gc = c; + } + + /** + * This constructor supports the create method + */ + public PDFGraphics2D(PDFGraphics2D g) { + super(g); + } + + /** + * Creates a new <code>Graphics</code> object that is + * a copy of this <code>Graphics</code> object. + * @return a new graphics context that is a copy of + * this graphics context. + */ + public Graphics create() { + return new PDFGraphics2D(this); + } + + /** + * Draws as much of the specified image as is currently available. + * The image is drawn with its top-left corner at + * (<i>x</i>, <i>y</i>) in this graphics context's coordinate + * space. Transparent pixels in the image do not affect whatever + * pixels are already there. + * <p> + * This method returns immediately in all cases, even if the + * complete image has not yet been loaded, and it has not been dithered + * and converted for the current output device. + * <p> + * If the image has not yet been completely loaded, then + * <code>drawImage</code> returns <code>false</code>. As more of + * the image becomes available, the process that draws the image notifies + * the specified image observer. + * @param img the specified image to be drawn. + * @param x the <i>x</i> coordinate. + * @param y the <i>y</i> coordinate. + * @param observer object to be notified as more of + * the image is converted. + * @see java.awt.Image + * @see java.awt.image.ImageObserver + * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int) + */ + public boolean drawImage(Image img, int x, int y, + ImageObserver observer) { + System.err.println("drawImage:x, y"); + + final int width = img.getWidth(observer); + final int height = img.getHeight(observer); + if (width == -1 || height == -1) { + return false; + } + + Dimension size = new Dimension(width, height); + BufferedImage buf = buildBufferedImage(size); + + java.awt.Graphics2D g = buf.createGraphics(); + g.setComposite(AlphaComposite.SrcOver); + g.setBackground(new Color(1, 1, 1, 0)); + g.setPaint(new Color(1, 1, 1, 0)); + g.fillRect(0, 0, width, height); + g.clip(new Rectangle(0, 0, buf.getWidth(), buf.getHeight())); + + if (!g.drawImage(img, 0, 0, observer)) { + return false; + } + g.dispose(); + + final byte[] result = + new byte[buf.getWidth() * buf.getHeight() * 3]; + + Raster raster = buf.getData(); + DataBuffer bd = raster.getDataBuffer(); + + int count = 0; + switch (bd.getDataType()) { + case DataBuffer.TYPE_INT: + int[][] idata = ((DataBufferInt) bd).getBankData(); + for (int i = 0; i < idata.length; i++) { + for (int j = 0; j < idata[i].length; j++) { + //System.out.println("data:" + ((idata[i][j] >> 24) & 0xFF)); + if (((idata[i][j] >> 24) & 0xFF) != 255) { + System.out.println("data:" + + ((idata[i][j] >> 24) & 0xFF)); + result[count++] = (byte) 0xFF; + result[count++] = (byte) 0xFF; + result[count++] = (byte) 0xFF; + } else { + result[count++] = + (byte)((idata[i][j] >> 16) & 0xFF); + result[count++] = + (byte)((idata[i][j] >> 8) & 0xFF); + result[count++] = (byte)((idata[i][j]) & 0xFF); + } + } + } + break; + default: + // error + break; + } + + try { + FopImage fopimg = new TempImage(width, height, result); + int xObjectNum = this.pdfDoc.addImage(fopimg); + /*currentStream.write("q\n" + (((float) width)) + + " 0 0 " + (((float) height)) + " " + + x + " " + + ((float)(y - height)) + " cm\n" + "/Im" + + xObjectNum + " Do\nQ\n");*/ + AffineTransform at = getTransform(); + double[] matrix = new double[6]; + at.getMatrix(matrix); + currentStream.write("q\n"); + Shape imclip = getClip(); + writeClip(imclip); + currentStream.write("" + matrix[0] + " " + matrix[1] + + " " + matrix[2] + " " + matrix[3] + " " + + matrix[4] + " " + matrix[5] + " cm\n"); + currentStream.write("" + width + " 0 0 " + (-height) + + " " + x + " " + (y + height) + " cm\n" + "/Im" + + xObjectNum + " Do\nQ\n"); + } catch (Exception e) { + e.printStackTrace(); + } + return true; + } + + public BufferedImage buildBufferedImage(Dimension size) { + return new BufferedImage(size.width, size.height, + BufferedImage.TYPE_INT_ARGB); + } + + class TempImage implements FopImage { + int m_height; + int m_width; + int m_bitsPerPixel; + ColorSpace m_colorSpace; + int m_bitmapSiye; + byte[] m_bitmaps; + PDFColor transparent = new PDFColor(255, 255, 255); + + TempImage(int width, int height, + byte[] result) throws FopImageException { + this.m_height = height; + this.m_width = width; + this.m_bitsPerPixel = 8; + this.m_colorSpace = new ColorSpace(ColorSpace.DEVICE_RGB); + //this.m_isTransparent = false; + //this.m_bitmapsSize = this.m_width * this.m_height * 3; + this.m_bitmaps = result; + } + + public String getURL() { + return "" + m_bitmaps; + } + + // image size + public int getWidth() throws FopImageException { + return m_width; + } + + public int getHeight() throws FopImageException { + return m_height; + } + + // DeviceGray, DeviceRGB, or DeviceCMYK + public ColorSpace getColorSpace() throws FopImageException { + return m_colorSpace; + } + + // bits per pixel + public int getBitsPerPixel() throws FopImageException { + return m_bitsPerPixel; + } + + // For transparent images + public boolean isTransparent() throws FopImageException { + return transparent != null; + } + public PDFColor getTransparentColor() throws FopImageException { + return transparent; + } + + // get the image bytes, and bytes properties + + // get uncompressed image bytes + public byte[] getBitmaps() throws FopImageException { + return m_bitmaps; + } + // width * (bitsPerPixel / 8) * height, no ? + public int getBitmapsSize() throws FopImageException { + return m_width * m_height * 3; + } + + // get compressed image bytes + // I don't know if we really need it, nor if it + // should be changed... + public byte[] getRessourceBytes() throws FopImageException { + return null; + } + public int getRessourceBytesSize() throws FopImageException { + return 0; + } + // return null if no corresponding PDFFilter + public PDFFilter getPDFFilter() throws FopImageException { + return null; + } + + // release memory + public void close() {} + + } + + + /** + * Draws as much of the specified image as has already been scaled + * to fit inside the specified rectangle. + * <p> + * The image is drawn inside the specified rectangle of this + * graphics context's coordinate space, and is scaled if + * necessary. Transparent pixels do not affect whatever pixels + * are already there. + * <p> + * This method returns immediately in all cases, even if the + * entire image has not yet been scaled, dithered, and converted + * for the current output device. + * If the current output representation is not yet complete, then + * <code>drawImage</code> returns <code>false</code>. As more of + * the image becomes available, the process that draws the image notifies + * the image observer by calling its <code>imageUpdate</code> method. + * <p> + * A scaled version of an image will not necessarily be + * available immediately just because an unscaled version of the + * image has been constructed for this output device. Each size of + * the image may be cached separately and generated from the original + * data in a separate image production sequence. + * @param img the specified image to be drawn. + * @param x the <i>x</i> coordinate. + * @param y the <i>y</i> coordinate. + * @param width the width of the rectangle. + * @param height the height of the rectangle. + * @param observer object to be notified as more of + * the image is converted. + * @see java.awt.Image + * @see java.awt.image.ImageObserver + * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int) + */ + public boolean drawImage(Image img, int x, int y, int width, + int height, ImageObserver observer) { + System.out.println("drawImage"); + return true; + } + + /** + * Disposes of this graphics context and releases + * any system resources that it is using. + * A <code>Graphics</code> object cannot be used after + * <code>dispose</code>has been called. + * <p> + * When a Java program runs, a large number of <code>Graphics</code> + * objects can be created within a short time frame. + * Although the finalization process of the garbage collector + * also disposes of the same system resources, it is preferable + * to manually free the associated resources by calling this + * method rather than to rely on a finalization process which + * may not run to completion for a long period of time. + * <p> + * Graphics objects which are provided as arguments to the + * <code>paint</code> and <code>update</code> methods + * of components are automatically released by the system when + * those methods return. For efficiency, programmers should + * call <code>dispose</code> when finished using + * a <code>Graphics</code> object only if it was created + * directly from a component or another <code>Graphics</code> object. + * @see java.awt.Graphics#finalize + * @see java.awt.Component#paint + * @see java.awt.Component#update + * @see java.awt.Component#getGraphics + * @see java.awt.Graphics#create + */ + public void dispose() { + System.out.println("dispose"); + } + + /** + * Strokes the outline of a <code>Shape</code> using the settings of the + * current <code>Graphics2D</code> context. The rendering attributes + * applied include the <code>Clip</code>, <code>Transform</code>, + * <code>Paint</code>, <code>Composite</code> and + * <code>Stroke</code> attributes. + * @param s the <code>Shape</code> to be rendered + * @see #setStroke + * @see #setPaint + * @see java.awt.Graphics#setColor + * @see #transform + * @see #setTransform + * @see #clip + * @see #setClip + * @see #setComposite + */ + public void draw(Shape s) { + //System.out.println("draw(Shape)"); + currentStream.write("q\n"); + Shape imclip = getClip(); + writeClip(imclip); + Color c = getColor(); + currentColour = new PDFColor(c.getRed(), c.getGreen(), c.getBlue()); + currentStream.write(currentColour.getColorSpaceOut(true)); + c = getBackground(); + PDFColor col = new PDFColor(c.getRed(), c.getGreen(), c.getBlue()); + currentStream.write(col.getColorSpaceOut(false)); + + PDFNumber pdfNumber = new PDFNumber(); + + PathIterator iter = s.getPathIterator(getTransform()); + while (!iter.isDone()) { + double vals[] = new double[6]; + int type = iter.currentSegment(vals); + switch (type) { + case PathIterator.SEG_CUBICTO: + currentStream.write(pdfNumber.doubleOut(vals[0]) + + " " + pdfNumber.doubleOut(vals[1]) + " " + + pdfNumber.doubleOut(vals[2]) + " " + + pdfNumber.doubleOut(vals[3]) + " " + + pdfNumber.doubleOut(vals[4]) + " " + + pdfNumber.doubleOut(vals[5]) + " c\n"); + break; + case PathIterator.SEG_LINETO: + currentStream.write(pdfNumber.doubleOut(vals[0]) + + " " + pdfNumber.doubleOut(vals[1]) + " l\n"); + break; + case PathIterator.SEG_MOVETO: + currentStream.write(pdfNumber.doubleOut(vals[0]) + + " " + pdfNumber.doubleOut(vals[1]) + " m\n"); + break; + case PathIterator.SEG_QUADTO: + currentStream.write(pdfNumber.doubleOut(vals[0]) + + " " + pdfNumber.doubleOut(vals[1]) + " " + + pdfNumber.doubleOut(vals[2]) + " " + + pdfNumber.doubleOut(vals[3]) + " y\n"); + break; + case PathIterator.SEG_CLOSE: + currentStream.write("h\n"); + break; + default: + break; + } + iter.next(); + } + doDrawing(false, true, false); + currentStream.write("Q\n"); + } + + protected void writeClip(Shape s) { + PDFNumber pdfNumber = new PDFNumber(); + + PathIterator iter = s.getPathIterator(getTransform()); + while (!iter.isDone()) { + double vals[] = new double[6]; + int type = iter.currentSegment(vals); + switch (type) { + case PathIterator.SEG_CUBICTO: + currentStream.write(pdfNumber.doubleOut(vals[0]) + + " " + pdfNumber.doubleOut(vals[1]) + " " + + pdfNumber.doubleOut(vals[2]) + " " + + pdfNumber.doubleOut(vals[3]) + " " + + pdfNumber.doubleOut(vals[4]) + " " + + pdfNumber.doubleOut(vals[5]) + " c\n"); + break; + case PathIterator.SEG_LINETO: + currentStream.write(pdfNumber.doubleOut(vals[0]) + + " " + pdfNumber.doubleOut(vals[1]) + " l\n"); + break; + case PathIterator.SEG_MOVETO: + currentStream.write(pdfNumber.doubleOut(vals[0]) + + " " + pdfNumber.doubleOut(vals[1]) + " m\n"); + break; + case PathIterator.SEG_QUADTO: + currentStream.write(pdfNumber.doubleOut(vals[0]) + + " " + pdfNumber.doubleOut(vals[1]) + " " + + pdfNumber.doubleOut(vals[2]) + " " + + pdfNumber.doubleOut(vals[3]) + " y\n"); + break; + case PathIterator.SEG_CLOSE: + currentStream.write("h\n"); + break; + default: + break; + } + iter.next(); + } + // clip area + currentStream.write("W\n"); + currentStream.write("n\n"); + } + + /** + * Renders a {@link RenderedImage}, + * applying a transform from image + * space into user space before drawing. + * The transformation from user space into device space is done with + * the current <code>Transform</code> in the <code>Graphics2D</code>. + * The specified transformation is applied to the image before the + * transform attribute in the <code>Graphics2D</code> context is applied. + * The rendering attributes applied include the <code>Clip</code>, + * <code>Transform</code>, and <code>Composite</code> attributes. Note + * that no rendering is done if the specified transform is + * noninvertible. + * @param img the image to be rendered + * @param xform the transformation from image space into user space + * @see #transform + * @see #setTransform + * @see #setComposite + * @see #clip + * @see #setClip + */ + public void drawRenderedImage(RenderedImage img, + AffineTransform xform) { + System.out.println("drawRenderedImage"); + } + + + /** + * Renders a + * {@link RenderableImage}, + * applying a transform from image space into user space before drawing. + * The transformation from user space into device space is done with + * the current <code>Transform</code> in the <code>Graphics2D</code>. + * The specified transformation is applied to the image before the + * transform attribute in the <code>Graphics2D</code> context is applied. + * The rendering attributes applied include the <code>Clip</code>, + * <code>Transform</code>, and <code>Composite</code> attributes. Note + * that no rendering is done if the specified transform is + * noninvertible. + *<p> + * Rendering hints set on the <code>Graphics2D</code> object might + * be used in rendering the <code>RenderableImage</code>. + * If explicit control is required over specific hints recognized by a + * specific <code>RenderableImage</code>, or if knowledge of which hints + * are used is required, then a <code>RenderedImage</code> should be + * obtained directly from the <code>RenderableImage</code> + * and rendered using + *{@link #drawRenderedImage(RenderedImage, AffineTransform) drawRenderedImage}. + * @param img the image to be rendered + * @param xform the transformation from image space into user space + * @see #transform + * @see #setTransform + * @see #setComposite + * @see #clip + * @see #setClip + * @see #drawRenderedImage + */ + public void drawRenderableImage(RenderableImage img, + AffineTransform xform) { + System.out.println("drawRenderableImage"); + } + + /** + * Renders the text specified by the specified <code>String</code>, + * using the current <code>Font</code> and <code>Paint</code> attributes + * in the <code>Graphics2D</code> context. + * The baseline of the first character is at position + * (<i>x</i>, <i>y</i>) in the User Space. + * The rendering attributes applied include the <code>Clip</code>, + * <code>Transform</code>, <code>Paint</code>, <code>Font</code> and + * <code>Composite</code> attributes. For characters in script systems + * such as Hebrew and Arabic, the glyphs can be rendered from right to + * left, in which case the coordinate supplied is the location of the + * leftmost character on the baseline. + * @param s the <code>String</code> to be rendered + * @param x, y the coordinates where the <code>String</code> + * should be rendered + * @see #setPaint + * @see java.awt.Graphics#setColor + * @see java.awt.Graphics#setFont + * @see #setTransform + * @see #setComposite + * @see #setClip + */ + public void drawString(String s, float x, float y) { + System.out.println("drawString(String)"); + } + + /** + * Renders the text of the specified iterator, using the + * <code>Graphics2D</code> context's current <code>Paint</code>. The + * iterator must specify a font + * for each character. The baseline of the + * first character is at position (<i>x</i>, <i>y</i>) in the + * User Space. + * The rendering attributes applied include the <code>Clip</code>, + * <code>Transform</code>, <code>Paint</code>, and + * <code>Composite</code> attributes. + * For characters in script systems such as Hebrew and Arabic, + * the glyphs can be rendered from right to left, in which case the + * coordinate supplied is the location of the leftmost character + * on the baseline. + * @param iterator the iterator whose text is to be rendered + * @param x, y the coordinates where the iterator's text is to be + * rendered + * @see #setPaint + * @see java.awt.Graphics#setColor + * @see #setTransform + * @see #setComposite + * @see #setClip + */ + public void drawString(AttributedCharacterIterator iterator, + float x, float y) { + System.err.println("drawString(AttributedCharacterIterator)"); + } + + /** + * Fills the interior of a <code>Shape</code> using the settings of the + * <code>Graphics2D</code> context. The rendering attributes applied + * include the <code>Clip</code>, <code>Transform</code>, + * <code>Paint</code>, and <code>Composite</code>. + * @param s the <code>Shape</code> to be filled + * @see #setPaint + * @see java.awt.Graphics#setColor + * @see #transform + * @see #setTransform + * @see #setComposite + * @see #clip + * @see #setClip + */ + public void fill(Shape s) { + //System.err.println("fill"); + currentStream.write("q\n"); + Shape imclip = getClip(); + writeClip(imclip); + Color c = getColor(); + currentColour = new PDFColor(c.getRed(), c.getGreen(), c.getBlue()); + currentStream.write(currentColour.getColorSpaceOut(true)); + c = getBackground(); + PDFColor col = new PDFColor(c.getRed(), c.getGreen(), c.getBlue()); + currentStream.write(col.getColorSpaceOut(false)); + + PDFNumber pdfNumber = new PDFNumber(); + + PathIterator iter = s.getPathIterator(getTransform()); + while (!iter.isDone()) { + double vals[] = new double[6]; + int type = iter.currentSegment(vals); + switch (type) { + case PathIterator.SEG_CUBICTO: + currentStream.write(pdfNumber.doubleOut(vals[0]) + + " " + pdfNumber.doubleOut(vals[1]) + " " + + pdfNumber.doubleOut(vals[2]) + " " + + pdfNumber.doubleOut(vals[3]) + " " + + pdfNumber.doubleOut(vals[4]) + " " + + pdfNumber.doubleOut(vals[5]) + " c\n"); + break; + case PathIterator.SEG_LINETO: + currentStream.write(pdfNumber.doubleOut(vals[0]) + + " " + pdfNumber.doubleOut(vals[1]) + " l\n"); + break; + case PathIterator.SEG_MOVETO: + currentStream.write(pdfNumber.doubleOut(vals[0]) + + " " + pdfNumber.doubleOut(vals[1]) + " m\n"); + break; + case PathIterator.SEG_QUADTO: + currentStream.write(pdfNumber.doubleOut(vals[0]) + + " " + pdfNumber.doubleOut(vals[1]) + " " + + pdfNumber.doubleOut(vals[2]) + " " + + pdfNumber.doubleOut(vals[3]) + " y\n"); + break; + case PathIterator.SEG_CLOSE: + currentStream.write("h\n"); + break; + default: + break; + } + iter.next(); + } + doDrawing(true, false, + iter.getWindingRule() == PathIterator.WIND_EVEN_ODD); + currentStream.write("Q\n"); + } + + protected void doDrawing(boolean fill, boolean stroke, + boolean nonzero) { + if (fill) { + if (stroke) { + if (!nonzero) + currentStream.write("B*\n"); + else + currentStream.write("B\n"); + } else { + if (!nonzero) + currentStream.write("f*\n"); + else + currentStream.write("f\n"); + } + } else { + //if(stroke) + currentStream.write("S\n"); + } + } + + /** + * Returns the device configuration associated with this + * <code>Graphics2D</code>. + */ + public GraphicsConfiguration getDeviceConfiguration() { + System.out.println("getDeviceConviguration"); + return GraphicsEnvironment.getLocalGraphicsEnvironment(). + getDefaultScreenDevice().getDefaultConfiguration(); + } + + /** + * Used to create proper font metrics + */ + private Graphics2D fmg; + + { + BufferedImage bi = + new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); + + fmg = bi.createGraphics(); + } + + /** + * Gets the font metrics for the specified font. + * @return the font metrics for the specified font. + * @param f the specified font + * @see java.awt.Graphics#getFont + * @see java.awt.FontMetrics + * @see java.awt.Graphics#getFontMetrics() + */ + public FontMetrics getFontMetrics(Font f) { + return fmg.getFontMetrics(f); + } + + /** + * Sets the paint mode of this graphics context to alternate between + * this graphics context's current color and the new specified color. + * This specifies that logical pixel operations are performed in the + * XOR mode, which alternates pixels between the current color and + * a specified XOR color. + * <p> + * When drawing operations are performed, pixels which are the + * current color are changed to the specified color, and vice versa. + * <p> + * Pixels that are of colors other than those two colors are changed + * in an unpredictable but reversible manner; if the same figure is + * drawn twice, then all pixels are restored to their original values. + * @param c1 the XOR alternation color + */ + public void setXORMode(Color c1) { + System.out.println("setXORMode"); + } + + + /** + * Copies an area of the component by a distance specified by + * <code>dx</code> and <code>dy</code>. From the point specified + * by <code>x</code> and <code>y</code>, this method + * copies downwards and to the right. To copy an area of the + * component to the left or upwards, specify a negative value for + * <code>dx</code> or <code>dy</code>. + * If a portion of the source rectangle lies outside the bounds + * of the component, or is obscured by another window or component, + * <code>copyArea</code> will be unable to copy the associated + * pixels. The area that is omitted can be refreshed by calling + * the component's <code>paint</code> method. + * @param x the <i>x</i> coordinate of the source rectangle. + * @param y the <i>y</i> coordinate of the source rectangle. + * @param width the width of the source rectangle. + * @param height the height of the source rectangle. + * @param dx the horizontal distance to copy the pixels. + * @param dy the vertical distance to copy the pixels. + */ + public void copyArea(int x, int y, int width, int height, int dx, + int dy) { + System.out.println("copyArea"); + } + +} diff --git a/src/org/apache/fop/svg/PDFTranscoder.java b/src/org/apache/fop/svg/PDFTranscoder.java new file mode 100644 index 000000000..fdf67007c --- /dev/null +++ b/src/org/apache/fop/svg/PDFTranscoder.java @@ -0,0 +1,659 @@ +/***************************************************************************** + * Copyright (C) The Apache Software Foundation. All rights reserved. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * + *****************************************************************************/ + +package org.apache.fop.svg; + +import java.awt.AlphaComposite; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Graphics2D; +import java.awt.Paint; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Shape; + +import java.awt.geom.AffineTransform; +import java.awt.geom.Dimension2D; +import java.awt.geom.Rectangle2D; +import java.awt.image.BufferedImage; + +import java.awt.*; +import java.awt.event.*; +import java.awt.geom.*; +import java.awt.font.*; + +import java.net.MalformedURLException; +import java.net.URL; + +import java.util.HashSet; +import java.util.Set; + +import org.apache.batik.transcoder.*; + +import org.apache.batik.bridge.BridgeContext; +import org.apache.batik.bridge.BridgeException; +import org.apache.batik.bridge.GVTBuilder; +import org.apache.batik.bridge.UserAgent; +import org.apache.batik.bridge.ViewBox; + +import org.apache.batik.dom.svg.DefaultSVGContext; +import org.apache.batik.dom.svg.SAXSVGDocumentFactory; +import org.apache.batik.dom.svg.SVGDOMImplementation; +import org.apache.batik.dom.svg.SVGOMDocument; +import org.apache.batik.dom.util.DocumentFactory; + +import org.apache.batik.ext.awt.image.GraphicsUtil; + +import org.apache.batik.gvt.GraphicsNode; +import org.apache.batik.gvt.GraphicsNodeRenderContext; +import org.apache.batik.gvt.event.EventDispatcher; +import org.apache.batik.gvt.renderer.ImageRenderer; +import org.apache.batik.gvt.renderer.ImageRendererFactory; + +import org.apache.batik.transcoder.TranscoderException; +import org.apache.batik.transcoder.TranscoderOutput; +import org.apache.batik.transcoder.TranscodingHints; +import org.apache.batik.transcoder.XMLAbstractTranscoder; +import org.apache.batik.transcoder.image.resources.Messages; + +import org.apache.batik.transcoder.keys.BooleanKey; +import org.apache.batik.transcoder.keys.FloatKey; +import org.apache.batik.transcoder.keys.LengthKey; +import org.apache.batik.transcoder.keys.PaintKey; +import org.apache.batik.transcoder.keys.PaintKey; +import org.apache.batik.transcoder.keys.Rectangle2DKey; +import org.apache.batik.transcoder.keys.StringKey; +import org.apache.batik.transcoder.*; + +import org.apache.batik.util.SVGConstants; + +import org.apache.batik.bridge.*; +import org.apache.batik.swing.svg.*; +import org.apache.batik.swing.gvt.*; +import org.apache.batik.gvt.*; +import org.apache.batik.gvt.renderer.*; +import org.apache.batik.gvt.filter.*; +import org.apache.batik.gvt.event.*; + +import org.w3c.dom.*; +import org.w3c.dom.svg.*; +import org.w3c.dom.css.*; +import org.w3c.dom.svg.SVGLength; + +import org.apache.fop.svg.*; + +import org.w3c.dom.DOMException; +import org.w3c.dom.DOMImplementation; +import org.w3c.dom.Document; +import org.w3c.dom.svg.SVGAElement; +import org.w3c.dom.svg.SVGDocument; +import org.w3c.dom.svg.SVGSVGElement; + +// <!> FIXME : Those import clauses will change with new design +import org.apache.batik.gvt.renderer.StaticRendererFactory; + +/** + * This class enables to transcode an input to an image of any format. + * + * <p>Two transcoding hints (<tt>KEY_WIDTH</tt> and + * <tt>KEY_HEIGHT</tt>) can be used to respectively specify the image + * width and the image height. If only one of these keys is specified, + * the transcoder preserves the aspect ratio of the original image. + * + * <p>The <tt>KEY_BACKGROUND_COLOR</tt> defines the background color + * to use for opaque image formats, or the background color that may + * be used for image formats that support alpha channel. + * + * <p>The <tt>KEY_AOI</tt> represents the area of interest to paint + * in device space. + * + * <p>Three additional transcoding hints that act on the SVG + * processor can be specified: + * + * <p><tt>KEY_LANGUAGE</tt> to set the default language to use (may be + * used by a <switch> SVG element for example), + * <tt>KEY_USER_STYLESHEET_URI</tt> to fix the URI of a user + * stylesheet, and <tt>KEY_PIXEL_TO_MM</tt> to specify the pixel to + * millimeter conversion factor. + * + * @author <a href="mailto:Thierry.Kormann@sophia.inria.fr">Thierry Kormann</a> + * @version $Id$ + */ +public class PDFTranscoder extends XMLAbstractTranscoder { + + /** The user agent dedicated to an <tt>ImageTranscoder</tt>. */ + protected UserAgent userAgent = new ImageTranscoderUserAgent(); + + /** + * Constructs a new <tt>ImageTranscoder</tt>. + */ + public PDFTranscoder() { + hints.put(KEY_DOCUMENT_ELEMENT_NAMESPACE_URI, + SVGConstants.SVG_NAMESPACE_URI); + hints.put(KEY_DOCUMENT_ELEMENT, + SVGConstants.SVG_SVG_TAG); + hints.put(KEY_DOM_IMPLEMENTATION, + SVGDOMImplementation.getDOMImplementation()); + } + + /** + * Transcodes the specified Document as an image in the specified output. + * + * @param document the document to transcode + * @param uri the uri of the document or null if any + * @param output the ouput where to transcode + * @exception TranscoderException if an error occured while transcoding + */ + protected void transcode(Document document, + String uri, + TranscoderOutput output) + throws TranscoderException { + + if (!(document instanceof SVGOMDocument)) { + throw new TranscoderException( + Messages.formatMessage("notsvg", null)); + } + SVGDocument svgDoc = (SVGDocument)document; + SVGSVGElement root = svgDoc.getRootElement(); + // initialize the SVG document with the appropriate context + String parserClassname = (String)hints.get(KEY_XML_PARSER_CLASSNAME); + DefaultSVGContext svgCtx = new DefaultSVGContext(); + svgCtx.setPixelToMM(userAgent.getPixelToMM()); + ((SVGOMDocument)document).setSVGContext(svgCtx); + + // build the GVT tree + GVTBuilder builder = new GVTBuilder(); + ImageRendererFactory rendFactory = new StaticRendererFactory(); + GraphicsNodeRenderContext rc = getRenderContext(); + BridgeContext ctx = new BridgeContext(userAgent, rc); + GraphicsNode gvtRoot; + try { + gvtRoot = builder.build(ctx, svgDoc); + } catch (BridgeException ex) { + throw new TranscoderException(ex); + } + // get the 'width' and 'height' attributes of the SVG document + float docWidth = (float)ctx.getDocumentSize().getWidth(); + float docHeight = (float)ctx.getDocumentSize().getHeight(); + ctx = null; + builder = null; + + // compute the image's width and height according the hints + float imgWidth = -1; + if (hints.containsKey(KEY_WIDTH)) { + imgWidth = ((Float)hints.get(KEY_WIDTH)).floatValue(); + } + float imgHeight = -1; + if (hints.containsKey(KEY_HEIGHT)) { + imgHeight = ((Float)hints.get(KEY_HEIGHT)).floatValue(); + } + float width, height; + if (imgWidth > 0 && imgHeight > 0) { + width = imgWidth; + height = imgHeight; + } else if (imgHeight > 0) { + width = (docWidth * imgHeight) / docHeight; + height = imgHeight; + } else if (imgWidth > 0) { + width = imgWidth; + height = (docHeight * imgWidth) / docWidth; + } else { + width = docWidth; + height = docHeight; + } + // compute the preserveAspectRatio matrix + AffineTransform Px; + String ref = null; + try { + ref = new URL(uri).getRef(); + } catch (MalformedURLException ex) { + // nothing to do, catched previously + } + + try { + Px = ViewBox.getViewTransform(ref, root, width, height); + } catch (BridgeException ex) { + throw new TranscoderException(ex); + } + + if (Px.isIdentity() && (width != docWidth || height != docHeight)) { + // The document has no viewBox, we need to resize it by hand. + // we want to keep the document size ratio + float d = Math.max(docWidth, docHeight); + float dd = Math.max(width, height); + float scale = dd/d; + Px = AffineTransform.getScaleInstance(scale, scale); + } + // take the AOI into account if any + if (hints.containsKey(KEY_AOI)) { + Rectangle2D aoi = (Rectangle2D)hints.get(KEY_AOI); + // transform the AOI into the image's coordinate system + aoi = Px.createTransformedShape(aoi).getBounds2D(); + AffineTransform Mx = new AffineTransform(); + double sx = width / aoi.getWidth(); + double sy = height / aoi.getHeight(); + Mx.scale(sx, sy); + double tx = -aoi.getX(); + double ty = -aoi.getY(); + Mx.translate(tx, ty); + // take the AOI transformation matrix into account + // we apply first the preserveAspectRatio matrix + Px.preConcatenate(Mx); + } + // prepare the image to be painted + int w = (int)width; + int h = (int)height; + + PDFDocumentGraphics2D graphics = new PDFDocumentGraphics2D(true, output.getOutputStream(), w, h); + // GraphicsNodeRenderContext rc = getRenderContext(); + graphics.setGraphicContext(new org.apache.batik.ext.awt.g2d.GraphicContext()); + graphics.setRenderingHints(rc.getRenderingHints()); + + gvtRoot.paint(graphics, rc); + + try { + graphics.finish(); + } catch (Exception ex) { + ex.printStackTrace(); + throw new TranscoderException(ex); + } + /* + // paint the SVG document using the bridge package + // create the appropriate renderer + ImageRenderer renderer = rendFactory.createImageRenderer(); + renderer.updateOffScreen(w, h); + renderer.setTransform(Px); + renderer.setTree(gvtRoot); + gvtRoot = null; // We're done with it... + + try { + // now we are sure that the aoi is the image size + Shape raoi = new Rectangle2D.Float(0, 0, width, height); + // Warning: the renderer's AOI must be in user space + renderer.repaint(Px.createInverse().createTransformedShape(raoi)); + BufferedImage rend = renderer.getOffScreen(); + renderer = null; // We're done with it... + + // BufferedImage dest = createImage(w, h); + + //Graphics2D g2d = GraphicsUtil.createGraphics(dest); + + //g2d.drawRenderedImage(rend, new AffineTransform()); + } catch (Exception ex) { + throw new TranscoderException(ex); + } + */ + } + + public GraphicsNodeRenderContext getRenderContext() { + GraphicsNodeRenderContext nodeRenderContext = null; + if (nodeRenderContext == null) { + RenderingHints hints = new RenderingHints(null); + hints.put(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + + hints.put(RenderingHints.KEY_INTERPOLATION, + RenderingHints.VALUE_INTERPOLATION_BILINEAR); + + FontRenderContext fontRenderContext = + new FontRenderContext(new AffineTransform(), true, true); + + TextPainter textPainter = new StrokingTextPainter(); + + GraphicsNodeRableFactory gnrFactory = + new ConcreteGraphicsNodeRableFactory(); + + nodeRenderContext = + new GraphicsNodeRenderContext(new AffineTransform(), + null, + hints, + fontRenderContext, + textPainter, + gnrFactory); + nodeRenderContext.setTextPainter(textPainter); + } + + return nodeRenderContext; + } + + /** + * Creates a <tt>DocumentFactory</tt> that is used to create an SVG DOM + * tree. The specified DOM Implementation is ignored and the Batik + * SVG DOM Implementation is automatically used. + * + * @param domImpl the DOM Implementation (not used) + * @param parserClassname the XML parser classname + */ + protected DocumentFactory createDocumentFactory(DOMImplementation domImpl, + String parserClassname) { + return new SAXSVGDocumentFactory(parserClassname); + } + + // -------------------------------------------------------------------- + // UserAgent implementation + // -------------------------------------------------------------------- + + /** + * A user agent implementation for <tt>ImageTranscoder</tt>. + */ + protected class ImageTranscoderUserAgent implements UserAgent { + + /** + * Returns the default size of this user agent (400x400). + */ + public Dimension2D getViewportSize() { + return new Dimension(400, 400); + } + + /** + * Displays the specified error message using the <tt>ErrorHandler</tt>. + */ + public void displayError(String message) { + try { + getErrorHandler().error(new TranscoderException(message)); + } catch (TranscoderException ex) { + throw new RuntimeException(); + } + } + + /** + * Displays the specified error using the <tt>ErrorHandler</tt>. + */ + public void displayError(Exception e) { + try { + getErrorHandler().error(new TranscoderException(e)); + } catch (TranscoderException ex) { + throw new RuntimeException(); + } + } + + /** + * Displays the specified message using the <tt>ErrorHandler</tt>. + */ + public void displayMessage(String message) { + try { + getErrorHandler().warning(new TranscoderException(message)); + } catch (TranscoderException ex) { + throw new RuntimeException(); + } + } + + /** + * Returns the pixel to millimeter conversion factor specified in the + * <tt>TranscodingHints</tt> or 0.3528 if any. + */ + public float getPixelToMM() { + if (getTranscodingHints().containsKey(KEY_PIXEL_TO_MM)) { + return ((Float)getTranscodingHints().get(KEY_PIXEL_TO_MM)).floatValue(); + } else { + // return 0.3528f; // 72 dpi + return 0.26458333333333333333333333333333f; // 96dpi + } + } + + /** + * Returns the user language specified in the + * <tt>TranscodingHints</tt> or "en" (english) if any. + */ + public String getLanguages() { + if (getTranscodingHints().containsKey(KEY_LANGUAGE)) { + return (String)getTranscodingHints().get(KEY_LANGUAGE); + } else { + return "en"; + } + } + + /** + * Returns the user stylesheet specified in the + * <tt>TranscodingHints</tt> or null if any. + */ + public String getUserStyleSheetURI() { + return (String)getTranscodingHints().get(KEY_USER_STYLESHEET_URI); + } + + /** + * Returns the XML parser to use from the TranscodingHints. + */ + public String getXMLParserClassName() { + return (String)getTranscodingHints().get(KEY_XML_PARSER_CLASSNAME); + } + + /** + * Unsupported operation. + */ + public EventDispatcher getEventDispatcher() { + return null; + } + + /** + * Unsupported operation. + */ + public void openLink(SVGAElement elt) { } + + /** + * Unsupported operation. + */ + public void setSVGCursor(Cursor cursor) { } + + /** + * Unsupported operation. + */ + public void runThread(Thread t) { } + + /** + * Unsupported operation. + */ + public AffineTransform getTransform() { + return null; + } + + /** + * Unsupported operation. + */ + public Point getClientAreaLocationOnScreen() { + return new Point(); + } + + /** + * Tells whether the given feature is supported by this + * user agent. + */ + public boolean hasFeature(String s) { + return FEATURES.contains(s); + } + + /** + * Tells whether the given extension is supported by this + * user agent. + */ + public boolean supportExtension(String s) { + return false; + } + + public void registerExtension(BridgeExtension be) + { + } + } + + protected final static Set FEATURES = new HashSet(); + static { + FEATURES.add(SVGConstants.SVG_ORG_W3C_SVG_FEATURE); + FEATURES.add(SVGConstants.SVG_ORG_W3C_SVG_LANG_FEATURE); + FEATURES.add(SVGConstants.SVG_ORG_W3C_SVG_STATIC_FEATURE); + } + + // -------------------------------------------------------------------- + // Keys definition + // -------------------------------------------------------------------- + + /** + * The image width key. + * <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1"> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Key: </TH> + * <TD VALIGN="TOP">KEY_WIDTH</TD></TR> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Value: </TH> + * <TD VALIGN="TOP">Float</TD></TR> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Default: </TH> + * <TD VALIGN="TOP">The width of the top most svg element</TD></TR> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Required: </TH> + * <TD VALIGN="TOP">No</TD></TR> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Description: </TH> + * <TD VALIGN="TOP">Specify the width of the image to create.</TD></TR> + * </TABLE> */ + public static final TranscodingHints.Key KEY_WIDTH + = new LengthKey(); + + /** + * The image height key. + * <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1"> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Key: </TH> + * <TD VALIGN="TOP">KEY_HEIGHT</TD></TR> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Value: </TH> + * <TD VALIGN="TOP">Float</TD></TR> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Default: </TH> + * <TD VALIGN="TOP">The height of the top most svg element</TD></TR> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Required: </TH> + * <TD VALIGN="TOP">No</TD></TR> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Description: </TH> + * <TD VALIGN="TOP">Specify the height of the image to create.</TD></TR> + * </TABLE> */ + public static final TranscodingHints.Key KEY_HEIGHT + = new LengthKey(); + + /** + * The area of interest key. + * <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1"> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Key: </TH> + * <TD VALIGN="TOP">KEY_AOI</TD></TR> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Value: </TH> + * <TD VALIGN="TOP">Rectangle2D</TD></TR> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Default: </TH> + * <TD VALIGN="TOP">The document's size</TD></TR> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Required: </TH> + * <TD VALIGN="TOP">No</TD></TR> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Description: </TH> + * <TD VALIGN="TOP">Specify the area of interest to render. The + * rectangle coordinates must be specified in pixels and in the + * document coordinates system.</TD></TR> + * </TABLE> + */ + public static final TranscodingHints.Key KEY_AOI + = new Rectangle2DKey(); + + /** + * The language key. + * <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1"> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Key: </TH> + * <TD VALIGN="TOP">KEY_LANGUAGE</TD></TR> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Value: </TH> + * <TD VALIGN="TOP">String</TD></TR> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Default: </TH> + * <TD VALIGN="TOP">"en"</TD></TR> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Required: </TH> + * <TD VALIGN="TOP">No</TD></TR> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Description: </TH> + * <TD VALIGN="TOP">Specify the preferred language of the document. + * </TD></TR> + * </TABLE> + */ + public static final TranscodingHints.Key KEY_LANGUAGE + = new StringKey(); + + /** + * The user stylesheet URI key. + * <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1"> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Key: </TH> + * <TD VALIGN="TOP">KEY_USER_STYLESHEET_URI</TD></TR> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Value: </TH> + * <TD VALIGN="TOP">String</TD></TR> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Default: </TH> + * <TD VALIGN="TOP">null</TD></TR> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Required: </TH> + * <TD VALIGN="TOP">No</TD></TR> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Description: </TH> + * <TD VALIGN="TOP">Specify the user style sheet.</TD></TR> + * </TABLE> + */ + public static final TranscodingHints.Key KEY_USER_STYLESHEET_URI + = new StringKey(); + + /** + * The pixel to millimeter conversion factor key. + * <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1"> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Key: </TH> + * <TD VALIGN="TOP">KEY_PIXEL_TO_MM</TD></TR> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Value: </TH> + * <TD VALIGN="TOP">Float</TD></TR> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Default: </TH> + * <TD VALIGN="TOP">0.33</TD></TR> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Required: </TH> + * <TD VALIGN="TOP">No</TD></TR> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Description: </TH> + * <TD VALIGN="TOP">Specify the pixel to millimeter conversion factor. + * </TD></TR> + * </TABLE> + */ + public static final TranscodingHints.Key KEY_PIXEL_TO_MM + = new FloatKey(); + + /** + * The image background paint key. + * <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1"> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Key: </TH> + * <TD VALIGN="TOP">KEY_BACKGROUND_COLOR</TD></TR> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Value: </TH> + * <TD VALIGN="TOP">Paint</TD></TR> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Default: </TH> + * <TD VALIGN="TOP">null</TD></TR> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Required: </TH> + * <TD VALIGN="TOP">No</TD></TR> + * <TR> + * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Description: </TH> + * <TD VALIGN="TOP">Specify the background color to use. + * The color is required by opaque image formats and is used by + * image formats that support alpha channel.</TD></TR> + * </TABLE> + */ + public static final TranscodingHints.Key KEY_BACKGROUND_COLOR + = new PaintKey(); + +} diff --git a/src/org/apache/fop/svg/Path.java b/src/org/apache/fop/svg/Path.java deleted file mode 100644 index 64a5b0a8c..000000000 --- a/src/org/apache/fop/svg/Path.java +++ /dev/null @@ -1,121 +0,0 @@ -/*-- $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.SVGElement; - -/** - * class representing svg:Path pseudo flow object. - * - */ -public class Path extends SVGObj { - - /** - * 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 SVGElement 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")).getTransform()); - graph.setId(this.properties.get("id").getString()); - return graph; - } -} diff --git a/src/org/apache/fop/svg/Pattern.java b/src/org/apache/fop/svg/Pattern.java deleted file mode 100644 index 5f3a852f2..000000000 --- a/src/org/apache/fop/svg/Pattern.java +++ /dev/null @@ -1,161 +0,0 @@ -/*-- $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.fo.properties.*; - -import org.apache.fop.dom.svg.*; -import org.apache.fop.dom.svg.SVGArea; - -import org.w3c.dom.svg.*; -/** - * class representing svg:Pattern pseudo flow object. - * - */ -public class Pattern extends SVGObj { - - /** - * 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"; - } - - public SVGElement createGraphic() { - SVGPatternElementImpl pattern = new SVGPatternElementImpl(); - String rf = this.properties.get("xlink:href").getString(); - pattern.setHref(new SVGAnimatedStringImpl(rf)); - 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(); - pattern.setX(x == null ? null : new SVGAnimatedLengthImpl(x)); - pattern.setY(y == null ? null : new SVGAnimatedLengthImpl(y)); - pattern.setWidth(width == null ? null : - new SVGAnimatedLengthImpl(width)); - pattern.setHeight(height == null ? null : - new SVGAnimatedLengthImpl(height)); - pattern.setPatternTransform( - ((SVGTransform) this.properties.get("transform")). - getTransform()); - pattern.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) { - SVGElement impl = ((GraphicsCreator) child).createGraphic(); - if (impl != null) { - if (impl instanceof SVGElementImpl) - ((SVGElementImpl) impl).setClassName( - new SVGAnimatedStringImpl( - ((FObj) child).getProperty( - "class").getString())); - pattern.appendChild(impl); - } - } - } - switch ((this.properties.get("patternUnits")).getEnum()) { - case GenericUnits.Enums.USER_SPACE_ON_USE: - pattern.setPatternUnits( new SVGAnimatedEnumerationImpl( - SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE)); - break; - case GenericUnits.Enums.OBJECT_BOUNDING_BOX: - pattern.setPatternUnits( new SVGAnimatedEnumerationImpl( - SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)); - break; - } - return pattern; - } -} diff --git a/src/org/apache/fop/svg/Polygon.java b/src/org/apache/fop/svg/Polygon.java deleted file mode 100644 index bd53fe4de..000000000 --- a/src/org/apache/fop/svg/Polygon.java +++ /dev/null @@ -1,120 +0,0 @@ -/*-- $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.SVGElement; - -/** - * - */ -public class Polygon extends SVGObj { - - /** - * 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 SVGElement 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")).getTransform()); - graph.setId(this.properties.get("id").getString()); - return graph; - } -} diff --git a/src/org/apache/fop/svg/Polyline.java b/src/org/apache/fop/svg/Polyline.java deleted file mode 100644 index 05187eef1..000000000 --- a/src/org/apache/fop/svg/Polyline.java +++ /dev/null @@ -1,121 +0,0 @@ -/*-- $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.SVGElement; - -/** - * class representing svg:Polyline pseudo flow object. - * - */ -public class Polyline extends SVGObj { - - /** - * 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 SVGElement 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")).getTransform()); - graph.setId(this.properties.get("id").getString()); - return graph; - } -} diff --git a/src/org/apache/fop/svg/RadialGradient.java b/src/org/apache/fop/svg/RadialGradient.java deleted file mode 100644 index 36a4770ee..000000000 --- a/src/org/apache/fop/svg/RadialGradient.java +++ /dev/null @@ -1,167 +0,0 @@ -/*-- $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.fo.properties.*; - -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 SVGObj { - - /** - * inner class for making RadialGradient objects. - */ - public static class Maker extends FObj.Maker { - - /** - * make a RadialGradient object. - * - * @param parent the parent formatting object - * @param propertyList the explicit properties of this object - * - * @return the RadialGradient object - */ - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new RadialGradient(parent, propertyList); - } - } - - /** - * returns the maker for this object. - * - * @return the maker for RadialGradient objects - */ - public static FObj.Maker maker() { - return new RadialGradient.Maker(); - } - - SVGRadialGradientElementImpl radial = - new SVGRadialGradientElementImpl(); - - /** - * constructs a RadialGradient object (called by Maker). - * - * @param parent the parent formatting object - * @param propertyList the explicit properties of this object - */ - protected RadialGradient(FObj parent, PropertyList propertyList) { - super(parent, propertyList); - this.name = "svg:radialGradient"; - } - - protected void addChild(FONode child) { - super.addChild(child); - if (child instanceof Stop) { - SVGStopElement sse = ((Stop) child).createStop(); - radial.appendChild(sse); - } - } - - public SVGElement createGraphic() { - radial.setStyle( - ((SVGStyle) this.properties.get("style")).getStyle()); - radial.setTransform( - ((SVGTransform) this.properties.get("transform")). - getTransform()); - radial.setGradientTransform( - ((SVGTransform) this.properties.get("gradientTransform")). - getTransform()); - radial.setId(this.properties.get("id").getString()); - String rf = this.properties.get("xlink:href").getString(); - radial.setHref(new SVGAnimatedStringImpl(rf)); - - SVGLength length = ((SVGLengthProperty) this.properties.get("cx")). - getSVGLength(); - radial.setCx(length == null ? null : - new SVGAnimatedLengthImpl(length)); - length = ((SVGLengthProperty) this.properties.get("cy")). - getSVGLength(); - radial.setCy(length == null ? null : - new SVGAnimatedLengthImpl(length)); - length = ((SVGLengthProperty) this.properties.get("r")). - getSVGLength(); - radial.setR(length == null ? null : - new SVGAnimatedLengthImpl(length)); - length = ((SVGLengthProperty) this.properties.get("fx")). - getSVGLength(); - radial.setFx(length == null ? null : - new SVGAnimatedLengthImpl(length)); - length = ((SVGLengthProperty) this.properties.get("fy")). - getSVGLength(); - radial.setFy(length == null ? null : - new SVGAnimatedLengthImpl(length)); - switch ((this.properties.get("gradientUnits")).getEnum()) { - case GenericUnits.Enums.USER_SPACE_ON_USE: - radial.setGradientUnits( new SVGAnimatedEnumerationImpl( - SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE)); - break; - case GenericUnits.Enums.OBJECT_BOUNDING_BOX: - radial.setGradientUnits( new SVGAnimatedEnumerationImpl( - SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)); - break; - } - return radial; - } -} diff --git a/src/org/apache/fop/svg/Rect.java b/src/org/apache/fop/svg/Rect.java deleted file mode 100644 index 49e3b741b..000000000 --- a/src/org/apache/fop/svg/Rect.java +++ /dev/null @@ -1,154 +0,0 @@ -/*-- $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.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 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; -import org.w3c.dom.svg.SVGElement; - -/** - * class representing svg:rect pseudo flow object. - */ -public class Rect extends SVGObj { - - /** - * inner class for making Rect objects. - */ - public static class Maker extends FObj.Maker { - - /** - * make a Rect object. - * - * @param parent the parent formatting object - * @param propertyList the explicit properties of this object - * - * @return the Rect object - */ - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new Rect(parent, propertyList); - } - } - - /** - * returns the maker for this object. - * - * @return the maker for Rect objects - */ - public static FObj.Maker maker() { - return new Rect.Maker(); - } - - /** - * constructs a Rect object (called by Maker). - * - * @param parent the parent formatting object - * @param propertyList the explicit properties of this object - */ - protected Rect(FObj parent, PropertyList propertyList) { - super(parent, propertyList); - this.name = "svg:rect"; - } - - public SVGElement createGraphic() { - /* retrieve properties */ - SVGLength width = - ((SVGLengthProperty) this.properties.get("width")). - getSVGLength(); - SVGLength height = - ((SVGLengthProperty) this.properties.get("height")). - getSVGLength(); - SVGLength length = new SVGLengthImpl(); - SVGLength lengthProp = - ((SVGLengthProperty) this.properties.get("x")). - getSVGLength(); - SVGLength x = lengthProp == null ? length : lengthProp; - lengthProp = ((SVGLengthProperty) this.properties.get("y")). - getSVGLength(); - length = new SVGLengthImpl(); - SVGLength y = lengthProp == null ? length : lengthProp; - lengthProp = ((SVGLengthProperty) this.properties.get("rx")). - getSVGLength(); - length = new SVGLengthImpl(); - SVGLength rx = lengthProp == null ? length : lengthProp; - lengthProp = ((SVGLengthProperty) this.properties.get("ry")). - getSVGLength(); - length = new SVGLengthImpl(); - SVGLength ry = lengthProp == null ? length : lengthProp; - SVGRectElementImpl graph = new SVGRectElementImpl(); - graph.setX(new SVGAnimatedLengthImpl(x)); - graph.setY(new SVGAnimatedLengthImpl(y)); - graph.setRx(new SVGAnimatedLengthImpl(rx)); - graph.setRy(new SVGAnimatedLengthImpl(ry)); - graph.setWidth(new SVGAnimatedLengthImpl(width)); - graph.setHeight(new SVGAnimatedLengthImpl(height)); - graph.setStyle( - ((SVGStyle) this.properties.get("style")).getStyle()); - graph.setTransform( - ((SVGTransform) this.properties.get("transform")). - getTransform()); - graph.setId(this.properties.get("id").getString()); - return graph; - } -} diff --git a/src/org/apache/fop/svg/SVG.java b/src/org/apache/fop/svg/SVG.java index afa9ab336..3b9b18c02 100644 --- a/src/org/apache/fop/svg/SVG.java +++ b/src/org/apache/fop/svg/SVG.java @@ -59,18 +59,17 @@ import org.apache.fop.layout.FontState; import org.apache.fop.apps.FOPException; import org.apache.fop.layout.inline.*; -import org.apache.fop.dom.svg.*; +import org.apache.batik.dom.svg.*; +import org.w3c.dom.*; import org.w3c.dom.svg.*; import org.w3c.dom.svg.SVGLength; -import org.apache.fop.dom.svg.SVGArea; - -import java.util.StringTokenizer; +import java.io.File; /** * class representing svg:svg pseudo flow object. */ -public class SVG extends FObj implements GraphicsCreator { +public class SVG extends SVGObj implements GraphicsCreator { /** * inner class for making SVG objects. @@ -101,8 +100,6 @@ public class SVG extends FObj implements GraphicsCreator { } FontState fs; - float width; - float height; /** * constructs an SVG object (called by Maker). @@ -113,49 +110,128 @@ public class SVG extends FObj implements GraphicsCreator { public SVG(FObj parent, PropertyList propertyList) { super(parent, propertyList); this.name = "svg:svg"; + tagName = "svg"; + props = new String[] {"width", "height", "x", "y", "id", "style", "class", "visibility", + "id", + "class", + + + + "enable-background", + + + "flood-color", + "flood-opacity", + + + "fill", + "fill-opacity", + "fill-rule", + "stroke", + "stroke-dasharray", + "stroke-dashoffset", + "stroke-linecap", + "stroke-linejoin", + "stroke-miterlimit", + "stroke-opacity", + "stroke-width", + + + "font-family", + "font-size", + "font-size-adjust", + "font-stretch", + "font-style", + "font-variant", + "font-weight", + + + "stop-color", + "stop-opacity", + + + "clip-path", + "clip-rule", + "color", + "color-interpolation", + "color-rendering", + "cursor", + "display", + "filter", + "image-rendering", + "mask", + "opacity", + "pointer-events", + "space-rendering", + "text-rendering", + "visibility", + + + "color-profile", + + + "lighting-color", + + + "marker-start", + "marker-mid", + "marker-end", + + + "alignment-baseline", + "baseline-shift", + "direction", + "glyph-orientation-horizontal", + "glyph-orientation-vertical", + "kerning", + "letter-spacing", + "text-decoration", + "unicode-bidi", + "word-spacing", + + + "writing-mode", + "text-anchor", + "dominant-baseline", + + + "clip", + "overflow", + + + "id", + "style", + "transform", + "class", + }; } - public SVGElement createGraphic() { +/* public void addGraphic(Document doc, Element parent) { + Element element = doc.createElement(tagName); + for(int count = 0; count < props.length; count++) { + String rf = this.properties.get(props[count]).getString(); + element.setAttribute(props[count], rf); + } + parent.appendChild(element); + int numChildren = this.children.size(); + for (int i = 0; i < numChildren; i++) { + Object child = children.elementAt(i); + if (child instanceof GraphicsCreator) { + ((GraphicsCreator)child).addGraphic(doc, element); + } else if (child instanceof String) { + org.w3c.dom.Text text = doc.createTextNode((String)child); + element.appendChild(text); + } + } + }*/ + +/* public SVGElement createGraphic() { SVGSVGElementImpl svgArea = null; SVGLength w = ((SVGLengthProperty) this.properties.get("width")). getSVGLength(); SVGLength h = ((SVGLengthProperty) this.properties.get("height")). getSVGLength(); svgArea = new SVGSVGElementImpl(); - { - String box = this.properties.get("viewBox").getString(); - if (box != "") { - StringTokenizer st = new StringTokenizer(box, " "); - float x = 0; - float y = 0; - float width = 0; - float height = 0; - try { - if(st.hasMoreTokens()) { - x = Double.valueOf(st.nextToken()).floatValue(); - } - if(st.hasMoreTokens()) { - y = Double.valueOf(st.nextToken()).floatValue(); - } - if(st.hasMoreTokens()) { - width = Double.valueOf(st.nextToken()).floatValue(); - } - if(st.hasMoreTokens()) { - height = Double.valueOf(st.nextToken()).floatValue(); - } - } catch(Exception e) { - } - SVGRect rect = new SVGRectImpl(); - rect.setX(x); - rect.setY(y); - rect.setWidth(width); - rect.setHeight(height); - svgArea.setViewBox (new SVGAnimatedRectImpl (rect)); - } else { - svgArea.setViewBox (null); - } - } - SVGAnimatedLengthImpl sal; if (w == null) w = new SVGLengthImpl(); @@ -206,7 +282,7 @@ public class SVG extends FObj implements GraphicsCreator { Status status; } return svgArea; - } + }*/ /** * layout this formatting object. @@ -235,45 +311,79 @@ public class SVG extends FObj implements GraphicsCreator { this.properties.get("font-style").getString(); String fontWeight = this.properties.get("font-weight").getString(); - int fontSize = - this.properties.get("font-size").getLength().mvalue(); + String fontSz = this.properties.get("font-size").getString(); + int fontSize = area.getFontState().getFontSize(); + try { + fontSize = Integer.parseInt(fontSz); + } catch(Exception e) { + } // FIX-ME: should get the font-variant property this.fs = new FontState(area.getFontInfo(), fontFamily, fontStyle, fontWeight, fontSize, FontVariant.NORMAL); - SVGLength length; - length = ((SVGLengthProperty) this.properties.get("width")).getSVGLength(); - if (length == null) - length = new SVGLengthImpl(); - this.width = length.getValue(); - length = ((SVGLengthProperty) this.properties.get("height")). - getSVGLength(); - if (length == null) - length = new SVGLengthImpl(); - this.height = length.getValue(); +// this.width = this.properties.get("width").getString(); +// this.height = this.properties.get("height").getString(); this.marker = 0; } /* create an SVG area */ /* if width and height are zero, may want to get the bounds of the content. */ + SVGOMDocument doc = new SVGOMDocument(null, SVGDOMImplementation.getDOMImplementation()); + try { + doc.setURLObject(new File(".").toURL()); + } catch(Exception e) { + } + + DefaultSVGContext dc = new DefaultSVGContext() { + public float getPixelToMM() { + return 0.264583333333333333333f; // 72 dpi + } + public float getViewportWidth() { + return 100; + } + public float getViewportHeight() { + return 100; + } + }; + doc.setSVGContext(dc); + + Element topLevel = doc.createElementNS("http://www.w3.org/2000/svg", tagName); + for(int count = 0; count < props.length; count++) { + if(this.properties.get(props[count]) != null) { + String rf = this.properties.get(props[count]).getString(); + if(rf != null) + topLevel.setAttribute(props[count], rf); + } + } + doc.appendChild(topLevel); + int numChildren = this.children.size(); + for (int i = 0; i < numChildren; i++) { + Object child = children.elementAt(i); + if (child instanceof GraphicsCreator) { + ((GraphicsCreator)child).addGraphic(doc, topLevel); + } else if (child instanceof String) { + org.w3c.dom.Text text = doc.createTextNode((String)child); + topLevel.appendChild(text); + } + } + + float width = ((SVGSVGElement)topLevel).getWidth().getBaseVal().getValue(); + float height = ((SVGSVGElement)topLevel).getHeight().getBaseVal().getValue(); SVGArea svg = new SVGArea(fs, width, height); - SVGDocument doc = new SVGDocumentImpl(); svg.setSVGDocument(doc); svg.start(); + /* finish off the SVG area */ + svg.end(); + /* add the SVG area to the containing area */ ForeignObjectArea foa = (ForeignObjectArea) area; foa.setObject(svg); foa.setIntrinsicWidth(svg.getWidth()); foa.setIntrinsicHeight(svg.getHeight()); - doc.appendChild((SVGSVGElement) createGraphic()); - - /* finish off the SVG area */ - svg.end(); - /* return status */ return new Status(Status.OK); } diff --git a/src/org/apache/fop/dom/svg/SVGArea.java b/src/org/apache/fop/svg/SVGArea.java index 58c3fee68..ea7e60d9d 100644 --- a/src/org/apache/fop/dom/svg/SVGArea.java +++ b/src/org/apache/fop/svg/SVGArea.java @@ -48,13 +48,12 @@ Software Foundation, please see <http://www.apache.org/>. */ -package org.apache.fop.dom.svg; +package org.apache.fop.svg; // FOP import org.apache.fop.render.Renderer; import org.apache.fop.layout.FontState; import org.apache.fop.layout.Area; -import org.apache.fop.dom.svg.*; import java.util.*; diff --git a/src/org/apache/fop/svg/SVGD.java b/src/org/apache/fop/svg/SVGD.java deleted file mode 100644 index 7fab240ce..000000000 --- a/src/org/apache/fop/svg/SVGD.java +++ /dev/null @@ -1,130 +0,0 @@ -/*-- $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, - FObj fo) 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, "", null); - } - } - - /** - * returns the maker for this object. - * - * @return the maker for SVG Length objects - */ - public static Property.Maker maker(String propName) { - 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.style = explicitValue; - } - - /** - * get the length - * - * @return the length as a Length object - */ - public Vector getPath() { - return this.style.getPath(); - } -} diff --git a/src/org/apache/fop/svg/SVGDriver.java b/src/org/apache/fop/svg/SVGDriver.java index caa56640d..0bb662f1e 100644 --- a/src/org/apache/fop/svg/SVGDriver.java +++ b/src/org/apache/fop/svg/SVGDriver.java @@ -54,7 +54,6 @@ package org.apache.fop.svg; // FOP import org.apache.fop.fo.*; import org.apache.fop.apps.*; -import org.apache.fop.dom.svg.*; import org.apache.fop.fo.FOTreeBuilder; import org.apache.fop.fo.ElementMapping; import org.apache.fop.fo.PropertyListMapping; diff --git a/src/org/apache/fop/svg/SVGElementMapping.java b/src/org/apache/fop/svg/SVGElementMapping.java index bdedf174e..cb7305750 100644 --- a/src/org/apache/fop/svg/SVGElementMapping.java +++ b/src/org/apache/fop/svg/SVGElementMapping.java @@ -53,12 +53,11 @@ package org.apache.fop.svg; import org.apache.fop.fo.TreeBuilder; import org.apache.fop.fo.FOTreeBuilder; import org.apache.fop.fo.ElementMapping; -import org.apache.fop.dom.svg.SVGDocumentImpl; public class SVGElementMapping implements ElementMapping { public void addToBuilder(TreeBuilder builder) { - String uri = SVGDocumentImpl.namespaceURI; + String uri = "http://www.w3.org/2000/svg"; builder.addMapping(uri, "svg", SVG.maker()); builder.addMapping(uri, "rect", Rect.maker()); builder.addMapping(uri, "line", Line.maker()); @@ -74,8 +73,8 @@ public class SVGElementMapping implements ElementMapping { 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, "tspan", Tspan.maker()); + builder.addMapping(uri, "tref", Tref.maker()); builder.addMapping(uri, "image", Image.maker()); builder.addMapping(uri, "style", Style.maker()); @@ -99,13 +98,19 @@ public class SVGElementMapping implements ElementMapping { 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, "hkern", Hkern.maker()); + builder.addMapping(uri, "vkern", Vkern.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, "cursor", Cursor.maker()); builder.addMapping(uri, "filter", Filter.maker()); + + builder.addMapping(uri, "feFlood", FeFlood.maker()); + builder.addMapping(uri, "feGaussianBlur", FeGaussianBlur.maker()); + builder.addMapping(uri, "feOffset", FeOffset.maker()); + builder.addMapping(uri, "feMerge", FeMerge.maker()); + builder.addMapping(uri, "feMergeNode", FeMergeNode.maker()); } } diff --git a/src/org/apache/fop/svg/SVGLengthListProperty.java b/src/org/apache/fop/svg/SVGLengthListProperty.java deleted file mode 100644 index bdbe25656..000000000 --- a/src/org/apache/fop/svg/SVGLengthListProperty.java +++ /dev/null @@ -1,145 +0,0 @@ -/*-- $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.*; - -import org.w3c.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, - FObj fo) throws FOPException { - SVGAnimatedLengthListImpl anime = - new SVGAnimatedLengthListImpl(); - SVGLengthListImpl len = new SVGLengthListImpl(); - anime.setBaseVal(len); - len.setValueAsString(value); - return new SVGLengthListProperty(propertyList, anime); - } - - /** - * 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, "", null); - } - } - - /** - * returns the maker for this object. - * - * @return the maker for SVG Length objects - */ - public static Property.Maker maker() { - return new SVGLengthListProperty.Maker(); - } - - public static Property.Maker maker(String propName) { - return new SVGLengthListProperty.Maker(); - } - - /** the length as a Length object */ - protected SVGAnimatedLengthList 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, - SVGAnimatedLengthList explicitValue) { - this.value = explicitValue; - } - - /** - * get the length - * - * @return the length as a Length object - */ - public SVGAnimatedLengthList getSVGLengthList() { - return this.value; - } -} diff --git a/src/org/apache/fop/svg/SVGLengthProperty.java b/src/org/apache/fop/svg/SVGLengthProperty.java deleted file mode 100644 index da30e761e..000000000 --- a/src/org/apache/fop/svg/SVGLengthProperty.java +++ /dev/null @@ -1,143 +0,0 @@ -/*-- $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, - FObj fo) throws FOPException { - SVGLengthImpl len = new SVGLengthImpl(); - len.setValueAsString(value); - return new SVGLengthProperty(propertyList, len); - } - - /** - * make an SVG Length property with the default value. - * - * @param propertyList the property list the property is a member of - */ - public Property make(PropertyList propertyList) - throws FOPException { - return new SVGLengthProperty(propertyList, null); - } - } - - /** - * returns the maker for this object. - * - * @return the maker for SVG Length objects - */ - public static Property.Maker maker() { - return new SVGLengthProperty.Maker(); - } - - /** - * returns the maker for this object. - * @param propName the name of the property (used with new - * property mapping scheme) - * @return the maker for SVG Length objects - */ - public static Property.Maker maker(String propName) { - 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.value = explicitValue; - } - - /** - * get the length - * - * @return the length as a Length object - */ - public SVGLengthImpl getSVGLength() { - return this.value; - } -} diff --git a/src/org/apache/fop/svg/SVGObj.java b/src/org/apache/fop/svg/SVGObj.java index c41b58cef..c5d53ad6f 100644 --- a/src/org/apache/fop/svg/SVGObj.java +++ b/src/org/apache/fop/svg/SVGObj.java @@ -57,9 +57,12 @@ 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.batik.dom.svg.*; -import org.w3c.dom.svg.SVGElement; +import org.w3c.dom.svg.*; +import org.w3c.dom.*; + +import java.util.*; /** * Since SVG objects are not layed out then this class checks @@ -68,6 +71,8 @@ import org.w3c.dom.svg.SVGElement; */ public abstract class SVGObj extends FObj implements GraphicsCreator { + String tagName = ""; + String[] props = {}; /** * * @param parent the parent formatting object @@ -77,10 +82,42 @@ public abstract class SVGObj extends FObj implements GraphicsCreator { super(parent, propertyList); } - public SVGElement createGraphic() - { - return null; - } + protected static Hashtable ns = new Hashtable(); + + public void addGraphic(Document doc, Element parent) { + Element element = doc.createElementNS("http://www.w3.org/2000/svg", tagName); +// Element element = doc.createElement(tagName); + for(int count = 0; count < props.length; count++) { + if(this.properties.get(props[count]) != null) { + String rf = this.properties.get(props[count]).getString(); + if(rf != null) { + if(props[count].indexOf(":") == -1) { + element.setAttribute(props[count], rf); + } else { + String pref = props[count].substring(0, props[count].indexOf(":")); +System.out.println(pref); + if(pref.equals("xmlns")) { + ns.put(props[count].substring(props[count].indexOf(":") + 1), rf); +System.out.println(ns); + } + ns.put("xlink", "http://www.w3.org/1999/xlink"); + element.setAttributeNS((String)ns.get(pref), props[count], rf); + } + } + } + } + parent.appendChild(element); + int numChildren = this.children.size(); + for (int i = 0; i < numChildren; i++) { + Object child = children.elementAt(i); + if (child instanceof GraphicsCreator) { + ((GraphicsCreator)child).addGraphic(doc, element); + } else if (child instanceof String) { + org.w3c.dom.Text text = doc.createTextNode((String)child); + element.appendChild(text); + } + } + } /** * layout this formatting object. @@ -90,11 +127,11 @@ public abstract class SVGObj extends FObj implements GraphicsCreator { */ public Status layout(Area area) throws FOPException { - if (area instanceof SVGArea) { - } else { +// if (area instanceof SVGArea) { +// } else { /* otherwise generate a warning */ System.err.println("WARNING: " + this.name + " outside svg:svg"); - } +// } /* return status */ return new Status(Status.OK); diff --git a/src/org/apache/fop/svg/SVGPropertyListMapping.java b/src/org/apache/fop/svg/SVGPropertyListMapping.java index e6b8940e5..3754194ae 100644 --- a/src/org/apache/fop/svg/SVGPropertyListMapping.java +++ b/src/org/apache/fop/svg/SVGPropertyListMapping.java @@ -53,7 +53,6 @@ package org.apache.fop.svg; import org.apache.fop.fo.*; import org.apache.fop.fo.properties.SVGPropertyMapping; -import org.apache.fop.dom.svg.SVGDocumentImpl; import java.util.Enumeration; @@ -61,7 +60,7 @@ public class SVGPropertyListMapping implements PropertyListMapping { public void addToBuilder(TreeBuilder builder) { - String uri = SVGDocumentImpl.namespaceURI; + String uri = "http://www.w3.org/2000/svg"; builder.addPropertyList(uri, SVGPropertyMapping.getGenericMappings()); /* Add any element mappings */ for (Enumeration e = SVGPropertyMapping.getElementMappings(); diff --git a/src/org/apache/fop/svg/SVGStringProperty.java b/src/org/apache/fop/svg/SVGStringProperty.java index 507e19c96..6fb768d71 100644 --- a/src/org/apache/fop/svg/SVGStringProperty.java +++ b/src/org/apache/fop/svg/SVGStringProperty.java @@ -54,10 +54,8 @@ 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 */ @@ -95,7 +93,7 @@ public class SVGStringProperty extends Property { */ public Property make(PropertyList propertyList) throws FOPException { - return make(propertyList, "", null); + return make(propertyList, null, null); } } @@ -104,7 +102,7 @@ public class SVGStringProperty extends Property { * * @return the maker for SVG Length objects */ - public static Property.Maker maker() { + public static Property.Maker maker(String name) { return new SVGStringProperty.Maker(); } diff --git a/src/org/apache/fop/svg/SVGStyle.java b/src/org/apache/fop/svg/SVGStyle.java deleted file mode 100644 index 28bc62fa5..000000000 --- a/src/org/apache/fop/svg/SVGStyle.java +++ /dev/null @@ -1,132 +0,0 @@ -/*-- $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.*; - -import org.w3c.dom.css.CSSStyleDeclaration; - -/** - * - */ -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, - FObj fo) 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, "", null); - } - } - - /** - * returns the maker for this object. - * - * @return the maker for SVG Length objects - */ - public static Property.Maker maker(String propName) { - 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.style = explicitValue; - } - - /** - * get the length - * - * @return the length as a Length object - */ - public CSSStyleDeclaration getStyle() { - return this.style.getStyle(); - } -} diff --git a/src/org/apache/fop/svg/SVGTransform.java b/src/org/apache/fop/svg/SVGTransform.java deleted file mode 100644 index 834621525..000000000 --- a/src/org/apache/fop/svg/SVGTransform.java +++ /dev/null @@ -1,131 +0,0 @@ -/*-- $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.w3c.dom.svg.SVGAnimatedTransformList; - -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, - FObj fo) 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, "", null); - } - } - - /** - * returns the maker for this object. - * - * @return the maker for SVG Length objects - */ - public static Property.Maker maker(String propName) { - 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.trans = explicitValue; - } - - /** - * - * @return the length as a Length object - */ - public SVGAnimatedTransformList getTransform() { - return this.trans.getTransform(); - } -} diff --git a/src/org/apache/fop/svg/Set.java b/src/org/apache/fop/svg/Set.java deleted file mode 100644 index d35dd254f..000000000 --- a/src/org/apache/fop/svg/Set.java +++ /dev/null @@ -1,106 +0,0 @@ -/*-- $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 SVGObj { - - /** - * 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"; - } -} diff --git a/src/org/apache/fop/svg/Stop.java b/src/org/apache/fop/svg/Stop.java deleted file mode 100644 index 76f0e1af5..000000000 --- a/src/org/apache/fop/svg/Stop.java +++ /dev/null @@ -1,120 +0,0 @@ -/*-- $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 SVGObj { - - /** - * 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(new SVGAnimatedNumberImpl(offset.getValue())); // what about percentages - sse.setId(this.properties.get("id").getString()); - return sse; - } -} diff --git a/src/org/apache/fop/svg/Style.java b/src/org/apache/fop/svg/Style.java deleted file mode 100644 index 676ec7b56..000000000 --- a/src/org/apache/fop/svg/Style.java +++ /dev/null @@ -1,125 +0,0 @@ -/*-- $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:Style pseudo flow object. - * - */ -public class Style extends SVGObj { - - /** - * 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"; - } - - String styleText = ""; - protected void addCharacters(char data[], int start, int length) - { - styleText += new String(data, start, length - start); - } - - public SVGElement createGraphic() - { - SVGStyleElement sse = new SVGStyleElementImpl(styleText); -// sse.setType(this.properties.get("type").getString()); -// sse.setMedia(this.properties.get("media").getString()); -// sse.setTitle(this.properties.get("title").getString()); -// sse.setStyle(styleText); - return sse; - } -} diff --git a/src/org/apache/fop/svg/Switch.java b/src/org/apache/fop/svg/Switch.java deleted file mode 100644 index caece1c73..000000000 --- a/src/org/apache/fop/svg/Switch.java +++ /dev/null @@ -1,167 +0,0 @@ -/*-- $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.*; - -/** - * - */ -public class Switch extends SVGObj { - - /** - * inner class for making Line objects. - */ - public static class Maker extends FObj.Maker { - - /** - * make a Line object. - * - * @param parent the parent formatting object - * @param propertyList the explicit properties of this object - * - * @return the Line object - */ - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new 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"; - } - - public SVGElement createGraphic() { - /* - * There are two options - * 1) add all children and select the correct one when rendering - * 2) select the correct one now and return it rather than a switch element - * Since renderers may have different ideas, leave it up to the renderer - * to select the correct one. - */ - String rf = this.properties.get("requiredFeatures").getString(); - String re = this.properties.get("requiredExtensions").getString(); - String sl = this.properties.get("systemLanguage").getString(); - SVGStringListImpl strlist; - GraphicElement graphic; - graphic = new SVGSwitchElementImpl(); - if (!rf.equals("notpresent")) { - strlist = new SVGStringListImpl(rf); - graphic.setRequiredFeatures(strlist); - } - if (!re.equals("notpresent")) { - strlist = new SVGStringListImpl(re); - graphic.setRequiredExtensions(strlist); - } - if (!sl.equals("notpresent")) { - strlist = new SVGStringListImpl(sl); - graphic.setSystemLanguage(strlist); - } - - int numChildren = this.children.size(); - for (int i = 0; i < numChildren; i++) { - FONode child = (FONode) children.elementAt(i); - if (child instanceof GraphicsCreator) { - SVGElement impl = ((GraphicsCreator) child).createGraphic(); - if (impl instanceof GraphicElement) { - GraphicElement testable = (GraphicElement) impl; - rf = child.getProperty("requiredFeatures").getString(); - re = child.getProperty( - "requiredExtensions").getString(); - sl = child.getProperty("systemLanguage").getString(); - if (!rf.equals("notpresent")) { - strlist = new SVGStringListImpl(rf); - testable.setRequiredFeatures(strlist); - } - if (!re.equals("notpresent")) { - strlist = new SVGStringListImpl(re); - testable.setRequiredExtensions(strlist); - } - if (!sl.equals("notpresent")) { - strlist = new SVGStringListImpl(sl); - testable.setSystemLanguage(strlist); - } - graphic.appendChild((GraphicElement) impl); - } - } else if (child instanceof Defs) { - } - } - - return graphic; - } -} diff --git a/src/org/apache/fop/svg/Symbol.java b/src/org/apache/fop/svg/Symbol.java deleted file mode 100644 index f119e220e..000000000 --- a/src/org/apache/fop/svg/Symbol.java +++ /dev/null @@ -1,156 +0,0 @@ -/*-- $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 java.util.StringTokenizer; - -/** - * - */ -public class Symbol extends SVGObj { - - /** - * 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"; - } - - public SVGElement createGraphic() - { - String box = this.properties.get("viewBox").getString(); - StringTokenizer st = new StringTokenizer(box, " "); - float x = 0; - float y = 0; - float width = 0; - float height = 0; - try { - if(st.hasMoreTokens()) { - x = Double.valueOf(st.nextToken()).floatValue(); - } - if(st.hasMoreTokens()) { - y = Double.valueOf(st.nextToken()).floatValue(); - } - if(st.hasMoreTokens()) { - width = Double.valueOf(st.nextToken()).floatValue(); - } - if(st.hasMoreTokens()) { - height = Double.valueOf(st.nextToken()).floatValue(); - } - } catch(Exception e) { - } - SVGRect rect = new SVGRectImpl(); - rect.setX(x); - rect.setY(y); - rect.setWidth(width); - rect.setHeight(height); - SVGSymbolElementImpl graphic; - graphic = new SVGSymbolElementImpl(); - String id = this.properties.get("id").getString(); - graphic.setId(id); - graphic.setViewBox(new SVGAnimatedRectImpl(rect)); - - int numChildren = this.children.size(); - for (int i = 0; i < numChildren; i++) { - FONode child = (FONode) children.elementAt(i); - if(child instanceof GraphicsCreator) { - SVGElement impl = ((GraphicsCreator)child).createGraphic(); - graphic.appendChild(impl); - } - } - - return graphic; - } -} diff --git a/src/org/apache/fop/svg/TRef.java b/src/org/apache/fop/svg/TRef.java deleted file mode 100644 index 8d4f93846..000000000 --- a/src/org/apache/fop/svg/TRef.java +++ /dev/null @@ -1,130 +0,0 @@ -/*-- $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.*; - -/** - * - */ -public class TRef extends SVGObj 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 SVGElement createTextElement() - { - SVGTRefElementImpl tref = new SVGTRefElementImpl(); - tref.setStyle(((SVGStyle)this.properties.get("style")).getStyle()); - Property prop; - prop = this.properties.get("x"); - SVGAnimatedLengthList xlist = ((SVGLengthListProperty)prop).getSVGLengthList(); - tref.xlist = xlist; - prop = this.properties.get("y"); - SVGAnimatedLengthList ylist = ((SVGLengthListProperty)prop).getSVGLengthList(); - tref.ylist = ylist; - prop = this.properties.get("dx"); - SVGAnimatedLengthList dxlist = ((SVGLengthListProperty)prop).getSVGLengthList(); - tref.dxlist = dxlist; - prop = this.properties.get("dy"); - SVGAnimatedLengthList dylist = ((SVGLengthListProperty)prop).getSVGLengthList(); - tref.dylist = dylist; - tref.ref = this.properties.get("xlink:href").getString(); - tref.setId(this.properties.get("id").getString()); - return tref; - } -} diff --git a/src/org/apache/fop/svg/TSpan.java b/src/org/apache/fop/svg/TSpan.java deleted file mode 100644 index f4b7624c5..000000000 --- a/src/org/apache/fop/svg/TSpan.java +++ /dev/null @@ -1,148 +0,0 @@ -/*-- $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.CharacterDataImpl; -import org.apache.fop.dom.svg.*; -import org.apache.fop.dom.svg.SVGArea; - -import org.w3c.dom.svg.SVGElement; -import org.w3c.dom.CharacterData; - -/** - * class representing svg:tspan pseudo flow object. - * - */ -public class TSpan extends SVGObj 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); - CharacterData cd = new CharacterDataImpl(); - cd.setData(text); - tspan.appendChild(cd); -// tspan.str = this.text; - } - - /** - * 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 SVGElement createTextElement() - { - tspan.setStyle(((SVGStyle)this.properties.get("style")).getStyle()); -/* CharacterData cd = new CharacterDataImpl(); - cd.setData(text); - tspan.appendChild(cd);*/ - Property prop; - prop = this.properties.get("x"); - tspan.xlist = ((SVGLengthListProperty)prop).getSVGLengthList(); - prop = this.properties.get("y"); - tspan.ylist = ((SVGLengthListProperty)prop).getSVGLengthList(); - prop = this.properties.get("dx"); - tspan.dxlist = ((SVGLengthListProperty)prop).getSVGLengthList(); - prop = this.properties.get("dy"); - tspan.dylist = ((SVGLengthListProperty)prop).getSVGLengthList(); - tspan.setId(this.properties.get("id").getString()); - return tspan; - } -} diff --git a/src/org/apache/fop/svg/Text.java b/src/org/apache/fop/svg/Text.java deleted file mode 100644 index 9b03852e6..000000000 --- a/src/org/apache/fop/svg/Text.java +++ /dev/null @@ -1,191 +0,0 @@ -/*-- $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.messaging.MessageHandler; -import org.apache.fop.layout.Area; -import org.apache.fop.layout.FontState; -import org.apache.fop.apps.FOPException; -import org.apache.fop.fo.properties.XMLSpace; -import org.apache.fop.fo.properties.TextAnchor; - -import java.util.*; - -import org.apache.fop.dom.svg.*; -import org.apache.fop.dom.svg.SVGTextElementImpl; -import org.apache.fop.dom.svg.SVGArea; -import org.apache.fop.dom.CharacterDataImpl; - -import org.w3c.dom.svg.*; -import org.w3c.dom.svg.SVGLength; -import org.w3c.dom.CharacterData; - -/** - * class representing svg:text pseudo flow object. - * - */ -public class Text extends SVGObj { - - /** - * inner class for making SVG Text objects. - */ - public static class Maker extends FObj.Maker { - - /** - * make an SVG Text object. - * - * @param parent the parent formatting object - * @param propertyList the explicit properties of this object - * - * @return the SVG Text object - */ - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new Text(parent, propertyList); - } - } - - /** - * returns the maker for this object. - * - * @return the maker for SVG Text objects - */ - public static FObj.Maker maker() { - return new Text.Maker(); - } - - /** - * the string of text to display - */ - Vector textList = new Vector(); - - /** - * constructs an SVG Text object (called by Maker). - * - * @param parent the parent formatting object - * @param propertyList the explicit properties of this object - */ - protected Text(FObj parent, PropertyList propertyList) { - super(parent, propertyList); - this.name = "svg:text"; - } - - SVGTextElementImpl textGraph = new SVGTextElementImpl(); - - /** - * add characters to the string to display. - * - * @param data array of characters - * @param start start offset in character array - * @param length number of characters to add - */ - protected void addCharacters(char data[], int start, int length) { - textList.addElement(new String(data, start, length - start)); - } - - /** - * The children need to be added in order so that the text data - * is also added in order. - */ - protected void addChild(FONode child) { - super.addChild(child); - if (child instanceof TextElement) { - TextElement te = (TextElement) child; - SVGElement graph = te.createTextElement(); - textList.addElement(graph); - } else { - // error - } - } - - public SVGElement createGraphic() { - int numChildren = this.textList.size(); - for (int i = 0; i < numChildren; i++) { - Object obj = textList.elementAt(i); - if (obj instanceof SVGElement) { - SVGElement child = (SVGElement) obj; - textGraph.appendChild(child); - } else if (obj instanceof String) { - String str = (String) obj; - CharacterData cd = new CharacterDataImpl(); - cd.setData(str); - textGraph.appendChild(cd); - } - // System.out.println(child); - } - /* retrieve properties */ - SVGLength prop; - prop = ((SVGLengthProperty) this.properties.get("x")).getSVGLength(); - textGraph.x = prop == null ? 0 : prop.getValue(); - prop = ((SVGLengthProperty) this.properties.get("y")).getSVGLength(); - textGraph.y = prop == null ? 0 : prop.getValue(); - textGraph.anchor = ((EnumProperty) this.properties.get("text-anchor")); - // textGraph.textList = textList; - textGraph.setStyle( - ((SVGStyle) this.properties.get("style")).getStyle()); - textGraph.setTransform( - ((SVGTransform) this.properties.get("transform")). - getTransform()); - textGraph.setId(this.properties.get("id").getString()); - switch ((this.properties.get("xml:space")).getEnum()) { - case XMLSpace.DEFAULT: - textGraph.setXMLspace("default"); - break; - case XMLSpace.PRESERVE: - textGraph.setXMLspace("preserve"); - break; - } - return textGraph; - } -} diff --git a/src/org/apache/fop/svg/TextElement.java b/src/org/apache/fop/svg/TextElement.java index 92486066b..fb63bbe40 100644 --- a/src/org/apache/fop/svg/TextElement.java +++ b/src/org/apache/fop/svg/TextElement.java @@ -51,8 +51,6 @@ package org.apache.fop.svg; -import org.apache.fop.dom.svg.*; - import org.w3c.dom.svg.SVGElement; /** diff --git a/src/org/apache/fop/svg/TextPath.java b/src/org/apache/fop/svg/TextPath.java deleted file mode 100644 index 0e1c96799..000000000 --- a/src/org/apache/fop/svg/TextPath.java +++ /dev/null @@ -1,124 +0,0 @@ -/*-- $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.SVGElement; - -/** - * class representing svg:TextPath pseudo flow object. - * - */ -public class TextPath extends SVGObj 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 SVGElement 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; - } -} diff --git a/src/org/apache/fop/svg/Title.java b/src/org/apache/fop/svg/Title.java deleted file mode 100644 index a8f8cd89a..000000000 --- a/src/org/apache/fop/svg/Title.java +++ /dev/null @@ -1,119 +0,0 @@ -/*-- $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; - -/** - * - */ -public class Title extends SVGObj { - - /** - * 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(); - } - - /** - * the title string - */ - protected String text = ""; - - /** - * 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"; - } - - /** - * 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); - } -} diff --git a/src/org/apache/fop/svg/Use.java b/src/org/apache/fop/svg/Use.java deleted file mode 100644 index 3254a13d0..000000000 --- a/src/org/apache/fop/svg/Use.java +++ /dev/null @@ -1,142 +0,0 @@ -/*-- $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.SVGElement; -import org.w3c.dom.svg.SVGLength; - -/** - * - */ -public class Use extends SVGObj { - - /** - * inner class for making Use objects. - */ - public static class Maker extends FObj.Maker { - - /** - * make a Use object. - * - * @param parent the parent formatting object - * @param propertyList the explicit properties of this object - * - * @return the Use object - */ - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new Use(parent, propertyList); - } - } - - /** - * returns the maker for this object. - * - * @return the maker for Use objects - */ - public static FObj.Maker maker() { - return new Use.Maker(); - } - - /** - * constructs a Use object (called by Maker). - * - * @param parent the parent formatting object - * @param propertyList the explicit properties of this object - */ - protected Use(FObj parent, PropertyList propertyList) { - super(parent, propertyList); - this.name = "svg:use"; - } - - public SVGElement createGraphic() { - String str = this.properties.get("xlink:href").getString(); - SVGUseElementImpl graph = new SVGUseElementImpl(str); - graph.setStyle( - ((SVGStyle) this.properties.get("style")).getStyle()); - graph.setTransform( - ((SVGTransform) this.properties.get("transform")). - getTransform()); - graph.setId(this.properties.get("id").getString()); - SVGLength length; - length = ((SVGLengthProperty) this.properties.get("x")). - getSVGLength(); - if (length == null) - length = new SVGLengthImpl(); - graph.setX(new SVGAnimatedLengthImpl(length)); - length = ((SVGLengthProperty) this.properties.get("y")). - getSVGLength(); - if (length == null) - length = new SVGLengthImpl(); - graph.setY(new SVGAnimatedLengthImpl(length)); - length = ((SVGLengthProperty) this.properties.get("width")). - getSVGLength(); - if (length == null) - length = new SVGLengthImpl(); - graph.setWidth(new SVGAnimatedLengthImpl(length)); - length = ((SVGLengthProperty) this.properties.get("height")). - getSVGLength(); - if (length == null) - length = new SVGLengthImpl(); - graph.setHeight(new SVGAnimatedLengthImpl(length)); - return graph; - } -} diff --git a/src/org/apache/fop/svg/VKern.java b/src/org/apache/fop/svg/VKern.java deleted file mode 100644 index 78c2f67c8..000000000 --- a/src/org/apache/fop/svg/VKern.java +++ /dev/null @@ -1,105 +0,0 @@ -/*-- $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 SVGObj { - - /** - * 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"; - } -} |