aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/poi
diff options
context:
space:
mode:
authorGlen Stampoultzis <glens@apache.org>2002-02-10 04:32:07 +0000
committerGlen Stampoultzis <glens@apache.org>2002-02-10 04:32:07 +0000
commit35ed88b7c1318ec48989247acee98086dd564389 (patch)
tree420ef73622e3157d6511cff4c1bb9e1a764895de /src/java/org/apache/poi
parente8bdf9d9596a5e4c603a501ad3f979140bb0b31a (diff)
downloadpoi-35ed88b7c1318ec48989247acee98086dd564389.tar.gz
poi-35ed88b7c1318ec48989247acee98086dd564389.zip
Added support for automatic record generation
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352078 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi')
-rw-r--r--src/java/org/apache/poi/hssf/dev/BiffViewer.java8
-rw-r--r--src/java/org/apache/poi/hssf/record/AreaRecord.java253
-rw-r--r--src/java/org/apache/poi/hssf/record/BarRecord.java322
-rw-r--r--src/java/org/apache/poi/hssf/record/DatRecord.java273
-rw-r--r--src/java/org/apache/poi/hssf/record/DataFormatRecord.java285
-rw-r--r--src/java/org/apache/poi/hssf/record/FrameRecord.java268
-rw-r--r--src/java/org/apache/poi/hssf/record/LegendRecord.java494
-rw-r--r--src/java/org/apache/poi/hssf/record/ProtectRecord.java14
-rw-r--r--src/java/org/apache/poi/hssf/record/SeriesRecord.java278
-rw-r--r--src/java/org/apache/poi/hssf/util/RecordGenerator.java133
-rw-r--r--src/java/org/apache/poi/util/HexDump.java49
11 files changed, 2290 insertions, 87 deletions
diff --git a/src/java/org/apache/poi/hssf/dev/BiffViewer.java b/src/java/org/apache/poi/hssf/dev/BiffViewer.java
index b44abf42f9..3e689d8458 100644
--- a/src/java/org/apache/poi/hssf/dev/BiffViewer.java
+++ b/src/java/org/apache/poi/hssf/dev/BiffViewer.java
@@ -587,6 +587,14 @@ public class BiffViewer
retval = new MergeCellsRecord(rectype, size, data);
break;
+ case AreaRecord.sid :
+ retval = new AreaRecord(rectype, size, data);
+ break;
+
+ case DataFormatRecord.sid :
+ retval = new DataFormatRecord(rectype, size, data);
+ break;
+
default :
retval = new UnknownRecord(rectype, size, data);
}
diff --git a/src/java/org/apache/poi/hssf/record/AreaRecord.java b/src/java/org/apache/poi/hssf/record/AreaRecord.java
new file mode 100644
index 0000000000..a43969bb59
--- /dev/null
+++ b/src/java/org/apache/poi/hssf/record/AreaRecord.java
@@ -0,0 +1,253 @@
+
+/* ====================================================================
+ * 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/>.
+ */
+
+
+package org.apache.poi.hssf.record;
+
+
+
+import org.apache.poi.util.BitField;
+import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.StringUtil;
+import org.apache.poi.util.HexDump;
+
+/**
+ * The area record is used to define a area chart.
+ * NOTE: This source is automatically generated please do not modify this file. Either subclass or
+ * remove the record in src/records/definitions.
+
+ * @author Glen Stampoultzis (gstamp at iprimus dot com dot au)
+ */
+public class AreaRecord
+ extends Record
+{
+ public final static short sid = 0x101A;
+ private short field_1_formatFlags;
+ private BitField stacked = new BitField(0x1);
+ private BitField displayAsPercentage = new BitField(0x2);
+ private BitField shadow = new BitField(0x4);
+
+
+ public AreaRecord()
+ {
+
+ }
+
+ /**
+ * Constructs a Area record and sets its fields appropriately.
+ *
+ * @param id id must be 0x101A or an exception
+ * will be throw upon validation
+ * @param size size the size of the data area of the record
+ * @param data data of the record (should not contain sid/len)
+ */
+
+ public AreaRecord(short id, short size, byte [] data)
+ {
+ super(id, size, data);
+ }
+
+ /**
+ * Constructs a Area record and sets its fields appropriately.
+ *
+ * @param id id must be 0x101A or an exception
+ * will be throw upon validation
+ * @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
+ */
+
+ public AreaRecord(short id, short size, byte [] data, int offset)
+ {
+ super(id, size, data, offset);
+ }
+
+ /**
+ * Checks the sid matches the expected side for this record
+ *
+ * @param id the expected sid.
+ */
+ protected void validateSid(short id)
+ {
+ if (id != sid)
+ {
+ throw new RecordFormatException("Not a Area record");
+ }
+ }
+
+ protected void fillFields(byte [] data, short size, int offset)
+ {
+ field_1_formatFlags = LittleEndian.getShort(data, 0 + offset);
+
+ }
+
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append("[Area]\n");
+
+ buffer.append(" .formatFlags = ")
+ .append("0x")
+ .append(HexDump.toHex((short)getFormatFlags()))
+ .append(" (").append(getFormatFlags()).append(" )\n");
+ buffer.append(" .stacked = ").append(isStacked ()).append('\n');
+ buffer.append(" .displayAsPercentage = ").append(isDisplayAsPercentage ()).append('\n');
+ buffer.append(" .shadow = ").append(isShadow ()).append('\n');
+
+ buffer.append("[/Area]\n");
+ return buffer.toString();
+ }
+
+ public int serialize(int offset, byte[] data)
+ {
+ LittleEndian.putShort(data, 0 + offset, sid);
+ LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
+
+ LittleEndian.putShort(data, 4 + offset, field_1_formatFlags);
+
+ return getRecordSize();
+ }
+
+ /**
+ * Size of record (exluding 4 byte header)
+ */
+ public int getRecordSize()
+ {
+ return 4 + 2;
+ }
+
+ public short getSid()
+ {
+ return this.sid;
+ }
+
+
+ /**
+ * Get the format flags field for the Area record.
+ */
+ public short getFormatFlags()
+ {
+ return field_1_formatFlags;
+ }
+
+ /**
+ * Set the format flags field for the Area record.
+ */
+ public void setFormatFlags(short field_1_formatFlags)
+ {
+ this.field_1_formatFlags = field_1_formatFlags;
+ }
+
+ /**
+ * Sets the stacked field value.
+ * series is stacked
+ */
+ public void setStacked(boolean value)
+ {
+ field_1_formatFlags = stacked.setShortBoolean(field_1_formatFlags, value);
+ }
+
+ /**
+ * series is stacked
+ * @return the stacked field value.
+ */
+ public boolean isStacked()
+ {
+ return stacked.isSet(field_1_formatFlags);
+ }
+
+ /**
+ * Sets the display as percentage field value.
+ * results displayed as percentages
+ */
+ public void setDisplayAsPercentage(boolean value)
+ {
+ field_1_formatFlags = displayAsPercentage.setShortBoolean(field_1_formatFlags, value);
+ }
+
+ /**
+ * results displayed as percentages
+ * @return the display as percentage field value.
+ */
+ public boolean isDisplayAsPercentage()
+ {
+ return displayAsPercentage.isSet(field_1_formatFlags);
+ }
+
+ /**
+ * Sets the shadow field value.
+ * display a shadow for the chart
+ */
+ public void setShadow(boolean value)
+ {
+ field_1_formatFlags = shadow.setShortBoolean(field_1_formatFlags, value);
+ }
+
+ /**
+ * display a shadow for the chart
+ * @return the shadow field value.
+ */
+ public boolean isShadow()
+ {
+ return shadow.isSet(field_1_formatFlags);
+ }
+
+
+} // END OF CLASS
+
+
+
+
diff --git a/src/java/org/apache/poi/hssf/record/BarRecord.java b/src/java/org/apache/poi/hssf/record/BarRecord.java
new file mode 100644
index 0000000000..b01368cd64
--- /dev/null
+++ b/src/java/org/apache/poi/hssf/record/BarRecord.java
@@ -0,0 +1,322 @@
+
+/* ====================================================================
+ * 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/>.
+ */
+
+
+package org.apache.poi.hssf.record;
+
+
+
+import org.apache.poi.util.BitField;
+import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.StringUtil;
+import org.apache.poi.util.HexDump;
+
+/**
+ * The bar record is used to define a bar chart.
+ * NOTE: This source is automatically generated please do not modify this file. Either subclass or
+ * remove the record in src/records/definitions.
+
+ * @author Glen Stampoultzis (gstamp at iprimus dot com dot au)
+ */
+public class BarRecord
+ extends Record
+{
+ public final static short sid = 0x1017;
+ private short field_1_barSpace;
+ private short field_2_categorySpace;
+ private short field_3_formatFlags;
+ private BitField horizontal = new BitField(0x1);
+ private BitField stacked = new BitField(0x2);
+ private BitField displayAsPercentage = new BitField(0x4);
+ private BitField shadow = new BitField(0x8);
+
+
+ public BarRecord()
+ {
+ field_2_categorySpace = 50;
+
+ }
+
+ /**
+ * Constructs a Bar record and sets its fields appropriately.
+ *
+ * @param id id must be 0x1017 or an exception
+ * will be throw upon validation
+ * @param size size the size of the data area of the record
+ * @param data data of the record (should not contain sid/len)
+ */
+
+ public BarRecord(short id, short size, byte [] data)
+ {
+ super(id, size, data);
+ }
+
+ /**
+ * Constructs a Bar record and sets its fields appropriately.
+ *
+ * @param id id must be 0x1017 or an exception
+ * will be throw upon validation
+ * @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
+ */
+
+ public BarRecord(short id, short size, byte [] data, int offset)
+ {
+ super(id, size, data, offset);
+ }
+
+ /**
+ * Checks the sid matches the expected side for this record
+ *
+ * @param id the expected sid.
+ */
+ protected void validateSid(short id)
+ {
+ if (id != sid)
+ {
+ throw new RecordFormatException("Not a Bar record");
+ }
+ }
+
+ protected void fillFields(byte [] data, short size, int offset)
+ {
+ field_1_barSpace = LittleEndian.getShort(data, 0 + offset);
+ field_2_categorySpace = LittleEndian.getShort(data, 2 + offset);
+ field_3_formatFlags = LittleEndian.getShort(data, 4 + offset);
+
+ }
+
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append("[Bar]\n");
+
+ buffer.append(" .barSpace = ")
+ .append("0x")
+ .append(HexDump.toHex((short)getBarSpace()))
+ .append(" (").append(getBarSpace()).append(" )\n");
+
+ buffer.append(" .categorySpace = ")
+ .append("0x")
+ .append(HexDump.toHex((short)getCategorySpace()))
+ .append(" (").append(getCategorySpace()).append(" )\n");
+
+ buffer.append(" .formatFlags = ")
+ .append("0x")
+ .append(HexDump.toHex((short)getFormatFlags()))
+ .append(" (").append(getFormatFlags()).append(" )\n");
+ buffer.append(" .horizontal = ").append(isHorizontal ()).append('\n');
+ buffer.append(" .stacked = ").append(isStacked ()).append('\n');
+ buffer.append(" .displayAsPercentage = ").append(isDisplayAsPercentage ()).append('\n');
+ buffer.append(" .shadow = ").append(isShadow ()).append('\n');
+
+ buffer.append("[/Bar]\n");
+ return buffer.toString();
+ }
+
+ public int serialize(int offset, byte[] data)
+ {
+ LittleEndian.putShort(data, 0 + offset, sid);
+ LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
+
+ LittleEndian.putShort(data, 4 + offset, field_1_barSpace);
+ LittleEndian.putShort(data, 6 + offset, field_2_categorySpace);
+ LittleEndian.putShort(data, 8 + offset, field_3_formatFlags);
+
+ return getRecordSize();
+ }
+
+ /**
+ * Size of record (exluding 4 byte header)
+ */
+ public int getRecordSize()
+ {
+ return 4 + 2 + 2 + 2;
+ }
+
+ public short getSid()
+ {
+ return this.sid;
+ }
+
+
+ /**
+ * Get the bar space field for the Bar record.
+ */
+ public short getBarSpace()
+ {
+ return field_1_barSpace;
+ }
+
+ /**
+ * Set the bar space field for the Bar record.
+ */
+ public void setBarSpace(short field_1_barSpace)
+ {
+ this.field_1_barSpace = field_1_barSpace;
+ }
+
+ /**
+ * Get the category space field for the Bar record.
+ */
+ public short getCategorySpace()
+ {
+ return field_2_categorySpace;
+ }
+
+ /**
+ * Set the category space field for the Bar record.
+ */
+ public void setCategorySpace(short field_2_categorySpace)
+ {
+ this.field_2_categorySpace = field_2_categorySpace;
+ }
+
+ /**
+ * Get the format flags field for the Bar record.
+ */
+ public short getFormatFlags()
+ {
+ return field_3_formatFlags;
+ }
+
+ /**
+ * Set the format flags field for the Bar record.
+ */
+ public void setFormatFlags(short field_3_formatFlags)
+ {
+ this.field_3_formatFlags = field_3_formatFlags;
+ }
+
+ /**
+ * Sets the horizontal field value.
+ * true to display horizontal bar charts, false for vertical
+ */
+ public void setHorizontal(boolean value)
+ {
+ field_3_formatFlags = horizontal.setShortBoolean(field_3_formatFlags, value);
+ }
+
+ /**
+ * true to display horizontal bar charts, false for vertical
+ * @return the horizontal field value.
+ */
+ public boolean isHorizontal()
+ {
+ return horizontal.isSet(field_3_formatFlags);
+ }
+
+ /**
+ * Sets the stacked field value.
+ * stack displayed values
+ */
+ public void setStacked(boolean value)
+ {
+ field_3_formatFlags = stacked.setShortBoolean(field_3_formatFlags, value);
+ }
+
+ /**
+ * stack displayed values
+ * @return the stacked field value.
+ */
+ public boolean isStacked()
+ {
+ return stacked.isSet(field_3_formatFlags);
+ }
+
+ /**
+ * Sets the display as percentage field value.
+ * display chart values as a percentage
+ */
+ public void setDisplayAsPercentage(boolean value)
+ {
+ field_3_formatFlags = displayAsPercentage.setShortBoolean(field_3_formatFlags, value);
+ }
+
+ /**
+ * display chart values as a percentage
+ * @return the display as percentage field value.
+ */
+ public boolean isDisplayAsPercentage()
+ {
+ return displayAsPercentage.isSet(field_3_formatFlags);
+ }
+
+ /**
+ * Sets the shadow field value.
+ * display a shadow for the chart
+ */
+ public void setShadow(boolean value)
+ {
+ field_3_formatFlags = shadow.setShortBoolean(field_3_formatFlags, value);
+ }
+
+ /**
+ * display a shadow for the chart
+ * @return the shadow field value.
+ */
+ public boolean isShadow()
+ {
+ return shadow.isSet(field_3_formatFlags);
+ }
+
+
+} // END OF CLASS
+
+
+
+
diff --git a/src/java/org/apache/poi/hssf/record/DatRecord.java b/src/java/org/apache/poi/hssf/record/DatRecord.java
new file mode 100644
index 0000000000..9121ce3f55
--- /dev/null
+++ b/src/java/org/apache/poi/hssf/record/DatRecord.java
@@ -0,0 +1,273 @@
+
+/* ====================================================================
+ * 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/>.
+ */
+
+
+package org.apache.poi.hssf.record;
+
+
+
+import org.apache.poi.util.BitField;
+import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.StringUtil;
+import org.apache.poi.util.HexDump;
+
+/**
+ * The dat record is used to store options for the chart.
+ * NOTE: This source is automatically generated please do not modify this file. Either subclass or
+ * remove the record in src/records/definitions.
+
+ * @author Glen Stampoultzis (gstamp at iprimus dot com dot au)
+ */
+public class DatRecord
+ extends Record
+{
+ public final static short sid = 0x1063;
+ private short field_1_options;
+ private BitField horizontalBorder = new BitField(0x1);
+ private BitField verticalBorder = new BitField(0x2);
+ private BitField border = new BitField(0x4);
+ private BitField showSeriesKey = new BitField(0x8);
+
+
+ public DatRecord()
+ {
+
+ }
+
+ /**
+ * Constructs a Dat record and sets its fields appropriately.
+ *
+ * @param id id must be 0x1063 or an exception
+ * will be throw upon validation
+ * @param size size the size of the data area of the record
+ * @param data data of the record (should not contain sid/len)
+ */
+
+ public DatRecord(short id, short size, byte [] data)
+ {
+ super(id, size, data);
+ }
+
+ /**
+ * Constructs a Dat record and sets its fields appropriately.
+ *
+ * @param id id must be 0x1063 or an exception
+ * will be throw upon validation
+ * @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
+ */
+
+ public DatRecord(short id, short size, byte [] data, int offset)
+ {
+ super(id, size, data, offset);
+ }
+
+ /**
+ * Checks the sid matches the expected side for this record
+ *
+ * @param id the expected sid.
+ */
+ protected void validateSid(short id)
+ {
+ if (id != sid)
+ {
+ throw new RecordFormatException("Not a Dat record");
+ }
+ }
+
+ protected void fillFields(byte [] data, short size, int offset)
+ {
+ field_1_options = LittleEndian.getShort(data, 0 + offset);
+
+ }
+
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append("[Dat]\n");
+
+ buffer.append(" .options = ")
+ .append("0x")
+ .append(HexDump.toHex((short)getOptions()))
+ .append(" (").append(getOptions()).append(" )\n");
+ buffer.append(" .horizontalBorder = ").append(isHorizontalBorder ()).append('\n');
+ buffer.append(" .verticalBorder = ").append(isVerticalBorder ()).append('\n');
+ buffer.append(" .border = ").append(isBorder ()).append('\n');
+ buffer.append(" .showSeriesKey = ").append(isShowSeriesKey ()).append('\n');
+
+ buffer.append("[/Dat]\n");
+ return buffer.toString();
+ }
+
+ public int serialize(int offset, byte[] data)
+ {
+ LittleEndian.putShort(data, 0 + offset, sid);
+ LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
+
+ LittleEndian.putShort(data, 4 + offset, field_1_options);
+
+ return getRecordSize();
+ }
+
+ /**
+ * Size of record (exluding 4 byte header)
+ */
+ public int getRecordSize()
+ {
+ return 4 + 2;
+ }
+
+ public short getSid()
+ {
+ return this.sid;
+ }
+
+
+ /**
+ * Get the options field for the Dat record.
+ */
+ public short getOptions()
+ {
+ return field_1_options;
+ }
+
+ /**
+ * Set the options field for the Dat record.
+ */
+ public void setOptions(short field_1_options)
+ {
+ this.field_1_options = field_1_options;
+ }
+
+ /**
+ * Sets the horizontal border field value.
+ * has a horizontal border
+ */
+ public void setHorizontalBorder(boolean value)
+ {
+ field_1_options = horizontalBorder.setShortBoolean(field_1_options, value);
+ }
+
+ /**
+ * has a horizontal border
+ * @return the horizontal border field value.
+ */
+ public boolean isHorizontalBorder()
+ {
+ return horizontalBorder.isSet(field_1_options);
+ }
+
+ /**
+ * Sets the vertical border field value.
+ * has vertical border
+ */
+ public void setVerticalBorder(boolean value)
+ {
+ field_1_options = verticalBorder.setShortBoolean(field_1_options, value);
+ }
+
+ /**
+ * has vertical border
+ * @return the vertical border field value.
+ */
+ public boolean isVerticalBorder()
+ {
+ return verticalBorder.isSet(field_1_options);
+ }
+
+ /**
+ * Sets the border field value.
+ * data table has a border
+ */
+ public void setBorder(boolean value)
+ {
+ field_1_options = border.setShortBoolean(field_1_options, value);
+ }
+
+ /**
+ * data table has a border
+ * @return the border field value.
+ */
+ public boolean isBorder()
+ {
+ return border.isSet(field_1_options);
+ }
+
+ /**
+ * Sets the show series key field value.
+ * shows the series key
+ */
+ public void setShowSeriesKey(boolean value)
+ {
+ field_1_options = showSeriesKey.setShortBoolean(field_1_options, value);
+ }
+
+ /**
+ * shows the series key
+ * @return the show series key field value.
+ */
+ public boolean isShowSeriesKey()
+ {
+ return showSeriesKey.isSet(field_1_options);
+ }
+
+
+} // END OF CLASS
+
+
+
+
diff --git a/src/java/org/apache/poi/hssf/record/DataFormatRecord.java b/src/java/org/apache/poi/hssf/record/DataFormatRecord.java
new file mode 100644
index 0000000000..6aa5c8a224
--- /dev/null
+++ b/src/java/org/apache/poi/hssf/record/DataFormatRecord.java
@@ -0,0 +1,285 @@
+
+/* ====================================================================
+ * 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/>.
+ */
+
+
+package org.apache.poi.hssf.record;
+
+
+
+import org.apache.poi.util.BitField;
+import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.StringUtil;
+import org.apache.poi.util.HexDump;
+
+/**
+ * The data format record is used to index into a series.
+ * NOTE: This source is automatically generated please do not modify this file. Either subclass or
+ * remove the record in src/records/definitions.
+
+ * @author Glen Stampoultzis (gstamp at iprimus dot com dot au)
+ */
+public class DataFormatRecord
+ extends Record
+{
+ public final static short sid = 0x1006;
+ private short field_1_pointNumber;
+ private short field_2_seriesIndex;
+ private short field_3_seriesNumber;
+ private short field_4_formatFlags;
+ private BitField useExcel4Colors = new BitField(0x1);
+
+
+ public DataFormatRecord()
+ {
+
+ }
+
+ /**
+ * Constructs a DataFormat record and sets its fields appropriately.
+ *
+ * @param id id must be 0x1006 or an exception
+ * will be throw upon validation
+ * @param size size the size of the data area of the record
+ * @param data data of the record (should not contain sid/len)
+ */
+
+ public DataFormatRecord(short id, short size, byte [] data)
+ {
+ super(id, size, data);
+ }
+
+ /**
+ * Constructs a DataFormat record and sets its fields appropriately.
+ *
+ * @param id id must be 0x1006 or an exception
+ * will be throw upon validation
+ * @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
+ */
+
+ public DataFormatRecord(short id, short size, byte [] data, int offset)
+ {
+ super(id, size, data, offset);
+ }
+
+ /**
+ * Checks the sid matches the expected side for this record
+ *
+ * @param id the expected sid.
+ */
+ protected void validateSid(short id)
+ {
+ if (id != sid)
+ {
+ throw new RecordFormatException("Not a DataFormat record");
+ }
+ }
+
+ protected void fillFields(byte [] data, short size, int offset)
+ {
+ field_1_pointNumber = LittleEndian.getShort(data, 0 + offset);
+ field_2_seriesIndex = LittleEndian.getShort(data, 2 + offset);
+ field_3_seriesNumber = LittleEndian.getShort(data, 4 + offset);
+ field_4_formatFlags = LittleEndian.getShort(data, 6 + offset);
+
+ }
+
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append("[DataFormat]\n");
+
+ buffer.append(" .pointNumber = ")
+ .append("0x")
+ .append(HexDump.toHex((short)getPointNumber()))
+ .append(" (").append(getPointNumber()).append(" )\n");
+
+ buffer.append(" .seriesIndex = ")
+ .append("0x")
+ .append(HexDump.toHex((short)getSeriesIndex()))
+ .append(" (").append(getSeriesIndex()).append(" )\n");
+
+ buffer.append(" .seriesNumber = ")
+ .append("0x")
+ .append(HexDump.toHex((short)getSeriesNumber()))
+ .append(" (").append(getSeriesNumber()).append(" )\n");
+
+ buffer.append(" .formatFlags = ")
+ .append("0x")
+ .append(HexDump.toHex((short)getFormatFlags()))
+ .append(" (").append(getFormatFlags()).append(" )\n");
+ buffer.append(" .useExcel4Colors = ").append(isUseExcel4Colors ()).append('\n');
+
+ buffer.append("[/DataFormat]\n");
+ return buffer.toString();
+ }
+
+ public int serialize(int offset, byte[] data)
+ {
+ LittleEndian.putShort(data, 0 + offset, sid);
+ LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
+
+ LittleEndian.putShort(data, 4 + offset, field_1_pointNumber);
+ LittleEndian.putShort(data, 6 + offset, field_2_seriesIndex);
+ LittleEndian.putShort(data, 8 + offset, field_3_seriesNumber);
+ LittleEndian.putShort(data, 10 + offset, field_4_formatFlags);
+
+ return getRecordSize();
+ }
+
+ /**
+ * Size of record (exluding 4 byte header)
+ */
+ public int getRecordSize()
+ {
+ return 4 + 2 + 2 + 2 + 2;
+ }
+
+ public short getSid()
+ {
+ return this.sid;
+ }
+
+
+ /**
+ * Get the point number field for the DataFormat record.
+ */
+ public short getPointNumber()
+ {
+ return field_1_pointNumber;
+ }
+
+ /**
+ * Set the point number field for the DataFormat record.
+ */
+ public void setPointNumber(short field_1_pointNumber)
+ {
+ this.field_1_pointNumber = field_1_pointNumber;
+ }
+
+ /**
+ * Get the series index field for the DataFormat record.
+ */
+ public short getSeriesIndex()
+ {
+ return field_2_seriesIndex;
+ }
+
+ /**
+ * Set the series index field for the DataFormat record.
+ */
+ public void setSeriesIndex(short field_2_seriesIndex)
+ {
+ this.field_2_seriesIndex = field_2_seriesIndex;
+ }
+
+ /**
+ * Get the series number field for the DataFormat record.
+ */
+ public short getSeriesNumber()
+ {
+ return field_3_seriesNumber;
+ }
+
+ /**
+ * Set the series number field for the DataFormat record.
+ */
+ public void setSeriesNumber(short field_3_seriesNumber)
+ {
+ this.field_3_seriesNumber = field_3_seriesNumber;
+ }
+
+ /**
+ * Get the format flags field for the DataFormat record.
+ */
+ public short getFormatFlags()
+ {
+ return field_4_formatFlags;
+ }
+
+ /**
+ * Set the format flags field for the DataFormat record.
+ */
+ public void setFormatFlags(short field_4_formatFlags)
+ {
+ this.field_4_formatFlags = field_4_formatFlags;
+ }
+
+ /**
+ * Sets the use excel 4 colors field value.
+ * set true to use excel 4 colors.
+ */
+ public void setUseExcel4Colors(boolean value)
+ {
+ field_4_formatFlags = useExcel4Colors.setShortBoolean(field_4_formatFlags, value);
+ }
+
+ /**
+ * set true to use excel 4 colors.
+ * @return the use excel 4 colors field value.
+ */
+ public boolean isUseExcel4Colors()
+ {
+ return useExcel4Colors.isSet(field_4_formatFlags);
+ }
+
+
+} // END OF CLASS
+
+
+
+
diff --git a/src/java/org/apache/poi/hssf/record/FrameRecord.java b/src/java/org/apache/poi/hssf/record/FrameRecord.java
new file mode 100644
index 0000000000..89cdbbb814
--- /dev/null
+++ b/src/java/org/apache/poi/hssf/record/FrameRecord.java
@@ -0,0 +1,268 @@
+
+/* ====================================================================
+ * 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/>.
+ */
+
+
+package org.apache.poi.hssf.record;
+
+
+
+import org.apache.poi.util.BitField;
+import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.StringUtil;
+import org.apache.poi.util.HexDump;
+
+/**
+ * The frame record indicates whether there is a border around the displayed text of a chart.
+ * NOTE: This source is automatically generated please do not modify this file. Either subclass or
+ * remove the record in src/records/definitions.
+
+ * @author Glen Stampoultzis (gstamp at iprimus dot com dot au)
+ */
+public class FrameRecord
+ extends Record
+{
+ public final static short sid = 0x1032;
+ private short field_1_borderType;
+ public final static short BORDER_TYPE_REGULAR = 0;
+ public final static short BORDER_TYPE_SHADOW = 1;
+ private short field_2_options;
+ private BitField autoSize = new BitField(0x1);
+ private BitField autoPosition = new BitField(0x2);
+
+
+ public FrameRecord()
+ {
+
+ }
+
+ /**
+ * Constructs a Frame record and sets its fields appropriately.
+ *
+ * @param id id must be 0x1032 or an exception
+ * will be throw upon validation
+ * @param size size the size of the data area of the record
+ * @param data data of the record (should not contain sid/len)
+ */
+
+ public FrameRecord(short id, short size, byte [] data)
+ {
+ super(id, size, data);
+ }
+
+ /**
+ * Constructs a Frame record and sets its fields appropriately.
+ *
+ * @param id id must be 0x1032 or an exception
+ * will be throw upon validation
+ * @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
+ */
+
+ public FrameRecord(short id, short size, byte [] data, int offset)
+ {
+ super(id, size, data, offset);
+ }
+
+ /**
+ * Checks the sid matches the expected side for this record
+ *
+ * @param id the expected sid.
+ */
+ protected void validateSid(short id)
+ {
+ if (id != sid)
+ {
+ throw new RecordFormatException("Not a Frame record");
+ }
+ }
+
+ protected void fillFields(byte [] data, short size, int offset)
+ {
+ field_1_borderType = LittleEndian.getShort(data, 0 + offset);
+ field_2_options = LittleEndian.getShort(data, 2 + offset);
+
+ }
+
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append("[Frame]\n");
+
+ buffer.append(" .borderType = ")
+ .append("0x")
+ .append(HexDump.toHex((short)getBorderType()))
+ .append(" (").append(getBorderType()).append(" )\n");
+
+ buffer.append(" .options = ")
+ .append("0x")
+ .append(HexDump.toHex((short)getOptions()))
+ .append(" (").append(getOptions()).append(" )\n");
+ buffer.append(" .autoSize = ").append(isAutoSize ()).append('\n');
+ buffer.append(" .autoPosition = ").append(isAutoPosition ()).append('\n');
+
+ buffer.append("[/Frame]\n");
+ return buffer.toString();
+ }
+
+ public int serialize(int offset, byte[] data)
+ {
+ LittleEndian.putShort(data, 0 + offset, sid);
+ LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
+
+ LittleEndian.putShort(data, 4 + offset, field_1_borderType);
+ LittleEndian.putShort(data, 6 + offset, field_2_options);
+
+ return getRecordSize();
+ }
+
+ /**
+ * Size of record (exluding 4 byte header)
+ */
+ public int getRecordSize()
+ {
+ return 4 + 2 + 2;
+ }
+
+ public short getSid()
+ {
+ return this.sid;
+ }
+
+
+ /**
+ * Get the border type field for the Frame record.
+ *
+ * @return One of
+ * BORDER_TYPE_REGULAR
+ * BORDER_TYPE_SHADOW
+ */
+ public short getBorderType()
+ {
+ return field_1_borderType;
+ }
+
+ /**
+ * Set the border type field for the Frame record.
+ *
+ * @param field_1_borderType
+ * One of
+ * BORDER_TYPE_REGULAR
+ * BORDER_TYPE_SHADOW
+ */
+ public void setBorderType(short field_1_borderType)
+ {
+ this.field_1_borderType = field_1_borderType;
+ }
+
+ /**
+ * Get the options field for the Frame record.
+ */
+ public short getOptions()
+ {
+ return field_2_options;
+ }
+
+ /**
+ * Set the options field for the Frame record.
+ */
+ public void setOptions(short field_2_options)
+ {
+ this.field_2_options = field_2_options;
+ }
+
+ /**
+ * Sets the auto size field value.
+ * excel calculates the size automatically if true
+ */
+ public void setAutoSize(boolean value)
+ {
+ field_2_options = autoSize.setShortBoolean(field_2_options, value);
+ }
+
+ /**
+ * excel calculates the size automatically if true
+ * @return the auto size field value.
+ */
+ public boolean isAutoSize()
+ {
+ return autoSize.isSet(field_2_options);
+ }
+
+ /**
+ * Sets the auto position field value.
+ * excel calculates the position automatically
+ */
+ public void setAutoPosition(boolean value)
+ {
+ field_2_options = autoPosition.setShortBoolean(field_2_options, value);
+ }
+
+ /**
+ * excel calculates the position automatically
+ * @return the auto position field value.
+ */
+ public boolean isAutoPosition()
+ {
+ return autoPosition.isSet(field_2_options);
+ }
+
+
+} // END OF CLASS
+
+
+
+
diff --git a/src/java/org/apache/poi/hssf/record/LegendRecord.java b/src/java/org/apache/poi/hssf/record/LegendRecord.java
new file mode 100644
index 0000000000..5f5e73d690
--- /dev/null
+++ b/src/java/org/apache/poi/hssf/record/LegendRecord.java
@@ -0,0 +1,494 @@
+
+/* ====================================================================
+ * 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/>.
+ */
+
+
+package org.apache.poi.hssf.record;
+
+
+
+import org.apache.poi.util.BitField;
+import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.StringUtil;
+import org.apache.poi.util.HexDump;
+
+/**
+ * The legend record specifies the location of legend on a chart and it's overall size.
+ * NOTE: This source is automatically generated please do not modify this file. Either subclass or
+ * remove the record in src/records/definitions.
+
+ * @author Glen Stampoultzis (gstamp at iprimus dot com dot au)
+ */
+public class LegendRecord
+ extends Record
+{
+ public final static short sid = 0x1015;
+ private int field_1_xPosition;
+ private int field_2_yPosition;
+ private int field_3_xSize;
+ private int field_4_ySize;
+ private byte field_5_type;
+ public final static byte TYPE_BOTTOM = 0;
+ public final static byte TYPE_CORNER = 1;
+ public final static byte TYPE_TOP = 2;
+ public final static byte TYPE_RIGHT = 3;
+ public final static byte TYPE_LEFT = 4;
+ public final static byte TYPE_NOT_DOCKED = 7;
+ private byte field_6_spacing;
+ public final static byte SPACING_CLOSE = 0;
+ public final static byte SPACING_MEDIUM = 1;
+ public final static byte SPACING_OPEN = 2;
+ private short field_7_options;
+ private BitField autoPosition = new BitField(0x1);
+ private BitField autoSeries = new BitField(0x2);
+ private BitField autoPosX = new BitField(0x4);
+ private BitField autoPosY = new BitField(0x8);
+ private BitField vert = new BitField(0x10);
+ private BitField containsDataTable = new BitField(0x20);
+
+
+ public LegendRecord()
+ {
+
+ }
+
+ /**
+ * Constructs a Legend record and sets its fields appropriately.
+ *
+ * @param id id must be 0x1015 or an exception
+ * will be throw upon validation
+ * @param size size the size of the data area of the record
+ * @param data data of the record (should not contain sid/len)
+ */
+
+ public LegendRecord(short id, short size, byte [] data)
+ {
+ super(id, size, data);
+ }
+
+ /**
+ * Constructs a Legend record and sets its fields appropriately.
+ *
+ * @param id id must be 0x1015 or an exception
+ * will be throw upon validation
+ * @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
+ */
+
+ public LegendRecord(short id, short size, byte [] data, int offset)
+ {
+ super(id, size, data, offset);
+ }
+
+ /**
+ * Checks the sid matches the expected side for this record
+ *
+ * @param id the expected sid.
+ */
+ protected void validateSid(short id)
+ {
+ if (id != sid)
+ {
+ throw new RecordFormatException("Not a Legend record");
+ }
+ }
+
+ protected void fillFields(byte [] data, short size, int offset)
+ {
+ field_1_xPosition = LittleEndian.getInt(data, 0 + offset);
+ field_2_yPosition = LittleEndian.getInt(data, 4 + offset);
+ field_3_xSize = LittleEndian.getInt(data, 8 + offset);
+ field_4_ySize = LittleEndian.getInt(data, 12 + offset);
+ field_5_type = data[ 16 + offset ];
+ field_6_spacing = data[ 17 + offset ];
+ field_7_options = LittleEndian.getShort(data, 18 + offset);
+
+ }
+
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append("[Legend]\n");
+
+ buffer.append(" .xPosition = ")
+ .append("0x")
+ .append(HexDump.toHex((int)getXPosition()))
+ .append(" (").append(getXPosition()).append(" )\n");
+
+ buffer.append(" .yPosition = ")
+ .append("0x")
+ .append(HexDump.toHex((int)getYPosition()))
+ .append(" (").append(getYPosition()).append(" )\n");
+
+ buffer.append(" .xSize = ")
+ .append("0x")
+ .append(HexDump.toHex((int)getXSize()))
+ .append(" (").append(getXSize()).append(" )\n");
+
+ buffer.append(" .ySize = ")
+ .append("0x")
+ .append(HexDump.toHex((int)getYSize()))
+ .append(" (").append(getYSize()).append(" )\n");
+
+ buffer.append(" .type = ")
+ .append("0x")
+ .append(HexDump.toHex((byte)getType()))
+ .append(" (").append(getType()).append(" )\n");
+
+ buffer.append(" .spacing = ")
+ .append("0x")
+ .append(HexDump.toHex((byte)getSpacing()))
+ .append(" (").append(getSpacing()).append(" )\n");
+
+ buffer.append(" .options = ")
+ .append("0x")
+ .append(HexDump.toHex((short)getOptions()))
+ .append(" (").append(getOptions()).append(" )\n");
+ buffer.append(" .autoPosition = ").append(isAutoPosition ()).append('\n');
+ buffer.append(" .autoSeries = ").append(isAutoSeries ()).append('\n');
+ buffer.append(" .autoPosX = ").append(isAutoPosX ()).append('\n');
+ buffer.append(" .autoPosY = ").append(isAutoPosY ()).append('\n');
+ buffer.append(" .vert = ").append(isVert ()).append('\n');
+ buffer.append(" .containsDataTable = ").append(isContainsDataTable ()).append('\n');
+
+ buffer.append("[/Legend]\n");
+ return buffer.toString();
+ }
+
+ public int serialize(int offset, byte[] data)
+ {
+ LittleEndian.putShort(data, 0 + offset, sid);
+ LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
+
+ LittleEndian.putInt(data, 4 + offset, field_1_xPosition);
+ LittleEndian.putInt(data, 8 + offset, field_2_yPosition);
+ LittleEndian.putInt(data, 12 + offset, field_3_xSize);
+ LittleEndian.putInt(data, 16 + offset, field_4_ySize);
+ data[ 20 + offset ] = field_5_type;
+ data[ 21 + offset ] = field_6_spacing;
+ LittleEndian.putShort(data, 22 + offset, field_7_options);
+
+ return getRecordSize();
+ }
+
+ /**
+ * Size of record (exluding 4 byte header)
+ */
+ public int getRecordSize()
+ {
+ return 4 + 4 + 4 + 4 + 4 + 1 + 1 + 2;
+ }
+
+ public short getSid()
+ {
+ return this.sid;
+ }
+
+
+ /**
+ * Get the x position field for the Legend record.
+ */
+ public int getXPosition()
+ {
+ return field_1_xPosition;
+ }
+
+ /**
+ * Set the x position field for the Legend record.
+ */
+ public void setXPosition(int field_1_xPosition)
+ {
+ this.field_1_xPosition = field_1_xPosition;
+ }
+
+ /**
+ * Get the y position field for the Legend record.
+ */
+ public int getYPosition()
+ {
+ return field_2_yPosition;
+ }
+
+ /**
+ * Set the y position field for the Legend record.
+ */
+ public void setYPosition(int field_2_yPosition)
+ {
+ this.field_2_yPosition = field_2_yPosition;
+ }
+
+ /**
+ * Get the x size field for the Legend record.
+ */
+ public int getXSize()
+ {
+ return field_3_xSize;
+ }
+
+ /**
+ * Set the x size field for the Legend record.
+ */
+ public void setXSize(int field_3_xSize)
+ {
+ this.field_3_xSize = field_3_xSize;
+ }
+
+ /**
+ * Get the y size field for the Legend record.
+ */
+ public int getYSize()
+ {
+ return field_4_ySize;
+ }
+
+ /**
+ * Set the y size field for the Legend record.
+ */
+ public void setYSize(int field_4_ySize)
+ {
+ this.field_4_ySize = field_4_ySize;
+ }
+
+ /**
+ * Get the type field for the Legend record.
+ *
+ * @return One of
+ * TYPE_BOTTOM
+ * TYPE_CORNER
+ * TYPE_TOP
+ * TYPE_RIGHT
+ * TYPE_LEFT
+ * TYPE_NOT_DOCKED
+ */
+ public byte getType()
+ {
+ return field_5_type;
+ }
+
+ /**
+ * Set the type field for the Legend record.
+ *
+ * @param field_5_type
+ * One of
+ * TYPE_BOTTOM
+ * TYPE_CORNER
+ * TYPE_TOP
+ * TYPE_RIGHT
+ * TYPE_LEFT
+ * TYPE_NOT_DOCKED
+ */
+ public void setType(byte field_5_type)
+ {
+ this.field_5_type = field_5_type;
+ }
+
+ /**
+ * Get the spacing field for the Legend record.
+ *
+ * @return One of
+ * SPACING_CLOSE
+ * SPACING_MEDIUM
+ * SPACING_OPEN
+ */
+ public byte getSpacing()
+ {
+ return field_6_spacing;
+ }
+
+ /**
+ * Set the spacing field for the Legend record.
+ *
+ * @param field_6_spacing
+ * One of
+ * SPACING_CLOSE
+ * SPACING_MEDIUM
+ * SPACING_OPEN
+ */
+ public void setSpacing(byte field_6_spacing)
+ {
+ this.field_6_spacing = field_6_spacing;
+ }
+
+ /**
+ * Get the options field for the Legend record.
+ */
+ public short getOptions()
+ {
+ return field_7_options;
+ }
+
+ /**
+ * Set the options field for the Legend record.
+ */
+ public void setOptions(short field_7_options)
+ {
+ this.field_7_options = field_7_options;
+ }
+
+ /**
+ * Sets the auto position field value.
+ * set to true if legend is docked
+ */
+ public void setAutoPosition(boolean value)
+ {
+ field_7_options = autoPosition.setShortBoolean(field_7_options, value);
+ }
+
+ /**
+ * set to true if legend is docked
+ * @return the auto position field value.
+ */
+ public boolean isAutoPosition()
+ {
+ return autoPosition.isSet(field_7_options);
+ }
+
+ /**
+ * Sets the auto series field value.
+ * automatic series distribution
+ */
+ public void setAutoSeries(boolean value)
+ {
+ field_7_options = autoSeries.setShortBoolean(field_7_options, value);
+ }
+
+ /**
+ * automatic series distribution
+ * @return the auto series field value.
+ */
+ public boolean isAutoSeries()
+ {
+ return autoSeries.isSet(field_7_options);
+ }
+
+ /**
+ * Sets the auto pos x field value.
+ * x positioning is done automatically
+ */
+ public void setAutoPosX(boolean value)
+ {
+ field_7_options = autoPosX.setShortBoolean(field_7_options, value);
+ }
+
+ /**
+ * x positioning is done automatically
+ * @return the auto pos x field value.
+ */
+ public boolean isAutoPosX()
+ {
+ return autoPosX.isSet(field_7_options);
+ }
+
+ /**
+ * Sets the auto pos y field value.
+ * y positioning is done automatically
+ */
+ public void setAutoPosY(boolean value)
+ {
+ field_7_options = autoPosY.setShortBoolean(field_7_options, value);
+ }
+
+ /**
+ * y positioning is done automatically
+ * @return the auto pos y field value.
+ */
+ public boolean isAutoPosY()
+ {
+ return autoPosY.isSet(field_7_options);
+ }
+
+ /**
+ * Sets the vert field value.
+ * if true legend is vertical (otherwise it's horizonal)
+ */
+ public void setVert(boolean value)
+ {
+ field_7_options = vert.setShortBoolean(field_7_options, value);
+ }
+
+ /**
+ * if true legend is vertical (otherwise it's horizonal)
+ * @return the vert field value.
+ */
+ public boolean isVert()
+ {
+ return vert.isSet(field_7_options);
+ }
+
+ /**
+ * Sets the contains data table field value.
+ * true if the chart contains the data table
+ */
+ public void setContainsDataTable(boolean value)
+ {
+ field_7_options = containsDataTable.setShortBoolean(field_7_options, value);
+ }
+
+ /**
+ * true if the chart contains the data table
+ * @return the contains data table field value.
+ */
+ public boolean isContainsDataTable()
+ {
+ return containsDataTable.isSet(field_7_options);
+ }
+
+
+} // END OF CLASS
+
+
+
+
diff --git a/src/java/org/apache/poi/hssf/record/ProtectRecord.java b/src/java/org/apache/poi/hssf/record/ProtectRecord.java
index d40f4bfcb4..f352395034 100644
--- a/src/java/org/apache/poi/hssf/record/ProtectRecord.java
+++ b/src/java/org/apache/poi/hssf/record/ProtectRecord.java
@@ -80,9 +80,9 @@ public class ProtectRecord
/**
* Constructs a Protect record and sets its fields appropriately.
*
- * @param short id must be 0x12 or an exception will be throw upon validation
- * @param short size the size of the data area of the record
- * @param byte[] data of the record (should not contain sid/len)
+ * @param id id must be 0x12 or an exception will be throw upon validation
+ * @param size size the size of the data area of the record
+ * @param data data of the record (should not contain sid/len)
*/
public ProtectRecord(short id, short size, byte [] data)
@@ -93,9 +93,9 @@ public class ProtectRecord
/**
* Constructs a Protect record and sets its fields appropriately.
*
- * @param short id must be 0x12 or an exception will be throw upon validation
- * @param short size the size of the data area of the record
- * @param byte[] data of the record (should not contain sid/len)
+ * @param id id must be 0x12 or an exception will be throw upon validation
+ * @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 data
*/
@@ -119,7 +119,7 @@ public class ProtectRecord
/**
* set whether the sheet is protected or not
- * @param whether to protect the sheet or not
+ * @param protect whether to protect the sheet or not
*/
public void setProtect(boolean protect)
diff --git a/src/java/org/apache/poi/hssf/record/SeriesRecord.java b/src/java/org/apache/poi/hssf/record/SeriesRecord.java
index 3861b28618..6225b0e312 100644
--- a/src/java/org/apache/poi/hssf/record/SeriesRecord.java
+++ b/src/java/org/apache/poi/hssf/record/SeriesRecord.java
@@ -53,42 +53,59 @@
* <http://www.apache.org/>.
*/
+
package org.apache.poi.hssf.record;
+
+
+import org.apache.poi.util.BitField;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.StringUtil;
+import org.apache.poi.util.HexDump;
/**
- * The series record defines the (graphing) series within a chart.
- * This record is matched with a corresponding EndRecord.
- *
+ * The series record describes the overall data for a series.
+ * NOTE: This source is automatically generated please do not modify this file. Either subclass or
+ * remove the record in src/records/definitions.
+
* @author Glen Stampoultzis (gstamp at iprimus dot com dot au)
*/
-
public class SeriesRecord
extends Record
{
- public static final short sid = 0x1003;
- public static final short AXIS_TYPE_DATE = 0;
- public static final short AXIS_TYPE_NUMERIC = 1;
- public static final short AXIS_TYPE_SEQUENCE = 3;
- public static final short AXIS_TYPE_TEXT = 4;
- private short field_1_xAxisType;
- private short field_2_yAxisType;
- private short field_3_countOfXValues;
- private short field_4_countOfYValues;
- private short field_5_bubbleType; // type of data in "bubble size series"
- private short field_6_countOfBubbleSeries; // count of bubble series values
+ public final static short sid = 0x1003;
+ private short field_1_categoryDataType;
+ public final static short CATEGORY_DATA_TYPE_DATES = 0;
+ public final static short CATEGORY_DATA_TYPE_NUMERIC = 1;
+ public final static short CATEGORY_DATA_TYPE_SEQUENCE = 2;
+ public final static short CATEGORY_DATA_TYPE_TEXT = 3;
+ private short field_2_valuesDataType;
+ public final static short VALUES_DATA_TYPE_DATES = 0;
+ public final static short VALUES_DATA_TYPE_NUMERIC = 1;
+ public final static short VALUES_DATA_TYPE_SEQUENCE = 2;
+ public final static short VALUES_DATA_TYPE_TEXT = 3;
+ private short field_3_numCategories;
+ private short field_4_numValues;
+ private short field_5_bubbleSeriesType;
+ public final static short BUBBLE_SERIES_TYPE_DATES = 0;
+ public final static short BUBBLE_SERIES_TYPE_NUMERIC = 1;
+ public final static short BUBBLE_SERIES_TYPE_SEQUENCE = 2;
+ public final static short BUBBLE_SERIES_TYPE_TEXT = 3;
+ private short field_6_numBubbleValues;
+
public SeriesRecord()
{
+
}
/**
- * Constructs a SeriesRecord record and sets its fields appropriately.
+ * Constructs a Series record and sets its fields appropriately.
*
- * @param short id must be 0x1003 or an exception will be throw upon validation
- * @param short size the size of the data area of the record
- * @param byte[] data of the record (should not contain sid/len)
+ * @param id id must be 0x1003 or an exception
+ * will be throw upon validation
+ * @param size size the size of the data area of the record
+ * @param data data of the record (should not contain sid/len)
*/
public SeriesRecord(short id, short size, byte [] data)
@@ -97,11 +114,12 @@ public class SeriesRecord
}
/**
- * Constructs a SeriesRecord record and sets its fields appropriately.
+ * Constructs a Series record and sets its fields appropriately.
*
- * @param short id must be 0x1003 or an exception will be throw upon validation
- * @param short size the size of the data area of the record
- * @param byte[] data of the record (should not contain sid/len)
+ * @param id id must be 0x1003 or an exception
+ * will be throw upon validation
+ * @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
*/
@@ -110,57 +128,91 @@ public class SeriesRecord
super(id, size, data, offset);
}
+ /**
+ * Checks the sid matches the expected side for this record
+ *
+ * @param id the expected sid.
+ */
protected void validateSid(short id)
{
if (id != sid)
{
- throw new RecordFormatException("NOT A SERIES RECORD");
+ throw new RecordFormatException("Not a Series record");
}
}
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_xAxisType = LittleEndian.getShort(data, 0 + offset);
- field_2_yAxisType = LittleEndian.getShort(data, 2 + offset);
- field_3_countOfXValues = LittleEndian.getShort(data, 4 + offset);
- field_4_countOfYValues = LittleEndian.getShort(data, 6 + offset);
- field_5_bubbleType = LittleEndian.getShort(data, 8 + offset);
- field_6_countOfBubbleSeries = LittleEndian.getShort(data,
- 10 + offset);
+ field_1_categoryDataType = LittleEndian.getShort(data, 0 + offset);
+ field_2_valuesDataType = LittleEndian.getShort(data, 2 + offset);
+ field_3_numCategories = LittleEndian.getShort(data, 4 + offset);
+ field_4_numValues = LittleEndian.getShort(data, 6 + offset);
+ field_5_bubbleSeriesType = LittleEndian.getShort(data, 8 + offset);
+ field_6_numBubbleValues = LittleEndian.getShort(data, 10 + offset);
+
}
public String toString()
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[SERIES]\n");
- buffer.append(" .xAxisType = ")
- .append(Integer.toHexString(getXAxisType())).append("\n");
- buffer.append(" .yAxisType = ")
- .append(Integer.toHexString(getYAxisType())).append("\n");
- buffer.append(" .countOfXValues = ").append(getCountOfXValues())
- .append("\n");
- buffer.append(" .countOfYValues = ").append(getCountOfYValues())
- .append("\n");
- buffer.append("[/SERIES]\n");
+ buffer.append("[Series]\n");
+
+ buffer.append(" .categoryDataType = ")
+ .append("0x")
+ .append(HexDump.toHex((short)getCategoryDataType()))
+ .append(" (").append(getCategoryDataType()).append(" )\n");
+
+ buffer.append(" .valuesDataType = ")
+ .append("0x")
+ .append(HexDump.toHex((short)getValuesDataType()))
+ .append(" (").append(getValuesDataType()).append(" )\n");
+
+ buffer.append(" .numCategories = ")
+ .append("0x")
+ .append(HexDump.toHex((short)getNumCategories()))
+ .append(" (").append(getNumCategories()).append(" )\n");
+
+ buffer.append(" .numValues = ")
+ .append("0x")
+ .append(HexDump.toHex((short)getNumValues()))
+ .append(" (").append(getNumValues()).append(" )\n");
+
+ buffer.append(" .bubbleSeriesType = ")
+ .append("0x")
+ .append(HexDump.toHex((short)getBubbleSeriesType()))
+ .append(" (").append(getBubbleSeriesType()).append(" )\n");
+
+ buffer.append(" .numBubbleValues = ")
+ .append("0x")
+ .append(HexDump.toHex((short)getNumBubbleValues()))
+ .append(" (").append(getNumBubbleValues()).append(" )\n");
+
+ buffer.append("[/Series]\n");
return buffer.toString();
}
- public int serialize(int offset, byte [] data)
+ public int serialize(int offset, byte[] data)
{
LittleEndian.putShort(data, 0 + offset, sid);
- LittleEndian.putShort(data, 2 + offset,
- (( short ) 12)); // 12 byte length
- LittleEndian.putShort(data, 4 + offset, getXAxisType());
- LittleEndian.putShort(data, 6 + offset, getYAxisType());
- LittleEndian.putShort(data, 8 + offset, getCountOfXValues());
- LittleEndian.putShort(data, 10 + offset, getCountOfYValues());
+ LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
+
+ LittleEndian.putShort(data, 4 + offset, field_1_categoryDataType);
+ LittleEndian.putShort(data, 6 + offset, field_2_valuesDataType);
+ LittleEndian.putShort(data, 8 + offset, field_3_numCategories);
+ LittleEndian.putShort(data, 10 + offset, field_4_numValues);
+ LittleEndian.putShort(data, 12 + offset, field_5_bubbleSeriesType);
+ LittleEndian.putShort(data, 14 + offset, field_6_numBubbleValues);
+
return getRecordSize();
}
+ /**
+ * Size of record (exluding 4 byte header)
+ */
public int getRecordSize()
{
- return 12;
+ return 4 + 2 + 2 + 2 + 2 + 2 + 2;
}
public short getSid()
@@ -168,75 +220,145 @@ public class SeriesRecord
return this.sid;
}
+
/**
- * @return one of AXIS_TYPE_XXX
+ * Get the category data type field for the Series record.
+ *
+ * @return One of
+ * CATEGORY_DATA_TYPE_DATES
+ * CATEGORY_DATA_TYPE_NUMERIC
+ * CATEGORY_DATA_TYPE_SEQUENCE
+ * CATEGORY_DATA_TYPE_TEXT
*/
-
- public short getXAxisType()
+ public short getCategoryDataType()
{
- return field_1_xAxisType;
+ return field_1_categoryDataType;
}
/**
- * @param xAxisType one of AXIS_TYPE_XXX
+ * Set the category data type field for the Series record.
+ *
+ * @param field_1_categoryDataType
+ * One of
+ * CATEGORY_DATA_TYPE_DATES
+ * CATEGORY_DATA_TYPE_NUMERIC
+ * CATEGORY_DATA_TYPE_SEQUENCE
+ * CATEGORY_DATA_TYPE_TEXT
*/
-
- public void setXAxisType(short xAxisType)
+ public void setCategoryDataType(short field_1_categoryDataType)
{
- this.field_1_xAxisType = xAxisType;
+ this.field_1_categoryDataType = field_1_categoryDataType;
}
/**
- * @return one of AXIS_TYPE_XXX
+ * Get the values data type field for the Series record.
+ *
+ * @return One of
+ * VALUES_DATA_TYPE_DATES
+ * VALUES_DATA_TYPE_NUMERIC
+ * VALUES_DATA_TYPE_SEQUENCE
+ * VALUES_DATA_TYPE_TEXT
*/
-
- public short getYAxisType()
+ public short getValuesDataType()
{
- return field_2_yAxisType;
+ return field_2_valuesDataType;
}
/**
- * @param xAxisType one of AXIS_TYPE_XXX
+ * Set the values data type field for the Series record.
+ *
+ * @param field_2_valuesDataType
+ * One of
+ * VALUES_DATA_TYPE_DATES
+ * VALUES_DATA_TYPE_NUMERIC
+ * VALUES_DATA_TYPE_SEQUENCE
+ * VALUES_DATA_TYPE_TEXT
*/
-
- public void setYAxisType(short yAxisType)
+ public void setValuesDataType(short field_2_valuesDataType)
{
- this.field_2_yAxisType = yAxisType;
+ this.field_2_valuesDataType = field_2_valuesDataType;
}
/**
- * @return number of x values in the series.
+ * Get the num categories field for the Series record.
*/
+ public short getNumCategories()
+ {
+ return field_3_numCategories;
+ }
- public short getCountOfXValues()
+ /**
+ * Set the num categories field for the Series record.
+ */
+ public void setNumCategories(short field_3_numCategories)
{
- return field_3_countOfXValues;
+ this.field_3_numCategories = field_3_numCategories;
}
/**
- * Sets the number of x values in the series.
+ * Get the num values field for the Series record.
*/
+ public short getNumValues()
+ {
+ return field_4_numValues;
+ }
- public void setCountOfXValues(short countOfXValues)
+ /**
+ * Set the num values field for the Series record.
+ */
+ public void setNumValues(short field_4_numValues)
{
- this.field_3_countOfXValues = countOfXValues;
+ this.field_4_numValues = field_4_numValues;
}
/**
- * @return number of y values in the series.
+ * Get the bubble series type field for the Series record.
+ *
+ * @return One of
+ * BUBBLE_SERIES_TYPE_DATES
+ * BUBBLE_SERIES_TYPE_NUMERIC
+ * BUBBLE_SERIES_TYPE_SEQUENCE
+ * BUBBLE_SERIES_TYPE_TEXT
*/
+ public short getBubbleSeriesType()
+ {
+ return field_5_bubbleSeriesType;
+ }
- public short getCountOfYValues()
+ /**
+ * Set the bubble series type field for the Series record.
+ *
+ * @param field_5_bubbleSeriesType
+ * One of
+ * BUBBLE_SERIES_TYPE_DATES
+ * BUBBLE_SERIES_TYPE_NUMERIC
+ * BUBBLE_SERIES_TYPE_SEQUENCE
+ * BUBBLE_SERIES_TYPE_TEXT
+ */
+ public void setBubbleSeriesType(short field_5_bubbleSeriesType)
{
- return field_4_countOfYValues;
+ this.field_5_bubbleSeriesType = field_5_bubbleSeriesType;
}
/**
- * @param countOfYValues sets the number of y values for the series.
+ * Get the num bubble values field for the Series record.
*/
+ public short getNumBubbleValues()
+ {
+ return field_6_numBubbleValues;
+ }
- public void setCountOfYValues(short countOfYValues)
+ /**
+ * Set the num bubble values field for the Series record.
+ */
+ public void setNumBubbleValues(short field_6_numBubbleValues)
{
- this.field_4_countOfYValues = countOfYValues;
+ this.field_6_numBubbleValues = field_6_numBubbleValues;
}
-}
+
+
+} // END OF CLASS
+
+
+
+
diff --git a/src/java/org/apache/poi/hssf/util/RecordGenerator.java b/src/java/org/apache/poi/hssf/util/RecordGenerator.java
new file mode 100644
index 0000000000..406dde9c01
--- /dev/null
+++ b/src/java/org/apache/poi/hssf/util/RecordGenerator.java
@@ -0,0 +1,133 @@
+/* ====================================================================
+ * 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/>.
+ */
+
+package org.apache.poi.hssf.util;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Node;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import java.io.File;
+
+public class RecordGenerator
+{
+ public static void main(String[] args)
+ throws Exception
+ {
+ if (args.length != 4)
+ {
+ System.out.println("Usage:");
+ System.out.println(" java org.apache.poi.hssf.util.RecordGenerator RECORD_DEFINTIONS RECORD_STYLES DEST_SRC_PATH TEST_SRC_PATH");
+ }
+ else
+ {
+ generateRecords(args[0], args[1], args[2], args[3]);
+ }
+ }
+
+ private static void generateRecords(String defintionsDir, String recordStyleDir, String destSrcPathDir, String testSrcPathDir)
+ throws Exception
+ {
+ File definitionsFile = new File(defintionsDir);
+
+ for (int i = 0; i < definitionsFile.listFiles().length; i++)
+ {
+ File file = definitionsFile.listFiles()[i];
+ if (file.isFile() && file.getName().endsWith("_record.xml"))
+ {
+ // Get record name and package
+ DocumentBuilderFactory factory =
+ DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document document = builder.parse(file);
+ Element record = document.getDocumentElement();
+ String recordName = record.getAttributes().getNamedItem("name").getNodeValue();
+ String packageName = record.getAttributes().getNamedItem("package").getNodeValue();
+ packageName = packageName.replace('.','/');
+
+ // Generate record
+ String destinationPath = destSrcPathDir + "/" + packageName ;
+ File destinationPathFile = new File(destinationPath);
+ destinationPathFile.mkdirs();
+ String destinationFilepath = destinationPath + "/" + recordName + "Record.java";
+ String args[] = new String [] { "-in", file.getAbsolutePath(), "-xsl", recordStyleDir + "/record.xsl",
+ "-out", destinationFilepath,
+ "-TEXT"};
+ org.apache.xalan.xslt.Process.main( args );
+ System.out.println("Generated record: " + destinationFilepath);
+
+ // Generate test (if not already generated)
+ destinationPath = testSrcPathDir + "/" + packageName ;
+ destinationPathFile = new File(destinationPath);
+ destinationPathFile.mkdirs();
+ destinationFilepath = destinationPath + "/Test" + recordName + "Record.java";
+ if (new File(destinationFilepath).exists() == false)
+ {
+ args = new String [] { "-in", file.getAbsolutePath(), "-xsl", recordStyleDir + "/record_test.xsl",
+ "-out", destinationFilepath,
+ "-TEXT"};
+ org.apache.xalan.xslt.Process.main( args );
+ System.out.println("Generated test: " + destinationFilepath);
+ }
+ else
+ {
+ System.out.println("Skipped test generation: " + destinationFilepath);
+ }
+ }
+ }
+ }
+}
diff --git a/src/java/org/apache/poi/util/HexDump.java b/src/java/org/apache/poi/util/HexDump.java
index d2d54e819f..4eac10f379 100644
--- a/src/java/org/apache/poi/util/HexDump.java
+++ b/src/java/org/apache/poi/util/HexDump.java
@@ -59,9 +59,10 @@ import java.io.*;
/**
* dump data in hexadecimal format; derived from a HexDump utility I
- * wrote in June 2001
+ * wrote in June 2001.
*
* @author Marc Johnson
+ * @author Glen Stampoultzis (glens at apache.org)
*/
public class HexDump
@@ -89,7 +90,7 @@ public class HexDump
* null
*/
- public static void dump(final byte [] data, final long offset,
+ public synchronized static void dump(final byte [] data, final long offset,
final OutputStream stream, final int index)
throws IOException, ArrayIndexOutOfBoundsException,
IllegalArgumentException
@@ -181,4 +182,48 @@ public class HexDump
}
return _cbuffer;
}
+
+ /**
+ * Converts the parameter to a hex value.
+ *
+ * @param value The value to convert
+ * @return The result right padded with 0
+ */
+ public static String toHex(final short value)
+ {
+ return toHex(value, 4);
+ }
+
+ /**
+ * Converts the parameter to a hex value.
+ *
+ * @param value The value to convert
+ * @return The result right padded with 0
+ */
+ public static String toHex(final byte value)
+ {
+ return toHex(value, 2);
+ }
+
+ /**
+ * Converts the parameter to a hex value.
+ *
+ * @param value The value to convert
+ * @return The result right padded with 0
+ */
+ public static String toHex(final int value)
+ {
+ return toHex(value, 8);
+ }
+
+
+ private static String toHex(final long value, final int digits)
+ {
+ StringBuffer result = new StringBuffer(digits);
+ for (int j = 0; j < digits; j++)
+ {
+ result.append( _hexcodes[ (int) ((value >> _shifts[ j + (8 - digits) ]) & 15)]);
+ }
+ return result.toString();
+ }
}