org.apache.poi.hslf.usermodel
Class HSLFSlideShow

java.lang.Object
  extended by org.apache.poi.hslf.usermodel.HSLFSlideShow
All Implemented Interfaces:
java.io.Closeable, SlideShow<HSLFShape,HSLFTextParagraph>

public final class HSLFSlideShow
extends java.lang.Object
implements SlideShow<HSLFShape,HSLFTextParagraph>, java.io.Closeable

This class is a friendly wrapper on top of the more scary HSLFSlideShow. TODO: - figure out how to match notes to their correct sheet (will involve understanding DocSlideList and DocNotesList) - handle Slide creation cleaner


Field Summary
static java.lang.String POWERPOINT_DOCUMENT
          Powerpoint document entry/stream name
 
Constructor Summary
HSLFSlideShow()
          Constructs a new, empty, Powerpoint document.
HSLFSlideShow(DirectoryNode root)
          Constructs a Powerpoint document from an DirectoryNode.
HSLFSlideShow(HSLFSlideShowImpl hslfSlideShow)
          Constructs a Powerpoint document from the underlying HSLFSlideShow object.
HSLFSlideShow(java.io.InputStream inputStream)
          Constructs a Powerpoint document from an input stream.
HSLFSlideShow(NPOIFSFileSystem npoifs)
          Constructs a Powerpoint document from an POIFSFileSystem.
 
Method Summary
 int addControl(java.lang.String name, java.lang.String progId)
          Add a control in this presentation
 int addEmbed(POIFSFileSystem poiData)
          Add a embedded object to this presentation
 int addFont(PPFont font)
          Add a font in this presentation
 int addMovie(java.lang.String path, int type)
          Add a movie in this presentation
protected  int addPersistentObject(PositionDependentRecord slideRecord)
           
 HSLFPictureData addPicture(byte[] data, PictureData.PictureType format)
           
 HSLFPictureData addPicture(java.io.File pict, PictureData.PictureType format)
          Adds a picture to the presentation.
 HSLFPictureData addPicture(java.io.InputStream is, PictureData.PictureType format)
          Adds a picture to the presentation.
protected  int addToObjListAtom(RecordContainer exObj)
           
 void close()
           
 MasterSheet<HSLFShape,HSLFTextParagraph> createMasterSheet()
           
 HSLFSlide createSlide()
          Create a blank Slide.
 HSLFPictureData findPictureData(byte[] pictureData)
          check if a picture with this picture data already exists in this presentation
 Document getDocumentRecord()
          Helper method for usermodel and model: Get the document record
 HSLFObjectData[] getEmbeddedObjects()
          Returns the data of all the embedded OLE object in the SlideShow
 PPFont getFont(int idx)
          Get a font by index
protected  FontCollection getFontCollection()
          Helper method for usermodel: Get the font collection
protected static org.apache.poi.hslf.usermodel.HSLFSlideShow.LoadSavePhase getLoadSavePhase()
           
 Record[] getMostRecentCoreRecords()
          Returns an array of the most recent version of all the interesting records
 java.util.List<HSLFNotes> getNotes()
          Returns an array of all the normal Notes found in the slideshow
 HeadersFooters getNotesHeadersFooters()
          Return Header / Footer settings for notes
 int getNumberOfFonts()
          get the number of fonts in the presentation
