sackley 02/04/19 15:51:39
Modified: src/scratchpad/src/org/apache/poi/hdf/model
HDFObjectFactory.java
Log:
Updated this to work with the latest data type generator
Revision Changes Path
1.6 +73 -20
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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- HDFObjectFactory.java 25 Mar 2002 02:03:37 -0000 1.5
+++ HDFObjectFactory.java 19 Apr 2002 22:51:39 -0000 1.6
@@ -1,3 +1,56 @@
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2002 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, 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 "Apache" and "Apache Software Foundation" and
+ * "Apache POI" 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",
+ * "Apache POI", 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 (INCLUDING, 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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
/*
* HDFObjectFactory.java
*
@@ -87,14 +140,14 @@
initFormattingProperties();
}
-
+
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");
@@ -106,11 +159,11 @@
// initTableStream();
// initTextPieces();
// initFormattingProperties();
-
+
results.add(fib);
return results;
}
-
+
/**
* Initializes the table stream
*
@@ -119,7 +172,7 @@
private void initTableStream() throws IOException
{
String tablename = null;
- if(_fib.isTabletype())
+ if(!_fib.isFWhichTblStm())
{
tablename="1Table";
}
@@ -143,7 +196,7 @@
*/
private void initTextPieces() throws IOException
{
- int pos = _fib.getTextPieceTableOffset();
+ int pos = _fib.getFcClx();
//skips through the prms before we reach the piece table. These contain data
//for actual fast saved files
@@ -207,8 +260,8 @@
*/
private void initCharacterProperties()
{
- int charOffset = _fib.getChp_bin_table_offset();
- int charPlcSize = _fib.getChp_bin_table_size();
+ int charOffset = _fib.getFcPlcfbteChpx();
+ int charPlcSize = _fib.getLcbPlcfbteChpx();
int arraySize = (charPlcSize - 4)/8;
@@ -256,8 +309,8 @@
private void initParagraphProperties()
{
//find paragraphs
- int parOffset = _fib.getPap_bin_table_offset();
- int parPlcSize = _fib.getPap_bin_table_size();
+ int parOffset = _fib.getFcPlcfbtePapx();
+ int parPlcSize = _fib.getLcbPlcfbtePapx();
int arraySize = (parPlcSize - 4)/8;
//first we must go through the bin table and find the fkps
@@ -301,9 +354,9 @@
private void initSectionProperties()
{
//find sections
- int fcMin = _fib.getOffsetFirstChar();
- int plcfsedFC = _fib.getSectionPlcOffset();
- int plcfsedSize = _fib.getSectionPlcSize();
+ int fcMin = _fib.getFcMin();
+ int plcfsedFC = _fib.getFcPlcfsed();
+ int plcfsedSize = _fib.getLcbPlcfsed();
byte[] plcfsed = new byte[plcfsedSize];
System.arraycopy(_tableBuffer, plcfsedFC, plcfsed, 0, plcfsedSize);
@@ -327,8 +380,8 @@
*/
private void initDocumentProperties()
{
- int pos = _fib.getDOPOffset();
- int size = _fib.getDOPSize();
+ int pos = _fib.getFcDop();
+ int size = _fib.getLcbDop();
byte[] dopArray = new byte[size];
System.arraycopy(_tableBuffer, pos, dopArray, 0, size);
@@ -339,8 +392,8 @@
*/
private void createStyleSheet()
{
- int stshIndex = _fib.getStylesheetOffset();
- int stshSize = _fib.getStylesheetSize();
+ int stshIndex = _fib.getFcStshf();
+ int stshSize = _fib.getLcbStshf();
byte[] stsh = new byte[stshSize];
System.arraycopy(_tableBuffer, stshIndex, stsh, 0, stshSize);
@@ -375,8 +428,8 @@
*/
private void createFontTable()
{
- int fontTableIndex = _fib.getFonts_bin_table_offset();
- int fontTableSize = _fib.getFonts_bin_table_size();
+ int fontTableIndex = _fib.getFcSttbfffn();
+ int fontTableSize = _fib.getLcbSttbfffn();
byte[] fontTable = new byte[fontTableSize];
System.arraycopy(_tableBuffer, fontTableIndex, fontTable, 0, fontTableSize);
_fonts = new FontTable(fontTable);