jxl.biff
Class XFRecord

java.lang.Object
  extended byjxl.biff.RecordData
      extended byjxl.biff.WritableRecordData
          extended byjxl.biff.XFRecord
All Implemented Interfaces:
ByteData, CellFormat
Direct Known Subclasses:
CellXFRecord, StyleXFRecord

public class XFRecord
extends WritableRecordData
implements CellFormat

Holds an extended formatting record


Field Summary
static jxl.biff.XFRecord.BiffType biff7
           
static jxl.biff.XFRecord.BiffType biff8
           
protected static jxl.biff.XFRecord.XFType cell
           
 int formatIndex
          The index to the format record
protected static jxl.biff.XFRecord.XFType style
           
 
Fields inherited from class jxl.biff.WritableRecordData
maxRecordLength
 
Constructor Summary
protected XFRecord(CellFormat cellFormat)
          A public copy constructor which can be used for copy formats between different sheets.
  XFRecord(FontRecord fnt, DisplayFormat form)
          A constructor used when creating a writable record
  XFRecord(Record t, WorkbookSettings ws, jxl.biff.XFRecord.BiffType bt)
          Constructs this object from the raw data
protected XFRecord(XFRecord fmt)
          Copy constructor.
 
Method Summary
 boolean equals(java.lang.Object o)
          Equals method.
 Alignment getAlignment()
          Gets the horizontal cell alignment
 Colour getBackgroundColour()
          Gets the background colour used by this cell
 BorderLineStyle getBorder(Border border)
          Gets the line style for the given cell border If a border type of ALL or NONE is specified, then a line style of NONE is returned
 Colour getBorderColour(Border border)
          Gets the line style for the given cell border If a border type of ALL or NONE is specified, then a line style of NONE is returned
 BorderLineStyle getBorderLine(Border border)
          Gets the line style for the given cell border If a border type of ALL or NONE is specified, then a line style of NONE is returned
 byte[] getData()
          Converts the various fields into binary data.
 java.text.DateFormat getDateFormat()
          Gets the java date format for this format record
 Font getFont()
          Gets the font used by this format
 Format getFormat()
          Gets the format used by this format
 int getFormatRecord()
          Gets the lookup number of the format record
protected  boolean getHidden()
          Accessor for the hidden flag
 int getIndentation()
          Gets the indentation
protected  boolean getLocked()
          Accessor for the locked flag
 java.text.NumberFormat getNumberFormat()
          Gets the java number format for this format record
 Orientation getOrientation()
          Gets the orientation
 Pattern getPattern()
          Gets the pattern used by this cell format
 VerticalAlignment getVerticalAlignment()
          Gets the vertical cell alignment
 boolean getWrap()
          Gets whether or not the contents of this cell are wrapped
 int getXFIndex()
          Accessor for the XF index
 boolean hasBorders()
          Determines if this cell format has any borders at all.
 int hashCode()
          Standard hash code implementation
 void initialize(int pos, FormattingRecords fr, Fonts fonts)
          If this cell has not been read in from an existing Excel sheet, then initializes this record with the XF index passed in.
 boolean isDate()
          Sees if this format is a date format
 boolean isInitialized()
          Accessor to see if this format is initialized
 boolean isLocked()
          Accessor for whether a particular cell is locked
 boolean isNumber()
          Sees if this format is a number format
 boolean isRead()
          Accessor to see if this format was read in.
 boolean isShrinkToFit()
          Gets the shrink to fit flag
 void setFont(FontRecord f)
          Sets the font object with a workbook specific clone.
protected  void setXFAlignment(Alignment a)
          Sets the horizontal alignment for the data in this cell.
protected  void setXFBackground(Colour c, Pattern p)
          Sets the horizontal alignment for the data in this cell.
protected  void setXFBorder(Border b, BorderLineStyle ls, Colour c)
          Sets the border for this cell This method should only be called from its writable subclass CellXFRecord
protected  void setXFCellOptions(int opt)
          Sets the cell options
protected  void setXFDetails(jxl.biff.XFRecord.XFType t, int pf)
          Sets the format type and parent format from the writable subclass
protected  void setXFIndentation(int i)
          Sets the indentation
protected  void setXFLocked(boolean l)
          Sets whether or not this XF record locks the cell
protected  void setXFOrientation(Orientation o)
          Sets the vertical alignment for the data in this cell This method should only be called from its writable subclass CellXFRecord
