Methods Summary |
---|
protected void | fillFields(org.apache.poi.hssf.record.RecordInputStream in)
fHighByte = BitFieldFactory.getInstance(0x01); //have to init here, since we are being called
//from super, and class level init hasnt been done.
field_1_xf_index = in.readShort();
if (getType() == STYLE_BUILT_IN)
{
field_2_builtin_style = in.readByte();
field_3_outline_style_level = in.readByte();
}
else if (getType() == STYLE_USER_DEFINED)
{
field_2_name_length = in.readShort();
field_3_string_options = in.readByte();
byte[] string = in.readRemainder();
if (fHighByte.isSet(field_3_string_options)) {
field_4_name= StringUtil.getFromUnicodeBE(string, 0, field_2_name_length);
}else {
field_4_name=StringUtil.getFromCompressedUnicode(string, 0, field_2_name_length);
}
}
// todo sanity check exception to make sure we're one or the other
|
public byte | getBuiltin()if this is a builtin style get the number of the built in style
return field_2_builtin_style;
|
public short | getIndex()get the entire index field (including the type) (see bit getters that reference this method)
return field_1_xf_index;
|
public java.lang.String | getName()get the style's name
return field_4_name;
|
public short | getNameLength()if this is a user defined record get the length of the style name
return field_2_name_length;
|
public byte | getOutlineStyleLevel()get the row or column level of the style (if builtin 1||2)
return field_3_outline_style_level;
|
public int | getRecordSize()
int retval;
if (getType() == STYLE_BUILT_IN)
{
retval = 8;
}
else
{
if (fHighByte.isSet(field_3_string_options)) {
retval= 9+2*getNameLength();
}else {
retval = 9 + getNameLength();
}
}
return retval;
|
public short | getSid()
return sid;
|
public short | getType()get the type of the style (builtin or user-defined)
return ( short ) ((field_1_xf_index & 0x8000) >> 15);
|
public short | getXFIndex()get the actual index of the style extended format record
return ( short ) (field_1_xf_index & 0x1FFF);
|
public int | serialize(int offset, byte[] data)
LittleEndian.putShort(data, 0 + offset, sid);
if (getType() == STYLE_BUILT_IN)
{
LittleEndian.putShort(data, 2 + offset,
(( short ) 0x04)); // 4 bytes (8 total)
}
else
{
LittleEndian.putShort(data, 2 + offset,
(( short ) (getRecordSize()-4)));
}
LittleEndian.putShort(data, 4 + offset, getIndex());
if (getType() == STYLE_BUILT_IN)
{
data[ 6 + offset ] = getBuiltin();
data[ 7 + offset ] = getOutlineStyleLevel();
}
else
{
LittleEndian.putShort(data, 6 + offset , getNameLength());
data[8+offset]=this.field_3_string_options;
StringUtil.putCompressedUnicode(getName(), data, 9 + offset);
}
return getRecordSize();
|
public void | setBuiltin(byte builtin)if this is a builtin style set teh number of the built in style
field_2_builtin_style = builtin;
|
private short | setField(int fieldValue, int new_value, int mask, int shiftLeft)
return ( short ) ((fieldValue & ~mask)
| ((new_value << shiftLeft) & mask));
|
public void | setIndex(short index)set the entire index field (including the type) (see bit setters that reference this method)
field_1_xf_index = index;
|
public void | setName(java.lang.String name)set the style's name
field_4_name = name;
//TODO set name length and string options
|
public void | setNameLength(byte length)if this is a user defined record set the length of the style name
field_2_name_length = length;
|
public void | setOutlineStyleLevel(byte level)set the row or column level of the style (if builtin 1||2)
field_3_outline_style_level = level;
|
public void | setType(short type)set the type of the style (builtin or user-defined)
field_1_xf_index = setField(field_1_xf_index, type, 0x8000, 15);
|
public void | setXFIndex(short index)set the actual index of the style extended format record
field_1_xf_index = setField(field_1_xf_index, index, 0x1FFF, 0);
|
public java.lang.String | toString()
StringBuffer buffer = new StringBuffer();
buffer.append("[STYLE]\n");
buffer.append(" .xf_index_raw = ")
.append(Integer.toHexString(getIndex())).append("\n");
buffer.append(" .type = ")
.append(Integer.toHexString(getType())).append("\n");
buffer.append(" .xf_index = ")
.append(Integer.toHexString(getXFIndex())).append("\n");
if (getType() == STYLE_BUILT_IN)
{
buffer.append(" .builtin_style = ")
.append(Integer.toHexString(getBuiltin())).append("\n");
buffer.append(" .outline_level = ")
.append(Integer.toHexString(getOutlineStyleLevel()))
.append("\n");
}
else if (getType() == STYLE_USER_DEFINED)
{
buffer.append(" .name_length = ")
.append(Integer.toHexString(getNameLength())).append("\n");
buffer.append(" .name = ").append(getName())
.append("\n");
}
buffer.append("[/STYLE]\n");
return buffer.toString();
|
protected void | validateSid(short id)
if (id != sid)
{
throw new RecordFormatException("NOT A STYLE RECORD");
}
|