*@param workbook The workbook that is being worked with.
*@param align the column alignment to use.
*@exception NestableException Thrown if an error happens.
+ *
+ * @see HSSFCellStyle for alignment options
*/
public static void setAlignment( HSSFCell cell, HSSFWorkbook workbook, short align ) throws NestableException
{
*@param cell The cell that needs it's style changes
*@exception NestableException Thrown if an error happens.
*/
-
public static void setCellStyleProperty( HSSFCell cell, HSSFWorkbook workbook, String propertyName, Object propertyValue )
throws NestableException
{
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "../dtd/document-v11.dtd">
+<!-- <!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "../dtd/document-v11.dtd"> -->
<document>
<header>
</p>
<p>
A utility was needed to take the defintition of what a
- record looked like and do all the boring stuff. Thus the
- record generator was born.
+ record looked like and do all the boring and repetitive work.
</p>
</section>
<section title="Capabilities">
<p>
- The record generator takes XML as input and produced the following
+ The record generator takes XML as input and produces the following
output:
<ul>
<li>A Java file capabile of decoding and encoding the record.</li>
- <li>A test class with provides a fill-in-the-blanks implementation of a test case
- for ensuring the record operates as designed.</li>
+ <li>A test class that provides a fill-in-the-blanks implementation
+ of a test case for ensuring the record operates as
+ designed.</li>
</ul>
</p>
</section>
<section title="Usage">
<p>
- The record generator is invoked as an Ant target (generate-records). It goes
- through looking for all files in src/records/defintitions ending with _record.xml.
- It then creates two files; the Java record definition and the Java test case template.
+ The record generator is invoked as an Ant target
+ (generate-records). It goes through looking for all files in
+ <code>src/records/defintitions</code> ending with _record.xml.
+ It then creates two files; the Java record definition and the
+ Java test case template.
</p>
<p>
The records themselves have the following general layout:
</p>
<source><![CDATA[
-<record id="0x1032" name="Frame" package="org.apache.poi.hssf.record">
- <description>The frame record indicates whether there is a border
+<record id="0x1032" name="Frame" package="org.apache.poi.hssf.record"
+ excel-record-id="FRAME">
+ <description>The frame record indicates whether there is a border
around the displayed text of a chart.</description>
<author>Glen Stampoultzis (glens at apache.org)</author>
<fields>
<const name="shadow" value="1" description="rectangle with shadow"/>
</field>
<field type="int" size="2" name="options">
- <bit number="0" name="auto size"
+ <bit number="0" name="auto size"
description="excel calculates the size automatically if true"/>
- <bit number="1" name="auto position"
+ <bit number="1" name="auto position"
description="excel calculates the position automatically"/>
</field>
</fields>
</record>
]]></source>
<p>
- Currently the type can be of type int, float or string. The 'int'
- type covers bytes, shorts and integers which is selected using a
- size of 1, 2 or 4. An additional type called varword is used to
- represent a array of word values where the first short is the length
- of the array. The string type generation is only partially
- implemented. If choosing string you must select a size of 'var'.
+ The following table details the allowable types and sizes for
+ the fields.
</p>
+ <table>
+ <tr>
+ <th>Type</th>
+ <th>Size</th>
+ <th>Java Type</th>
+ </tr>
+ <tr>
+ <td>int</td>
+ <td>1</td>
+ <td>byte</td>
+ </tr>
+ <tr>
+ <td>int</td>
+ <td>2</td>
+ <td>short</td>
+ </tr>
+ <tr>
+ <td>int</td>
+ <td>4</td>
+ <td>int</td>
+ </tr>
+ <tr>
+ <td>int</td>
+ <td>8</td>
+ <td>long</td>
+ </tr>
+ <tr>
+ <td>int</td>
+ <td>varword</td>
+ <td>array of shorts</td>
+ </tr>
+ <tr>
+ <td>bits</td>
+ <td>1</td>
+ <td>A byte comprising of a bits (defined by the bit element)
+ </td>
+ </tr>
+ <tr>
+ <td>bits</td>
+ <td>2</td>
+ <td>An short comprising of a bits</td>
+ </tr>
+ <tr>
+ <td>bits</td>
+ <td>4</td>
+ <td>A int comprising of a bits</td>
+ </tr>
+ <tr>
+ <td>float</td>
+ <td>8</td>
+ <td>double</td>
+ </tr>
+ <tr>
+ <td>hbstring</td>
+ <td>java expression</td>
+ <td>String</td>
+ </tr>
+ </table>
<p>
The Java records are regenerated each time the record generator is
run, however the test stubs are only created if the test stub does
stubs but not the generated records.
</p>
</section>
+ <section title="Custom Field Types">
+ <p>
+ Occationally the builtin types are not enough. More control
+ over the encoding and decoding of the streams is required. This
+ can be achieved using a custom type.
+ </p>
+ <p>
+ A custom type lets you escape to java to define the way in which
+ the field encodes and decodes. To code a custom type you
+ declare your field like this:
+ </p>
+ <source><![CDATA[
+ <field type="custom:org.apache.poi.hssf.record.LinkedDataFormulaField"
+ size="var" name="formula of link" description="formula"/>
+ ]]></source>
+ <p>
+ Where the class name specified after <code>custom:</code> is a
+ class implementing the interface <code>CustomField</code>.
+ </p>
+ <p>
+ You can then implement the encoding yourself.
+ </p>
+ </section>
<section title="How it Works">
<p>
The record generation works by taking an XML file and styling it
See record.xsl, record_test.xsl, FieldIterator.java,
RecordUtil.java, RecordGenerator.java
</p>
- </section>
- <section title="Limitations">
<p>
- The record generator does not handle all possible record types and
- is not ment to. Sometimes it's going to make more sense to generate
- the records manually. The main point of this thing is to make the
- easy stuff simple.
+ There is a corresponding "type" generator for HDF.
+ See the HDF documentation for details.
</p>
+ </section>
+ <section title="Limitations">
<p>
- Currently the record generator is optimized to create Excel records.
- It could be adapted to create Word records with a little poking
- around.
+ The record generator does not handle all possible record types and
+ goes not intend to perform this function. When dealing with a
+ non-standard record sometimes the cost-benifit of coding the
+ record by hand will be greater than attempting modify the
+ generator. The main point of the record generator is to save
+ time, so keep that in mind.
</p>
<p>
Currently the the XSL file that generates the record calls out to
- Java objects. This would have been better done as Javascript inside
- the XSL file itself. The Java code for the record generation is
+ Java objects. The Java code for the record generation is
currently quite messy with minimal comments.
</p>
</section>
package org.apache.poi.hssf.model;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Stack;
-
-import java.io.FileOutputStream;
-import java.io.File;
-
-import org.apache.poi.hssf.util.SheetReferences;
import org.apache.poi.hssf.record.formula.*;
+import org.apache.poi.hssf.util.SheetReferences;
+
+import java.util.ArrayList;
+import java.util.List;
/**
private static char TAB = '\t';
private static char CR = '\n';
- private char Look; // Lookahead Character
+ private char look; // Lookahead Character
private Workbook book;
formulaString = formula;
pointer=0;
this.book = book;
- formulaLength = formulaString.length();
+ formulaLength = formulaString.length();
}
// Just return if so and reset Look to smoething to keep
// SkipWhitespace from spinning
if (pointer == formulaLength) {
- Look = (char)0;
+ look = (char)0;
return;
}
- Look=formulaString.charAt(pointer++);
+ look=formulaString.charAt(pointer++);
//System.out.println("Got char: "+Look);
}
/** Skip Over Leading White Space */
private void SkipWhite() {
- while (IsWhite(Look)) {
+ while (IsWhite(look)) {
GetChar();
}
}
/** Match a Specific Input Character */
private void Match(char x) {
- if (Look != x) {
+ if (look != x) {
Expected("" + x + "");
}else {
GetChar();
/** Get an Identifier */
private String GetName() {
StringBuffer Token = new StringBuffer();
- if (!IsAlpha(Look)) {
+ if (!IsAlpha(look)) {
Expected("Name");
}
- while (IsAlNum(Look)) {
- Token = Token.append(Character.toUpperCase(Look));
+ while (IsAlNum(look)) {
+ Token = Token.append(Character.toUpperCase(look));
GetChar();
}
SkipWhite();
converting to uppercase; used for literals */
private String GetNameAsIs() {
StringBuffer Token = new StringBuffer();
- if (!IsAlpha(Look)) {
+ if (!IsAlpha(look)) {
Expected("Name");
}
- while (IsAlNum(Look) || IsWhite(Look)) {
- Token = Token.append(Look);
+ while (IsAlNum(look) || IsWhite(look)) {
+ Token = Token.append(look);
GetChar();
}
return Token.toString();
/** Get a Number */
private String GetNum() {
String Value ="";
- if (!IsDigit(Look)) Expected("Integer");
- while (IsDigit(Look)){
- Value = Value + Look;
+ if (!IsDigit(look)) Expected("Integer");
+ while (IsDigit(look)){
+ Value = Value + look;
GetChar();
}
SkipWhite();
private void Ident() {
String name;
name = GetName();
- if (Look == '('){
+ if (look == '('){
//This is a function
function(name);
- } else if (Look == ':') { // this is a AreaReference
+ } else if (look == ':') { // this is a AreaReference
String first = name;
Match(':');
String second = GetName();
tokens.add(new AreaPtg(first+":"+second));
- } else if (Look == '!') {
+ } else if (look == '!') {
Match('!');
String sheetName = name;
String first = GetName();
short externIdx = book.checkExternSheet(book.getSheetIndex(sheetName));
- if (Look == ':') {
+ if (look == ':') {
Match(':');
String second=GetName();
/** get arguments to a function */
private int Arguments() {
int numArgs = 0;
- if (Look != ')') {
+ if (look != ')') {
numArgs++;
Expression();
}
- while (Look == ',' || Look == ';') { //TODO handle EmptyArgs
- if(Look == ',') {
+ while (look == ',' || look == ';') { //TODO handle EmptyArgs
+ if(look == ',') {
Match(',');
}
else {
/** Parse and Translate a Math Factor */
private void Factor() {
- if (Look == '(' ) {
+ if (look == '(' ) {
Match('(');
Expression();
Match(')');
tokens.add(new ParenthesisPtg());
return;
- } else if (IsAlpha(Look)){
+ } else if (IsAlpha(look)){
Ident();
- } else if(Look == '"') {
+ } else if(look == '"') {
StringLiteral();
} else {
String number = GetNum();
- if (Look=='.') {
+ if (look=='.') {
Match('.');
String decimalPart = null;
- if (IsDigit(Look)) number = number +"."+ GetNum(); //this also takes care of someone entering "1234."
+ if (IsDigit(look)) number = number +"."+ GetNum(); //this also takes care of someone entering "1234."
tokens.add(new NumberPtg(number));
} else {
tokens.add(new IntPtg(number)); //TODO:what if the number is too big to be a short? ..add factory to return Int or Number!
/** Parse and Translate a Math Term */
private void Term(){
Factor();
- while (Look == '*' || Look == '/' || Look == '^' || Look == '&' || Look == '=' ) {
+ while (look == '*' || look == '/' || look == '^' || look == '&' || look == '=' ) {
///TODO do we need to do anything here??
- if (Look == '*') Multiply();
- if (Look == '/') Divide();
- if (Look == '^') Power();
- if (Look == '&') Concat();
- if (Look == '=') Equal();
+ if (look == '*') Multiply();
+ if (look == '/') Divide();
+ if (look == '^') Power();
+ if (look == '&') Concat();
+ if (look == '=') Equal();
}
}
/** Parse and Translate an Expression */
private void Expression() {
- if (IsAddop(Look)) {
+ if (IsAddop(look)) {
EmitLn("CLR D0"); //unaryAdd ptg???
} else {
Term();
}
- while (IsAddop(Look)) {
- if ( Look == '+' ) Add();
- if (Look == '-') Subtract();
- if (Look == '*') Multiply();
- if (Look == '/') Divide();
+ while (IsAddop(look)) {
+ if ( look == '+' ) Add();
+ if (look == '-') Subtract();
+ if (look == '*') Multiply();
+ if (look == '/') Divide();
}
}
public AreaFormatRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public AreaFormatRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_foregroundColor = LittleEndian.getInt(data, 0x0 + offset);
- field_2_backgroundColor = LittleEndian.getInt(data, 0x4 + offset);
- field_3_pattern = LittleEndian.getShort(data, 0x8 + offset);
- field_4_formatFlags = LittleEndian.getShort(data, 0xa + offset);
- field_5_forecolorIndex = LittleEndian.getShort(data, 0xc + offset);
- field_6_backcolorIndex = LittleEndian.getShort(data, 0xe + offset);
+
+ int pos = 0;
+ field_1_foregroundColor = LittleEndian.getInt(data, pos + 0x0 + offset);
+ field_2_backgroundColor = LittleEndian.getInt(data, pos + 0x4 + offset);
+ field_3_pattern = LittleEndian.getShort(data, pos + 0x8 + offset);
+ field_4_formatFlags = LittleEndian.getShort(data, pos + 0xa + offset);
+ field_5_forecolorIndex = LittleEndian.getShort(data, pos + 0xc + offset);
+ field_6_backcolorIndex = LittleEndian.getShort(data, pos + 0xe + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[AreaFormat]\n");
-
+ buffer.append("[AREAFORMAT]\n");
buffer.append(" .foregroundColor = ")
- .append("0x")
- .append(HexDump.toHex((int)getForegroundColor()))
- .append(" (").append(getForegroundColor()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getForegroundColor ()))
+ .append(" (").append( getForegroundColor() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .backgroundColor = ")
- .append("0x")
- .append(HexDump.toHex((int)getBackgroundColor()))
- .append(" (").append(getBackgroundColor()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getBackgroundColor ()))
+ .append(" (").append( getBackgroundColor() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .pattern = ")
- .append("0x")
- .append(HexDump.toHex((short)getPattern()))
- .append(" (").append(getPattern()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getPattern ()))
+ .append(" (").append( getPattern() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .formatFlags = ")
- .append("0x")
- .append(HexDump.toHex((short)getFormatFlags()))
- .append(" (").append(getFormatFlags()).append(" )\n");
- buffer.append(" .automatic = ").append(isAutomatic ()).append('\n');
- buffer.append(" .invert = ").append(isInvert ()).append('\n');
-
+ .append("0x").append(HexDump.toHex( getFormatFlags ()))
+ .append(" (").append( getFormatFlags() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
+ buffer.append(" .automatic = ").append(isAutomatic()).append('\n');
+ buffer.append(" .invert = ").append(isInvert()).append('\n');
buffer.append(" .forecolorIndex = ")
- .append("0x")
- .append(HexDump.toHex((short)getForecolorIndex()))
- .append(" (").append(getForecolorIndex()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getForecolorIndex ()))
+ .append(" (").append( getForecolorIndex() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .backcolorIndex = ")
- .append("0x")
- .append(HexDump.toHex((short)getBackcolorIndex()))
- .append(" (").append(getBackcolorIndex()).append(" )\n");
+ .append("0x").append(HexDump.toHex( getBackcolorIndex ()))
+ .append(" (").append( getBackcolorIndex() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
- buffer.append("[/AreaFormat]\n");
+ buffer.append("[/AREAFORMAT]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- LittleEndian.putInt(data, 4 + offset, field_1_foregroundColor);
- LittleEndian.putInt(data, 8 + offset, field_2_backgroundColor);
- LittleEndian.putShort(data, 12 + offset, field_3_pattern);
- LittleEndian.putShort(data, 14 + offset, field_4_formatFlags);
- LittleEndian.putShort(data, 16 + offset, field_5_forecolorIndex);
- LittleEndian.putShort(data, 18 + offset, field_6_backcolorIndex);
+ LittleEndian.putInt(data, 4 + offset + pos, field_1_foregroundColor);
+ LittleEndian.putInt(data, 8 + offset + pos, field_2_backgroundColor);
+ LittleEndian.putShort(data, 12 + offset + pos, field_3_pattern);
+ LittleEndian.putShort(data, 14 + offset + pos, field_4_formatFlags);
+ LittleEndian.putShort(data, 16 + offset + pos, field_5_forecolorIndex);
+ LittleEndian.putShort(data, 18 + offset + pos, field_6_backcolorIndex);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 4 + 4 + 2 + 2 + 2 + 2;
+ return 4 + 4 + 4 + 2 + 2 + 2 + 2;
}
public short getSid()
}
public Object clone() {
- AreaFormatRecord rec = new AreaFormatRecord();
-
- rec.field_1_foregroundColor = field_1_foregroundColor;
- rec.field_2_backgroundColor = field_2_backgroundColor;
- rec.field_3_pattern = field_3_pattern;
- rec.field_4_formatFlags = field_4_formatFlags;
- rec.field_5_forecolorIndex = field_5_forecolorIndex;
- rec.field_6_backcolorIndex = field_6_backcolorIndex;
-
- return rec;
+ AreaFormatRecord rec = new AreaFormatRecord();
+
+ rec.field_1_foregroundColor = field_1_foregroundColor;
+ rec.field_2_backgroundColor = field_2_backgroundColor;
+ rec.field_3_pattern = field_3_pattern;
+ rec.field_4_formatFlags = field_4_formatFlags;
+ rec.field_5_forecolorIndex = field_5_forecolorIndex;
+ rec.field_6_backcolorIndex = field_6_backcolorIndex;
+ return rec;
}
+
+
/**
* Get the foreground color field for the AreaFormat record.
*/
public AreaRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public AreaRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_formatFlags = LittleEndian.getShort(data, 0x0 + offset);
+
+ int pos = 0;
+ field_1_formatFlags = LittleEndian.getShort(data, pos + 0x0 + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[Area]\n");
-
+ 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");
+ .append("0x").append(HexDump.toHex( getFormatFlags ()))
+ .append(" (").append( getFormatFlags() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
+ 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)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- LittleEndian.putShort(data, 4 + offset, field_1_formatFlags);
+ LittleEndian.putShort(data, 4 + offset + pos, field_1_formatFlags);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 2;
+ return 4 + 2;
}
public short getSid()
}
public Object clone() {
- AreaRecord rec = new AreaRecord();
-
- rec.field_1_formatFlags = field_1_formatFlags;
-
- return rec;
+ AreaRecord rec = new AreaRecord();
+
+ rec.field_1_formatFlags = field_1_formatFlags;
+ return rec;
}
+
+
/**
* Get the format flags field for the Area record.
*/
public AxisLineFormatRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public AxisLineFormatRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_axisType = LittleEndian.getShort(data, 0x0 + offset);
+
+ int pos = 0;
+ field_1_axisType = LittleEndian.getShort(data, pos + 0x0 + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[AxisLineFormat]\n");
-
+ buffer.append("[AXISLINEFORMAT]\n");
buffer.append(" .axisType = ")
- .append("0x")
- .append(HexDump.toHex((short)getAxisType()))
- .append(" (").append(getAxisType()).append(" )\n");
+ .append("0x").append(HexDump.toHex( getAxisType ()))
+ .append(" (").append( getAxisType() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
- buffer.append("[/AxisLineFormat]\n");
+ buffer.append("[/AXISLINEFORMAT]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- LittleEndian.putShort(data, 4 + offset, field_1_axisType);
+ LittleEndian.putShort(data, 4 + offset + pos, field_1_axisType);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 2;
+ return 4 + 2;
}
public short getSid()
}
public Object clone() {
- AxisLineFormatRecord rec = new AxisLineFormatRecord();
-
- rec.field_1_axisType = field_1_axisType;
-
- return rec;
+ AxisLineFormatRecord rec = new AxisLineFormatRecord();
+
+ rec.field_1_axisType = field_1_axisType;
+ return rec;
}
+
+
/**
* Get the axis type field for the AxisLineFormat record.
*
public AxisOptionsRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public AxisOptionsRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_minimumCategory = LittleEndian.getShort(data, 0x0 + offset);
- field_2_maximumCategory = LittleEndian.getShort(data, 0x2 + offset);
- field_3_majorUnitValue = LittleEndian.getShort(data, 0x4 + offset);
- field_4_majorUnit = LittleEndian.getShort(data, 0x6 + offset);
- field_5_minorUnitValue = LittleEndian.getShort(data, 0x8 + offset);
- field_6_minorUnit = LittleEndian.getShort(data, 0xa + offset);
- field_7_baseUnit = LittleEndian.getShort(data, 0xc + offset);
- field_8_crossingPoint = LittleEndian.getShort(data, 0xe + offset);
- field_9_options = LittleEndian.getShort(data, 0x10 + offset);
+
+ int pos = 0;
+ field_1_minimumCategory = LittleEndian.getShort(data, pos + 0x0 + offset);
+ field_2_maximumCategory = LittleEndian.getShort(data, pos + 0x2 + offset);
+ field_3_majorUnitValue = LittleEndian.getShort(data, pos + 0x4 + offset);
+ field_4_majorUnit = LittleEndian.getShort(data, pos + 0x6 + offset);
+ field_5_minorUnitValue = LittleEndian.getShort(data, pos + 0x8 + offset);
+ field_6_minorUnit = LittleEndian.getShort(data, pos + 0xa + offset);
+ field_7_baseUnit = LittleEndian.getShort(data, pos + 0xc + offset);
+ field_8_crossingPoint = LittleEndian.getShort(data, pos + 0xe + offset);
+ field_9_options = LittleEndian.getShort(data, pos + 0x10 + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[AxisOptions]\n");
-
+ buffer.append("[AXCEXT]\n");
buffer.append(" .minimumCategory = ")
- .append("0x")
- .append(HexDump.toHex((short)getMinimumCategory()))
- .append(" (").append(getMinimumCategory()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getMinimumCategory ()))
+ .append(" (").append( getMinimumCategory() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .maximumCategory = ")
- .append("0x")
- .append(HexDump.toHex((short)getMaximumCategory()))
- .append(" (").append(getMaximumCategory()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getMaximumCategory ()))
+ .append(" (").append( getMaximumCategory() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .majorUnitValue = ")
- .append("0x")
- .append(HexDump.toHex((short)getMajorUnitValue()))
- .append(" (").append(getMajorUnitValue()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getMajorUnitValue ()))
+ .append(" (").append( getMajorUnitValue() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .majorUnit = ")
- .append("0x")
- .append(HexDump.toHex((short)getMajorUnit()))
- .append(" (").append(getMajorUnit()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getMajorUnit ()))
+ .append(" (").append( getMajorUnit() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .minorUnitValue = ")
- .append("0x")
- .append(HexDump.toHex((short)getMinorUnitValue()))
- .append(" (").append(getMinorUnitValue()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getMinorUnitValue ()))
+ .append(" (").append( getMinorUnitValue() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .minorUnit = ")
- .append("0x")
- .append(HexDump.toHex((short)getMinorUnit()))
- .append(" (").append(getMinorUnit()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getMinorUnit ()))
+ .append(" (").append( getMinorUnit() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .baseUnit = ")
- .append("0x")
- .append(HexDump.toHex((short)getBaseUnit()))
- .append(" (").append(getBaseUnit()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getBaseUnit ()))
+ .append(" (").append( getBaseUnit() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .crossingPoint = ")
- .append("0x")
- .append(HexDump.toHex((short)getCrossingPoint()))
- .append(" (").append(getCrossingPoint()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getCrossingPoint ()))
+ .append(" (").append( getCrossingPoint() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .options = ")
- .append("0x")
- .append(HexDump.toHex((short)getOptions()))
- .append(" (").append(getOptions()).append(" )\n");
- buffer.append(" .defaultMinimum = ").append(isDefaultMinimum ()).append('\n');
- buffer.append(" .defaultMaximum = ").append(isDefaultMaximum ()).append('\n');
- buffer.append(" .defaultMajor = ").append(isDefaultMajor ()).append('\n');
- buffer.append(" .defaultMinorUnit = ").append(isDefaultMinorUnit ()).append('\n');
- buffer.append(" .isDate = ").append(isIsDate ()).append('\n');
- buffer.append(" .defaultBase = ").append(isDefaultBase ()).append('\n');
- buffer.append(" .defaultCross = ").append(isDefaultCross ()).append('\n');
- buffer.append(" .defaultDateSettings = ").append(isDefaultDateSettings ()).append('\n');
-
- buffer.append("[/AxisOptions]\n");
+ .append("0x").append(HexDump.toHex( getOptions ()))
+ .append(" (").append( getOptions() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
+ buffer.append(" .defaultMinimum = ").append(isDefaultMinimum()).append('\n');
+ buffer.append(" .defaultMaximum = ").append(isDefaultMaximum()).append('\n');
+ buffer.append(" .defaultMajor = ").append(isDefaultMajor()).append('\n');
+ buffer.append(" .defaultMinorUnit = ").append(isDefaultMinorUnit()).append('\n');
+ buffer.append(" .isDate = ").append(isIsDate()).append('\n');
+ buffer.append(" .defaultBase = ").append(isDefaultBase()).append('\n');
+ buffer.append(" .defaultCross = ").append(isDefaultCross()).append('\n');
+ buffer.append(" .defaultDateSettings = ").append(isDefaultDateSettings()).append('\n');
+
+ buffer.append("[/AXCEXT]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- LittleEndian.putShort(data, 4 + offset, field_1_minimumCategory);
- LittleEndian.putShort(data, 6 + offset, field_2_maximumCategory);
- LittleEndian.putShort(data, 8 + offset, field_3_majorUnitValue);
- LittleEndian.putShort(data, 10 + offset, field_4_majorUnit);
- LittleEndian.putShort(data, 12 + offset, field_5_minorUnitValue);
- LittleEndian.putShort(data, 14 + offset, field_6_minorUnit);
- LittleEndian.putShort(data, 16 + offset, field_7_baseUnit);
- LittleEndian.putShort(data, 18 + offset, field_8_crossingPoint);
- LittleEndian.putShort(data, 20 + offset, field_9_options);
+ LittleEndian.putShort(data, 4 + offset + pos, field_1_minimumCategory);
+ LittleEndian.putShort(data, 6 + offset + pos, field_2_maximumCategory);
+ LittleEndian.putShort(data, 8 + offset + pos, field_3_majorUnitValue);
+ LittleEndian.putShort(data, 10 + offset + pos, field_4_majorUnit);
+ LittleEndian.putShort(data, 12 + offset + pos, field_5_minorUnitValue);
+ LittleEndian.putShort(data, 14 + offset + pos, field_6_minorUnit);
+ LittleEndian.putShort(data, 16 + offset + pos, field_7_baseUnit);
+ LittleEndian.putShort(data, 18 + offset + pos, field_8_crossingPoint);
+ LittleEndian.putShort(data, 20 + offset + pos, field_9_options);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2;
+ return 4 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2;
}
public short getSid()
}
public Object clone() {
- AxisOptionsRecord rec = new AxisOptionsRecord();
-
- rec.field_1_minimumCategory = field_1_minimumCategory;
- rec.field_2_maximumCategory = field_2_maximumCategory;
- rec.field_3_majorUnitValue = field_3_majorUnitValue;
- rec.field_4_majorUnit = field_4_majorUnit;
- rec.field_5_minorUnitValue = field_5_minorUnitValue;
- rec.field_6_minorUnit = field_6_minorUnit;
- rec.field_7_baseUnit = field_7_baseUnit;
- rec.field_8_crossingPoint = field_8_crossingPoint;
- rec.field_9_options = field_9_options;
-
- return rec;
+ AxisOptionsRecord rec = new AxisOptionsRecord();
+
+ rec.field_1_minimumCategory = field_1_minimumCategory;
+ rec.field_2_maximumCategory = field_2_maximumCategory;
+ rec.field_3_majorUnitValue = field_3_majorUnitValue;
+ rec.field_4_majorUnit = field_4_majorUnit;
+ rec.field_5_minorUnitValue = field_5_minorUnitValue;
+ rec.field_6_minorUnit = field_6_minorUnit;
+ rec.field_7_baseUnit = field_7_baseUnit;
+ rec.field_8_crossingPoint = field_8_crossingPoint;
+ rec.field_9_options = field_9_options;
+ return rec;
}
+
+
/**
* Get the minimum category field for the AxisOptions record.
*/
public AxisParentRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public AxisParentRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_axisType = LittleEndian.getShort(data, 0x0 + offset);
- field_2_x = LittleEndian.getInt(data, 0x2 + offset);
- field_3_y = LittleEndian.getInt(data, 0x6 + offset);
- field_4_width = LittleEndian.getInt(data, 0xa + offset);
- field_5_height = LittleEndian.getInt(data, 0xe + offset);
+
+ int pos = 0;
+ field_1_axisType = LittleEndian.getShort(data, pos + 0x0 + offset);
+ field_2_x = LittleEndian.getInt(data, pos + 0x2 + offset);
+ field_3_y = LittleEndian.getInt(data, pos + 0x6 + offset);
+ field_4_width = LittleEndian.getInt(data, pos + 0xa + offset);
+ field_5_height = LittleEndian.getInt(data, pos + 0xe + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[AxisParent]\n");
-
+ buffer.append("[AXISPARENT]\n");
buffer.append(" .axisType = ")
- .append("0x")
- .append(HexDump.toHex((short)getAxisType()))
- .append(" (").append(getAxisType()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getAxisType ()))
+ .append(" (").append( getAxisType() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .x = ")
- .append("0x")
- .append(HexDump.toHex((int)getX()))
- .append(" (").append(getX()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getX ()))
+ .append(" (").append( getX() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .y = ")
- .append("0x")
- .append(HexDump.toHex((int)getY()))
- .append(" (").append(getY()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getY ()))
+ .append(" (").append( getY() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .width = ")
- .append("0x")
- .append(HexDump.toHex((int)getWidth()))
- .append(" (").append(getWidth()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getWidth ()))
+ .append(" (").append( getWidth() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .height = ")
- .append("0x")
- .append(HexDump.toHex((int)getHeight()))
- .append(" (").append(getHeight()).append(" )\n");
+ .append("0x").append(HexDump.toHex( getHeight ()))
+ .append(" (").append( getHeight() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
- buffer.append("[/AxisParent]\n");
+ buffer.append("[/AXISPARENT]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- LittleEndian.putShort(data, 4 + offset, field_1_axisType);
- LittleEndian.putInt(data, 6 + offset, field_2_x);
- LittleEndian.putInt(data, 10 + offset, field_3_y);
- LittleEndian.putInt(data, 14 + offset, field_4_width);
- LittleEndian.putInt(data, 18 + offset, field_5_height);
+ LittleEndian.putShort(data, 4 + offset + pos, field_1_axisType);
+ LittleEndian.putInt(data, 6 + offset + pos, field_2_x);
+ LittleEndian.putInt(data, 10 + offset + pos, field_3_y);
+ LittleEndian.putInt(data, 14 + offset + pos, field_4_width);
+ LittleEndian.putInt(data, 18 + offset + pos, field_5_height);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 2 + 4 + 4 + 4 + 4;
+ return 4 + 2 + 4 + 4 + 4 + 4;
}
public short getSid()
}
public Object clone() {
- AxisParentRecord rec = new AxisParentRecord();
-
- rec.field_1_axisType = field_1_axisType;
- rec.field_2_x = field_2_x;
- rec.field_3_y = field_3_y;
- rec.field_4_width = field_4_width;
- rec.field_5_height = field_5_height;
-
- return rec;
+ AxisParentRecord rec = new AxisParentRecord();
+
+ rec.field_1_axisType = field_1_axisType;
+ rec.field_2_x = field_2_x;
+ rec.field_3_y = field_3_y;
+ rec.field_4_width = field_4_width;
+ rec.field_5_height = field_5_height;
+ return rec;
}
+
+
/**
* Get the axis type field for the AxisParent record.
*
public AxisRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public AxisRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_axisType = LittleEndian.getShort(data, 0x0 + offset);
- field_2_reserved1 = LittleEndian.getInt(data, 0x2 + offset);
- field_3_reserved2 = LittleEndian.getInt(data, 0x6 + offset);
- field_4_reserved3 = LittleEndian.getInt(data, 0xa + offset);
- field_5_reserved4 = LittleEndian.getInt(data, 0xe + offset);
+
+ int pos = 0;
+ field_1_axisType = LittleEndian.getShort(data, pos + 0x0 + offset);
+ field_2_reserved1 = LittleEndian.getInt(data, pos + 0x2 + offset);
+ field_3_reserved2 = LittleEndian.getInt(data, pos + 0x6 + offset);
+ field_4_reserved3 = LittleEndian.getInt(data, pos + 0xa + offset);
+ field_5_reserved4 = LittleEndian.getInt(data, pos + 0xe + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[Axis]\n");
-
+ buffer.append("[AXIS]\n");
buffer.append(" .axisType = ")
- .append("0x")
- .append(HexDump.toHex((short)getAxisType()))
- .append(" (").append(getAxisType()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getAxisType ()))
+ .append(" (").append( getAxisType() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .reserved1 = ")
- .append("0x")
- .append(HexDump.toHex((int)getReserved1()))
- .append(" (").append(getReserved1()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getReserved1 ()))
+ .append(" (").append( getReserved1() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .reserved2 = ")
- .append("0x")
- .append(HexDump.toHex((int)getReserved2()))
- .append(" (").append(getReserved2()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getReserved2 ()))
+ .append(" (").append( getReserved2() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .reserved3 = ")
- .append("0x")
- .append(HexDump.toHex((int)getReserved3()))
- .append(" (").append(getReserved3()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getReserved3 ()))
+ .append(" (").append( getReserved3() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .reserved4 = ")
- .append("0x")
- .append(HexDump.toHex((int)getReserved4()))
- .append(" (").append(getReserved4()).append(" )\n");
+ .append("0x").append(HexDump.toHex( getReserved4 ()))
+ .append(" (").append( getReserved4() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
- buffer.append("[/Axis]\n");
+ buffer.append("[/AXIS]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- LittleEndian.putShort(data, 4 + offset, field_1_axisType);
- LittleEndian.putInt(data, 6 + offset, field_2_reserved1);
- LittleEndian.putInt(data, 10 + offset, field_3_reserved2);
- LittleEndian.putInt(data, 14 + offset, field_4_reserved3);
- LittleEndian.putInt(data, 18 + offset, field_5_reserved4);
+ LittleEndian.putShort(data, 4 + offset + pos, field_1_axisType);
+ LittleEndian.putInt(data, 6 + offset + pos, field_2_reserved1);
+ LittleEndian.putInt(data, 10 + offset + pos, field_3_reserved2);
+ LittleEndian.putInt(data, 14 + offset + pos, field_4_reserved3);
+ LittleEndian.putInt(data, 18 + offset + pos, field_5_reserved4);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 2 + 4 + 4 + 4 + 4;
+ return 4 + 2 + 4 + 4 + 4 + 4;
}
public short getSid()
}
public Object clone() {
- AxisRecord rec = new AxisRecord();
-
- rec.field_1_axisType = field_1_axisType;
- rec.field_2_reserved1 = field_2_reserved1;
- rec.field_3_reserved2 = field_3_reserved2;
- rec.field_4_reserved3 = field_4_reserved3;
- rec.field_5_reserved4 = field_5_reserved4;
-
- return rec;
+ AxisRecord rec = new AxisRecord();
+
+ rec.field_1_axisType = field_1_axisType;
+ rec.field_2_reserved1 = field_2_reserved1;
+ rec.field_3_reserved2 = field_3_reserved2;
+ rec.field_4_reserved3 = field_4_reserved3;
+ rec.field_5_reserved4 = field_5_reserved4;
+ return rec;
}
+
+
/**
* Get the axis type field for the Axis record.
*
public AxisUsedRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public AxisUsedRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_numAxis = LittleEndian.getShort(data, 0x0 + offset);
+
+ int pos = 0;
+ field_1_numAxis = LittleEndian.getShort(data, pos + 0x0 + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[AxisUsed]\n");
-
+ buffer.append("[AXISUSED]\n");
buffer.append(" .numAxis = ")
- .append("0x")
- .append(HexDump.toHex((short)getNumAxis()))
- .append(" (").append(getNumAxis()).append(" )\n");
+ .append("0x").append(HexDump.toHex( getNumAxis ()))
+ .append(" (").append( getNumAxis() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
- buffer.append("[/AxisUsed]\n");
+ buffer.append("[/AXISUSED]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- LittleEndian.putShort(data, 4 + offset, field_1_numAxis);
+ LittleEndian.putShort(data, 4 + offset + pos, field_1_numAxis);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 2;
+ return 4 + 2;
}
public short getSid()
}
public Object clone() {
- AxisUsedRecord rec = new AxisUsedRecord();
-
- rec.field_1_numAxis = field_1_numAxis;
-
- return rec;
+ AxisUsedRecord rec = new AxisUsedRecord();
+
+ rec.field_1_numAxis = field_1_numAxis;
+ return rec;
}
+
+
/**
* Get the num axis field for the AxisUsed record.
*/
public BarRecord()
{
- field_2_categorySpace = 50;
}
public BarRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public BarRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_barSpace = LittleEndian.getShort(data, 0x0 + offset);
- field_2_categorySpace = LittleEndian.getShort(data, 0x2 + offset);
- field_3_formatFlags = LittleEndian.getShort(data, 0x4 + offset);
+
+ int pos = 0;
+ field_1_barSpace = LittleEndian.getShort(data, pos + 0x0 + offset);
+ field_2_categorySpace = LittleEndian.getShort(data, pos + 0x2 + offset);
+ field_3_formatFlags = LittleEndian.getShort(data, pos + 0x4 + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[Bar]\n");
-
+ buffer.append("[BAR]\n");
buffer.append(" .barSpace = ")
- .append("0x")
- .append(HexDump.toHex((short)getBarSpace()))
- .append(" (").append(getBarSpace()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getBarSpace ()))
+ .append(" (").append( getBarSpace() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .categorySpace = ")
- .append("0x")
- .append(HexDump.toHex((short)getCategorySpace()))
- .append(" (").append(getCategorySpace()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getCategorySpace ()))
+ .append(" (").append( getCategorySpace() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
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");
+ .append("0x").append(HexDump.toHex( getFormatFlags ()))
+ .append(" (").append( getFormatFlags() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
+ 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)
{
+ int pos = 0;
+
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);
+ LittleEndian.putShort(data, 4 + offset + pos, field_1_barSpace);
+ LittleEndian.putShort(data, 6 + offset + pos, field_2_categorySpace);
+ LittleEndian.putShort(data, 8 + offset + pos, field_3_formatFlags);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 2 + 2 + 2;
+ return 4 + 2 + 2 + 2;
}
public short getSid()
}
public Object clone() {
- BarRecord rec = new BarRecord();
-
- rec.field_1_barSpace = field_1_barSpace;
- rec.field_2_categorySpace = field_2_categorySpace;
- rec.field_3_formatFlags = field_3_formatFlags;
-
- return rec;
+ BarRecord rec = new BarRecord();
+
+ rec.field_1_barSpace = field_1_barSpace;
+ rec.field_2_categorySpace = field_2_categorySpace;
+ rec.field_3_formatFlags = field_3_formatFlags;
+ return rec;
}
+
+
/**
* Get the bar space field for the Bar record.
*/
public CategorySeriesAxisRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public CategorySeriesAxisRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_crossingPoint = LittleEndian.getShort(data, 0x0 + offset);
- field_2_labelFrequency = LittleEndian.getShort(data, 0x2 + offset);
- field_3_tickMarkFrequency = LittleEndian.getShort(data, 0x4 + offset);
- field_4_options = LittleEndian.getShort(data, 0x6 + offset);
+
+ int pos = 0;
+ field_1_crossingPoint = LittleEndian.getShort(data, pos + 0x0 + offset);
+ field_2_labelFrequency = LittleEndian.getShort(data, pos + 0x2 + offset);
+ field_3_tickMarkFrequency = LittleEndian.getShort(data, pos + 0x4 + offset);
+ field_4_options = LittleEndian.getShort(data, pos + 0x6 + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[CategorySeriesAxis]\n");
-
+ buffer.append("[CATSERRANGE]\n");
buffer.append(" .crossingPoint = ")
- .append("0x")
- .append(HexDump.toHex((short)getCrossingPoint()))
- .append(" (").append(getCrossingPoint()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getCrossingPoint ()))
+ .append(" (").append( getCrossingPoint() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .labelFrequency = ")
- .append("0x")
- .append(HexDump.toHex((short)getLabelFrequency()))
- .append(" (").append(getLabelFrequency()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getLabelFrequency ()))
+ .append(" (").append( getLabelFrequency() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .tickMarkFrequency = ")
- .append("0x")
- .append(HexDump.toHex((short)getTickMarkFrequency()))
- .append(" (").append(getTickMarkFrequency()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getTickMarkFrequency ()))
+ .append(" (").append( getTickMarkFrequency() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .options = ")
- .append("0x")
- .append(HexDump.toHex((short)getOptions()))
- .append(" (").append(getOptions()).append(" )\n");
- buffer.append(" .valueAxisCrossing = ").append(isValueAxisCrossing ()).append('\n');
- buffer.append(" .crossesFarRight = ").append(isCrossesFarRight ()).append('\n');
- buffer.append(" .reversed = ").append(isReversed ()).append('\n');
-
- buffer.append("[/CategorySeriesAxis]\n");
+ .append("0x").append(HexDump.toHex( getOptions ()))
+ .append(" (").append( getOptions() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
+ buffer.append(" .valueAxisCrossing = ").append(isValueAxisCrossing()).append('\n');
+ buffer.append(" .crossesFarRight = ").append(isCrossesFarRight()).append('\n');
+ buffer.append(" .reversed = ").append(isReversed()).append('\n');
+
+ buffer.append("[/CATSERRANGE]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- LittleEndian.putShort(data, 4 + offset, field_1_crossingPoint);
- LittleEndian.putShort(data, 6 + offset, field_2_labelFrequency);
- LittleEndian.putShort(data, 8 + offset, field_3_tickMarkFrequency);
- LittleEndian.putShort(data, 10 + offset, field_4_options);
+ LittleEndian.putShort(data, 4 + offset + pos, field_1_crossingPoint);
+ LittleEndian.putShort(data, 6 + offset + pos, field_2_labelFrequency);
+ LittleEndian.putShort(data, 8 + offset + pos, field_3_tickMarkFrequency);
+ LittleEndian.putShort(data, 10 + offset + pos, field_4_options);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 2 + 2 + 2 + 2;
+ return 4 + 2 + 2 + 2 + 2;
}
public short getSid()
}
public Object clone() {
- CategorySeriesAxisRecord rec = new CategorySeriesAxisRecord();
-
- rec.field_1_crossingPoint = field_1_crossingPoint;
- rec.field_2_labelFrequency = field_2_labelFrequency;
- rec.field_3_tickMarkFrequency = field_3_tickMarkFrequency;
- rec.field_4_options = field_4_options;
-
- return rec;
+ CategorySeriesAxisRecord rec = new CategorySeriesAxisRecord();
+
+ rec.field_1_crossingPoint = field_1_crossingPoint;
+ rec.field_2_labelFrequency = field_2_labelFrequency;
+ rec.field_3_tickMarkFrequency = field_3_tickMarkFrequency;
+ rec.field_4_options = field_4_options;
+ return rec;
}
+
+
/**
* Get the crossing point field for the CategorySeriesAxis record.
*/
public ChartRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public ChartRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_x = LittleEndian.getInt(data, 0x0 + offset);
- field_2_y = LittleEndian.getInt(data, 0x4 + offset);
- field_3_width = LittleEndian.getInt(data, 0x8 + offset);
- field_4_height = LittleEndian.getInt(data, 0xc + offset);
+
+ int pos = 0;
+ field_1_x = LittleEndian.getInt(data, pos + 0x0 + offset);
+ field_2_y = LittleEndian.getInt(data, pos + 0x4 + offset);
+ field_3_width = LittleEndian.getInt(data, pos + 0x8 + offset);
+ field_4_height = LittleEndian.getInt(data, pos + 0xc + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[Chart]\n");
-
+ buffer.append("[CHART]\n");
buffer.append(" .x = ")
- .append("0x")
- .append(HexDump.toHex((int)getX()))
- .append(" (").append(getX()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getX ()))
+ .append(" (").append( getX() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .y = ")
- .append("0x")
- .append(HexDump.toHex((int)getY()))
- .append(" (").append(getY()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getY ()))
+ .append(" (").append( getY() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .width = ")
- .append("0x")
- .append(HexDump.toHex((int)getWidth()))
- .append(" (").append(getWidth()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getWidth ()))
+ .append(" (").append( getWidth() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .height = ")
- .append("0x")
- .append(HexDump.toHex((int)getHeight()))
- .append(" (").append(getHeight()).append(" )\n");
+ .append("0x").append(HexDump.toHex( getHeight ()))
+ .append(" (").append( getHeight() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
- buffer.append("[/Chart]\n");
+ buffer.append("[/CHART]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- LittleEndian.putInt(data, 4 + offset, field_1_x);
- LittleEndian.putInt(data, 8 + offset, field_2_y);
- LittleEndian.putInt(data, 12 + offset, field_3_width);
- LittleEndian.putInt(data, 16 + offset, field_4_height);
+ LittleEndian.putInt(data, 4 + offset + pos, field_1_x);
+ LittleEndian.putInt(data, 8 + offset + pos, field_2_y);
+ LittleEndian.putInt(data, 12 + offset + pos, field_3_width);
+ LittleEndian.putInt(data, 16 + offset + pos, field_4_height);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 4 + 4 + 4 + 4;
+ return 4 + 4 + 4 + 4 + 4;
}
public short getSid()
}
public Object clone() {
- ChartRecord rec = new ChartRecord();
-
- rec.field_1_x = field_1_x;
- rec.field_2_y = field_2_y;
- rec.field_3_width = field_3_width;
- rec.field_4_height = field_4_height;
-
- return rec;
+ ChartRecord rec = new ChartRecord();
+
+ rec.field_1_x = field_1_x;
+ rec.field_2_y = field_2_y;
+ rec.field_3_width = field_3_width;
+ rec.field_4_height = field_4_height;
+ return rec;
}
+
+
/**
* Get the x field for the Chart record.
*/
--- /dev/null
+package org.apache.poi.hssf.record;
+
+public interface CustomField
+ extends Cloneable
+{
+ /**
+ * @return The size of this field in bytes. This operation is not valid
+ * until after the call to <code>fillField()</code>
+ */
+ int getSize();
+
+ /**
+ * Populates this fields data from the byte array passed in.
+ * @param data raw data
+ * @param size size of data
+ * @param offset of the record's data (provided a big array of the file)
+ * @return the number of bytes read.
+ */
+ int fillField(byte [] data, short size, int offset);
+
+ /**
+ * Appends the string representation of this field to the supplied
+ * StringBuffer.
+ *
+ * @param str The string buffer to append to.
+ */
+ void toString(StringBuffer str);
+
+ /**
+ * Converts this field to it's byte array form.
+ * @param offset The offset into the byte array to start writing to.
+ * @param data The data array to write to.
+ * @return The number of bytes written.
+ */
+ int serializeField(int offset, byte[] data);
+
+
+}
public DatRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public DatRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_options = LittleEndian.getShort(data, 0x0 + offset);
+
+ int pos = 0;
+ field_1_options = LittleEndian.getShort(data, pos + 0x0 + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[Dat]\n");
-
+ 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");
+ .append("0x").append(HexDump.toHex( getOptions ()))
+ .append(" (").append( getOptions() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
+ 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)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- LittleEndian.putShort(data, 4 + offset, field_1_options);
+ LittleEndian.putShort(data, 4 + offset + pos, field_1_options);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 2;
+ return 4 + 2;
}
public short getSid()
}
public Object clone() {
- DatRecord rec = new DatRecord();
-
- rec.field_1_options = field_1_options;
-
- return rec;
+ DatRecord rec = new DatRecord();
+
+ rec.field_1_options = field_1_options;
+ return rec;
}
+
+
/**
* Get the options field for the Dat record.
*/
public DataFormatRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public DataFormatRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_pointNumber = LittleEndian.getShort(data, 0x0 + offset);
- field_2_seriesIndex = LittleEndian.getShort(data, 0x2 + offset);
- field_3_seriesNumber = LittleEndian.getShort(data, 0x4 + offset);
- field_4_formatFlags = LittleEndian.getShort(data, 0x6 + offset);
+
+ int pos = 0;
+ field_1_pointNumber = LittleEndian.getShort(data, pos + 0x0 + offset);
+ field_2_seriesIndex = LittleEndian.getShort(data, pos + 0x2 + offset);
+ field_3_seriesNumber = LittleEndian.getShort(data, pos + 0x4 + offset);
+ field_4_formatFlags = LittleEndian.getShort(data, pos + 0x6 + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[DataFormat]\n");
-
+ buffer.append("[DATAFORMAT]\n");
buffer.append(" .pointNumber = ")
- .append("0x")
- .append(HexDump.toHex((short)getPointNumber()))
- .append(" (").append(getPointNumber()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getPointNumber ()))
+ .append(" (").append( getPointNumber() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .seriesIndex = ")
- .append("0x")
- .append(HexDump.toHex((short)getSeriesIndex()))
- .append(" (").append(getSeriesIndex()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getSeriesIndex ()))
+ .append(" (").append( getSeriesIndex() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .seriesNumber = ")
- .append("0x")
- .append(HexDump.toHex((short)getSeriesNumber()))
- .append(" (").append(getSeriesNumber()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getSeriesNumber ()))
+ .append(" (").append( getSeriesNumber() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .formatFlags = ")
- .append("0x")
- .append(HexDump.toHex((short)getFormatFlags()))
- .append(" (").append(getFormatFlags()).append(" )\n");
- buffer.append(" .useExcel4Colors = ").append(isUseExcel4Colors ()).append('\n');
+ .append("0x").append(HexDump.toHex( getFormatFlags ()))
+ .append(" (").append( getFormatFlags() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
+ buffer.append(" .useExcel4Colors = ").append(isUseExcel4Colors()).append('\n');
- buffer.append("[/DataFormat]\n");
+ buffer.append("[/DATAFORMAT]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
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);
+ LittleEndian.putShort(data, 4 + offset + pos, field_1_pointNumber);
+ LittleEndian.putShort(data, 6 + offset + pos, field_2_seriesIndex);
+ LittleEndian.putShort(data, 8 + offset + pos, field_3_seriesNumber);
+ LittleEndian.putShort(data, 10 + offset + pos, field_4_formatFlags);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 2 + 2 + 2 + 2;
+ return 4 + 2 + 2 + 2 + 2;
}
public short getSid()
}
public Object clone() {
- DataFormatRecord rec = new DataFormatRecord();
-
- rec.field_1_pointNumber = field_1_pointNumber;
- rec.field_2_seriesIndex = field_2_seriesIndex;
- rec.field_3_seriesNumber = field_3_seriesNumber;
- rec.field_4_formatFlags = field_4_formatFlags;
-
- return rec;
+ DataFormatRecord rec = new DataFormatRecord();
+
+ rec.field_1_pointNumber = field_1_pointNumber;
+ rec.field_2_seriesIndex = field_2_seriesIndex;
+ rec.field_3_seriesNumber = field_3_seriesNumber;
+ rec.field_4_formatFlags = field_4_formatFlags;
+ return rec;
}
+
+
/**
* Get the point number field for the DataFormat record.
*/
public DefaultDataLabelTextPropertiesRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public DefaultDataLabelTextPropertiesRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_categoryDataType = LittleEndian.getShort(data, 0x0 + offset);
+
+ int pos = 0;
+ field_1_categoryDataType = LittleEndian.getShort(data, pos + 0x0 + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[DefaultDataLabelTextProperties]\n");
-
+ buffer.append("[DEFAULTTEXT]\n");
buffer.append(" .categoryDataType = ")
- .append("0x")
- .append(HexDump.toHex((short)getCategoryDataType()))
- .append(" (").append(getCategoryDataType()).append(" )\n");
+ .append("0x").append(HexDump.toHex( getCategoryDataType ()))
+ .append(" (").append( getCategoryDataType() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
- buffer.append("[/DefaultDataLabelTextProperties]\n");
+ buffer.append("[/DEFAULTTEXT]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- LittleEndian.putShort(data, 4 + offset, field_1_categoryDataType);
+ LittleEndian.putShort(data, 4 + offset + pos, field_1_categoryDataType);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 2;
+ return 4 + 2;
}
public short getSid()
}
public Object clone() {
- DefaultDataLabelTextPropertiesRecord rec = new DefaultDataLabelTextPropertiesRecord();
-
- rec.field_1_categoryDataType = field_1_categoryDataType;
-
- return rec;
+ DefaultDataLabelTextPropertiesRecord rec = new DefaultDataLabelTextPropertiesRecord();
+
+ rec.field_1_categoryDataType = field_1_categoryDataType;
+ return rec;
}
+
+
/**
* Get the category data type field for the DefaultDataLabelTextProperties record.
*
public FontBasisRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public FontBasisRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_xBasis = LittleEndian.getShort(data, 0x0 + offset);
- field_2_yBasis = LittleEndian.getShort(data, 0x2 + offset);
- field_3_heightBasis = LittleEndian.getShort(data, 0x4 + offset);
- field_4_scale = LittleEndian.getShort(data, 0x6 + offset);
- field_5_indexToFontTable = LittleEndian.getShort(data, 0x8 + offset);
+
+ int pos = 0;
+ field_1_xBasis = LittleEndian.getShort(data, pos + 0x0 + offset);
+ field_2_yBasis = LittleEndian.getShort(data, pos + 0x2 + offset);
+ field_3_heightBasis = LittleEndian.getShort(data, pos + 0x4 + offset);
+ field_4_scale = LittleEndian.getShort(data, pos + 0x6 + offset);
+ field_5_indexToFontTable = LittleEndian.getShort(data, pos + 0x8 + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[FontBasis]\n");
-
+ buffer.append("[FBI]\n");
buffer.append(" .xBasis = ")
- .append("0x")
- .append(HexDump.toHex((short)getXBasis()))
- .append(" (").append(getXBasis()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getXBasis ()))
+ .append(" (").append( getXBasis() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .yBasis = ")
- .append("0x")
- .append(HexDump.toHex((short)getYBasis()))
- .append(" (").append(getYBasis()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getYBasis ()))
+ .append(" (").append( getYBasis() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .heightBasis = ")
- .append("0x")
- .append(HexDump.toHex((short)getHeightBasis()))
- .append(" (").append(getHeightBasis()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getHeightBasis ()))
+ .append(" (").append( getHeightBasis() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .scale = ")
- .append("0x")
- .append(HexDump.toHex((short)getScale()))
- .append(" (").append(getScale()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getScale ()))
+ .append(" (").append( getScale() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .indexToFontTable = ")
- .append("0x")
- .append(HexDump.toHex((short)getIndexToFontTable()))
- .append(" (").append(getIndexToFontTable()).append(" )\n");
+ .append("0x").append(HexDump.toHex( getIndexToFontTable ()))
+ .append(" (").append( getIndexToFontTable() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
- buffer.append("[/FontBasis]\n");
+ buffer.append("[/FBI]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- LittleEndian.putShort(data, 4 + offset, field_1_xBasis);
- LittleEndian.putShort(data, 6 + offset, field_2_yBasis);
- LittleEndian.putShort(data, 8 + offset, field_3_heightBasis);
- LittleEndian.putShort(data, 10 + offset, field_4_scale);
- LittleEndian.putShort(data, 12 + offset, field_5_indexToFontTable);
+ LittleEndian.putShort(data, 4 + offset + pos, field_1_xBasis);
+ LittleEndian.putShort(data, 6 + offset + pos, field_2_yBasis);
+ LittleEndian.putShort(data, 8 + offset + pos, field_3_heightBasis);
+ LittleEndian.putShort(data, 10 + offset + pos, field_4_scale);
+ LittleEndian.putShort(data, 12 + offset + pos, field_5_indexToFontTable);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 2 + 2 + 2 + 2 + 2;
+ return 4 + 2 + 2 + 2 + 2 + 2;
}
public short getSid()
}
public Object clone() {
- FontBasisRecord rec = new FontBasisRecord();
-
- rec.field_1_xBasis = field_1_xBasis;
- rec.field_2_yBasis = field_2_yBasis;
- rec.field_3_heightBasis = field_3_heightBasis;
- rec.field_4_scale = field_4_scale;
- rec.field_5_indexToFontTable = field_5_indexToFontTable;
-
- return rec;
+ FontBasisRecord rec = new FontBasisRecord();
+
+ rec.field_1_xBasis = field_1_xBasis;
+ rec.field_2_yBasis = field_2_yBasis;
+ rec.field_3_heightBasis = field_3_heightBasis;
+ rec.field_4_scale = field_4_scale;
+ rec.field_5_indexToFontTable = field_5_indexToFontTable;
+ return rec;
}
+
+
/**
* Get the x Basis field for the FontBasis record.
*/
public FontIndexRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public FontIndexRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_fontIndex = LittleEndian.getShort(data, 0x0 + offset);
+
+ int pos = 0;
+ field_1_fontIndex = LittleEndian.getShort(data, pos + 0x0 + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[FontIndex]\n");
-
+ buffer.append("[FONTX]\n");
buffer.append(" .fontIndex = ")
- .append("0x")
- .append(HexDump.toHex((short)getFontIndex()))
- .append(" (").append(getFontIndex()).append(" )\n");
+ .append("0x").append(HexDump.toHex( getFontIndex ()))
+ .append(" (").append( getFontIndex() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
- buffer.append("[/FontIndex]\n");
+ buffer.append("[/FONTX]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- LittleEndian.putShort(data, 4 + offset, field_1_fontIndex);
+ LittleEndian.putShort(data, 4 + offset + pos, field_1_fontIndex);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 2;
+ return 4 + 2;
}
public short getSid()
}
public Object clone() {
- FontIndexRecord rec = new FontIndexRecord();
-
- rec.field_1_fontIndex = field_1_fontIndex;
-
- return rec;
+ FontIndexRecord rec = new FontIndexRecord();
+
+ rec.field_1_fontIndex = field_1_fontIndex;
+ return rec;
}
+
+
/**
* Get the font index field for the FontIndex record.
*/
public FrameRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public FrameRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_borderType = LittleEndian.getShort(data, 0x0 + offset);
- field_2_options = LittleEndian.getShort(data, 0x2 + offset);
+
+ int pos = 0;
+ field_1_borderType = LittleEndian.getShort(data, pos + 0x0 + offset);
+ field_2_options = LittleEndian.getShort(data, pos + 0x2 + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[Frame]\n");
-
+ buffer.append("[FRAME]\n");
buffer.append(" .borderType = ")
- .append("0x")
- .append(HexDump.toHex((short)getBorderType()))
- .append(" (").append(getBorderType()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getBorderType ()))
+ .append(" (").append( getBorderType() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
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');
+ .append("0x").append(HexDump.toHex( getOptions ()))
+ .append(" (").append( getOptions() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
+ buffer.append(" .autoSize = ").append(isAutoSize()).append('\n');
+ buffer.append(" .autoPosition = ").append(isAutoPosition()).append('\n');
- buffer.append("[/Frame]\n");
+ buffer.append("[/FRAME]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
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);
+ LittleEndian.putShort(data, 4 + offset + pos, field_1_borderType);
+ LittleEndian.putShort(data, 6 + offset + pos, field_2_options);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 2 + 2;
+ return 4 + 2 + 2;
}
public short getSid()
}
public Object clone() {
- FrameRecord rec = new FrameRecord();
-
- rec.field_1_borderType = field_1_borderType;
- rec.field_2_options = field_2_options;
-
- return rec;
+ FrameRecord rec = new FrameRecord();
+
+ rec.field_1_borderType = field_1_borderType;
+ rec.field_2_options = field_2_options;
+ return rec;
}
+
+
/**
* Get the border type field for the Frame record.
*
public LegendRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public LegendRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_xAxisUpperLeft = LittleEndian.getInt(data, 0x0 + offset);
- field_2_yAxisUpperLeft = LittleEndian.getInt(data, 0x4 + offset);
- field_3_xSize = LittleEndian.getInt(data, 0x8 + offset);
- field_4_ySize = LittleEndian.getInt(data, 0xc + offset);
- field_5_type = data[ 0x10 + offset ];
- field_6_spacing = data[ 0x11 + offset ];
- field_7_options = LittleEndian.getShort(data, 0x12 + offset);
+
+ int pos = 0;
+ field_1_xAxisUpperLeft = LittleEndian.getInt(data, pos + 0x0 + offset);
+ field_2_yAxisUpperLeft = LittleEndian.getInt(data, pos + 0x4 + offset);
+ field_3_xSize = LittleEndian.getInt(data, pos + 0x8 + offset);
+ field_4_ySize = LittleEndian.getInt(data, pos + 0xc + offset);
+ field_5_type = data[ pos + 0x10 + offset ];
+ field_6_spacing = data[ pos + 0x11 + offset ];
+ field_7_options = LittleEndian.getShort(data, pos + 0x12 + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[Legend]\n");
-
+ buffer.append("[LEGEND]\n");
buffer.append(" .xAxisUpperLeft = ")
- .append("0x")
- .append(HexDump.toHex((int)getXAxisUpperLeft()))
- .append(" (").append(getXAxisUpperLeft()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getXAxisUpperLeft ()))
+ .append(" (").append( getXAxisUpperLeft() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .yAxisUpperLeft = ")
- .append("0x")
- .append(HexDump.toHex((int)getYAxisUpperLeft()))
- .append(" (").append(getYAxisUpperLeft()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getYAxisUpperLeft ()))
+ .append(" (").append( getYAxisUpperLeft() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .xSize = ")
- .append("0x")
- .append(HexDump.toHex((int)getXSize()))
- .append(" (").append(getXSize()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getXSize ()))
+ .append(" (").append( getXSize() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .ySize = ")
- .append("0x")
- .append(HexDump.toHex((int)getYSize()))
- .append(" (").append(getYSize()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getYSize ()))
+ .append(" (").append( getYSize() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .type = ")
- .append("0x")
- .append(HexDump.toHex((byte)getType()))
- .append(" (").append(getType()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getType ()))
+ .append(" (").append( getType() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .spacing = ")
- .append("0x")
- .append(HexDump.toHex((byte)getSpacing()))
- .append(" (").append(getSpacing()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getSpacing ()))
+ .append(" (").append( getSpacing() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
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(" .autoXPositioning = ").append(isAutoXPositioning ()).append('\n');
- buffer.append(" .autoYPositioning = ").append(isAutoYPositioning ()).append('\n');
- buffer.append(" .vertical = ").append(isVertical ()).append('\n');
- buffer.append(" .dataTable = ").append(isDataTable ()).append('\n');
-
- buffer.append("[/Legend]\n");
+ .append("0x").append(HexDump.toHex( getOptions ()))
+ .append(" (").append( getOptions() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
+ buffer.append(" .autoPosition = ").append(isAutoPosition()).append('\n');
+ buffer.append(" .autoSeries = ").append(isAutoSeries()).append('\n');
+ buffer.append(" .autoXPositioning = ").append(isAutoXPositioning()).append('\n');
+ buffer.append(" .autoYPositioning = ").append(isAutoYPositioning()).append('\n');
+ buffer.append(" .vertical = ").append(isVertical()).append('\n');
+ buffer.append(" .dataTable = ").append(isDataTable()).append('\n');
+
+ buffer.append("[/LEGEND]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- LittleEndian.putInt(data, 4 + offset, field_1_xAxisUpperLeft);
- LittleEndian.putInt(data, 8 + offset, field_2_yAxisUpperLeft);
- 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);
+ LittleEndian.putInt(data, 4 + offset + pos, field_1_xAxisUpperLeft);
+ LittleEndian.putInt(data, 8 + offset + pos, field_2_yAxisUpperLeft);
+ LittleEndian.putInt(data, 12 + offset + pos, field_3_xSize);
+ LittleEndian.putInt(data, 16 + offset + pos, field_4_ySize);
+ data[ 20 + offset + pos ] = field_5_type;
+ data[ 21 + offset + pos ] = field_6_spacing;
+ LittleEndian.putShort(data, 22 + offset + pos, field_7_options);
return getRecordSize();
}
}
public Object clone() {
- LegendRecord rec = new LegendRecord();
-
- rec.field_1_xAxisUpperLeft = field_1_xAxisUpperLeft;
- rec.field_2_yAxisUpperLeft = field_2_yAxisUpperLeft;
- rec.field_3_xSize = field_3_xSize;
- rec.field_4_ySize = field_4_ySize;
- rec.field_5_type = field_5_type;
- rec.field_6_spacing = field_6_spacing;
- rec.field_7_options = field_7_options;
-
- return rec;
+ LegendRecord rec = new LegendRecord();
+
+ rec.field_1_xAxisUpperLeft = field_1_xAxisUpperLeft;
+ rec.field_2_yAxisUpperLeft = field_2_yAxisUpperLeft;
+ rec.field_3_xSize = field_3_xSize;
+ rec.field_4_ySize = field_4_ySize;
+ rec.field_5_type = field_5_type;
+ rec.field_6_spacing = field_6_spacing;
+ rec.field_7_options = field_7_options;
+ return rec;
}
+
+
/**
* Get the x axis upper left field for the Legend record.
*/
public LineFormatRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public LineFormatRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_lineColor = LittleEndian.getInt(data, 0x0 + offset);
- field_2_linePattern = LittleEndian.getShort(data, 0x4 + offset);
- field_3_weight = LittleEndian.getShort(data, 0x6 + offset);
- field_4_format = LittleEndian.getShort(data, 0x8 + offset);
- field_5_colourPaletteIndex = LittleEndian.getShort(data, 0xa + offset);
+
+ int pos = 0;
+ field_1_lineColor = LittleEndian.getInt(data, pos + 0x0 + offset);
+ field_2_linePattern = LittleEndian.getShort(data, pos + 0x4 + offset);
+ field_3_weight = LittleEndian.getShort(data, pos + 0x6 + offset);
+ field_4_format = LittleEndian.getShort(data, pos + 0x8 + offset);
+ field_5_colourPaletteIndex = LittleEndian.getShort(data, pos + 0xa + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[LineFormat]\n");
-
+ buffer.append("[LINEFORMAT]\n");
buffer.append(" .lineColor = ")
- .append("0x")
- .append(HexDump.toHex((int)getLineColor()))
- .append(" (").append(getLineColor()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getLineColor ()))
+ .append(" (").append( getLineColor() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .linePattern = ")
- .append("0x")
- .append(HexDump.toHex((short)getLinePattern()))
- .append(" (").append(getLinePattern()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getLinePattern ()))
+ .append(" (").append( getLinePattern() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .weight = ")
- .append("0x")
- .append(HexDump.toHex((short)getWeight()))
- .append(" (").append(getWeight()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getWeight ()))
+ .append(" (").append( getWeight() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .format = ")
- .append("0x")
- .append(HexDump.toHex((short)getFormat()))
- .append(" (").append(getFormat()).append(" )\n");
- buffer.append(" .auto = ").append(isAuto ()).append('\n');
- buffer.append(" .drawTicks = ").append(isDrawTicks ()).append('\n');
- buffer.append(" .unknown = ").append(isUnknown ()).append('\n');
-
+ .append("0x").append(HexDump.toHex( getFormat ()))
+ .append(" (").append( getFormat() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
+ buffer.append(" .auto = ").append(isAuto()).append('\n');
+ buffer.append(" .drawTicks = ").append(isDrawTicks()).append('\n');
+ buffer.append(" .unknown = ").append(isUnknown()).append('\n');
buffer.append(" .colourPaletteIndex = ")
- .append("0x")
- .append(HexDump.toHex((short)getColourPaletteIndex()))
- .append(" (").append(getColourPaletteIndex()).append(" )\n");
+ .append("0x").append(HexDump.toHex( getColourPaletteIndex ()))
+ .append(" (").append( getColourPaletteIndex() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
- buffer.append("[/LineFormat]\n");
+ buffer.append("[/LINEFORMAT]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- LittleEndian.putInt(data, 4 + offset, field_1_lineColor);
- LittleEndian.putShort(data, 8 + offset, field_2_linePattern);
- LittleEndian.putShort(data, 10 + offset, field_3_weight);
- LittleEndian.putShort(data, 12 + offset, field_4_format);
- LittleEndian.putShort(data, 14 + offset, field_5_colourPaletteIndex);
+ LittleEndian.putInt(data, 4 + offset + pos, field_1_lineColor);
+ LittleEndian.putShort(data, 8 + offset + pos, field_2_linePattern);
+ LittleEndian.putShort(data, 10 + offset + pos, field_3_weight);
+ LittleEndian.putShort(data, 12 + offset + pos, field_4_format);
+ LittleEndian.putShort(data, 14 + offset + pos, field_5_colourPaletteIndex);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 4 + 2 + 2 + 2 + 2;
+ return 4 + 4 + 2 + 2 + 2 + 2;
}
public short getSid()
}
public Object clone() {
- LineFormatRecord rec = new LineFormatRecord();
-
- rec.field_1_lineColor = field_1_lineColor;
- rec.field_2_linePattern = field_2_linePattern;
- rec.field_3_weight = field_3_weight;
- rec.field_4_format = field_4_format;
- rec.field_5_colourPaletteIndex = field_5_colourPaletteIndex;
-
- return rec;
+ LineFormatRecord rec = new LineFormatRecord();
+
+ rec.field_1_lineColor = field_1_lineColor;
+ rec.field_2_linePattern = field_2_linePattern;
+ rec.field_3_weight = field_3_weight;
+ rec.field_4_format = field_4_format;
+ rec.field_5_colourPaletteIndex = field_5_colourPaletteIndex;
+ return rec;
}
+
+
/**
* Get the line color field for the LineFormat record.
*/
--- /dev/null
+/* ====================================================================
+ * 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;
+
+/**
+ * Not implemented yet. May commit it anyway just so people can see
+ * where I'm heading.
+ *
+ * @author Glen Stampoultzis (glens at apache.org)
+ */
+public class LinkedDataFormulaField
+ implements CustomField
+{
+ public int getSize()
+ {
+ return 2;
+ }
+
+ public int fillField( byte[] data, short size, int offset )
+ {
+ return 0;
+ }
+
+ public void toString( StringBuffer str )
+ {
+ str.append("todo");
+ }
+
+ public int serializeField( int offset, byte[] data )
+ {
+ return 0;
+ }
+
+ public Object clone()
+ {
+ return this;
+ }
+
+}
private short field_3_options;
private BitField customNumberFormat = new BitField(0x1);
private short field_4_indexNumberFmtRecord;
- private short field_5_formulaOfLink;
+ private LinkedDataFormulaField field_5_formulaOfLink = new org.apache.poi.hssf.record.LinkedDataFormulaField();
public LinkedDataRecord()
public LinkedDataRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public LinkedDataRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_linkType = data[ 0x0 + offset ];
- field_2_referenceType = data[ 0x1 + offset ];
- field_3_options = LittleEndian.getShort(data, 0x2 + offset);
- field_4_indexNumberFmtRecord = LittleEndian.getShort(data, 0x4 + offset);
- field_5_formulaOfLink = LittleEndian.getShort(data, 0x6 + offset);
+
+ int pos = 0;
+ field_1_linkType = data[ pos + 0x0 + offset ];
+ field_2_referenceType = data[ pos + 0x1 + offset ];
+ field_3_options = LittleEndian.getShort(data, pos + 0x2 + offset);
+ field_4_indexNumberFmtRecord = LittleEndian.getShort(data, pos + 0x4 + offset);
+ field_5_formulaOfLink = new org.apache.poi.hssf.record.LinkedDataFormulaField();
+ pos += field_5_formulaOfLink.fillField(data,size,pos + 6);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[LinkedData]\n");
-
+ buffer.append("[AI]\n");
buffer.append(" .linkType = ")
- .append("0x")
- .append(HexDump.toHex((byte)getLinkType()))
- .append(" (").append(getLinkType()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getLinkType ()))
+ .append(" (").append( getLinkType() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .referenceType = ")
- .append("0x")
- .append(HexDump.toHex((byte)getReferenceType()))
- .append(" (").append(getReferenceType()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getReferenceType ()))
+ .append(" (").append( getReferenceType() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .options = ")
- .append("0x")
- .append(HexDump.toHex((short)getOptions()))
- .append(" (").append(getOptions()).append(" )\n");
- buffer.append(" .customNumberFormat = ").append(isCustomNumberFormat ()).append('\n');
-
+ .append("0x").append(HexDump.toHex( getOptions ()))
+ .append(" (").append( getOptions() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
+ buffer.append(" .customNumberFormat = ").append(isCustomNumberFormat()).append('\n');
buffer.append(" .indexNumberFmtRecord = ")
- .append("0x")
- .append(HexDump.toHex((short)getIndexNumberFmtRecord()))
- .append(" (").append(getIndexNumberFmtRecord()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getIndexNumberFmtRecord ()))
+ .append(" (").append( getIndexNumberFmtRecord() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .formulaOfLink = ")
- .append("0x")
- .append(HexDump.toHex((short)getFormulaOfLink()))
- .append(" (").append(getFormulaOfLink()).append(" )\n");
+ .append(" (").append( getFormulaOfLink() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
- buffer.append("[/LinkedData]\n");
+ buffer.append("[/AI]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- data[ 4 + offset ] = field_1_linkType;
- data[ 5 + offset ] = field_2_referenceType;
- LittleEndian.putShort(data, 6 + offset, field_3_options);
- LittleEndian.putShort(data, 8 + offset, field_4_indexNumberFmtRecord);
- LittleEndian.putShort(data, 10 + offset, field_5_formulaOfLink);
+ data[ 4 + offset + pos ] = field_1_linkType;
+ data[ 5 + offset + pos ] = field_2_referenceType;
+ LittleEndian.putShort(data, 6 + offset + pos, field_3_options);
+ LittleEndian.putShort(data, 8 + offset + pos, field_4_indexNumberFmtRecord);
+ pos += field_5_formulaOfLink.serializeField( pos + offset, data );
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 1 + 1 + 2 + 2 + 2;
+ return 4 + 1 + 1 + 2 + 2 + field_5_formulaOfLink.getSize();
}
public short getSid()
}
public Object clone() {
- LinkedDataRecord rec = new LinkedDataRecord();
-
- rec.field_1_linkType = field_1_linkType;
- rec.field_2_referenceType = field_2_referenceType;
- rec.field_3_options = field_3_options;
- rec.field_4_indexNumberFmtRecord = field_4_indexNumberFmtRecord;
- rec.field_5_formulaOfLink = field_5_formulaOfLink;
-
- return rec;
+ LinkedDataRecord rec = new LinkedDataRecord();
+
+ rec.field_1_linkType = field_1_linkType;
+ rec.field_2_referenceType = field_2_referenceType;
+ rec.field_3_options = field_3_options;
+ rec.field_4_indexNumberFmtRecord = field_4_indexNumberFmtRecord;
+ rec.field_5_formulaOfLink = ((org.apache.poi.hssf.record.LinkedDataFormulaField)field_5_formulaOfLink.clone());;
+ return rec;
}
+
+
/**
* Get the link type field for the LinkedData record.
*
/**
* Get the formula of link field for the LinkedData record.
*/
- public short getFormulaOfLink()
+ public LinkedDataFormulaField getFormulaOfLink()
{
return field_5_formulaOfLink;
}
/**
* Set the formula of link field for the LinkedData record.
*/
- public void setFormulaOfLink(short field_5_formulaOfLink)
+ public void setFormulaOfLink(LinkedDataFormulaField field_5_formulaOfLink)
{
this.field_5_formulaOfLink = field_5_formulaOfLink;
}
public NumberFormatIndexRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public NumberFormatIndexRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_formatIndex = LittleEndian.getShort(data, 0x0 + offset);
+
+ int pos = 0;
+ field_1_formatIndex = LittleEndian.getShort(data, pos + 0x0 + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[NumberFormatIndex]\n");
-
+ buffer.append("[IFMT]\n");
buffer.append(" .formatIndex = ")
- .append("0x")
- .append(HexDump.toHex((short)getFormatIndex()))
- .append(" (").append(getFormatIndex()).append(" )\n");
+ .append("0x").append(HexDump.toHex( getFormatIndex ()))
+ .append(" (").append( getFormatIndex() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
- buffer.append("[/NumberFormatIndex]\n");
+ buffer.append("[/IFMT]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- LittleEndian.putShort(data, 4 + offset, field_1_formatIndex);
+ LittleEndian.putShort(data, 4 + offset + pos, field_1_formatIndex);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 2;
+ return 4 + 2;
}
public short getSid()
}
public Object clone() {
- NumberFormatIndexRecord rec = new NumberFormatIndexRecord();
-
- rec.field_1_formatIndex = field_1_formatIndex;
-
- return rec;
+ NumberFormatIndexRecord rec = new NumberFormatIndexRecord();
+
+ rec.field_1_formatIndex = field_1_formatIndex;
+ return rec;
}
+
+
/**
* Get the format index field for the NumberFormatIndex record.
*/
public ObjectLinkRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public ObjectLinkRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_anchorId = LittleEndian.getShort(data, 0x0 + offset);
- field_2_link1 = LittleEndian.getShort(data, 0x2 + offset);
- field_3_link2 = LittleEndian.getShort(data, 0x4 + offset);
+
+ int pos = 0;
+ field_1_anchorId = LittleEndian.getShort(data, pos + 0x0 + offset);
+ field_2_link1 = LittleEndian.getShort(data, pos + 0x2 + offset);
+ field_3_link2 = LittleEndian.getShort(data, pos + 0x4 + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[ObjectLink]\n");
-
+ buffer.append("[OBJECTLINK]\n");
buffer.append(" .anchorId = ")
- .append("0x")
- .append(HexDump.toHex((short)getAnchorId()))
- .append(" (").append(getAnchorId()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getAnchorId ()))
+ .append(" (").append( getAnchorId() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .link1 = ")
- .append("0x")
- .append(HexDump.toHex((short)getLink1()))
- .append(" (").append(getLink1()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getLink1 ()))
+ .append(" (").append( getLink1() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .link2 = ")
- .append("0x")
- .append(HexDump.toHex((short)getLink2()))
- .append(" (").append(getLink2()).append(" )\n");
+ .append("0x").append(HexDump.toHex( getLink2 ()))
+ .append(" (").append( getLink2() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
- buffer.append("[/ObjectLink]\n");
+ buffer.append("[/OBJECTLINK]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- LittleEndian.putShort(data, 4 + offset, field_1_anchorId);
- LittleEndian.putShort(data, 6 + offset, field_2_link1);
- LittleEndian.putShort(data, 8 + offset, field_3_link2);
+ LittleEndian.putShort(data, 4 + offset + pos, field_1_anchorId);
+ LittleEndian.putShort(data, 6 + offset + pos, field_2_link1);
+ LittleEndian.putShort(data, 8 + offset + pos, field_3_link2);
return getRecordSize();
}
}
public Object clone() {
- ObjectLinkRecord rec = new ObjectLinkRecord();
-
- rec.field_1_anchorId = field_1_anchorId;
- rec.field_2_link1 = field_2_link1;
- rec.field_3_link2 = field_3_link2;
-
- return rec;
+ ObjectLinkRecord rec = new ObjectLinkRecord();
+
+ rec.field_1_anchorId = field_1_anchorId;
+ rec.field_2_link1 = field_2_link1;
+ rec.field_3_link2 = field_3_link2;
+ return rec;
}
+
+
/**
* Get the anchor id field for the ObjectLink record.
*
public PlotAreaRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public PlotAreaRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
+ int pos = 0;
+
}
public String toString()
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[PlotArea]\n");
+ buffer.append("[PLOTAREA]\n");
- buffer.append("[/PlotArea]\n");
+ buffer.append("[/PLOTAREA]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
}
public Object clone() {
- PlotAreaRecord rec = new PlotAreaRecord();
-
-
- return rec;
+ PlotAreaRecord rec = new PlotAreaRecord();
+
+ return rec;
}
+
+
} // END OF CLASS
public PlotGrowthRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public PlotGrowthRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_horizontalScale = LittleEndian.getInt(data, 0x0 + offset);
- field_2_verticalScale = LittleEndian.getInt(data, 0x4 + offset);
+
+ int pos = 0;
+ field_1_horizontalScale = LittleEndian.getInt(data, pos + 0x0 + offset);
+ field_2_verticalScale = LittleEndian.getInt(data, pos + 0x4 + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[PlotGrowth]\n");
-
+ buffer.append("[PLOTGROWTH]\n");
buffer.append(" .horizontalScale = ")
- .append("0x")
- .append(HexDump.toHex((int)getHorizontalScale()))
- .append(" (").append(getHorizontalScale()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getHorizontalScale ()))
+ .append(" (").append( getHorizontalScale() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .verticalScale = ")
- .append("0x")
- .append(HexDump.toHex((int)getVerticalScale()))
- .append(" (").append(getVerticalScale()).append(" )\n");
+ .append("0x").append(HexDump.toHex( getVerticalScale ()))
+ .append(" (").append( getVerticalScale() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
- buffer.append("[/PlotGrowth]\n");
+ buffer.append("[/PLOTGROWTH]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- LittleEndian.putInt(data, 4 + offset, field_1_horizontalScale);
- LittleEndian.putInt(data, 8 + offset, field_2_verticalScale);
+ LittleEndian.putInt(data, 4 + offset + pos, field_1_horizontalScale);
+ LittleEndian.putInt(data, 8 + offset + pos, field_2_verticalScale);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 4 + 4;
+ return 4 + 4 + 4;
}
public short getSid()
}
public Object clone() {
- PlotGrowthRecord rec = new PlotGrowthRecord();
-
- rec.field_1_horizontalScale = field_1_horizontalScale;
- rec.field_2_verticalScale = field_2_verticalScale;
-
- return rec;
+ PlotGrowthRecord rec = new PlotGrowthRecord();
+
+ rec.field_1_horizontalScale = field_1_horizontalScale;
+ rec.field_2_verticalScale = field_2_verticalScale;
+ return rec;
}
+
+
/**
* Get the horizontalScale field for the PlotGrowth record.
*/
public SCLRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public SCLRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_numerator = LittleEndian.getShort(data, 0x0 + offset);
- field_2_denominator = LittleEndian.getShort(data, 0x2 + offset);
+
+ int pos = 0;
+ field_1_numerator = LittleEndian.getShort(data, pos + 0x0 + offset);
+ field_2_denominator = LittleEndian.getShort(data, pos + 0x2 + offset);
}
StringBuffer buffer = new StringBuffer();
buffer.append("[SCL]\n");
-
buffer.append(" .numerator = ")
- .append("0x")
- .append(HexDump.toHex((short)getNumerator()))
- .append(" (").append(getNumerator()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getNumerator ()))
+ .append(" (").append( getNumerator() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .denominator = ")
- .append("0x")
- .append(HexDump.toHex((short)getDenominator()))
- .append(" (").append(getDenominator()).append(" )\n");
+ .append("0x").append(HexDump.toHex( getDenominator ()))
+ .append(" (").append( getDenominator() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append("[/SCL]\n");
return buffer.toString();
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- LittleEndian.putShort(data, 4 + offset, field_1_numerator);
- LittleEndian.putShort(data, 6 + offset, field_2_denominator);
+ LittleEndian.putShort(data, 4 + offset + pos, field_1_numerator);
+ LittleEndian.putShort(data, 6 + offset + pos, field_2_denominator);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 2 + 2;
+ return 4 + 2 + 2;
}
public short getSid()
}
public Object clone() {
- SCLRecord rec = new SCLRecord();
-
- rec.field_1_numerator = field_1_numerator;
- rec.field_2_denominator = field_2_denominator;
-
- return rec;
+ SCLRecord rec = new SCLRecord();
+
+ rec.field_1_numerator = field_1_numerator;
+ rec.field_2_denominator = field_2_denominator;
+ return rec;
}
+
+
/**
* Get the numerator field for the SCL record.
*/
public SeriesChartGroupIndexRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public SeriesChartGroupIndexRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_chartGroupIndex = LittleEndian.getShort(data, 0x0 + offset);
+
+ int pos = 0;
+ field_1_chartGroupIndex = LittleEndian.getShort(data, pos + 0x0 + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[SeriesChartGroupIndex]\n");
-
+ buffer.append("[SERTOCRT]\n");
buffer.append(" .chartGroupIndex = ")
- .append("0x")
- .append(HexDump.toHex((short)getChartGroupIndex()))
- .append(" (").append(getChartGroupIndex()).append(" )\n");
+ .append("0x").append(HexDump.toHex( getChartGroupIndex ()))
+ .append(" (").append( getChartGroupIndex() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
- buffer.append("[/SeriesChartGroupIndex]\n");
+ buffer.append("[/SERTOCRT]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- LittleEndian.putShort(data, 4 + offset, field_1_chartGroupIndex);
+ LittleEndian.putShort(data, 4 + offset + pos, field_1_chartGroupIndex);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 2;
+ return 4 + 2;
}
public short getSid()
}
public Object clone() {
- SeriesChartGroupIndexRecord rec = new SeriesChartGroupIndexRecord();
-
- rec.field_1_chartGroupIndex = field_1_chartGroupIndex;
-
- return rec;
+ SeriesChartGroupIndexRecord rec = new SeriesChartGroupIndexRecord();
+
+ rec.field_1_chartGroupIndex = field_1_chartGroupIndex;
+ return rec;
}
+
+
/**
* Get the chart group index field for the SeriesChartGroupIndex record.
*/
public SeriesIndexRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public SeriesIndexRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_index = LittleEndian.getShort(data, 0x0 + offset);
+
+ int pos = 0;
+ field_1_index = LittleEndian.getShort(data, pos + 0x0 + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[SeriesIndex]\n");
-
+ buffer.append("[SINDEX]\n");
buffer.append(" .index = ")
- .append("0x")
- .append(HexDump.toHex((short)getIndex()))
- .append(" (").append(getIndex()).append(" )\n");
+ .append("0x").append(HexDump.toHex( getIndex ()))
+ .append(" (").append( getIndex() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
- buffer.append("[/SeriesIndex]\n");
+ buffer.append("[/SINDEX]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- LittleEndian.putShort(data, 4 + offset, field_1_index);
+ LittleEndian.putShort(data, 4 + offset + pos, field_1_index);
return getRecordSize();
}
}
public Object clone() {
- SeriesIndexRecord rec = new SeriesIndexRecord();
-
- rec.field_1_index = field_1_index;
-
- return rec;
+ SeriesIndexRecord rec = new SeriesIndexRecord();
+
+ rec.field_1_index = field_1_index;
+ return rec;
}
+
+
/**
* Get the index field for the SeriesIndex record.
*/
public SeriesLabelsRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public SeriesLabelsRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_formatFlags = LittleEndian.getShort(data, 0x0 + offset);
+
+ int pos = 0;
+ field_1_formatFlags = LittleEndian.getShort(data, pos + 0x0 + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[SeriesLabels]\n");
-
+ buffer.append("[ATTACHEDLABEL]\n");
buffer.append(" .formatFlags = ")
- .append("0x")
- .append(HexDump.toHex((short)getFormatFlags()))
- .append(" (").append(getFormatFlags()).append(" )\n");
- buffer.append(" .showActual = ").append(isShowActual ()).append('\n');
- buffer.append(" .showPercent = ").append(isShowPercent ()).append('\n');
- buffer.append(" .labelAsPercentage = ").append(isLabelAsPercentage ()).append('\n');
- buffer.append(" .smoothedLine = ").append(isSmoothedLine ()).append('\n');
- buffer.append(" .showLabel = ").append(isShowLabel ()).append('\n');
- buffer.append(" .showBubbleSizes = ").append(isShowBubbleSizes ()).append('\n');
-
- buffer.append("[/SeriesLabels]\n");
+ .append("0x").append(HexDump.toHex( getFormatFlags ()))
+ .append(" (").append( getFormatFlags() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
+ buffer.append(" .showActual = ").append(isShowActual()).append('\n');
+ buffer.append(" .showPercent = ").append(isShowPercent()).append('\n');
+ buffer.append(" .labelAsPercentage = ").append(isLabelAsPercentage()).append('\n');
+ buffer.append(" .smoothedLine = ").append(isSmoothedLine()).append('\n');
+ buffer.append(" .showLabel = ").append(isShowLabel()).append('\n');
+ buffer.append(" .showBubbleSizes = ").append(isShowBubbleSizes()).append('\n');
+
+ buffer.append("[/ATTACHEDLABEL]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- LittleEndian.putShort(data, 4 + offset, field_1_formatFlags);
+ LittleEndian.putShort(data, 4 + offset + pos, field_1_formatFlags);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 2;
+ return 4 + 2;
}
public short getSid()
}
public Object clone() {
- SeriesLabelsRecord rec = new SeriesLabelsRecord();
-
- rec.field_1_formatFlags = field_1_formatFlags;
-
- return rec;
+ SeriesLabelsRecord rec = new SeriesLabelsRecord();
+
+ rec.field_1_formatFlags = field_1_formatFlags;
+ return rec;
}
+
+
/**
* Get the format flags field for the SeriesLabels record.
*/
public SeriesListRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public SeriesListRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_seriesNumbers = LittleEndian.getShortArray(data, 0x0 + offset);
+
+ int pos = 0;
+ field_1_seriesNumbers = LittleEndian.getShortArray(data, pos + 0x0 + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[SeriesList]\n");
-
+ buffer.append("[SERIESLIST]\n");
buffer.append(" .seriesNumbers = ")
- .append(" (").append(getSeriesNumbers()).append(" )\n");
+ .append(" (").append( getSeriesNumbers() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
- buffer.append("[/SeriesList]\n");
+ buffer.append("[/SERIESLIST]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- LittleEndian.putShortArray(data, 4 + offset, field_1_seriesNumbers);
+ LittleEndian.putShortArray(data, 4 + offset + pos, field_1_seriesNumbers);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + field_1_seriesNumbers.length * 2 + 2;
+ return 4 + field_1_seriesNumbers.length * 2 + 2;
}
public short getSid()
}
public Object clone() {
- SeriesListRecord rec = new SeriesListRecord();
-
- rec.field_1_seriesNumbers = field_1_seriesNumbers;
-
- return rec;
+ SeriesListRecord rec = new SeriesListRecord();
+
+ rec.field_1_seriesNumbers = field_1_seriesNumbers;
+ return rec;
}
+
+
/**
* Get the series numbers field for the SeriesList record.
*/
public SeriesRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public SeriesRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_categoryDataType = LittleEndian.getShort(data, 0x0 + offset);
- field_2_valuesDataType = LittleEndian.getShort(data, 0x2 + offset);
- field_3_numCategories = LittleEndian.getShort(data, 0x4 + offset);
- field_4_numValues = LittleEndian.getShort(data, 0x6 + offset);
- field_5_bubbleSeriesType = LittleEndian.getShort(data, 0x8 + offset);
- field_6_numBubbleValues = LittleEndian.getShort(data, 0xa + offset);
+
+ int pos = 0;
+ field_1_categoryDataType = LittleEndian.getShort(data, pos + 0x0 + offset);
+ field_2_valuesDataType = LittleEndian.getShort(data, pos + 0x2 + offset);
+ field_3_numCategories = LittleEndian.getShort(data, pos + 0x4 + offset);
+ field_4_numValues = LittleEndian.getShort(data, pos + 0x6 + offset);
+ field_5_bubbleSeriesType = LittleEndian.getShort(data, pos + 0x8 + offset);
+ field_6_numBubbleValues = LittleEndian.getShort(data, pos + 0xa + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[Series]\n");
-
+ buffer.append("[SERIES]\n");
buffer.append(" .categoryDataType = ")
- .append("0x")
- .append(HexDump.toHex((short)getCategoryDataType()))
- .append(" (").append(getCategoryDataType()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getCategoryDataType ()))
+ .append(" (").append( getCategoryDataType() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .valuesDataType = ")
- .append("0x")
- .append(HexDump.toHex((short)getValuesDataType()))
- .append(" (").append(getValuesDataType()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getValuesDataType ()))
+ .append(" (").append( getValuesDataType() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .numCategories = ")
- .append("0x")
- .append(HexDump.toHex((short)getNumCategories()))
- .append(" (").append(getNumCategories()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getNumCategories ()))
+ .append(" (").append( getNumCategories() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .numValues = ")
- .append("0x")
- .append(HexDump.toHex((short)getNumValues()))
- .append(" (").append(getNumValues()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getNumValues ()))
+ .append(" (").append( getNumValues() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .bubbleSeriesType = ")
- .append("0x")
- .append(HexDump.toHex((short)getBubbleSeriesType()))
- .append(" (").append(getBubbleSeriesType()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getBubbleSeriesType ()))
+ .append(" (").append( getBubbleSeriesType() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .numBubbleValues = ")
- .append("0x")
- .append(HexDump.toHex((short)getNumBubbleValues()))
- .append(" (").append(getNumBubbleValues()).append(" )\n");
+ .append("0x").append(HexDump.toHex( getNumBubbleValues ()))
+ .append(" (").append( getNumBubbleValues() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
- buffer.append("[/Series]\n");
+ buffer.append("[/SERIES]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
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);
+ LittleEndian.putShort(data, 4 + offset + pos, field_1_categoryDataType);
+ LittleEndian.putShort(data, 6 + offset + pos, field_2_valuesDataType);
+ LittleEndian.putShort(data, 8 + offset + pos, field_3_numCategories);
+ LittleEndian.putShort(data, 10 + offset + pos, field_4_numValues);
+ LittleEndian.putShort(data, 12 + offset + pos, field_5_bubbleSeriesType);
+ LittleEndian.putShort(data, 14 + offset + pos, field_6_numBubbleValues);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 2 + 2 + 2 + 2 + 2 + 2;
+ return 4 + 2 + 2 + 2 + 2 + 2 + 2;
}
public short getSid()
}
public Object clone() {
- SeriesRecord rec = new SeriesRecord();
-
- rec.field_1_categoryDataType = field_1_categoryDataType;
- rec.field_2_valuesDataType = field_2_valuesDataType;
- rec.field_3_numCategories = field_3_numCategories;
- rec.field_4_numValues = field_4_numValues;
- rec.field_5_bubbleSeriesType = field_5_bubbleSeriesType;
- rec.field_6_numBubbleValues = field_6_numBubbleValues;
-
- return rec;
+ SeriesRecord rec = new SeriesRecord();
+
+ rec.field_1_categoryDataType = field_1_categoryDataType;
+ rec.field_2_valuesDataType = field_2_valuesDataType;
+ rec.field_3_numCategories = field_3_numCategories;
+ rec.field_4_numValues = field_4_numValues;
+ rec.field_5_bubbleSeriesType = field_5_bubbleSeriesType;
+ rec.field_6_numBubbleValues = field_6_numBubbleValues;
+ return rec;
}
+
+
/**
* Get the category data type field for the Series record.
*
public SeriesTextRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public SeriesTextRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_id = LittleEndian.getShort(data, 0x0 + offset);
- field_2_textLength = data[ 0x2 + offset ];
- field_3_undocumented = data[ 0x3 + offset ];
- field_4_text = StringUtil.getFromUnicodeHigh(data, 0x4 + offset, ((field_2_textLength *2)/2));
+
+ int pos = 0;
+ field_1_id = LittleEndian.getShort(data, pos + 0x0 + offset);
+ field_2_textLength = data[ pos + 0x2 + offset ];
+ field_3_undocumented = data[ pos + 0x3 + offset ];
+ field_4_text = StringUtil.getFromUnicodeHigh(data, pos + 0x4 + offset, ((field_2_textLength *2)/2));
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[SeriesText]\n");
-
+ buffer.append("[SERIESTEXT]\n");
buffer.append(" .id = ")
- .append("0x")
- .append(HexDump.toHex((short)getId()))
- .append(" (").append(getId()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getId ()))
+ .append(" (").append( getId() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .textLength = ")
- .append("0x")
- .append(HexDump.toHex((byte)getTextLength()))
- .append(" (").append(getTextLength()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getTextLength ()))
+ .append(" (").append( getTextLength() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .undocumented = ")
- .append("0x")
- .append(HexDump.toHex((byte)getUndocumented()))
- .append(" (").append(getUndocumented()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getUndocumented ()))
+ .append(" (").append( getUndocumented() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .text = ")
- .append(" (").append(getText()).append(" )\n");
+ .append(" (").append( getText() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
- buffer.append("[/SeriesText]\n");
+ buffer.append("[/SERIESTEXT]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- LittleEndian.putShort(data, 4 + offset, field_1_id);
- data[ 6 + offset ] = field_2_textLength;
- data[ 7 + offset ] = field_3_undocumented;
- StringUtil.putUncompressedUnicodeHigh(field_4_text, data, 8 + offset);
+ LittleEndian.putShort(data, 4 + offset + pos, field_1_id);
+ data[ 6 + offset + pos ] = field_2_textLength;
+ data[ 7 + offset + pos ] = field_3_undocumented;
+ StringUtil.putUncompressedUnicodeHigh(field_4_text, data, 8 + offset + pos);
return getRecordSize();
}
}
public Object clone() {
- SeriesTextRecord rec = new SeriesTextRecord();
-
- rec.field_1_id = field_1_id;
- rec.field_2_textLength = field_2_textLength;
- rec.field_3_undocumented = field_3_undocumented;
- rec.field_4_text = field_4_text;
-
- return rec;
+ SeriesTextRecord rec = new SeriesTextRecord();
+
+ rec.field_1_id = field_1_id;
+ rec.field_2_textLength = field_2_textLength;
+ rec.field_3_undocumented = field_3_undocumented;
+ rec.field_4_text = field_4_text;
+ return rec;
}
+
+
/**
* Get the id field for the SeriesText record.
*/
public SeriesToChartGroupRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public SeriesToChartGroupRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_chartGroupIndex = LittleEndian.getShort(data, 0x0 + offset);
+
+ int pos = 0;
+ field_1_chartGroupIndex = LittleEndian.getShort(data, pos + 0x0 + offset);
}
StringBuffer buffer = new StringBuffer();
buffer.append("[SeriesToChartGroup]\n");
-
buffer.append(" .chartGroupIndex = ")
- .append("0x")
- .append(HexDump.toHex((short)getChartGroupIndex()))
- .append(" (").append(getChartGroupIndex()).append(" )\n");
+ .append("0x").append(HexDump.toHex( getChartGroupIndex ()))
+ .append(" (").append( getChartGroupIndex() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append("[/SeriesToChartGroup]\n");
return buffer.toString();
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- LittleEndian.putShort(data, 4 + offset, field_1_chartGroupIndex);
+ LittleEndian.putShort(data, 4 + offset + pos, field_1_chartGroupIndex);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 2;
+ return 4 + 2;
}
public short getSid()
}
public Object clone() {
- SeriesToChartGroupRecord rec = new SeriesToChartGroupRecord();
-
- rec.field_1_chartGroupIndex = field_1_chartGroupIndex;
-
- return rec;
+ SeriesToChartGroupRecord rec = new SeriesToChartGroupRecord();
+
+ rec.field_1_chartGroupIndex = field_1_chartGroupIndex;
+ return rec;
}
+
+
/**
* Get the chart group index field for the SeriesToChartGroup record.
*/
public SheetPropertiesRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public SheetPropertiesRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_flags = LittleEndian.getShort(data, 0x0 + offset);
- field_2_empty = data[ 0x2 + offset ];
+
+ int pos = 0;
+ field_1_flags = LittleEndian.getShort(data, pos + 0x0 + offset);
+ field_2_empty = data[ pos + 0x2 + offset ];
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[SheetProperties]\n");
-
+ buffer.append("[SHTPROPS]\n");
buffer.append(" .flags = ")
- .append("0x")
- .append(HexDump.toHex((short)getFlags()))
- .append(" (").append(getFlags()).append(" )\n");
- buffer.append(" .chartTypeManuallyFormatted = ").append(isChartTypeManuallyFormatted()).append('\n');
- buffer.append(" .plotVisibleOnly = ").append(isPlotVisibleOnly ()).append('\n');
- buffer.append(" .doNotSizeWithWindow = ").append(isDoNotSizeWithWindow ()).append('\n');
- buffer.append(" .defaultPlotDimensions = ").append(isDefaultPlotDimensions()).append('\n');
- buffer.append(" .autoPlotArea = ").append(isAutoPlotArea ()).append('\n');
-
+ .append("0x").append(HexDump.toHex( getFlags ()))
+ .append(" (").append( getFlags() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
+ buffer.append(" .chartTypeManuallyFormatted = ").append(isChartTypeManuallyFormatted()).append('\n');
+ buffer.append(" .plotVisibleOnly = ").append(isPlotVisibleOnly()).append('\n');
+ buffer.append(" .doNotSizeWithWindow = ").append(isDoNotSizeWithWindow()).append('\n');
+ buffer.append(" .defaultPlotDimensions = ").append(isDefaultPlotDimensions()).append('\n');
+ buffer.append(" .autoPlotArea = ").append(isAutoPlotArea()).append('\n');
buffer.append(" .empty = ")
- .append("0x")
- .append(HexDump.toHex((byte)getEmpty()))
- .append(" (").append(getEmpty()).append(" )\n");
+ .append("0x").append(HexDump.toHex( getEmpty ()))
+ .append(" (").append( getEmpty() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
- buffer.append("[/SheetProperties]\n");
+ buffer.append("[/SHTPROPS]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- LittleEndian.putShort(data, 4 + offset, field_1_flags);
- data[ 6 + offset ] = field_2_empty;
+ LittleEndian.putShort(data, 4 + offset + pos, field_1_flags);
+ data[ 6 + offset + pos ] = field_2_empty;
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 2 + 1;
+ return 4 + 2 + 1;
}
public short getSid()
}
public Object clone() {
- SheetPropertiesRecord rec = new SheetPropertiesRecord();
-
- rec.field_1_flags = field_1_flags;
- rec.field_2_empty = field_2_empty;
-
- return rec;
+ SheetPropertiesRecord rec = new SheetPropertiesRecord();
+
+ rec.field_1_flags = field_1_flags;
+ rec.field_2_empty = field_2_empty;
+ return rec;
}
+
+
/**
* Get the flags field for the SheetProperties record.
*/
public TextRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public TextRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_horizontalAlignment = data[ 0x0 + offset ];
- field_2_verticalAlignment = data[ 0x1 + offset ];
- field_3_displayMode = LittleEndian.getShort(data, 0x2 + offset);
- field_4_rgbColor = LittleEndian.getInt(data, 0x4 + offset);
- field_5_x = LittleEndian.getInt(data, 0x8 + offset);
- field_6_y = LittleEndian.getInt(data, 0xc + offset);
- field_7_width = LittleEndian.getInt(data, 0x10 + offset);
- field_8_height = LittleEndian.getInt(data, 0x14 + offset);
- field_9_options1 = LittleEndian.getShort(data, 0x18 + offset);
- field_10_indexOfColorValue = LittleEndian.getShort(data, 0x1a + offset);
- field_11_options2 = LittleEndian.getShort(data, 0x1c + offset);
- field_12_textRotation = LittleEndian.getShort(data, 0x1e + offset);
+
+ int pos = 0;
+ field_1_horizontalAlignment = data[ pos + 0x0 + offset ];
+ field_2_verticalAlignment = data[ pos + 0x1 + offset ];
+ field_3_displayMode = LittleEndian.getShort(data, pos + 0x2 + offset);
+ field_4_rgbColor = LittleEndian.getInt(data, pos + 0x4 + offset);
+ field_5_x = LittleEndian.getInt(data, pos + 0x8 + offset);
+ field_6_y = LittleEndian.getInt(data, pos + 0xc + offset);
+ field_7_width = LittleEndian.getInt(data, pos + 0x10 + offset);
+ field_8_height = LittleEndian.getInt(data, pos + 0x14 + offset);
+ field_9_options1 = LittleEndian.getShort(data, pos + 0x18 + offset);
+ field_10_indexOfColorValue = LittleEndian.getShort(data, pos + 0x1a + offset);
+ field_11_options2 = LittleEndian.getShort(data, pos + 0x1c + offset);
+ field_12_textRotation = LittleEndian.getShort(data, pos + 0x1e + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[Text]\n");
-
+ buffer.append("[TEXT]\n");
buffer.append(" .horizontalAlignment = ")
- .append("0x")
- .append(HexDump.toHex((byte)getHorizontalAlignment()))
- .append(" (").append(getHorizontalAlignment()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getHorizontalAlignment ()))
+ .append(" (").append( getHorizontalAlignment() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .verticalAlignment = ")
- .append("0x")
- .append(HexDump.toHex((byte)getVerticalAlignment()))
- .append(" (").append(getVerticalAlignment()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getVerticalAlignment ()))
+ .append(" (").append( getVerticalAlignment() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .displayMode = ")
- .append("0x")
- .append(HexDump.toHex((short)getDisplayMode()))
- .append(" (").append(getDisplayMode()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getDisplayMode ()))
+ .append(" (").append( getDisplayMode() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .rgbColor = ")
- .append("0x")
- .append(HexDump.toHex((int)getRgbColor()))
- .append(" (").append(getRgbColor()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getRgbColor ()))
+ .append(" (").append( getRgbColor() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .x = ")
- .append("0x")
- .append(HexDump.toHex((int)getX()))
- .append(" (").append(getX()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getX ()))
+ .append(" (").append( getX() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .y = ")
- .append("0x")
- .append(HexDump.toHex((int)getY()))
- .append(" (").append(getY()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getY ()))
+ .append(" (").append( getY() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .width = ")
- .append("0x")
- .append(HexDump.toHex((int)getWidth()))
- .append(" (").append(getWidth()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getWidth ()))
+ .append(" (").append( getWidth() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .height = ")
- .append("0x")
- .append(HexDump.toHex((int)getHeight()))
- .append(" (").append(getHeight()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getHeight ()))
+ .append(" (").append( getHeight() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .options1 = ")
- .append("0x")
- .append(HexDump.toHex((short)getOptions1()))
- .append(" (").append(getOptions1()).append(" )\n");
- buffer.append(" .autoColor = ").append(isAutoColor ()).append('\n');
- buffer.append(" .showKey = ").append(isShowKey ()).append('\n');
- buffer.append(" .showValue = ").append(isShowValue ()).append('\n');
- buffer.append(" .vertical = ").append(isVertical ()).append('\n');
- buffer.append(" .autoGeneratedText = ").append(isAutoGeneratedText ()).append('\n');
- buffer.append(" .generated = ").append(isGenerated ()).append('\n');
- buffer.append(" .autoLabelDeleted = ").append(isAutoLabelDeleted ()).append('\n');
- buffer.append(" .autoBackground = ").append(isAutoBackground ()).append('\n');
- buffer.append(" .rotation = ").append(getRotation ()).append('\n');
- buffer.append(" .showCategoryLabelAsPercentage = ").append(isShowCategoryLabelAsPercentage()).append('\n');
- buffer.append(" .showValueAsPercentage = ").append(isShowValueAsPercentage()).append('\n');
- buffer.append(" .showBubbleSizes = ").append(isShowBubbleSizes ()).append('\n');
- buffer.append(" .showLabel = ").append(isShowLabel ()).append('\n');
-
+ .append("0x").append(HexDump.toHex( getOptions1 ()))
+ .append(" (").append( getOptions1() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
+ buffer.append(" .autoColor = ").append(isAutoColor()).append('\n');
+ buffer.append(" .showKey = ").append(isShowKey()).append('\n');
+ buffer.append(" .showValue = ").append(isShowValue()).append('\n');
+ buffer.append(" .vertical = ").append(isVertical()).append('\n');
+ buffer.append(" .autoGeneratedText = ").append(isAutoGeneratedText()).append('\n');
+ buffer.append(" .generated = ").append(isGenerated()).append('\n');
+ buffer.append(" .autoLabelDeleted = ").append(isAutoLabelDeleted()).append('\n');
+ buffer.append(" .autoBackground = ").append(isAutoBackground()).append('\n');
+ buffer.append(" .rotation = ").append(getRotation()).append('\n');
+ buffer.append(" .showCategoryLabelAsPercentage = ").append(isShowCategoryLabelAsPercentage()).append('\n');
+ buffer.append(" .showValueAsPercentage = ").append(isShowValueAsPercentage()).append('\n');
+ buffer.append(" .showBubbleSizes = ").append(isShowBubbleSizes()).append('\n');
+ buffer.append(" .showLabel = ").append(isShowLabel()).append('\n');
buffer.append(" .indexOfColorValue = ")
- .append("0x")
- .append(HexDump.toHex((short)getIndexOfColorValue()))
- .append(" (").append(getIndexOfColorValue()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getIndexOfColorValue ()))
+ .append(" (").append( getIndexOfColorValue() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .options2 = ")
- .append("0x")
- .append(HexDump.toHex((short)getOptions2()))
- .append(" (").append(getOptions2()).append(" )\n");
- buffer.append(" .dataLabelPlacement = ").append(getDataLabelPlacement ()).append('\n');
-
+ .append("0x").append(HexDump.toHex( getOptions2 ()))
+ .append(" (").append( getOptions2() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
+ buffer.append(" .dataLabelPlacement = ").append(getDataLabelPlacement()).append('\n');
buffer.append(" .textRotation = ")
- .append("0x")
- .append(HexDump.toHex((short)getTextRotation()))
- .append(" (").append(getTextRotation()).append(" )\n");
+ .append("0x").append(HexDump.toHex( getTextRotation ()))
+ .append(" (").append( getTextRotation() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
- buffer.append("[/Text]\n");
+ buffer.append("[/TEXT]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- data[ 4 + offset ] = field_1_horizontalAlignment;
- data[ 5 + offset ] = field_2_verticalAlignment;
- LittleEndian.putShort(data, 6 + offset, field_3_displayMode);
- LittleEndian.putInt(data, 8 + offset, field_4_rgbColor);
- LittleEndian.putInt(data, 12 + offset, field_5_x);
- LittleEndian.putInt(data, 16 + offset, field_6_y);
- LittleEndian.putInt(data, 20 + offset, field_7_width);
- LittleEndian.putInt(data, 24 + offset, field_8_height);
- LittleEndian.putShort(data, 28 + offset, field_9_options1);
- LittleEndian.putShort(data, 30 + offset, field_10_indexOfColorValue);
- LittleEndian.putShort(data, 32 + offset, field_11_options2);
- LittleEndian.putShort(data, 34 + offset, field_12_textRotation);
+ data[ 4 + offset + pos ] = field_1_horizontalAlignment;
+ data[ 5 + offset + pos ] = field_2_verticalAlignment;
+ LittleEndian.putShort(data, 6 + offset + pos, field_3_displayMode);
+ LittleEndian.putInt(data, 8 + offset + pos, field_4_rgbColor);
+ LittleEndian.putInt(data, 12 + offset + pos, field_5_x);
+ LittleEndian.putInt(data, 16 + offset + pos, field_6_y);
+ LittleEndian.putInt(data, 20 + offset + pos, field_7_width);
+ LittleEndian.putInt(data, 24 + offset + pos, field_8_height);
+ LittleEndian.putShort(data, 28 + offset + pos, field_9_options1);
+ LittleEndian.putShort(data, 30 + offset + pos, field_10_indexOfColorValue);
+ LittleEndian.putShort(data, 32 + offset + pos, field_11_options2);
+ LittleEndian.putShort(data, 34 + offset + pos, field_12_textRotation);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 1 + 1 + 2 + 4 + 4 + 4 + 4 + 4 + 2 + 2 + 2 + 2;
+ return 4 + 1 + 1 + 2 + 4 + 4 + 4 + 4 + 4 + 2 + 2 + 2 + 2;
}
public short getSid()
}
public Object clone() {
- TextRecord rec = new TextRecord();
-
- rec.field_1_horizontalAlignment = field_1_horizontalAlignment;
- rec.field_2_verticalAlignment = field_2_verticalAlignment;
- rec.field_3_displayMode = field_3_displayMode;
- rec.field_4_rgbColor = field_4_rgbColor;
- rec.field_5_x = field_5_x;
- rec.field_6_y = field_6_y;
- rec.field_7_width = field_7_width;
- rec.field_8_height = field_8_height;
- rec.field_9_options1 = field_9_options1;
- rec.field_10_indexOfColorValue = field_10_indexOfColorValue;
- rec.field_11_options2 = field_11_options2;
- rec.field_12_textRotation = field_12_textRotation;
-
- return rec;
+ TextRecord rec = new TextRecord();
+
+ rec.field_1_horizontalAlignment = field_1_horizontalAlignment;
+ rec.field_2_verticalAlignment = field_2_verticalAlignment;
+ rec.field_3_displayMode = field_3_displayMode;
+ rec.field_4_rgbColor = field_4_rgbColor;
+ rec.field_5_x = field_5_x;
+ rec.field_6_y = field_6_y;
+ rec.field_7_width = field_7_width;
+ rec.field_8_height = field_8_height;
+ rec.field_9_options1 = field_9_options1;
+ rec.field_10_indexOfColorValue = field_10_indexOfColorValue;
+ rec.field_11_options2 = field_11_options2;
+ rec.field_12_textRotation = field_12_textRotation;
+ return rec;
}
+
+
/**
* Get the horizontal alignment field for the Text record.
*
public TickRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public TickRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_majorTickType = data[ 0x0 + offset ];
- field_2_minorTickType = data[ 0x1 + offset ];
- field_3_labelPosition = data[ 0x2 + offset ];
- field_4_background = data[ 0x3 + offset ];
- field_5_labelColorRgb = LittleEndian.getInt(data, 0x4 + offset);
- field_6_zero1 = LittleEndian.getShort(data, 0x8 + offset);
- field_7_zero2 = LittleEndian.getShort(data, 0x10 + offset);
- field_8_options = LittleEndian.getShort(data, 0x18 + offset);
- field_9_tickColor = LittleEndian.getShort(data, 0x1a + offset);
- field_10_zero3 = LittleEndian.getShort(data, 0x1c + offset);
+
+ int pos = 0;
+ field_1_majorTickType = data[ pos + 0x0 + offset ];
+ field_2_minorTickType = data[ pos + 0x1 + offset ];
+ field_3_labelPosition = data[ pos + 0x2 + offset ];
+ field_4_background = data[ pos + 0x3 + offset ];
+ field_5_labelColorRgb = LittleEndian.getInt(data, pos + 0x4 + offset);
+ field_6_zero1 = LittleEndian.getShort(data, pos + 0x8 + offset);
+ field_7_zero2 = LittleEndian.getShort(data, pos + 0x10 + offset);
+ field_8_options = LittleEndian.getShort(data, pos + 0x18 + offset);
+ field_9_tickColor = LittleEndian.getShort(data, pos + 0x1a + offset);
+ field_10_zero3 = LittleEndian.getShort(data, pos + 0x1c + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[Tick]\n");
-
+ buffer.append("[TICK]\n");
buffer.append(" .majorTickType = ")
- .append("0x")
- .append(HexDump.toHex((byte)getMajorTickType()))
- .append(" (").append(getMajorTickType()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getMajorTickType ()))
+ .append(" (").append( getMajorTickType() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .minorTickType = ")
- .append("0x")
- .append(HexDump.toHex((byte)getMinorTickType()))
- .append(" (").append(getMinorTickType()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getMinorTickType ()))
+ .append(" (").append( getMinorTickType() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .labelPosition = ")
- .append("0x")
- .append(HexDump.toHex((byte)getLabelPosition()))
- .append(" (").append(getLabelPosition()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getLabelPosition ()))
+ .append(" (").append( getLabelPosition() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .background = ")
- .append("0x")
- .append(HexDump.toHex((byte)getBackground()))
- .append(" (").append(getBackground()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getBackground ()))
+ .append(" (").append( getBackground() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .labelColorRgb = ")
- .append("0x")
- .append(HexDump.toHex((int)getLabelColorRgb()))
- .append(" (").append(getLabelColorRgb()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getLabelColorRgb ()))
+ .append(" (").append( getLabelColorRgb() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .zero1 = ")
- .append("0x")
- .append(HexDump.toHex((short)getZero1()))
- .append(" (").append(getZero1()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getZero1 ()))
+ .append(" (").append( getZero1() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .zero2 = ")
- .append("0x")
- .append(HexDump.toHex((short)getZero2()))
- .append(" (").append(getZero2()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getZero2 ()))
+ .append(" (").append( getZero2() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .options = ")
- .append("0x")
- .append(HexDump.toHex((short)getOptions()))
- .append(" (").append(getOptions()).append(" )\n");
- buffer.append(" .autoTextColor = ").append(isAutoTextColor ()).append('\n');
- buffer.append(" .autoTextBackground = ").append(isAutoTextBackground ()).append('\n');
- buffer.append(" .rotation = ").append(getRotation ()).append('\n');
- buffer.append(" .autorotate = ").append(isAutorotate ()).append('\n');
-
+ .append("0x").append(HexDump.toHex( getOptions ()))
+ .append(" (").append( getOptions() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
+ buffer.append(" .autoTextColor = ").append(isAutoTextColor()).append('\n');
+ buffer.append(" .autoTextBackground = ").append(isAutoTextBackground()).append('\n');
+ buffer.append(" .rotation = ").append(getRotation()).append('\n');
+ buffer.append(" .autorotate = ").append(isAutorotate()).append('\n');
buffer.append(" .tickColor = ")
- .append("0x")
- .append(HexDump.toHex((short)getTickColor()))
- .append(" (").append(getTickColor()).append(" )\n");
-
+ .append("0x").append(HexDump.toHex( getTickColor ()))
+ .append(" (").append( getTickColor() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .zero3 = ")
- .append("0x")
- .append(HexDump.toHex((short)getZero3()))
- .append(" (").append(getZero3()).append(" )\n");
+ .append("0x").append(HexDump.toHex( getZero3 ()))
+ .append(" (").append( getZero3() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
- buffer.append("[/Tick]\n");
+ buffer.append("[/TICK]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- data[ 4 + offset ] = field_1_majorTickType;
- data[ 5 + offset ] = field_2_minorTickType;
- data[ 6 + offset ] = field_3_labelPosition;
- data[ 7 + offset ] = field_4_background;
- LittleEndian.putInt(data, 8 + offset, field_5_labelColorRgb);
- LittleEndian.putShort(data, 12 + offset, field_6_zero1);
- LittleEndian.putShort(data, 20 + offset, field_7_zero2);
- LittleEndian.putShort(data, 28 + offset, field_8_options);
- LittleEndian.putShort(data, 30 + offset, field_9_tickColor);
- LittleEndian.putShort(data, 32 + offset, field_10_zero3);
+ data[ 4 + offset + pos ] = field_1_majorTickType;
+ data[ 5 + offset + pos ] = field_2_minorTickType;
+ data[ 6 + offset + pos ] = field_3_labelPosition;
+ data[ 7 + offset + pos ] = field_4_background;
+ LittleEndian.putInt(data, 8 + offset + pos, field_5_labelColorRgb);
+ LittleEndian.putShort(data, 12 + offset + pos, field_6_zero1);
+ LittleEndian.putShort(data, 20 + offset + pos, field_7_zero2);
+ LittleEndian.putShort(data, 28 + offset + pos, field_8_options);
+ LittleEndian.putShort(data, 30 + offset + pos, field_9_tickColor);
+ LittleEndian.putShort(data, 32 + offset + pos, field_10_zero3);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 1 + 1 + 1 + 1 + 4 + 8 + 8 + 2 + 2 + 2;
+ return 4 + 1 + 1 + 1 + 1 + 4 + 8 + 8 + 2 + 2 + 2;
}
public short getSid()
}
public Object clone() {
- TickRecord rec = new TickRecord();
-
- rec.field_1_majorTickType = field_1_majorTickType;
- rec.field_2_minorTickType = field_2_minorTickType;
- rec.field_3_labelPosition = field_3_labelPosition;
- rec.field_4_background = field_4_background;
- rec.field_5_labelColorRgb = field_5_labelColorRgb;
- rec.field_6_zero1 = field_6_zero1;
- rec.field_7_zero2 = field_7_zero2;
- rec.field_8_options = field_8_options;
- rec.field_9_tickColor = field_9_tickColor;
- rec.field_10_zero3 = field_10_zero3;
-
- return rec;
+ TickRecord rec = new TickRecord();
+
+ rec.field_1_majorTickType = field_1_majorTickType;
+ rec.field_2_minorTickType = field_2_minorTickType;
+ rec.field_3_labelPosition = field_3_labelPosition;
+ rec.field_4_background = field_4_background;
+ rec.field_5_labelColorRgb = field_5_labelColorRgb;
+ rec.field_6_zero1 = field_6_zero1;
+ rec.field_7_zero2 = field_7_zero2;
+ rec.field_8_options = field_8_options;
+ rec.field_9_tickColor = field_9_tickColor;
+ rec.field_10_zero3 = field_10_zero3;
+ return rec;
}
+
+
/**
* Get the major tick type field for the Tick record.
*/
public UnitsRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public UnitsRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_units = LittleEndian.getShort(data, 0x0 + offset);
+
+ int pos = 0;
+ field_1_units = LittleEndian.getShort(data, pos + 0x0 + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[Units]\n");
-
+ buffer.append("[UNITS]\n");
buffer.append(" .units = ")
- .append("0x")
- .append(HexDump.toHex((short)getUnits()))
- .append(" (").append(getUnits()).append(" )\n");
+ .append("0x").append(HexDump.toHex( getUnits ()))
+ .append(" (").append( getUnits() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
- buffer.append("[/Units]\n");
+ buffer.append("[/UNITS]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- LittleEndian.putShort(data, 4 + offset, field_1_units);
+ LittleEndian.putShort(data, 4 + offset + pos, field_1_units);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 2;
+ return 4 + 2;
}
public short getSid()
}
public Object clone() {
- UnitsRecord rec = new UnitsRecord();
-
- rec.field_1_units = field_1_units;
-
- return rec;
+ UnitsRecord rec = new UnitsRecord();
+
+ rec.field_1_units = field_1_units;
+ return rec;
}
+
+
/**
* Get the units field for the Units record.
*/
public ValueRangeRecord(short id, short size, byte [] data)
{
super(id, size, data);
+
}
/**
public ValueRangeRecord(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
- field_1_minimumAxisValue = LittleEndian.getDouble(data, 0x0 + offset);
- field_2_maximumAxisValue = LittleEndian.getDouble(data, 0x8 + offset);
- field_3_majorIncrement = LittleEndian.getDouble(data, 0x10 + offset);
- field_4_minorIncrement = LittleEndian.getDouble(data, 0x18 + offset);
- field_5_categoryAxisCross = LittleEndian.getDouble(data, 0x20 + offset);
- field_6_options = LittleEndian.getShort(data, 0x28 + offset);
+
+ int pos = 0;
+ field_1_minimumAxisValue = LittleEndian.getDouble(data, pos + 0x0 + offset);
+ field_2_maximumAxisValue = LittleEndian.getDouble(data, pos + 0x8 + offset);
+ field_3_majorIncrement = LittleEndian.getDouble(data, pos + 0x10 + offset);
+ field_4_minorIncrement = LittleEndian.getDouble(data, pos + 0x18 + offset);
+ field_5_categoryAxisCross = LittleEndian.getDouble(data, pos + 0x20 + offset);
+ field_6_options = LittleEndian.getShort(data, pos + 0x28 + offset);
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[ValueRange]\n");
-
+ buffer.append("[VALUERANGE]\n");
buffer.append(" .minimumAxisValue = ")
- .append(" (").append(getMinimumAxisValue()).append(" )\n");
-
+ .append(" (").append( getMinimumAxisValue() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .maximumAxisValue = ")
- .append(" (").append(getMaximumAxisValue()).append(" )\n");
-
+ .append(" (").append( getMaximumAxisValue() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .majorIncrement = ")
- .append(" (").append(getMajorIncrement()).append(" )\n");
-
+ .append(" (").append( getMajorIncrement() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .minorIncrement = ")
- .append(" (").append(getMinorIncrement()).append(" )\n");
-
+ .append(" (").append( getMinorIncrement() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .categoryAxisCross = ")
- .append(" (").append(getCategoryAxisCross()).append(" )\n");
-
+ .append(" (").append( getCategoryAxisCross() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
buffer.append(" .options = ")
- .append("0x")
- .append(HexDump.toHex((short)getOptions()))
- .append(" (").append(getOptions()).append(" )\n");
- buffer.append(" .automaticMinimum = ").append(isAutomaticMinimum ()).append('\n');
- buffer.append(" .automaticMaximum = ").append(isAutomaticMaximum ()).append('\n');
- buffer.append(" .automaticMajor = ").append(isAutomaticMajor ()).append('\n');
- buffer.append(" .automaticMinor = ").append(isAutomaticMinor ()).append('\n');
- buffer.append(" .automaticCategoryCrossing = ").append(isAutomaticCategoryCrossing()).append('\n');
- buffer.append(" .logarithmicScale = ").append(isLogarithmicScale ()).append('\n');
- buffer.append(" .valuesInReverse = ").append(isValuesInReverse ()).append('\n');
- buffer.append(" .crossCategoryAxisAtMaximum = ").append(isCrossCategoryAxisAtMaximum()).append('\n');
- buffer.append(" .reserved = ").append(isReserved ()).append('\n');
-
- buffer.append("[/ValueRange]\n");
+ .append("0x").append(HexDump.toHex( getOptions ()))
+ .append(" (").append( getOptions() ).append(" )");
+ buffer.append(System.getProperty("line.separator"));
+ buffer.append(" .automaticMinimum = ").append(isAutomaticMinimum()).append('\n');
+ buffer.append(" .automaticMaximum = ").append(isAutomaticMaximum()).append('\n');
+ buffer.append(" .automaticMajor = ").append(isAutomaticMajor()).append('\n');
+ buffer.append(" .automaticMinor = ").append(isAutomaticMinor()).append('\n');
+ buffer.append(" .automaticCategoryCrossing = ").append(isAutomaticCategoryCrossing()).append('\n');
+ buffer.append(" .logarithmicScale = ").append(isLogarithmicScale()).append('\n');
+ buffer.append(" .valuesInReverse = ").append(isValuesInReverse()).append('\n');
+ buffer.append(" .crossCategoryAxisAtMaximum = ").append(isCrossCategoryAxisAtMaximum()).append('\n');
+ buffer.append(" .reserved = ").append(isReserved()).append('\n');
+
+ buffer.append("[/VALUERANGE]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
- LittleEndian.putDouble(data, 4 + offset, field_1_minimumAxisValue);
- LittleEndian.putDouble(data, 12 + offset, field_2_maximumAxisValue);
- LittleEndian.putDouble(data, 20 + offset, field_3_majorIncrement);
- LittleEndian.putDouble(data, 28 + offset, field_4_minorIncrement);
- LittleEndian.putDouble(data, 36 + offset, field_5_categoryAxisCross);
- LittleEndian.putShort(data, 44 + offset, field_6_options);
+ LittleEndian.putDouble(data, 4 + offset + pos, field_1_minimumAxisValue);
+ LittleEndian.putDouble(data, 12 + offset + pos, field_2_maximumAxisValue);
+ LittleEndian.putDouble(data, 20 + offset + pos, field_3_majorIncrement);
+ LittleEndian.putDouble(data, 28 + offset + pos, field_4_minorIncrement);
+ LittleEndian.putDouble(data, 36 + offset + pos, field_5_categoryAxisCross);
+ LittleEndian.putShort(data, 44 + offset + pos, field_6_options);
return getRecordSize();
}
*/
public int getRecordSize()
{
- return 4 + 8 + 8 + 8 + 8 + 8 + 2;
+ return 4 + 8 + 8 + 8 + 8 + 8 + 2;
}
public short getSid()
return this.sid;
}
+ public Object clone() {
+ ValueRangeRecord rec = new ValueRangeRecord();
+
+ rec.field_1_minimumAxisValue = field_1_minimumAxisValue;
+ rec.field_2_maximumAxisValue = field_2_maximumAxisValue;
+ rec.field_3_majorIncrement = field_3_majorIncrement;
+ rec.field_4_minorIncrement = field_4_minorIncrement;
+ rec.field_5_categoryAxisCross = field_5_categoryAxisCross;
+ rec.field_6_options = field_6_options;
+ return rec;
+ }
+
+
+
/**
* Get the minimum axis value field for the ValueRange record.
*/
package org.apache.poi.hssf.usermodel;
-import java.util.Vector;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Iterator;
-
import org.apache.poi.hssf.model.Workbook;
-import org.apache.poi.hssf.record.Record;
import org.apache.poi.hssf.record.FormatRecord;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Vector;
+
/**
* Utility to identify builin formats. Now can handle user defined data formats also. The following is a list of the formats as
* returned by this class.<P>
*<P>
- * 0, "General"<P>
- * 1, "0"<P>
- * 2, "0.00"<P>
- * 3, "#,##0"<P>
- * 4, "#,##0.00"<P>
- * 5, "($#,##0_);($#,##0)"<P>
- * 6, "($#,##0_);[Red]($#,##0)"<P>
- * 7, "($#,##0.00);($#,##0.00)"<P>
- * 8, "($#,##0.00_);[Red]($#,##0.00)"<P>
- * 9, "0%"<P>
- * 0xa, "0.00%"<P>
- * 0xb, "0.00E+00"<P>
- * 0xc, "# ?/?"<P>
- * 0xd, "# ??/??"<P>
- * 0xe, "m/d/yy"<P>
- * 0xf, "d-mmm-yy"<P>
- * 0x10, "d-mmm"<P>
- * 0x11, "mmm-yy"<P>
- * 0x12, "h:mm AM/PM"<P>
- * 0x13, "h:mm:ss AM/PM"<P>
- * 0x14, "h:mm"<P>
- * 0x15, "h:mm:ss"<P>
- * 0x16, "m/d/yy h:mm"<P>
+ * 0, "General"<br>
+ * 1, "0"<br>
+ * 2, "0.00"<br>
+ * 3, "#,##0"<br>
+ * 4, "#,##0.00"<br>
+ * 5, "($#,##0_);($#,##0)"<br>
+ * 6, "($#,##0_);[Red]($#,##0)"<br>
+ * 7, "($#,##0.00);($#,##0.00)"<br>
+ * 8, "($#,##0.00_);[Red]($#,##0.00)"<br>
+ * 9, "0%"<br>
+ * 0xa, "0.00%"<br>
+ * 0xb, "0.00E+00"<br>
+ * 0xc, "# ?/?"<br>
+ * 0xd, "# ??/??"<br>
+ * 0xe, "m/d/yy"<br>
+ * 0xf, "d-mmm-yy"<br>
+ * 0x10, "d-mmm"<br>
+ * 0x11, "mmm-yy"<br>
+ * 0x12, "h:mm AM/PM"<br>
+ * 0x13, "h:mm:ss AM/PM"<br>
+ * 0x14, "h:mm"<br>
+ * 0x15, "h:mm:ss"<br>
+ * 0x16, "m/d/yy h:mm"<br>
*<P>
- * // 0x17 - 0x24 reserved for international and undocumented
- * 0x25, "(#,##0_);(#,##0)"<P>
- * 0x26, "(#,##0_);[Red](#,##0)"<P>
- * 0x27, "(#,##0.00_);(#,##0.00)"<P>
- * 0x28, "(#,##0.00_);[Red](#,##0.00)"<P>
- * 0x29, "_(*#,##0_);_(*(#,##0);_(* \"-\"_);_(@_)"<P>
- * 0x2a, "_($*#,##0_);_($*(#,##0);_($* \"-\"_);_(@_)"<P>
- * 0x2b, "_(*#,##0.00_);_(*(#,##0.00);_(*\"-\"??_);_(@_)"<P>
- * 0x2c, "_($*#,##0.00_);_($*(#,##0.00);_($*\"-\"??_);_(@_)"<P>
- * 0x2d, "mm:ss"<P>
- * 0x2e, "[h]:mm:ss"<P>
- * 0x2f, "mm:ss.0"<P>
- * 0x30, "##0.0E+0"<P>
- * 0x31, "@"<P>
+ * // 0x17 - 0x24 reserved for international and undocumented<br>
+ * 0x25, "(#,##0_);(#,##0)"<br>
+ * 0x26, "(#,##0_);[Red](#,##0)"<br>
+ * 0x27, "(#,##0.00_);(#,##0.00)"<br>
+ * 0x28, "(#,##0.00_);[Red](#,##0.00)"<br>
+ * 0x29, "_(*#,##0_);_(*(#,##0);_(* \"-\"_);_(@_)"<br>
+ * 0x2a, "_($*#,##0_);_($*(#,##0);_($* \"-\"_);_(@_)"<br>
+ * 0x2b, "_(*#,##0.00_);_(*(#,##0.00);_(*\"-\"??_);_(@_)"<br>
+ * 0x2c, "_($*#,##0.00_);_($*(#,##0.00);_($*\"-\"??_);_(@_)"<br>
+ * 0x2d, "mm:ss"<br>
+ * 0x2e, "[h]:mm:ss"<br>
+ * 0x2f, "mm:ss.0"<br>
+ * 0x30, "##0.0E+0"<br>
+ * 0x31, "@"<br>
*
*
* @author Andrew C. Oliver (acoliver at apache dot org)
private Vector formats = new Vector();
private Workbook workbook;
private boolean movedBuiltins = false; // Flag to see if need to
- // check the built in list
- // or if the regular list
- // has all entries.
+ // check the built in list
+ // or if the regular list
+ // has all entries.
- /**
+ /**
* Construncts a new data formatter. It takes a workbook to have
* access to the workbooks format records.
* @param workbook the workbook the formats are tied to.
*/
- public HSSFDataFormat(Workbook workbook) {
- this.workbook = workbook;
- if (builtinFormats == null) populateBuiltinFormats();
- Iterator i = workbook.getFormats().iterator();
- while (i.hasNext()) {
- FormatRecord r = (FormatRecord)i.next();
- if (formats.size() < r.getIndexCode() + 1) {
- formats.setSize(r.getIndexCode() + 1);
- }
- formats.set(r.getIndexCode(), r.getFormatString());
- }
+ public HSSFDataFormat( Workbook workbook )
+ {
+ this.workbook = workbook;
+ if ( builtinFormats == null ) populateBuiltinFormats();
+ Iterator i = workbook.getFormats().iterator();
+ while ( i.hasNext() )
+ {
+ FormatRecord r = (FormatRecord) i.next();
+ if ( formats.size() < r.getIndexCode() + 1 )
+ {
+ formats.setSize( r.getIndexCode() + 1 );
+ }
+ formats.set( r.getIndexCode(), r.getFormatString() );
+ }
}
private static synchronized void populateBuiltinFormats()
{
builtinFormats = new Vector();
- builtinFormats.add(0, "General");
- builtinFormats.add(1, "0");
- builtinFormats.add(2, "0.00");
- builtinFormats.add(3, "#,##0");
- builtinFormats.add(4, "#,##0.00");
- builtinFormats.add(5, "($#,##0_);($#,##0)");
- builtinFormats.add(6, "($#,##0_);[Red]($#,##0)");
- builtinFormats.add(7, "($#,##0.00);($#,##0.00)");
- builtinFormats.add(8, "($#,##0.00_);[Red]($#,##0.00)");
- builtinFormats.add(9, "0%");
- builtinFormats.add(0xa, "0.00%");
- builtinFormats.add(0xb, "0.00E+00");
- builtinFormats.add(0xc, "# ?/?");
- builtinFormats.add(0xd, "# ??/??");
- builtinFormats.add(0xe, "m/d/yy");
- builtinFormats.add(0xf, "d-mmm-yy");
- builtinFormats.add(0x10, "d-mmm");
- builtinFormats.add(0x11, "mmm-yy");
- builtinFormats.add(0x12, "h:mm AM/PM");
- builtinFormats.add(0x13, "h:mm:ss AM/PM");
- builtinFormats.add(0x14, "h:mm");
- builtinFormats.add(0x15, "h:mm:ss");
- builtinFormats.add(0x16, "m/d/yy h:mm");
+ builtinFormats.add( 0, "General" );
+ builtinFormats.add( 1, "0" );
+ builtinFormats.add( 2, "0.00" );
+ builtinFormats.add( 3, "#,##0" );
+ builtinFormats.add( 4, "#,##0.00" );
+ builtinFormats.add( 5, "($#,##0_);($#,##0)" );
+ builtinFormats.add( 6, "($#,##0_);[Red]($#,##0)" );
+ builtinFormats.add( 7, "($#,##0.00);($#,##0.00)" );
+ builtinFormats.add( 8, "($#,##0.00_);[Red]($#,##0.00)" );
+ builtinFormats.add( 9, "0%" );
+ builtinFormats.add( 0xa, "0.00%" );
+ builtinFormats.add( 0xb, "0.00E+00" );
+ builtinFormats.add( 0xc, "# ?/?" );
+ builtinFormats.add( 0xd, "# ??/??" );
+ builtinFormats.add( 0xe, "m/d/yy" );
+ builtinFormats.add( 0xf, "d-mmm-yy" );
+ builtinFormats.add( 0x10, "d-mmm" );
+ builtinFormats.add( 0x11, "mmm-yy" );
+ builtinFormats.add( 0x12, "h:mm AM/PM" );
+ builtinFormats.add( 0x13, "h:mm:ss AM/PM" );
+ builtinFormats.add( 0x14, "h:mm" );
+ builtinFormats.add( 0x15, "h:mm:ss" );
+ builtinFormats.add( 0x16, "m/d/yy h:mm" );
// 0x17 - 0x24 reserved for international and undocumented
- builtinFormats.add(0x17, "0x17");
- builtinFormats.add(0x18, "0x18");
- builtinFormats.add(0x19, "0x19");
- builtinFormats.add(0x1a, "0x1a");
- builtinFormats.add(0x1b, "0x1b");
- builtinFormats.add(0x1c, "0x1c");
- builtinFormats.add(0x1d, "0x1d");
- builtinFormats.add(0x1e, "0x1e");
- builtinFormats.add(0x1f, "0x1f");
- builtinFormats.add(0x20, "0x20");
- builtinFormats.add(0x21, "0x21");
- builtinFormats.add(0x22, "0x22");
- builtinFormats.add(0x23, "0x23");
- builtinFormats.add(0x24, "0x24");
+ builtinFormats.add( 0x17, "0x17" );
+ builtinFormats.add( 0x18, "0x18" );
+ builtinFormats.add( 0x19, "0x19" );
+ builtinFormats.add( 0x1a, "0x1a" );
+ builtinFormats.add( 0x1b, "0x1b" );
+ builtinFormats.add( 0x1c, "0x1c" );
+ builtinFormats.add( 0x1d, "0x1d" );
+ builtinFormats.add( 0x1e, "0x1e" );
+ builtinFormats.add( 0x1f, "0x1f" );
+ builtinFormats.add( 0x20, "0x20" );
+ builtinFormats.add( 0x21, "0x21" );
+ builtinFormats.add( 0x22, "0x22" );
+ builtinFormats.add( 0x23, "0x23" );
+ builtinFormats.add( 0x24, "0x24" );
// 0x17 - 0x24 reserved for international and undocumented
- builtinFormats.add(0x25, "(#,##0_);(#,##0)");
- builtinFormats.add(0x26, "(#,##0_);[Red](#,##0)");
- builtinFormats.add(0x27, "(#,##0.00_);(#,##0.00)");
- builtinFormats.add(0x28, "(#,##0.00_);[Red](#,##0.00)");
- builtinFormats.add(0x29, "_(*#,##0_);_(*(#,##0);_(* \"-\"_);_(@_)");
- builtinFormats.add(0x2a, "_($*#,##0_);_($*(#,##0);_($* \"-\"_);_(@_)");
- builtinFormats.add(0x2b, "_(*#,##0.00_);_(*(#,##0.00);_(*\"-\"??_);_(@_)");
- builtinFormats.add(0x2c,
- "_($*#,##0.00_);_($*(#,##0.00);_($*\"-\"??_);_(@_)");
- builtinFormats.add(0x2d, "mm:ss");
- builtinFormats.add(0x2e, "[h]:mm:ss");
- builtinFormats.add(0x2f, "mm:ss.0");
- builtinFormats.add(0x30, "##0.0E+0");
- builtinFormats.add(0x31, "@");
+ builtinFormats.add( 0x25, "(#,##0_);(#,##0)" );
+ builtinFormats.add( 0x26, "(#,##0_);[Red](#,##0)" );
+ builtinFormats.add( 0x27, "(#,##0.00_);(#,##0.00)" );
+ builtinFormats.add( 0x28, "(#,##0.00_);[Red](#,##0.00)" );
+ builtinFormats.add( 0x29, "_(*#,##0_);_(*(#,##0);_(* \"-\"_);_(@_)" );
+ builtinFormats.add( 0x2a, "_($*#,##0_);_($*(#,##0);_($* \"-\"_);_(@_)" );
+ builtinFormats.add( 0x2b, "_(*#,##0.00_);_(*(#,##0.00);_(*\"-\"??_);_(@_)" );
+ builtinFormats.add( 0x2c,
+ "_($*#,##0.00_);_($*(#,##0.00);_($*\"-\"??_);_(@_)" );
+ builtinFormats.add( 0x2d, "mm:ss" );
+ builtinFormats.add( 0x2e, "[h]:mm:ss" );
+ builtinFormats.add( 0x2f, "mm:ss.0" );
+ builtinFormats.add( 0x30, "##0.0E+0" );
+ builtinFormats.add( 0x31, "@" );
}
public static List getBuiltinFormats()
{
- if (builtinFormats == null)
+ if ( builtinFormats == null )
{
populateBuiltinFormats();
}
* @return index of format or -1 if undefined.
*/
- public static short getBuiltinFormat(String format)
+ public static short getBuiltinFormat( String format )
{
- if (builtinFormats == null)
+ if ( builtinFormats == null )
{
populateBuiltinFormats();
}
short retval = -1;
- for (short k = 0; k < 0x31; k++)
+ for ( short k = 0; k < 0x31; k++ )
{
- String nformat = ( String ) builtinFormats.get(k);
+ String nformat = (String) builtinFormats.get( k );
- if ((nformat != null) && nformat.equals(format))
+ if ( ( nformat != null ) && nformat.equals( format ) )
{
retval = k;
break;
* @return index of format.
*/
- public short getFormat(String format)
+ public short getFormat( String format )
{
- ListIterator i;
- int ind;
- if (!movedBuiltins) {
- i = builtinFormats.listIterator();
- while (i.hasNext()) {
- ind = i.nextIndex();
- formats.add(ind, i.next());
- }
- movedBuiltins = true;
- }
- i = formats.listIterator();
- while (i.hasNext()) {
- ind = i.nextIndex();
- if (format.equals(i.next()))
- return (short)ind;
- }
-
- ind = workbook.getFormat(format, true);
- if (formats.size() <= ind)
- formats.setSize(ind + 1);
- formats.add(ind, format);
+ ListIterator i;
+ int ind;
+ if ( !movedBuiltins )
+ {
+ i = builtinFormats.listIterator();
+ while ( i.hasNext() )
+ {
+ ind = i.nextIndex();
+ formats.add( ind, i.next() );
+ }
+ movedBuiltins = true;
+ }
+ i = formats.listIterator();
+ while ( i.hasNext() )
+ {
+ ind = i.nextIndex();
+ if ( format.equals( i.next() ) )
+ return (short) ind;
+ }
+
+ ind = workbook.getFormat( format, true );
+ if ( formats.size() <= ind )
+ formats.setSize( ind + 1 );
+ formats.add( ind, format );
- return (short)ind;
+ return (short) ind;
}
/**
* @return string represented at index of format or null if there is not a format at that index
*/
- public String getFormat(short index)
+ public String getFormat( short index )
{
- if (movedBuiltins)
- return ( String ) formats.get(index);
- else
- return (String) (builtinFormats.size() > index && builtinFormats.get(index) != null ? builtinFormats.get(index) : formats.get(index));
+ if ( movedBuiltins )
+ return (String) formats.get( index );
+ else
+ return (String) ( builtinFormats.size() > index
+ && builtinFormats.get( index ) != null
+ ? builtinFormats.get( index ) : formats.get( index ) );
}
/**
* @return string represented at index of format or null if there is not a builtin format at that index
*/
- public static String getBuiltinFormat(short index)
+ public static String getBuiltinFormat( short index )
{
- if (builtinFormats == null)
+ if ( builtinFormats == null )
{
populateBuiltinFormats();
}
- return ( String ) builtinFormats.get(index);
+ return (String) builtinFormats.get( index );
}
/**
public static int getNumberOfBuiltinBuiltinFormats()
{
- if (builtinFormats == null)
+ if ( builtinFormats == null )
{
populateBuiltinFormats();
}
workbook.removeName(index);
}
- /**
+ /**
* Creates an instance of HSSFDataFormat.
* @return the HSSFDataFormat object
* @see org.apache.poi.hssf.record.FormatRecord
* @see org.apache.poi.hssf.record.Record
*/
public HSSFDataFormat createDataFormat() {
- return new HSSFDataFormat(workbook);
+ return new HSSFDataFormat(workbook);
}
/** remove the named range by his name
-<record id="0x100a" name="AreaFormat" package="org.apache.poi.hssf.record">
+<record id="0x100a" name="AreaFormat" excel-record-id="AREAFORMAT" package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>The area format record is used to define the colours and patterns for an area.</description>
-<record id="0x101A" name="Area" package="org.apache.poi.hssf.record">
+<record id="0x101A" name="Area" excel-record-id="AREA"
+ package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>The area record is used to define a area chart.</description>
-<record id="0x100c" name="SeriesLabels" package="org.apache.poi.hssf.record">
+<record id="0x100c" name="SeriesLabels" excel-record-id="ATTACHEDLABEL"
+ package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>The series label record defines the type of label associated with the data format record.</description>
-<record id="0x1046" name="AxisUsed" package="org.apache.poi.hssf.record">
+<record id="0x1046" name="AxisUsed" excel-record-id="AXISUSED"
+ package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>The number of axes used on a chart.</description>
-<record id="0x1021" name="AxisLineFormat" package="org.apache.poi.hssf.record">
+<record id="0x1021" name="AxisLineFormat" excel-record-id="AXISLINEFORMAT"
+ package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>The axis line format record defines the axis type details.</description>
-<record id="0x1062" name="AxisOptions" package="org.apache.poi.hssf.record">
+<record id="0x1062" name="AxisOptions" excel-record-id="AXCEXT"
+ package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>The axis options record provides unit information and other various tidbits about the axis.</description>
-<record id="0x1041" name="AxisParent" package="org.apache.poi.hssf.record">
+<record id="0x1041" name="AxisParent" excel-record-id="AXISPARENT"
+ package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>The axis size and location</description>
-<record id="0x101d" name="Axis" package="org.apache.poi.hssf.record">
+<record id="0x101d" name="Axis" excel-record-id="AXIS" package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>The axis record defines the type of an axis.</description>
-<record id="0x1017" name="Bar" package="org.apache.poi.hssf.record">
+<record id="0x1017" name="Bar" excel-record-id="BAR"
+ package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>The bar record is used to define a bar chart.</description>
<author>Glen Stampoultzis (glens at apache.org)</author>
<fields>
<field type="int" size="2" name="bar space" description="space between bars"/>
- <field type="int" size="2" name="category space" default="50" description="space between categories"/>
+ <field type="int" size="2" name="category space" description="space between categories"/>
<field type="int" size="2" name="format flags">
<bit number="0" name="horizontal" description="true to display horizontal bar charts, false for vertical"/>
<bit number="1" name="stacked" description="stack displayed values"/>
-<record id="0x1020" name="CategorySeriesAxis" package="org.apache.poi.hssf.record">
+<record id="0x1020" name="CategorySeriesAxis" excel-record-id="CATSERRANGE"
+ package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>This record refers to a category or series axis and is used to specify label/tickmark frequency.</description>
-<record id="0x1002" name="Chart" package="org.apache.poi.hssf.record">
+<record id="0x1002" name="Chart" excel-record-id="CHART"
+ package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>The chart record is used to define the location and size of a chart.</description>
-<record id="0x1063" name="Dat" package="org.apache.poi.hssf.record">
+<record id="0x1063" name="Dat" excel-record-id="DAT"
+ package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>The dat record is used to store options for the chart.</description>
-<record id="0x1006" name="DataFormat" package="org.apache.poi.hssf.record">
+<record id="0x1006" name="DataFormat" excel-record-id="DATAFORMAT"
+ package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>The data format record is used to index into a series.</description>
-<record id="0x1024" name="DefaultDataLabelTextProperties" package="org.apache.poi.hssf.record">
+<record id="0x1024" name="DefaultDataLabelTextProperties"
+ excel-record-id="DEFAULTTEXT" package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>The default data label text properties record identifies the text characteristics of the preceeding text record.</description>
-<record id="0x1060" name="FontBasis" package="org.apache.poi.hssf.record">
+<record id="0x1060" name="FontBasis" excel-record-id="FBI"
+ package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>The font basis record stores various font metrics.</description>
-<record id="0x31" name="Font" package="org.apache.poi.hssf.records">
+<record id="0x31" name="Font" excel-record-id="FONT" package="org.apache.poi.hssf.records">
<suffix>Record</suffix>
<extends>Record</extends>
<description>Describes a font record. In Excel a font belongs in the font table.</description>
-<record id="0x1026" name="FontIndex" package="org.apache.poi.hssf.record">
+<record id="0x1026" name="FontIndex" excel-record-id="FONTX"
+ package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>The font index record indexes into the font table for the text record.</description>
-<record id="0x1032" name="Frame" package="org.apache.poi.hssf.record">
+<record id="0x1032" name="Frame" excel-record-id="FRAME"
+ package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>The frame record indicates whether there is a border around the displayed text of a chart.</description>
-<record id="0x1015" name="Legend" package="org.apache.poi.hssf.record">
+<record id="0x1015" name="Legend" excel-record-id="LEGEND"
+ package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>Defines a legend for a chart.</description>
-<record id="0x1007" name="LineFormat" package="org.apache.poi.hssf.record">
+<record id="0x1007" name="LineFormat" excel-record-id="LINEFORMAT"
+ package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>Describes a line format record. The line format record controls how a line on a chart appears.</description>
-<record id="0x1051" name="LinkedData" package="org.apache.poi.hssf.record">
+<record id="0x1051" name="LinkedData" excel-record-id="AI" package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>Describes a linked data record. This record referes to the series data or text.</description>
<bit number="0" name="custom number format" description="true if this object has a custom number format"/>
</field>
<field type="int" size="2" name="index number fmt record"/>
- <field type="int" size="2" name="formula of link" description="not supported"/>
+ <field type="custom:org.apache.poi.hssf.record.LinkedDataFormulaField"
+ size="var" name="formula of link" description="formula"/>
</fields>
</record>
-<record id="0x104e" name="NumberFormatIndex" package="org.apache.poi.hssf.record">
+<record id="0x104e" name="NumberFormatIndex" excel-record-id="IFMT"
+ package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>The number format index record indexes format table. This applies to an axis.</description>
-<record id="0x1027" name="ObjectLink" package="org.apache.poi.hssf.record">
+<record id="0x1027" name="ObjectLink" excel-record-id="OBJECTLINK"
+ package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>Links text to an object on the chart or identifies it as the title.</description>
-<record id="0x1035" name="PlotArea" package="org.apache.poi.hssf.record">
+<record id="0x1035" name="PlotArea" excel-record-id="PLOTAREA"
+ package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>preceeds and identifies a frame as belonging to the plot area.</description>
-<record id="0x1064" name="PlotGrowth" package="org.apache.poi.hssf.record">
+<record id="0x1064" name="PlotGrowth" excel-record-id="PLOTGROWTH"
+ package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>The plot growth record specifies the scaling factors used when a font is scaled.</description>
-<record id="0x1045" name="SeriesChartGroupIndex" package="org.apache.poi.hssf.record">
+<record id="0x1045" name="SeriesChartGroupIndex" excel-record-id="SERTOCRT"
+ package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>The series chart group index record stores the index to the CHARTFORMAT record (0 based).</description>
-<record id="0x1065" name="SeriesIndex" package="org.apache.poi.hssf.record">
+<record id="0x1065" name="SeriesIndex" excel-record-id="SINDEX"
+ package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>links a series to its position in the series list.</description>
-<record id="0x1016" name="SeriesList" package="org.apache.poi.hssf.record">
+<record id="0x1016" name="SeriesList" excel-record-id="SERIESLIST"
+ package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>The series list record defines the series displayed as an overlay to the main chart record.</description>
-<record id="0x1003" name="Series" package="org.apache.poi.hssf.record">
+<record id="0x1003" name="Series" excel-record-id="SERIES" package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>The series record describes the overall data for a series.</description>
-<record id="0x100d" name="SeriesText" package="org.apache.poi.hssf.record">
+<record id="0x100d" name="SeriesText" excel-record-id="SERIESTEXT"
+ package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>Defines a series name</description>
-<record id="0x1044" name="SheetProperties" package="org.apache.poi.hssf.record">
+<record id="0x1044" name="SheetProperties" excel-record-id="SHTPROPS" package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>Describes a chart sheet properties record.</description>
-<record id="0x1025" name="Text" package="org.apache.poi.hssf.record">
+<record id="0x1025" name="Text" excel-record-id="TEXT" package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>The text record is used to define text stored on a chart.</description>
-<record id="0x101e" name="Tick" package="org.apache.poi.hssf.record">
+<record id="0x101e" name="Tick" excel-record-id="TICK" package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>The Tick record defines how tick marks and label positioning/formatting</description>
-<record id="0x1001" name="Units" package="org.apache.poi.hssf.record">
+<record id="0x1001" name="Units" excel-record-id="UNITS" package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>The units record describes units.</description>
-<record id="0x101f" name="ValueRange" package="org.apache.poi.hssf.record">
+<record id="0x101f" name="ValueRange" excel-record-id="VALUERANGE"
+ package="org.apache.poi.hssf.record">
<suffix>Record</suffix>
<extends>Record</extends>
<description>The value range record defines the range of the value axis.</description>
extends Record
{
public final static short sid = <xsl:value-of select="@id"/>;
-<xsl:for-each select="//fields/field"> private <xsl:value-of select="recutil:getType(@size,@type,10)"/><xsl:text> </xsl:text><xsl:value-of select="recutil:getFieldName(position(),@name,0)"/>;
+<xsl:for-each select="//fields/field"> private <xsl:value-of select="recutil:getType(@size,@type,10)"/><xsl:text> </xsl:text><xsl:value-of select="recutil:getFieldName(position(),@name,0)"/><xsl:value-of select="recutil:initializeText(@size,@type)"/>;
<xsl:apply-templates select="./bit|./const|./bit/const"/>
</xsl:for-each>
public <xsl:value-of select="@name"/>Record(short id, short size, byte [] data)
{
super(id, size, data);
+ <xsl:for-each select="//fields/field">
+ <xsl:if test="@default">
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="recutil:getFieldName(position(),@name,0)"/> =
+ <xsl:value-of select="@default"/>;
+
+ </xsl:if>
+ </xsl:for-each>
}
/**
public <xsl:value-of select="@name"/>Record(short id, short size, byte [] data, int offset)
{
super(id, size, data, offset);
+ <xsl:for-each select="//fields/field">
+ <xsl:if test="@default">
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="recutil:getFieldName(position(),@name,0)"/> =
+ <xsl:value-of select="@default"/>;
+
+ </xsl:if>
+ </xsl:for-each>
}
/**
protected void fillFields(byte [] data, short size, int offset)
{
-<xsl:variable name="fieldIterator" select="field:new()"/>
+
+<xsl:text> int pos = 0;
+</xsl:text>
+
+ <xsl:variable name="fieldIterator" select="field:new()"/>
<xsl:for-each select="//fields/field">
-<xsl:text> </xsl:text><xsl:value-of select="recutil:getFieldName(position(),@name,30)"/> = <xsl:value-of select="field:fillDecoder($fieldIterator,@size,@type)"/>;
+ <xsl:text> </xsl:text><xsl:value-of select="field:fillDecoder2($fieldIterator,position(),@name,@size,@type)"/>;
</xsl:for-each>
}
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[<xsl:value-of select="@name"/>]\n");
+ buffer.append("[<xsl:value-of select="recutil:getRecordId(@name,@excel-record-id)"/>]\n");
<xsl:apply-templates select="//field" mode="tostring"/>
- buffer.append("[/<xsl:value-of select="@name"/>]\n");
+ buffer.append("[/<xsl:value-of select="recutil:getRecordId(@name,@excel-record-id)"/>]\n");
return buffer.toString();
}
public int serialize(int offset, byte[] data)
{
+ int pos = 0;
+
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
<xsl:variable name="fieldIterator" select="field:new()"/>
}
public Object clone() {
- <xsl:value-of select="@name"/>Record rec = new <xsl:value-of select="@name"/>Record();
-
-<xsl:for-each select="//fields/field"><xsl:text> rec.</xsl:text><xsl:value-of select="recutil:getFieldName(position(),@name,0)"/><xsl:text> = </xsl:text><xsl:value-of select="recutil:getFieldName(position(),@name,0)"/><xsl:text>;
-</xsl:text></xsl:for-each>
- return rec;
+ <xsl:value-of select="@name"/>Record rec = new <xsl:value-of select="@name"/>Record();
+ <xsl:for-each select="//fields/field">
+ <xsl:text>
+ </xsl:text><xsl:value-of select="recutil:clone(@name,@type,position())"/><xsl:text>;</xsl:text>
+ </xsl:for-each>
+ return rec;
}
</xsl:template>
<xsl:template match="field" mode="tostring">
- buffer.append(" .<xsl:value-of select="recutil:getFieldName(@name,20)"/> = ")<xsl:choose><xsl:when test="@type != 'string' and @type != 'hbstring' and @type != 'float' and @size != 'varword'">
- .append("0x")
- .append(HexDump.toHex((<xsl:value-of select="recutil:getType(@size,@type,00)"/>)get<xsl:value-of select="recutil:getFieldName1stCap(@name,0)"/>()))</xsl:when></xsl:choose>
- .append(" (").append(get<xsl:value-of select="recutil:getFieldName1stCap(@name,0)"/>()).append(" )\n");
-<xsl:apply-templates select="bit" mode="bittostring"/>
+ <xsl:value-of select="recutil:getToString(@name,@type,@size)"/>
+ <xsl:text>
+ buffer.append(System.getProperty("line.separator")); </xsl:text>
+ <xsl:apply-templates select="bit" mode="bittostring"/>
+ <xsl:text> </xsl:text>
</xsl:template>
-<xsl:template match="bit" mode="bittostring">
-<xsl:if test="not (@mask)"> buffer.append(" .<xsl:value-of select="recutil:getFieldName(@name,20)"/> = ").append(is<xsl:value-of select="recutil:getFieldName1stCap(@name,20)"/>()).append('\n');
-</xsl:if>
-<xsl:if test="@mask"> buffer.append(" .<xsl:value-of select="recutil:getFieldName(@name,20)"/> = ").append(get<xsl:value-of select="recutil:getFieldName1stCap(@name,20)"/>()).append('\n');
-</xsl:if>
-</xsl:template>
+ <xsl:template match="bit" mode="bittostring">
+ <xsl:if test="not (@mask)">
+ <xsl:text> buffer.append(" .</xsl:text>
+ <xsl:value-of select="recutil:getFieldName(@name,20)"/>
+ <xsl:text> = ").append(is</xsl:text>
+ <xsl:value-of select="recutil:getFieldName1stCap(@name,0)"/>
+ <xsl:text>()).append('\n'); </xsl:text>
+ </xsl:if>
+ <xsl:if test="@mask">
+ <xsl:text> buffer.append(" .</xsl:text>
+ <xsl:value-of select="recutil:getFieldName(@name,20)"/>
+ <xsl:text> = ").append(get</xsl:text>
+ <xsl:value-of select="recutil:getFieldName1stCap(@name,0)"/>
+ <xsl:text>()).append('\n'); </xsl:text>
+ </xsl:if>
+ </xsl:template>
<xsl:template match="author">
* @author <xsl:value-of select="."/>
package org.apache.poi.generator;
/**
- * For iterating through our fields. Todo: Change this to javascript in the style sheet.
+ * For iterating through our fields.
*
* @author Glen Stampoultzis (glens at apache.org)
*/
offset = 0;
}
- /**
+ /**
* This utility function returns a fill method entry for a given field
*
* @param size - how big of an "int" or the name of the size field for a string
* @param type - int or string
- */
+ */
public String fillDecoder(String size, String type)
{
String javaType = RecordUtil.getType(size, type, 0);
String result = "";
if (javaType.equals("short"))
- result = "LittleEndian.getShort(data, 0x" + Integer.toHexString(offset) + " + offset)";
+ result = "LittleEndian.getShort(data, pos + 0x" + Integer.toHexString(offset) + " + offset)";
else if (javaType.equals("short[]"))
- result = "LittleEndian.getShortArray(data, 0x" + Integer.toHexString(offset) + " + offset)";
+ result = "LittleEndian.getShortArray(data, pos + 0x" + Integer.toHexString(offset) + " + offset)";
else if (javaType.equals("int"))
- result = "LittleEndian.getInt(data, 0x" + Integer.toHexString(offset) + " + offset)";
+ result = "LittleEndian.getInt(data, pos + 0x" + Integer.toHexString(offset) + " + offset)";
else if (javaType.equals("byte"))
- result = "data[ 0x" + Integer.toHexString(offset) + " + offset ]";
+ result = "data[ pos + 0x" + Integer.toHexString(offset) + " + offset ]";
else if (javaType.equals("double"))
- result = "LittleEndian.getDouble(data, 0x" + Integer.toHexString(offset) + " + offset)";
+ result = "LittleEndian.getDouble(data, pos + 0x" + Integer.toHexString(offset) + " + offset)";
else if (javaType.equals("String") && !type.equals("hbstring"))
- result = "StringUtil.getFromUnicode(data, 0x" + Integer.toHexString(offset) + " + offset,("+ size + "-1)/2)";
+ result = "StringUtil.getFromUnicode(data, pos + 0x" + Integer.toHexString(offset) + " + offset,("+ size + "-1)/2)";
else if (javaType.equals("String") && type.equals("hbstring"))
- result = "StringUtil.getFromUnicodeHigh(data, 0x" + Integer.toHexString(offset) + " + offset, ("+ size+"/2))";
+ result = "StringUtil.getFromUnicodeHigh(data, pos + 0x" + Integer.toHexString(offset) + " + offset, ("+ size+"/2))";
try
{
}
return result;
}
-
+
+ public String fillDecoder2(int position, String name, String size, String type)
+ {
+ if (type.startsWith("custom:"))
+ {
+ StringBuffer result = new StringBuffer();
+ result.append( RecordUtil.getFieldName( position, name, 0 ) );
+ result.append( " = new " );
+ String javaType = type.substring( 7 );
+ result.append(javaType);
+ result.append( "();\n");
+ result.append( " pos += " );
+ result.append(RecordUtil.getFieldName(position, name, 0))
+ .append(".fillField(data,size,pos + ")
+ .append(offset)
+ .append(")");
+ return result.toString();
+ }
+ else
+ {
+ return RecordUtil.getFieldName(position, name, 30) +
+ " = " + fillDecoder(size, type);
+ }
+ }
+
//position(),@name,@size,@type
public String serialiseEncoder( int fieldNumber, String fieldName, String size, String type)
String javaFieldName = RecordUtil.getFieldName(fieldNumber,fieldName,0);
String result = "";
- if (javaType.equals("short"))
- result = "LittleEndian.putShort(data, " + (offset+4) + " + offset, " + javaFieldName + ");";
+ if (type.startsWith("custom:"))
+ result = "pos += " + javaFieldName + ".serializeField( pos + offset, data );";
+ else if (javaType.equals("short"))
+ result = "LittleEndian.putShort(data, " + (offset+4) + " + offset + pos, " + javaFieldName + ");";
else if (javaType.equals("short[]"))
- result = "LittleEndian.putShortArray(data, " + (offset+4) + " + offset, " + javaFieldName + ");";
+ result = "LittleEndian.putShortArray(data, " + (offset+4) + " + offset + pos, " + javaFieldName + ");";
else if (javaType.equals("int"))
- result = "LittleEndian.putInt(data, " + (offset+4) + " + offset, " + javaFieldName + ");";
+ result = "LittleEndian.putInt(data, " + (offset+4) + " + offset + pos, " + javaFieldName + ");";
else if (javaType.equals("byte"))
- result = "data[ " + (offset+4) + " + offset ] = " + javaFieldName + ";";
+ result = "data[ " + (offset+4) + " + offset + pos ] = " + javaFieldName + ";";
else if (javaType.equals("double"))
- result = "LittleEndian.putDouble(data, " + (offset+4) + " + offset, " + javaFieldName + ");";
+ result = "LittleEndian.putDouble(data, " + (offset+4) + " + offset + pos, " + javaFieldName + ");";
else if (javaType.equals("String") && !type.equals("hbstring"))
- result = "StringUtil.putUncompressedUnicode("+ javaFieldName +", data, offset+4);";
+ result = "StringUtil.putUncompressedUnicode("+ javaFieldName +", data, offset + pos + 4);";
else if (javaType.equals("String") && type.equals("hbstring"))
- result = "StringUtil.putUncompressedUnicodeHigh("+ javaFieldName +", data, "+(offset+4)+" + offset);";
-
+ result = "StringUtil.putUncompressedUnicodeHigh("+ javaFieldName +", data, "+(offset+4)+" + offset + pos);";
+
try
{
public String calcSize( int fieldNumber, String fieldName, String size, String type)
{
String result = " + ";
- if ("var".equals(size))
+ if (type.startsWith("custom:"))
+ {
+ String javaFieldName = RecordUtil.getFieldName(fieldNumber, fieldName, 0);
+ return result + javaFieldName + ".getSize()";
+ }
+ else if ("var".equals(size))
{
String javaFieldName = RecordUtil.getFieldName(fieldNumber,fieldName,0);
return result + " ("+javaFieldName + ".length() *2)";
{
String javaFieldName = RecordUtil.getFieldName(fieldNumber,fieldName,0);
return result + javaFieldName + ".length * 2 + 2";
- } else
+ } else
{
return result + size;
}
}
-
+
}
*/
public class RecordUtil
{
+ private static final String CR = "\n";
+
public static String getFieldName(int position, String name, int padTo)
{
StringBuffer fieldName = new StringBuffer("field_" + position + "_");
return fieldName.toString();
}
+ public static String clone(String name, String type, int pos) {
+ StringBuffer fieldName = new StringBuffer();
+ toIdentifier(name, fieldName);
+
+ String javaFieldName = getFieldName(pos, name, 0);
+
+ if (type.startsWith("custom:"))
+ {
+ String javaType = type.substring(7);
+ return "rec." + javaFieldName + " = ((" + javaType + ")" + javaFieldName + ".clone());";
+ }
+ else
+ {
+ return "rec." + javaFieldName + " = " + javaFieldName;
+ }
+ }
+
+ public static String initializeText(String size, String type)
+ {
+ if (type.startsWith("custom:"))
+ {
+ String javaType = type.substring( 7 );
+ return " = new " + javaType + "()";
+ }
+ else
+ {
+ return "";
+ }
+ }
+
private static void toIdentifier(String name, StringBuffer fieldName)
{
for (int i = 0; i < name.length(); i++)
return pad(new StringBuffer("String"), padTo).toString();
else if (type.equals("hbstring"))
return pad(new StringBuffer("String"), padTo).toString();
-
+ else if (type.startsWith("custom:"))
+ {
+ int pos = type.lastIndexOf('.');
+ return pad(new StringBuffer(type.substring(pos+1)), padTo)
+ .toString();
+ }
return "short"; // if we don't know, default to short
}
}
return retval.toString();
}
-
+
+ public static String getToString(String fieldName, String type, String size) {
+ StringBuffer result = new StringBuffer();
+ result.append(" buffer.append(\" .");
+ result.append(getFieldName(fieldName, 20));
+ result.append(" = \")" + CR);
+ if (type.equals("string") == false
+ && type.equals("hbstring") == false
+ && type.equals("float") == false
+// && type.equals("varword") == false
+ && size.equals("varword") == false
+ && type.startsWith("custom:") == false)
+ {
+ result.append(" .append(\"0x\")");
+ result.append(".append(HexDump.toHex( ");
+// result.append(getType(size, type, 0));
+ result.append(" get");
+ result.append(getFieldName1stCap(fieldName, 0));
+ result.append(" ()))" + CR);
+ }
+ result.append(" .append(\" (\").append( get");
+ result.append(getFieldName1stCap(fieldName,0));
+ result.append("() ).append(\" )\");");
+ return result.toString();
+ }
+
+ public static String getRecordId(String recordName, String excelName)
+ {
+ if (excelName == null || excelName.equals(""))
+ return recordName;
+ else
+ return excelName;
+ }
}
* class works correctly. Test data taken directly from a real
* Excel file.
*
-
* @author Glen Stampoultzis (glens at apache.org)
*/
public class TestLinkedDataRecord
extends TestCase
{
- byte[] data = new byte[] {
- (byte)0x00,
- (byte)0x01,
- (byte)0x00,(byte)0x00,
+
+/*
+ Records that would appear in a simple bar chart
+
+ The first record links to the series title (linkType = 0). It's
+ reference type is 1 which means that it links directly to data entered
+ into the forumula bar. There seems to be no reference to any data
+ however. The formulaOfLink field contains two 0 bytes.
+
+============================================
+Offset 0xf9c (3996)
+rectype = 0x1051, recsize = 0x8
+-BEGIN DUMP---------------------------------
+00000000 00 01 00 00 00 00 00 00 ........
+-END DUMP-----------------------------------
+recordid = 0x1051, size =8
+[AI]
+.linkType = 0x00 (0 )
+.referenceType = 0x01 (1 )
+.options = 0x0000 (0 )
+ .customNumberFormat = false
+.indexNumberFmtRecord = 0x0000 (0 )
+.formulaOfLink = (org.apache.poi.hssf.record.LinkedDataFormulaField@95fd19 )
+[/AI]
+
+============================================
+Offset 0xfa8 (4008)
+rectype = 0x1051, recsize = 0x13
+-BEGIN DUMP---------------------------------
+00000000 01 02 00 00 00 00 0B 00 3B 00 00 00 00 1E 00 01 ........;.......
+00000010 00 01 00 ...
+-END DUMP-----------------------------------
+recordid = 0x1051, size =19
+[AI]
+.linkType = 0x01 (1 )
+.referenceType = 0x02 (2 )
+.options = 0x0000 (0 )
+ .customNumberFormat = false
+.indexNumberFmtRecord = 0x0000 (0 )
+.formulaOfLink = (org.apache.poi.hssf.record.LinkedDataFormulaField@11b9fb1 )
+[/AI]
+
+============================================
+Offset 0xfbf (4031)
+rectype = 0x1051, recsize = 0x13
+-BEGIN DUMP---------------------------------
+00000000 02 02 00 00 69 01 0B 00 3B 00 00 00 00 1F 00 00 ....i...;.......
+00000010 00 00 00 ...
+-END DUMP-----------------------------------
+recordid = 0x1051, size =19
+[AI]
+.linkType = 0x02 (2 )
+.referenceType = 0x02 (2 )
+.options = 0x0000 (0 )
+ .customNumberFormat = false
+.indexNumberFmtRecord = 0x0169 (361 )
+.formulaOfLink = (org.apache.poi.hssf.record.LinkedDataFormulaField@913fe2 )
+[/AI]
+
+============================================
+Offset 0xfd6 (4054)
+rectype = 0x1051, recsize = 0x8
+-BEGIN DUMP---------------------------------
+00000000 03 01 00 00 00 00 00 00 ........
+-END DUMP-----------------------------------
+recordid = 0x1051, size =8
+[AI]
+.linkType = 0x03 (3 )
+.referenceType = 0x01 (1 )
+.options = 0x0000 (0 )
+ .customNumberFormat = false
+.indexNumberFmtRecord = 0x0000 (0 )
+.formulaOfLink = (org.apache.poi.hssf.record.LinkedDataFormulaField@1f934ad )
+[/AI]
+
+*/
+
+ byte[] data = new byte[]{
+ (byte) 0x00,
+ (byte) 0x01,
+ (byte) 0x00, (byte) 0x00,
(byte)0x00,(byte)0x00,
(byte)0x00,(byte)0x00 // not supported
};
POIFSFileSystem fs = null;
HSSFWorkbook wb = null;
- System.out.println("testTestCase");
-
String filename = System.getProperty("HSSF.testdata.path");
filename = filename + "/Simple.xls";