poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ye...@apache.org
Subject svn commit: r690262 [2/2] - in /poi/trunk/src: documentation/content/xdocs/hslf/ scratchpad/src/org/apache/poi/hslf/blip/ scratchpad/src/org/apache/poi/hslf/dev/ scratchpad/src/org/apache/poi/hslf/model/ scratchpad/src/org/apache/poi/hslf/record/ scrat...
Date Fri, 29 Aug 2008 14:01:08 GMT
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjAtom.java?rev=690262&r1=690261&r2=690262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjAtom.java Fri Aug 29 07:01:04 2008
@@ -65,11 +65,35 @@
  */
 public class ExOleObjAtom extends RecordAtom {
 
+    /**
+     * The object) is displayed as an embedded object inside of a container,
+     */
     public static final int DRAW_ASPECT_VISIBLE = 1;
+    /**
+     *   The object is displayed as a thumbnail image.
+     */
+    public static final int DRAW_ASPECT_THUMBNAIL = 2;
+    /**
+     *   The object is displayed as an icon.
+     */
     public static final int DRAW_ASPECT_ICON = 4;
+    /**
+     *   The object is displayed on the screen as though it were printed to a printer.
+     */
+    public static final int DRAW_ASPECT_DOCPRINT = 8;
 
+    /**
+     * An embedded OLE object; the object is serialized and saved within the file.
+     */
     public static final int TYPE_EMBEDDED = 0;
+    /**
+     * A linked OLE object; the object is saved outside of the file.
+     */
     public static final int TYPE_LINKED = 1;
+    /**
+     * The OLE object is an ActiveX control.
+     */
+    public static final int TYPE_CONTROL = 2;
 
     public static final int SUBTYPE_DEFAULT = 0;
     public static final int SUBTYPE_CLIPART_GALLERY = 1;
@@ -101,14 +125,13 @@
     /**
      * Constructs a brand new link related atom record.
      */
-    protected ExOleObjAtom() {
+    public ExOleObjAtom() {
         _header = new byte[8];
-        _data = new byte[18];
+        _data = new byte[24];
 
+        LittleEndian.putShort(_header, 0, (short)1); //MUST be 0x1
         LittleEndian.putShort(_header, 2, (short)getRecordType());
         LittleEndian.putInt(_header, 4, _data.length);
-
-        // I hope it is fine for the other values to be zero.
     }
 
     /**
@@ -145,6 +168,16 @@
     }
 
     /**
+     * Sets whether the object can be completely seen, or if only the
+     * icon is visible.
+     *
+     * @param aspect the draw aspect, one of the {@code DRAW_ASPECT_*} constants.
+     */
+     public void setDrawAspect(int aspect) {
+        LittleEndian.putInt(_data, 0, aspect);
+    }
+
+    /**
      * Gets whether the object is embedded or linked.
      *
      * @return the type, one of the {@code TYPE_EMBEDDED_*} constants.
@@ -154,6 +187,15 @@
     }
 
     /**
+     * Sets whether the object is embedded or linked.
+     *
+     * @param type the type, one of the {@code TYPE_EMBEDDED_*} constants.
+     */
+    public void setType(int type) {
+        LittleEndian.putInt(_data, 4, type);
+    }
+
+    /**
      * Gets the unique identifier for the OLE object.
      *
      * @return the object ID.
@@ -163,6 +205,15 @@
     }
 
     /**
+     * Sets the unique identifier for the OLE object.
+     *
+     * @param id the object ID.
+     */
+    public void setObjID(int id) {
+        LittleEndian.putInt(_data, 8, id);
+    }
+
+    /**
      * Gets the type of OLE object.
      * 
      * @return the sub-type, one of the {@code SUBTYPE_*} constants.
@@ -172,6 +223,15 @@
     }
 
     /**
+     * Sets the type of OLE object.
+     *
+     * @param type the sub-type, one of the {@code SUBTYPE_*} constants.
+     */
+    public void setSubType(int type) {
+        LittleEndian.putInt(_data, 12, type);
+    }
+
+    /**
      * Gets the reference to the persistent object
      *
      * @return the reference to the persistent object, corresponds with an
@@ -182,6 +242,16 @@
     }
 
     /**
+     * Sets the reference to the persistent object
+     *
+     * @param ref the reference to the persistent object, corresponds with an
+     *         {@code ExOleObjStg} storage container.
+     */
+    public void setObjStgDataRef(int ref) {
+        LittleEndian.putInt(_data, 16, ref);
+    }
+
+    /**
      * Gets whether the object's image is blank.
      *
      * @return {@code true} if the object's image is blank.
@@ -192,6 +262,24 @@
     }
     
     /**
+     * Gets misc options (the last four bytes in the atom).
+     *
+     * @return {@code true} if the object's image is blank.
+     */
+    public int getOptions() {
+        // Even though this is a mere boolean, KOffice's code says it's an int.
+        return LittleEndian.getInt(_data, 20);
+    }
+
+    /**
+     * Sets misc options (the last four bytes in the atom).
+     */
+    public void setOptions(int opts) {
+        // Even though this is a mere boolean, KOffice's code says it's an int.
+        LittleEndian.putInt(_data, 20, opts);
+    }
+
+    /**
      * Returns the type (held as a little endian in bytes 3 and 4)
      * that this class handles.
      */
@@ -210,4 +298,16 @@
         out.write(_header);
         out.write(_data);
     }
+
+    public String toString(){
+        StringBuffer buf = new StringBuffer();
+        buf.append("ExOleObjAtom\n");
+        buf.append("  drawAspect: " + getDrawAspect() + "\n");
+        buf.append("  type: " + getType() + "\n");
+        buf.append("  objID: " + getObjID() + "\n");
+        buf.append("  subType: " + getSubType() + "\n");
+        buf.append("  objStgDataRef: " + getObjStgDataRef() + "\n");
+        buf.append("  options: " + getOptions() + "\n");
+        return buf.toString();
+    }
 }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java?rev=690262&r1=690261&r2=690262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java Fri Aug 29 07:01:04 2008
@@ -20,6 +20,7 @@
 import java.io.*;
 import java.util.zip.InflaterInputStream;
 import java.util.zip.DeflaterOutputStream;
+import java.util.Hashtable;
 
 import org.apache.poi.util.LittleEndian;
 
@@ -28,7 +29,7 @@
  *
  * @author Daniel Noll
  */
