acoliver    02/03/23 15:35:21

  Modified:    src/scratchpad/src/org/apache/poi/hdf/model
                        HDFObjectFactory.java
               src/targets interactive.xtarget
               src/types/styles hdftype.xsl
  Log:
  Started work
  
  Revision  Changes    Path
  1.3       +38 -7     
jakarta-poi/src/scratchpad/src/org/apache/poi/hdf/model/HDFObjectFactory.java
  
  Index: HDFObjectFactory.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-poi/src/scratchpad/src/org/apache/poi/hdf/model/HDFObjectFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HDFObjectFactory.java     20 Mar 2002 12:35:26 -0000      1.2
  +++ HDFObjectFactory.java     23 Mar 2002 23:35:21 -0000      1.3
  @@ -7,10 +7,18 @@
   package org.apache.poi.hdf.model;
   
   
  -import java.io.*;
  +//import java.io;
  +
  +import java.util.ArrayList;
  +import java.io.InputStream;
  +import java.io.IOException;
  +import java.util.List;
  +import java.util.TreeSet;
  +
   
   import org.apache.poi.hdf.model.hdftypes.*;
  -import org.apache.poi.hdf.model.util.*;
  +//import org.apache.poi.hdf.model.util.*;
  +
   import org.apache.poi.poifs.filesystem.POIFSFileSystem;
   import org.apache.poi.poifs.filesystem.POIFSDocument;
   import org.apache.poi.poifs.filesystem.DocumentEntry;
  @@ -41,13 +49,14 @@
       private FontTable _fonts;
   
       /** text pieces */
  -    BTreeSet _text = new BTreeSet();
  +    //BTreeSet _text = new BTreeSet();
  +    TreeSet _text = new TreeSet();
       /** document sections */
  -    BTreeSet _sections = new BTreeSet();
  +    TreeSet _sections = new TreeSet();
       /** document paragraphs */
  -    BTreeSet _paragraphs = new BTreeSet();
  +    TreeSet _paragraphs = new TreeSet();
       /** document character runs */
  -    BTreeSet _characterRuns = new BTreeSet();
  +    TreeSet _characterRuns = new TreeSet();
   
       /** main document stream buffer*/
       byte[] _mainDocument;
  @@ -78,9 +87,31 @@
           initTextPieces();
           initFormattingProperties();
   
  -        istream.close();
  +    }
  +    
  +    public static List getTypes(InputStream istream) throws IOException
  +    {
  +        List results = new ArrayList(1);
  +        
  +        //do Ole stuff
  +        POIFSFileSystem filesystem = new POIFSFileSystem(istream);
  +        
  +        DocumentEntry headerProps =
  +            (DocumentEntry)filesystem.getRoot().getEntry("WordDocument");
  +
  +        byte[] mainDocument = new byte[headerProps.getSize()];
  +        filesystem.createDocumentInputStream("WordDocument").read(mainDocument);
  +
  +        FileInformationBlock fib = new FileInformationBlock(mainDocument);
   
  +       // initTableStream();
  +       // initTextPieces();
  +       // initFormattingProperties();
  +        
  +        results.add(fib);
  +        return results;
       }
  +   
       /**
        * Initializes the table stream
        *
  
  
  
  1.3       +1 -0      jakarta-poi/src/targets/interactive.xtarget
  
  Index: interactive.xtarget
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/targets/interactive.xtarget,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- interactive.xtarget       16 Mar 2002 08:59:15 -0000      1.2
  +++ interactive.xtarget       23 Mar 2002 23:35:21 -0000      1.3
  @@ -24,6 +24,7 @@
       <echo message=" scratchpad ------- build-run scratchpad code"/>       
       <echo message=" contrib ---------- build-run contributed code"/>    
       <echo message=" generate-records - generate excel records"/>    
  +    <echo message=" generate-types --- generate word types"/>    
   
       <property name="input.selection" value="compile"/>        
       <user-input name="input.selection">Please select a target </user-input>   
  
  
  
  1.4       +2 -18     jakarta-poi/src/types/styles/hdftype.xsl
  
  Index: hdftype.xsl
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/types/styles/hdftype.xsl,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- hdftype.xsl       21 Mar 2002 00:49:36 -0000      1.3
  +++ hdftype.xsl       23 Mar 2002 23:35:21 -0000      1.4
  @@ -79,7 +79,7 @@
   public class <xsl:value-of select="@name"/>Type
       implements HDFType
   {
  -    public final static short      sid                             = <xsl:value-of 
select="@id"/>;
  +
   <xsl:for-each select="//fields/field">    private  <xsl:value-of 
select="recutil:getType(@size,@type,10)"/><xsl:text> </xsl:text><xsl:value-of 
select="recutil:getFieldName(position(),@name,0)"/>;
   <xsl:apply-templates select="./bit|./const"/>
   </xsl:for-each>
  @@ -110,18 +110,6 @@
           return buffer.toString();
       }
   
  -    public int serialize(int offset, byte[] data)
  -    {
  -        LittleEndian.putShort(data, 0 + offset, sid);
  -        LittleEndian.putShort(data, 2 + offset, (short)(getSize() - 4));
  -<xsl:variable name="fieldIterator" select="field:new()"/>
  -<xsl:for-each select="//fields/field"><xsl:text>
  -        </xsl:text><xsl:value-of 
select="field:serialiseEncoder($fieldIterator,position(),@name,@size,@type)"/>
  -</xsl:for-each>
  -
  -        return getSize();
  -    }
  -
       /**
        * Size of record (exluding 4 byte header)
        */
  @@ -134,10 +122,6 @@
   </xsl:for-each>;
       }
   
  -    public short getSid()
  -    {
  -        return this.sid;
  -    }
   
   <xsl:apply-templates select="//field" mode="getset"/>
   <xsl:apply-templates select="//field" mode="bits"/>
  @@ -172,7 +156,7 @@
   </xsl:for-each>
   </xsl:template>
   
  -<xsl:template match = "bit" >    private BitField   <xsl:value-of 
select="recutil:getFieldName(@name,42)"/> = new BitField(<xsl:value-of 
select="recutil:getMask(@number)"/>);
  +<xsl:template match = "bit" >    private BitField   <xsl:value-of 
select="recutil:getFieldName(@name,42)"/> = new BitField(<xsl:value-of 
select="@mask"/>);
   </xsl:template>
   <xsl:template match = "const">    public final static <xsl:value-of 
select="recutil:getType(../@size,../@type,10)"/><xsl:text>  </xsl:text><xsl:value-of 
select="recutil:getConstName(../@name,@name,30)"/> = <xsl:value-of select="@value"/>;
   </xsl:template>
  
  
  


Reply via email to