poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r776377 [1/6] - in /poi/trunk/src/java/org/apache/poi: ddf/ hssf/model/ hssf/record/ hssf/record/aggregates/ hssf/record/cont/ hssf/record/formula/ hssf/record/formula/eval/ hssf/usermodel/ hssf/util/ poifs/dev/ ss/ ss/formula/ ss/formula/e...
Date Tue, 19 May 2009 16:29:53 GMT
Author: josh
Date: Tue May 19 16:29:51 2009
New Revision: 776377

URL: http://svn.apache.org/viewvc?rev=776377&view=rev
Log:
Changed CRLF to LF in .java base src files.  Minor reformatting fixes.

Modified:
    poi/trunk/src/java/org/apache/poi/ddf/EscherPictBlip.java
    poi/trunk/src/java/org/apache/poi/hssf/model/HSSFFormulaParser.java
    poi/trunk/src/java/org/apache/poi/hssf/record/ArrayRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/CellRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/HeaderFooterBase.java
    poi/trunk/src/java/org/apache/poi/hssf/record/StandardRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/ChartSubstreamRecordAggregate.java
    poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/DataValidityTable.java
    poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/RecordAggregate.java
    poi/trunk/src/java/org/apache/poi/hssf/record/cont/ContinuableRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/cont/ContinuableRecordOutput.java
    poi/trunk/src/java/org/apache/poi/hssf/record/cont/UnknownLengthRecordOutput.java
    poi/trunk/src/java/org/apache/poi/hssf/record/formula/Area2DPtgBase.java
    poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefPtg.java
    poi/trunk/src/java/org/apache/poi/hssf/record/formula/ScalarConstantPtg.java
    poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/RefEvalBase.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFEvaluationWorkbook.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFHyperlink.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheetConditionalFormatting.java
    poi/trunk/src/java/org/apache/poi/hssf/util/CellRangeAddress.java
    poi/trunk/src/java/org/apache/poi/hssf/util/CellRangeAddress8Bit.java
    poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSDump.java
    poi/trunk/src/java/org/apache/poi/ss/SpreadsheetVersion.java
    poi/trunk/src/java/org/apache/poi/ss/formula/CellEvaluationFrame.java
    poi/trunk/src/java/org/apache/poi/ss/formula/EvaluationName.java
    poi/trunk/src/java/org/apache/poi/ss/formula/EvaluationWorkbook.java
    poi/trunk/src/java/org/apache/poi/ss/formula/Formula.java
    poi/trunk/src/java/org/apache/poi/ss/formula/FormulaParsingWorkbook.java
    poi/trunk/src/java/org/apache/poi/ss/formula/FormulaRenderer.java
    poi/trunk/src/java/org/apache/poi/ss/formula/FormulaRenderingWorkbook.java
    poi/trunk/src/java/org/apache/poi/ss/formula/FormulaType.java
    poi/trunk/src/java/org/apache/poi/ss/formula/LazyRefEval.java
    poi/trunk/src/java/org/apache/poi/ss/formula/SheetRefEvaluator.java
    poi/trunk/src/java/org/apache/poi/ss/formula/WorkbookDependentFormula.java
    poi/trunk/src/java/org/apache/poi/ss/formula/eval/NotImplementedException.java
    poi/trunk/src/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationCell.java
    poi/trunk/src/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationSheet.java
    poi/trunk/src/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationWorkbook.java
    poi/trunk/src/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluator.java
    poi/trunk/src/java/org/apache/poi/ss/usermodel/CellValue.java
    poi/trunk/src/java/org/apache/poi/ss/usermodel/ClientAnchor.java
    poi/trunk/src/java/org/apache/poi/ss/usermodel/DataFormatter.java
    poi/trunk/src/java/org/apache/poi/ss/usermodel/Drawing.java
    poi/trunk/src/java/org/apache/poi/ss/usermodel/FormulaError.java
    poi/trunk/src/java/org/apache/poi/ss/usermodel/HorizontalAlignment.java
    poi/trunk/src/java/org/apache/poi/ss/usermodel/Picture.java
    poi/trunk/src/java/org/apache/poi/ss/usermodel/ShapeTypes.java
    poi/trunk/src/java/org/apache/poi/ss/usermodel/VerticalAlignment.java
    poi/trunk/src/java/org/apache/poi/util/DelayableLittleEndianOutput.java
    poi/trunk/src/java/org/apache/poi/util/LittleEndianInput.java
    poi/trunk/src/java/org/apache/poi/util/LittleEndianInputStream.java
    poi/trunk/src/java/org/apache/poi/util/LittleEndianOutput.java
    poi/trunk/src/java/org/apache/poi/util/LittleEndianOutputStream.java

