org.apache.poi.hslf.usermodel
Class SlideShow

java.lang.Object
  extended by org.apache.poi.hslf.usermodel.SlideShow

public final class SlideShow
extends java.lang.Object

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

Author:
Nick Burch, Yegor kozlov

Constructor Summary
SlideShow()
          Constructs a new, empty, Powerpoint document.
SlideShow(HSLFSlideShow hslfSlideShow)
          Constructs a Powerpoint document from the underlying HSLFSlideShow object.
SlideShow(java.io.InputStream inputStream)
          Constructs a Powerpoint document from an input stream.
 
Method Summary
 int addControl(java.lang.String name, java.lang.String progId)
          Add a control in this presentation
 int addFont(PPFont font)
          Add a font in this presentation
 int addHyperlink(Hyperlink link)
          Add a hyperlink to this presentation
 int addMovie(java.lang.String path, int type)
          Add a movie in this presentation
 int addPicture(byte[] data, int format)
          Adds a picture to this presentation and returns the associated index.
 int addPicture(java.io.File pict, int format)
          Adds a picture to this presentation and returns the associated index.
 Slide createSlide()
          Create a blank Slide.
 Document getDocumentRecord()
          Helper method for usermodel and model: Get the document record
 ObjectData[] 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
 Record[] getMostRecentCoreRecords()
          Returns an array of the most recent version of all the interesting records
 Notes[] 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
 java.awt.Dimension getPageSize()
          Return the current page size
 PictureData[] getPictureData()
          Returns the data of all the pictures attached to the SlideShow
 HeadersFooters getSlideHeadersFooters()
          Return Header / Footer settings for slides
 Slide[] getSlides()
          Returns an array of all the normal Slides found in the slideshow
 SlideMaster[] getSlidesMasters()
          Returns an array of all the normal Slide Masters found in the slideshow
 SoundData[] getSoundData()
          Returns the data of all the embedded sounds in the SlideShow
 TitleMaster[] getTitleMasters()
          Returns an array of all the normal Title Masters found in the slideshow
 Slide 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)
          Change the current page size
 void write(java.io.OutputStream out)
          Writes out the slideshow file the is represented by an instance of this class
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SlideShow

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

Parameters:
hslfSlideShow - the HSLFSlideShow to base on

SlideShow

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


SlideShow

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

Throws:
java.io.IOException
Method Detail

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

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

getMostRecentCoreRecords

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


getSlides

public Slide[] getSlides()
Returns an array of all the normal Slides found in the slideshow


getNotes

public Notes[] getNotes()
Returns an array of all the normal Notes found in the slideshow


getSlidesMasters

public SlideMaster[] getSlidesMasters()
Returns an array of all the normal Slide Masters found in the slideshow


getTitleMasters

public TitleMaster[] getTitleMasters()
Returns an array of all the normal Title Masters found in the slideshow


getPictureData

public PictureData[] getPictureData()
Returns the data of all the pictures attached to the SlideShow


getEmbeddedObjects

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


getSoundData

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


getPageSize

public java.awt.Dimension getPageSize()
Return the current page size


setPageSize

public void setPageSize(java.awt.Dimension pgsize)
Change the current page size

Parameters:
pgsize - page size (in points)

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 Slide 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 Slide createSlide()
Create a blank Slide.

Returns:
the created Slide

addPicture

public int addPicture(byte[] data,
                      int format)
               throws java.io.IOException
Adds a picture to this presentation and returns the associated index.

Parameters:
data - picture data
format - the format of the picture. One of constans defined in the Picture class.
Returns:
the index to this picture (1 based).
Throws:
java.io.IOException

addPicture

public int addPicture(java.io.File pict,
                      int format)
               throws java.io.IOException
Adds a picture to this presentation and returns the associated index.

Parameters:
pict - the file containing the image to add
format - the format of the picture. One of constans defined in the Picture class.
Returns:
the index to this picture (1 based).
Throws:
java.io.IOException

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

addHyperlink

public int addHyperlink(Hyperlink link)
Add a hyperlink to this presentation

Returns:
0-based index of the hyperlink


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