ExHyperlinkpublic class ExHyperlink extends RecordContainer This class represents the data of a link in the document. |
Fields Summary |
---|
private byte[] | _header | private static long | _type | private ExHyperlinkAtom | linkAtom | private CString | linkDetailsA | private CString | linkDetailsB |
Constructors Summary |
---|
protected ExHyperlink(byte[] source, int start, int len)Set things up, and find our more interesting children
// Grab the header
_header = new byte[8];
System.arraycopy(source,start,_header,0,8);
// Find our children
_children = Record.findChildRecords(source,start+8,len-8);
findInterestingChildren();
| public ExHyperlink()Create a new ExHyperlink, with blank fields
_header = new byte[8];
_children = new Record[3];
// Setup our header block
_header[0] = 0x0f; // We are a container record
LittleEndian.putShort(_header, 2, (short)_type);
// Setup our child records
CString csa = new CString();
CString csb = new CString();
csa.setCount(0x00);
csb.setCount(0x10);
_children[0] = new ExHyperlinkAtom();
_children[1] = csa;
_children[2] = csb;
findInterestingChildren();
|
Methods Summary |
---|
public java.lang.String | _getDetailsA()Get the link details (field A)
return linkDetailsA == null ? null : linkDetailsA.getText();
| public java.lang.String | _getDetailsB()Get the link details (field B)
return linkDetailsB == null ? null : linkDetailsB.getText();
| private void | findInterestingChildren()Go through our child records, picking out the ones that are
interesting, and saving those for use by the easy helper
methods.
// First child should be the ExHyperlinkAtom
if(_children[0] instanceof ExHyperlinkAtom) {
linkAtom = (ExHyperlinkAtom)_children[0];
} else {
logger.log(POILogger.ERROR, "First child record wasn't a ExHyperlinkAtom, was of type " + _children[0].getRecordType());
}
for (int i = 1; i < _children.length; i++) {
if (_children[i] instanceof CString){
if ( linkDetailsA == null) linkDetailsA = (CString)_children[i];
else linkDetailsB = (CString)_children[i];
} else {
logger.log(POILogger.ERROR, "Record after ExHyperlinkAtom wasn't a CString, was of type " + _children[1].getRecordType());
}
}
| public org.apache.poi.hslf.record.ExHyperlinkAtom | getExHyperlinkAtom()Returns the ExHyperlinkAtom of this link
return linkAtom;
| public java.lang.String | getLinkTitle()Returns the hyperlink's user-readable name
return linkDetailsA == null ? null : linkDetailsA.getText();
| public java.lang.String | getLinkURL()Returns the URL of the link.
return linkDetailsB == null ? null : linkDetailsB.getText();
| public long | getRecordType()We are of type 4055 return _type;
| public void | setLinkURL(java.lang.String url)Sets the URL of the link
TODO: Figure out if we should always set both
linkDetailsA.setText(url);
// linkDetailsB isn't present in all PPT versions
if(linkDetailsB != null) {
linkDetailsB.setText(url);
}
| public void | writeOut(java.io.OutputStream out)Write the contents of the record back, so it can be written
to disk
writeOut(_header[0],_header[1],_type,_children,out);
|
|