]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
moving towards the dom impl with document and svg element
authorKeiron Liddle <keiron@apache.org>
Tue, 29 Aug 2000 00:00:28 +0000 (00:00 +0000)
committerKeiron Liddle <keiron@apache.org>
Tue, 29 Aug 2000 00:00:28 +0000 (00:00 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193677 13f79535-47bb-0310-9956-ffa450edef68

23 files changed:
src/org/apache/fop/dom/svg/ElementImpl.java [new file with mode: 0644]
src/org/apache/fop/dom/svg/GraphicElement.java
src/org/apache/fop/dom/svg/GraphicImpl.java
src/org/apache/fop/dom/svg/SVGAElementImpl.java
src/org/apache/fop/dom/svg/SVGAnimatedLengthImpl.java
src/org/apache/fop/dom/svg/SVGArea.java
src/org/apache/fop/dom/svg/SVGCircleElementImpl.java
src/org/apache/fop/dom/svg/SVGClipPathElementImpl.java
src/org/apache/fop/dom/svg/SVGDocumentImpl.java
src/org/apache/fop/dom/svg/SVGElementImpl.java
src/org/apache/fop/dom/svg/SVGEllipseElementImpl.java
src/org/apache/fop/dom/svg/SVGGElementImpl.java
src/org/apache/fop/dom/svg/SVGLengthListImpl.java
src/org/apache/fop/dom/svg/SVGLineElementImpl.java
src/org/apache/fop/dom/svg/SVGMaskElementImpl.java
src/org/apache/fop/dom/svg/SVGPathElementImpl.java
src/org/apache/fop/dom/svg/SVGPolygonElementImpl.java
src/org/apache/fop/dom/svg/SVGSVGElementImpl.java [new file with mode: 0644]
src/org/apache/fop/dom/svg/SVGSwitchElementImpl.java
src/org/apache/fop/dom/svg/SVGTRefElementImpl.java
src/org/apache/fop/dom/svg/SVGTSpanElementImpl.java
src/org/apache/fop/dom/svg/SVGTextContentElementImpl.java [new file with mode: 0644]
src/org/apache/fop/dom/svg/SVGTextElementImpl.java

diff --git a/src/org/apache/fop/dom/svg/ElementImpl.java b/src/org/apache/fop/dom/svg/ElementImpl.java
new file mode 100644 (file)
index 0000000..2b07216
--- /dev/null
@@ -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);
+       }
+}
index 1b38a50f02832adf088c0ba03dc8b0fa14d1ac9c..8be3028edc204661d748c9d561553c7faf807f36 100644 (file)
@@ -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;
+       }
 }
index a54186880b9863357251cc29b88540005c099277..72dfc5c4aec7adabdaf93acdf75eeb5955a128fd 100644 (file)
@@ -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);    // ??
index 2c675955ff33b52eed60d042497b0e5b0b6c169d..66206068ec22e9114477ec6c1fb408c5055771dd 100644 (file)
@@ -73,4 +73,9 @@ public class SVGAElementImpl extends SVGURIReferenceImpl implements SVGAElement
        {
                return target;
        }
+
+    public SVGRect getBBox()
+    {
+        return getChildrenBBox();
+    }
 }
index 92dfcf2985e4906bf0fad24e89621aaf79eeb313..3e21499fbbfaf4c1a1b67968c135859e5cff0970 100644 (file)
@@ -73,6 +73,6 @@ public class SVGAnimatedLengthImpl implements SVGAnimatedLength {
 
   public SVGLength getAnimVal( )
   {
-      return null;
+      return len;
   }
 }
index fa8aefedf7c5687829e1ad6e87aab97b80537d4f..58c3fee68d487dddb17eaecc2b9d9b12c232db4f 100644 (file)
@@ -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;
-       }
 }
index 21b7c86d083db70bc8851261a8ba339791ddde56..0c11944870bb619fdb1b8b5c0f8d0796a3d60dae 100644 (file)
@@ -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;
index 4c6e671eb8bd09b70ca9f87a1a3f07e27b742fe1..77c333bad5b57785a1efb1df45c0834548618325 100644 (file)
@@ -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);
        }
index 7710dab5aea48e78e5d7c0a67587fc4cd50a3655..4f0f77671314360798a7e3174d56b9d50478c3a2 100644 (file)
@@ -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)
index dfa92e00eb00b018c0919d145c5b08b4e7d72ca9..e8b157b2b0194bdc9b74a27ab6462601b9fa558f 100644 (file)
@@ -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;
index 9de85fcd57ee7cf2f136ff52b461320ab22eca4b..b92234fe80bbdbad3f175ff211d7bb67ecc894d2 100644 (file)
@@ -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;
index eb6c76168a4a2afae21df9a7c9a4e1f3bdd2adcd..95330d4a7fe0632d19c96c21f1cb591941dc48d8 100644 (file)
@@ -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();
+    }
 }
index 2154932125e1309f3a3d8920d22634e60648fd5d..60e7ddd6f277b1221a6b04d5536bb8099919c52b 100644 (file)
@@ -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());
index b8d6e53a70c6898b6316140317131d5d7b28f524..34168c86492c5f202541dc56988b2866ff2f4b4b 100644 (file)
@@ -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;
index b3c7043c52a4a855b1fd30f595c2ec5c14f09a92..c9efa34b8fc8f19040d07e5c04e0e5f17bd26e51 100644 (file)
 
 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;
+       }
 }
index 4154d4f54ee6f8a99a6b870c3e58a29dd83e134d..cf5d29b39c852435e54cf2a6ba518c1aa2654458 100644 (file)
@@ -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 )
        {
        }
index f451649397b2f0ca9278b4098a28a57263cc89ba..ba0ac2af34e0c1231906b9728f80dbb970bee193 100644 (file)
@@ -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;
+       }
 }
diff --git a/src/org/apache/fop/dom/svg/SVGSVGElementImpl.java b/src/org/apache/fop/dom/svg/SVGSVGElementImpl.java
new file mode 100644 (file)
index 0000000..9216c85
--- /dev/null
@@ -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;
+       }
+}
index 8c686e5f129989965931a0627c6187394cccbb72..be4ecacab285ce40432204dbe3e550bda864acbd 100644 (file)
@@ -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();
+    }
 }
index 59d4f7366ef2f9fcc94f1e37f5b03991934ad7bb..205b84b004dc39f0f5b2a5d21d18bf537115ea4c 100644 (file)
@@ -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)
+       {
+       }
 }
index fa16b1debd88b46cc328b627e5dd9486f79f3f1b..fbda8d9e5eb92ed0f37ca6e9435ebb02aa32d8f9 100644 (file)
@@ -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;
+       }
 }
diff --git a/src/org/apache/fop/dom/svg/SVGTextContentElementImpl.java b/src/org/apache/fop/dom/svg/SVGTextContentElementImpl.java
new file mode 100644 (file)
index 0000000..ebf0ca5
--- /dev/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 )
+       {
+       }
+}
index 9c5857b032576819b9ebc81c08ee8785eaec4dbd..ddf9d874749ec6be811321f9cf7aff33abd07a27 100644 (file)
@@ -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;