]> source.dussan.org Git - poi.git/commitdiff
Finish Comment2000Atom support
authorNick Burch <nick@apache.org>
Sun, 26 Feb 2006 20:52:42 +0000 (20:52 +0000)
committerNick Burch <nick@apache.org>
Sun, 26 Feb 2006 20:52:42 +0000 (20:52 +0000)
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@381167 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hslf/record/Comment2000.java
src/scratchpad/src/org/apache/poi/hslf/record/Comment2000Atom.java
src/scratchpad/src/org/apache/poi/hslf/record/RecordTypes.java

index 37ecb8999b918479e88b877bd4f0fb7c286098d8..27ae0aa7a6c1f169a2a15d668f1eeb0a0f543daa 100644 (file)
@@ -16,12 +16,12 @@ public class Comment2000 extends RecordContainer {
        private CString authorRecord;
        private CString authorInitialsRecord;
        private CString commentRecord;
-       //private Comment2000Atom commentAtom; 
+       private Comment2000Atom commentAtom; 
        
        /** 
         * Returns the Comment2000Atom of this Comment
         */ 
-       //public Comment2000Atom getComment2000Atom() { return commentAtom; }
+       public Comment2000Atom getComment2000Atom() { return commentAtom; }
        
        /**
         * Get the Author of this comment
@@ -92,6 +92,11 @@ public class Comment2000 extends RecordContainer {
                        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());
+               }
        }
 
        /**
index 2a33443e6a1328eb9e9bb8789ab1a1edf3b32102..99d4c9af357f95cbc56b3919eb20e03dbf84da28 100644 (file)
@@ -46,8 +46,8 @@ public class Comment2000Atom extends RecordAtom
      * Constructs a brand new comment atom record.
      */
     protected Comment2000Atom() {
-        _header = new byte[28];
-        _data = new byte[8];
+        _header = new byte[8];
+        _data = new byte[28];
 
         LittleEndian.putShort(_header, 2, (short)getRecordType());
         LittleEndian.putInt(_header, 4, _data.length);
index f58c2119f096de917f66a715667257894b2db37f..96c2dad145ce461ac8cf2169a637b4c1996fcf59 100644 (file)
@@ -152,8 +152,8 @@ public class RecordTypes {
     
     // Records ~12000 seem to be related to the Comments used in PPT 2000/XP
     // (Comments in PPT97 are normal Escher text boxes)
-    public static final Type Comment2000 = new Type(12000,org.apache.poi.hslf.record.Comment2000.class);
-    public static final Type Comment2000Atom = new Type(12002,null);
+    public static final Type Comment2000 = new Type(12000,Comment2000.class);
+    public static final Type Comment2000Atom = new Type(12001,Comment2000Atom.class);
     public static final Type Comment2000Summary = new Type(12004,null);
     public static final Type Comment2000SummaryAtom = new Type(12005,null);