-public class ExOleObjStg extends RecordAtom implements PersistRecord {
+public class ExOleObjStg extends RecordAtom implements PositionDependentRecord, PersistRecord {
 
     private int _persistId; // Found from PersistPtrHolder
 
@@ -45,10 +46,11 @@
     /**
      * Constructs a new empty storage container.
      */
-    protected ExOleObjStg() {
+    public ExOleObjStg() {
         _header = new byte[8];
         _data = new byte[0];
 
+        LittleEndian.putShort(_header, 0, (short)0x10);
         LittleEndian.putShort(_header, 2, (short)getRecordType());
         LittleEndian.putInt(_header, 4, _data.length);
     }
@@ -90,6 +92,10 @@
         return new InflaterInputStream(compressedStream);
     }
 
+    public byte[] getRawData() {
+        return _data;
+    }
+
     /**
      * Sets the embedded data.
      *
@@ -144,4 +150,23 @@
     public void setPersistId(int id) {
         _persistId = id;
     }
+
+    /** Our location on the disk, as of the last write out */
+    protected int myLastOnDiskOffset;
+
+    /** Fetch our location on the disk, as of the last write out */
+    public int getLastOnDiskOffset() { return myLastOnDiskOffset; }
+
+    /**
+     * Update the Record's idea of where on disk it lives, after a write out.
+     * Use with care...
+     */
+    public void setLastOnDiskOffset(int offset) {
+        myLastOnDiskOffset = offset;
+    }
+
+    public void updateOtherRecordReferences(Hashtable oldToNewReferencesLookup) {
+        return;
+    }
+
 }

Added: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExVideoContainer.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExVideoContainer.java?rev=690262&view=auto
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExVideoContainer.java (added)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExVideoContainer.java Fri Aug 29 07:01:04 2008
@@ -0,0 +1,108 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.poi.hslf.record;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.POILogger;
+
+/**
+ * A container record that specifies information about external video data.
+ *
+ * @author Yegor Kozlov
+ */
+public class ExVideoContainer extends RecordContainer {
+	private byte[] _header;
+
+	// Links to our more interesting children
+	private ExMediaAtom mediaAtom;
+    //the UNC or local path to a video file.
+    private CString pathAtom;
+
+	/**
+	 * Set things up, and find our more interesting children
+	 */
+	protected ExVideoContainer(byte[] source, int start, int len) {
+		// 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();
+	}
+
+	/**
+	 * 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 ExMediaAtom
+		if(_children[0] instanceof ExMediaAtom) {
+			mediaAtom = (ExMediaAtom)_children[0];
+		} else {
+			logger.log(POILogger.ERROR, "First child record wasn't a ExMediaAtom, was of type " + _children[0].getRecordType());
+		}
+        if(_children[1] instanceof CString) {
+            pathAtom = (CString)_children[1];
+        } else {
+            logger.log(POILogger.ERROR, "Second child record wasn't a CString, was of type " + _children[1].getRecordType());
+        }
+	}
+
+	/**
+	 * Create a new ExVideoContainer, with blank fields
+	 */
+	public ExVideoContainer() {
+        // Setup our header block
+		_header = new byte[8];
+		_header[0] = 0x0f; // We are a container record
+		LittleEndian.putShort(_header, 2, (short)getRecordType());
+		
+        _children = new Record[2];
+		_children[0] = mediaAtom = new ExMediaAtom();
+		_children[1] = pathAtom = new CString();
+	}
+
+	/**
+	 * We are of type 4103
+	 */
+	public long getRecordType() { return RecordTypes.ExVideoContainer.typeID; }
+
+	/**
+	 * Write the contents of the record back, so it can be written
+	 *  to disk
+	 */
+	public void writeOut(OutputStream out) throws IOException {
+		writeOut(_header[0],_header[1],getRecordType(),_children,out);
+	}
+
+    /**
+     * Returns the ExMediaAtom of this link
+     */
+    public ExMediaAtom getExMediaAtom() { return mediaAtom; }
+
+    /**
+     * Returns the Path Atom (CString) of this link
+     */
+    public CString getPathAtom() { return pathAtom; }
+
+}

Propchange: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExVideoContainer.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/InteractiveInfoAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/InteractiveInfoAtom.java?rev=690262&r1=690261&r2=690262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/InteractiveInfoAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/InteractiveInfoAtom.java Fri Aug 29 07:01:04 2008
@@ -39,27 +39,39 @@
     /**
      * Action Table
      */
-    public static final int ACTION_NONE = 0;
-    public static final int ACTION_MACRO = 1;
-    public static final int ACTION_RUNPROGRAM = 2;
-    public static final int ACTION_JUMP = 3;
-    public static final int ACTION_HYPERLINK = 4;
-    public static final int ACTION_OLE = 5;
-    public static final int ACTION_MEDIA = 6;
-    public static final int ACTION_CUSTOMSHOW = 7;
+    public static final byte ACTION_NONE = 0;
+    public static final byte ACTION_MACRO = 1;
+    public static final byte ACTION_RUNPROGRAM = 2;
+    public static final byte ACTION_JUMP = 3;
+    public static final byte ACTION_HYPERLINK = 4;
+    public static final byte ACTION_OLE = 5;
+    public static final byte ACTION_MEDIA = 6;
+    public static final byte ACTION_CUSTOMSHOW = 7;
 
     /**
      *  Jump Table
      */
-    public static final int JUMP_NONE = 0;
-    public static final int JUMP_NEXTSLIDE = 1;
-    public static final int JUMP_PREVIOUSSLIDE = 2;
-    public static final int JUMP_FIRSTSLIDE = 3;
-    public static final int JUMP_LASTSLIDE = 4;
-    public static final int JUMP_LASTSLIDEVIEWED = 5;
-    public static final int JUMP_ENDSHOW = 6;
-
-
+    public static final byte JUMP_NONE = 0;
+    public static final byte JUMP_NEXTSLIDE = 1;
+    public static final byte JUMP_PREVIOUSSLIDE = 2;
+    public static final byte JUMP_FIRSTSLIDE = 3;
+    public static final byte JUMP_LASTSLIDE = 4;
+    public static final byte JUMP_LASTSLIDEVIEWED = 5;
+    public static final byte JUMP_ENDSHOW = 6;
+
+    /**
+     * Types of hyperlinks
+     */
+    public static final byte LINK_NextSlide = 0x00;
+    public static final byte LINK_PreviousSlide = 0x01;
+    public static final byte LINK_FirstSlide = 0x02;
+    public static final byte LINK_LastSlide = 0x03;
+    public static final byte LINK_CustomShow = 0x06;
+    public static final byte LINK_SlideNumber = 0x07;
+    public static final byte LINK_Url = 0x08;
+    public static final byte LINK_OtherPresentation = 0x09;
+    public static final byte LINK_OtherFile = 0x0A;
+    public static final byte LINK_NULL = (byte)0xFF;
 
     /**
      * Record header.

Added: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/OEShapeAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/OEShapeAtom.java?rev=690262&view=auto
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/OEShapeAtom.java (added)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/OEShapeAtom.java Fri Aug 29 07:01:04 2008
@@ -0,0 +1,110 @@
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+        
+
+package org.apache.poi.hslf.record;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Date;
+
+import org.apache.poi.hslf.util.SystemTimeUtils;
+import org.apache.poi.util.LittleEndian;
+
+/**
+ * Atom that contains information that describes shape client data.
+ *
+ * @author Yegor Kozlov
+ */
+public class OEShapeAtom extends RecordAtom
+{
+
+    /**
+     * Record header.
+     */
+    private byte[] _header;
+
+    /**
+     * record data
+     */
+    private byte[] _recdata;
+
+    /**
+     * Constructs a brand new link related atom record.
+     */
+    public OEShapeAtom() {
+        _recdata = new byte[4];
+
+        _header = new byte[8];
+        LittleEndian.putShort(_header, 2, (short)getRecordType());
+        LittleEndian.putInt(_header, 4, _recdata.length);
+    }
+
+    /**
+     * Constructs the link related atom record from its
+     *  source data.
+     *
+     * @param source the source data as a byte array.
+     * @param start the start offset into the byte array.
+     * @param len the length of the slice in the byte array.
+     */
+    protected OEShapeAtom(byte[] source, int start, int len) {
+        // Get the header
+        _header = new byte[8];
+        System.arraycopy(source,start,_header,0,8);
+
+        // Grab the record data
+        _recdata = new byte[len-8];
+        System.arraycopy(source,start+8,_recdata,0,len-8);
+    }
+
+    /**
+     * Gets the record type.
+     * @return the record type.
+     */
+    public long getRecordType() { return RecordTypes.OEShapeAtom.typeID; }
+
+    /**
+     * Write the contents of the record back, so it can be written
+     * to disk
+     *
+     * @param out the output stream to write to.
+     * @throws java.io.IOException if an error occurs.
+     */
+    public void writeOut(OutputStream out) throws IOException {
+        out.write(_header);
+        out.write(_recdata);
+    }
+
+    /**
+     * shape flags.
+     *
+     * @return  shape flags.
+     */
+    public int getOptions(){
+        return LittleEndian.getInt(_recdata, 0);
+    }
+
+    /**
+     * shape flags.
+     *
+     * @param id  shape flags.
+     */
+    public void setOptions(int id){
+         LittleEndian.putInt(_recdata, 0, id);
+    }
+}

Propchange: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/OEShapeAtom.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/RecordTypes.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/RecordTypes.java?rev=690262&r1=690261&r2=690262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/RecordTypes.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/RecordTypes.java Fri Aug 29 07:01:04 2008
@@ -77,7 +77,7 @@
     public static final Type BookmarkSeedAtom = new Type(2025,null);
     public static final Type ColorSchemeAtom = new Type(2032,ColorSchemeAtom.class);
     public static final Type ExObjRefAtom = new Type(3009,null);
-    public static final Type OEShapeAtom = new Type(3009,null);
+    public static final Type OEShapeAtom = new Type(3009,OEShapeAtom.class);
     public static final Type OEPlaceholderAtom = new Type(3011,OEPlaceholderAtom.class);
     public static final Type GPopublicintAtom = new Type(3024,null);
     public static final Type GRatioAtom = new Type(3031,null);
@@ -128,11 +128,11 @@
     public static final Type DateTimeMCAtom = new Type(4087,null);
     public static final Type GenericDateMCAtom = new Type(4088,null);
     public static final Type FooterMCAtom = new Type(4090,null);
-    public static final Type ExControlAtom = new Type(4091,null);
-    public static final Type ExMediaAtom = new Type(4100,null);
-    public static final Type ExVideo = new Type(4101,null);
-    public static final Type ExAviMovie = new Type(4102,null);
-    public static final Type ExMCIMovie = new Type(4103,null);
+    public static final Type ExControlAtom = new Type(4091,ExControlAtom.class);
+    public static final Type ExMediaAtom = new Type(4100,ExMediaAtom.class);
+    public static final Type ExVideoContainer = new Type(4101,ExVideoContainer.class);
+    public static final Type ExAviMovie = new Type(4102,ExAviMovie.class);
+    public static final Type ExMCIMovie = new Type(4103,ExMCIMovie.class);
     public static final Type ExMIDIAudio = new Type(4109,null);
     public static final Type ExCDAudio = new Type(4110,null);
     public static final Type ExWAVAudioEmbedded = new Type(4111,null);
@@ -140,7 +140,8 @@
     public static final Type ExOleObjStg = new Type(4113,ExOleObjStg.class);
     public static final Type ExCDAudioAtom = new Type(4114,null);
     public static final Type ExWAVAudioEmbeddedAtom = new Type(4115,null);
-    public static final Type AnimationInfoAtom = new Type(4116,null);
+    public static final Type AnimationInfo = new Type(4116,AnimationInfo.class);
+    public static final Type AnimationInfoAtom = new Type(4081,AnimationInfoAtom.class);
     public static final Type RTFDateTimeMCAtom = new Type(4117,null);
     public static final Type ProgTags = new Type(5000,DummyPositionSensitiveRecordWithChildren.class);
     public static final Type ProgStringTag = new Type(5001,null);

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java?rev=690262&r1=690261&r2=690262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java Fri Aug 29 07:01:04 2008
@@ -367,8 +367,14 @@
 
 		rawContents	= baos.toByteArray();
 	}
