Index: jakarta-poi/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java =================================================================== RCS file: /home/cvspublic/jakarta-poi/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java,v --- jakarta-poi/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java 9 Apr 2004 13:05:19 -0000 1.3 +++ jakarta-poi/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java 26 Jun 2004 02:27:30 -0000 @@ -1,6 +1,5 @@ - /* ==================================================================== - Copyright 2002-2004 Apache Software Foundation + Copyright 2004 Apache Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,13 +13,10 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; - - import org.apache.poi.ddf.DefaultEscherRecordFactory; import org.apache.poi.ddf.EscherRecord; import org.apache.poi.ddf.EscherRecordFactory; @@ -52,10 +48,11 @@ } /** - * Constructs a Bar record and sets its fields appropriately. + * Constructs one of the Escher records. These are + * MSODRAWING, MSODRAWINGGROUP and MSODRAWINGSELECTION * - * @param id id must be 0x1017 or an exception - * will be throw upon validation + * @param id must be one of 0xeb (MSODRAWINGGROUP), + * 0xec (MSODRAWING), or 0xef (MSODRAWINGSELECTION) * @param size size the size of the data area of the record * @param data data of the record (should not contain sid/len) */ @@ -63,14 +60,13 @@ public AbstractEscherHolderRecord(short id, short size, byte [] data) { super(id, size, data); - } /** - * Constructs a Bar record and sets its fields appropriately. + * Constructs one of the Escher records * - * @param id id must be 0x1017 or an exception - * will be throw upon validation + * @param id must be one of 0xeb (MSODRAWINGGROUP), + * 0xec (MSODRAWING), or 0xef (MSODRAWINGSELECTION) * @param size size the size of the data area of the record * @param data data of the record (should not contain sid/len) * @param offset of the record's data @@ -91,7 +87,7 @@ { if (id != getSid()) { - throw new RecordFormatException("Not a Bar record"); + throw new RecordFormatException("Not a Drawing record"); } } @@ -137,27 +133,22 @@ public int serialize(int offset, byte[] data) { + LittleEndian.putShort(data, 0 + offset, getSid()); + LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4)); if (escherRecords.size() == 0 && rawData != null) { - System.arraycopy( rawData, 0, data, offset, rawData.length); - return rawData.length; + System.arraycopy( rawData, 0, data, offset + 4, rawData.length); } else { - collapseShapeInformation(); - - LittleEndian.putShort(data, 0 + offset, getSid()); - LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4)); - int pos = offset + 4; for ( Iterator iterator = escherRecords.iterator(); iterator.hasNext(); ) { EscherRecord r = (EscherRecord) iterator.next(); pos += r.serialize(pos, data, new NullEscherSerializationListener() ); } - - return getRecordSize(); } + return getRecordSize(); } /** @@ -167,12 +158,10 @@ { if (escherRecords.size() == 0 && rawData != null) { - return rawData.length; + return rawData.length + 4; } else { - collapseShapeInformation(); - int size = 4; for ( Iterator iterator = escherRecords.iterator(); iterator.hasNext(); ) { @@ -183,11 +172,6 @@ } } - private void collapseShapeInformation() - { - - } - public abstract short getSid(); public Object clone() @@ -215,15 +199,9 @@ escherRecords.clear(); } - public EscherRecord getEscherRecord(int index) { return (EscherRecord) escherRecords.get(index); } - } // END OF CLASS - - - -