org.apache.poi.hssf.record
Class HyperlinkRecord

java.lang.Object
  extended by org.apache.poi.hssf.record.Record
      extended by org.apache.poi.hssf.record.HyperlinkRecord

public class HyperlinkRecord
extends Record

The HyperlinkRecord wraps an HLINK-record from the Excel-97 format. Supports only external links for now (eg http://)

Author:
Mark Hissink Muller
Field Summary
protected static byte[] FILE_MONIKER
           
protected static byte[] FILE_TAIL
          Tail of a file link
protected static int HLINK_ABS
           
protected static int HLINK_LABEL
           
protected static int HLINK_PLACE
           
protected static int HLINK_URL
          Link flags
static short sid
           
protected static byte[] STD_MONIKER
           
protected static byte[] URL_MONIKER
           
protected static byte[] URL_TAIL
          Tail of a URL link
 
Constructor Summary
HyperlinkRecord()
          Create a new hyperlink
HyperlinkRecord(RecordInputStream in)
          Read hyperlink from input stream
 
Method Summary
 java.lang.Object clone()
           
protected  void fillFields(RecordInputStream in)
          called by the constructor, should set class level fields.
 java.lang.String getAddress()
          Hypelink address.
 int getFileOptions()
          Options for a file link
 short getFirstColumn()
          Return the column of the first cell that contains the hyperlink
 int getFirstRow()
          Return the row of the first cell that contains the hyperlink
 byte[] getGuid()
          Returns a 16-byte guid identifier.
 java.lang.String getLabel()
          Return text label for this hyperlink
 int getLabelOptions()
          Label options
 short getLastColumn()
          Set the column of the last cell that contains the hyperlink
 int getLastRow()
          Return the row of the last cell that contains the hyperlink
 int getLinkOptions()
          Link options.
 byte[] getMoniker()
          Returns a 16-byte moniker.
 int getRecordSize()
          gives the current serialized size of the record.
 short getSid()
          return the non static version of the id for this record.
 byte[] getTail()
           
 void newDocumentLink()
          Initialize a new document link
 void newFileLink()
          Initialize a new file link
 void newUrlLink()
          Initialize a new url link
 int serialize(int offset, byte[] data)
          called by the class that is responsible for writing this sucker.
 void setAddress(java.lang.String address)
          Hypelink address.
 void setFirstColumn(short col)
          Set the column of the first cell that contains the hyperlink
 void setFirstRow(int row)
          Set the row of the first cell that contains the hyperlink
 void setLabel(java.lang.String label)
          Sets text label for this hyperlink
 void setLastColumn(short col)
          Set the column of the last cell that contains the hyperlink
 void setLastRow(int row)
          Set the row of the last cell that contains the hyperlink
 java.lang.String toString()
          get a string representation of the record (for biffview/debugging)
protected  void validateSid(short id)
          called by constructor, should throw runtime exception in the event of a record passed with a differing ID.
 
Methods inherited from class org.apache.poi.hssf.record.Record
cloneViaReserialise, isInValueSection, isValue, serialize
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

HLINK_URL

protected static final int HLINK_URL
Link flags

See Also:
Constant Field Values

HLINK_ABS

protected static final int HLINK_ABS
See Also:
Constant Field Values

HLINK_LABEL

protected static final int HLINK_LABEL
See Also:
Constant Field Values

HLINK_PLACE

protected static final int HLINK_PLACE
See Also:
Constant Field Values

STD_MONIKER

protected static final byte[] STD_MONIKER

URL_MONIKER

protected static final byte[] URL_MONIKER

FILE_MONIKER

protected static final byte[] FILE_MONIKER

URL_TAIL

protected static final byte[] URL_TAIL
Tail of a URL link


FILE_TAIL

protected static final byte[] FILE_TAIL
Tail of a file link


sid

public static final short sid
See Also:
Constant Field Values
Constructor Detail

HyperlinkRecord

public HyperlinkRecord()
Create a new hyperlink


HyperlinkRecord

public HyperlinkRecord(RecordInputStream in)
Read hyperlink from input stream

Parameters:
in - the stream to read from
Method Detail

getFirstColumn

public short getFirstColumn()
Return the column of the first cell that contains the hyperlink

Returns:
the 0-based column of the first cell that contains the hyperlink

setFirstColumn

public void setFirstColumn(short col)
Set the column of the first cell that contains the hyperlink

Parameters:
col - the 0-based column of the first cell that contains the hyperlink

getLastColumn

public short getLastColumn()
Set the column of the last cell that contains the hyperlink

Returns:
the 0-based column of the last cell that contains the hyperlink

setLastColumn

public void setLastColumn(short col)
Set the column of the last cell that contains the hyperlink

Parameters:
col - the 0-based column of the last cell that contains the hyperlink

getFirstRow

public int getFirstRow()
Return the row of the first cell that contains the hyperlink

Returns:
the 0-based row of the first cell that contains the hyperlink

setFirstRow

public void setFirstRow(int row)
Set the row of the first cell that contains the hyperlink

Parameters:
row - the 0-based row of the first cell that contains the hyperlink

getLastRow

public int getLastRow()
Return the row of the last cell that contains the hyperlink

Returns:
the 0-based row of the last cell that contains the hyperlink

setLastRow

public void setLastRow(int row)
Set the row of the last cell that contains the hyperlink

Parameters:
row - the 0-based row of the last cell that contains the hyperlink

getGuid

public byte[] getGuid()
Returns a 16-byte guid identifier. Seems to always equal STD_MONIKER

Returns:
16-byte guid identifier

getMoniker

public byte[] getMoniker()
Returns a 16-byte moniker.

Returns:
16-byte moniker

getLabel

public java.lang.String getLabel()
Return text label for this hyperlink

Returns:
text to display

setLabel

public void setLabel(java.lang.String label)
Sets text label for this hyperlink

Parameters:
label - text label for this hyperlink

getAddress

public java.lang.String getAddress()
Hypelink address. Depending on the hyperlink type it can be URL, e-mail, patrh to a file, etc.

Returns:
the address of this hyperlink

setAddress

public void setAddress(java.lang.String address)
Hypelink address. Depending on the hyperlink type it can be URL, e-mail, patrh to a file, etc.

Parameters:
address - the address of this hyperlink

getLinkOptions

public int getLinkOptions()
Link options. Must be a combination of HLINK_* constants.


getLabelOptions

public int getLabelOptions()
Label options


getFileOptions

public int getFileOptions()
Options for a file link


getTail

public byte[] getTail()

fillFields

protected void fillFields(RecordInputStream in)
Description copied from class: Record
called by the constructor, should set class level fields. Should throw runtime exception for bad/icomplete data.

Specified by:
fillFields in class Record
Parameters:
in - the RecordInputstream to read the record from

getSid

public short getSid()
Description copied from class: Record
return the non static version of the id for this record.

Specified by:
getSid in class Record

validateSid

protected void validateSid(short id)
Description copied from class: Record
called by constructor, should throw runtime exception in the event of a record passed with a differing ID.

Specified by:
validateSid in class Record
Parameters:
id - alleged id for this record

serialize

public int serialize(int offset,
                     byte[] data)
Description copied from class: Record
called by the class that is responsible for writing this sucker. Subclasses should implement this so that their data is passed back in a byte array.

Specified by:
serialize in class Record
Parameters:
offset - to begin writing at
data - byte array containing instance data
Returns:
number of bytes written

getRecordSize

public int getRecordSize()
Description copied from class: Record
gives the current serialized size of the record. Should include the sid and reclength (4 bytes).

Overrides:
getRecordSize in class Record

toString

public java.lang.String toString()
Description copied from class: Record
get a string representation of the record (for biffview/debugging)

Overrides:
toString in class Record

newUrlLink

public void newUrlLink()
Initialize a new url link


newFileLink

public void newFileLink()
Initialize a new file link


newDocumentLink

public void newDocumentLink()
Initialize a new document link


clone

public java.lang.Object clone()
Overrides:
clone in class Record


Copyright 2008 The Apache Software Foundation or its licensors, as applicable.