-	
-	/**
+
+    public void setRawContents(byte[] bytes) {
+        rawContents = bytes;
+        reserved = new byte[0];
+        initialised = false;
+    }
+
+    /**
 	 * Create a new Paragraph TextPropCollection, and add it to the list
 	 * @param charactersCovered The number of characters this TextPropCollection will cover
 	 * @return the new TextPropCollection, which will then be in the list

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextRulerAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextRulerAtom.java?rev=690262&r1=690261&r2=690262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextRulerAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextRulerAtom.java Fri Aug 29 07:01:04 2008
@@ -53,7 +53,7 @@
     /**
      * Constructs a new empty ruler atom.
      */
-    protected TextRulerAtom() {
+    public TextRulerAtom() {
         _header = new byte[8];
         _data = new byte[0];
 
@@ -191,4 +191,19 @@
     public int[] getBulletOffsets(){
         return bulletOffsets;
     }
+
+    public static TextRulerAtom getParagraphInstance(){
+        byte[] data = new byte[] {
+            0x00, 0x00, (byte)0xA6, 0x0F, 0x0A, 0x00, 0x00, 0x00,
+            0x10, 0x03, 0x00, 0x00, (byte)0xF9, 0x00, 0x41, 0x01, 0x41, 0x01
+        };
+        TextRulerAtom ruler = new TextRulerAtom(data, 0, data.length);
+        return ruler;
+    }
+
+    public void setParagraphIndent(short tetxOffset, short bulletOffset){
+        LittleEndian.putShort(_data, 4, tetxOffset);
+        LittleEndian.putShort(_data, 6, bulletOffset);
+        LittleEndian.putShort(_data, 8, bulletOffset);
+    }
 }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/RichTextRun.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/RichTextRun.java?rev=690262&r1=690261&r2=690262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/RichTextRun.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/RichTextRun.java Fri Aug 29 07:01:04 2008
@@ -687,6 +687,7 @@
      */
     public void setBulletFont(int idx) {
         setParaTextPropVal("bullet.font", idx);
+        setFlag(false, ParagraphFlagsTextProp.BULLET_HARDFONT_IDX, true);
     }
 
     /**

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java?rev=690262&r1=690261&r2=690262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java Fri Aug 29 07:01:04 2008
@@ -24,11 +24,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.List;
+import java.util.*;
 
 import org.apache.poi.ddf.EscherBSERecord;
 import org.apache.poi.ddf.EscherContainerRecord;
@@ -38,21 +34,9 @@
 import org.apache.poi.hslf.exceptions.CorruptPowerPointFileException;
 import org.apache.poi.hslf.exceptions.HSLFException;
 import org.apache.poi.hslf.model.*;
-import org.apache.poi.hslf.record.Document;
-import org.apache.poi.hslf.record.DocumentAtom;
-import org.apache.poi.hslf.record.FontCollection;
-import org.apache.poi.hslf.record.FontEntityAtom;
-import org.apache.poi.hslf.record.HeadersFootersContainer;
-import org.apache.poi.hslf.record.ParentAwareRecord;
-import org.apache.poi.hslf.record.PersistPtrHolder;
-import org.apache.poi.hslf.record.PositionDependentRecord;
-import org.apache.poi.hslf.record.PositionDependentRecordContainer;
-import org.apache.poi.hslf.record.Record;
-import org.apache.poi.hslf.record.RecordContainer;
-import org.apache.poi.hslf.record.RecordTypes;
-import org.apache.poi.hslf.record.SlideListWithText;
-import org.apache.poi.hslf.record.SlidePersistAtom;
-import org.apache.poi.hslf.record.UserEditAtom;
+import org.apache.poi.hslf.model.Notes;
+import org.apache.poi.hslf.model.Slide;
+import org.apache.poi.hslf.record.*;
 import org.apache.poi.hslf.record.SlideListWithText.SlideAtomsSet;
 import org.apache.poi.util.ArrayUtil;
 import org.apache.poi.util.POILogFactory;
@@ -590,9 +574,8 @@
 	 * Create a blank <code>Slide</code>.
 	 *
 	 * @return  the created <code>Slide</code>
-	 * @throws IOException
 	 */
-  	public Slide createSlide() throws IOException {
+  	public Slide createSlide() {
   		SlideListWithText slist = null;
 
   		// We need to add the records to the SLWT that deals
@@ -660,9 +643,13 @@
   		for (int i = 0; i < _records.length; i++) {
   			Record record = _records[i];
   			ByteArrayOutputStream out = new ByteArrayOutputStream();
-  			record.writeOut(out);
+  			try {
+                record.writeOut(out);
+            } catch (IOException e){
+                throw new HSLFException(e);
+            }
 
-  			// Grab interesting records as they come past
+              // Grab interesting records as they come past
   			if(_records[i].getRecordType() == RecordTypes.PersistPtrIncrementalBlock.typeID){
   				ptr = (PersistPtrHolder)_records[i];
   			}
@@ -888,4 +875,72 @@
         }
     }
 
+    /**
+     * Add a movie in this presentation
+     *
+     * @param path the path or url to the movie
+     * @return 0-based index of the movie
+     */
+    public int addMovie(String path, int type) {
+        ExObjList lst = (ExObjList)_documentRecord.findFirstOfType(RecordTypes.ExObjList.typeID);
+        if(lst == null){
+            lst = new ExObjList();
+            _documentRecord.addChildAfter(lst, _documentRecord.getDocumentAtom());
+        }
+
+        ExObjListAtom objAtom = lst.getExObjListAtom();
+        //increment the object ID seed
+        int objectId = (int)objAtom.getObjectIDSeed() + 1;
+        objAtom.setObjectIDSeed(objectId);
+        ExMCIMovie mci;
+        switch (type){
+            case MovieShape.MOVIE_MPEG:
+                mci = new ExMCIMovie();
+                break;
+            case MovieShape.MOVIE_AVI:
+                mci = new ExAviMovie();
+                break;
+            default:
+                throw new IllegalArgumentException("Unsupported Movie: " + type);
+        }
+
+        lst.appendChildRecord(mci);
+        ExVideoContainer exVideo = mci.getExVideo();
+        exVideo.getExMediaAtom().setObjectId(objectId);
+        exVideo.getExMediaAtom().setMask(0xE80000);
+        exVideo.getPathAtom().setText(path);
+        return objectId;
+    }
+
+    /**
+     * Add a control in this presentation
+     *
+     * @param name   name of the control, e.g. "Shockwave Flash Object"
+     * @param progId OLE Programmatic Identifier, e.g. "ShockwaveFlash.ShockwaveFlash.9"
+     * @return 0-based index of the control
+     */
+    public int addControl(String name, String progId) {
+        ExObjList lst = _documentRecord.getExObjList();
+        if (lst == null) {
+            lst = new ExObjList();
+            _documentRecord.addChildAfter(lst, _documentRecord.getDocumentAtom());
+        }
+        ExObjListAtom objAtom = lst.getExObjListAtom();
+        //increment the object ID seed
+        int objectId = (int) objAtom.getObjectIDSeed() + 1;
+        objAtom.setObjectIDSeed(objectId);
+        ExControl ctrl = new ExControl();
+        ExOleObjAtom oleObj = ctrl.getExOleObjAtom();
+        oleObj.setObjID(objectId);
+        oleObj.setDrawAspect(ExOleObjAtom.DRAW_ASPECT_VISIBLE);
+        oleObj.setType(ExOleObjAtom.TYPE_CONTROL);
+        oleObj.setSubType(ExOleObjAtom.SUBTYPE_DEFAULT);
+
+        ctrl.setProgId(progId);
+        ctrl.setMenuName(name);
+        ctrl.setClipboardName(name);
+        lst.addChildAfter(ctrl, objAtom);
+
+        return objectId;
+    }
 }

Added: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestMovieShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestMovieShape.java?rev=690262&view=auto
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestMovieShape.java (added)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestMovieShape.java Fri Aug 29 07:01:04 2008
@@ -0,0 +1,66 @@
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+package org.apache.poi.hslf.model;
+
+import junit.framework.TestCase;
+
+import java.io.*;
+import java.awt.*;
+import java.awt.geom.Rectangle2D;
+
+import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.hslf.HSLFSlideShow;
+
+/**
+ * Test <code>MovieShape</code> object.
+ * 
+ * @author Yegor Kozlov
+ */
+public class TestMovieShape extends TestCase {
+
+    protected String cwd = System.getProperty("HSLF.testdata.path");
+
+    public void testCreate() throws Exception {
+        SlideShow ppt = new SlideShow();
+
+        Slide slide = ppt.createSlide();
+
+        String path = cwd + "/test-movie.mpg";
+        int movieIdx = ppt.addMovie(path, MovieShape.MOVIE_MPEG);
+        int thumbnailIdx = ppt.addPicture(new File(cwd, "tomcat.png"), Picture.PNG);
+
+        MovieShape shape = new MovieShape(movieIdx, thumbnailIdx);
+        shape.setAnchor(new Rectangle2D.Float(300,225,120,90));
+        slide.addShape(shape);
+
+        assertEquals(path, shape.getPath());
+        assertTrue(shape.isAutoPlay());
+        shape.setAutoPlay(false);
+        assertFalse(shape.isAutoPlay());
+
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        ppt.write(out);
+
+        ppt = new SlideShow(new ByteArrayInputStream(out.toByteArray()));
+        slide = ppt.getSlides()[0];
+        shape = (MovieShape)slide.getShapes()[0];
+        assertEquals(path, shape.getPath());
+        assertFalse(shape.isAutoPlay());
+
+    }
+
+}

Propchange: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestMovieShape.java
------------------------------------------------------------------------------
    svn:executable = *

Added: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java?rev=690262&view=auto
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java (added)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java Fri Aug 29 07:01:04 2008
@@ -0,0 +1,63 @@
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+package org.apache.poi.hslf.model;
+
+import junit.framework.TestCase;
+
+import java.io.*;
+import java.awt.*;
+import java.awt.geom.Rectangle2D;
+
+import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.hslf.HSLFSlideShow;
+
+/**
+ * Test <code>Table</code> object.
+ * 
+ * @author Yegor Kozlov
+ */
+public class TestTable extends TestCase {
+
+    /**
+     * Test that ShapeFactory works properly and returns <code>Table</code>
+     */
+    public void testShapeFactory() throws Exception {
+        SlideShow ppt = new SlideShow();
+
+        Slide slide = ppt.createSlide();
+
+        Table tbl = new Table(2, 5);
+        slide.addShape(tbl);
+
+        assertTrue(slide.getShapes()[0] instanceof Table);
+        Table tbl2 = (Table)slide.getShapes()[0];
+        assertEquals(tbl.getNumberOfColumns(), tbl2.getNumberOfColumns());
+        assertEquals(tbl.getNumberOfRows(), tbl2.getNumberOfRows());
+
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        ppt.write(out);
+        out.close();
+
+        ppt = new SlideShow(new ByteArrayInputStream(out.toByteArray()));
+        slide = ppt.getSlides()[0];
+        assertTrue(slide.getShapes()[0] instanceof Table);
+        Table tbl3 = (Table)slide.getShapes()[0];
+        assertEquals(tbl.getNumberOfColumns(), tbl3.getNumberOfColumns());
+        assertEquals(tbl.getNumberOfRows(), tbl3.getNumberOfRows());
+    }
+
+}

Propchange: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java
------------------------------------------------------------------------------
    svn:executable = *

Added: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestAnimationInfoAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestAnimationInfoAtom.java?rev=690262&view=auto
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestAnimationInfoAtom.java (added)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestAnimationInfoAtom.java Fri Aug 29 07:01:04 2008
@@ -0,0 +1,91 @@
+
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+        
+
+
+package org.apache.poi.hslf.record;
+
+
+import junit.framework.TestCase;
+import java.io.ByteArrayOutputStream;
+import java.util.Arrays;
+
+import org.apache.poi.util.HexDump;
+
+/**
+ * Tests that {@link HeadersFootersAtom} works properly
+ *
+ * @author Yegor Kozlov
+ */
+public class TestAnimationInfoAtom extends TestCase {
+    // From a real file
+    /*
+     <AnimationInfoAtom info="1" type="4081" size="28" offset="4015" header="01 00 F1 0F 1C 00 00 00 ">
+       00 00 00 07 04 05 00 00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 00
+       00 00 00
+     </AnimationInfoAtom>
+     */
+    private byte[] data = new byte[] {
+         0x01, 0x00, (byte)0xF1, 0x0F, 0x1C, 0x00, 0x00, 0x00,
+            0x00, 0x00, 0x00, 0x07, 0x04, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+            0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+    };
+
+    public void testRead() throws Exception {
+        AnimationInfoAtom record = new AnimationInfoAtom(data, 0, data.length);
+        assertEquals(RecordTypes.AnimationInfoAtom.typeID, record.getRecordType());
+        assertTrue(record.getFlag(AnimationInfoAtom.Automatic));
+        assertTrue(record.getFlag(AnimationInfoAtom.Play));
+        assertTrue(record.getFlag(AnimationInfoAtom.Synchronous));
+        assertFalse(record.getFlag(AnimationInfoAtom.Reverse));
+        assertFalse(record.getFlag(AnimationInfoAtom.Sound));
+        assertFalse(record.getFlag(AnimationInfoAtom.StopSound));
+        assertFalse(record.getFlag(AnimationInfoAtom.Hide));
+        assertFalse(record.getFlag(AnimationInfoAtom.AnimateBg));
+        assertEquals(0x07000000, record.getDimColor());
+        assertEquals(0, record.getSoundIdRef());
+        assertEquals(0, record.getDelayTime());
+        assertEquals(2, record.getOrderID());
+        assertEquals(0, record.getSlideCount());
+    }
+
+    public void testWrite() throws Exception {
+        AnimationInfoAtom record = new AnimationInfoAtom(data, 0, data.length);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        record.writeOut(baos);
+        byte[] b = baos.toByteArray();
+
+        assertTrue(Arrays.equals(data, b));
+    }
+
+    public void testNewRecord() throws Exception {
+        AnimationInfoAtom record = new AnimationInfoAtom();
+        record.setDimColor(0x07000000);
+        record.setOrderID(2);
+        record.setFlag(AnimationInfoAtom.Automatic, true);
+        record.setFlag(AnimationInfoAtom.Play, true);
+        record.setFlag(AnimationInfoAtom.Synchronous, true);
+
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        record.writeOut(baos);
+        byte[] b = baos.toByteArray();
+
+        assertTrue(Arrays.equals(data, b));
+    }
+
+}
\ No newline at end of file

Propchange: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestAnimationInfoAtom.java
------------------------------------------------------------------------------
    svn:executable = *

Added: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExControl.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExControl.java?rev=690262&view=auto
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExControl.java (added)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExControl.java Fri Aug 29 07:01:04 2008
@@ -0,0 +1,127 @@
+
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+        
+
+
+package org.apache.poi.hslf.record;
+
+
+import junit.framework.TestCase;
+import java.io.ByteArrayOutputStream;
+import java.util.Arrays;
+
+/**
+ * Tests that {@link org.apache.poi.hslf.record.ExControl} works properly
+ *
+ * @author Yegor Kozlov
+ */
+public class TestExControl extends TestCase {
+
+	// From a real file (embedded SWF control)
+    /*
+     <ExControl info="15" type="4078" size="218" offset="76" header="0F 00 EE 0F DA 00 00 00 ">
+       <ExControlAtom info="0" type="4091" size="4" offset="84" header="00 00 FB 0F 04 00 00 00 ">
+         00 01 00 00
+       </ExControlAtom>
+       <ExOleObjAtom info="1" type="4035" size="24" offset="96" header="01 00 C3 0F 18 00 00 00 ">
+         01 00 00 00 02 00 00 00 01 00 00 00 00 00 00 00 02 00 00 00 00 96 13 00
+       </ExOleObjAtom>
+       <CString info="16" type="4026" size="44" offset="128" header="10 00 BA 0F 2C 00 00 00 ">
+         53 00 68 00 6F 00 63 00 6B 00 77 00 61 00 76 00 65 00 20 00 46 00 6C 00 61
+         00 73 00 68 00 20 00 4F 00 62 00 6A 00 65 00 63 00 74 00
+       </CString>
+       <CString info="32" type="4026" size="62" offset="180" header="20 00 BA 0F 3E 00 00 00 ">
+         53 00 68 00 6F 00 63 00 6B 00 77 00 61 00 76 00 65 00 46 00 6C 00 61 00 73
+         00 68 00 2E 00 53 00 68 00 6F 00 63 00 6B 00 77 00 61 00 76 00 65 00 46 00
+         6C 00 61 00 73 00 68 00 2E 00 39 00
+       </CString>
+       <CString info="48" type="4026" size="44" offset="250" header="30 00 BA 0F 2C 00 00 00 ">
+         53 00 68 00 6F 00 63 00 6B 00 77 00 61 00 76 00 65 00 20 00 46 00 6C 00 61
+         00 73 00 68 00 20 00 4F 00 62 00 6A 00 65 00 63 00 74 00
+       </CString>
+     </ExControl>
+     */
+    private byte[] data = new byte[] {
+            0x0F, 0x00, (byte)0xEE, 0x0F, (byte)0xDA, 0x00, 0x00, 0x00, 0x00, 0x00, (byte)0xFB, 0x0F, 0x04, 0x00, 0x00, 0x00,
+            0x00, 0x01, 0x00, 0x00, 0x01, 0x00, (byte)0xC3, 0x0F, 0x18, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00,
+            0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, (byte)0x96, 0x13, 0x00,
+            0x10, 0x00, (byte)0xBA, 0x0F, 0x2C, 0x00, 0x00, 0x00, 0x53, 0x00, 0x68, 0x00, 0x6F, 0x00, 0x63, 0x00, 0x6B, 0x00,
+            0x77, 0x00, 0x61, 0x00, 0x76, 0x00, 0x65, 0x00, 0x20, 0x00, 0x46, 0x00, 0x6C, 0x00, 0x61, 0x00, 0x73, 0x00, 0x68,
+            0x00, 0x20, 0x00, 0x4F, 0x00, 0x62, 0x00, 0x6A, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x20, 0x00, (byte)0xBA,
+            0x0F, 0x3E, 0x00, 0x00, 0x00, 0x53, 0x00, 0x68, 0x00, 0x6F, 0x00, 0x63, 0x00, 0x6B, 0x00, 0x77, 0x00, 0x61, 0x00,
+            0x76, 0x00, 0x65, 0x00, 0x46, 0x00, 0x6C, 0x00, 0x61, 0x00, 0x73, 0x00, 0x68, 0x00, 0x2E, 0x00, 0x53, 0x00, 0x68,
+            0x00, 0x6F, 0x00, 0x63, 0x00, 0x6B, 0x00, 0x77, 0x00, 0x61, 0x00, 0x76, 0x00, 0x65, 0x00, 0x46, 0x00, 0x6C, 0x00,
+            0x61, 0x00, 0x73, 0x00, 0x68, 0x00, 0x2E, 0x00, 0x39, 0x00, 0x30, 0x00, (byte)0xBA, 0x0F, 0x2C, 0x00, 0x00, 0x00,
+            0x53, 0x00, 0x68, 0x00, 0x6F, 0x00, 0x63, 0x00, 0x6B, 0x00, 0x77, 0x00, 0x61, 0x00, 0x76, 0x00, 0x65, 0x00, 0x20,
+            0x00, 0x46, 0x00, 0x6C, 0x00, 0x61, 0x00, 0x73, 0x00, 0x68, 0x00, 0x20, 0x00, 0x4F, 0x00, 0x62, 0x00, 0x6A, 0x00,
+            0x65, 0x00, 0x63, 0x00, 0x74, 0x00
+    };
+
+    public void testRead() throws Exception {
+		ExControl record = new ExControl(data, 0, data.length);
+		assertEquals(RecordTypes.ExControl.typeID, record.getRecordType());
+
+        assertNotNull(record.getExControlAtom());
+        assertEquals(256, record.getExControlAtom().getSlideId());
+
+        ExOleObjAtom oleObj = record.getExOleObjAtom();
+        assertNotNull(oleObj);
+        assertEquals(oleObj.getDrawAspect(), ExOleObjAtom.DRAW_ASPECT_VISIBLE);
+        assertEquals(oleObj.getType(), ExOleObjAtom.TYPE_CONTROL);
+        assertEquals(oleObj.getSubType(), ExOleObjAtom.SUBTYPE_DEFAULT);
+
+        assertEquals("Shockwave Flash Object", record.getMenuName());
+        assertEquals("ShockwaveFlash.ShockwaveFlash.9", record.getProgId());
+        assertEquals("Shockwave Flash Object", record.getClipboardName());
+    }
+
+	public void testWrite() throws Exception {
+		ExControl record = new ExControl(data, 0, data.length);
+		ByteArrayOutputStream baos = new ByteArrayOutputStream();
+		record.writeOut(baos);
+		byte[] b = baos.toByteArray();
+
+        assertTrue(Arrays.equals(data, b));
+	}
+
+    public void testNewRecord() throws Exception {
+        ExControl record = new ExControl();
+        ExControlAtom ctrl = record.getExControlAtom();
+        ctrl.setSlideId(256);
+
+        ExOleObjAtom oleObj = record.getExOleObjAtom();
+        oleObj.setDrawAspect(ExOleObjAtom.DRAW_ASPECT_VISIBLE);
+        oleObj.setType(ExOleObjAtom.TYPE_CONTROL);
+        oleObj.setObjID(1);
+        oleObj.setSubType(ExOleObjAtom.SUBTYPE_DEFAULT);
+        oleObj.setObjStgDataRef(2);
+        oleObj.setOptions(1283584);
+
+        record.setMenuName("Shockwave Flash Object");
+        record.setProgId("ShockwaveFlash.ShockwaveFlash.9");
+        record.setClipboardName("Shockwave Flash Object");
+
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        record.writeOut(baos);
+        byte[] b = baos.toByteArray();
+
+        assertEquals(data.length, b.length);
+        assertTrue(Arrays.equals(data, b));
+    }
+
+}
\ No newline at end of file

Propchange: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExControl.java
------------------------------------------------------------------------------
    svn:executable = *

Added: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExMediaAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExMediaAtom.java?rev=690262&view=auto
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExMediaAtom.java (added)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExMediaAtom.java Fri Aug 29 07:01:04 2008
@@ -0,0 +1,94 @@
+
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+        
+
+
+package org.apache.poi.hslf.record;
+
+
+import junit.framework.TestCase;
+import java.io.ByteArrayOutputStream;
+import java.util.Arrays;
+
+/**
+ * Tests that {@link org.apache.poi.hslf.record.HeadersFootersAtom} works properly
+ *
+ * @author Yegor Kozlov
+ */
+public class TestExMediaAtom extends TestCase {
+	// From a real file
+    private byte[] data = new byte[] {
+            0x00, 0x00, (byte)0x04, 0x10, 0x08, 0x00, 0x00, 00,
+            0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+    public void testRead() throws Exception {
+		ExMediaAtom record = new ExMediaAtom(data, 0, data.length);
+		assertEquals(RecordTypes.ExMediaAtom.typeID, record.getRecordType());
+
+        assertEquals(1, record.getObjectId());
+        assertFalse(record.getFlag(ExMediaAtom.fLoop));
+        assertFalse(record.getFlag(ExMediaAtom.fNarration));
+        assertFalse(record.getFlag(ExMediaAtom.fRewind));
+    }
+
+	public void testWrite() throws Exception {
+		ExMediaAtom record = new ExMediaAtom(data, 0, data.length);
+		ByteArrayOutputStream baos = new ByteArrayOutputStream();
+		record.writeOut(baos);
+		byte[] b = baos.toByteArray();
+
+		assertTrue(Arrays.equals(data, b));
+	}
+
+    public void testNewRecord() throws Exception {
+        ExMediaAtom ref = new ExMediaAtom(data, 0, data.length);
+        System.out.println(ref.getMask());
+
+        ExMediaAtom record = new ExMediaAtom();
+        record.setObjectId(1);
+        record.setFlag(HeadersFootersAtom.fHasDate, false);
+        record.setFlag(HeadersFootersAtom.fHasTodayDate, false);
+        record.setFlag(HeadersFootersAtom.fHasFooter, false);
+
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        record.writeOut(baos);
+        byte[] b = baos.toByteArray();
+
+        assertTrue(Arrays.equals(data, b));
+    }
+
+    public void testFlags() throws Exception {
+        ExMediaAtom record = new ExMediaAtom();
+
+        //in a new record all the bits are 0
+        for(int i = 0; i < 3; i++) assertFalse(record.getFlag(1 << i));
+
+        record.setFlag(ExMediaAtom.fLoop, true);
+        assertTrue(record.getFlag(ExMediaAtom.fLoop));
+
+        record.setFlag(ExMediaAtom.fNarration, true);
+        assertTrue(record.getFlag(ExMediaAtom.fNarration));
+
+        record.setFlag(ExMediaAtom.fNarration, false);
+        assertFalse(record.getFlag(ExMediaAtom.fNarration));
+
+        record.setFlag(ExMediaAtom.fNarration, false);
+        assertFalse(record.getFlag(ExMediaAtom.fNarration));
+
+    }
+}
\ No newline at end of file

Propchange: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExMediaAtom.java
------------------------------------------------------------------------------
    svn:executable = *

Added: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExOleObjAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExOleObjAtom.java?rev=690262&view=auto
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExOleObjAtom.java (added)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExOleObjAtom.java Fri Aug 29 07:01:04 2008
@@ -0,0 +1,78 @@
+
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+        
+
+
+package org.apache.poi.hslf.record;
+
+
+import junit.framework.TestCase;
+import java.io.ByteArrayOutputStream;
+import java.util.Arrays;
+
+/**
+ * Tests that {@link ExOleObjAtom} works properly
+ *
+ * @author Yegor Kozlov
+ */
+public class TestExOleObjAtom extends TestCase {
+	// From a real file (embedded SWF control)
+    private byte[] data = new byte[] {
+            0x01, 0x00, (byte)0xC3, 0x0F, 0x18, 0x00, 0x00, 0x00,
+            0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+            0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, (byte)0x96, 0x13, 0x00  };
+
+    public void testRead() throws Exception {
+		ExOleObjAtom record = new ExOleObjAtom(data, 0, data.length);
+		assertEquals(RecordTypes.ExOleObjAtom.typeID, record.getRecordType());
+        System.out.println(record);
+
+        assertEquals(record.getDrawAspect(), ExOleObjAtom.DRAW_ASPECT_VISIBLE);
+        assertEquals(record.getType(), ExOleObjAtom.TYPE_CONTROL);
+        assertEquals(record.getObjID(), 1);
+        assertEquals(record.getSubType(), ExOleObjAtom.SUBTYPE_DEFAULT);
+        assertEquals(record.getObjStgDataRef(), 2);
+        assertEquals(record.getOptions(), 1283584); //ther meaning is unknown
+    }
+
+	public void testWrite() throws Exception {
+		ExOleObjAtom record = new ExOleObjAtom(data, 0, data.length);
+		ByteArrayOutputStream baos = new ByteArrayOutputStream();
+		record.writeOut(baos);
+		byte[] b = baos.toByteArray();
+
+		assertTrue(Arrays.equals(data, b));
+	}
+
+    public void testNewRecord() throws Exception {
+        ExOleObjAtom record = new ExOleObjAtom();
+        record.setDrawAspect(ExOleObjAtom.DRAW_ASPECT_VISIBLE);
+        record.setType(ExOleObjAtom.TYPE_CONTROL);
+        record.setObjID(1);
+        record.setSubType(ExOleObjAtom.SUBTYPE_DEFAULT);
+        record.setObjStgDataRef(2);
+        record.setOptions(1283584);
+
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        record.writeOut(baos);
+        byte[] b = baos.toByteArray();
+
+        assertTrue(Arrays.equals(data, b));
+    }
+
+}
\ No newline at end of file

Propchange: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExOleObjAtom.java
------------------------------------------------------------------------------
    svn:executable = *

Added: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExOleObjStg.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExOleObjStg.java?rev=690262&view=auto
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExOleObjStg.java (added)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExOleObjStg.java Fri Aug 29 07:01:04 2008
@@ -0,0 +1,144 @@
+
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+        
+
+
+package org.apache.poi.hslf.record;
+
+
+import junit.framework.TestCase;
+import java.io.ByteArrayOutputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.IOException;
+import java.util.Arrays;
+
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.poifs.filesystem.DirectoryNode;
+import org.apache.poi.poifs.filesystem.DocumentEntry;
+
+/**
+ * Tests that {@link ExOleObjStg} works properly
+ *
+ * @author Yegor Kozlov
+ */
+public class TestExOleObjStg extends TestCase {
+
+    // From a real file (embedded SWF control)
+    /*
+    <ExOleObjStg info="16" type="4113" size="347" offset="4322" header="10 00 11 10 5B 01 00 00 ">
+      00 0E 00 00 78 9C BB 70 5E F0 C1 C2 8D 52 0F 19 D0 80 1D 03 33 C3 BF FF 9C
+      0C 6C 48 62 8C 40 CC 04 E3 08 30 30 B0 40 C5 FE FD FF FF 1F 24 C4 0C C4 FF
+      47 C1 90 02 41 0C F9 40 58 C2 A0 C0 E0 CA 90 07 A4 8B 18 2A D1 93 02 5E 20
+      C6 C0 0A 8F 73 50 5A C8 BB 5D 73 29 77 DD 79 C1 69 3B 5C 5C 83 43 50 D5 06
+      BC 48 2F 2B 66 38 C9 C8 0E 64 3B 30 42 C4 9C 81 B6 83 EC 4D 05 93 C5 24 D9
+      0D 02 42 0C 4C 8C C8 FE 21 56 9F 02 23 C9 56 E1 04 E4 D8 4F 4D 40 89 FD A0
+      BC FB 17 4B BA F8 07 C5 A3 60 78 03 7A E6 FF 09 67 59 1B 41 F9 9F 95 61 34
+      FF 53 13 50 62 3F 4C 1F AC 1C 18 CD F7 23 0B C0 DA 74 A0 B6 1B A8 3D 37 1A
+      F7 23 0B A4 87 A6 85 0A 00 1B 64 6F 38 21 98 03 DA C2 E7 60 90 01 92 69 0C
+      39 0C 65 0C 05 40 32 11 58 2F A4 02 6B 07 3D 60 19 5D 0E 14 27 4E 05 1F 90
+      0C 67 C8 04 96 ED 29 C0 72 BE 1C C8 E3 06 E3 FF FF 39 18 B8 80 2C 0F A0 5C
+      3A 43 06 58 2D A8 A7 E1 C3 10 02 97 87 B8 02 E6 1A 60 77 83 21 18 A8 12 64
+      8A 23 D0 B6 1C B8 59 C8 AA 90 F5 F0 62 94 75 DC C0 DE 0A 37 5C 1D 33 54 35
+      88 97 08 35 91 83 81 07 EC 27 10 BF 18 E8 9B E1 0F 00 BD 65 3D D4
+    </ExOleObjStg>
+     */
+    private byte[] data = new byte[] {
+            0x10, 0x00, 0x11, 0x10, 0x5B, 0x01, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x78, (byte)0x9C, (byte)0xBB, 0x70,
+            0x5E, (byte)0xF0, (byte)0xC1, (byte)0xC2, (byte)0x8D, 0x52, 0x0F, 0x19, (byte)0xD0, (byte)0x80, 0x1D, 0x03,
+            0x33, (byte)0xC3, (byte)0xBF, (byte)0xFF, (byte)0x9C, 0x0C, 0x6C, 0x48, 0x62, (byte)0x8C, 0x40, (byte)0xCC,
+            0x04, (byte)0xE3, 0x08, 0x30, 0x30, (byte)0xB0, 0x40, (byte)0xC5, (byte)0xFE, (byte)0xFD, (byte)0xFF, (byte)0xFF,
+            0x1F, 0x24, (byte)0xC4, (byte)0x0C, (byte)0xC4, (byte)0xFF, 0x47, (byte)0xC1, (byte)0x90, 0x02, 0x41, 0x0C,
+            (byte)0xF9, 0x40, 0x58, (byte)0xC2, (byte)0xA0, (byte)0xC0, (byte)0xE0, (byte)0xCA, (byte)0x90, 0x07, (byte)0xA4,
+            (byte)0x8B, 0x18, 0x2A, (byte)0xD1, (byte)0x93, 0x02, 0x5E, 0x20, (byte)0xC6, (byte)0xC0, 0x0A, (byte)0x8F,
+            0x73, 0x50, 0x5A, (byte)0xC8, (byte)0xBB, 0x5D, 0x73, 0x29, 0x77, (byte)0xDD, 0x79, (byte)0xC1, 0x69, 0x3B,
+            0x5C, 0x5C, (byte)0x83, 0x43, 0x50, (byte)0xD5, 0x06, (byte)0xBC, 0x48, 0x2F, 0x2B, 0x66, 0x38, (byte)0xC9,
+            (byte)0xC8, 0x0E, 0x64, 0x3B, 0x30, 0x42, (byte)0xC4, (byte)0x9C, (byte)0x81, (byte)0xB6, (byte)0x83, (byte)0xEC,
+            0x4D, 0x05, (byte)0x93, (byte)0xC5, 0x24, (byte)0xD9, 0x0D, 0x02, 0x42, 0x0C, 0x4C, (byte)0x8C, (byte)0xC8,
+            (byte)0xFE, 0x21, 0x56, (byte)0x9F, 0x02, 0x23, (byte)0xC9, 0x56, (byte)0xE1, 0x04, (byte)0xE4, (byte)0xD8,
+            0x4F, 0x4D, 0x40, (byte)0x89, (byte)0xFD, (byte)0xA0, (byte)0xBC, (byte)0xFB, 0x17, 0x4B, (byte)0xBA, (byte)0xF8,
+            0x07, (byte)0xC5, (byte)0xA3, 0x60, 0x78, 0x03, 0x7A, (byte)0xE6, (byte)0xFF, 0x09, 0x67, 0x59, 0x1B, 0x41,
+            (byte)0xF9, (byte)0x9F, (byte)0x95, 0x61, 0x34, (byte)0xFF, 0x53, 0x13, 0x50, 0x62, 0x3F, 0x4C, 0x1F, (byte)0xAC,
+            0x1C, 0x18, (byte)0xCD, (byte)0xF7, 0x23, 0x0B, (byte)0xC0, (byte)0xDA, 0x74, (byte)0xA0, (byte)0xB6, 0x1B,
+            (byte)0xA8, 0x3D, 0x37, 0x1A, (byte)0xF7, 0x23, 0x0B, (byte)0xA4, (byte)0x87, (byte)0xA6, (byte)0x85, 0x0A,
+            0x00, 0x1B, 0x64, 0x6F, 0x38, 0x21, (byte)0x98, 0x03, (byte)0xDA, (byte)0xC2, (byte)0xE7, 0x60, (byte)0x90,
+            0x01, (byte)0x92, 0x69, 0x0C, 0x39, 0x0C, 0x65, 0x0C, 0x05, 0x40, 0x32, 0x11, 0x58, 0x2F, (byte)0xA4, 0x02,
+            0x6B, 0x07, 0x3D, 0x60, 0x19, 0x5D, 0x0E, 0x14, 0x27, 0x4E, 0x05, 0x1F, (byte)0x90, 0x0C, 0x67, (byte)0xC8,
+            0x04, (byte)0x96, (byte)0xED, 0x29, (byte)0xC0, 0x72, (byte)0xBE, 0x1C, (byte)0xC8, (byte)0xE3, 0x06, (byte)0xE3,
+            (byte)0xFF, (byte)0xFF, 0x39, 0x18, (byte)0xB8, (byte)0x80, 0x2C, 0x0F, (byte)0xA0, 0x5C, 0x3A, 0x43, 0x06, 0x58,
+            0x2D, (byte)0xA8, (byte)0xA7, (byte)0xE1, (byte)0xC3, 0x10, 0x02, (byte)0x97, (byte)0x87, (byte)0xB8, 0x02,
+            (byte)0xE6, 0x1A, 0x60, 0x77, (byte)0x83, 0x21, 0x18, (byte)0xA8, 0x12, 0x64, (byte)0x8A, 0x23, (byte)0xD0,
+            (byte)0xB6, 0x1C, (byte)0xB8, 0x59, (byte)0xC8, (byte)0xAA, (byte)0x90, (byte)0xF5, (byte)0xF0, 0x62, (byte)0x94,
+            0x75, (byte)0xDC, (byte)0xC0, (byte)0xDE, 0x0A, 0x37, 0x5C, 0x1D, 0x33, 0x54, 0x35, (byte)0x88, (byte)0x97, 0x08,
+            0x35, (byte)0x91, (byte)0x83, (byte)0x81, 0x07, (byte)0xEC, 0x27, 0x10, (byte)0xBF, 0x18, (byte)0xE8, (byte)0x9B,
+            (byte)0xE1, 0x0F, 0x00, (byte)0xBD, 0x65, 0x3D, (byte)0xD4
+                };
+
+    public void testRead() throws Exception {
+        ExOleObjStg record = new ExOleObjStg(data, 0, data.length);
+        assertEquals(RecordTypes.ExOleObjStg.typeID, record.getRecordType());
+
+        int len = record.getDataLength();
+        byte[] oledata = readAll(record.getData());
+        assertEquals(len, oledata.length);
+
+        POIFSFileSystem fs = new POIFSFileSystem(record.getData());
+        assertTrue("Constructed POIFS from ExOleObjStg data", true);
+        DocumentEntry doc = (DocumentEntry)fs.getRoot().getEntry("Contents");
+        assertNotNull(doc);
+        assertTrue("Fetched the Contents stream containing OLE properties", true);
+    }
+
+    public void testWrite() throws Exception {
+        ExOleObjStg record = new ExOleObjStg(data, 0, data.length);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        record.writeOut(baos);
+        byte[] b = baos.toByteArray();
+
+        assertTrue(Arrays.equals(data, b));
+    }
+
+    public void testNewRecord() throws Exception {
+        ExOleObjStg src = new ExOleObjStg(data, 0, data.length);
+        byte[] oledata = readAll(src.getData());
+
+        ExOleObjStg tgt = new ExOleObjStg();
+        tgt.setData(oledata);
+
+
+        assertEquals(src.getDataLength(), tgt.getDataLength());
+
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        tgt.writeOut(out);
+        byte[] b = out.toByteArray();
+
+        assertEquals(data.length, b.length);
+        assertTrue(Arrays.equals(data, b));
+    }
+
+    private byte[] readAll(InputStream is) throws IOException {
+        int pos;
+        byte[] chunk = new byte[1024];
+        ByteArrayOutputStream out = new  ByteArrayOutputStream();
+        while((pos = is.read(chunk)) > 0){
+            out.write(chunk, 0, pos);
+        }
+        return out.toByteArray();
+
+    }
+}
\ No newline at end of file

Propchange: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExOleObjStg.java
------------------------------------------------------------------------------
    svn:executable = *

Added: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExVideoContainer.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExVideoContainer.java?rev=690262&view=auto
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExVideoContainer.java (added)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExVideoContainer.java Fri Aug 29 07:01:04 2008
@@ -0,0 +1,90 @@
+
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+        
+
+
+package org.apache.poi.hslf.record;
+
+
+import junit.framework.TestCase;
+import java.io.ByteArrayOutputStream;
+import java.util.Arrays;
+
+/**
+ * Tests that {@link HeadersFootersAtom} works properly
+ *
+ * @author Yegor Kozlov
+ */
+public class TestExVideoContainer extends TestCase {
+
+    // From a real file
+    private byte[] data = new byte[]{
+            0x0F, 0x00, 0x05, 0x10, (byte) 0x9E, 0x00, 0x00, 0x00,
+            0x00, 0x00, 0x04, 0x10, 0x08, 0x00, 0x00, 0x00,
+            0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+            0x00, 0x00, (byte)0xBA, 0x0F, (byte)0x86, 0x00, 0x00, 0x00,
+            0x44, 0x00, 0x3A, 0x00, 0x5C, 0x00, 0x70, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x6A, 0x00, 0x65, 0x00,
+            0x63, 0x00, 0x74, 0x00, 0x73, 0x00, 0x5C, 0x00, 0x53, 0x00, 0x63, 0x00, 0x68, 0x00, 0x75, 0x00,
+            0x6C, 0x00, 0x65, 0x00, 0x72, 0x00, 0x41, 0x00, 0x47, 0x00, 0x5C, 0x00, 0x6D, 0x00, 0x63, 0x00,
+            0x6F, 0x00, 0x6D, 0x00, 0x5F, 0x00, 0x76, 0x00, 0x5F, 0x00, 0x31, 0x00, 0x5F, 0x00, 0x30, 0x00,
+            0x5F, 0x00, 0x34, 0x00, 0x5C, 0x00, 0x76, 0x00, 0x69, 0x00, 0x65, 0x00, 0x77, 0x00, 0x5C, 0x00,
+            0x64, 0x00, 0x61, 0x00, 0x74, 0x00, 0x61, 0x00, 0x5C, 0x00, 0x74, 0x00, 0x65, 0x00, 0x73, 0x00,
+            0x74, 0x00, 0x73, 0x00, 0x5C, 0x00, 0x69, 0x00, 0x6D, 0x00, 0x61, 0x00, 0x67, 0x00, 0x65, 0x00,
+            0x73, 0x00, 0x5C, 0x00, 0x63, 0x00, 0x61, 0x00, 0x72, 0x00, 0x64, 0x00, 0x73, 0x00, 0x2E, 0x00,
+            0x6D, 0x00, 0x70, 0x00, 0x67, 0x00};
+
+
+
+
+    public void testRead() throws Exception {
+		ExVideoContainer record = new ExVideoContainer(data, 0, data.length);
+		assertEquals(RecordTypes.ExVideoContainer.typeID, record.getRecordType());
+
+        ExMediaAtom exMedia = record.getExMediaAtom();
+        assertEquals(1, exMedia.getObjectId());
+        assertNotNull(exMedia);
+        assertFalse(exMedia.getFlag(ExMediaAtom.fLoop));
+        assertFalse(exMedia.getFlag(ExMediaAtom.fNarration));
+        assertFalse(exMedia.getFlag(ExMediaAtom.fRewind));
+
+        CString path = record.getPathAtom();
+        assertNotNull(exMedia);
+        assertEquals("D:\\projects\\SchulerAG\\mcom_v_1_0_4\\view\\data\\tests\\images\\cards.mpg", path.getText());
+    }
+
+	public void testWrite() throws Exception {
+		ExVideoContainer record = new ExVideoContainer(data, 0, data.length);
+		ByteArrayOutputStream baos = new ByteArrayOutputStream();
+		record.writeOut(baos);
+		byte[] b = baos.toByteArray();
+
+		assertTrue(Arrays.equals(data, b));
+	}
+
+    public void testNewRecord() throws Exception {
+        ExVideoContainer record = new ExVideoContainer();
+        record.getExMediaAtom().setObjectId(1);
+        record.getPathAtom().setText("D:\\projects\\SchulerAG\\mcom_v_1_0_4\\view\\data\\tests\\images\\cards.mpg");
+
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        record.writeOut(baos);
+        byte[] b = baos.toByteArray();
+
+        assertTrue(Arrays.equals(data, b));
+    }
+}
\ No newline at end of file

Propchange: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExVideoContainer.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextRulerAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextRulerAtom.java?rev=690262&r1=690261&r2=690262&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextRulerAtom.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextRulerAtom.java Fri Aug 29 07:01:04 2008
@@ -48,6 +48,10 @@
         0x03, 0x69, 0x04, (byte)0xF6, 0x05, (byte)0xF6, 0x05
 	};
 
+    private byte[] data_2 = new byte[] {
+        0x00, 0x00, (byte)0xA6, 0x0F, 0x0A, 0x00, 0x00, 0x00,
+        0x10, 0x03, 0x00, 0x00, (byte)0xF9, 0x00, 0x41, 0x01, 0x41, 0x01
+    };
 
     public void testReadRuler() throws Exception {
 		TextRulerAtom ruler = new TextRulerAtom(data_1, 0, data_1.length);
@@ -73,4 +77,16 @@
         byte[] result = out.toByteArray();
         assertTrue(Arrays.equals(result, data_1));
 	}
+
+    public void testRead2() throws Exception {
+		TextRulerAtom ruler = TextRulerAtom.getParagraphInstance();
+        ruler.setParagraphIndent((short)249, (short)321);
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        ruler.writeOut(out);
+
+        byte[] result = out.toByteArray();
+        assertTrue(Arrays.equals(result, data_2));
+
+	}
+
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message