Package org.apache.poi.hslf.usermodel
Class HSLFSlide
java.lang.Object
org.apache.poi.hslf.usermodel.HSLFSheet
org.apache.poi.hslf.usermodel.HSLFSlide
- All Implemented Interfaces:
Iterable<HSLFShape>
,HSLFShapeContainer
,ShapeContainer<HSLFShape,
,HSLFTextParagraph> Sheet<HSLFShape,
,HSLFTextParagraph> Slide<HSLFShape,
HSLFTextParagraph>
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
ConstructorsConstructorDescriptionHSLFSlide
(int sheetNumber, int sheetRefId, int slideNumber) Create a new Slide instanceHSLFSlide
(Slide slide, HSLFNotes notes, SlideListWithText.SlideAtomsSet atomSet, int slideIdentifier, int slideNumber) Constructs a Slide from the Slide record, and the SlideAtomsSet containing the text. -
Method Summary
Modifier and TypeMethodDescriptionaddTitle()
Create aTextBox
object that represents the slide's title.void
draw
(Graphics2D graphics) Convenience method to draw a sheet to a graphics contextBackground for this slide.Color scheme for this slide.Get the comment(s) for this slide.boolean
getDisplayPlaceholder
(Placeholder placeholder) In XSLF, slidenumber and date shapes aren't marked as placeholders whereas in HSLF they are activated via a HeadersFooter configuration.boolean
Whether this slide follows master sheet backgroundboolean
boolean
boolean
Whether this slide draws master sheet objectsboolean
Whether this slide follows master color schemeHeader / Footer settings for this slide.Returns master sheet associated with this slide.getNotes()
Returns the Notes Sheet for this slide, or null if there isn't oneThis will return an atom per TextBox, so if the page has two text boxes the method should return two atoms.protected SlideListWithText.SlideAtomsSet
int
Returns the (public facing) page number of this slideReturns the underlying slide recordReturns an array of all the TextRuns foundgetTitle()
The title is a run of text of typeTextHeaderAtom.CENTER_TITLE_TYPE
orTextHeaderAtom.TITLE_TYPE
boolean
isHidden()
protected void
onAddTextShape
(HSLFTextShape shape) Subclasses should call this method and update the array of text runs when a text shape is addedvoid
onCreate()
Called by SlideShow ater a new slide is created.void
setFollowMasterBackground
(boolean flag) Sets whether this slide follows master backgroundvoid
setFollowMasterColourScheme
(boolean follow) void
setFollowMasterObjects
(boolean flag) Sets whether this slide draws master sheet objectsvoid
setFollowMasterScheme
(boolean flag) Sets whether this slide draws master color schemevoid
setHidden
(boolean hidden) Sets the slide visibilityvoid
setMasterSheet
(HSLFMasterSheet master) Change Master of this slide.void
setNotes
(Notes<HSLFShape, HSLFTextParagraph> 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.usermodel.HSLFSheet
_getSheetNumber, _getSheetRefId, addShape, allocateShapeId, createAutoShape, createConnector, createFreeform, createGroup, createOleShape, createPicture, createTable, createTextBox, getPlaceholder, getPlaceholderByTextType, getPlaceholderDetails, getPPDrawing, getProgrammableTag, getShapes, getSheetContainer, getSlideShow, iterator, removeShape, setSlideShow
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
Methods inherited from interface org.apache.poi.sl.usermodel.ShapeContainer
addShape, createTable, getShapes, removeShape
Methods inherited from interface org.apache.poi.sl.usermodel.Sheet
getPlaceholderDetails, getSlideShow
-
Constructor Details
-
HSLFSlide
public HSLFSlide(Slide slide, HSLFNotes notes, SlideListWithText.SlideAtomsSet atomSet, int slideIdentifier, int slideNumber) Constructs a Slide from the Slide record, and the SlideAtomsSet containing the text. Initializes TextRuns, to provide easier access to the text- Parameters:
slide
- the Slide record we're based onnotes
- the Notes sheet attached to usatomSet
- the SlideAtomsSet to get the text from
-
HSLFSlide
public HSLFSlide(int sheetNumber, int sheetRefId, int slideNumber) Create a new Slide instance- Parameters:
sheetNumber
- The internal number of the sheet, as used by PersistPtrHolderslideNumber
- The user facing number of the sheet
-
-
Method Details
-
getNotes
Returns the Notes Sheet for this slide, or null if there isn't one- Specified by:
getNotes
in interfaceSlide<HSLFShape,
HSLFTextParagraph>
-
setNotes
Sets the Notes that are associated with this. Updates the references in the records to point to the new ID- Specified by:
setNotes
in interfaceSlide<HSLFShape,
HSLFTextParagraph>
-
setSlideNumber
public void setSlideNumber(int newSlideNumber) Changes the Slide's (external facing) page number.- See Also:
-
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
-
addTitle
Create aTextBox
object that represents the slide's title.- Returns:
TextBox
object that represents the slide's title.
-
getTitle
The title is a run of text of type
TextHeaderAtom.CENTER_TITLE_TYPE
orTextHeaderAtom.TITLE_TYPE
- Specified by:
getTitle
in interfaceSlide<HSLFShape,
HSLFTextParagraph> - Returns:
- title of this slide or null if title is not set
- See Also:
-
getSlideName
- Specified by:
getSlideName
in interfaceSlide<HSLFShape,
HSLFTextParagraph> - Returns:
- the slide name, defaults to "Slide[slideNumber]"
-
getTextParagraphs
Returns an array of all the TextRuns found- Specified by:
getTextParagraphs
in classHSLFSheet
-
getSlideNumber
public int getSlideNumber()Returns the (public facing) page number of this slide- Specified by:
getSlideNumber
in interfaceSlide<HSLFShape,
HSLFTextParagraph> - Returns:
- the 1-based slide no.
-
getSlideRecord
Returns the underlying slide record -
getSlideAtomsSet
- Returns:
- set of records inside
SlideListWithtext
container which hold text data for this slide (typically for placeholders).
-
getMasterSheet
Returns master sheet associated with this slide. It can be either SlideMaster or TitleMaster objects.- Specified by:
getMasterSheet
in interfaceSheet<HSLFShape,
HSLFTextParagraph> - Specified by:
getMasterSheet
in classHSLFSheet
- Returns:
- the master sheet associated with this slide.
-
setMasterSheet
Change Master of this slide. -
setFollowMasterBackground
public void setFollowMasterBackground(boolean flag) Sets whether this slide follows master background- Specified by:
setFollowMasterBackground
in interfaceSlide<HSLFShape,
HSLFTextParagraph> - Parameters:
flag
-true
if the slide follows master,false
otherwise
-
getFollowMasterBackground
public boolean getFollowMasterBackground()Whether this slide follows master sheet background- Specified by:
getFollowMasterBackground
in interfaceSlide<HSLFShape,
HSLFTextParagraph> - Returns:
true
if the slide follows master background,false
otherwise
-
setFollowMasterObjects
public void setFollowMasterObjects(boolean flag) Sets whether this slide draws master sheet objects- Specified by:
setFollowMasterObjects
in interfaceSlide<HSLFShape,
HSLFTextParagraph> - 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- Specified by:
getFollowMasterObjects
in interfaceSlide<HSLFShape,
HSLFTextParagraph> - Returns:
true
if the slide draws master sheet objects,false
otherwise
-
getBackground
Background for this slide.- Specified by:
getBackground
in interfaceSheet<HSLFShape,
HSLFTextParagraph> - Overrides:
getBackground
in classHSLFSheet
- Returns:
- the background shape for this sheet.
-
getColorScheme
Color scheme for this slide.- Overrides:
getColorScheme
in classHSLFSheet
-
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.- Specified by:
getComments
in interfaceSlide<HSLFShape,
HSLFTextParagraph> - Returns:
- the comment(s) for this slide
-
onAddTextShape
Description copied from class:HSLFSheet
Subclasses should call this method and update the array of text runs when a text shape is added- Overrides:
onAddTextShape
in classHSLFSheet
-
getNumberedListInfo
This will return an atom per TextBox, so if the page has two text boxes the method should return two atoms. -
getTextboxWrappers
-
setHidden
public void setHidden(boolean hidden) Description copied from interface:Slide
Sets the slide visibility- Specified by:
setHidden
in interfaceSlide<HSLFShape,
HSLFTextParagraph> - Parameters:
hidden
- slide visibility, iftrue
the slide is hidden,false
shows the slide
-
isHidden
public boolean isHidden()- Specified by:
isHidden
in interfaceSlide<HSLFShape,
HSLFTextParagraph> - Returns:
- the slide visibility, the slide is hidden when
true
- or shown whenfalse
-
draw
Description copied from interface:Sheet
Convenience method to draw a sheet to a graphics context -
getFollowMasterColourScheme
public boolean getFollowMasterColourScheme()- Specified by:
getFollowMasterColourScheme
in interfaceSlide<HSLFShape,
HSLFTextParagraph>
-
setFollowMasterColourScheme
public void setFollowMasterColourScheme(boolean follow) - Specified by:
setFollowMasterColourScheme
in interfaceSlide<HSLFShape,
HSLFTextParagraph>
-
getFollowMasterGraphics
public boolean getFollowMasterGraphics()- Specified by:
getFollowMasterGraphics
in interfaceSheet<HSLFShape,
HSLFTextParagraph> - Overrides:
getFollowMasterGraphics
in classHSLFSheet
- Returns:
- whether shapes on the master sheet should be shown. By default master graphics is turned off. Sheets that support the notion of master (slide, slideLayout) should override it and check this setting
-
getDisplayPlaceholder
Description copied from interface:Slide
In XSLF, slidenumber and date shapes aren't marked as placeholders whereas in HSLF they are activated via a HeadersFooter configuration. This method is used to generalize that handling.- Specified by:
getDisplayPlaceholder
in interfaceSlide<HSLFShape,
HSLFTextParagraph> - Parameters:
placeholder
- the placeholder type- Returns:
true
if the placeholder should be displayed/rendered
-
getSlideLayout
- Specified by:
getSlideLayout
in interfaceSlide<HSLFShape,
HSLFTextParagraph> - Returns:
- the assigned slide layout
-