org.apache.poi.hslf.model
Class Slide

java.lang.Object
  extended by org.apache.poi.hslf.model.Sheet
      extended by org.apache.poi.hslf.model.Slide

public final class Slide
extends Sheet

This class represents a slide in a PowerPoint Document. It allows access to the text within, and the layout. For now, it only does the text side of things though

Author:
Nick Burch, Yegor Kozlov

Constructor Summary
Slide(int sheetNumber, int sheetRefId, int slideNumber)
          Create a new Slide instance
Slide(Slide slide, Notes notes, SlideListWithText.SlideAtomsSet atomSet, int slideIdentifier, int slideNumber)
          Constructs a Slide from the Slide record, and the SlideAtomsSet containing the text.
 
Method Summary
 TextBox addTitle()
          Create a TextBox object that represents the slide's title.
 void draw(java.awt.Graphics2D graphics)
           
 Background getBackground()
          Background for this slide.
 ColorSchemeAtom getColorScheme()
          Color scheme for this slide.
 Comment[] getComments()
          Get the comment(s) for this slide.
 boolean getFollowMasterBackground()
          Whether this slide follows master sheet background
 boolean getFollowMasterObjects()
          Whether this slide draws master sheet objects
 boolean getFollowMasterScheme()
          Whether this slide follows master color scheme
 HeadersFooters getHeadersFooters()
          Header / Footer settings for this slide.
 MasterSheet getMasterSheet()
          Returns master sheet associated with this slide.
 Notes getNotesSheet()
          Returns the Notes Sheet for this slide, or null if there isn't one
protected  SlideListWithText.SlideAtomsSet getSlideAtomsSet()
           
 int getSlideNumber()
          Returns the (public facing) page number of this slide
 Slide getSlideRecord()
          Returns the underlying slide record
 TextRun[] getTextRuns()
          Returns an array of all the TextRuns found
 java.lang.String getTitle()
          Return title of this slide or null if the slide does not have title.
protected  void onAddTextShape(TextShape shape)
          Subclasses should call this method and update the array of text runs when a text shape is added
 void onCreate()
          Called by SlideShow ater a new slide is created.
 void setFollowMasterBackground(boolean flag)
          Sets whether this slide follows master background
 void setFollowMasterObjects(boolean flag)
          Sets whether this slide draws master sheet objects
 void setFollowMasterScheme(boolean flag)
          Sets whether this slide draws master color scheme
 void setMasterSheet(MasterSheet master)
          Change Master of this slide.
 void setNotes(Notes notes)
          Sets the Notes that are associated with this.
 void setSlideNumber(int newSlideNumber)
          Changes the Slide's (external facing) page number.
 
Methods inherited from class org.apache.poi.hslf.model.Sheet
_getSheetNumber, _getSheetRefId, addShape, allocateShapeId, findTextRuns, findTextRuns, getPlaceholder, getPlaceholderByTextType, getPPDrawing, getProgrammableTag, getShapes, getSheetContainer, getSlideShow, removeShape, setSlideShow
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Slide

public Slide(Slide slide,
             Notes notes,
             SlideListWithText.SlideAtomsSet atomSet,
             int slideIdentifier,
             int slideNumber)
Constructs a Slide from the Slide record, and the SlideAtomsSet containing the text. Initialises TextRuns, to provide easier access to the text

Parameters:
slide - the Slide record we're based on
notes - the Notes sheet attached to us
atomSet - the SlideAtomsSet to get the text from

Slide

public Slide(int sheetNumber,
             int sheetRefId,
             int slideNumber)
Create a new Slide instance

Parameters:
sheetNumber - The internal number of the sheet, as used by PersistPtrHolder
slideNumber - The user facing number of the sheet
Method Detail

setNotes

public void setNotes(Notes notes)
Sets the Notes that are associated with this. Updates the references in the records to point to the new ID


setSlideNumber

public void setSlideNumber(int newSlideNumber)
Changes the Slide's (external facing) page number.

