From cf9efc65f2a0a4ce8084be00b9c5ad4e64c0806e Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Sun, 26 Feb 2006 20:52:42 +0000 Subject: [PATCH] Finish Comment2000Atom support git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@381167 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/org/apache/poi/hslf/record/Comment2000.java | 9 +++++++-- .../src/org/apache/poi/hslf/record/Comment2000Atom.java | 4 ++-- .../src/org/apache/poi/hslf/record/RecordTypes.java | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000.java b/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000.java index 37ecb8999..27ae0aa7a 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000.java @@ -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()); + } } /** diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000Atom.java b/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000Atom.java index 2a33443e6..99d4c9af3 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000Atom.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000Atom.java @@ -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); diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/RecordTypes.java b/src/scratchpad/src/org/apache/poi/hslf/record/RecordTypes.java index f58c2119f..96c2dad14 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/RecordTypes.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/RecordTypes.java @@ -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);