protected static java.util.Map<java.lang.String,ClassID> getOleMap()
           
 java.awt.Dimension getPageSize()
           
 java.util.List<HSLFPictureData> getPictureData()
           
 Resources getResources()
           
 HeadersFooters getSlideHeadersFooters()
          Return Header / Footer settings for slides
 java.util.List<HSLFSlideMaster> getSlideMasters()
          Returns an array of all the normal Slide Masters found in the slideshow
 java.util.List<HSLFSlide> getSlides()
          Returns an array of all the normal Slides found in the slideshow
 HSLFSlideShowImpl getSlideShowImpl()
           
 HSLFSoundData[] getSoundData()
          Returns the data of all the embedded sounds in the SlideShow
 java.util.List<HSLFTitleMaster> getTitleMasters()
          Returns an array of all the normal Title Masters found in the slideshow
 HSLFSlide removeSlide(int index)
          Removes the slide at the given index (0-based).
 void reorderSlide(int oldSlideNumber, int newSlideNumber)
          Re-orders a slide, to a new position.
 void setPageSize(java.awt.Dimension pgsize)
           
 void write(java.io.OutputStream out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POWERPOINT_DOCUMENT

public static final java.lang.String POWERPOINT_DOCUMENT
Powerpoint document entry/stream name

See Also:
Constant Field Values
Constructor Detail

HSLFSlideShow

public HSLFSlideShow(HSLFSlideShowImpl hslfSlideShow)
Constructs a Powerpoint document from the underlying HSLFSlideShow object. Finds the model stuff from this

Parameters:
hslfSlideShow - the HSLFSlideShow to base on

HSLFSlideShow

public HSLFSlideShow()
Constructs a new, empty, Powerpoint document.


HSLFSlideShow

public HSLFSlideShow(java.io.InputStream inputStream)
              throws java.io.IOException
Constructs a Powerpoint document from an input stream.

Throws:
java.io.IOException

HSLFSlideShow

public HSLFSlideShow(NPOIFSFileSystem npoifs)
              throws java.io.IOException
Constructs a Powerpoint document from an POIFSFileSystem.

Throws:
java.io.IOException

HSLFSlideShow

public HSLFSlideShow(DirectoryNode root)
              throws java.io.IOException
Constructs a Powerpoint document from an DirectoryNode.

Throws:
java.io.IOException
Method Detail

getLoadSavePhase

protected static org.apache.poi.hslf.usermodel.HSLFSlideShow.LoadSavePhase getLoadSavePhase()
Returns:
the current loading/saving phase

write

public void write(java.io.OutputStream out)
           throws java.io.IOException
Specified by:
write in interface SlideShow<HSLFShape,HSLFTextParagraph>
Throws:
java.io.IOException

getMostRecentCoreRecords

public Record[] getMostRecentCoreRecords()
Returns an array of the most recent version of all the interesting records


getSlides

public java.util.List<HSLFSlide> getSlides()
Returns an array of all the normal Slides found in the slideshow

Specified by:
getSlides in interface SlideShow<HSLFShape,HSLFTextParagraph>

getNotes

public java.util.List<HSLFNotes> getNotes()
Returns an array of all the normal Notes found in the slideshow


getSlideMasters

public java.util.List<HSLFSlideMaster> getSlideMasters()
Returns an array of all the normal Slide Masters found in the slideshow

Specified by:
getSlideMasters in interface SlideShow<HSLFShape,HSLFTextParagraph>

getTitleMasters

public java.util.List<HSLFTitleMaster> getTitleMasters()
Returns an array of all the normal Title Masters found in the slideshow


getPictureData

public java.util.List<HSLFPictureData> getPictureData()
Specified by:
getPictureData in interface SlideShow<HSLFShape,HSLFTextParagraph>

getEmbeddedObjects

public HSLFObjectData[] getEmbeddedObjects()
Returns the data of all the embedded OLE object in the SlideShow


getSoundData

public HSLFSoundData[] getSoundData()
Returns the data of all the embedded sounds in the SlideShow


getPageSize

public java.awt.Dimension getPageSize()
Specified by:
getPageSize in interface SlideShow<HSLFShape,HSLFTextParagraph>

setPageSize

public void setPageSize(java.awt.Dimension pgsize)
Specified by:
setPageSize in interface SlideShow<HSLFShape,HSLFTextParagraph>

getFontCollection

protected FontCollection getFontCollection()
Helper method for usermodel: Get the font collection


getDocumentRecord

public Document getDocumentRecord()
Helper method for usermodel and model: Get the document record


reorderSlide

public void reorderSlide(int oldSlideNumber,
                         int newSlideNumber)
Re-orders a slide, to a new position.

Parameters:
oldSlideNumber - The old slide number (1 based)
newSlideNumber - The new slide number (1 based)

removeSlide

public HSLFSlide removeSlide(int index)
Removes the slide at the given index (0-based).

Shifts any subsequent slides to the left (subtracts one from their slide numbers).

Parameters:
index - the index of the slide to remove (0-based)
Returns:
the slide that was removed from the slide show.

createSlide

public HSLFSlide createSlide()
Create a blank Slide.

Specified by:
createSlide in interface SlideShow<HSLFShape,HSLFTextParagraph>
Returns:
the created Slide

addPicture

public HSLFPictureData addPicture(byte[] data,
                                  PictureData.PictureType format)
                           throws java.io.IOException
Specified by:
addPicture in interface SlideShow<HSLFShape,HSLFTextParagraph>
Throws:
java.io.IOException

addPicture

public HSLFPictureData addPicture(java.io.InputStream is,
                                  PictureData.PictureType format)
                           throws java.io.IOException
Adds a picture to the presentation.

Specified by:
addPicture in interface SlideShow<HSLFShape,HSLFTextParagraph>
Parameters:
is - The stream to read the image from
format - The format of the picture.
Returns:
the picture data.
Throws:
java.io.IOException
Since:
3.15 beta 2

addPicture

public HSLFPictureData addPicture(java.io.File pict,
                                  PictureData.PictureType format)
                           throws java.io.IOException
Adds a picture to the presentation.

Specified by:
addPicture in interface SlideShow<HSLFShape,HSLFTextParagraph>
Parameters:
pict - the file containing the image to add
format - The format of the picture.
Returns:
the picture data.
Throws:
java.io.IOException
Since:
3.15 beta 2

findPictureData

public HSLFPictureData findPictureData(byte[] pictureData)
check if a picture with this picture data already exists in this presentation

Specified by:
findPictureData in interface SlideShow<HSLFShape,HSLFTextParagraph>
Parameters:
pictureData - The picture data to find in the SlideShow
Returns:
null if picture data is not found in this slideshow
Since:
3.15 beta 3

addFont

public int addFont(PPFont font)
Add a font in this presentation

Parameters:
font - the font to add
Returns:
0-based index of the font

getFont

public PPFont getFont(int idx)
Get a font by index

Parameters:
idx - 0-based index of the font
Returns:
of an instance of PPFont or null if not found

getNumberOfFonts

public int getNumberOfFonts()
get the number of fonts in the presentation

Returns:
number of fonts

getSlideHeadersFooters

public HeadersFooters getSlideHeadersFooters()
Return Header / Footer settings for slides

Returns:
Header / Footer settings for slides

getNotesHeadersFooters

public HeadersFooters getNotesHeadersFooters()
Return Header / Footer settings for notes

Returns:
Header / Footer settings for notes

addMovie

public int addMovie(java.lang.String path,
                    int type)
Add a movie in this presentation

Parameters:
path - the path or url to the movie
Returns:
0-based index of the movie

addControl

public int addControl(java.lang.String name,
                      java.lang.String progId)
Add a control in this presentation

Parameters:
name - name of the control, e.g. "Shockwave Flash Object"
progId - OLE Programmatic Identifier, e.g. "ShockwaveFlash.ShockwaveFlash.9"
Returns:
0-based index of the control

addEmbed

public int addEmbed(POIFSFileSystem poiData)
Add a embedded object to this presentation

Returns:
0-based index of the embedded object

addToObjListAtom

protected int addToObjListAtom(RecordContainer exObj)

getOleMap

protected static java.util.Map<java.lang.String,ClassID> getOleMap()

addPersistentObject

protected int addPersistentObject(PositionDependentRecord slideRecord)

createMasterSheet

public MasterSheet<HSLFShape,HSLFTextParagraph> createMasterSheet()
                                                           throws java.io.IOException
Specified by:
createMasterSheet in interface SlideShow<HSLFShape,HSLFTextParagraph>
Throws:
java.io.IOException

getResources

public Resources getResources()
Specified by:
getResources in interface SlideShow<HSLFShape,HSLFTextParagraph>

getSlideShowImpl

@Internal
public HSLFSlideShowImpl getSlideShowImpl()
Returns:
the handler class which holds the hslf records

close

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