Author: nick
Date: Sun Mar 12 11:18:59 2006
New Revision: 385355

URL: http://svn.apache.org/viewcvs?rev=385355&view=rev
Log:
Support for creating a new Comment2000 record

Modified:
    
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000.java

Modified: 
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000.java
URL: 
http://svn.apache.org/viewcvs/jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000.java?rev=385355&r1=385354&r2=385355&view=diff
==============================================================================
--- 
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000.java
 (original)
+++ 
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000.java
 Sun Mar 12 11:18:59 2006
@@ -3,6 +3,8 @@
 import java.io.IOException;
 import java.io.OutputStream;
 
+import org.apache.poi.util.LittleEndian;
+
 /**
  * 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) 
@@ -72,7 +74,15 @@
 
                // Find our children
                _children = Record.findChildRecords(source,start+8,len-8);
+               findInterestingChildren();
+       }
 
+       /**
+        * Go through our child records, picking out the ones that are
+        *  interesting, and saving those for use by the easy helper
+        *  methods.
+        */     
+       private void findInterestingChildren() {
                // First child should be the author
                if(_children[0] instanceof CString) {
                        authorRecord = (CString)_children[0];
@@ -97,6 +107,31 @@
                } else {
                        throw new IllegalStateException("Fourth child record 
wasn't a Comment2000Atom, was of type " + _children[3].getRecordType());
                }
+       }
+       
+       /**
+        * Create a new Comment2000, with blank fields
+        */
+       public Comment2000() {
+               _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();
        }
 
        /**



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/

Reply via email to