You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ke...@apache.org on 2001/05/17 13:03:45 UTC

cvs commit: xml-fop/src/org/apache/fop/render/txt TXTRenderer.java

keiron      01/05/17 04:03:44

  Modified:    src/org/apache/fop/svg PDFDocumentGraphics2D.java
                        PDFGraphics2D.java PDFTranscoder.java SVGArea.java
                        SVGDriver.java SVGElementMapping.java SVGObj.java
                        SVGPropertyListMapping.java SVGStringProperty.java
               src/org/apache/fop/fo SVGTreeBuilder.java
               src/org/apache/fop/render/awt AWTRenderer.java
               src/org/apache/fop/render/pdf PDFRenderer.java
               src/org/apache/fop/render/txt TXTRenderer.java
  Added:       src/org/apache/fop/svg SVGElement.java
  Removed:     src/org/apache/fop/svg PathPoint.java SVG.java
                        SVGPoints.java TextElement.java TextProperty.java
               src/org/apache/fop/datatypes PointsData.java
  Log:
  general clean up
  removing unused files
  better formatting
  
  Revision  Changes    Path
  1.3       +6 -8      xml-fop/src/org/apache/fop/svg/PDFDocumentGraphics2D.java
  
  Index: PDFDocumentGraphics2D.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/PDFDocumentGraphics2D.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PDFDocumentGraphics2D.java	2001/05/17 07:47:24	1.2
  +++ PDFDocumentGraphics2D.java	2001/05/17 11:01:58	1.3
  @@ -1,10 +1,8 @@
  -/*****************************************************************************
  - * Copyright (C) The Apache Software Foundation. All rights reserved.        *
  - * ------------------------------------------------------------------------- *
  - * This software is published under the terms of the Apache Software License *
  - * version 1.1, a copy of which has been included with this distribution in  *
  - * the LICENSE file.                                                         *
  - *****************************************************************************/
  +/* $Id: PDFDocumentGraphics2D.java,v 1.3 2001/05/17 11:01:58 keiron Exp $
  + * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * For details on use and redistribution please refer to the
  + * LICENSE file included with these sources."
  + */
   
   package org.apache.fop.svg;
   
  @@ -38,7 +36,7 @@
    * implementing a <tt>Graphic2D</tt> piece-meal.
    *
    * @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
  - * @version $Id: PDFDocumentGraphics2D.java,v 1.2 2001/05/17 07:47:24 keiron Exp $
  + * @version $Id: PDFDocumentGraphics2D.java,v 1.3 2001/05/17 11:01:58 keiron Exp $
    * @see org.apache.batik.ext.awt.g2d.AbstractGraphics2D
    */
   public class PDFDocumentGraphics2D extends PDFGraphics2D {
  
  
  
  1.3       +6 -8      xml-fop/src/org/apache/fop/svg/PDFGraphics2D.java
  
  Index: PDFGraphics2D.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/PDFGraphics2D.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PDFGraphics2D.java	2001/05/17 07:47:25	1.2
  +++ PDFGraphics2D.java	2001/05/17 11:02:00	1.3
  @@ -1,10 +1,8 @@
  -/*****************************************************************************
  - * Copyright (C) The Apache Software Foundation. All rights reserved.        *
  - * ------------------------------------------------------------------------- *
  - * This software is published under the terms of the Apache Software License *
  - * version 1.1, a copy of which has been included with this distribution in  *
  - * the LICENSE file.                                                         *
  - *****************************************************************************/
  +/* $Id: PDFGraphics2D.java,v 1.3 2001/05/17 11:02:00 keiron Exp $
  + * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * For details on use and redistribution please refer to the
  + * LICENSE file included with these sources."
  + */
   
   package org.apache.fop.svg;
   
  @@ -38,7 +36,7 @@
    * implementing a <tt>Graphic2D</tt> piece-meal.
    *
    * @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
  - * @version $Id: PDFGraphics2D.java,v 1.2 2001/05/17 07:47:25 keiron Exp $
  + * @version $Id: PDFGraphics2D.java,v 1.3 2001/05/17 11:02:00 keiron Exp $
    * @see org.apache.batik.ext.awt.g2d.AbstractGraphics2D
    */
   public class PDFGraphics2D extends AbstractGraphics2D {
  
  
  
  1.3       +6 -8      xml-fop/src/org/apache/fop/svg/PDFTranscoder.java
  
  Index: PDFTranscoder.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/PDFTranscoder.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PDFTranscoder.java	2001/05/17 07:47:27	1.2
  +++ PDFTranscoder.java	2001/05/17 11:02:02	1.3
  @@ -1,10 +1,8 @@
  -/*****************************************************************************
  - * Copyright (C) The Apache Software Foundation. All rights reserved.        *
  - * ------------------------------------------------------------------------- *
  - * This software is published under the terms of the Apache Software License *
  - * version 1.1, a copy of which has been included with this distribution in  *
  - * the LICENSE file.                                                         *
  - *****************************************************************************/
  +/* $Id: PDFTranscoder.java,v 1.3 2001/05/17 11:02:02 keiron Exp $
  + * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * For details on use and redistribution please refer to the
  + * LICENSE file included with these sources."
  + */
   
   package org.apache.fop.svg;
   
  @@ -122,7 +120,7 @@
    * millimeter conversion factor.
    *
    * @author <a href="mailto:Thierry.Kormann@sophia.inria.fr">Thierry Kormann</a>
  - * @version $Id: PDFTranscoder.java,v 1.2 2001/05/17 07:47:27 keiron Exp $
  + * @version $Id: PDFTranscoder.java,v 1.3 2001/05/17 11:02:02 keiron Exp $
    */
   public class PDFTranscoder extends XMLAbstractTranscoder {
   
  
  
  
  1.8       +38 -86    xml-fop/src/org/apache/fop/svg/SVGArea.java
  
  Index: SVGArea.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/SVGArea.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SVGArea.java	2001/05/17 07:47:38	1.7
  +++ SVGArea.java	2001/05/17 11:02:07	1.8
  @@ -1,53 +1,9 @@
  -/*-- $Id: SVGArea.java,v 1.7 2001/05/17 07:47:38 keiron Exp $ -- 
  -
  - ============================================================================
  -                   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 <jt...@jtauber.com>. For more  information on the Apache 
  - Software Foundation, please see <http://www.apache.org/>.
  - 
  +/* $Id: SVGArea.java,v 1.8 2001/05/17 11:02:07 keiron Exp $
  + * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * For details on use and redistribution please refer to the
  + * LICENSE file included with these sources."
    */
  +
   package org.apache.fop.svg;
   
   // FOP
  @@ -60,48 +16,44 @@
   import org.w3c.dom.svg.*;
   import org.w3c.dom.*;
   
  -
   /**
    * class representing an SVG area in which the SVG graphics sit
    */
  -public class SVGArea extends Area implements GetSVGDocument {
  -	SVGDocument doc;
  +public class SVGArea extends Area {
  +    Document doc;
  +
  +    /**
  +     * construct an SVG area
  +     *
  +     * @param fontState the font state
  +     * @param width the width of the area
  +     * @param height the height of the area
  +     */
  +    public SVGArea(FontState fontState, float width, float height) {
  +        super(fontState, (int) width * 1000, (int) height * 1000);
  +        currentHeight = (int) height * 1000;
  +        contentRectangleWidth = (int) width * 1000;
  +    }
   
  -	/**
  -	 * construct an SVG area
  -	 *
  -	 * @param fontState the font state
  -	 * @param width the width of the area
  -	 * @param height the height of the area
  -	 */
  -	public SVGArea(FontState fontState, float width, float height)  {
  -		super(fontState, (int)width * 1000, (int)height * 1000);
  -		currentHeight = (int)height * 1000;
  -		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();
  +    public void setSVGDocument(Document doc) {
  +        this.doc = doc;
  +    }
  +
  +    public Document getSVGDocument() {
  +        return doc;
  +    }
  +
  +    public int getWidth() {
  +        //        return getSVGDocument().getRootElement().getWidth().getBaseVal().getValue();
           return contentRectangleWidth;
       }
   
  -	/**
  -	 * render the SVG.
  -	 *
  -	 * @param renderer the Renderer to use
  -	 */
  -	public void render(Renderer renderer) {
  -		renderer.renderSVGArea(this);
  -	}
  +    /**
  +     * render the SVG.
  +     *
  +     * @param renderer the Renderer to use
  +     */
  +    public void render(Renderer renderer) {
  +        renderer.renderSVGArea(this);
  +    }
   }
  
  
  
  1.3       +151 -225  xml-fop/src/org/apache/fop/svg/SVGDriver.java
  
  Index: SVGDriver.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/SVGDriver.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SVGDriver.java	2001/05/17 07:47:41	1.2
  +++ SVGDriver.java	2001/05/17 11:02:12	1.3
  @@ -1,52 +1,7 @@
  -/*-- $Id: SVGDriver.java,v 1.2 2001/05/17 07:47:41 keiron Exp $ -- 
  -
  - ============================================================================
  -                   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 <jt...@jtauber.com>. For more  information on the Apache 
  - Software Foundation, please see <http://www.apache.org/>.
  - 
  +/* $Id: SVGDriver.java,v 1.3 2001/05/17 11:02:12 keiron Exp $
  + * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * For details on use and redistribution please refer to the
  + * LICENSE file included with these sources."
    */
   
   package org.apache.fop.svg;
  @@ -82,40 +37,6 @@
   import java.io.IOException;
   
   /**
  - * <P>Primary class that drives overall FOP process.
  - *
  - * <P>Once this class is instantiated, methods are called to set the
  - * Renderer to use, the (possibly multiple) ElementMapping(s) to
  - * use and the PrintWriter to use to output the results of the
  - * rendering (where applicable). In the case of the Renderer and
  - * ElementMapping(s), the Driver may be supplied either with the
  - * object itself, or the name of the class, in which case Driver will
  - * instantiate the class itself. The advantage of the latter is it
  - * enables runtime determination of Renderer and ElementMapping(s).
  - *
  - * <P>Once the Driver is set up, the buildFOTree method
  - * is called. Depending on whether DOM or SAX is being used, the
  - * invocation of the method is either buildFOTree(Document) or
  - * buildFOTree(Parser, InputSource) respectively.
  - *
  - * <P>A third possibility may be used to build the FO Tree, namely
  - * calling getDocumentHandler() and firing the SAX events yourself.
  - *
  - * <P>Once the FO Tree is built, the format() and render() methods may be
  - * called in that order.
  - *
  - * <P>Here is an example use of Driver from CommandLine.java:
  - *
  - * <PRE>
  - *   Driver driver = new Driver();
  - *   driver.setRenderer("org.apache.fop.render.pdf.PDFRenderer", version);
  - *   driver.addElementMapping("org.apache.fop.fo.StandardElementMapping");
  - *   driver.addElementMapping("org.apache.fop.svg.SVGElementMapping");
  - *   driver.setWriter(new PrintWriter(new FileWriter(args[1])));
  - *   driver.buildFOTree(parser, fileInputSource(args[0]));
  - *   driver.format();
  - *   driver.render();
  - * </PRE>
    */
   public class SVGDriver {
   
  @@ -127,76 +48,86 @@
   
       /** create a new Driver */
       public SVGDriver() {
  -	this.treeBuilder = new SVGTreeBuilder();
  +        this.treeBuilder = new SVGTreeBuilder();
       }
  -   
  +
       /**
        * add the given element mapping.
        *
        * an element mapping maps element names to Java classes
        */
       public void addElementMapping(ElementMapping mapping) {
  -	mapping.addToBuilder(this.treeBuilder);
  +        mapping.addToBuilder(this.treeBuilder);
       }
  -    
  +
       /**
        * add the element mapping with the given class name
        */
       public void addElementMapping(String mappingClassName) {
  -	createElementMapping(mappingClassName).addToBuilder(this.treeBuilder);
  +        createElementMapping(mappingClassName).addToBuilder(
  +          this.treeBuilder);
       }
   
       /**
        * protected method used by addElementMapping(String) to
        * instantiate element mapping class
        */
  -    protected ElementMapping createElementMapping(String mappingClassName) {
  -    MessageHandler.logln("using element mapping " + mappingClassName);
  -
  -	try {
  -	    return (ElementMapping)
  -		Class.forName(mappingClassName).newInstance();
  -	} catch (ClassNotFoundException e) {
  -	    MessageHandler.errorln("Could not find " + mappingClassName);
  -	} catch (InstantiationException e) {
  -	    MessageHandler.errorln("Could not instantiate "
  -			       + mappingClassName);
  -	} catch (IllegalAccessException e) {
  -	    MessageHandler.errorln("Could not access " + mappingClassName);
  -	} catch (ClassCastException e) {
  -	    MessageHandler.errorln(mappingClassName + " is not an element mapping"); 
  -	}
  -	return null;
  +    protected ElementMapping createElementMapping(
  +      String mappingClassName) {
  +        MessageHandler.logln("using element mapping " + mappingClassName);
  +
  +        try {
  +            return (ElementMapping) Class.forName(
  +                     mappingClassName).newInstance();
  +        } catch (ClassNotFoundException e) {
  +            MessageHandler.errorln("Could not find " + mappingClassName);
  +        }
  +        catch (InstantiationException e) {
  +            MessageHandler.errorln("Could not instantiate " +
  +                                   mappingClassName);
  +        }
  +        catch (IllegalAccessException e) {
  +            MessageHandler.errorln("Could not access " + mappingClassName);
  +        }
  +        catch (ClassCastException e) {
  +            MessageHandler.errorln(mappingClassName + " is not an element mapping");
  +        }
  +        return null;
       }
   
       /**
        * add the element mapping with the given class name
        */
       public void addPropertyList(String listClassName) {
  -	createPropertyList(listClassName).addToBuilder(this.treeBuilder);
  +        createPropertyList(listClassName).addToBuilder(this.treeBuilder);
       }
   
       /**
        * protected method used by addPropertyList(String) to
        * instantiate list mapping class
        */
  -    protected PropertyListMapping createPropertyList(String listClassName) {
  -    MessageHandler.logln("using property list mapping " + listClassName);
  -
  -	try {
  -	    return (PropertyListMapping)
  -		Class.forName(listClassName).newInstance();
  -	} catch (ClassNotFoundException e) {
  -	    MessageHandler.errorln("Could not find " + listClassName);
  -	} catch (InstantiationException e) {
  -	    MessageHandler.errorln("Could not instantiate "
  -			       + listClassName);
  -	} catch (IllegalAccessException e) {
  -	    MessageHandler.errorln("Could not access " + listClassName);
  -	} catch (ClassCastException e) {
  -	    MessageHandler.errorln(listClassName + " is not an property list"); 
  -	}
  -	return null;
  +    protected PropertyListMapping createPropertyList(
  +      String listClassName) {
  +        MessageHandler.logln("using property list mapping " +
  +                             listClassName);
  +
  +        try {
  +            return (PropertyListMapping) Class.forName(
  +                     listClassName).newInstance();
  +        } catch (ClassNotFoundException e) {
  +            MessageHandler.errorln("Could not find " + listClassName);
  +        }
  +        catch (InstantiationException e) {
  +            MessageHandler.errorln("Could not instantiate " +
  +                                   listClassName);
  +        }
  +        catch (IllegalAccessException e) {
  +            MessageHandler.errorln("Could not access " + listClassName);
  +        }
  +        catch (ClassCastException e) {
  +            MessageHandler.errorln(listClassName + " is not an property list");
  +        }
  +        return null;
       }
   
       /**
  @@ -207,129 +138,124 @@
        * events but isn't a SAX Parser itself.
        */
       public ContentHandler getContentHandler() {
  -	return this.treeBuilder;
  +        return this.treeBuilder;
       }
   
       /**
        * build the formatting object tree using the given SAX Parser and
        * SAX InputSource
        */
  -    public void buildSVGTree(XMLReader parser, InputSource source)
  -		throws FOPException {
  +    public void buildSVGTree(XMLReader parser,
  +                             InputSource source) throws FOPException {
   
  -	parser.setContentHandler(this.treeBuilder);
  -	try {
  -	    parser.parse(source);
  -	} catch (SAXException e) {
  -e.printStackTrace();
  -	    if (e.getException() instanceof FOPException)
  -		throw (FOPException) e.getException();
  -	    else
  -		throw new FOPException(e.getMessage());
  -	} catch (IOException e) {
  -	    throw new FOPException(e.getMessage());
  -	}
  +        parser.setContentHandler(this.treeBuilder);
  +        try {
  +            parser.parse(source);
  +        } catch (SAXException e) {
  +            e.printStackTrace();
  +            if (e.getException() instanceof FOPException)
  +                throw (FOPException) e.getException();
  +            else
  +                throw new FOPException(e.getMessage());
  +        }
  +        catch (IOException e) {
  +            throw new FOPException(e.getMessage());
  +        }
       }
   
       /**
        * build the formatting object tree using the given DOM Document
        */
  -    public void buildSVGTree(Document document) 
  -	throws FOPException {
  +    public void buildSVGTree(Document document) throws FOPException {
  +
  +        /* most of this code is modified from John Cowan's */
   
  -	/* most of this code is modified from John Cowan's */
  +        Node currentNode;
  +        AttributesImpl currentAtts;
   
  -	Node currentNode;
  -	AttributesImpl currentAtts;
  -	
  -	/* temporary array for making Strings into character arrays */
  -	char[] array = null;
  -
  -	currentAtts = new AttributesImpl();
  -	
  -	/* start at the document element */
  -	currentNode = document;
  -
  -	try {
  -	    while (currentNode != null) {
  -		switch (currentNode.getNodeType()) {
  -		case Node.DOCUMENT_NODE:
  -		    this.treeBuilder.startDocument();
  -		    break;
  -		case Node.CDATA_SECTION_NODE:
  -		case Node.TEXT_NODE:
  -		    String data = currentNode.getNodeValue();
  -		    int datalen = data.length();
  -		    if (array == null || array.length < datalen) {
  -			/* if the array isn't big enough, make a new
  -			   one */
  -			array = new char[datalen];
  -		    }
  -		    data.getChars(0, datalen, array, 0);
  -		    this.treeBuilder.characters(array, 0, datalen);
  -		    break;
  -		case Node.PROCESSING_INSTRUCTION_NODE:
  -		    this.treeBuilder.processingInstruction(
  -	  	        currentNode.getNodeName(),
  -			currentNode.getNodeValue());
  -		    break;
  -		case Node.ELEMENT_NODE:
  -		    NamedNodeMap map = currentNode.getAttributes();
  -		    currentAtts.clear();
  -		    for (int i = map.getLength() - 1; i >= 0; i--) {
  -			Attr att = (Attr)map.item(i);
  -			currentAtts.addAttribute("",
  -                         att.getName(),
  -                         "",
  -                         "CDATA",
  -                         att.getValue());
  -		    }
  -		    this.treeBuilder.startElement(
  -			"", currentNode.getNodeName(), "", currentAtts);
  -		    break;
  -		}
  -		
  -		Node nextNode = currentNode.getFirstChild();
  -		if (nextNode != null) {
  -		    currentNode = nextNode;
  -		    continue;
  -		}
  -		
  -		while (currentNode != null) {
  -		    switch (currentNode.getNodeType()) {
  -		    case Node.DOCUMENT_NODE:
  -			this.treeBuilder.endDocument();
  -			break;
  -		    case Node.ELEMENT_NODE:
  -			this.treeBuilder.endElement(
  -			    "", currentNode.getNodeName(), "" );
  -			break;
  -		    }
  -		    
  -		    nextNode = currentNode.getNextSibling();
  -		    if (nextNode != null) {
  -			currentNode = nextNode;
  -			break;
  -		    }
  -		    
  -		    currentNode = currentNode.getParentNode();
  -		}
  -	    }
  -	} catch (SAXException e) {
  -	    throw new FOPException(e.getMessage());
  -	}
  +        /* temporary array for making Strings into character arrays */
  +        char[] array = null;
  +
  +        currentAtts = new AttributesImpl();
  +
  +        /* start at the document element */
  +        currentNode = document;
  +
  +        try {
  +            while (currentNode != null) {
  +                switch (currentNode.getNodeType()) {
  +                    case Node.DOCUMENT_NODE:
  +                        this.treeBuilder.startDocument();
  +                        break;
  +                    case Node.CDATA_SECTION_NODE:
  +                    case Node.TEXT_NODE:
  +                        String data = currentNode.getNodeValue();
  +                        int datalen = data.length();
  +                        if (array == null || array.length < datalen) {
  +                            /* if the array isn't big enough, make a new
  +                                one */
  +                            array = new char[datalen];
  +                        }
  +                        data.getChars(0, datalen, array, 0);
  +                        this.treeBuilder.characters(array, 0, datalen);
  +                        break;
  +                    case Node.PROCESSING_INSTRUCTION_NODE:
  +                        this.treeBuilder.processingInstruction(
  +                          currentNode.getNodeName(),
  +                          currentNode.getNodeValue());
  +                        break;
  +                    case Node.ELEMENT_NODE:
  +                        NamedNodeMap map = currentNode.getAttributes();
  +                        currentAtts.clear();
  +                        for (int i = map.getLength() - 1; i >= 0; i--) {
  +                            Attr att = (Attr) map.item(i);
  +                            currentAtts.addAttribute("", att.getName(),
  +                                                     "", "CDATA", att.getValue());
  +                        }
  +                        this.treeBuilder.startElement("",
  +                                                      currentNode.getNodeName(), "", currentAtts);
  +                        break;
  +                }
  +
  +                Node nextNode = currentNode.getFirstChild();
  +                if (nextNode != null) {
  +                    currentNode = nextNode;
  +                    continue;
  +                }
  +
  +                while (currentNode != null) {
  +                    switch (currentNode.getNodeType()) {
  +                        case Node.DOCUMENT_NODE:
  +                            this.treeBuilder.endDocument();
  +                            break;
  +                        case Node.ELEMENT_NODE:
  +                            this.treeBuilder.endElement("",
  +                                                        currentNode.getNodeName(), "");
  +                            break;
  +                    }
  +
  +                    nextNode = currentNode.getNextSibling();
  +                    if (nextNode != null) {
  +                        currentNode = nextNode;
  +                        break;
  +                    }
  +
  +                    currentNode = currentNode.getParentNode();
  +                }
  +            }
  +        } catch (SAXException e) {
  +            throw new FOPException(e.getMessage());
  +        }
       }
   
  -    public SVGDocument getSVGDocument()
  -    {
  +    public SVGDocument getSVGDocument() {
           return this.treeBuilder.getSVGDocument();
       }
   
       /**
        * format the formatting object tree into an area tree
        */
  -    public void format()
  -	throws FOPException {
  -	FontInfo fontInfo = new FontInfo();
  +    public void format() throws FOPException {
  +        FontInfo fontInfo = new FontInfo();
       }
   }
  
  
  
  1.12      +61 -106   xml-fop/src/org/apache/fop/svg/SVGElementMapping.java
  
  Index: SVGElementMapping.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/SVGElementMapping.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- SVGElementMapping.java	2001/05/17 07:47:42	1.11
  +++ SVGElementMapping.java	2001/05/17 11:02:14	1.12
  @@ -1,53 +1,9 @@
  -/*-- $Id: SVGElementMapping.java,v 1.11 2001/05/17 07:47:42 keiron Exp $ -- 
  -
  - ============================================================================
  -                   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 <jt...@jtauber.com>. For more  information on the Apache 
  - Software Foundation, please see <http://www.apache.org/>.
  - 
  +/* $Id: SVGElementMapping.java,v 1.12 2001/05/17 11:02:14 keiron Exp $
  + * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * For details on use and redistribution please refer to the
  + * LICENSE file included with these sources."
    */
  +
   package org.apache.fop.svg;
   
   import org.apache.fop.fo.TreeBuilder;
  @@ -56,61 +12,60 @@
   
   public class SVGElementMapping implements ElementMapping {
   
  -	public void addToBuilder(TreeBuilder builder) {
  -		String uri = "http://www.w3.org/2000/svg";
  -		builder.addMapping(uri, "svg", SVG.maker());
  -		builder.addMapping(uri, "rect", Rect.maker());
  -		builder.addMapping(uri, "line", Line.maker());
  -		builder.addMapping(uri, "text", Text.maker());
  -
  -		builder.addMapping(uri, "desc", Desc.maker());
  -		builder.addMapping(uri, "title", Title.maker());
  -		builder.addMapping(uri, "circle", Circle.maker());
  -		builder.addMapping(uri, "ellipse", Ellipse.maker());
  -		builder.addMapping(uri, "g", G.maker());
  -		builder.addMapping(uri, "polyline", Polyline.maker());
  -		builder.addMapping(uri, "polygon", Polygon.maker());
  -		builder.addMapping(uri, "defs", Defs.maker());
  -		builder.addMapping(uri, "path", Path.maker());
  -		builder.addMapping(uri, "use", Use.maker());
  -		builder.addMapping(uri, "tspan", Tspan.maker());
  -		builder.addMapping(uri, "tref", Tref.maker());
  -		builder.addMapping(uri, "image", Image.maker());
  -		builder.addMapping(uri, "style", Style.maker());
  -
  -// elements in progress
  -		builder.addMapping(uri, "textPath", TextPath.maker());
  -		builder.addMapping(uri, "clipPath", ClipPath.maker());
  -		builder.addMapping(uri, "mask", Mask.maker());
  -		builder.addMapping(uri, "linearGradient", LinearGradient.maker());
  -		builder.addMapping(uri, "radialGradient", RadialGradient.maker());
  -		builder.addMapping(uri, "stop", Stop.maker());
  -		builder.addMapping(uri, "a", A.maker());
  -		builder.addMapping(uri, "switch", Switch.maker());
  -		builder.addMapping(uri, "symbol", Symbol.maker());
  -
  -// elements below will not work
  -		builder.addMapping(uri, "pattern", Pattern.maker());
  -
  -		builder.addMapping(uri, "marker", Marker.maker());
  -		builder.addMapping(uri, "animate", Animate.maker());
  -		builder.addMapping(uri, "altGlyph", AltGlyph.maker());
  -		builder.addMapping(uri, "font", Font.maker());
  -		builder.addMapping(uri, "glyph", Glyph.maker());
  -		builder.addMapping(uri, "missing-glyph", MissingGlyph.maker());
  -		builder.addMapping(uri, "hkern", Hkern.maker());
  -		builder.addMapping(uri, "vkern", Vkern.maker());
  -		builder.addMapping(uri, "set", Set.maker());
  -		builder.addMapping(uri, "animateMotion", AnimateMotion.maker());
  -		builder.addMapping(uri, "animateColor", AnimateColor.maker());
  -		builder.addMapping(uri, "animateTransform", AnimateTransform.maker());
  -		builder.addMapping(uri, "cursor", Cursor.maker());
  -		builder.addMapping(uri, "filter", Filter.maker());
  -
  -                builder.addMapping(uri, "feFlood", FeFlood.maker());
  -                builder.addMapping(uri, "feGaussianBlur", FeGaussianBlur.maker());
  -                builder.addMapping(uri, "feOffset", FeOffset.maker());
  -                builder.addMapping(uri, "feMerge", FeMerge.maker());
  -                builder.addMapping(uri, "feMergeNode", FeMergeNode.maker());
  -	}
  +    public void addToBuilder(TreeBuilder builder) {
  +        String uri = "http://www.w3.org/2000/svg";
  +        builder.addMapping(uri, "svg", SVGElement.maker());
  +        builder.addMapping(uri, "rect", Rect.maker());
  +        builder.addMapping(uri, "line", Line.maker());
  +        builder.addMapping(uri, "text", Text.maker());
  +
  +        builder.addMapping(uri, "desc", Desc.maker());
  +        builder.addMapping(uri, "title", Title.maker());
  +        builder.addMapping(uri, "circle", Circle.maker());
  +        builder.addMapping(uri, "ellipse", Ellipse.maker());
  +        builder.addMapping(uri, "g", G.maker());
  +        builder.addMapping(uri, "polyline", Polyline.maker());
  +        builder.addMapping(uri, "polygon", Polygon.maker());
  +        builder.addMapping(uri, "defs", Defs.maker());
  +        builder.addMapping(uri, "path", Path.maker());
  +        builder.addMapping(uri, "use", Use.maker());
  +        builder.addMapping(uri, "tspan", Tspan.maker());
  +        builder.addMapping(uri, "tref", Tref.maker());
  +        builder.addMapping(uri, "image", Image.maker());
  +        builder.addMapping(uri, "style", Style.maker());
  +
  +        builder.addMapping(uri, "textPath", TextPath.maker());
  +        builder.addMapping(uri, "clipPath", ClipPath.maker());
  +        builder.addMapping(uri, "mask", Mask.maker());
  +        builder.addMapping(uri, "linearGradient", LinearGradient.maker());
  +        builder.addMapping(uri, "radialGradient", RadialGradient.maker());
  +        builder.addMapping(uri, "stop", Stop.maker());
  +        builder.addMapping(uri, "a", A.maker());
  +        builder.addMapping(uri, "switch", Switch.maker());
  +        builder.addMapping(uri, "symbol", Symbol.maker());
  +
  +        builder.addMapping(uri, "pattern", Pattern.maker());
  +
  +        builder.addMapping(uri, "marker", Marker.maker());
  +        builder.addMapping(uri, "animate", Animate.maker());
  +        builder.addMapping(uri, "altGlyph", AltGlyph.maker());
  +        builder.addMapping(uri, "font", Font.maker());
  +        builder.addMapping(uri, "glyph", Glyph.maker());
  +        builder.addMapping(uri, "missing-glyph", MissingGlyph.maker());
  +        builder.addMapping(uri, "hkern", Hkern.maker());
  +        builder.addMapping(uri, "vkern", Vkern.maker());
  +        builder.addMapping(uri, "set", Set.maker());
  +        builder.addMapping(uri, "animateMotion", AnimateMotion.maker());
  +        builder.addMapping(uri, "animateColor", AnimateColor.maker());
  +        builder.addMapping(uri, "animateTransform",
  +                           AnimateTransform.maker());
  +        builder.addMapping(uri, "cursor", Cursor.maker());
  +        builder.addMapping(uri, "filter", Filter.maker());
  +
  +        builder.addMapping(uri, "feFlood", FeFlood.maker());
  +        builder.addMapping(uri, "feGaussianBlur", FeGaussianBlur.maker());
  +        builder.addMapping(uri, "feOffset", FeOffset.maker());
  +        builder.addMapping(uri, "feMerge", FeMerge.maker());
  +        builder.addMapping(uri, "feMergeNode", FeMergeNode.maker());
  +    }
   }
  
  
  
  1.3       +48 -92    xml-fop/src/org/apache/fop/svg/SVGObj.java
  
  Index: SVGObj.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/SVGObj.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SVGObj.java	2001/05/17 07:47:44	1.2
  +++ SVGObj.java	2001/05/17 11:02:15	1.3
  @@ -1,52 +1,7 @@
  -/*-- $Id: SVGObj.java,v 1.2 2001/05/17 07:47:44 keiron Exp $ -- 
  -
  - ============================================================================
  -                   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 <jt...@jtauber.com>. For more  information on the Apache 
  - Software Foundation, please see <http://www.apache.org/>.
  - 
  +/* $Id: SVGObj.java,v 1.3 2001/05/17 11:02:15 keiron Exp $
  + * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * For details on use and redistribution please refer to the
  + * LICENSE file included with these sources."
    */
   
   package org.apache.fop.svg;
  @@ -69,39 +24,43 @@
    * that this element is not being layed out inside some incorrect
    * element.
    */
  -public abstract class SVGObj extends FObj implements GraphicsCreator {
  +public abstract class SVGObj extends FObj {
   
  -	String tagName = "";
  -	String[] props = {};
  -	/**
  -	 *
  -	 * @param parent the parent formatting object
  -	 * @param propertyList the explicit properties of this object
  -	 */
  -	public SVGObj(FObj parent, PropertyList propertyList) {
  -		super(parent, propertyList);
  -	}
  +    String tagName = "";
  +    String[] props = {};
  +    /**
  +     *
  +     * @param parent the parent formatting object
  +     * @param propertyList the explicit properties of this object
  +     */
  +    public SVGObj(FObj parent, PropertyList propertyList) {
  +        super(parent, propertyList);
  +    }
   
       protected static Hashtable ns = new Hashtable();
   
       public void addGraphic(Document doc, Element parent) {
  -        Element element = doc.createElementNS("http://www.w3.org/2000/svg", tagName);
  -//        Element element = doc.createElement(tagName);
  -        for(int count = 0; count < props.length; count++) {
  -            if(this.properties.get(props[count]) != null) {
  +        Element element = doc.createElementNS("http://www.w3.org/2000/svg",
  +                                              tagName);
  +        //        Element element = doc.createElement(tagName);
  +        for (int count = 0; count < props.length; count++) {
  +            if (this.properties.get(props[count]) != null) {
                   String rf = this.properties.get(props[count]).getString();
  -                if(rf != null) {
  -                    if(props[count].indexOf(":") == -1) {
  +                if (rf != null) {
  +                    if (props[count].indexOf(":") == -1) {
                           element.setAttribute(props[count], rf);
                       } else {
  -                        String pref = props[count].substring(0, props[count].indexOf(":"));
  -System.out.println(pref);
  -                        if(pref.equals("xmlns")) {
  -                            ns.put(props[count].substring(props[count].indexOf(":") + 1), rf);
  -System.out.println(ns);
  +                        String pref = props[count].substring(0,
  +                                                             props[count].indexOf(":"));
  +                        System.out.println(pref);
  +                        if (pref.equals("xmlns")) {
  +                            ns.put(props[count].substring(
  +                                     props[count].indexOf(":") + 1), rf);
  +                            System.out.println(ns);
                           }
                           ns.put("xlink", "http://www.w3.org/1999/xlink");
  -                        element.setAttributeNS((String)ns.get(pref), props[count], rf);
  +                        element.setAttributeNS((String) ns.get(pref),
  +                                               props[count], rf);
                       }
                   }
               }
  @@ -110,30 +69,27 @@
           int numChildren = this.children.size();
           for (int i = 0; i < numChildren; i++) {
               Object child = children.elementAt(i);
  -            if (child instanceof GraphicsCreator) {
  -                ((GraphicsCreator)child).addGraphic(doc, element);
  +            if (child instanceof SVGObj) {
  +                ((SVGObj) child).addGraphic(doc, element);
               } else if (child instanceof String) {
  -                org.w3c.dom.Text text = doc.createTextNode((String)child);
  +                org.w3c.dom.Text text = doc.createTextNode((String) child);
                   element.appendChild(text);
               }
           }
       }
  +
  +    /**
  +     * layout this formatting object.
  +     *
  +     * @param area the area to layout the object into
  +     * @return the status of the layout
  +     */
  +    public Status layout(Area area) throws FOPException {
  +        /* generate a warning */
  +        System.err.println("WARNING: " + this.name + " outside svg:svg");
   
  -	/**
  -	 * layout this formatting object.
  -	 *
  -	 * @param area the area to layout the object into
  -	 * @return the status of the layout
  -	 */
  -	public Status layout(Area area) throws FOPException
  -	{
  -//		if (area instanceof SVGArea) {
  -//		} else {
  -			/* otherwise generate a warning */
  -			System.err.println("WARNING: " + this.name + " outside svg:svg");
  -//		}
  -
  -		/* return status */
  -		return new Status(Status.OK);
  -	}
  +        /* return status */
  +        return new Status(Status.OK);
  +    }
   }
  +
  
  
  
  1.10      +14 -58    xml-fop/src/org/apache/fop/svg/SVGPropertyListMapping.java
  
  Index: SVGPropertyListMapping.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/SVGPropertyListMapping.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- SVGPropertyListMapping.java	2001/05/17 07:47:45	1.9
  +++ SVGPropertyListMapping.java	2001/05/17 11:02:20	1.10
  @@ -1,52 +1,7 @@
  -/*-- $Id: SVGPropertyListMapping.java,v 1.9 2001/05/17 07:47:45 keiron Exp $ --
  -
  - ============================================================================
  -                   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 <jt...@jtauber.com>. For more  information on the Apache
  - Software Foundation, please see <http://www.apache.org/>.
  -
  +/* $Id: SVGPropertyListMapping.java,v 1.10 2001/05/17 11:02:20 keiron Exp $
  + * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * For details on use and redistribution please refer to the
  + * LICENSE file included with these sources."
    */
   
   package org.apache.fop.svg;
  @@ -60,14 +15,15 @@
   
       public void addToBuilder(TreeBuilder builder) {
   
  -		String uri = "http://www.w3.org/2000/svg";
  -        builder.addPropertyList(uri, SVGPropertyMapping.getGenericMappings());
  -	/* Add any element mappings */
  -	for (Enumeration e = SVGPropertyMapping.getElementMappings();
  -	     e.hasMoreElements();) {
  -	  String elem = (String)e.nextElement();
  -	  builder.addElementPropertyList(uri, elem,
  -		  SVGPropertyMapping.getElementMapping(elem));
  -	}
  +        String uri = "http://www.w3.org/2000/svg";
  +        builder.addPropertyList(uri,
  +                                SVGPropertyMapping.getGenericMappings());
  +        /* Add any element mappings */
  +        for (Enumeration e = SVGPropertyMapping.getElementMappings();
  +                e.hasMoreElements();) {
  +            String elem = (String) e.nextElement();
  +            builder.addElementPropertyList(uri, elem,
  +                                           SVGPropertyMapping.getElementMapping(elem));
  +        }
       }
   }
  
  
  
  1.5       +12 -56    xml-fop/src/org/apache/fop/svg/SVGStringProperty.java
  
  Index: SVGStringProperty.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/SVGStringProperty.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SVGStringProperty.java	2001/05/17 07:47:46	1.4
  +++ SVGStringProperty.java	2001/05/17 11:02:23	1.5
  @@ -1,53 +1,9 @@
  -/*-- $Id: SVGStringProperty.java,v 1.4 2001/05/17 07:47:46 keiron Exp $ --
  -
  - ============================================================================
  -                   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 <jt...@jtauber.com>. For more  information on the Apache
  - Software Foundation, please see <http://www.apache.org/>.
  -
  +/* $Id: SVGStringProperty.java,v 1.5 2001/05/17 11:02:23 keiron Exp $
  + * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * For details on use and redistribution please refer to the
  + * LICENSE file included with these sources."
    */
  +
   package org.apache.fop.svg;
   
   import java.util.*;
  @@ -57,12 +13,12 @@
   import org.apache.fop.apps.FOPException;
   
   /**
  - * a class representing all the length properties in SVG
  + * a class representing all properties in SVG
    */
   public class SVGStringProperty extends Property {
   
       /**
  -     * inner class for making SVG Length objects.
  +     * inner class for making SVG String objects.
        */
       public static class Maker extends Property.Maker {
   
  @@ -76,7 +32,7 @@
           }
   
           /**
  -         * make an SVG Length property with the given value.
  +         * make an SVG String property with the given value.
            *
            * @param propertyList the property list this is a member of
            * @param value the explicit string value of the property
  @@ -87,7 +43,7 @@
           }
   
           /**
  -         * make an SVG Length property with the default value.
  +         * make an SVG String property with the default value.
            *
            * @param propertyList the property list the property is a member of
            */
  @@ -106,11 +62,11 @@
           return new SVGStringProperty.Maker();
       }
   
  -    /** the length as a Length object */
  +    /** the value */
       protected String value;
   
       /**
  -     * construct an SVG length (called by the Maker).
  +     * construct an SVG String (called by the Maker).
        *
        * @param propertyList the property list this is a member of
        * @param explicitValue the explicit value as a Length object
  @@ -121,7 +77,7 @@
       }
   
       /**
  -     * get the length
  +     * get the value
        *
        * @return the length as a Length object
        */
  
  
  
  1.1                  xml-fop/src/org/apache/fop/svg/SVGElement.java
  
  Index: SVGElement.java
  ===================================================================
  /* $Id: SVGElement.java,v 1.1 2001/05/17 11:01:57 keiron Exp $
   * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
   * For details on use and redistribution please refer to the
   * LICENSE file included with these sources."
   */
  
  package org.apache.fop.svg;
  
  // FOP
  import org.apache.fop.fo.*;
  import org.apache.fop.fo.properties.*;
  import org.apache.fop.layout.Area;
  import org.apache.fop.layout.FontState;
  import org.apache.fop.apps.FOPException;
  import org.apache.fop.layout.inline.*;
  
  import org.apache.batik.dom.svg.*;
  import org.w3c.dom.*;
  import org.w3c.dom.svg.*;
  import org.w3c.dom.svg.SVGLength;
  
  import org.w3c.dom.DOMImplementation;
  import org.apache.batik.dom.svg.SVGDOMImplementation;
  
  import java.io.File;
  
  /**
   * class representing svg:svg pseudo flow object.
   */
  public class SVGElement extends Svg {
  
      /**
       * inner class for making SVG objects.
       */
      public static class Maker extends FObj.Maker {
  
          /**
           * make an SVG object.
           *
           * @param parent the parent formatting object
           * @param propertyList the explicit properties of this object
           *
           * @return the SVG object
           */
          public FObj make(FObj parent,
                           PropertyList propertyList) throws FOPException {
              return new SVGElement(parent, propertyList);
          }
      }
  
      /**
       * returns the maker for this object.
       *
       * @return the maker for SVG objects
       */
      public static FObj.Maker maker() {
          return new SVGElement.Maker();
      }
  
      FontState fs;
  
      /**
       * constructs an SVG object (called by Maker).
       *
       * @param parent the parent formatting object
       * @param propertyList the explicit properties of this object
       */
      public SVGElement(FObj parent, PropertyList propertyList) {
          super(parent, propertyList);
      }
  
      /**
       * layout this formatting object.
       *
       * @param area the area to layout the object into
       *
       * @return the status of the layout
       */
      public Status layout(Area area) throws FOPException {
  
          if (!(area instanceof ForeignObjectArea)) {
              // this is an error
              throw new FOPException("SVG not in fo:instream-foreign-object");
          }
  
          /*if (this.marker == BREAK_AFTER) {
              return new Status(Status.OK);
          }*/
  
          if (this.marker == START) {
              /* retrieve properties */
              String id = this.properties.get("id").getString();
              String fontFamily =
                this.properties.get("font-family").getString();
              String fontStyle =
                this.properties.get("font-style").getString();
              String fontWeight =
                this.properties.get("font-weight").getString();
              String fontSz = this.properties.get("font-size").getString();
              int fontSize = area.getFontState().getFontSize();
              try {
                  fontSize = Integer.parseInt(fontSz);
              } catch (Exception e) {
              }
  
              // FIX-ME: should get the font-variant property
              this.fs = new FontState(area.getFontInfo(), fontFamily,
                                      fontStyle, fontWeight, fontSize, FontVariant.NORMAL);
  
              //						this.width = this.properties.get("width").getString();
              //						this.height = this.properties.get("height").getString();
  
              this.marker = 0;
          }
  
          /* create an SVG area */
          /* if width and height are zero, may want to get the bounds of the content. */
  
          DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
          String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
          Document doc = impl.createDocument(svgNS, "svg", null);
  
          Element svgRoot = doc.getDocumentElement();
  
          try {
              ((SVGOMDocument)doc).setURLObject(new File(".").toURL());
          } catch (Exception e) {
          }
  
          DefaultSVGContext dc = new DefaultSVGContext() {
                                     public float getPixelToMM() {
                                         return 0.264583333333333333333f;
                                         // 72 dpi
                                     }
                                     public float getViewportWidth() {
                                         return 100;
                                     }
                                     public float getViewportHeight() {
                                         return 100;
                                     }
                                 };
          ((SVGOMDocument)doc).setSVGContext(dc);
  
          for (int count = 0; count < props.length; count++) {
              if (this.properties.get(props[count]) != null) {
                  String rf = this.properties.get(props[count]).getString();
                  if (rf != null)
                      svgRoot.setAttributeNS(null, props[count], rf);
              }
          }
          //doc.appendChild(topLevel);
          int numChildren = this.children.size();
          for (int i = 0; i < numChildren; i++) {
              Object child = children.elementAt(i);
              if (child instanceof SVGObj) {
                  ((SVGObj) child).addGraphic(doc, svgRoot);
              } else if (child instanceof String) {
                  org.w3c.dom.Text text = doc.createTextNode((String) child);
                  svgRoot.appendChild(text);
              }
          }
  
          float width = ((SVGSVGElement) svgRoot).getWidth().getBaseVal().
                        getValue();
          float height = ((SVGSVGElement) svgRoot).getHeight().getBaseVal().
                         getValue();
          SVGArea svg = new SVGArea(fs, width, height);
          svg.setSVGDocument(doc);
          svg.start();
  
          /* finish off the SVG area */
          svg.end();
  
          /* add the SVG area to the containing area */
          ForeignObjectArea foa = (ForeignObjectArea) area;
          foa.setObject(svg);
          foa.setIntrinsicWidth(svg.getWidth());
          foa.setIntrinsicHeight(svg.getHeight());
  
          /* return status */
          return new Status(Status.OK);
      }
  }
  
  
  
  1.5       +144 -186  xml-fop/src/org/apache/fop/fo/SVGTreeBuilder.java
  
  Index: SVGTreeBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/SVGTreeBuilder.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SVGTreeBuilder.java	2001/05/17 07:46:04	1.4
  +++ SVGTreeBuilder.java	2001/05/17 11:03:15	1.5
  @@ -1,53 +1,9 @@
  -/*-- $Id: SVGTreeBuilder.java,v 1.4 2001/05/17 07:46:04 keiron Exp $ -- 
  -
  - ============================================================================
  -                   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 <jt...@jtauber.com>. For more  information on the Apache 
  - Software Foundation, please see <http://www.apache.org/>.
  - 
  +/* $Id: SVGTreeBuilder.java,v 1.5 2001/05/17 11:03:15 keiron Exp $
  + * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * For details on use and redistribution please refer to the
  + * LICENSE file included with these sources."
    */
  +
   package org.apache.fop.fo;
   
   // FOP
  @@ -88,7 +44,7 @@
        * class that builds a property list for each formatting object
        */
       protected Hashtable propertylistTable = new Hashtable();
  -	
  +
       /**
        * current formatting object being handled
        */
  @@ -105,55 +61,55 @@
       protected Hashtable unknownFOs = new Hashtable();
   
       // namespace implementation ideas pinched from John Cowan
  -/*    protected static class NSMap {
  -	String prefix;
  -	String uri;
  -	int level;
  -
  -	NSMap(String prefix, String uri, int level) {
  -	    this.prefix = prefix;
  -	    this.uri = uri;
  -	    this.level = level;
  -	}
  -    }
  +    /*    protected static class NSMap {
  +    	String prefix;
  +    	String uri;
  +    	int level;
  +
  +    	NSMap(String prefix, String uri, int level) {
  +    	    this.prefix = prefix;
  +    	    this.uri = uri;
  +    	    this.level = level;
  +    	}
  +        }
   
  -    protected int level = 0;
  -    protected Stack namespaceStack = new Stack();
  +        protected int level = 0;
  +        protected Stack namespaceStack = new Stack();
   
  -    {
  -	namespaceStack.push(new NSMap("xml",
  -				      "http://www.w3.org/XML/1998/namespace",
  -				      -1));
  -	namespaceStack.push(new NSMap("", "http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.dtd", -1));
  -    }
  +        {
  +    	namespaceStack.push(new NSMap("xml",
  +    				      "http://www.w3.org/XML/1998/namespace",
  +    				      -1));
  +    	namespaceStack.push(new NSMap("", "http://www.w3.org/2000/svg", -1));
  +        }
   
  -    protected String findURI(String prefix) {
  -	for (int i = namespaceStack.size() - 1; i >= 0; i--) {
  -	    NSMap nsMap = (NSMap) (namespaceStack.elementAt(i));
  -	    if (prefix.equals(nsMap.prefix)) return nsMap.uri;
  -	}
  -	return null;
  -    }
  +        protected String findURI(String prefix) {
  +    	for (int i = namespaceStack.size() - 1; i >= 0; i--) {
  +    	    NSMap nsMap = (NSMap) (namespaceStack.elementAt(i));
  +    	    if (prefix.equals(nsMap.prefix)) return nsMap.uri;
  +    	}
  +    	return null;
  +        }
   
  -    protected String mapName(String name)
  -	throws SAXException {
  -	int colon = name.indexOf(':');
  -	String prefix = "";
  -	String localPart = name;
  -	if (colon != -1) {
  -	    prefix = name.substring(0, colon);
  -	    localPart = name.substring(colon + 1);
  -	}
  -	String uri = findURI(prefix);
  -	if (uri == null) {
  -	    if (prefix.equals("")) {
  -		return "http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.dtd^" + name;
  -	    } else {
  -		throw new SAXException(new FOPException("Unknown namespace prefix " + prefix));
  -	    }
  -	}
  -	return uri + "^" + localPart;
  -    }*/
  +        protected String mapName(String name)
  +    	throws SAXException {
  +    	int colon = name.indexOf(':');
  +    	String prefix = "";
  +    	String localPart = name;
  +    	if (colon != -1) {
  +    	    prefix = name.substring(0, colon);
  +    	    localPart = name.substring(colon + 1);
  +    	}
  +    	String uri = findURI(prefix);
  +    	if (uri == null) {
  +    	    if (prefix.equals("")) {
  +    		return "http://www.w3.org/2000/svg^" + name;
  +    	    } else {
  +    		throw new SAXException(new FOPException("Unknown namespace prefix " + prefix));
  +    	    }
  +    	}
  +    	return uri + "^" + localPart;
  +        }*/
   
       /**
        * add a mapping from element name to maker.
  @@ -161,10 +117,10 @@
        * @param namespaceURI namespace URI of formatting object element
        * @param localName local name of formatting object element
        * @param maker Maker for class representing formatting object
  -    */
  +     */
       public void addMapping(String namespaceURI, String localName,
  -			   FObj.Maker maker) {
  -	this.fobjTable.put(namespaceURI + "^" + localName, maker);
  +                           FObj.Maker maker) {
  +        this.fobjTable.put(namespaceURI + "^" + localName, maker);
       }
   
       /**
  @@ -173,11 +129,12 @@
        * @param namespaceURI namespace URI of formatting object element
        * @param localName local name of formatting object element
        * @param maker Maker for class representing formatting object
  -    */
  +     */
       public void addPropertyList(String namespaceURI, Hashtable list) {
           PropertyListBuilder plb;
  -        plb = (PropertyListBuilder)this.propertylistTable.get(namespaceURI);
  -        if(plb == null) {
  +        plb = (PropertyListBuilder) this.propertylistTable.get(
  +                namespaceURI);
  +        if (plb == null) {
               plb = new PropertyListBuilder();
               plb.addList(list);
               this.propertylistTable.put(namespaceURI, plb);
  @@ -192,11 +149,13 @@
        * @param namespaceURI namespace URI of formatting object element
        * @param localName local name of formatting object element
        * @param maker Maker for class representing formatting object
  -    */
  -    public void addElementPropertyList(String namespaceURI, String localName, Hashtable list) {
  +     */
  +    public void addElementPropertyList(String namespaceURI,
  +                                       String localName, Hashtable list) {
           PropertyListBuilder plb;
  -        plb = (PropertyListBuilder)this.propertylistTable.get(namespaceURI);
  -        if(plb == null) {
  +        plb = (PropertyListBuilder) this.propertylistTable.get(
  +                namespaceURI);
  +        if (plb == null) {
               plb = new PropertyListBuilder();
               plb.addElementList(localName, list);
               this.propertylistTable.put(namespaceURI, plb);
  @@ -207,100 +166,99 @@
   
       /** SAX Handler for characters */
       public void characters(char data[], int start, int length) {
  -	currentFObj.addCharacters(data, start, start + length);
  +        currentFObj.addCharacters(data, start, start + length);
       }
   
       /** SAX Handler for the end of an element */
  -    public void endElement(
  -		String uri, String localName, String rawName) {
  -	currentFObj.end();
  -	currentFObj = (FObj) currentFObj.getParent();
  -/*	level--;
  -	while (((NSMap) namespaceStack.peek()).level > level) {
  -	    namespaceStack.pop();
  -	}*/
  +    public void endElement(String uri, String localName, String rawName) {
  +        currentFObj.end();
  +        currentFObj = (FObj) currentFObj.getParent();
  +        /*	level--;
  +         	while (((NSMap) namespaceStack.peek()).level > level) {
  +         	    namespaceStack.pop();
  +         	}*/
       }
   
       /** SAX Handler for the start of the document */
       public void startDocument() {
  -	MessageHandler.logln("building svg tree");
  +        MessageHandler.logln("building svg tree");
       }
   
       /** SAX Handler for the start of an element */
  -    public void startElement(String uri,
  -    	String localName, String rawName, Attributes attlist)
  -	throws SAXException { 
  -	/* the formatting object started */
  -	FObj fobj;
  -	if(uri.equals("")) {
  -		uri = "http://www.w3.org/2000/svg";
  -	}
  -
  -	/* the maker for the formatting object started */
  -	FObj.Maker fobjMaker;
  -
  -/*	level++;
  -	int length = attlist.getLength();
  -	for (int i = 0; i < length; i++) {
  -	    String att = attlist.getQName(i);
  -	    if (att.equals("xmlns")) {
  -		namespaceStack.push( new NSMap("",
  -					       attlist.getValue(i),
  -					       level));
  -	    } else if (att.startsWith("xmlns:")) {
  -		String value = attlist.getValue(i);
  -		namespaceStack.push(new NSMap(att.substring(6), value,
  -					      level));
  -	    }
  -	}*/
  -
  -//	String fullName = mapName(rawName);
  -	String fullName = uri + "^" + localName;
  -	fobjMaker = (FObj.Maker) fobjTable.get(fullName);
  -    PropertyListBuilder currentListBuilder = (PropertyListBuilder)this.propertylistTable.get(uri);
  -
  -	if (fobjMaker == null) {
  -	    if (!this.unknownFOs.containsKey(fullName)) {
  -		this.unknownFOs.put(fullName, "");
  -		MessageHandler.errorln("WARNING: Unknown formatting object "
  -				   + fullName);  
  -	    }
  -	    fobjMaker = new FObjMixed.Maker(); // fall back
  -	}
  -	
  -	try {
  -		PropertyList list = null;
  -		if(currentListBuilder != null) {
  -			list = currentListBuilder.makeList(fullName, attlist,  
  -			     (currentFObj == null) ? null : currentFObj.properties, currentFObj);
  -		}
  -	    fobj = fobjMaker.make(currentFObj, list);
  -	} catch (FOPException e) {
  -		throw new SAXException(e);
  -	}
  -
  -	if (rootFObj == null) {
  -	    rootFObj = fobj;
  -	    if (!fobj.getName().equals("svg:svg")) {
  -		throw new SAXException(new FOPException("Root element must"
  -							+ " be svg, not "
  -							+ fobj.getName())); 
  -	    }
  -	} else {
  -	    currentFObj.addChild(fobj);
  -	}
  -	
  -	currentFObj = fobj;
  +    public void startElement(String uri, String localName,
  +                             String rawName, Attributes attlist) throws SAXException {
  +        /* the formatting object started */
  +        FObj fobj;
  +        if (uri.equals("")) {
  +            uri = "http://www.w3.org/2000/svg";
  +        }
  +
  +        /* the maker for the formatting object started */
  +        FObj.Maker fobjMaker;
  +
  +        /*	level++;
  +        	int length = attlist.getLength();
  +        	for (int i = 0; i < length; i++) {
  +        	    String att = attlist.getQName(i);
  +        	    if (att.equals("xmlns")) {
  +        		namespaceStack.push( new NSMap("",
  +        					       attlist.getValue(i),
  +        					       level));
  +        	    } else if (att.startsWith("xmlns:")) {
  +        		String value = attlist.getValue(i);
  +        		namespaceStack.push(new NSMap(att.substring(6), value,
  +        					      level));
  +        	    }
  +        	}*/
  +
  +        //	String fullName = mapName(rawName);
  +        String fullName = uri + "^" + localName;
  +        fobjMaker = (FObj.Maker) fobjTable.get(fullName);
  +        PropertyListBuilder currentListBuilder =
  +          (PropertyListBuilder) this.propertylistTable.get(uri);
  +
  +        if (fobjMaker == null) {
  +            if (!this.unknownFOs.containsKey(fullName)) {
  +                this.unknownFOs.put(fullName, "");
  +                MessageHandler.errorln(
  +                  "WARNING: Unknown formatting object " + fullName);
  +            }
  +            fobjMaker = new FObjMixed.Maker(); // fall back
  +        }
  +
  +        try {
  +            PropertyList list = null;
  +            if (currentListBuilder != null) {
  +                list = currentListBuilder.makeList(fullName, attlist,
  +                                                   (currentFObj == null) ? null :
  +                                                   currentFObj.properties, currentFObj);
  +            }
  +            fobj = fobjMaker.make(currentFObj, list);
  +        } catch (FOPException e) {
  +            throw new SAXException(e);
  +        }
  +
  +        if (rootFObj == null) {
  +            rootFObj = fobj;
  +            if (!fobj.getName().equals("svg:svg")) {
  +                throw new SAXException(
  +                  new FOPException("Root element must" +
  +                                   " be svg, not " + fobj.getName()));
  +            }
  +        } else {
  +            currentFObj.addChild(fobj);
  +        }
  +
  +        currentFObj = fobj;
       }
   
       /**
        */
  -    public SVGDocument getSVGDocument()
  -    {
  -    	SVGDocument doc = null;
  -/*    	doc = new SVGDocumentImpl();
  -        SVGSVGElement svg = (SVGSVGElement)((org.apache.fop.svg.SVG)rootFObj).createGraphic();
  -        doc.appendChild(svg);*/
  -    	return doc;
  +    public SVGDocument getSVGDocument() {
  +        SVGDocument doc = null;
  +        /*    	doc = new SVGDocumentImpl();
  +                 SVGSVGElement svg = (SVGSVGElement)((org.apache.fop.svg.SVG)rootFObj).createGraphic();
  +                 doc.appendChild(svg);*/
  +        return doc;
       }
   }
  
  
  
  1.21      +2 -1      xml-fop/src/org/apache/fop/render/awt/AWTRenderer.java
  
  Index: AWTRenderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/awt/AWTRenderer.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- AWTRenderer.java	2001/05/17 07:46:19	1.20
  +++ AWTRenderer.java	2001/05/17 11:03:23	1.21
  @@ -20,6 +20,7 @@
   import org.apache.fop.apps.*;
   
   import org.w3c.dom.svg.*;
  +import org.w3c.dom.Document;
   
   import org.apache.batik.bridge.*;
   import org.apache.batik.swing.svg.*;
  @@ -682,7 +683,7 @@
   
   //        this.currentYPosition -= h;
   
  -        SVGDocument doc = area.getSVGDocument();
  +        Document doc = area.getSVGDocument();
   
           UserAgent userAgent = new MUserAgent(new AffineTransform());
   
  
  
  
  1.65      +3 -3      xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java
  
  Index: PDFRenderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java,v
  retrieving revision 1.64
  retrieving revision 1.65
  diff -u -r1.64 -r1.65
  --- PDFRenderer.java	2001/05/17 08:36:26	1.64
  +++ PDFRenderer.java	2001/05/17 11:03:31	1.65
  @@ -1,4 +1,4 @@
  -/* $Id: PDFRenderer.java,v 1.64 2001/05/17 08:36:26 keiron Exp $
  +/* $Id: PDFRenderer.java,v 1.65 2001/05/17 11:03:31 keiron Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources."
  @@ -329,7 +329,7 @@
           // place at the current instream offset
           int x = this.currentXPosition;
           int y = this.currentYPosition;
  -        SVGSVGElement svg = area.getSVGDocument().getRootElement();
  +        SVGSVGElement svg = ((SVGDocument)area.getSVGDocument()).getRootElement();
           int w = (int)(svg.getWidth().getBaseVal().getValue() * 1000);
           int h = (int)(svg.getHeight().getBaseVal().getValue() * 1000);
           float sx = 1, sy = -1;
  @@ -358,7 +358,7 @@
                             " " + yOffset / 1000f + " cm\n");
   
   
  -        SVGDocument doc = area.getSVGDocument();
  +        Document doc = area.getSVGDocument();
   
           UserAgent userAgent = new MUserAgent(new AffineTransform());
   
  
  
  
  1.6       +1 -31     xml-fop/src/org/apache/fop/render/txt/TXTRenderer.java
  
  Index: TXTRenderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/txt/TXTRenderer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TXTRenderer.java	2001/05/17 07:46:40	1.5
  +++ TXTRenderer.java	2001/05/17 11:03:40	1.6
  @@ -1,4 +1,4 @@
  -/* $Id: TXTRenderer.java,v 1.5 2001/05/17 07:46:40 keiron Exp $
  +/* $Id: TXTRenderer.java,v 1.6 2001/05/17 11:03:40 keiron Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources."
  @@ -16,7 +16,6 @@
   import org.apache.fop.layout.*;
   import org.apache.fop.layout.inline.*;
   import org.apache.fop.datatypes.*;
  -import org.apache.fop.svg.PathPoint;
   import org.apache.fop.pdf.PDFPathPaint;
   import org.apache.fop.pdf.PDFColor;
   import org.apache.fop.image.*;
  @@ -790,35 +789,6 @@
   	// Add a polyline or polygon. Does not support fills yet!!!
       protected void addPolyline(Vector points, int posx, int posy, PDFColor fc, PDFColor sc, float sw, boolean close)
       {
  -		PathPoint pc;
  -    	float lastx = 0;
  -    	float lasty = 0;
  -    	float curx = 0;
  -    	float cury = 0;
  -    	float startx = 0;
  -    	float starty = 0;
  -    	Enumeration e = points.elements();
  -    	if(e.hasMoreElements())
  -    	{
  -    		pc = (PathPoint)e.nextElement();
  -			lastx = pc.x + posx / 1000;
  -			lasty = ((pageHeight / 10) - posy/1000) + pc.y;
  -			startx = lastx;
  -			starty = lasty;
  -    	}
  -    	while(e.hasMoreElements())
  -    	{
  -    		pc = (PathPoint)e.nextElement();
  -			curx = pc.x + posx / 1000;
  -			cury = ((pageHeight / 10) - posy/1000) + pc.y;
  -    		addLine(lastx, lasty, curx, cury, sc, sw);
  -			lastx = curx;
  -			lasty = cury;
  -    	}
  -    	if(close)
  -		{
  -    		addLine(lastx, lasty, startx, starty, sc, sw);
  -		}
       }
   
   	boolean printBMP(FopImage img, int x, int y, int w, int h) throws FopImageException
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org