Updated this to work with the latest data type generator

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352454 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Said Ryan Ackley 2002-04-19 22:51:39 +00:00
parent cc57327b0d
commit c9cffe9d37
1 changed files with 73 additions and 20 deletions

View File

@ -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 apache@apache.org.
*
* 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 @@ public class HDFObjectFactory
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 @@ public class HDFObjectFactory
// initTableStream();
// initTextPieces();
// initFormattingProperties();
results.add(fib);
return results;
}
/**
* Initializes the table stream
*
@ -119,7 +172,7 @@ public class HDFObjectFactory
private void initTableStream() throws IOException
{
String tablename = null;
if(_fib.isTabletype())
if(!_fib.isFWhichTblStm())
{
tablename="1Table";
}
@ -143,7 +196,7 @@ public class HDFObjectFactory
*/
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 @@ public class HDFObjectFactory
*/
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 @@ public class HDFObjectFactory
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 @@ public class HDFObjectFactory
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 @@ public class HDFObjectFactory
*/
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 @@ public class HDFObjectFactory
*/
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 @@ public class HDFObjectFactory
*/
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);