Package org.apache.poi.hslf.usermodel
Class HSLFSheet
java.lang.Object
org.apache.poi.hslf.usermodel.HSLFSheet
- All Implemented Interfaces:
Iterable<HSLFShape>
,HSLFShapeContainer
,ShapeContainer<HSLFShape,
,HSLFTextParagraph> Sheet<HSLFShape,
HSLFTextParagraph>
- Direct Known Subclasses:
HSLFMasterSheet
,HSLFNotes
,HSLFSlide
public abstract class HSLFSheet
extends Object
implements HSLFShapeContainer, Sheet<HSLFShape,HSLFTextParagraph>
This class defines the common format of "Sheets" in a powerpoint
document. Such sheets could be Slides, Notes, Master etc
- Author:
- Nick Burch, Yegor Kozlov
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the (internal, SlideIdentifier based) sheet number, as used to reference this sheet from other records.int
Returns the (internal, RefID based) sheet number, as used to in PersistPtr stuff.void
Add a new Shape to this Slideint
Allocates new shape id for the new drawing group id.create a new shape with a predefined geometry and add it to this shape containercreate a connectorcreate a new shape with a custom geometrycreate a group of shapes belonging to this containercreateOleShape
(PictureData pictureData) Create a new OLE object shape with the given pictureData as preview imagecreatePicture
(PictureData pictureData) create a picture belonging to this containercreateTable
(int numRows, int numCols) Create a new Table of the given number of rows and columnscreate a text boxvoid
draw
(Graphics2D graphics) Convenience method to draw a sheet to a graphics contextReturns the background shape for this sheet.Color scheme for this sheet.boolean
Header / Footer settings for this slide.abstract HSLFMasterSheet
Return the master sheet .getPlaceholder
(Placeholder type) Search placeholder by its typegetPlaceholderByTextType
(int type) Return placeholder by text typegetPlaceholderDetails
(Placeholder placeholder) Get the placeholder details for the given placeholder type.Fetch the PPDrawing from the underlying recordReturn programmable tag associated with this sheet, e.g.Returns all shapes contained in this SheetReturn record container for this sheetFetch the SlideShow we're attached toabstract List<List<HSLFTextParagraph>>
Returns an array of all the TextRuns in the sheet.iterator()
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 sheet is createdboolean
removeShape
(HSLFShape shape) Removes the specified shape from this sheet.protected void
Set the SlideShow we're attached to.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, spliterator
-
Constructor Details
-
HSLFSheet
-
-
Method Details
-
getTextParagraphs
Returns an array of all the TextRuns in the sheet. -
_getSheetRefId
public int _getSheetRefId()Returns the (internal, RefID based) sheet number, as used to in PersistPtr stuff. -
_getSheetNumber
public int _getSheetNumber()Returns the (internal, SlideIdentifier based) sheet number, as used to reference this sheet from other records. -
getPPDrawing
Fetch the PPDrawing from the underlying record -
getSlideShow
Fetch the SlideShow we're attached to- Specified by:
getSlideShow
in interfaceSheet<HSLFShape,
HSLFTextParagraph>
-
getSheetContainer
Return record container for this sheet -
setSlideShow
Set the SlideShow we're attached to. Also passes it on to our child text paragraphs -
getShapes
Returns all shapes contained in this Sheet- Specified by:
getShapes
in interfaceShapeContainer<HSLFShape,
HSLFTextParagraph> - Returns:
- all shapes contained in this Sheet (Slide or Notes)
-
addShape
Add a new Shape to this Slide- Specified by:
addShape
in interfaceShapeContainer<HSLFShape,
HSLFTextParagraph> - Parameters:
shape
- - the Shape to add
-
allocateShapeId
public int allocateShapeId()Allocates new shape id for the new drawing group id.- Returns:
- a new shape id.
-
removeShape
Removes the specified shape from this sheet.- Specified by:
removeShape
in interfaceShapeContainer<HSLFShape,
HSLFTextParagraph> - Parameters:
shape
- shape to be removed from this sheet, if present.- Returns:
- true if the shape was deleted.
-
onCreate
public void onCreate()Called by SlideShow ater a new sheet is created -
getMasterSheet
Return the master sheet .- Specified by:
getMasterSheet
in interfaceSheet<HSLFShape,
HSLFTextParagraph>
-
getColorScheme
Color scheme for this sheet. -
getBackground
Returns the background shape for this sheet.- Specified by:
getBackground
in interfaceSheet<HSLFShape,
HSLFTextParagraph> - Returns:
- the background shape for this sheet.
-
draw
Description copied from interface:Sheet
Convenience method to draw a sheet to a graphics context- Specified by:
draw
in interfaceSheet<HSLFShape,
HSLFTextParagraph>
-
onAddTextShape
Subclasses should call this method and update the array of text runs when a text shape is added- Parameters:
shape
-
-
getPlaceholderByTextType
Return placeholder by text type- Parameters:
type
- type of text, SeeTextHeaderAtom
- Returns:
TextShape
ornull
-
getPlaceholder
Search placeholder by its type- Parameters:
type
- type of placeholder to search. SeeOEPlaceholderAtom
- Returns:
SimpleShape
ornull
-
getProgrammableTag
Return programmable tag associated with this sheet, e.g.___PPT12
.- Returns:
- programmable tag associated with this sheet.
-
iterator
-
getFollowMasterGraphics
public boolean getFollowMasterGraphics()- Specified by:
getFollowMasterGraphics
in interfaceSheet<HSLFShape,
HSLFTextParagraph> - 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
-
createTextBox
Description copied from interface:ShapeContainer
create a text box- Specified by:
createTextBox
in interfaceHSLFShapeContainer
- Specified by:
createTextBox
in interfaceShapeContainer<HSLFShape,
HSLFTextParagraph>
-
createAutoShape
Description copied from interface:ShapeContainer
create a new shape with a predefined geometry and add it to this shape container- Specified by:
createAutoShape
in interfaceHSLFShapeContainer
- Specified by:
createAutoShape
in interfaceShapeContainer<HSLFShape,
HSLFTextParagraph>
-
createFreeform
Description copied from interface:ShapeContainer
create a new shape with a custom geometry- Specified by:
createFreeform
in interfaceHSLFShapeContainer
- Specified by:
createFreeform
in interfaceShapeContainer<HSLFShape,
HSLFTextParagraph>
-
createConnector
Description copied from interface:ShapeContainer
create a connector- Specified by:
createConnector
in interfaceHSLFShapeContainer
- Specified by:
createConnector
in interfaceShapeContainer<HSLFShape,
HSLFTextParagraph>
-
createGroup
Description copied from interface:ShapeContainer
create a group of shapes belonging to this container- Specified by:
createGroup
in interfaceHSLFShapeContainer
- Specified by:
createGroup
in interfaceShapeContainer<HSLFShape,
HSLFTextParagraph>
-
createPicture
Description copied from interface:ShapeContainer
create a picture belonging to this container- Specified by:
createPicture
in interfaceHSLFShapeContainer
- Specified by:
createPicture
in interfaceShapeContainer<HSLFShape,
HSLFTextParagraph>
-
createTable
Description copied from interface:ShapeContainer
Create a new Table of the given number of rows and columns- Specified by:
createTable
in interfaceShapeContainer<HSLFShape,
HSLFTextParagraph> - Parameters:
numRows
- the number of rowsnumCols
- the number of columns
-
createOleShape
Description copied from interface:ShapeContainer
Create a new OLE object shape with the given pictureData as preview image- Specified by:
createOleShape
in interfaceHSLFShapeContainer
- Specified by:
createOleShape
in interfaceShapeContainer<HSLFShape,
HSLFTextParagraph> - Parameters:
pictureData
- the preview image
-
getPlaceholderDetails
Description copied from interface:Sheet
Get the placeholder details for the given placeholder type. Not all placeholders are also shapes - this is especially true for old HSLF slideshows, which notes have header/footers elements which aren't shapes.- Specified by:
getPlaceholderDetails
in interfaceSheet<HSLFShape,
HSLFTextParagraph> - Parameters:
placeholder
- the placeholder type- Returns:
- the placeholder details or
null
, if the placeholder isn't contained in the sheet
-