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
  Author:
    Nick Burch, Yegor Kozlov

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `HSLFSheet(SheetContainer container, int sheetNo)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and 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 Slide
    `int` | `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 container
    `HSLFConnectorShape` | `createConnector()` create a connector
    `HSLFFreeformShape` | `createFreeform()` create a new shape with a custom geometry
    `HSLFGroupShape` | `createGroup()` create a group of shapes belonging to this container
    `HSLFObjectShape` | `createOleShape(PictureData pictureData)` Create a new OLE object shape with the given pictureData as preview image
    `HSLFPictureShape` | `createPicture(PictureData pictureData)` create a picture belonging to this container
    `HSLFTable` | `createTable(int numRows, int numCols)` Create a new Table of the given number of rows and columns
    `HSLFTextBox` | `createTextBox()` create a text box
    `void` | `draw(java.awt.Graphics2D graphics)` Convenience method to draw a sheet to a graphics context
    `HSLFBackground` | `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 type
    `HSLFTextShape` | `getPlaceholderByTextType(int type)` Return placeholder by text type
    `HSLFPlaceholderDetails` | `getPlaceholderDetails(Placeholder placeholder)` Get the placeholder details for the given placeholder type.
    `PPDrawing` | `getPPDrawing()` Fetch the PPDrawing from the underlying record
    `java.lang.String` | `getProgrammableTag()` Return programmable tag associated with this sheet, e.g.
    `java.util.List<HSLFShape>` | `getShapes()` Returns all shapes contained in this Sheet
    `SheetContainer` | `getSheetContainer()` Return record container for this sheet
    `HSLFSlideShow` | `getSlideShow()` Fetch the SlideShow we're attached to
    `abstract java.util.List<java.util.List<HSLFTextParagraph>>` | `getTextParagraphs()` Returns an array of all the TextRuns in the sheet.
    `java.util.Iterator<HSLFShape>` | `iterator()`
    `protected void` | `onAddTextShape(HSLFTextShape 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 sheet is created
    `boolean` | `removeShape(HSLFShape shape)` Removes the specified shape from this sheet.
    `protected void` | `setSlideShow(HSLFSlideShow ss)` 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 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 interface `Sheet<HSLFShape,HSLFTextParagraph>`

    - #### getSheetContainer

          public SheetContainer getSheetContainer()

      Return record container for this sheet

    - #### setSlideShow

          @Internal
          protected void setSlideShow(HSLFSlideShow ss)

      Set the SlideShow we're attached to. Also passes it on to our child text paragraphs

    - #### getShapes

          public java.util.List<HSLFShape> getShapes()

      Returns all shapes contained in this Sheet
      Specified by:
        `getShapes` in interface `ShapeContainer<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 interface `ShapeContainer<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 interface `ShapeContainer<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 interface `Sheet<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 interface `Sheet<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 interface `Sheet<HSLFShape,HSLFTextParagraph>`

    - #### onAddTextShape

          protected void onAddTextShape(HSLFTextShape shape)

      Subclasses should call this method and update the array of text runs when a text shape is added
      Parameters:
        `shape` -

    - #### getPlaceholderByTextType

          public HSLFTextShape getPlaceholderByTextType(int type)

      Return placeholder by text type
      Parameters:
        `type` - type of text, See `TextHeaderAtom`
      Returns:
        `TextShape` or `null`

    - #### getPlaceholder

          public HSLFSimpleShape getPlaceholder(Placeholder type)

      Search placeholder by its type
      Parameters:
        `type` - type of placeholder to search. See `OEPlaceholderAtom`
      Returns:
        `SimpleShape` or `null`

    - #### 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 interface `java.lang.Iterable<HSLFShape>`

    - #### getFollowMasterGraphics

          public boolean getFollowMasterGraphics()

      Specified by:
        `getFollowMasterGraphics` in interface `Sheet<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 interface `HSLFShapeContainer`
      Specified by:
        `createTextBox` in interface `ShapeContainer<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 interface `HSLFShapeContainer`
      Specified by:
        `createAutoShape` in interface `ShapeContainer<HSLFShape,HSLFTextParagraph>`

    - #### createFreeform

          public HSLFFreeformShape createFreeform()

      Description copied from interface: `ShapeContainer`
      create a new shape with a custom geometry
      Specified by:
        `createFreeform` in interface `HSLFShapeContainer`
      Specified by:
        `createFreeform` in interface `ShapeContainer<HSLFShape,HSLFTextParagraph>`

    - #### createConnector

          public HSLFConnectorShape createConnector()

      Description copied from interface: `ShapeContainer`
      create a connector
      Specified by:
        `createConnector` in interface `HSLFShapeContainer`
      Specified by:
        `createConnector` in interface `ShapeContainer<HSLFShape,HSLFTextParagraph>`

    - #### createGroup

          public HSLFGroupShape createGroup()

      Description copied from interface: `ShapeContainer`
      create a group of shapes belonging to this container
      Specified by:
        `createGroup` in interface `HSLFShapeContainer`
      Specified by:
        `createGroup` in interface `ShapeContainer<HSLFShape,HSLFTextParagraph>`

    - #### createPicture

          public HSLFPictureShape createPicture(PictureData pictureData)

      Description copied from interface: `ShapeContainer`
      create a picture belonging to this container
      Specified by:
        `createPicture` in interface `HSLFShapeContainer`
      Specified by:
        `createPicture` in interface `ShapeContainer<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 interface `ShapeContainer<HSLFShape,HSLFTextParagraph>`
      Parameters:
        `numRows` - the number of rows
        `numCols` - 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 interface `HSLFShapeContainer`
      Specified by:
        `createOleShape` in interface `ShapeContainer<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 interface `Sheet<HSLFShape,HSLFTextParagraph>`
      Parameters:
        `placeholder` - the placeholder type
      Returns:
        the placeholder details or `null`, if the placeholder isn't contained in the sheet

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