Modified: poi/trunk/src/java/org/apache/poi/ddf/EscherPictBlip.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ddf/EscherPictBlip.java?rev=776377&r1=776376&r2=776377&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ddf/EscherPictBlip.java (original)
+++ poi/trunk/src/java/org/apache/poi/ddf/EscherPictBlip.java Tue May 19 16:29:51 2009
@@ -1,276 +1,276 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-package org.apache.poi.ddf;
-
-import org.apache.poi.util.HexDump;
-import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.POILogFactory;
-import org.apache.poi.util.POILogger;
-
-import java.awt.Dimension;
-import java.awt.Rectangle;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.zip.InflaterInputStream;
-
-/**
- * @author Daniel Noll
- * @version $Id$
- */
-public class EscherPictBlip
-        extends EscherBlipRecord
-{
-    private static final POILogger log = POILogFactory.getLogger(EscherPictBlip.class);
-
-    public static final short RECORD_ID_EMF = (short) 0xF018 + 2;
-    public static final short RECORD_ID_WMF = (short) 0xF018 + 3;
-    public static final short RECORD_ID_PICT = (short) 0xF018 + 4;
-
-    private static final int HEADER_SIZE = 8;
-
-    private byte[] field_1_UID;
-    private int field_2_cb;
-    private int field_3_rcBounds_x1;
-    private int field_3_rcBounds_y1;
-    private int field_3_rcBounds_x2;
-    private int field_3_rcBounds_y2;
-    private int field_4_ptSize_w;
-    private int field_4_ptSize_h;
-    private int field_5_cbSave;
-    private byte field_6_fCompression;
-    private byte field_7_fFilter;
-
-    private byte[] raw_pictureData;
-
-    /**
-     * This method deserializes the record from a byte array.
-     *
-     * @param data          The byte array containing the escher record information
-     * @param offset        The starting offset into <code>data</code>.
-     * @param recordFactory May be null since this is not a container record.
-     * @return The number of bytes read from the byte array.
-     */
-    public int fillFields( byte[] data, int offset, EscherRecordFactory recordFactory )
-    {
-        int bytesAfterHeader = readHeader( data, offset );
-        int pos = offset + HEADER_SIZE;
-
-        field_1_UID = new byte[16];
-        System.arraycopy( data, pos, field_1_UID, 0, 16 ); pos += 16;
-        field_2_cb = LittleEndian.getInt( data, pos ); pos += 4;
-        field_3_rcBounds_x1 = LittleEndian.getInt( data, pos ); pos += 4;
-        field_3_rcBounds_y1 = LittleEndian.getInt( data, pos ); pos += 4;
-        field_3_rcBounds_x2 = LittleEndian.getInt( data, pos ); pos += 4;
-        field_3_rcBounds_y2 = LittleEndian.getInt( data, pos ); pos += 4;
-        field_4_ptSize_w = LittleEndian.getInt( data, pos ); pos += 4;
-        field_4_ptSize_h = LittleEndian.getInt( data, pos ); pos += 4;
-        field_5_cbSave = LittleEndian.getInt( data, pos ); pos += 4;
-        field_6_fCompression = data[pos]; pos++;
-        field_7_fFilter = data[pos]; pos++;
-
-        raw_pictureData = new byte[field_5_cbSave];
-        System.arraycopy( data, pos, raw_pictureData, 0, field_5_cbSave );
-
-        // 0 means DEFLATE compression
-        // 0xFE means no compression
-        if (field_6_fCompression == 0)
-        {
-            field_pictureData = inflatePictureData(raw_pictureData);
-        }
-        else
-        {
-            field_pictureData = raw_pictureData;
-        }
-
-        return bytesAfterHeader + HEADER_SIZE;
-    }
-    
-    /**
-     * Serializes the record to an existing byte array.
-     *
-     * @param offset    the offset within the byte array
-     * @param data      the data array to serialize to
-     * @param listener  a listener for begin and end serialization events.  This
-     *                  is useful because the serialization is
-     *                  hierarchical/recursive and sometimes you need to be able
-     *                  break into that.
-     * @return the number of bytes written.
-     */
-    public int serialize( int offset, byte[] data, EscherSerializationListener listener )
-    {
-        listener.beforeRecordSerialize(offset, getRecordId(), this);
-
-        int pos = offset;
-        LittleEndian.putShort( data, pos, getOptions() ); pos += 2;
-        LittleEndian.putShort( data, pos, getRecordId() ); pos += 2;
-        LittleEndian.putInt( data, getRecordSize() - HEADER_SIZE ); pos += 4;
-
-        System.arraycopy( field_1_UID, 0, data, pos, 16 ); pos += 16;
-        LittleEndian.putInt( data, pos, field_2_cb ); pos += 4;
-        LittleEndian.putInt( data, pos, field_3_rcBounds_x1 ); pos += 4;
-        LittleEndian.putInt( data, pos, field_3_rcBounds_y1 ); pos += 4;
-        LittleEndian.putInt( data, pos, field_3_rcBounds_x2 ); pos += 4;
-        LittleEndian.putInt( data, pos, field_3_rcBounds_y2 ); pos += 4;
-        LittleEndian.putInt( data, pos, field_4_ptSize_w ); pos += 4;
-        LittleEndian.putInt( data, pos, field_4_ptSize_h ); pos += 4;
-        LittleEndian.putInt( data, pos, field_5_cbSave ); pos += 4;
-        data[pos] = field_6_fCompression; pos++;
-        data[pos] = field_7_fFilter; pos++;
-
-        System.arraycopy( raw_pictureData, 0, data, pos, raw_pictureData.length );
-
-        listener.afterRecordSerialize(offset + getRecordSize(), getRecordId(), getRecordSize(), this);
-        return HEADER_SIZE + 16 + 1 + raw_pictureData.length;
-    }
-
-    /**
-     * Decompresses the provided data, returning the inflated result.
-     *
-     * @param data the deflated picture data.
-     * @return the inflated picture data.
-     */
-    private static byte[] inflatePictureData(byte[] data)
-    {
-        try
-        {
-            InflaterInputStream in = new InflaterInputStream(
-                new ByteArrayInputStream( data ) );
-            ByteArrayOutputStream out = new ByteArrayOutputStream();
-            byte[] buf = new byte[4096];
-            int readBytes;
-            while ((readBytes = in.read(buf)) > 0)
-            {
-                out.write(buf, 0, readBytes);
-            }
-            return out.toByteArray();
-        }
-        catch ( IOException e )
-        {
-            log.log(POILogger.INFO, "Possibly corrupt compression or non-compressed data", e);
-            return data;
-        }
-    }
-
-    /**
-     * Returns the number of bytes that are required to serialize this record.
-     *
-     * @return Number of bytes
-     */
-    public int getRecordSize()
-    {
-        return 8 + 50 + raw_pictureData.length;
-    }
-
-    public byte[] getUID()
-    {
-        return field_1_UID;
-    }
-
-    public void setUID( byte[] field_1_UID )
-    {
-        this.field_1_UID = field_1_UID;
-    }
-
-    public int getUncompressedSize()
-    {
-        return field_2_cb;
-    }
-
-    public void setUncompressedSize(int uncompressedSize)
-    {
-        field_2_cb = uncompressedSize;
-    }
-
-    public Rectangle getBounds()
-    {
-        return new Rectangle(field_3_rcBounds_x1,
-                             field_3_rcBounds_y1,
-                             field_3_rcBounds_x2 - field_3_rcBounds_x1,
-                             field_3_rcBounds_y2 - field_3_rcBounds_y1);
-    }
-
-    public void setBounds(Rectangle bounds)
-    {
-        field_3_rcBounds_x1 = bounds.x;
-        field_3_rcBounds_y1 = bounds.y;
-        field_3_rcBounds_x2 = bounds.x + bounds.width;
-        field_3_rcBounds_y2 = bounds.y + bounds.height;
-    }
-
-    public Dimension getSizeEMU()
-    {
-        return new Dimension(field_4_ptSize_w, field_4_ptSize_h);
-    }
-
-    public void setSizeEMU(Dimension sizeEMU)
-    {
-        field_4_ptSize_w = sizeEMU.width;
-        field_4_ptSize_h = sizeEMU.height;
-    }
-
-    public int getCompressedSize()
-    {
-        return field_5_cbSave;
-    }
-
-    public void setCompressedSize(int compressedSize)
-    {
-        field_5_cbSave = compressedSize;
-    }
-
-    public boolean isCompressed()
-    {
-        return (field_6_fCompression == 0);
-    }
-
-    public void setCompressed(boolean compressed)
-    {
-        field_6_fCompression = compressed ? 0 : (byte)0xFE;
-    }
-
-    // filtering is always 254 according to available docs, so no point giving it a setter method.
-
-    public String toString()
-    {
-        String nl = System.getProperty( "line.separator" );
-
-        String extraData;
-        ByteArrayOutputStream b = new ByteArrayOutputStream();
-        try
-        {
-            HexDump.dump( this.field_pictureData, 0, b, 0 );
-            extraData = b.toString();
-        }
-        catch ( Exception e )
-        {
-            extraData = e.toString();
-        }
-        return getClass().getName() + ":" + nl +
-                "  RecordId: 0x" + HexDump.toHex( getRecordId() ) + nl +
-                "  Options: 0x" + HexDump.toHex( getOptions() ) + nl +
-                "  UID: 0x" + HexDump.toHex( field_1_UID ) + nl +
-                "  Uncompressed Size: " + HexDump.toHex( field_2_cb ) + nl +
-                "  Bounds: " + getBounds() + nl +
-                "  Size in EMU: " + getSizeEMU() + nl +
-                "  Compressed Size: " + HexDump.toHex( field_5_cbSave ) + nl +
-                "  Compression: " + HexDump.toHex( field_6_fCompression ) + nl +
-                "  Filter: " + HexDump.toHex( field_7_fFilter ) + nl +
-                "  Extra Data:" + nl + extraData;
-    }
-
-}
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.poi.ddf;
+
+import org.apache.poi.util.HexDump;
+import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
+
+import java.awt.Dimension;
+import java.awt.Rectangle;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.zip.InflaterInputStream;
+
+/**
+ * @author Daniel Noll
+ * @version $Id$
+ */
+public class EscherPictBlip
+        extends EscherBlipRecord
+{
+    private static final POILogger log = POILogFactory.getLogger(EscherPictBlip.class);
+
+    public static final short RECORD_ID_EMF = (short) 0xF018 + 2;
+    public static final short RECORD_ID_WMF = (short) 0xF018 + 3;
+    public static final short RECORD_ID_PICT = (short) 0xF018 + 4;
+
+    private static final int HEADER_SIZE = 8;
+
+    private byte[] field_1_UID;
+    private int field_2_cb;
+    private int field_3_rcBounds_x1;
+    private int field_3_rcBounds_y1;
+    private int field_3_rcBounds_x2;
+    private int field_3_rcBounds_y2;
+    private int field_4_ptSize_w;
+    private int field_4_ptSize_h;
+    private int field_5_cbSave;
+    private byte field_6_fCompression;
+    private byte field_7_fFilter;
+
+    private byte[] raw_pictureData;
+
+    /**
+     * This method deserializes the record from a byte array.
+     *
+     * @param data          The byte array containing the escher record information
+     * @param offset        The starting offset into <code>data</code>.
+     * @param recordFactory May be null since this is not a container record.
+     * @return The number of bytes read from the byte array.
+     */
+    public int fillFields( byte[] data, int offset, EscherRecordFactory recordFactory )
+    {
+        int bytesAfterHeader = readHeader( data, offset );
+        int pos = offset + HEADER_SIZE;
+
+        field_1_UID = new byte[16];
+        System.arraycopy( data, pos, field_1_UID, 0, 16 ); pos += 16;
+        field_2_cb = LittleEndian.getInt( data, pos ); pos += 4;
+        field_3_rcBounds_x1 = LittleEndian.getInt( data, pos ); pos += 4;
+        field_3_rcBounds_y1 = LittleEndian.getInt( data, pos ); pos += 4;
+        field_3_rcBounds_x2 = LittleEndian.getInt( data, pos ); pos += 4;
+        field_3_rcBounds_y2 = LittleEndian.getInt( data, pos ); pos += 4;
+        field_4_ptSize_w = LittleEndian.getInt( data, pos ); pos += 4;
+        field_4_ptSize_h = LittleEndian.getInt( data, pos ); pos += 4;
+        field_5_cbSave = LittleEndian.getInt( data, pos ); pos += 4;
+        field_6_fCompression = data[pos]; pos++;
+        field_7_fFilter = data[pos]; pos++;
+
+        raw_pictureData = new byte[field_5_cbSave];
+        System.arraycopy( data, pos, raw_pictureData, 0, field_5_cbSave );
+
+        // 0 means DEFLATE compression
+        // 0xFE means no compression
+        if (field_6_fCompression == 0)
+        {
+            field_pictureData = inflatePictureData(raw_pictureData);
+        }
+        else
+        {
+            field_pictureData = raw_pictureData;
+        }
+
+        return bytesAfterHeader + HEADER_SIZE;
+    }
+
+    /**
+     * Serializes the record to an existing byte array.
+     *
+     * @param offset    the offset within the byte array
+     * @param data      the data array to serialize to
+     * @param listener  a listener for begin and end serialization events.  This
+     *                  is useful because the serialization is
+     *                  hierarchical/recursive and sometimes you need to be able
+     *                  break into that.
+     * @return the number of bytes written.
+     */
+    public int serialize( int offset, byte[] data, EscherSerializationListener listener )
+    {
+        listener.beforeRecordSerialize(offset, getRecordId(), this);
+
+        int pos = offset;
+        LittleEndian.putShort( data, pos, getOptions() ); pos += 2;
+        LittleEndian.putShort( data, pos, getRecordId() ); pos += 2;
+        LittleEndian.putInt( data, getRecordSize() - HEADER_SIZE ); pos += 4;
+
+        System.arraycopy( field_1_UID, 0, data, pos, 16 ); pos += 16;
+        LittleEndian.putInt( data, pos, field_2_cb ); pos += 4;
+        LittleEndian.putInt( data, pos, field_3_rcBounds_x1 ); pos += 4;
+        LittleEndian.putInt( data, pos, field_3_rcBounds_y1 ); pos += 4;
+        LittleEndian.putInt( data, pos, field_3_rcBounds_x2 ); pos += 4;
+        LittleEndian.putInt( data, pos, field_3_rcBounds_y2 ); pos += 4;
+        LittleEndian.putInt( data, pos, field_4_ptSize_w ); pos += 4;
+        LittleEndian.putInt( data, pos, field_4_ptSize_h ); pos += 4;
+        LittleEndian.putInt( data, pos, field_5_cbSave ); pos += 4;
+        data[pos] = field_6_fCompression; pos++;
+        data[pos] = field_7_fFilter; pos++;
+
+        System.arraycopy( raw_pictureData, 0, data, pos, raw_pictureData.length );
+
+        listener.afterRecordSerialize(offset + getRecordSize(), getRecordId(), getRecordSize(), this);
+        return HEADER_SIZE + 16 + 1 + raw_pictureData.length;
+    }
+
+    /**
+     * Decompresses the provided data, returning the inflated result.
+     *
+     * @param data the deflated picture data.
+     * @return the inflated picture data.
+     */
+    private static byte[] inflatePictureData(byte[] data)
+    {
+        try
+        {
+            InflaterInputStream in = new InflaterInputStream(
+                new ByteArrayInputStream( data ) );
+            ByteArrayOutputStream out = new ByteArrayOutputStream();
+            byte[] buf = new byte[4096];
+            int readBytes;
+            while ((readBytes = in.read(buf)) > 0)
+            {
+                out.write(buf, 0, readBytes);
+            }
+            return out.toByteArray();
+        }
+        catch ( IOException e )
+        {
+            log.log(POILogger.INFO, "Possibly corrupt compression or non-compressed data", e);
+            return data;
+        }
+    }
+
+    /**
+     * Returns the number of bytes that are required to serialize this record.
+     *
+     * @return Number of bytes
+     */
+    public int getRecordSize()
+    {
+        return 8 + 50 + raw_pictureData.length;
+    }
+
+    public byte[] getUID()
+    {
+        return field_1_UID;
+    }
+
+    public void setUID( byte[] field_1_UID )
+    {
+        this.field_1_UID = field_1_UID;
+    }
+
+    public int getUncompressedSize()
+    {
+        return field_2_cb;
+    }
+
+    public void setUncompressedSize(int uncompressedSize)
+    {
+        field_2_cb = uncompressedSize;
+    }
+
+    public Rectangle getBounds()
+    {
+        return new Rectangle(field_3_rcBounds_x1,
+                             field_3_rcBounds_y1,
+                             field_3_rcBounds_x2 - field_3_rcBounds_x1,
+                             field_3_rcBounds_y2 - field_3_rcBounds_y1);
+    }
+
+    public void setBounds(Rectangle bounds)
+    {
+        field_3_rcBounds_x1 = bounds.x;
+        field_3_rcBounds_y1 = bounds.y;
+        field_3_rcBounds_x2 = bounds.x + bounds.width;
+        field_3_rcBounds_y2 = bounds.y + bounds.height;
+    }
+
+    public Dimension getSizeEMU()
+    {
+        return new Dimension(field_4_ptSize_w, field_4_ptSize_h);
+    }
+
+    public void setSizeEMU(Dimension sizeEMU)
+    {
+        field_4_ptSize_w = sizeEMU.width;
+        field_4_ptSize_h = sizeEMU.height;
+    }
+
+    public int getCompressedSize()
+    {
+        return field_5_cbSave;
+    }
+
+    public void setCompressedSize(int compressedSize)
+    {
+        field_5_cbSave = compressedSize;
+    }
+
+    public boolean isCompressed()
+    {
+        return (field_6_fCompression == 0);
+    }
+
+    public void setCompressed(boolean compressed)
+    {
+        field_6_fCompression = compressed ? 0 : (byte)0xFE;
+    }
+
+    // filtering is always 254 according to available docs, so no point giving it a setter method.
+
+    public String toString()
+    {
+        String nl = System.getProperty( "line.separator" );
+
+        String extraData;
+        ByteArrayOutputStream b = new ByteArrayOutputStream();
+        try
+        {
+            HexDump.dump( this.field_pictureData, 0, b, 0 );
+            extraData = b.toString();
+        }
+        catch ( Exception e )
+        {
+            extraData = e.toString();
+        }
+        return getClass().getName() + ":" + nl +
+                "  RecordId: 0x" + HexDump.toHex( getRecordId() ) + nl +
+                "  Options: 0x" + HexDump.toHex( getOptions() ) + nl +
+                "  UID: 0x" + HexDump.toHex( field_1_UID ) + nl +
+                "  Uncompressed Size: " + HexDump.toHex( field_2_cb ) + nl +
+                "  Bounds: " + getBounds() + nl +
+                "  Size in EMU: " + getSizeEMU() + nl +
+                "  Compressed Size: " + HexDump.toHex( field_5_cbSave ) + nl +
+                "  Compression: " + HexDump.toHex( field_6_fCompression ) + nl +
+                "  Filter: " + HexDump.toHex( field_7_fFilter ) + nl +
+                "  Extra Data:" + nl + extraData;
+    }
+
+}