See Also:
SlideShow.reorderSlide(int, int)

onCreate

public void onCreate()
Called by SlideShow ater a new slide is created.

For Slide we need to do the following:

  • set id of the drawing group.
  • set shapeId for the container descriptor and background

    Overrides:
    onCreate in class Sheet

  • addTitle

    public TextBox addTitle()
    Create a TextBox object that represents the slide's title.

    Returns:
    TextBox object that represents the slide's title.

    getTitle

    public java.lang.String getTitle()
    Return title of this slide or null if the slide does not have title.

    The title is a run of text of type TextHeaderAtom.CENTER_TITLE_TYPE or TextHeaderAtom.TITLE_TYPE

    Returns:
    title of this slide
    See Also:
    TextHeaderAtom

    getTextRuns

    public TextRun[] getTextRuns()
    Returns an array of all the TextRuns found

    Specified by:
    getTextRuns in class Sheet

    getSlideNumber

    public int getSlideNumber()
    Returns the (public facing) page number of this slide


    getSlideRecord

    public Slide getSlideRecord()
    Returns the underlying slide record


    getNotesSheet

    public Notes getNotesSheet()
    Returns the Notes Sheet for this slide, or null if there isn't one


    getSlideAtomsSet

    protected SlideListWithText.SlideAtomsSet getSlideAtomsSet()
    Returns:
    set of records inside SlideListWithtext container which hold text data for this slide (typically for placeholders).

    getMasterSheet

    public MasterSheet getMasterSheet()
    Returns master sheet associated with this slide. It can be either SlideMaster or TitleMaster objects.

    Specified by:
    getMasterSheet in class Sheet
    Returns:
    the master sheet associated with this slide.

    setMasterSheet

    public void setMasterSheet(MasterSheet master)
    Change Master of this slide.


    setFollowMasterBackground

    public void setFollowMasterBackground(boolean flag)
    Sets whether this slide follows master background

    Parameters:
    flag - true if the slide follows master, false otherwise

    getFollowMasterBackground

    public boolean getFollowMasterBackground()
    Whether this slide follows master sheet background

    Returns:
    true if the slide follows master background, false otherwise

    setFollowMasterObjects

    public void setFollowMasterObjects(boolean flag)
    Sets whether this slide draws master sheet objects

    Parameters:
    flag - true if the slide draws master sheet objects, false otherwise

    getFollowMasterScheme

    public boolean getFollowMasterScheme()
    Whether this slide follows master color scheme

    Returns:
    true if the slide follows master color scheme, false otherwise

    setFollowMasterScheme

    public void setFollowMasterScheme(boolean flag)
    Sets whether this slide draws master color scheme

    Parameters:
    flag - true if the slide draws master color scheme, false otherwise

    getFollowMasterObjects

    public boolean getFollowMasterObjects()
    Whether this slide draws master sheet objects

    Returns:
    true if the slide draws master sheet objects, false otherwise

    getBackground

    public Background getBackground()
    Background for this slide.

    Overrides:
    getBackground in class Sheet
    Returns:
    the background shape for this sheet.

    getColorScheme

    public ColorSchemeAtom getColorScheme()
    Color scheme for this slide.

    Overrides:
    getColorScheme in class Sheet

    getComments

    public Comment[] getComments()
    Get the comment(s) for this slide. Note - for now, only works on PPT 2000 and PPT 2003 files. Doesn't work for PPT 97 ones, as they do their comments oddly.


    draw

    public void draw(java.awt.Graphics2D graphics)
    Overrides:
    draw in class Sheet

    getHeadersFooters

    public HeadersFooters getHeadersFooters()
    Header / Footer settings for this slide.

    Returns:
    Header / Footer settings for this slide

    onAddTextShape

    protected void onAddTextShape(TextShape shape)
    Description copied from class: Sheet
    Subclasses should call this method and update the array of text runs when a text shape is added

    Overrides:
    onAddTextShape in class Sheet


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