org.apache.poi.hslf.usermodel
Class HSLFSlideShowImpl

java.lang.Object
  extended by org.apache.poi.POIDocument
      extended by org.apache.poi.hslf.usermodel.HSLFSlideShowImpl
All Implemented Interfaces:
java.io.Closeable

public final class HSLFSlideShowImpl
extends POIDocument
implements java.io.Closeable

This class contains the main functionality for the Powerpoint file "reader". It is only a very basic class for now

Author:
Nick Burch

Field Summary
static int UNSET_OFFSET
           
 
Fields inherited from class org.apache.poi.POIDocument
directory
 
Constructor Summary
HSLFSlideShowImpl(DirectoryNode dir)
          Constructs a Powerpoint document from a specific point in a POIFS Filesystem.
HSLFSlideShowImpl(DirectoryNode dir, POIFSFileSystem filesystem)
          Deprecated. Use HSLFSlideShowImpl(DirectoryNode) instead
HSLFSlideShowImpl(java.io.InputStream inputStream)
          Constructs a Powerpoint document from an input stream.
HSLFSlideShowImpl(NPOIFSFileSystem filesystem)
          Constructs a Powerpoint document from a POIFS Filesystem.
HSLFSlideShowImpl(POIFSFileSystem filesystem)
          Constructs a Powerpoint document from a POIFS Filesystem.
HSLFSlideShowImpl(java.lang.String fileName)
          Constructs a Powerpoint document from fileName.
 
Method Summary
 int addPicture(HSLFPictureData img)
          Add a new picture to this presentation.
 int appendRootLevelRecord(Record newRecord)
          Adds a new root level record, at the end, but before the last PersistPtrIncrementalBlock.
 void close()
           
static HSLFSlideShowImpl create()
          Constructs a new, empty, Powerpoint document.
 CurrentUserAtom getCurrentUserAtom()
          Fetch the Current User Atom of the document
 DocumentEncryptionAtom getDocumentEncryptionAtom()
           
 HSLFObjectData[] getEmbeddedObjects()
          Gets embedded object data from the slide show.
 java.util.List<HSLFPictureData> getPictureData()
          Return list of pictures contained in this presentation
protected  DirectoryNode getPOIFSDirectory()
          Returns the directory in the underlying POIFSFileSystem for the document that is open.
protected  PropertySet getPropertySet(java.lang.String setName)
          For a given named property entry, either return it or null if if it wasn't found
 Record[] getRecords()
          Returns an array of all the records found in the slideshow
 byte[] getUnderlyingBytes()
          Returns an array of the bytes of the file.
 void normalizeRecords()
          remove duplicated UserEditAtoms and merge PersistPtrHolder, i.e.
 void updateAndWriteDependantRecords(java.io.OutputStream os, java.util.Map<RecordTypes,PositionDependentRecord> interestingRecords)
          This is a helper functions, which is needed for adding new position dependent records or finally write the slideshow to a file.
 void write(java.io.OutputStream out)
          Writes out the slideshow file the is represented by an instance of this class.
 void write(java.io.OutputStream out, boolean preserveNodes)
          Writes out the slideshow file the is represented by an instance of this class.
protected  void writeProperties(POIFSFileSystem outFS, java.util.List<java.lang.String> writtenEntries)
          Writes out the standard Documment Information Properties (HPSF)
 
Methods inherited from class org.apache.poi.POIDocument
createInformationProperties, getDirectory, getDocumentSummaryInformation, getPropertySet, getSummaryInformation, readProperties, writeProperties, writeProperties, writeProperties, writePropertySet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNSET_OFFSET

public static final int UNSET_OFFSET
See Also:
Constant Field Values
Constructor Detail

HSLFSlideShowImpl

public HSLFSlideShowImpl(java.lang.String fileName)
                  throws java.io.IOException
Constructs a Powerpoint document from fileName. Parses the document and places all the important stuff into data structures.

Parameters:
fileName - The name of the file to read.
Throws:
java.io.IOException - if there is a problem while parsing the document.

HSLFSlideShowImpl

public HSLFSlideShowImpl(java.io.InputStream inputStream)
                  throws java.io.IOException
Constructs a Powerpoint document from an input stream. Parses the document and places all the important stuff into data structures.

Parameters:
inputStream - the source of the data
Throws:
java.io.IOException - if there is a problem while parsing the document.

HSLFSlideShowImpl

public HSLFSlideShowImpl(POIFSFileSystem filesystem)
                  throws java.io.IOException
Constructs a Powerpoint document from a POIFS Filesystem. Parses the document and places all the important stuff into data structures.

Parameters:
filesystem - the POIFS FileSystem to read from
Throws:
java.io.IOException - if there is a problem while parsing the document.

HSLFSlideShowImpl

public HSLFSlideShowImpl(NPOIFSFileSystem filesystem)
                  throws java.io.IOException
