jeremias 2003/03/07 02:47:42 Modified: examples/mathml/src/org/apache/fop/mathml MathMLObj.java MathMLElement.java MathMLElementMapping.java Log: Switched to long licence Some general checkstyle fixing Revision Changes Path 1.2 +56 -6 xml-fop/examples/mathml/src/org/apache/fop/mathml/MathMLObj.java Index: MathMLObj.java =================================================================== RCS file: /home/cvs/xml-fop/examples/mathml/src/org/apache/fop/mathml/MathMLObj.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MathMLObj.java 29 Jan 2003 16:25:25 -0000 1.1 +++ MathMLObj.java 7 Mar 2003 10:47:42 -0000 1.2 @@ -1,9 +1,53 @@ -/* $Id$ - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. - * For details on use and redistribution please refer to the - * LICENSE file included with these sources. - */ - +/* + * $Id$ + * ============================================================================ + * The Apache Software License, Version 1.1 + * ============================================================================ + * + * Copyright (C) 1999-2003 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 + * [EMAIL PROTECTED] + * + * 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 <[EMAIL PROTECTED]>. For more information on the Apache + * Software Foundation, please see <http://www.apache.org/>. + */ package org.apache.fop.mathml; // FOP @@ -15,10 +59,16 @@ */ public class MathMLObj extends XMLObj { + /** + * @see org.apache.fop.fo.FONode#FONode(FONode) + */ public MathMLObj(FONode parent) { super(parent); } + /** + * @see org.apache.fop.fo.XMLObj#getNameSpace() + */ public String getNameSpace() { return MathMLElementMapping.URI; } 1.2 +85 -12 xml-fop/examples/mathml/src/org/apache/fop/mathml/MathMLElement.java Index: MathMLElement.java =================================================================== RCS file: /home/cvs/xml-fop/examples/mathml/src/org/apache/fop/mathml/MathMLElement.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MathMLElement.java 29 Jan 2003 16:25:25 -0000 1.1 +++ MathMLElement.java 7 Mar 2003 10:47:42 -0000 1.2 @@ -1,9 +1,53 @@ -/* $Id$ - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. - * For details on use and redistribution please refer to the - * LICENSE file included with these sources. - */ - +/* + * $Id$ + * ============================================================================ + * The Apache Software License, Version 1.1 + * ============================================================================ + * + * Copyright (C) 1999-2003 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 + * [EMAIL PROTECTED] + * + * 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 <[EMAIL PROTECTED]>. For more information on the Apache + * Software Foundation, please see <http://www.apache.org/>. + */ package org.apache.fop.mathml; import java.awt.Color; @@ -13,8 +57,11 @@ import org.apache.fop.fo.FONode; import org.apache.fop.apps.FOPException; +import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; -import org.w3c.dom.*; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + import org.xml.sax.Attributes; import org.apache.batik.svggen.SVGGraphics2D; @@ -23,21 +70,34 @@ import net.sourceforge.jeuclid.MathBase; import net.sourceforge.jeuclid.DOMMathBuilder; +/** + * Defines the top-level element for MathML. + */ public class MathMLElement extends MathMLObj { - Document svgDoc = null; - float width; - float height; - boolean converted = false; + private Document svgDoc = null; + private float width; + private float height; + private boolean converted = false; + + /** + * @see org.apache.fop.fo.FONode#FONode(FONode) + */ public MathMLElement(FONode parent) { super(parent); } + /** + * @see org.apache.fop.fo.FONode#handleAttrs(Attributes) + */ public void handleAttrs(Attributes attlist) throws FOPException { super.handleAttrs(attlist); createBasicDocument(); } + /** + * Converts the MathML to SVG. + */ public void convertToSVG() { try { if (!converted) { @@ -70,10 +130,14 @@ } + /** + * Create the SVG from MathML. + * @return the DOM document containing SVG + */ public static Document createSVG(MathBase base) { DOMImplementation impl = - SVGDOMImplementation.getDOMImplementation(); + SVGDOMImplementation.getDOMImplementation(); String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI; Document svgdocument = impl.createDocument(svgNS, "svg", null); @@ -104,11 +168,17 @@ } + /** + * @see org.apache.fop.fo.XMLObj#getDocument() + */ public Document getDocument() { convertToSVG(); return doc; } + /** + * @see org.apache.fop.fo.XMLObj#getDocumentNamespace() + */ public String getDocumentNamespace() { if (svgDoc == null) { return MathMLElementMapping.URI; @@ -116,6 +186,9 @@ return "http://www.w3.org/2000/svg"; } + /** + * @see org.apache.fop.fo.XMLObj#getDimension(Point2D) + */ public Point2D getDimension(Point2D view) { convertToSVG(); return new Point2D.Float(width, height); 1.2 +58 -6 xml-fop/examples/mathml/src/org/apache/fop/mathml/MathMLElementMapping.java Index: MathMLElementMapping.java =================================================================== RCS file: /home/cvs/xml-fop/examples/mathml/src/org/apache/fop/mathml/MathMLElementMapping.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MathMLElementMapping.java 29 Jan 2003 16:25:25 -0000 1.1 +++ MathMLElementMapping.java 7 Mar 2003 10:47:42 -0000 1.2 @@ -1,9 +1,53 @@ -/* $Id$ - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. - * For details on use and redistribution please refer to the - * LICENSE file included with these sources. - */ - +/* + * $Id$ + * ============================================================================ + * The Apache Software License, Version 1.1 + * ============================================================================ + * + * Copyright (C) 1999-2003 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 + * [EMAIL PROTECTED] + * + * 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 <[EMAIL PROTECTED]>. For more information on the Apache + * Software Foundation, please see <http://www.apache.org/>. + */ package org.apache.fop.mathml; import org.apache.fop.fo.FOTreeBuilder; @@ -18,8 +62,12 @@ import net.sourceforge.jeuclid.MathBase; import net.sourceforge.jeuclid.DOMMathBuilder; +/** + * This class provides the element mapping for FOP. + */ public class MathMLElementMapping implements ElementMapping { + /** MathML namespace */ public static final String URI = "http://www.w3.org/1998/Math/MathML"; private static HashMap foObjs = null; @@ -34,6 +82,9 @@ } } + /** + * @see org.apache.fop.fo.ElementMapping#addToBuilder(FOTreeBuilder) + */ public void addToBuilder(FOTreeBuilder builder) { setupMathML(); builder.addMapping(URI, foObjs); @@ -78,6 +129,7 @@ return info; } catch (Throwable t) { + /[EMAIL PROTECTED] log that properly */ } return null;
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]