protected  void setXFShrinkToFit(boolean s)
          Sets the shrink to fit flag
protected  void setXFVerticalAlignment(VerticalAlignment va)
          Sets the vertical alignment for the data in this cell This method should only be called from its writable subclass CellXFRecord
protected  void setXFWrap(boolean w)
          Sets whether the data in this cell is wrapped This method should only be called from its writable subclass CellXFRecord
 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

formatIndex

public int formatIndex
The index to the format record


biff8

public static final jxl.biff.XFRecord.BiffType biff8

biff7

public static final jxl.biff.XFRecord.BiffType biff7

cell

protected static final jxl.biff.XFRecord.XFType cell

style

protected static final jxl.biff.XFRecord.XFType style
Constructor Detail

XFRecord

public XFRecord(Record t,
                WorkbookSettings ws,
                jxl.biff.XFRecord.BiffType bt)
Constructs this object from the raw data

Parameters:
t - the raw data
bt - the biff type

XFRecord

public XFRecord(FontRecord fnt,
                DisplayFormat form)
A constructor used when creating a writable record

Parameters:
fnt - the font
form - the format

XFRecord

protected XFRecord(XFRecord fmt)
Copy constructor. Used for copying writable formats, typically when duplicating formats to handle merged cells

Parameters:
fmt - XFRecord

XFRecord

protected XFRecord(CellFormat cellFormat)
A public copy constructor which can be used for copy formats between different sheets. Unlike the the other copy constructor, this version does a deep copy

Parameters:
cellFormat - the format to copy
Method Detail

getDateFormat

public java.text.DateFormat getDateFormat()
Gets the java date format for this format record

Returns:
returns the date format

getNumberFormat

public java.text.NumberFormat getNumberFormat()
Gets the java number format for this format record

Returns:
returns the number format

getFormatRecord

public int getFormatRecord()
Gets the lookup number of the format record

Returns:
returns the lookup number of the format record

isDate

public boolean isDate()
Sees if this format is a date format

Returns:
TRUE if this refers to a built in date format

isNumber

public boolean isNumber()
Sees if this format is a number format

Returns:
TRUE if this refers to a built in date format

getData

public byte[] getData()
Converts the various fields into binary data. If this object has been read from an Excel file rather than being requested by a user (ie. if the read flag is TRUE) then no processing takes place and the raw data is simply returned.

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

getLocked

protected final boolean getLocked()
Accessor for the locked flag

Returns:
TRUE if this XF record locks cells, FALSE otherwise

getHidden

protected final boolean getHidden()
Accessor for the hidden flag

Returns:
TRUE if this XF record hides the cell, FALSE otherwise

setXFLocked

protected final void setXFLocked(boolean l)
Sets whether or not this XF record locks the cell

Parameters:
l - the locked flag

setXFCellOptions

protected final void setXFCellOptions(int opt)
Sets the cell options

Parameters:
opt - the cell options

setXFAlignment

protected void setXFAlignment(Alignment a)
Sets the horizontal alignment for the data in this cell. This method should only be called from its writable subclass CellXFRecord

Parameters:
a - the alignment

setXFIndentation

protected void setXFIndentation(int i)
Sets the indentation

Parameters:
i - the indentation

setXFShrinkToFit

protected void setXFShrinkToFit(boolean s)
Sets the shrink to fit flag

Parameters:
s - the shrink to fit flag

getAlignment

public Alignment getAlignment()
Gets the horizontal cell alignment

Specified by:
getAlignment in interface CellFormat
Returns:
the alignment

getIndentation

public int getIndentation()
Gets the indentation

Specified by:
getIndentation in interface CellFormat
Returns:
the indentation

isShrinkToFit

public boolean isShrinkToFit()
Gets the shrink to fit flag

Specified by:
isShrinkToFit in interface CellFormat
Returns:
TRUE if this format is shrink to fit, FALSE otherise

isLocked

public boolean isLocked()
Accessor for whether a particular cell is locked

Specified by:
isLocked in interface CellFormat
Returns:
TRUE if this cell is locked, FALSE otherwise

getVerticalAlignment

public VerticalAlignment getVerticalAlignment()
Gets the vertical cell alignment

Specified by:
getVerticalAlignment in interface CellFormat
Returns:
the alignment

getOrientation

public Orientation getOrientation()
Gets the orientation

Specified by:
getOrientation in interface CellFormat
Returns:
the orientation

setXFBackground

