jxl.biff
Class FontRecord

java.lang.Object
  extended byjxl.biff.RecordData
      extended byjxl.biff.WritableRecordData
          extended byjxl.biff.FontRecord
All Implemented Interfaces:
ByteData, Font
Direct Known Subclasses:
WritableFontRecord

public class FontRecord
extends WritableRecordData
implements Font

A record containing the necessary data for the font information


Field Summary
static jxl.biff.FontRecord.Biff7 biff7
           
 
Fields inherited from class jxl.biff.WritableRecordData
maxRecordLength
 
Constructor Summary
protected FontRecord(Font f)
          Publicly available copy constructor
  FontRecord(Record t, WorkbookSettings ws)
          Constructs this object from the raw data.
  FontRecord(Record t, WorkbookSettings ws, jxl.biff.FontRecord.Biff7 dummy)
          Constructs this object from the raw data.
protected FontRecord(java.lang.String fn, int ps, int bold, boolean it, int us, int ci, int ss)
          Constructor, used when creating a new font for writing out.
 
Method Summary
 boolean equals(java.lang.Object o)
          Standard equals method
 int getBoldWeight()
          Gets the bold weight for this font
 Colour getColour()
          Gets the colour for this font
 byte[] getData()
          Gets the byte data for writing out
 int getFontIndex()
          Accessor for the font index
 java.lang.String getName()
          Gets the name of this font
 int getPointSize()
          Gets the point size for this font, if the font hasn't been initialized
 ScriptStyle getScriptStyle()
          Gets the script style
 UnderlineStyle getUnderlineStyle()
          Gets the underline style for this font
 int hashCode()
          Standard hash code method
 void initialize(int pos)
          Sets the font index of this record.
 boolean isInitialized()
          Accessor to see whether this object is initialized or not.
 boolean isItalic()
          Returns the italic flag
 boolean isStruckout()
          Accessor for the strike out flag
protected  void setFontBoldStyle(int bs)
          Sets the bold style for this font, if the font hasn't been initialized
protected  void setFontColour(int c)
          Sets the colour for this font, if the font hasn't been initialized
protected  void setFontItalic(boolean i)
          Sets the italic indicator for this font, if the font hasn't been initialized
protected  void setFontPointSize(int ps)
          Sets the point size for this font, if the font hasn't been initialized
protected  void setFontScriptStyle(int ss)
          Sets the script style (eg. superscript, subscript) for this font, if the font hasn't been initialized
protected  void setFontStruckout(boolean os)
          Sets the struck out flag
protected  void setFontUnderlineStyle(int us)
          Sets the underline style for this font, if the font hasn't been initialized
 void uninitialize()
          Resets the initialize flag.
 
Methods inherited from class jxl.biff.WritableRecordData
getBytes
 
Methods inherited from class jxl.biff.RecordData
getCode, getRecord
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

biff7

public static final jxl.biff.FontRecord.Biff7 biff7
Constructor Detail

FontRecord

protected FontRecord(java.lang.String fn,
                     int ps,
                     int bold,
                     boolean it,
                     int us,
                     int ci,
                     int ss)
Constructor, used when creating a new font for writing out.

Parameters:
bold - the bold indicator
ps - the point size
us - the underline style
fn - the name
it - italicised indicator
ss - the script style
ci - the colour index

FontRecord

public FontRecord(Record t,
                  WorkbookSettings ws)
Constructs this object from the raw data. Used when reading in a format record

Parameters:
t - the raw data
ws - the workbook settings

FontRecord

public FontRecord(Record t,
                  WorkbookSettings ws,
                  jxl.biff.FontRecord.Biff7 dummy)
Constructs this object from the raw data. Used when reading in a format record

Parameters:
t - the raw data
ws - the workbook settings
dummy - dummy overload

FontRecord

protected FontRecord(Font f)
Publicly available copy constructor

Parameters:
f - the font to copy
Method Detail

getData

public byte[] getData()
Gets the byte data for writing out

Specified by:
getData in class WritableRecordData
Returns:
the raw data

isInitialized

public final boolean isInitialized()
Accessor to see whether this object is initialized or not.

Returns:
TRUE if this font record has been initialized, FALSE otherwise

initialize

public final void initialize(int pos)
Sets the font index of this record. Called from the FormattingRecords object

Parameters:
pos - the position of this font in the workbooks font list

uninitialize

public final void uninitialize()
Resets the initialize flag. This is called by the constructor of WritableWorkbookImpl to reset the statically declared fonts


getFontIndex

public final int getFontIndex()
Accessor for the font index

Returns:
the font index

setFontPointSize

protected void setFontPointSize(int ps)
Sets the point size for this font, if the font hasn't been initialized

Parameters:
ps - the point size

getPointSize

public int getPointSize()
Gets the point size for this font, if the font hasn't been initialized

Specified by:
getPointSize in interface Font
Returns:
the point size

setFontBoldStyle

protected void setFontBoldStyle(int bs)
Sets the bold style for this font, if the font hasn't been initialized

Parameters:
bs - the bold style

getBoldWeight

public int getBoldWeight()
Gets the bold weight for this font

Specified by:
getBoldWeight in interface Font
Returns:
the bold weight for this font

setFontItalic

protected void setFontItalic(boolean i)
Sets the italic indicator for this font, if the font hasn't been initialized

Parameters:
i - the italic flag

isItalic

public boolean isItalic()
Returns the italic flag

Specified by:
isItalic in interface Font
Returns:
TRUE if this font is italic, FALSE otherwise

setFontUnderlineStyle

protected void setFontUnderlineStyle(int us)
Sets the underline style for this font, if the font hasn't been initialized

Parameters:
us - the underline style

getUnderlineStyle

public UnderlineStyle getUnderlineStyle()
Gets the underline style for this font

Specified by:
getUnderlineStyle in interface Font
Returns:
the underline style

setFontColour

protected void setFontColour(int c)
Sets the colour for this font, if the font hasn't been initialized

Parameters:
c - the colour

getColour

public Colour getColour()
Gets the colour for this font

Specified by:
getColour in interface Font
Returns:
the colour

setFontScriptStyle

protected void setFontScriptStyle(int ss)
Sets the script style (eg. superscript, subscript) for this font, if the font hasn't been initialized

Parameters:
ss - the colour

getScriptStyle

public ScriptStyle getScriptStyle()
Gets the script style

Specified by:
getScriptStyle in interface Font
Returns:
the script style

getName

public java.lang.String getName()
Gets the name of this font

Specified by:
getName in interface Font
Returns:
the name of this font

hashCode

public int hashCode()
Standard hash code method

Returns:
the hash code for this object

equals

public boolean equals(java.lang.Object o)
Standard equals method

Parameters:
o - the object to compare
Returns:
TRUE if the objects are equal, FALSE otherwise

isStruckout

public boolean isStruckout()
Accessor for the strike out flag

Specified by:
isStruckout in interface Font
Returns:
TRUE if this font is struck out, FALSE otherwise

setFontStruckout

protected void setFontStruckout(boolean os)
Sets the struck out flag

Parameters:
os - TRUE if the font is struck out, false otherwise