FileDocCategorySizeDatePackage
Comment2000.javaAPI DocApache Poi 3.0.14762Sun Mar 11 12:59:30 GMT 2007org.apache.poi.hslf.record

Comment2000

public class Comment2000 extends RecordContainer
This class represents a comment on a slide, in the format used by PPT 2000/XP/etc. (PPT 97 uses plain Escher Text Boxes for comments)
author
Nick Burch

Fields Summary
private byte[]
_header
private static long
_type
private CString
authorRecord
private CString
authorInitialsRecord
private CString
commentRecord
private Comment2000Atom
commentAtom
Constructors Summary
public Comment2000()
Create a new Comment2000, with blank fields

		_header = new byte[8];
		_children = new Record[4];
		
		// 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();
		CString csc = new CString();
		csa.setCount(0x00);
		csb.setCount(0x10);
		csc.setCount(0x20);
		_children[0] = csa;
		_children[1] = csb;
		_children[2] = csc;
		_children[3] = new Comment2000Atom();
		findInterestingChildren();
	
protected Comment2000(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();
	
Methods Summary
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 author
		if(_children[0] instanceof CString) {
			authorRecord = (CString)_children[0];
		} else {
			throw new IllegalStateException("First child record wasn't a CString, was of type " + _children[0].getRecordType());
		}
		// Second child should be the text
		if(_children[1] instanceof CString) {
			commentRecord = (CString)_children[1];
		} else {
			throw new IllegalStateException("Second child record wasn't a CString, was of type " + _children[1].getRecordType());
		}
		// Third child should be the author's initials
		if(_children[2] instanceof CString) {
			authorInitialsRecord = (CString)_children[2];
		} else {
			throw new IllegalStateException("Third child record wasn't a CString, was of type " + _children[2].getRecordType());
		}
		// Fourth child should be the comment atom
		if(_children[3] instanceof Comment2000Atom) {
			commentAtom = (Comment2000Atom)_children[3];
		} else {
			throw new IllegalStateException("Fourth child record wasn't a Comment2000Atom, was of type " + _children[3].getRecordType());
		}
	
public java.lang.StringgetAuthor()
Get the Author of this comment

		return authorRecord.getText();
	
public java.lang.StringgetAuthorInitials()
Get the Author's Initials of this comment

		return authorInitialsRecord.getText();
	
public org.apache.poi.hslf.record.Comment2000AtomgetComment2000Atom()
Returns the Comment2000Atom of this Comment

 
	
	       	  
	    return commentAtom; 
public longgetRecordType()
We are of type 1200

 return _type; 
public java.lang.StringgetText()
Get the text of this comment

		return commentRecord.getText();
	
public voidsetAuthor(java.lang.String author)
Set the Author of this comment

		authorRecord.setText(author);
	
public voidsetAuthorInitials(java.lang.String initials)
Set the Author's Initials of this comment

		authorInitialsRecord.setText(initials);
	
public voidsetText(java.lang.String text)
Set the text of this comment

		commentRecord.setText(text);
	
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);