protected void setXFBackground(Colour c,
                               Pattern p)
Sets the horizontal alignment for the data in this cell. This method should only be called from its writable subclass CellXFRecord

Parameters:
c - the background colour
p - the background pattern

getBackgroundColour

public Colour getBackgroundColour()
Gets the background colour used by this cell

Specified by:
getBackgroundColour in interface CellFormat
Returns:
the foreground colour

getPattern

public Pattern getPattern()
Gets the pattern used by this cell format

Specified by:
getPattern in interface CellFormat
Returns:
the background pattern

setXFVerticalAlignment

protected void setXFVerticalAlignment(VerticalAlignment va)
Sets the vertical alignment for the data in this cell This method should only be called from its writable subclass CellXFRecord

Parameters:
va - the vertical alignment

setXFOrientation

protected void setXFOrientation(Orientation o)
Sets the vertical alignment for the data in this cell This method should only be called from its writable subclass CellXFRecord

Parameters:
o - the orientation

setXFWrap

protected void setXFWrap(boolean w)
Sets whether the data in this cell is wrapped This method should only be called from its writable subclass CellXFRecord

Parameters:
w - the wrap flag

getWrap

public boolean getWrap()
Gets whether or not the contents of this cell are wrapped

Specified by:
getWrap in interface CellFormat
Returns:
TRUE if this cell's contents are wrapped, FALSE otherwise

setXFBorder

protected void setXFBorder(Border b,
                           BorderLineStyle ls,
                           Colour c)
Sets the border for this cell This method should only be called from its writable subclass CellXFRecord

Parameters:
b - the border
ls - the border line style

getBorder

public BorderLineStyle getBorder(Border border)
Gets the line style for the given cell border If a border type of ALL or NONE is specified, then a line style of NONE is returned

Specified by:
getBorder in interface CellFormat
Parameters:
border - the cell border we are interested in
Returns:
the line style of the specified border

getBorderLine

public BorderLineStyle getBorderLine(Border border)
Gets the line style for the given cell border If a border type of ALL or NONE is specified, then a line style of NONE is returned

Specified by:
getBorderLine in interface CellFormat
Parameters:
border - the cell border we are interested in
Returns:
the line style of the specified border

getBorderColour

public Colour getBorderColour(Border border)
Gets the line style for the given cell border If a border type of ALL or NONE is specified, then a line style of NONE is returned

Specified by:
getBorderColour in interface CellFormat
Parameters:
border - the cell border we are interested in
Returns:
the line style of the specified border

hasBorders

public final boolean hasBorders()
Determines if this cell format has any borders at all. Used to set the new borders when merging a group of cells

Specified by:
hasBorders in interface CellFormat
Returns:
TRUE if this cell has any borders, FALSE otherwise

initialize

public final void initialize(int pos,
                             FormattingRecords fr,
                             Fonts fonts)
                      throws NumFormatRecordsException
If this cell has not been read in from an existing Excel sheet, then initializes this record with the XF index passed in. Calls initialized on the font and format record

Parameters:
pos - the xf index to initialize this record with
fr - the containing formatting records
fonts - the container for the fonts
Throws:
NumFormatRecordsException

uninitialize

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


getXFIndex

public final int getXFIndex()
Accessor for the XF index

Returns:
the XF index for this cell

isInitialized

public final boolean isInitialized()
Accessor to see if this format is initialized

Returns:
TRUE if this format is initialized, FALSE otherwise

isRead

public final boolean isRead()
Accessor to see if this format was read in. Used when checking merged cells

Returns:
TRUE if this XF record was read in, FALSE if it was generated by the user API

getFormat

public Format getFormat()
Gets the format used by this format

Specified by:
getFormat in interface CellFormat
Returns:
the format

getFont

public Font getFont()
Gets the font used by this format

Specified by:
getFont in interface CellFormat
Returns:
the font

hashCode

public int hashCode()
Standard hash code implementation

Returns:
the hash code

equals

public boolean equals(java.lang.Object o)
Equals method. This is called when comparing writable formats in order to prevent duplicate formats being added to the workbook

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

setXFDetails

protected void setXFDetails(jxl.biff.XFRecord.XFType t,
                            int pf)
Sets the format type and parent format from the writable subclass

Parameters:
t - the xf type
pf - the parent format

setFont

public void setFont(FontRecord f)
Sets the font object with a workbook specific clone. Called from the CellValue object when the font has been identified as a statically shared font