FileDocCategorySizeDatePackage
ExHyperlink.javaAPI DocApache Poi 3.0.14472Thu May 31 18:45:28 BST 2007org.apache.poi.hslf.record

ExHyperlink

public class ExHyperlink extends RecordContainer
This class represents the data of a link in the document.
author
Nick Burch

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 voidfindInterestingChildren()
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.ExHyperlinkAtomgetExHyperlinkAtom()
Returns the ExHyperlinkAtom of this link

	
	       	  
	    return linkAtom; 
public java.lang.StringgetLinkTitle()
Returns the hyperlink's user-readable name

return
the hyperlink's user-readable name

        return linkDetailsA == null ? null : linkDetailsA.getText();
    
public java.lang.StringgetLinkURL()
Returns the URL of the link.

return
the URL of the link

		return linkDetailsB == null ? null : linkDetailsB.getText();
	
public longgetRecordType()
We are of type 4055

 return _type; 
public voidsetLinkURL(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 voidwriteOut(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);