jeremias    2003/03/07 00:09:27

  Modified:    src/org/apache/fop/mif RefElement.java RulingElement.java
                        PGFElement.java MIFFile.java MIFHandler.java
                        MIFElement.java
  Log:
  Switched to long licence
  Some general checkstyle fixing
  
  Revision  Changes    Path
  1.2       +50 -10    xml-fop/src/org/apache/fop/mif/RefElement.java
  
  Index: RefElement.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/mif/RefElement.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RefElement.java   5 Jun 2002 14:52:27 -0000       1.1
  +++ RefElement.java   7 Mar 2003 08:09:26 -0000       1.2
  @@ -1,16 +1,55 @@
   /*
    * $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.
  - */
  -
  + * ============================================================================
  + *                    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.mif;
   
  -// Java
  -import java.io.*;
  -import java.util.*;
  -
   /**
    * Reference MIF Element.
    * This element is a lookup reference set that contains
  @@ -23,6 +62,7 @@
   public class RefElement extends MIFElement {
   
       /**
  +     * @see org.apache.fop.mif.MIFElement#MIFElement(String)
        */
       public RefElement(String n) {
           super(n);
  
  
  
  1.2       +50 -16    xml-fop/src/org/apache/fop/mif/RulingElement.java
  
  Index: RulingElement.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/mif/RulingElement.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RulingElement.java        5 Jun 2002 14:52:27 -0000       1.1
  +++ RulingElement.java        7 Mar 2003 08:09:26 -0000       1.2
  @@ -1,29 +1,63 @@
   /*
    * $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.
  - */
  -
  + * ============================================================================
  + *                    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.mif;
   
  -// Java
  -import java.io.*;
  -import java.util.*;
  -
  -/**
  - *
  - */
   public class RulingElement extends RefElement {
   
  -    /**
  -     */
       public RulingElement() {
           super("RulingCatalog");
       }
   
       public MIFElement lookupElement(Object key) {
  -        if(key == null) {
  +        if (key == null) {
               MIFElement rul = new MIFElement("Ruling");
               MIFElement prop = new MIFElement("RulingTag");
               prop.setValue("`Default'");
  
  
  
  1.2       +51 -11    xml-fop/src/org/apache/fop/mif/PGFElement.java
  
  Index: PGFElement.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/mif/PGFElement.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PGFElement.java   5 Jun 2002 14:52:27 -0000       1.1
  +++ PGFElement.java   7 Mar 2003 08:09:26 -0000       1.2
  @@ -1,16 +1,55 @@
   /*
    * $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.
  - */
  -
  + * ============================================================================
  + *                    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.mif;
   
  -// Java
  -import java.io.*;
  -import java.util.*;
  -
   /**
    * Font Catalog element.
    * This is the reference lookup element for fonts in
  @@ -19,13 +58,14 @@
   public class PGFElement extends RefElement {
   
       /**
  +     * Creates a new font catalog element.
        */
       public PGFElement() {
           super("PgfCatalog");
       }
   
       public MIFElement lookupElement(Object key) {
  -        if(key == null) {
  +        if (key == null) {
               MIFElement pgf = new MIFElement("Pgf");
               MIFElement prop = new MIFElement("PgfTag");
               prop.setValue("`Body'");
  
  
  
  1.2       +63 -18    xml-fop/src/org/apache/fop/mif/MIFFile.java
  
  Index: MIFFile.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/mif/MIFFile.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MIFFile.java      5 Jun 2002 14:52:27 -0000       1.1
  +++ MIFFile.java      7 Mar 2003 08:09:26 -0000       1.2
  @@ -1,15 +1,60 @@
   /*
    * $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.
  - */
  -
  + * ============================================================================
  + *                    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.mif;
   
   // Java
  -import java.io.*;
  -import java.util.*;
  +import java.io.IOException;
  +import java.io.OutputStream;
  +import java.util.Iterator;
  +import java.util.List;
   
   /**
    * The MIF File.
  @@ -32,15 +77,13 @@
       protected MIFElement initialAutoNums = null;
       protected MIFElement aFrames = null;
       protected MIFElement tbls = null;
  -    protected ArrayList pages = new ArrayList();
  -    protected ArrayList textFlows = null;
  +    protected List pages = new java.util.ArrayList();
  +    protected List textFlows = null;
   
   
  -    /**
  -     */
       public MIFFile() {
           super("");
  -        valueElements = new ArrayList();
  +        valueElements = new java.util.ArrayList();
           setup();
       }
   
  @@ -93,25 +136,27 @@
       }
   
       public void output(OutputStream os) throws IOException {
  -        if(finished) return;
  +        if (finished) {
  +            return;
  +        }
   
  -        if(!started) {
  +        if (!started) {
               os.write(("<MIFFile  5.00> # Generated by FOP\n"/* + 
getVersion()*/).getBytes());
               started = true;
           }
           boolean done = true;
   
  -        for(Iterator iter = valueElements.iterator(); iter.hasNext(); ) {
  +        for (Iterator iter = valueElements.iterator(); iter.hasNext();) {
               MIFElement el = (MIFElement)iter.next();
               boolean d = el.output(os, 0);
  -            if(d) {
  +            if (d) {
                   iter.remove();
               } else {
                   done = false;
                   break;
               }
           }
  -        if(done && finish) {
  +        if (done && finish) {
               os.write(("# end of MIFFile").getBytes());
           }
       }
  
  
  
  1.6       +105 -23   xml-fop/src/org/apache/fop/mif/MIFHandler.java
  
  Index: MIFHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/mif/MIFHandler.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MIFHandler.java   29 Nov 2002 23:18:56 -0000      1.5
  +++ MIFHandler.java   7 Mar 2003 08:09:26 -0000       1.6
  @@ -1,26 +1,75 @@
   /*
    * $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.
  - */
  -
  + * ============================================================================
  + *                    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.mif;
   
  -import org.apache.fop.apps.StructureHandler;
  -import org.apache.fop.layout.FontInfo;
  -import org.apache.fop.fo.pagination.*;
  -import org.apache.fop.fo.flow.*;
  -import org.apache.fop.fo.*;
  -import org.apache.fop.apps.FOPException;
  -
   // Java
  -import java.io.*;
  -import java.util.*;
  +import java.io.IOException;
  +import java.io.OutputStream;
   
  +// XML
   import org.xml.sax.SAXException;
   
  -// do we really want every method throwing a SAXException
  +// FOP
  +import org.apache.fop.apps.StructureHandler;
  +import org.apache.fop.fo.Title;
  +import org.apache.fop.fo.flow.Block;
  +import org.apache.fop.fo.flow.Flow;
  +import org.apache.fop.fo.pagination.LayoutMasterSet;
  +import org.apache.fop.fo.pagination.PageSequence;
  +import org.apache.fop.fo.pagination.PageSequenceMaster;
  +import org.apache.fop.fo.pagination.SimplePageMaster;
  +import org.apache.fop.layout.FontInfo;
  +import org.apache.fop.apps.FOPException;
  +
  +// TODO: do we really want every method throwing a SAXException
   
   /**
    * The MIF Handler.
  @@ -29,15 +78,20 @@
    * This builds an MIF file and writes it to the output.
    */
   public class MIFHandler extends StructureHandler {
  +    
  +    /** the MIFFile instance */
       protected MIFFile mifFile;
  +    /** the OutputStream to write to */
       protected OutputStream outStream;
       private FontInfo fontInfo = new FontInfo();
   
       // current state elements
  -    MIFElement textFlow;
  -    MIFElement para;
  +    private MIFElement textFlow;
  +    private MIFElement para;
   
       /**
  +     * Creates a new MIF handler on a given OutputStream.
  +     * @param os OutputStream to write to
        */
       public MIFHandler(OutputStream os) {
           outStream = os;
  @@ -45,26 +99,35 @@
           org.apache.fop.render.pdf.FontSetup.setup(fontInfo, null);
       }
   
  +    /**
  +     * @see org.apache.fop.apps.StructureHandler#getFontInfo()
  +     */
       public FontInfo getFontInfo() {
           return fontInfo;
       }
   
  +    /**
  +     * @see org.apache.fop.apps.StructureHandler#startDocument()
  +     */
       public void startDocument() throws SAXException {
           mifFile = new MIFFile();
           try {
               mifFile.output(outStream);
  -        } catch(IOException ioe) {
  +        } catch (IOException ioe) {
               throw new SAXException(ioe);
           }
       }
   
  +    /**
  +     * @see org.apache.fop.apps.StructureHandler#endDocument()
  +     */
       public void endDocument() throws SAXException {
           // finish all open elements
           mifFile.finish(true);
           try {
               mifFile.output(outStream);
               outStream.flush();
  -        } catch(IOException ioe) {
  +        } catch (IOException ioe) {
               throw new SAXException(ioe);
           }
       }
  @@ -73,13 +136,14 @@
        * Start the page sequence.
        * This creates the pages in the MIF document that will be used
        * by the following flows and static areas.
  +     * @see org.apache.fop.apps.StructureHandler
        */
       public void startPageSequence(PageSequence pageSeq, Title seqTitle, 
LayoutMasterSet lms) {
           // get the layout master set
           // setup the pages for this sequence
           String name = pageSeq.getProperty("master-reference").getString();
           SimplePageMaster spm = lms.getSimplePageMaster(name);
  -        if(spm == null) {
  +        if (spm == null) {
               PageSequenceMaster psm = lms.getPageSequenceMaster(name);
           } else {
               // create simple master with regions
  @@ -118,38 +182,56 @@
           }
       }
   
  +    /**
  +     * @see org.apache.fop.apps.StructureHandler#endPageSequence(PageSequence)
  +     */
       public void endPageSequence(PageSequence pageSeq) throws FOPException {
   
       }
   
  +    /**
  +     * @see org.apache.fop.apps.StructureHandler#startFlow(Flow)
  +     */
       public void startFlow(Flow fl) {
           // start text flow in body region
           textFlow = new MIFElement("TextFlow");
       }
   
  +    /**
  +     * @see org.apache.fop.apps.StructureHandler#endFlow(Flow)
  +     */
       public void endFlow(Flow fl) {
           textFlow.finish(true);
           mifFile.addElement(textFlow);
           textFlow = null;
       }
   
  +    /**
  +     * @see org.apache.fop.apps.StructureHandler#startBlock(Block)
  +     */
       public void startBlock(Block bl) {
           para = new MIFElement("Para");
           // get font
           textFlow.addElement(para);
       }
   
  +    /**
  +     * @see org.apache.fop.apps.StructureHandler#endBlock(Block)
  +     */
       public void endBlock(Block bl) {
           para.finish(true);
           para = null;
       }
   
  +    /**
  +     * @see org.apache.fop.apps.StructureHandler#characters(char[], int, int)
  +     */
       public void characters(char data[], int start, int length) {
  -        if(para != null) {
  +        if (para != null) {
               String str = new String(data, start, length);
               str = str.trim();
               // break into nice length chunks
  -            if(str.length() == 0) {
  +            if (str.length() == 0) {
                   return;
               }
   
  
  
  
  1.3       +74 -22    xml-fop/src/org/apache/fop/mif/MIFElement.java
  
  Index: MIFElement.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/mif/MIFElement.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MIFElement.java   10 Jun 2002 08:51:37 -0000      1.2
  +++ MIFElement.java   7 Mar 2003 08:09:26 -0000       1.3
  @@ -1,15 +1,60 @@
   /*
    * $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.
  - */
  -
  + * ============================================================================
  + *                    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.mif;
   
   // Java
  -import java.io.*;
  -import java.util.*;
  +import java.io.IOException;
  +import java.io.OutputStream;
  +import java.util.Iterator;
  +import java.util.List;
   
   /**
    * The is the basis for MIF document elements.
  @@ -19,7 +64,7 @@
   public class MIFElement {
       protected String name;
       protected String valueStr = null;
  -    protected ArrayList valueElements = null;
  +    protected List valueElements = null;
   
       protected boolean started = false;
       protected boolean finish = false;
  @@ -36,8 +81,8 @@
       }
   
       public void addElement(MIFElement el) {
  -        if(valueElements == null) {
  -            valueElements = new ArrayList();
  +        if (valueElements == null) {
  +            valueElements = new java.util.ArrayList();
           }
           valueElements.add(el);
       }
  @@ -50,30 +95,37 @@
        * the finish method is called.
        */
       public boolean output(OutputStream os, int indent) throws IOException {
  -        if(finished) return true;
  -        if(valueElements == null && valueStr == null) return false;
  +        if (finished) {
  +            return true;
  +        }
  +        if (valueElements == null && valueStr == null) {
  +            return false;
  +        }
   
           String indentStr = "";
  -        for(int c = 0; c < indent; c++) indentStr += " ";
  -        if(!started) {
  +        for (int c = 0; c < indent; c++) {
  +            indentStr += " ";
  +        }
  +        if (!started) {
               os.write((indentStr + "<" + name).getBytes());
  -            if(valueElements != null)
  +            if (valueElements != null) {
                   os.write(("\n").getBytes());
  +            }
               started = true;
           }
  -        if(valueElements != null) {
  +        if (valueElements != null) {
               boolean done = true;
  -            for(Iterator iter = valueElements.iterator(); iter.hasNext(); ) {
  +            for (Iterator iter = valueElements.iterator(); iter.hasNext();) {
                   MIFElement el = (MIFElement)iter.next();
                   boolean d = el.output(os, indent + 1);
  -                if(d) {
  +                if (d) {
                       iter.remove();
                   } else {
                       done = false;
                       break;
                   }
               }
  -            if(!finish || !done) {
  +            if (!finish || !done) {
                   return false;
               }
               os.write((indentStr + "> # end of " + name + "\n").getBytes());
  @@ -86,8 +138,8 @@
   
       public void finish(boolean deep) {
           finish = true;
  -        if(deep && valueElements != null) {
  -            for(Iterator iter = valueElements.iterator(); iter.hasNext(); ) {
  +        if (deep && valueElements != null) {
  +            for (Iterator iter = valueElements.iterator(); iter.hasNext();) {
                   MIFElement el = (MIFElement)iter.next();
                   el.finish(deep);
               }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to