Constructs a Powerpoint document from a POIFS Filesystem. Parses the document and places all the important stuff into data structures.

Parameters:
filesystem - the POIFS FileSystem to read from
Throws:
java.io.IOException - if there is a problem while parsing the document.

HSLFSlideShowImpl

@Deprecated
public HSLFSlideShowImpl(DirectoryNode dir,
                                    POIFSFileSystem filesystem)
                  throws java.io.IOException
Deprecated. Use HSLFSlideShowImpl(DirectoryNode) instead

Constructs a Powerpoint document from a specific point in a POIFS Filesystem. Parses the document and places all the important stuff into data structures.

Parameters:
dir - the POIFS directory to read from
filesystem - the POIFS FileSystem to read from
Throws:
java.io.IOException - if there is a problem while parsing the document.

HSLFSlideShowImpl

public HSLFSlideShowImpl(DirectoryNode dir)
                  throws java.io.IOException
Constructs a Powerpoint document from a specific point in a POIFS Filesystem. Parses the document and places all the important stuff into data structures.

Parameters:
dir - the POIFS directory to read from
Throws:
java.io.IOException - if there is a problem while parsing the document.
Method Detail

getPOIFSDirectory

protected DirectoryNode getPOIFSDirectory()
Returns the directory in the underlying POIFSFileSystem for the document that is open.


create

public static final HSLFSlideShowImpl create()
Constructs a new, empty, Powerpoint document.


getDocumentEncryptionAtom

public DocumentEncryptionAtom getDocumentEncryptionAtom()

normalizeRecords

public void normalizeRecords()
remove duplicated UserEditAtoms and merge PersistPtrHolder, i.e. remove document edit history


updateAndWriteDependantRecords

public void updateAndWriteDependantRecords(java.io.OutputStream os,
                                           java.util.Map<RecordTypes,PositionDependentRecord> interestingRecords)
                                    throws java.io.IOException
This is a helper functions, which is needed for adding new position dependent records or finally write the slideshow to a file.

Parameters:
os - the stream to write to, if null only the references are updated
interestingRecords - a map of interesting records (PersistPtrHolder and UserEditAtom) referenced by their RecordType. Only the very last of each type will be saved to the map. May be null, if not needed.
Throws:
java.io.IOException

write

public void write(java.io.OutputStream out)
           throws java.io.IOException
Writes out the slideshow file the is represented by an instance of this class. It will write out the common OLE2 streams. If you require all streams to be written out, pass in preserveNodes

Specified by:
write in class POIDocument
Parameters:
out - The OutputStream to write to.
Throws:
java.io.IOException - If there is an unexpected IOException from the passed in OutputStream

write

public void write(java.io.OutputStream out,
                  boolean preserveNodes)
           throws java.io.IOException
Writes out the slideshow file the is represented by an instance of this class. If you require all streams to be written out (eg Marcos, embeded documents), then set preserveNodes to true

Parameters:
out - The OutputStream to write to.
preserveNodes - Should all OLE2 streams be written back out, or only the common ones?
Throws:
java.io.IOException - If there is an unexpected IOException from the passed in OutputStream

getPropertySet

protected PropertySet getPropertySet(java.lang.String setName)
For a given named property entry, either return it or null if if it wasn't found

Overrides:
getPropertySet in class POIDocument
Parameters:
setName - The property to read
Returns:
The value of the given property or null if it wasn't found.

writeProperties

protected void writeProperties(POIFSFileSystem outFS,
                               java.util.List<java.lang.String> writtenEntries)
                        throws java.io.IOException
Writes out the standard Documment Information Properties (HPSF)

Parameters:
outFS - the POIFSFileSystem to write the properties into
writtenEntries - a list of POIFS entries to add the property names too
Throws:
java.io.IOException - if an error when writing to the POIFSFileSystem occurs

appendRootLevelRecord

public int appendRootLevelRecord(Record newRecord)
Adds a new root level record, at the end, but before the last PersistPtrIncrementalBlock.


addPicture

public int addPicture(HSLFPictureData img)
Add a new picture to this presentation.

Returns:
offset of this picture in the Pictures stream

getRecords

public Record[] getRecords()
Returns an array of all the records found in the slideshow


getUnderlyingBytes

public byte[] getUnderlyingBytes()
Returns an array of the bytes of the file. Only correct after a call to open or write - at all other times might be wrong!


getCurrentUserAtom

public CurrentUserAtom getCurrentUserAtom()
Fetch the Current User Atom of the document


getPictureData

public java.util.List<HSLFPictureData> getPictureData()
Return list of pictures contained in this presentation

Returns:
list with the read pictures or an empty list if the presentation doesn't contain pictures.

getEmbeddedObjects

public HSLFObjectData[] getEmbeddedObjects()
Gets embedded object data from the slide show.

Returns:
the embedded objects.

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Throws:
java.io.IOException


Copyright 2016 The Apache Software Foundation or its licensors, as applicable.