git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193677 13f79535-47bb-0310-9956-ffa450edef68pull/32/head
@@ -0,0 +1,305 @@ | |||
/*-- $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.*; | |||
import java.util.*; | |||
/** | |||
* | |||
* | |||
*/ | |||
public class ElementImpl implements Element { | |||
Vector childs = new Vector(); | |||
Node parent = null; | |||
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() | |||
{ | |||
return null; | |||
} | |||
public Node getLastChild() | |||
{ | |||
return null; | |||
} | |||
public Node getPreviousSibling() | |||
{ | |||
return null; | |||
} | |||
public Node getNextSibling() | |||
{ | |||
return null; | |||
} | |||
public NamedNodeMap getAttributes() | |||
{ | |||
return null; | |||
} | |||
public Document getOwnerDocument() | |||
{ | |||
return null; | |||
} | |||
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)newChild).parent = this; | |||
} | |||
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 String getNamespaceURI() | |||
{ | |||
return SVGDocumentImpl.namespaceURI; | |||
} | |||
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 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) | |||
{ | |||
return null; | |||
} | |||
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; | |||
} | |||
} | |||
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); | |||
} | |||
} |
@@ -68,6 +68,8 @@ public abstract class GraphicElement extends SVGElementImpl implements SVGTransf | |||
protected SVGList reqFeatures; | |||
protected SVGList reqExtensions; | |||
protected SVGList sysLanguage; | |||
SVGAnimatedTransformList transform; | |||
String xmlspace = "default"; | |||
public SVGElement getNearestViewportElement( ) | |||
{ | |||
@@ -81,20 +83,20 @@ public abstract class GraphicElement extends SVGElementImpl implements SVGTransf | |||
public SVGAnimatedTransformList getTransform() | |||
{ | |||
if(trans != null) { | |||
SVGTransformList stl = new SVGTransformListImpl(); | |||
for(Enumeration e = trans.elements(); e.hasMoreElements(); ) { | |||
stl.appendItem((SVGTransform)e.nextElement()); | |||
} | |||
SVGAnimatedTransformList atl = new SVGAnimatedTransformListImpl(); | |||
atl.setBaseVal(stl); | |||
return atl; | |||
if(transform != null) { | |||
return transform; | |||
} | |||
return null; | |||
SVGTransformList stl = new SVGTransformListImpl(); | |||
SVGTransform transform = new SVGTransformImpl(); | |||
stl.appendItem(transform); | |||
SVGAnimatedTransformList atl = new SVGAnimatedTransformListImpl(); | |||
atl.setBaseVal(stl); | |||
return atl; | |||
} | |||
public void setTransform(SVGAnimatedTransformList transform) | |||
{ | |||
this.transform = transform; | |||
} | |||
public SVGRect getBBox() | |||
@@ -129,11 +131,12 @@ public abstract class GraphicElement extends SVGElementImpl implements SVGTransf | |||
public String getXMLspace() | |||
{ | |||
return null; | |||
return xmlspace; | |||
} | |||
public void setXMLspace(String xmlspace) | |||
{ | |||
this.xmlspace = xmlspace; | |||
} | |||
public SVGList getRequiredFeatures( ) | |||
@@ -190,4 +193,40 @@ public abstract class GraphicElement extends SVGElementImpl implements SVGTransf | |||
{ | |||
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; | |||
} | |||
} |
@@ -54,6 +54,8 @@ import org.apache.fop.datatypes.*; | |||
import java.util.*; | |||
import org.w3c.dom.svg.SVGElement; | |||
/** | |||
* base class for SVG graphic objects. | |||
* | |||
@@ -63,11 +65,11 @@ import java.util.*; | |||
// use this so that the SVGArea can also hold style, defs and transform etc. | |||
public interface GraphicImpl { | |||
public Hashtable oldgetStyle(); | |||
public void setParent(GraphicImpl g); | |||
public GraphicImpl getGraphicParent(); | |||
public void setParent(SVGElement g); | |||
public SVGElement getGraphicParent(); | |||
public Vector oldgetTransform(); // ?? | |||
public Hashtable getDefs(); | |||
public GraphicImpl locateDef(String str); | |||
public SVGElement locateDef(String str); | |||
public void setStyle(Hashtable st); | |||
public void addDefs(Hashtable st); | |||
public void setTransform(Vector tr); // ?? |
@@ -73,4 +73,9 @@ public class SVGAElementImpl extends SVGURIReferenceImpl implements SVGAElement | |||
{ | |||
return target; | |||
} | |||
public SVGRect getBBox() | |||
{ | |||
return getChildrenBBox(); | |||
} | |||
} |
@@ -73,6 +73,6 @@ public class SVGAnimatedLengthImpl implements SVGAnimatedLength { | |||
public SVGLength getAnimVal( ) | |||
{ | |||
return null; | |||
return len; | |||
} | |||
} |
@@ -65,12 +65,8 @@ import org.w3c.dom.*; | |||
/** | |||
* class representing an SVG area in which the SVG graphics sit | |||
*/ | |||
public class SVGArea extends Area implements GraphicImpl, GetSVGDocument {//, SVGSVGElement { | |||
public SVGDocument getSVGDocument() throws DOMException | |||
{ | |||
return null; | |||
} | |||
public class SVGArea extends Area implements GetSVGDocument { | |||
SVGDocument doc; | |||
/** | |||
* construct an SVG area | |||
@@ -85,23 +81,22 @@ public class SVGArea extends Area implements GraphicImpl, GetSVGDocument {//, SV | |||
contentRectangleWidth = (int)width * 1000; | |||
} | |||
public void setSVGDocument(SVGDocument doc) | |||
{ | |||
this.doc = doc; | |||
} | |||
public SVGDocument getSVGDocument() throws DOMException | |||
{ | |||
return doc; | |||
} | |||
public int getWidth() | |||
{ | |||
// return getSVGDocument().getRootElement().getWidth().getBaseVal().getValue(); | |||
return contentRectangleWidth; | |||
} | |||
/** | |||
* add a graphic. | |||
* | |||
* Graphics include SVG Rectangles, Lines and Text | |||
* | |||
* @param graphic the Graphic to add | |||
*/ | |||
public void addGraphic(GraphicImpl graphic) { | |||
graphic.setParent(this); | |||
this.children.addElement(graphic); | |||
} | |||
/** | |||
* render the SVG. | |||
* | |||
@@ -110,127 +105,4 @@ public class SVGArea extends Area implements GraphicImpl, GetSVGDocument {//, SV | |||
public void render(Renderer renderer) { | |||
renderer.renderSVGArea(this); | |||
} | |||
Hashtable defs = new Hashtable(); | |||
public void addDefs(Hashtable table) | |||
{ | |||
for(Enumeration e = table.keys(); e.hasMoreElements(); ) { | |||
String str = (String)e.nextElement(); | |||
defs.put(str, table.get(str)); | |||
} | |||
} | |||
public Hashtable getDefs() | |||
{ | |||
Hashtable ret = null; | |||
if(parent != null) { | |||
ret = parent.getDefs(); | |||
if(ret != null) | |||
ret = (Hashtable)ret.clone(); | |||
} | |||
if(ret == null) { | |||
ret = defs; | |||
} else { | |||
if(defs != null) { | |||
for(Enumeration e = defs.keys(); e.hasMoreElements(); ) { | |||
String str = (String)e.nextElement(); | |||
ret.put(str, defs.get(str)); | |||
} | |||
} | |||
} | |||
return ret; | |||
} | |||
public GraphicImpl locateDef(String str) | |||
{ | |||
Object obj = null; | |||
if(defs != null) { | |||
obj = defs.get(str); | |||
} | |||
if(obj == null) { | |||
Enumeration e = getChildren().elements(); | |||
while (e.hasMoreElements()) { | |||
Object o = e.nextElement(); | |||
if(o instanceof SVGElement) { | |||
String s; | |||
s = ((SVGElement)o).getId(); | |||
if(str.equals(s)) { | |||
obj = o; | |||
break; | |||
} | |||
} | |||
} | |||
} | |||
if(obj == null && parent != null) { | |||
obj = parent.locateDef(str); | |||
} | |||
return (GraphicImpl)obj; | |||
} | |||
public Hashtable oldgetStyle() | |||
{ | |||
Hashtable ret = null; | |||
if(parent != null) { | |||
ret = parent.oldgetStyle(); | |||
if(ret != null) | |||
ret = (Hashtable)ret.clone(); | |||
} | |||
if(ret == null) { | |||
ret = style; | |||
} else { | |||
if(style != null) { | |||
for(Enumeration e = style.keys(); e.hasMoreElements(); ) { | |||
String str = (String)e.nextElement(); | |||
ret.put(str, style.get(str)); | |||
} | |||
} | |||
} | |||
return ret; | |||
} | |||
public Vector oldgetTransform() | |||
{ | |||
return trans; | |||
/* Vector ret = null; | |||
if(parent != null) { | |||
ret = parent.oldgetTransform(); | |||
if(ret != null) | |||
ret = (Vector)ret.clone(); | |||
} | |||
if(ret == null) { | |||
ret = trans; | |||
} else { | |||
if(trans != null) { | |||
for(Enumeration e = trans.elements(); e.hasMoreElements(); ) { | |||
Object o = e.nextElement(); | |||
ret.addElement(o); | |||
} | |||
} | |||
} | |||
return ret;*/ | |||
} | |||
Hashtable style = null; | |||
public void setStyle(Hashtable st) | |||
{ | |||
style = st; | |||
} | |||
Vector trans = null; | |||
public void setTransform(Vector tr) | |||
{ | |||
trans = tr; | |||
} | |||
GraphicImpl parent = null; | |||
public void setParent(GraphicImpl g) | |||
{ | |||
parent = g; | |||
} | |||
public GraphicImpl getGraphicParent() | |||
{ | |||
return parent; | |||
} | |||
} |
@@ -67,15 +67,16 @@ public class SVGCircleElementImpl extends GraphicElement implements SVGCircleEle | |||
{ | |||
} | |||
/* public String getClassName( ) | |||
public SVGRect getBBox() | |||
{ | |||
return null; | |||
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 void setClassName( String className ) | |||
{ | |||
}*/ | |||
public SVGAnimatedLength getCx( ) | |||
{ | |||
return cx; |
@@ -62,7 +62,7 @@ public class SVGClipPathElementImpl extends GraphicElement implements SVGClipPat | |||
public Vector elements = new Vector(); | |||
SVGAnimatedEnumeration units; | |||
public void addElement(GraphicImpl g) | |||
public void addElement(SVGElement g) | |||
{ | |||
elements.addElement(g); | |||
} |
@@ -59,14 +59,22 @@ import org.w3c.dom.events.*; | |||
/** | |||
* | |||
*/ | |||
class SVGDocumentImpl extends SVGElementImpl implements SVGDocument { | |||
public class SVGDocumentImpl extends ElementImpl implements SVGDocument { | |||
String title; | |||
public static final String namespaceURI = "http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.dtd"; | |||
public SVGDocumentImpl() | |||
{ | |||
} | |||
public String getTitle() | |||
{ | |||
return null; | |||
return title; | |||
} | |||
public void setTitle(String title) | |||
{ | |||
this.title = title; | |||
} | |||
public String getReferrer() | |||
@@ -81,12 +89,12 @@ class SVGDocumentImpl extends SVGElementImpl implements SVGDocument { | |||
public String getURL() | |||
{ | |||
return null; | |||
return ""; | |||
} | |||
public SVGSVGElement getRootElement() | |||
{ | |||
return null; | |||
return (SVGSVGElement)childs.elementAt(0); | |||
} | |||
public Element getElementById(String elementId) |
@@ -59,263 +59,9 @@ import org.w3c.dom.*; | |||
import java.util.*; | |||
/** | |||
* | |||
* | |||
*/ | |||
class ElementImpl implements Element { | |||
Vector childs = new Vector(); | |||
Node parent = null; | |||
public Node replaceChild(Node n, Node no) | |||
{ | |||
return null; | |||
} | |||
public String getNodeName() | |||
{ | |||
return null; | |||
} | |||
public short getNodeType() | |||
{ | |||
return 0; | |||
} | |||
public Node getParentNode() | |||
{ | |||
return null; | |||
} | |||
public NodeList getChildNodes() | |||
{ | |||
return new NodeListImpl(childs); | |||
} | |||
public Node getFirstChild() | |||
{ | |||
return null; | |||
} | |||
public Node getLastChild() | |||
{ | |||
return null; | |||
} | |||
public Node getPreviousSibling() | |||
{ | |||
return null; | |||
} | |||
public Node getNextSibling() | |||
{ | |||
return null; | |||
} | |||
public NamedNodeMap getAttributes() | |||
{ | |||
return null; | |||
} | |||
public Document getOwnerDocument() | |||
{ | |||
return null; | |||
} | |||
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); | |||
return null; | |||
} | |||
public boolean hasChildNodes() | |||
{ | |||
return false; | |||
} | |||
public Node cloneNode(boolean deep) | |||
{ | |||
return null; | |||
} | |||
public void normalize() | |||
{ | |||
} | |||
public boolean supports(String feature, | |||
String version) | |||
{ | |||
return false; | |||
} | |||
public String getNamespaceURI() | |||
{ | |||
return null; | |||
} | |||
public String getPrefix() | |||
{ | |||
return null; | |||
} | |||
public void setPrefix(String prefix) throws DOMException | |||
{ | |||
} | |||
public String getLocalName() | |||
{ | |||
return null; | |||
} | |||
/* public String getClassName() | |||
{ | |||
return null; | |||
} | |||
public void setClassName(String n) | |||
{ | |||
}*/ | |||
public String getNodeValue() throws DOMException | |||
{ | |||
return null; | |||
} | |||
public void setNodeValue(String nodeValue) throws DOMException | |||
{ | |||
} | |||
public String getTagName() | |||
{ | |||
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) | |||
{ | |||
return null; | |||
} | |||
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; | |||
} | |||
} | |||
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); | |||
} | |||
} | |||
/* | |||
I want to use | |||
org.apache.xerces.dom.ElementImpl | |||
but it causes an null pointer exception in appendChild | |||
*/ | |||
public abstract class SVGElementImpl extends ElementImpl/*org.apache.xerces.dom.ElementImpl*/ implements GraphicImpl, SVGElement { | |||
public abstract class SVGElementImpl extends ElementImpl implements SVGElement { | |||
String idString = ""; | |||
CSSStyleDeclaration styleDec; | |||
public String getId() | |||
{ | |||
@@ -348,31 +94,51 @@ public abstract class SVGElementImpl extends ElementImpl/*org.apache.xerces.dom. | |||
public CSSValue getPresentationAttribute ( String name ) | |||
{ | |||
return null; | |||
CSSStyleDeclaration style; | |||
style = getStyle(); | |||
CSSValue val; | |||
val = style.getPropertyCSSValue(name); | |||
if(val == null) { | |||
// get "style" element style for this | |||
SVGSVGElement svg = getOwnerSVGElement(); | |||
} | |||
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 null; | |||
return getPresentationAttribute(name); | |||
} | |||
public CSSStyleDeclaration getStyle( ) | |||
{ | |||
return null; | |||
return styleDec; | |||
} | |||
GraphicImpl parent = null; | |||
public GraphicImpl getGraphicParent() | |||
public void setStyle(CSSStyleDeclaration dec) | |||
{ | |||
styleDec = dec; | |||
} | |||
/* SVGElement parent = null; | |||
public SVGElement getGraphicParent() | |||
{ | |||
return parent; | |||
} | |||
public void setParent(GraphicImpl graph) | |||
public void setParent(SVGElement graph) | |||
{ | |||
parent = graph; | |||
} | |||
}*/ | |||
Hashtable style = null; | |||
/* Hashtable style = null; | |||
public void setStyle(Hashtable st) | |||
{ | |||
style = st; | |||
@@ -402,7 +168,6 @@ public abstract class SVGElementImpl extends ElementImpl/*org.apache.xerces.dom. | |||
Hashtable defs = new Hashtable(); | |||
public void addDefs(Hashtable table) | |||
{ | |||
// System.out.println("Adding defs : " + table); | |||
for(Enumeration e = table.keys(); e.hasMoreElements(); ) { | |||
String str = (String)e.nextElement(); | |||
defs.put(str, table.get(str)); | |||
@@ -430,7 +195,7 @@ public abstract class SVGElementImpl extends ElementImpl/*org.apache.xerces.dom. | |||
return ret; | |||
} | |||
public GraphicImpl locateDef(String str) | |||
public SVGElement locateDef(String str) | |||
{ | |||
Object obj = null; | |||
if(defs != null) { | |||
@@ -453,7 +218,7 @@ public abstract class SVGElementImpl extends ElementImpl/*org.apache.xerces.dom. | |||
if(obj == null && parent != null) { | |||
obj = parent.locateDef(str); | |||
} | |||
return (GraphicImpl)obj; | |||
return (SVGElement)obj; | |||
} | |||
Vector trans = null; | |||
@@ -481,9 +246,9 @@ public abstract class SVGElementImpl extends ElementImpl/*org.apache.xerces.dom. | |||
} | |||
} | |||
} | |||
return ret;*/ | |||
return ret;* | |||
} | |||
*/ | |||
public SVGAnimatedBoolean getExternalResourcesRequired( ) | |||
{ | |||
return null; |
@@ -70,13 +70,16 @@ public class SVGEllipseElementImpl extends GraphicElement implements SVGEllipseE | |||
{ | |||
} | |||
/* public String getClassName( ) | |||
public SVGRect getBBox() | |||
{ | |||
return null; | |||
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 void setClassName( String className ) | |||
{ | |||
}*/ | |||
public SVGAnimatedLength getCx( ) | |||
{ | |||
return cx; |
@@ -55,35 +55,21 @@ import org.apache.fop.layout.*; | |||
import java.util.*; | |||
import org.w3c.dom.svg.*; | |||
import org.w3c.dom.*; | |||
/** | |||
* | |||
*/ | |||
public class SVGGElementImpl extends GraphicElement implements SVGGElement { | |||
protected Vector children = new Vector(); | |||
/** | |||
*/ | |||
public SVGGElementImpl() | |||
{ | |||
} | |||
/** | |||
* add a graphic. | |||
* | |||
* Graphics include SVG Rectangles, Lines and Text | |||
* | |||
* @param graphic the GraphicImpl to add | |||
*/ | |||
public void addGraphic(GraphicImpl graphic) | |||
{ | |||
this.children.addElement(graphic); | |||
graphic.setParent(this); | |||
} | |||
public Vector getChildren() | |||
{ | |||
return this.children; | |||
} | |||
public SVGRect getBBox() | |||
{ | |||
return getChildrenBBox(); | |||
} | |||
} |
@@ -63,7 +63,7 @@ import org.w3c.dom.svg.*; | |||
public class SVGLengthListImpl extends SVGListImpl implements SVGLengthList { | |||
protected float millipoints = 0; | |||
protected Vector valueList; | |||
protected Vector valueList = new Vector(); | |||
protected float fontsize = 12; | |||
@@ -103,7 +103,6 @@ public class SVGLengthListImpl extends SVGListImpl implements SVGLengthList { | |||
// could be an array of points, as in for svg:text | |||
int pos; | |||
pos = len.trim().indexOf(" "); | |||
this.valueList = new Vector(); | |||
if(pos != -1) { | |||
this.millipoints = 0; | |||
StringTokenizer st = new StringTokenizer(len.trim()); |
@@ -83,6 +83,16 @@ public class SVGLineElementImpl extends GraphicElement implements SVGLineElement | |||
{ | |||
} | |||
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; |
@@ -51,15 +51,17 @@ | |||
package org.apache.fop.dom.svg; | |||
import org.w3c.dom.svg.*; | |||
import java.util.Vector; | |||
/** | |||
* | |||
*/ | |||
public class SVGMaskElementImpl extends SVGElementImpl { | |||
public class SVGMaskElementImpl extends GraphicElement implements SVGMaskElement { | |||
public Vector elements = new Vector(); | |||
public void addElement(GraphicImpl g) | |||
public void addElement(SVGElement g) | |||
{ | |||
elements.addElement(g); | |||
} | |||
@@ -67,4 +69,29 @@ public class SVGMaskElementImpl extends SVGElementImpl { | |||
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; | |||
} | |||
} |
@@ -56,7 +56,7 @@ import java.util.*; | |||
import org.w3c.dom.svg.*; | |||
/** | |||
* | |||
* TODO: implement properly | |||
*/ | |||
public class SVGPathElementImpl extends GraphicElement implements SVGPathElement { | |||
@@ -75,6 +75,62 @@ public class SVGPathElementImpl extends GraphicElement implements SVGPathElement | |||
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 | |||
for(Enumeration e = pathElements.elements(); e.hasMoreElements(); ) { | |||
SVGPathSegImpl pc = (SVGPathSegImpl)e.nextElement(); | |||
float[] vals = pc.getValues(); | |||
switch(pc.getPathSegType()) { | |||
case SVGPathSeg.PATHSEG_MOVETO_ABS: | |||
break; | |||
case SVGPathSeg.PATHSEG_MOVETO_REL: | |||
break; | |||
case SVGPathSeg.PATHSEG_LINETO_ABS: | |||
break; | |||
case SVGPathSeg.PATHSEG_LINETO_REL: | |||
break; | |||
case SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS: | |||
break; | |||
case SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL: | |||
break; | |||
case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS: | |||
break; | |||
case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL: | |||
break; | |||
case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS: | |||
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; | |||
} | |||
} | |||
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 ) | |||
{ | |||
} |
@@ -76,4 +76,21 @@ public class SVGPolygonElementImpl extends GraphicElement implements SVGPolygonE | |||
{ | |||
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; | |||
} | |||
} |
@@ -0,0 +1,366 @@ | |||
/*-- $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.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.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 width; | |||
SVGAnimatedLength height; | |||
public SVGSVGElementImpl() | |||
{ | |||
} | |||
public SVGAnimatedLength getX( ) | |||
{ | |||
return null; | |||
} | |||
public SVGAnimatedLength getY( ) | |||
{ | |||
return null; | |||
} | |||
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 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 SVGAnimatedRect getViewBox() | |||
{ | |||
return null; | |||
} | |||
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() | |||
{ | |||
return null; | |||
} | |||
public Event createEvent(String str) | |||
{ | |||
return null; | |||
} | |||
public DocumentView getDocument() | |||
{ | |||
return null; | |||
} | |||
} |
@@ -60,4 +60,10 @@ public class SVGSwitchElementImpl extends GraphicElement implements SVGSwitchEle | |||
public SVGSwitchElementImpl() { | |||
} | |||
public SVGRect getBBox() | |||
{ | |||
// is this valid since only one will be rendered? | |||
return getChildrenBBox(); | |||
} | |||
} |
@@ -53,13 +53,102 @@ package org.apache.fop.dom.svg; | |||
import java.util.Vector; | |||
import org.w3c.dom.svg.*; | |||
/** | |||
* | |||
*/ | |||
public class SVGTRefElementImpl extends SVGTSpanElementImpl { | |||
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) | |||
{ | |||
} | |||
} |
@@ -58,7 +58,7 @@ import org.w3c.dom.svg.*; | |||
/** | |||
* | |||
*/ | |||
public class SVGTSpanElementImpl extends SVGElementImpl {// implements SVGTSpanElement { | |||
public class SVGTSpanElementImpl extends SVGTextContentElementImpl implements SVGTSpanElement { | |||
public String str; | |||
public int dx = 0; | |||
public int dy = 0; | |||
@@ -75,4 +75,29 @@ public class SVGTSpanElementImpl extends SVGElementImpl {// implements SVGTSpanE | |||
public SVGTSpanElementImpl() | |||
{ | |||
} | |||
public SVGAnimatedLengthList getX( ) | |||
{ | |||
return null; | |||
} | |||
public SVGAnimatedLengthList getY( ) | |||
{ | |||
return null; | |||
} | |||
public SVGAnimatedLengthList getDx( ) | |||
{ | |||
return null; | |||
} | |||
public SVGAnimatedLengthList getDy( ) | |||
{ | |||
return null; | |||
} | |||
public SVGAnimatedTextRotate getRotate( ) | |||
{ | |||
return null; | |||
} | |||
} |
@@ -0,0 +1,120 @@ | |||
/*-- $Id$ -- | |||
============================================================================ | |||
The Apache Software License, Version 1.1 | |||
============================================================================ | |||
Copyright (C) 1999 The Apache Software Foundation. All rights reserved. | |||
Redistribution and use in source and binary forms, with or without modifica- | |||
tion, are permitted provided that the following conditions are met: | |||
1. Redistributions of source code must retain the above copyright notice, | |||
this list of conditions and the following disclaimer. | |||
2. Redistributions in binary form must reproduce the above copyright notice, | |||
this list of conditions and the following disclaimer in the documentation | |||
and/or other materials provided with the distribution. | |||
3. The end-user documentation included with the redistribution, if any, must | |||
include the following acknowledgment: "This product includes software | |||
developed by the Apache Software Foundation (http://www.apache.org/)." | |||
Alternately, this acknowledgment may appear in the software itself, if | |||
and wherever such third-party acknowledgments normally appear. | |||
4. The names "Fop" and "Apache Software Foundation" must not be used to | |||
endorse or promote products derived from this software without prior | |||
written permission. For written permission, please contact | |||
apache@apache.org. | |||
5. Products derived from this software may not be called "Apache", nor may | |||
"Apache" appear in their name, without prior written permission of the | |||
Apache Software Foundation. | |||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
This software consists of voluntary contributions made by many individuals | |||
on behalf of the Apache Software Foundation and was originally created by | |||
James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.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 ) | |||
{ | |||
} | |||
} |
@@ -58,7 +58,7 @@ import org.w3c.dom.svg.*; | |||
* class representing text in an SVG Area | |||
* | |||
*/ | |||
public class SVGTextElementImpl extends GraphicElement {//implements SVGTextElement { | |||
public class SVGTextElementImpl extends SVGTextContentElementImpl { | |||
/** x-coordinate of text */ | |||
public float x; |