Modified: poi/trunk/src/java/org/apache/poi/hssf/model/HSSFFormulaParser.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/model/HSSFFormulaParser.java?rev=776377&r1=776376&r2=776377&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/model/HSSFFormulaParser.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/model/HSSFFormulaParser.java Tue May 19 16:29:51 2009
@@ -1,82 +1,82 @@
-/* ====================================================================
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-==================================================================== */
-
-package org.apache.poi.hssf.model;
-
-import org.apache.poi.hssf.record.formula.Ptg;
-import org.apache.poi.hssf.usermodel.HSSFEvaluationWorkbook;
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.apache.poi.ss.formula.FormulaParser;
-import org.apache.poi.ss.formula.FormulaParsingWorkbook;
-import org.apache.poi.ss.formula.FormulaRenderer;
-import org.apache.poi.ss.formula.FormulaType;
-
-/**
- * HSSF wrapper for the {@link FormulaParser} and {@link FormulaRenderer} 
- * 
- * @author Josh Micich
- */
-public final class HSSFFormulaParser {
-
-	private static FormulaParsingWorkbook createParsingWorkbook(HSSFWorkbook book) {
-		return HSSFEvaluationWorkbook.create(book);
-	}
-
-	private HSSFFormulaParser() {
-		// no instances of this class
-	}
-
-	/**
-	 * Convenience method for parsing cell formulas. see {@link #parse(String, HSSFWorkbook, int)}
-	 */
-	public static Ptg[] parse(String formula, HSSFWorkbook workbook) {
-        return parse(formula, workbook, FormulaType.CELL);
-	}
-
-	/**
-	 * @param formulaType a constant from {@link FormulaType}
-	 * @return the parsed formula tokens
-	 */
-	public static Ptg[] parse(String formula, HSSFWorkbook workbook, int formulaType) {
-		return parse(formula, workbook, formulaType, -1);
-	}
-
-    /**
-     * @param formula     the formula to parse
-     * @param workbook    the parent workbook
-     * @param formulaType a constant from {@link FormulaType}
-     * @param sheetIndex  the 0-based index of the sheet this formula belongs to.
-     * The sheet index is required to resolve sheet-level names. <code>-1</code> means that
-     * the scope of the name will be ignored and  the parser will match named ranges only by name
-     *
-     * @return the parsed formula tokens
-     */
-    public static Ptg[] parse(String formula, HSSFWorkbook workbook, int formulaType, int sheetIndex) {
-        return FormulaParser.parse(formula, createParsingWorkbook(workbook), formulaType, sheetIndex);
-    }
-
-	/**
-	 * Static method to convert an array of {@link Ptg}s in RPN order
-	 * to a human readable string format in infix mode.
-	 * @param book  used for defined names and 3D references
-	 * @param ptgs  must not be <code>null</code>
-	 * @return a human readable String
-	 */
-	public static String toFormulaString(HSSFWorkbook book, Ptg[] ptgs) {
-		return FormulaRenderer.toFormulaString(HSSFEvaluationWorkbook.create(book), ptgs);
-	}
-}
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
+package org.apache.poi.hssf.model;
+
+import org.apache.poi.hssf.record.formula.Ptg;
+import org.apache.poi.hssf.usermodel.HSSFEvaluationWorkbook;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.formula.FormulaParser;
+import org.apache.poi.ss.formula.FormulaParsingWorkbook;
+import org.apache.poi.ss.formula.FormulaRenderer;
+import org.apache.poi.ss.formula.FormulaType;
+
+/**
+ * HSSF wrapper for the {@link FormulaParser} and {@link FormulaRenderer}
+ *
+ * @author Josh Micich
+ */
+public final class HSSFFormulaParser {
+
+	private static FormulaParsingWorkbook createParsingWorkbook(HSSFWorkbook book) {
+		return HSSFEvaluationWorkbook.create(book);
+	}
+
+	private HSSFFormulaParser() {
+		// no instances of this class
+	}
+
+	/**
+	 * Convenience method for parsing cell formulas. see {@link #parse(String, HSSFWorkbook, int)}
+	 */
+	public static Ptg[] parse(String formula, HSSFWorkbook workbook) {
+		return parse(formula, workbook, FormulaType.CELL);
+	}
+
+	/**
+	 * @param formulaType a constant from {@link FormulaType}
+	 * @return the parsed formula tokens
+	 */
+	public static Ptg[] parse(String formula, HSSFWorkbook workbook, int formulaType) {
+		return parse(formula, workbook, formulaType, -1);
+	}
+
+	/**
+	 * @param formula     the formula to parse
+	 * @param workbook    the parent workbook
+	 * @param formulaType a constant from {@link FormulaType}
+	 * @param sheetIndex  the 0-based index of the sheet this formula belongs to.
+	 * The sheet index is required to resolve sheet-level names. <code>-1</code> means that
+	 * the scope of the name will be ignored and  the parser will match named ranges only by name
+	 *
+	 * @return the parsed formula tokens
+	 */
+	public static Ptg[] parse(String formula, HSSFWorkbook workbook, int formulaType, int sheetIndex) {
+		return FormulaParser.parse(formula, createParsingWorkbook(workbook), formulaType, sheetIndex);
+	}
+
+	/**
+	 * Static method to convert an array of {@link Ptg}s in RPN order
+	 * to a human readable string format in infix mode.
+	 * @param book  used for defined names and 3D references
+	 * @param ptgs  must not be <code>null</code>
+	 * @return a human readable String
+	 */
+	public static String toFormulaString(HSSFWorkbook book, Ptg[] ptgs) {
+		return FormulaRenderer.toFormulaString(HSSFEvaluationWorkbook.create(book), ptgs);
+	}
+}

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/ArrayRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/ArrayRecord.java?rev=776377&r1=776376&r2=776377&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/ArrayRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/ArrayRecord.java Tue May 19 16:29:51 2009
@@ -1,87 +1,87 @@
-/* ====================================================================
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-==================================================================== */
-
-package org.apache.poi.hssf.record;
-
-import org.apache.poi.hssf.record.formula.Ptg;
-import org.apache.poi.ss.formula.Formula;
-import org.apache.poi.util.HexDump;
-import org.apache.poi.util.LittleEndianOutput;
-
-/**
- * ARRAY (0x0221)<p/>
- * 
- * Treated in a similar way to SharedFormulaRecord
- * 
- * @author Josh Micich
- */		
-public final class ArrayRecord extends SharedValueRecordBase {
-
-	public final static short sid = 0x0221;
-	private static final int OPT_ALWAYS_RECALCULATE = 0x0001;
-	private static final int OPT_CALCULATE_ON_OPEN  = 0x0002;
-	
-	private int	_options;
-	private int _field3notUsed;
-	private Formula _formula;
-
-	public ArrayRecord(RecordInputStream in) {
-		super(in);
-		_options = in.readUShort();
-		_field3notUsed = in.readInt();
-		int formulaTokenLen = in.readUShort();
-		int totalFormulaLen = in.available();
-		_formula = Formula.read(formulaTokenLen, in, totalFormulaLen);
-	}
-
-	public boolean isAlwaysRecalculate() {
-		return (_options & OPT_ALWAYS_RECALCULATE) != 0;
-	}
-	public boolean isCalculateOnOpen() {
-		return (_options & OPT_CALCULATE_ON_OPEN) != 0;
-	}
-
-	protected int getExtraDataSize() {
-		return 2 + 4
-			+ _formula.getEncodedSize();
-	}
-	protected void serializeExtraData(LittleEndianOutput out) {
-		out.writeShort(_options);
-		out.writeInt(_field3notUsed);
-		_formula.serialize(out);
-	}
-
-	public short getSid() {
-		return sid;
-	}
-
-	public String toString() {
-		StringBuffer sb = new StringBuffer();
-		sb.append(getClass().getName()).append(" [ARRAY]\n");
-		sb.append(" range=").append(getRange().toString()).append("\n");
-		sb.append(" options=").append(HexDump.shortToHex(_options)).append("\n");
-		sb.append(" notUsed=").append(HexDump.intToHex(_field3notUsed)).append("\n");
-		sb.append(" formula:").append("\n");
-		Ptg[] ptgs = _formula.getTokens();
-		for (int i = 0; i < ptgs.length; i++) {
-			Ptg ptg = ptgs[i];
-			sb.append(ptg.toString()).append(ptg.getRVAType()).append("\n");
-		}
-		sb.append("]");
-		return sb.toString();
-	}
-}
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
+package org.apache.poi.hssf.record;
+
+import org.apache.poi.hssf.record.formula.Ptg;
+import org.apache.poi.ss.formula.Formula;
+import org.apache.poi.util.HexDump;
+import org.apache.poi.util.LittleEndianOutput;
+
+/**
+ * ARRAY (0x0221)<p/>
+ *
+ * Treated in a similar way to SharedFormulaRecord
+ *
+ * @author Josh Micich
+ */
+public final class ArrayRecord extends SharedValueRecordBase {
+
+	public final static short sid = 0x0221;
+	private static final int OPT_ALWAYS_RECALCULATE = 0x0001;
+	private static final int OPT_CALCULATE_ON_OPEN  = 0x0002;
+
+	private int	_options;
+	private int _field3notUsed;
+	private Formula _formula;
+
+	public ArrayRecord(RecordInputStream in) {
+		super(in);
+		_options = in.readUShort();
+		_field3notUsed = in.readInt();
+		int formulaTokenLen = in.readUShort();
+		int totalFormulaLen = in.available();
+		_formula = Formula.read(formulaTokenLen, in, totalFormulaLen);
+	}
+
+	public boolean isAlwaysRecalculate() {
+		return (_options & OPT_ALWAYS_RECALCULATE) != 0;
+	}
+	public boolean isCalculateOnOpen() {
+		return (_options & OPT_CALCULATE_ON_OPEN) != 0;
+	}
+
+	protected int getExtraDataSize() {
+		return 2 + 4
+			+ _formula.getEncodedSize();
+	}
+	protected void serializeExtraData(LittleEndianOutput out) {
+		out.writeShort(_options);
+		out.writeInt(_field3notUsed);
+		_formula.serialize(out);
+	}
+
+	public short getSid() {
+		return sid;
+	}
+
+	public String toString() {
+		StringBuffer sb = new StringBuffer();
+		sb.append(getClass().getName()).append(" [ARRAY]\n");
+		sb.append(" range=").append(getRange().toString()).append("\n");
+		sb.append(" options=").append(HexDump.shortToHex(_options)).append("\n");
+		sb.append(" notUsed=").append(HexDump.intToHex(_field3notUsed)).append("\n");
+		sb.append(" formula:").append("\n");
+		Ptg[] ptgs = _formula.getTokens();
+		for (int i = 0; i < ptgs.length; i++) {
+			Ptg ptg = ptgs[i];
+			sb.append(ptg.toString()).append(ptg.getRVAType()).append("\n");
+		}
+		sb.append("]");
+		return sb.toString();
+	}
+}

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/CellRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/CellRecord.java?rev=776377&r1=776376&r2=776377&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/CellRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/CellRecord.java Tue May 19 16:29:51 2009
@@ -1,132 +1,132 @@
-/* ====================================================================
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-==================================================================== */
-
-package org.apache.poi.hssf.record;
-
-import org.apache.poi.util.HexDump;
-import org.apache.poi.util.LittleEndianOutput;
-
-/**
- * Base class for all cell value records (implementors of {@link CellValueRecordInterface}).
- * Subclasses are expected to manage the cell data values (of various types). 
- * 
- * @author Josh Micich
- */
-public abstract class CellRecord extends StandardRecord implements CellValueRecordInterface {
-	private int _rowIndex;
-	private int _columnIndex;
-	private int _formatIndex;
-
-	protected CellRecord() {
-		// fields uninitialised
-	}
-
-	protected CellRecord(RecordInputStream in) {
-		_rowIndex = in.readUShort();
-		_columnIndex = in.readUShort();
-		_formatIndex = in.readUShort();
-	}
-
-	public final void setRow(int row) {
-		_rowIndex = row;
-	}
-
-	public final void setColumn(short col) {
-		_columnIndex = col;
-	}
-
-	/**
-	 * set the index to the ExtendedFormat
-	 * 
-	 * @see org.apache.poi.hssf.record.ExtendedFormatRecord
-	 * @param xf index to the XF record
-	 */
-	public final void setXFIndex(short xf) {
-		_formatIndex = xf;
-	}
-
-	public final int getRow() {
-		return _rowIndex;
-	}
-
-	public final short getColumn() {
-		return (short) _columnIndex;
-	}
-
-	/**
-	 * get the index to the ExtendedFormat
-	 * 
-	 * @see org.apache.poi.hssf.record.ExtendedFormatRecord
-	 * @return index to the XF record
-	 */
-	public final short getXFIndex() {
-		return (short) _formatIndex;
-	}
-
-	public final String toString() {
-		StringBuilder sb = new StringBuilder();
-		String recordName = getRecordName();
-
-		sb.append("[").append(recordName).append("]\n");
-		sb.append("    .row    = ").append(HexDump.shortToHex(getRow())).append("\n");
-		sb.append("    .col    = ").append(HexDump.shortToHex(getColumn())).append("\n");
-		sb.append("    .xfindex= ").append(HexDump.shortToHex(getXFIndex())).append("\n");
-		appendValueText(sb);
-		sb.append("\n");
-		sb.append("[/").append(recordName).append("]\n");
-		return sb.toString();
-	}
-
-	/**
-	 * Append specific debug info (used by {@link #toString()} for the value
-	 * contained in this record. Trailing new-line should not be appended
-	 * (superclass does that).
-	 */
-	protected abstract void appendValueText(StringBuilder sb);
-
-	/**
-	 * Gets the debug info BIFF record type name (used by {@link #toString()}.
-	 */
-	protected abstract String getRecordName();
-
-	/**
-	 * writes out the value data for this cell record
-	 */
-	protected abstract void serializeValue(LittleEndianOutput out);
-
-	/**
-	 * @return the size (in bytes) of the value data for this cell record
-	 */
-	protected abstract int getValueDataSize();
-
-	public final void serialize(LittleEndianOutput out) {
-		out.writeShort(getRow());
-		out.writeShort(getColumn());
-		out.writeShort(getXFIndex());
-		serializeValue(out);
-	}
-
-	protected final int getDataSize() {
-		return 6 + getValueDataSize();
-	}
-
-	protected final void copyBaseFields(CellRecord rec) {
-		rec._rowIndex = _rowIndex;
-		rec._columnIndex = _columnIndex;
-		rec._formatIndex = _formatIndex;
-	}
-}
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
+package org.apache.poi.hssf.record;
+
+import org.apache.poi.util.HexDump;
+import org.apache.poi.util.LittleEndianOutput;
+
+/**
+ * Base class for all cell value records (implementors of {@link CellValueRecordInterface}).
+ * Subclasses are expected to manage the cell data values (of various types).
+ *
+ * @author Josh Micich
+ */
+public abstract class CellRecord extends StandardRecord implements CellValueRecordInterface {
+	private int _rowIndex;
+	private int _columnIndex;
+	private int _formatIndex;
+
+	protected CellRecord() {
+		// fields uninitialised
+	}
+
+	protected CellRecord(RecordInputStream in) {
+		_rowIndex = in.readUShort();
+		_columnIndex = in.readUShort();
+		_formatIndex = in.readUShort();
+	}
+
+	public final void setRow(int row) {
+		_rowIndex = row;
+	}
+
+	public final void setColumn(short col) {
+		_columnIndex = col;
+	}
+
+	/**
+	 * set the index to the ExtendedFormat
+	 *
+	 * @see org.apache.poi.hssf.record.ExtendedFormatRecord
+	 * @param xf index to the XF record
+	 */
+	public final void setXFIndex(short xf) {
+		_formatIndex = xf;
+	}
+
+	public final int getRow() {
+		return _rowIndex;
+	}
+
+	public final short getColumn() {
+		return (short) _columnIndex;
+	}
+
+	/**
+	 * get the index to the ExtendedFormat
+	 *
+	 * @see org.apache.poi.hssf.record.ExtendedFormatRecord
+	 * @return index to the XF record
+	 */
+	public final short getXFIndex() {
+		return (short) _formatIndex;
+	}
+
+	public final String toString() {
+		StringBuilder sb = new StringBuilder();
+		String recordName = getRecordName();
+
+		sb.append("[").append(recordName).append("]\n");
+		sb.append("    .row    = ").append(HexDump.shortToHex(getRow())).append("\n");
+		sb.append("    .col    = ").append(HexDump.shortToHex(getColumn())).append("\n");
+		sb.append("    .xfindex= ").append(HexDump.shortToHex(getXFIndex())).append("\n");
+		appendValueText(sb);
+		sb.append("\n");
+		sb.append("[/").append(recordName).append("]\n");
+		return sb.toString();
+	}
+
+	/**
+	 * Append specific debug info (used by {@link #toString()} for the value
+	 * contained in this record. Trailing new-line should not be appended
+	 * (superclass does that).
+	 */
+	protected abstract void appendValueText(StringBuilder sb);
+
+	/**
+	 * Gets the debug info BIFF record type name (used by {@link #toString()}.
+	 */
+	protected abstract String getRecordName();
+
+	/**
+	 * writes out the value data for this cell record
+	 */
+	protected abstract void serializeValue(LittleEndianOutput out);
+
+	/**
+	 * @return the size (in bytes) of the value data for this cell record
+	 */
+	protected abstract int getValueDataSize();
+
+	public final void serialize(LittleEndianOutput out) {
+		out.writeShort(getRow());
+		out.writeShort(getColumn());
+		out.writeShort(getXFIndex());
+		serializeValue(out);
+	}
+
+	protected final int getDataSize() {
+		return 6 + getValueDataSize();
+	}
+
+	protected final void copyBaseFields(CellRecord rec) {
+		rec._rowIndex = _rowIndex;
+		rec._columnIndex = _columnIndex;
+		rec._formatIndex = _formatIndex;
+	}
+}

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/HeaderFooterBase.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/HeaderFooterBase.java?rev=776377&r1=776376&r2=776377&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/HeaderFooterBase.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/HeaderFooterBase.java Tue May 19 16:29:51 2009
@@ -1,109 +1,109 @@
-/* ====================================================================
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-==================================================================== */
-
-package org.apache.poi.hssf.record;
-
-import org.apache.poi.util.LittleEndianOutput;
-import org.apache.poi.util.StringUtil;
-
-/**
- * Common header/footer base class
- * 
- * @author Josh Micich
- */
-abstract class HeaderFooterBase extends StandardRecord {
-	private boolean field_2_hasMultibyte;
-	private String field_3_text;
-
-	protected HeaderFooterBase(String text) {
-		setText(text);
-	}
-
-	protected HeaderFooterBase(RecordInputStream in) {
-		if (in.remaining() > 0) {
-			int field_1_footer_len = in.readShort();
-			field_2_hasMultibyte = in.readByte() != 0x00;
-
-			if (field_2_hasMultibyte) {
-				field_3_text = in.readUnicodeLEString(field_1_footer_len);
-			} else {
-				field_3_text = in.readCompressedUnicode(field_1_footer_len);
-			}
-		} else {
-			// Note - this is unusual: when the text is empty string, the whole record is empty (just the 4 byte BIFF header)
-			field_3_text = "";
-		}
-	}
-
-	/**
-	 * set the footer string
-	 * 
-	 * @param text string to display
-	 */
-	public final void setText(String text) {
-		if (text == null) {
-			throw new IllegalArgumentException("text must not be null");
-		}
-		field_2_hasMultibyte = StringUtil.hasMultibyte(text);
-		field_3_text = text;
-		
-		// Check it'll fit into the space in the record
-		if (field_2_hasMultibyte) {
-			if (field_3_text.length() > 127) {
-				throw new IllegalArgumentException(
-						"Footer string too long (limit is 127 for unicode strings)");
-			}
-		} else {
-			if (field_3_text.length() > 255) {
-				throw new IllegalArgumentException(
-						"Footer string too long (limit is 255 for non-unicode strings)");
-			}
-		}
-	}
-
-	/**
-	 * get the length of the footer string
-	 * 
-	 * @return length of the footer string
-	 */
-	private int getTextLength() {
-		return field_3_text.length();
-	}
-
-	public final String getText() {
-		return field_3_text;
-	}
-
-	public final void serialize(LittleEndianOutput out) {
-		if (getTextLength() > 0) {
-			out.writeShort(getTextLength());
-			out.writeByte(field_2_hasMultibyte ? 0x01 : 0x00);
-			if (field_2_hasMultibyte) {
-				StringUtil.putUnicodeLE(field_3_text, out);
-			} else {
-				StringUtil.putCompressedUnicode(field_3_text, out);
-			}
-		}
-	}
-
-	protected final int getDataSize() {
-		if (getTextLength() < 1) {
-			return 0;
-		}
-		return 3 + getTextLength() * (field_2_hasMultibyte ? 2 : 1);
-	}
-}
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
+package org.apache.poi.hssf.record;
+
+import org.apache.poi.util.LittleEndianOutput;
+import org.apache.poi.util.StringUtil;
+
+/**
+ * Common header/footer base class
+ *
+ * @author Josh Micich
+ */
+abstract class HeaderFooterBase extends StandardRecord {
+	private boolean field_2_hasMultibyte;
+	private String field_3_text;
+
+	protected HeaderFooterBase(String text) {
+		setText(text);
+	}
+
+	protected HeaderFooterBase(RecordInputStream in) {
+		if (in.remaining() > 0) {
+			int field_1_footer_len = in.readShort();
+			field_2_hasMultibyte = in.readByte() != 0x00;
+
+			if (field_2_hasMultibyte) {
+				field_3_text = in.readUnicodeLEString(field_1_footer_len);
+			} else {
+				field_3_text = in.readCompressedUnicode(field_1_footer_len);
+			}
+		} else {
+			// Note - this is unusual: when the text is empty string, the whole record is empty (just the 4 byte BIFF header)
+			field_3_text = "";
+		}
+	}
+
+	/**
+	 * set the footer string
+	 *
+	 * @param text string to display
+	 */
+	public final void setText(String text) {
+		if (text == null) {
+			throw new IllegalArgumentException("text must not be null");
+		}
+		field_2_hasMultibyte = StringUtil.hasMultibyte(text);
+		field_3_text = text;
+
+		// Check it'll fit into the space in the record
+		if (field_2_hasMultibyte) {
+			if (field_3_text.length() > 127) {
+				throw new IllegalArgumentException(
+						"Footer string too long (limit is 127 for unicode strings)");
+			}
+		} else {
+			if (field_3_text.length() > 255) {
+				throw new IllegalArgumentException(
+						"Footer string too long (limit is 255 for non-unicode strings)");
+			}
+		}
+	}
+
+	/**
+	 * get the length of the footer string
+	 *
+	 * @return length of the footer string
+	 */
+	private int getTextLength() {
+		return field_3_text.length();
+	}
+
+	public final String getText() {
+		return field_3_text;
+	}
+
+	public final void serialize(LittleEndianOutput out) {
+		if (getTextLength() > 0) {
+			out.writeShort(getTextLength());
+			out.writeByte(field_2_hasMultibyte ? 0x01 : 0x00);
+			if (field_2_hasMultibyte) {
+				StringUtil.putUnicodeLE(field_3_text, out);
+			} else {
+				StringUtil.putCompressedUnicode(field_3_text, out);
+			}
+		}
+	}
+
+	protected final int getDataSize() {
+		if (getTextLength() < 1) {
+			return 0;
+		}
+		return 3 + getTextLength() * (field_2_hasMultibyte ? 2 : 1);
+	}
+}

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/StandardRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/StandardRecord.java?rev=776377&r1=776376&r2=776377&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/StandardRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/StandardRecord.java Tue May 19 16:29:51 2009
@@ -1,57 +1,57 @@
-/* ====================================================================
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-==================================================================== */
-
-package org.apache.poi.hssf.record;
-
-import org.apache.poi.util.LittleEndianByteArrayOutputStream;
-import org.apache.poi.util.LittleEndianOutput;
-
-/**
- * Subclasses of this class (the majority of BIFF records) are non-continuable.  This allows for
- * some simplification of serialization logic
- * 
- * @author Josh Micich
- */
-public abstract class StandardRecord extends Record {
-	protected abstract int getDataSize();
-	public final int getRecordSize() {
-		return 4 + getDataSize();
-	}
-	@Override
-	public final int serialize(int offset, byte[] data) {
-		int dataSize = getDataSize();
-		int recSize = 4 + dataSize;
-		LittleEndianByteArrayOutputStream out = new LittleEndianByteArrayOutputStream(data, offset, recSize);
-		out.writeShort(getSid());
-		out.writeShort(dataSize);
-		serialize(out);
-		if (out.getWriteIndex() - offset != recSize) {
-			throw new IllegalStateException("Error in serialization of (" + getClass().getName() + "): "
-					+ "Incorrect number of bytes written - expected " 
-					+ recSize + " but got " + (out.getWriteIndex() - offset));
-		}
-		return recSize;
-	}
-
-	/**
-	 * Write the data content of this BIFF record.  The 'ushort sid' and 'ushort size' header fields
-	 * have already been written by the superclass.<br/>
-	 * 
-	 * The subclass must write the exact number of bytes as reported by {@link org.apache.poi.hssf.record.Record#getRecordSize()}}
-	 */
-	protected abstract void serialize(LittleEndianOutput out);
-}
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
+package org.apache.poi.hssf.record;
+
+import org.apache.poi.util.LittleEndianByteArrayOutputStream;
+import org.apache.poi.util.LittleEndianOutput;
+
+/**
+ * Subclasses of this class (the majority of BIFF records) are non-continuable.  This allows for
+ * some simplification of serialization logic
+ *
+ * @author Josh Micich
+ */
+public abstract class StandardRecord extends Record {
+	protected abstract int getDataSize();
+	public final int getRecordSize() {
+		return 4 + getDataSize();
+	}
+	@Override
+	public final int serialize(int offset, byte[] data) {
+		int dataSize = getDataSize();
+		int recSize = 4 + dataSize;
+		LittleEndianByteArrayOutputStream out = new LittleEndianByteArrayOutputStream(data, offset, recSize);
+		out.writeShort(getSid());
+		out.writeShort(dataSize);
+		serialize(out);
+		if (out.getWriteIndex() - offset != recSize) {
+			throw new IllegalStateException("Error in serialization of (" + getClass().getName() + "): "
+					+ "Incorrect number of bytes written - expected "
+					+ recSize + " but got " + (out.getWriteIndex() - offset));
+		}
+		return recSize;
+	}
+
+	/**
+	 * Write the data content of this BIFF record.  The 'ushort sid' and 'ushort size' header fields
+	 * have already been written by the superclass.<br/>
+	 *
+	 * The subclass must write the exact number of bytes as reported by {@link org.apache.poi.hssf.record.Record#getRecordSize()}}
+	 */
+	protected abstract void serialize(LittleEndianOutput out);
+}

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/ChartSubstreamRecordAggregate.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/ChartSubstreamRecordAggregate.java?rev=776377&r1=776376&r2=776377&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/ChartSubstreamRecordAggregate.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/ChartSubstreamRecordAggregate.java Tue May 19 16:29:51 2009
@@ -1,87 +1,87 @@
-/* ====================================================================
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-==================================================================== */
-
-package org.apache.poi.hssf.record.aggregates;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.poi.hssf.model.RecordStream;
-import org.apache.poi.hssf.record.BOFRecord;
-import org.apache.poi.hssf.record.EOFRecord;
-import org.apache.poi.hssf.record.Record;
-import org.apache.poi.hssf.record.RecordBase;
-import org.apache.poi.hssf.record.UnknownRecord;
-
-/**
- * Manages the all the records associated with a chart sub-stream.<br/>
- * Includes the initial {@link BOFRecord} and final {@link EOFRecord}.
- * 
- * @author Josh Micich
- */
-public final class ChartSubstreamRecordAggregate extends RecordAggregate {
-
-	private final BOFRecord _bofRec;
-	/**
-	 * All the records between BOF and EOF
-	 */
-	private final List<RecordBase> _recs;
-	private PageSettingsBlock _psBlock;
-
-	public ChartSubstreamRecordAggregate(RecordStream rs) {
-		_bofRec = (BOFRecord) rs.getNext();
-		List<RecordBase> temp = new ArrayList<RecordBase>();
-		while (rs.peekNextClass() != EOFRecord.class) {
-			if (PageSettingsBlock.isComponentRecord(rs.peekNextSid())) {
-				if (_psBlock != null) {
-					if (rs.peekNextSid() == UnknownRecord.HEADER_FOOTER_089C) {
-						// test samples: 45538_classic_Footer.xls, 45538_classic_Header.xls
-						_psBlock.addLateHeaderFooter(rs.getNext());
-						continue;
-					}
-					throw new IllegalStateException(
-							"Found more than one PageSettingsBlock in chart sub-stream");
-				}
-				_psBlock = new PageSettingsBlock(rs);
-				temp.add(_psBlock);
-				continue;
-			}
-			temp.add(rs.getNext());
-		}
-		_recs = temp;
-		Record eof = rs.getNext(); // no need to save EOF in field
-		if (!(eof instanceof EOFRecord)) {
-			throw new IllegalStateException("Bad chart EOF");
-		}
-	}
-
-	public void visitContainedRecords(RecordVisitor rv) {
-		if (_recs.isEmpty()) {
-			return;
-		}
-		rv.visitRecord(_bofRec);
-		for (int i = 0; i < _recs.size(); i++) {
-			RecordBase rb = _recs.get(i);
-			if (rb instanceof RecordAggregate) {
-				((RecordAggregate) rb).visitContainedRecords(rv);
-			} else {
-				rv.visitRecord((Record) rb);
-			}
-		}
-		rv.visitRecord(EOFRecord.instance);
-	}
-}
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
+package org.apache.poi.hssf.record.aggregates;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.poi.hssf.model.RecordStream;
+import org.apache.poi.hssf.record.BOFRecord;
+import org.apache.poi.hssf.record.EOFRecord;
+import org.apache.poi.hssf.record.Record;
+import org.apache.poi.hssf.record.RecordBase;
+import org.apache.poi.hssf.record.UnknownRecord;
+
+/**
+ * Manages the all the records associated with a chart sub-stream.<br/>
+ * Includes the initial {@link BOFRecord} and final {@link EOFRecord}.
+ *
+ * @author Josh Micich
+ */
+public final class ChartSubstreamRecordAggregate extends RecordAggregate {
+
+	private final BOFRecord _bofRec;
+	/**
+	 * All the records between BOF and EOF
+	 */
+	private final List<RecordBase> _recs;
+	private PageSettingsBlock _psBlock;
+
+	public ChartSubstreamRecordAggregate(RecordStream rs) {
+		_bofRec = (BOFRecord) rs.getNext();
+		List<RecordBase> temp = new ArrayList<RecordBase>();
+		while (rs.peekNextClass() != EOFRecord.class) {
+			if (PageSettingsBlock.isComponentRecord(rs.peekNextSid())) {
+				if (_psBlock != null) {
+					if (rs.peekNextSid() == UnknownRecord.HEADER_FOOTER_089C) {
+						// test samples: 45538_classic_Footer.xls, 45538_classic_Header.xls
+						_psBlock.addLateHeaderFooter(rs.getNext());
+						continue;
+					}
+					throw new IllegalStateException(
+							"Found more than one PageSettingsBlock in chart sub-stream");
+				}
+				_psBlock = new PageSettingsBlock(rs);
+				temp.add(_psBlock);
+				continue;
+			}
+			temp.add(rs.getNext());
+		}
+		_recs = temp;
+		Record eof = rs.getNext(); // no need to save EOF in field
+		if (!(eof instanceof EOFRecord)) {
+			throw new IllegalStateException("Bad chart EOF");
+		}
+	}
+
+	public void visitContainedRecords(RecordVisitor rv) {
+		if (_recs.isEmpty()) {
+			return;
+		}
+		rv.visitRecord(_bofRec);
+		for (int i = 0; i < _recs.size(); i++) {
+			RecordBase rb = _recs.get(i);
+			if (rb instanceof RecordAggregate) {
+				((RecordAggregate) rb).visitContainedRecords(rv);
+			} else {
+				rv.visitRecord((Record) rb);
+			}
+		}
+		rv.visitRecord(EOFRecord.instance);
+	}
+}

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/DataValidityTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/DataValidityTable.java?rev=776377&r1=776376&r2=776377&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/DataValidityTable.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/DataValidityTable.java Tue May 19 16:29:51 2009
@@ -1,70 +1,70 @@
-/* ====================================================================
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-==================================================================== */
-
-package org.apache.poi.hssf.record.aggregates;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.poi.hssf.model.RecordStream;
-import org.apache.poi.hssf.record.DVALRecord;
-import org.apache.poi.hssf.record.DVRecord;
-import org.apache.poi.hssf.record.Record;
-
-/**
- * Manages the DVALRecord and DVRecords for a single sheet<br/>
- * See OOO excelfileformat.pdf section 4.14
- * @author Josh Micich
- */
-public final class DataValidityTable extends RecordAggregate {
-
-	private final DVALRecord _headerRec;
-	/**
-	 * The list of data validations for the current sheet.
-	 * Note - this may be empty (contrary to OOO documentation)
-	 */
-	private final List _validationList;
-
-	public DataValidityTable(RecordStream rs) {
-		_headerRec = (DVALRecord) rs.getNext();
-		List temp = new ArrayList();
-		while (rs.peekNextClass() == DVRecord.class) {
-			temp.add(rs.getNext());
-		}
-		_validationList = temp;
-	}
-
-	public DataValidityTable() {
-		_headerRec = new DVALRecord();
-		_validationList = new ArrayList();
-	}
-
-	public void visitContainedRecords(RecordVisitor rv) {
-		if (_validationList.isEmpty()) {
-			return;
-		}
-		rv.visitRecord(_headerRec);
-		for (int i = 0; i < _validationList.size(); i++) {
-			rv.visitRecord((Record) _validationList.get(i));
-		}
-	}
-	
-	public void addDataValidation(DVRecord dvRecord) {
-		_validationList.add(dvRecord);
-		_headerRec.setDVRecNo(_validationList.size());
-	}
-}
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
+package org.apache.poi.hssf.record.aggregates;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.poi.hssf.model.RecordStream;
+import org.apache.poi.hssf.record.DVALRecord;
+import org.apache.poi.hssf.record.DVRecord;
+import org.apache.poi.hssf.record.Record;
+
+/**
+ * Manages the DVALRecord and DVRecords for a single sheet<br/>
+ * See OOO excelfileformat.pdf section 4.14
+ * @author Josh Micich
+ */
+public final class DataValidityTable extends RecordAggregate {
+
+	private final DVALRecord _headerRec;
+	/**
+	 * The list of data validations for the current sheet.
+	 * Note - this may be empty (contrary to OOO documentation)
+	 */
+	private final List _validationList;
+
+	public DataValidityTable(RecordStream rs) {
+		_headerRec = (DVALRecord) rs.getNext();
+		List temp = new ArrayList();
+		while (rs.peekNextClass() == DVRecord.class) {
+			temp.add(rs.getNext());
+		}
+		_validationList = temp;
+	}
+
+	public DataValidityTable() {
+		_headerRec = new DVALRecord();
+		_validationList = new ArrayList();
+	}
+
+	public void visitContainedRecords(RecordVisitor rv) {
+		if (_validationList.isEmpty()) {
+			return;
+		}
+		rv.visitRecord(_headerRec);
+		for (int i = 0; i < _validationList.size(); i++) {
+			rv.visitRecord((Record) _validationList.get(i));
+		}
+	}
+
+	public void addDataValidation(DVRecord dvRecord) {
+		_validationList.add(dvRecord);
+		_headerRec.setDVRecNo(_validationList.size());
+	}
+}

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/RecordAggregate.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/RecordAggregate.java?rev=776377&r1=776376&r2=776377&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/RecordAggregate.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/RecordAggregate.java Tue May 19 16:29:51 2009
@@ -1,115 +1,115 @@
-/* ====================================================================
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-==================================================================== */
-
-package org.apache.poi.hssf.record.aggregates;
-
-import org.apache.poi.hssf.record.Record;
-import org.apache.poi.hssf.record.RecordBase;
-
-/**
- * <tt>RecordAggregate</tt>s are groups of of BIFF <tt>Record</tt>s that are typically stored 
- * together and/or updated together.  Workbook / Sheet records are typically stored in a sequential
- * list, which does not provide much structure to coordinate updates.
- * 
- * @author Josh Micich
- */
-public abstract class RecordAggregate extends RecordBase {
-
-	/**
-	 * Visit each of the atomic BIFF records contained in this {@link RecordAggregate} in the order
-	 * that they should be written to file.  Implementors may or may not return the actual 
-	 * {@link Record}s being used to manage POI's internal implementation.  Callers should not
-	 * assume either way, and therefore only attempt to modify those {@link Record}s after cloning
-	 */
-	public abstract void visitContainedRecords(RecordVisitor rv);
-	
-	public final int serialize(int offset, byte[] data) {
-		SerializingRecordVisitor srv = new SerializingRecordVisitor(data, offset);
-		visitContainedRecords(srv);
-		return srv.countBytesWritten();
-	}
-	public int getRecordSize() {
-		RecordSizingVisitor rsv = new RecordSizingVisitor();
-		visitContainedRecords(rsv);
-		return rsv.getTotalSize();
-	}
-	
-	public interface RecordVisitor {
-		/**
-		 * Implementors may call non-mutating methods on Record r.
-		 * @param r must not be <code>null</code>
-		 */
-		void visitRecord(Record r);
-	}
-	
-	private static final class SerializingRecordVisitor implements RecordVisitor {
-
-		private final byte[] _data;
-		private final int _startOffset;
-		private int _countBytesWritten;
-
-		public SerializingRecordVisitor(byte[] data, int startOffset) {
-			_data = data;
-			_startOffset = startOffset;
-			_countBytesWritten = 0;
-		}
-		public int countBytesWritten() {
-			return _countBytesWritten;
-		}
-		public void visitRecord(Record r) {
-			int currentOffset = _startOffset + _countBytesWritten;
-			_countBytesWritten += r.serialize(currentOffset, _data);
-		}
-	}
-	private static final class RecordSizingVisitor implements RecordVisitor {
-
-		private int _totalSize;
-		
-		public RecordSizingVisitor() {
-			_totalSize = 0;
-		}
-		public int getTotalSize() {
-			return _totalSize;
-		}
-		public void visitRecord(Record r) {
-			_totalSize += r.getRecordSize();
-		}
-	}
-	/**
-	 * A wrapper for {@link RecordVisitor} which accumulates the sizes of all
-	 * records visited.
-	 */
-	public static final class PositionTrackingVisitor implements RecordVisitor {
-		private final RecordVisitor _rv;
-		private int _position;
-
-		public PositionTrackingVisitor(RecordVisitor rv, int initialPosition) {
-			_rv = rv;
-			_position = initialPosition;
-		}
-		public void visitRecord(Record r) {
-			_position += r.getRecordSize();
-			_rv.visitRecord(r);
-		}
-		public void setPosition(int position) {
-			_position = position;
-		}
-		public int getPosition() {
-			return _position;
-		}
-	}
-}
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
+package org.apache.poi.hssf.record.aggregates;
+
+import org.apache.poi.hssf.record.Record;
+import org.apache.poi.hssf.record.RecordBase;
+
+/**
+ * <tt>RecordAggregate</tt>s are groups of of BIFF <tt>Record</tt>s that are typically stored
+ * together and/or updated together.  Workbook / Sheet records are typically stored in a sequential
+ * list, which does not provide much structure to coordinate updates.
+ *
+ * @author Josh Micich
+ */
+public abstract class RecordAggregate extends RecordBase {
+
+	/**
+	 * Visit each of the atomic BIFF records contained in this {@link RecordAggregate} in the order
+	 * that they should be written to file.  Implementors may or may not return the actual
+	 * {@link Record}s being used to manage POI's internal implementation.  Callers should not
+	 * assume either way, and therefore only attempt to modify those {@link Record}s after cloning
+	 */
+	public abstract void visitContainedRecords(RecordVisitor rv);
+
+	public final int serialize(int offset, byte[] data) {
+		SerializingRecordVisitor srv = new SerializingRecordVisitor(data, offset);
+		visitContainedRecords(srv);
+		return srv.countBytesWritten();
+	}
+	public int getRecordSize() {
+		RecordSizingVisitor rsv = new RecordSizingVisitor();
+		visitContainedRecords(rsv);
+		return rsv.getTotalSize();
+	}
+
+	public interface RecordVisitor {
+		/**
+		 * Implementors may call non-mutating methods on Record r.
+		 * @param r must not be <code>null</code>
+		 */
+		void visitRecord(Record r);
+	}
+
+	private static final class SerializingRecordVisitor implements RecordVisitor {
+
+		private final byte[] _data;
+		private final int _startOffset;
+		private int _countBytesWritten;
+
+		public SerializingRecordVisitor(byte[] data, int startOffset) {
+			_data = data;
+			_startOffset = startOffset;
+			_countBytesWritten = 0;
+		}
+		public int countBytesWritten() {
+			return _countBytesWritten;
+		}
+		public void visitRecord(Record r) {
+			int currentOffset = _startOffset + _countBytesWritten;
+			_countBytesWritten += r.serialize(currentOffset, _data);
+		}
+	}
+	private static final class RecordSizingVisitor implements RecordVisitor {
+
+		private int _totalSize;
+
+		public RecordSizingVisitor() {
+			_totalSize = 0;
+		}
+		public int getTotalSize() {
+			return _totalSize;
+		}
+		public void visitRecord(Record r) {
+			_totalSize += r.getRecordSize();
+		}
+	}
+	/**
+	 * A wrapper for {@link RecordVisitor} which accumulates the sizes of all
+	 * records visited.
+	 */
+	public static final class PositionTrackingVisitor implements RecordVisitor {
+		private final RecordVisitor _rv;
+		private int _position;
+
+		public PositionTrackingVisitor(RecordVisitor rv, int initialPosition) {
+			_rv = rv;
+			_position = initialPosition;
+		}
+		public void visitRecord(Record r) {
+			_position += r.getRecordSize();
+			_rv.visitRecord(r);
+		}
+		public void setPosition(int position) {
+			_position = position;
+		}
+		public int getPosition() {
+			return _position;
+		}
+	}
+}

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/cont/ContinuableRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/cont/ContinuableRecord.java?rev=776377&r1=776376&r2=776377&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/cont/ContinuableRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/cont/ContinuableRecord.java Tue May 19 16:29:51 2009
@@ -1,69 +1,69 @@
-/* ====================================================================
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-==================================================================== */
-
-package org.apache.poi.hssf.record.cont;
-
-import org.apache.poi.hssf.record.ContinueRecord;
-import org.apache.poi.hssf.record.Record;
-import org.apache.poi.util.LittleEndianByteArrayOutputStream;
-import org.apache.poi.util.LittleEndianOutput;
-
-/**
- * Common superclass of all records that can produce {@link ContinueRecord}s while being serialized.
- * 
- * @author Josh Micich
- */
-public abstract class ContinuableRecord extends Record {
-
-	protected ContinuableRecord() {
-		// no fields to initialise 
-	}
-	/**
-	 * Serializes this record's content to the supplied data output.<br/>
-	 * The standard BIFF header (ushort sid, ushort size) has been handled by the superclass, so 
-	 * only BIFF data should be written by this method.  Simple data types can be written with the
-	 * standard {@link LittleEndianOutput} methods.  Methods from {@link ContinuableRecordOutput} 
-	 * can be used to serialize strings (with {@link ContinueRecord}s being written as required).
-	 * If necessary, implementors can explicitly start {@link ContinueRecord}s (regardless of the
-	 * amount of remaining space).
-	 * 
-	 * @param out a data output stream
-	 */
-	protected abstract void serialize(ContinuableRecordOutput out);
-
-
-	/**
-	 * @return the total length of the encoded record(s) 
-	 * (Note - if any {@link ContinueRecord} is required, this result includes the
-	 * size of those too)
-	 */
-	public final int getRecordSize() {
-		ContinuableRecordOutput out = ContinuableRecordOutput.createForCountingOnly();
-		serialize(out);
-		out.terminate();
-		return out.getTotalSize();
-	}
-
-	public final int serialize(int offset, byte[] data) {
-
-		LittleEndianOutput leo = new LittleEndianByteArrayOutputStream(data, offset);
-		ContinuableRecordOutput out = new ContinuableRecordOutput(leo, getSid());
-		serialize(out);
-		out.terminate();
-		return out.getTotalSize();
-	}
-}
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
+package org.apache.poi.hssf.record.cont;
+
+import org.apache.poi.hssf.record.ContinueRecord;
+import org.apache.poi.hssf.record.Record;
+import org.apache.poi.util.LittleEndianByteArrayOutputStream;
+import org.apache.poi.util.LittleEndianOutput;
+
+/**
+ * Common superclass of all records that can produce {@link ContinueRecord}s while being serialized.
+ *
+ * @author Josh Micich
+ */
+public abstract class ContinuableRecord extends Record {
+
+	protected ContinuableRecord() {
+		// no fields to initialise
+	}
+	/**
+	 * Serializes this record's content to the supplied data output.<br/>
+	 * The standard BIFF header (ushort sid, ushort size) has been handled by the superclass, so
+	 * only BIFF data should be written by this method.  Simple data types can be written with the
+	 * standard {@link LittleEndianOutput} methods.  Methods from {@link ContinuableRecordOutput}
+	 * can be used to serialize strings (with {@link ContinueRecord}s being written as required).
+	 * If necessary, implementors can explicitly start {@link ContinueRecord}s (regardless of the
+	 * amount of remaining space).
+	 *
+	 * @param out a data output stream
+	 */
+	protected abstract void serialize(ContinuableRecordOutput out);
+
+
+	/**
+	 * @return the total length of the encoded record(s)
+	 * (Note - if any {@link ContinueRecord} is required, this result includes the
+	 * size of those too)
+	 */
+	public final int getRecordSize() {
+		ContinuableRecordOutput out = ContinuableRecordOutput.createForCountingOnly();
+		serialize(out);
+		out.terminate();
+		return out.getTotalSize();
+	}
+
+	public final int serialize(int offset, byte[] data) {
+
+		LittleEndianOutput leo = new LittleEndianByteArrayOutputStream(data, offset);
+		ContinuableRecordOutput out = new ContinuableRecordOutput(leo, getSid());
+		serialize(out);
+		out.terminate();
+		return out.getTotalSize();
+	}
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message