Package org.apache.poi.hslf.usermodel
Class HSLFSheet
- java.lang.Object
-
- org.apache.poi.hslf.usermodel.HSLFSheet
-
- All Implemented Interfaces:
java.lang.Iterable<HSLFShape>
,HSLFShapeContainer
,ShapeContainer<HSLFShape,HSLFTextParagraph>
,Sheet<HSLFShape,HSLFTextParagraph>
- Direct Known Subclasses:
HSLFMasterSheet
,HSLFNotes
,HSLFSlide
public abstract class HSLFSheet extends java.lang.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
-
-
Constructor Summary
Constructors Constructor Description HSLFSheet(SheetContainer container, int sheetNo)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
_getSheetNumber()
Returns the (internal, SlideIdentifier based) sheet number, as used to reference this sheet from other records.int
_getSheetRefId()
Returns the (internal, RefID based) sheet number, as used to in PersistPtr stuff.void
addShape(HSLFShape shape)
Add a new Shape to this Slideint
allocateShapeId()
Allocates new shape id for the new drawing group id.HSLFAutoShape
createAutoShape()
create a new shape with a predefined geometry and add it to this shape containerHSLFConnectorShape
createConnector()
create a connectorHSLFFreeformShape
createFreeform()
create a new shape with a custom geometryHSLFGroupShape
createGroup()
create a group of shapes belonging to this containerHSLFObjectShape
createOleShape(PictureData pictureData)
Create a new OLE object shape with the given pictureData as preview imageHSLFPictureShape
createPicture(PictureData pictureData)
create a picture belonging to this containerHSLFTable
createTable(int numRows, int numCols)
Create a new Table of the given number of rows and columnsHSLFTextBox
createTextBox()
create a text boxvoid
draw(java.awt.Graphics2D graphics)
Convenience method to draw a sheet to a graphics contextHSLFBackground
getBackground()
Returns the background shape for this sheet.ColorSchemeAtom
getColorScheme()
Color scheme for this sheet.boolean
getFollowMasterGraphics()
HeadersFooters
getHeadersFooters()
Header / Footer settings for this slide.abstract HSLFMasterSheet
getMasterSheet()
Return the master sheet .HSLFSimpleShape
getPlaceholder(Placeholder type)
Search placeholder by its typeHSLFTextShape
getPlaceholderByTextType(int type)
Return placeholder by text typeHSLFPlaceholderDetails
getPlaceholderDetails(Placeholder placeholder)
Get the placeholder details for the given placeholder type.PPDrawing
getPPDrawing()
Fetch the PPDrawing from the underlying recordjava.lang.String
getProgrammableTag()
Return programmable tag associated with this sheet, e.g.java.util.List<HSLFShape>
getShapes()
Returns all shapes contained in this SheetSheetContainer
getSheetContainer()
Return record container for this sheetHSLFSlideShow
getSlideShow()
Fetch the SlideShow we're attached toabstract java.util.List<java.util.List<HSLFTextParagraph>>
getTextParagraphs()
Returns an array of all the TextRuns in the sheet.java.util.Iterator<HSLFShape>
iterator()
void
onCreate()
Called by SlideShow ater a new sheet is createdboolean
removeShape(HSLFShape shape)
Removes the specified shape from this sheet.
-
-
-
Constructor Detail
-
HSLFSheet
public HSLFSheet(SheetContainer container, int sheetNo)
-
-
Method Detail
-
getTextParagraphs
public abstract java.util.List<java.util.List<HSLFTextParagraph>> 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
public PPDrawing getPPDrawing()
Fetch the PPDrawing from the underlying record
-
getSlideShow
public HSLFSlideShow getSlideShow()
Fetch the SlideShow we're attached to- Specified by:
getSlideShow
in interfaceSheet<HSLFShape,HSLFTextParagraph>
-
getSheetContainer
public SheetContainer getSheetContainer()
Return record container for this sheet
-
getShapes
public java.util.List<HSLFShape> 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
public void addShape(HSLFShape shape)
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
public boolean removeShape(HSLFShape shape)
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
public abstract HSLFMasterSheet getMasterSheet()
Return the master sheet .- Specified by:
getMasterSheet
in interfaceSheet<HSLFShape,HSLFTextParagraph>
-
getColorScheme
public ColorSchemeAtom getColorScheme()
Color scheme for this sheet.
-
getBackground
public HSLFBackground getBackground()
Returns the background shape for this sheet.- Specified by:
getBackground
in interfaceSheet<HSLFShape,HSLFTextParagraph>
- Returns:
- the background shape for this sheet.
-
draw
public void draw(java.awt.Graphics2D graphics)
Description copied from interface:Sheet
Convenience method to draw a sheet to a graphics context- Specified by:
draw
in interfaceSheet<HSLFShape,HSLFTextParagraph>
-
getPlaceholderByTextType
public HSLFTextShape getPlaceholderByTextType(int type)
Return placeholder by text type- Parameters:
type
- type of text, SeeTextHeaderAtom
- Returns:
TextShape
ornull
-
getPlaceholder
public HSLFSimpleShape getPlaceholder(Placeholder type)
Search placeholder by its type- Parameters:
type
- type of placeholder to search. SeeOEPlaceholderAtom
- Returns:
SimpleShape
ornull
-
getProgrammableTag
public java.lang.String getProgrammableTag()
Return programmable tag associated with this sheet, e.g.___PPT12
.- Returns:
- programmable tag associated with this sheet.
-
iterator
public java.util.Iterator<HSLFShape> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<HSLFShape>
-
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
public HSLFTextBox createTextBox()
Description copied from interface:ShapeContainer
create a text box- Specified by:
createTextBox
in interfaceHSLFShapeContainer
- Specified by:
createTextBox
in interfaceShapeContainer<HSLFShape,HSLFTextParagraph>
-
createAutoShape
public HSLFAutoShape 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
public HSLFFreeformShape 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
public HSLFConnectorShape createConnector()
Description copied from interface:ShapeContainer
create a connector- Specified by:
createConnector
in interfaceHSLFShapeContainer
- Specified by:
createConnector
in interfaceShapeContainer<HSLFShape,HSLFTextParagraph>
-
createGroup
public HSLFGroupShape 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
public HSLFPictureShape createPicture(PictureData pictureData)
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
public HSLFTable createTable(int numRows, int numCols)
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
public HSLFObjectShape createOleShape(PictureData pictureData)
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
-
getHeadersFooters
public HeadersFooters getHeadersFooters()
Header / Footer settings for this slide.- Returns:
- Header / Footer settings for this slide
-
getPlaceholderDetails
public HSLFPlaceholderDetails getPlaceholderDetails(Placeholder placeholder)
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
-
-