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:
java.lang.Iterable<HSLFShape>,HSLFShapeContainer,ShapeContainer<HSLFShape,HSLFTextParagraph>,Sheet<HSLFShape,HSLFTextParagraph>,Slide<HSLFShape,HSLFTextParagraph>
public final class HSLFSlide extends HSLFSheet implements 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
-
-
Constructor Summary
Constructors Constructor Description HSLFSlide(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HSLFTextBoxaddTitle()Create aTextBoxobject that represents the slide's title.voiddraw(java.awt.Graphics2D graphics)Convenience method to draw a sheet to a graphics contextHSLFBackgroundgetBackground()Background for this slide.ColorSchemeAtomgetColorScheme()Color scheme for this slide.java.util.List<HSLFComment>getComments()Get the comment(s) for this slide.booleangetDisplayPlaceholder(Placeholder placeholder)In XSLF, slidenumber and date shapes aren't marked as placeholders whereas in HSLF they are activated via a HeadersFooter configuration.booleangetFollowMasterBackground()Whether this slide follows master sheet backgroundbooleangetFollowMasterColourScheme()booleangetFollowMasterGraphics()booleangetFollowMasterObjects()Whether this slide draws master sheet objectsbooleangetFollowMasterScheme()Whether this slide follows master color schemeHeadersFootersgetHeadersFooters()Header / Footer settings for this slide.HSLFMasterSheetgetMasterSheet()Returns master sheet associated with this slide.HSLFNotesgetNotes()Returns the Notes Sheet for this slide, or null if there isn't oneStyleTextProp9Atom[]getNumberedListInfo()This will return an atom per TextBox, so if the page has two text boxes the method should return two atoms.HSLFMasterSheetgetSlideLayout()java.lang.StringgetSlideName()intgetSlideNumber()Returns the (public facing) page number of this slideSlidegetSlideRecord()Returns the underlying slide recordEscherTextboxWrapper[]getTextboxWrappers()java.util.List<java.util.List<HSLFTextParagraph>>getTextParagraphs()Returns an array of all the TextRuns foundjava.lang.StringgetTitle()The title is a run of text of typeTextHeaderAtom.CENTER_TITLE_TYPEorTextHeaderAtom.TITLE_TYPEbooleanisHidden()voidonCreate()Called by SlideShow ater a new slide is created.voidsetFollowMasterBackground(boolean flag)Sets whether this slide follows master backgroundvoidsetFollowMasterColourScheme(boolean follow)voidsetFollowMasterObjects(boolean flag)Sets whether this slide draws master sheet objectsvoidsetFollowMasterScheme(boolean flag)Sets whether this slide draws master color schemevoidsetHidden(boolean hidden)Sets the slide visibilityvoidsetMasterSheet(HSLFMasterSheet master)Change Master of this slide.voidsetNotes(Notes<HSLFShape,HSLFTextParagraph> notes)Sets the Notes that are associated with this.voidsetSlideNumber(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
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
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 Detail
-
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 Detail
-
getNotes
public HSLFNotes getNotes()
Returns the Notes Sheet for this slide, or null if there isn't one- Specified by:
getNotesin interfaceSlide<HSLFShape,HSLFTextParagraph>
-
setNotes
public void setNotes(Notes<HSLFShape,HSLFTextParagraph> notes)
Sets the Notes that are associated with this. Updates the references in the records to point to the new ID- Specified by:
setNotesin interfaceSlide<HSLFShape,HSLFTextParagraph>
-
setSlideNumber
public void setSlideNumber(int newSlideNumber)
Changes the Slide's (external facing) page number.- See Also:
HSLFSlideShow.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
-
addTitle
public HSLFTextBox addTitle()
Create aTextBoxobject that represents the slide's title.- Returns:
TextBoxobject that represents the slide's title.
-
getTitle
public java.lang.String getTitle()
The title is a run of text of type
TextHeaderAtom.CENTER_TITLE_TYPEorTextHeaderAtom.TITLE_TYPE- Specified by:
getTitlein interfaceSlide<HSLFShape,HSLFTextParagraph>- Returns:
- title of this slide or null if title is not set
- See Also:
TextHeaderAtom
-
getSlideName
public java.lang.String getSlideName()
- Specified by:
getSlideNamein interfaceSlide<HSLFShape,HSLFTextParagraph>- Returns:
- the slide name, defaults to "Slide[slideNumber]"
-
getTextParagraphs
public java.util.List<java.util.List<HSLFTextParagraph>> getTextParagraphs()
Returns an array of all the TextRuns found- Specified by:
getTextParagraphsin classHSLFSheet
-
getSlideNumber
public int getSlideNumber()
Returns the (public facing) page number of this slide- Specified by:
getSlideNumberin interfaceSlide<HSLFShape,HSLFTextParagraph>- Returns:
- the 1-based slide no.
-
getSlideRecord
public Slide getSlideRecord()
Returns the underlying slide record
-
getMasterSheet
public HSLFMasterSheet getMasterSheet()
Returns master sheet associated with this slide. It can be either SlideMaster or TitleMaster objects.- Specified by:
getMasterSheetin interfaceSheet<HSLFShape,HSLFTextParagraph>- Specified by:
getMasterSheetin classHSLFSheet- Returns:
- the master sheet associated with this slide.
-
setMasterSheet
public void setMasterSheet(HSLFMasterSheet master)
Change Master of this slide.
-
setFollowMasterBackground
public void setFollowMasterBackground(boolean flag)
Sets whether this slide follows master background- Specified by:
setFollowMasterBackgroundin interfaceSlide<HSLFShape,HSLFTextParagraph>- Parameters:
flag-trueif the slide follows master,falseotherwise
-
getFollowMasterBackground
public boolean getFollowMasterBackground()
Whether this slide follows master sheet background- Specified by:
getFollowMasterBackgroundin interfaceSlide<HSLFShape,HSLFTextParagraph>- Returns:
trueif the slide follows master background,falseotherwise
-
setFollowMasterObjects
public void setFollowMasterObjects(boolean flag)
Sets whether this slide draws master sheet objects- Specified by:
setFollowMasterObjectsin interfaceSlide<HSLFShape,HSLFTextParagraph>- Parameters:
flag-trueif the slide draws master sheet objects,falseotherwise
-
getFollowMasterScheme
public boolean getFollowMasterScheme()
Whether this slide follows master color scheme- Returns:
trueif the slide follows master color scheme,falseotherwise
-
setFollowMasterScheme
public void setFollowMasterScheme(boolean flag)
Sets whether this slide draws master color scheme- Parameters:
flag-trueif the slide draws master color scheme,falseotherwise
-
getFollowMasterObjects
public boolean getFollowMasterObjects()
Whether this slide draws master sheet objects- Specified by:
getFollowMasterObjectsin interfaceSlide<HSLFShape,HSLFTextParagraph>- Returns:
trueif the slide draws master sheet objects,falseotherwise
-
getBackground
public HSLFBackground getBackground()
Background for this slide.- Specified by:
getBackgroundin interfaceSheet<HSLFShape,HSLFTextParagraph>- Overrides:
getBackgroundin classHSLFSheet- Returns:
- the background shape for this sheet.
-
getColorScheme
public ColorSchemeAtom getColorScheme()
Color scheme for this slide.- Overrides:
getColorSchemein classHSLFSheet
-
getComments
public java.util.List<HSLFComment> 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:
getCommentsin interfaceSlide<HSLFShape,HSLFTextParagraph>- Returns:
- the comment(s) for this slide
-
getHeadersFooters
public HeadersFooters getHeadersFooters()
Header / Footer settings for this slide.- Overrides:
getHeadersFootersin classHSLFSheet- Returns:
- Header / Footer settings for this slide
-
getNumberedListInfo
public StyleTextProp9Atom[] getNumberedListInfo()
This will return an atom per TextBox, so if the page has two text boxes the method should return two atoms.
-
getTextboxWrappers
public EscherTextboxWrapper[] getTextboxWrappers()
-
setHidden
public void setHidden(boolean hidden)
Description copied from interface:SlideSets the slide visibility- Specified by:
setHiddenin interfaceSlide<HSLFShape,HSLFTextParagraph>- Parameters:
hidden- slide visibility, iftruethe slide is hidden,falseshows the slide
-
isHidden
public boolean isHidden()
- Specified by:
isHiddenin interfaceSlide<HSLFShape,HSLFTextParagraph>- Returns:
- the slide visibility, the slide is hidden when
true- or shown whenfalse
-
draw
public void draw(java.awt.Graphics2D graphics)
Description copied from interface:SheetConvenience method to draw a sheet to a graphics context
-
getFollowMasterColourScheme
public boolean getFollowMasterColourScheme()
- Specified by:
getFollowMasterColourSchemein interfaceSlide<HSLFShape,HSLFTextParagraph>
-
setFollowMasterColourScheme
public void setFollowMasterColourScheme(boolean follow)
- Specified by:
setFollowMasterColourSchemein interfaceSlide<HSLFShape,HSLFTextParagraph>
-
getFollowMasterGraphics
public boolean getFollowMasterGraphics()
- Specified by:
getFollowMasterGraphicsin interfaceSheet<HSLFShape,HSLFTextParagraph>- Overrides:
getFollowMasterGraphicsin 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
public boolean getDisplayPlaceholder(Placeholder placeholder)
Description copied from interface:SlideIn 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:
getDisplayPlaceholderin interfaceSlide<HSLFShape,HSLFTextParagraph>- Parameters:
placeholder- the placeholder type- Returns:
trueif the placeholder should be displayed/rendered
-
getSlideLayout
public HSLFMasterSheet getSlideLayout()
- Specified by:
getSlideLayoutin interfaceSlide<HSLFShape,HSLFTextParagraph>- Returns:
- the assigned slide layout
-
-