public final class HSLFSlideShow extends POIDocument implements SlideShow<HSLFShape,HSLFTextParagraph>, java.io.Closeable, GenericRecord
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
POWERPOINT_DOCUMENT
Powerpoint document entry/stream name
|
static java.lang.String |
PP95_DOCUMENT |
static java.lang.String |
PP97_DOCUMENT |
Constructor and Description |
---|
HSLFSlideShow()
Constructs a new, empty, Powerpoint document.
|
HSLFSlideShow(DirectoryNode root)
Constructs a Powerpoint document from an DirectoryNode.
|
HSLFSlideShow(HSLFSlideShowImpl hslfSlideShow)
Constructs a Powerpoint document from the underlying
HSLFSlideShow object.
|
HSLFSlideShow(java.io.InputStream inputStream)
Constructs a Powerpoint document from an input stream.
|
HSLFSlideShow(POIFSFileSystem poifs)
Constructs a Powerpoint document from an POIFSFileSystem.
|
Modifier and Type | Method and Description |
---|---|
int |
addControl(java.lang.String name,
java.lang.String progId)
Add a control in this presentation
|
int |
addEmbed(POIFSFileSystem poiData)
Add a embedded object to this presentation
|
HSLFFontInfo |
addFont(FontInfo fontInfo)
Add a font in this presentation
|
HSLFFontInfo |
addFont(java.io.InputStream fontData)
Add a font in this presentation and also embed its font data
|
int |
addMovie(java.lang.String path,
int type)
Add a movie in this presentation
|
HSLFPictureData |
addPicture(byte[] data,
PictureData.PictureType format)
Adds a picture to the presentation.
|
HSLFPictureData |
addPicture(java.io.File pict,
PictureData.PictureType format)
Adds a picture to the presentation.
|
HSLFPictureData |
addPicture(java.io.InputStream is,
PictureData.PictureType format)
Adds a picture to the presentation.
|
protected void |
clearDirectory()
Clear/unlink the attached directory entry
|
void |
close()
Closes the underlying
POIFSFileSystem from which
the document was read, if any. |
void |
createInformationProperties()
Will create whichever of SummaryInformation
and DocumentSummaryInformation (HPSF) properties
are not already part of your document.
|
MasterSheet<HSLFShape,HSLFTextParagraph> |
createMasterSheet() |
HSLFSlide |
createSlide()
Create a blank
Slide . |
HSLFPictureData |
findPictureData(byte[] pictureData)
check if a picture with this picture data already exists in this presentation
|
Record |
getCoreRecordForRefID(int refID)
For a given refID (the internal, 0 based numbering scheme), return the
core record
|
Record |
getCoreRecordForSAS(SlideListWithText.SlideAtomsSet sas)
For a given SlideAtomsSet, return the core record, based on the refID
from the SlidePersistAtom
|
DirectoryNode |
getDirectory() |
Document |
getDocumentRecord()
Helper method for usermodel and model: Get the document record
|
DocumentSummaryInformation |
getDocumentSummaryInformation()
Fetch the Document Summary Information of the document
|
HSLFObjectData[] |
getEmbeddedObjects()
Returns the data of all the embedded OLE object in the SlideShow
|
protected java.lang.String |
getEncryptedPropertyStreamName() |
EncryptionInfo |
getEncryptionInfo() |
HSLFFontInfo |
getFont(int idx)
Get a font by index
|
java.util.List<HSLFFontInfo> |
getFonts() |
java.util.List<? extends GenericRecord> |
getGenericChildren() |
java.util.Map<java.lang.String,java.util.function.Supplier<?>> |
getGenericProperties() |
static int |
getMaxRecordLength() |
HPSFPropertiesExtractor |
getMetadataTextExtractor() |
Record[] |
getMostRecentCoreRecords()
Returns an array of the most recent version of all the interesting
records
|
java.util.List<HSLFNotes> |
getNotes()
Returns an array of all the normal Notes found in the slideshow
|
HeadersFooters |
getNotesHeadersFooters()
Return Header / Footer settings for notes
|
int |
getNumberOfFonts()
get the number of fonts in the presentation
|
java.awt.Dimension |
getPageSize()
Returns the current page size
|
java.lang.Object |
getPersistDocument() |
java.util.List<HSLFPictureData> |
getPictureData()
Returns all Pictures of this slideshow.
|
protected PropertySet |
getPropertySet(java.lang.String setName)
For a given named property entry, either return it or null if
if it wasn't found
|
protected PropertySet |
getPropertySet(java.lang.String setName,
EncryptionInfo encryptionInfo)
For a given named property entry, either return it or null if
if it wasn't found
|
HeadersFooters |
getSlideHeadersFooters()
Return Header / Footer settings for slides
|
java.util.List<HSLFSlideMaster> |
getSlideMasters()
Returns an array of all the normal Slide Masters found in the slideshow
|
java.util.List<HSLFSlide> |
getSlides()
Returns an array of all the normal Slides found in the slideshow
|
HSLFSlideShowImpl |
getSlideShowImpl() |
HSLFSoundData[] |
getSoundData()
Returns the data of all the embedded sounds in the SlideShow
|
SummaryInformation |
getSummaryInformation()
Fetch the Summary Information of the document
|
java.util.List<HSLFTitleMaster> |
getTitleMasters()
Returns an array of all the normal Title Masters found in the slideshow
|
protected boolean |
initDirectory()
check if we were created by POIFS otherwise create a new dummy POIFS
for storing the package data
|
void |
readProperties()
Find, and create objects for, the standard
Document Information Properties (HPSF).
|
HSLFSlide |
removeSlide(int index)
Removes the slide at the given index (0-based).
|
void |
reorderSlide(int oldSlideNumber,
int newSlideNumber)
Re-orders a slide, to a new position.
|
protected void |
replaceDirectory(DirectoryNode newDirectory)
Replaces the attached directory, e.g.
|
static void |
setMaxRecordLength(int length) |
void |
setPageSize(java.awt.Dimension pgsize)
Change the current page size
|
protected void |
validateInPlaceWritePossible()
Called during a
POIDocument.write() to ensure that the Document (and
associated POIFSFileSystem ) was opened in a way compatible
with an in-place write. |
void |
write()
Writes the document out to the currently open
File , via the
writeable POIFSFileSystem it was opened from. |
void |
write(java.io.File newFile)
Writes the document out to the specified new
File . |
void |
write(java.io.OutputStream out)
Writes the document out to the specified output stream.
|
protected void |
writeProperties()
Writes out the updated standard Document Information Properties (HPSF)
into the currently open POIFSFileSystem
|
void |
writeProperties(POIFSFileSystem outFS)
Writes out the standard Document Information Properties (HPSF)
|
protected void |
writeProperties(POIFSFileSystem outFS,
java.util.List<java.lang.String> writtenEntries)
Writes out the standard Document Information Properties (HPSF)
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getGenericRecordType
public static final java.lang.String POWERPOINT_DOCUMENT
public static final java.lang.String PP97_DOCUMENT
public static final java.lang.String PP95_DOCUMENT
public HSLFSlideShow(HSLFSlideShowImpl hslfSlideShow)
hslfSlideShow
- the HSLFSlideShow to base onpublic HSLFSlideShow()
public HSLFSlideShow(java.io.InputStream inputStream) throws java.io.IOException
java.io.IOException
- If reading data from the stream failsjava.lang.RuntimeException
- a number of runtime exceptions can be thrown, especially if there are problems with the
input formatpublic HSLFSlideShow(POIFSFileSystem poifs) throws java.io.IOException
java.io.IOException
- If reading data from the file-system failsjava.lang.RuntimeException
- a number of runtime exceptions can be thrown, especially if there are problems with the
input formatpublic HSLFSlideShow(DirectoryNode root) throws java.io.IOException
java.io.IOException
- If reading data from the DirectoryNode failsjava.lang.RuntimeException
- a number of runtime exceptions can be thrown, especially if there are problems with the
input formatpublic static void setMaxRecordLength(int length)
length
- the max record length allowed for HSLFSlideShowpublic static int getMaxRecordLength()
public Record getCoreRecordForSAS(SlideListWithText.SlideAtomsSet sas)
public Record getCoreRecordForRefID(int refID)
refID
- the refIDpublic void write(java.io.OutputStream out) throws java.io.IOException
POIDocument
File
rather
than an InputStream
, you must write out using
POIDocument.write()
or to a different File. Overwriting the currently
open file via an OutputStream isn't possible.
If stream
is a FileOutputStream
on a networked drive
or has a high cost/latency associated with each written byte,
consider wrapping the OutputStream in a BufferedOutputStream
to improve write performance, or use POIDocument.write()
/ POIDocument.write(File)
if possible.write
in interface SlideShow<HSLFShape,HSLFTextParagraph>
write
in class POIDocument
out
- The stream to write to.java.io.IOException
- thrown on errors writing to the streampublic Record[] getMostRecentCoreRecords()
public java.util.List<HSLFSlide> getSlides()
getSlides
in interface SlideShow<HSLFShape,HSLFTextParagraph>
public java.util.List<HSLFNotes> getNotes()
public java.util.List<HSLFSlideMaster> getSlideMasters()
getSlideMasters
in interface SlideShow<HSLFShape,HSLFTextParagraph>
public java.util.List<HSLFTitleMaster> getTitleMasters()
public java.util.List<HSLFPictureData> getPictureData()
SlideShow
List
is unmodifiable.getPictureData
in interface SlideShow<HSLFShape,HSLFTextParagraph>
List
of PictureData
.public HSLFObjectData[] getEmbeddedObjects()
public HSLFSoundData[] getSoundData()
public java.awt.Dimension getPageSize()
SlideShow
getPageSize
in interface SlideShow<HSLFShape,HSLFTextParagraph>
public void setPageSize(java.awt.Dimension pgsize)
SlideShow
setPageSize
in interface SlideShow<HSLFShape,HSLFTextParagraph>
pgsize
- page size (in points)public Document getDocumentRecord()
public void reorderSlide(int oldSlideNumber, int newSlideNumber)
oldSlideNumber
- The old slide number (1 based)newSlideNumber
- The new slide number (1 based)public HSLFSlide removeSlide(int index)
Shifts any subsequent slides to the left (subtracts one from their slide numbers).
index
- the index of the slide to remove (0-based)public HSLFSlide createSlide()
Slide
.createSlide
in interface SlideShow<HSLFShape,HSLFTextParagraph>
Slide
public HSLFPictureData addPicture(byte[] data, PictureData.PictureType format) throws java.io.IOException
SlideShow
addPicture
in interface SlideShow<HSLFShape,HSLFTextParagraph>
data
- The bytes of the pictureformat
- The format of the picture.java.io.IOException
public HSLFPictureData addPicture(java.io.InputStream is, PictureData.PictureType format) throws java.io.IOException
addPicture
in interface SlideShow<HSLFShape,HSLFTextParagraph>
is
- The stream to read the image fromformat
- The format of the picture.java.io.IOException
public HSLFPictureData addPicture(java.io.File pict, PictureData.PictureType format) throws java.io.IOException
addPicture
in interface SlideShow<HSLFShape,HSLFTextParagraph>
pict
- the file containing the image to addformat
- The format of the picture.java.io.IOException
public HSLFPictureData findPictureData(byte[] pictureData)
findPictureData
in interface SlideShow<HSLFShape,HSLFTextParagraph>
pictureData
- The picture data to find in the SlideShownull
if picture data is not found in this slideshowpublic HSLFFontInfo addFont(FontInfo fontInfo)
fontInfo
- the font to addpublic HSLFFontInfo addFont(java.io.InputStream fontData) throws java.io.IOException
addFont
in interface SlideShow<HSLFShape,HSLFTextParagraph>
fontData
- the EOT font data as streamjava.io.IOException
- if the fontData can't be saved or if the fontData is no EOT fontpublic HSLFFontInfo getFont(int idx)
idx
- 0-based index of the fontPPFont
or null
if not
foundpublic int getNumberOfFonts()
public java.util.List<HSLFFontInfo> getFonts()
getFonts
in interface SlideShow<HSLFShape,HSLFTextParagraph>
public HeadersFooters getSlideHeadersFooters()
public HeadersFooters getNotesHeadersFooters()
public int addMovie(java.lang.String path, int type)
path
- the path or url to the moviepublic int addControl(java.lang.String name, java.lang.String progId)
name
- name of the control, e.g. "Shockwave Flash Object"progId
- OLE Programmatic Identifier, e.g.
"ShockwaveFlash.ShockwaveFlash.9"public int addEmbed(POIFSFileSystem poiData)
public HPSFPropertiesExtractor getMetadataTextExtractor()
getMetadataTextExtractor
in interface SlideShow<HSLFShape,HSLFTextParagraph>
public MasterSheet<HSLFShape,HSLFTextParagraph> createMasterSheet()
createMasterSheet
in interface SlideShow<HSLFShape,HSLFTextParagraph>
@Internal public HSLFSlideShowImpl getSlideShowImpl()
public void close() throws java.io.IOException
POIDocument
POIFSFileSystem
from which
the document was read, if any. Has no effect on documents
opened from an InputStream, or newly created ones.
Once close()
has been called, no further operations
should be called on the document.
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class POIDocument
java.io.IOException
public java.lang.Object getPersistDocument()
getPersistDocument
in interface SlideShow<HSLFShape,HSLFTextParagraph>
POIDocument
or POIXMLDocument
public java.util.Map<java.lang.String,java.util.function.Supplier<?>> getGenericProperties()
getGenericProperties
in interface GenericRecord
public java.util.List<? extends GenericRecord> getGenericChildren()
getGenericChildren
in interface GenericRecord
public void write() throws java.io.IOException
POIDocument
File
, via the
writeable POIFSFileSystem
it was opened from.
This will fail (with an IllegalStateException
if the
document was opened read-only, opened from an InputStream
instead of a File, or if this is not the root document. For those cases,
you must use POIDocument.write(OutputStream)
or POIDocument.write(File)
to
write to a brand new document.
write
in class POIDocument
java.io.IOException
- thrown on errors writing to the filepublic void write(java.io.File newFile) throws java.io.IOException
POIDocument
File
. If the file
exists, it will be replaced, otherwise a new one will be createdwrite
in class POIDocument
newFile
- The new File to write to.java.io.IOException
- thrown on errors writing to the filepublic DocumentSummaryInformation getDocumentSummaryInformation()
POIDocument
getDocumentSummaryInformation
in class POIDocument
public SummaryInformation getSummaryInformation()
POIDocument
getSummaryInformation
in class POIDocument
public void createInformationProperties()
POIDocument
createInformationProperties
in class POIDocument
public void readProperties()
POIDocument
readProperties
in class POIDocument
protected PropertySet getPropertySet(java.lang.String setName) throws java.io.IOException
POIDocument
getPropertySet
in class POIDocument
setName
- The property to readjava.io.IOException
- If retrieving properties failsprotected PropertySet getPropertySet(java.lang.String setName, EncryptionInfo encryptionInfo) throws java.io.IOException
POIDocument
getPropertySet
in class POIDocument
setName
- The property to readencryptionInfo
- the encryption descriptor in case of cryptoAPI encryptionjava.io.IOException
- If retrieving properties failsprotected void writeProperties() throws java.io.IOException
POIDocument
writeProperties
in class POIDocument
java.io.IOException
- if an error when writing to the open
POIFSFileSystem
occurspublic void writeProperties(POIFSFileSystem outFS) throws java.io.IOException
POIDocument
writeProperties
in class POIDocument
outFS
- the POIFSFileSystem to write the properties intojava.io.IOException
- if an error when writing to the
POIFSFileSystem
occursprotected void writeProperties(POIFSFileSystem outFS, java.util.List<java.lang.String> writtenEntries) throws java.io.IOException
POIDocument
writeProperties
in class POIDocument
outFS
- the POIFSFileSystem
to write the properties intowrittenEntries
- a list of POIFS entries to add the property names toojava.io.IOException
- if an error when writing to the
POIFSFileSystem
occursprotected void validateInPlaceWritePossible() throws java.lang.IllegalStateException
POIDocument
POIDocument.write()
to ensure that the Document (and
associated POIFSFileSystem
) was opened in a way compatible
with an in-place write.validateInPlaceWritePossible
in class POIDocument
java.lang.IllegalStateException
- if the document was opened suitablypublic DirectoryNode getDirectory()
getDirectory
in class POIDocument
protected void clearDirectory()
POIDocument
clearDirectory
in class POIDocument
protected boolean initDirectory()
POIDocument
initDirectory
in class POIDocument
true
if dummy directory was created, false
otherwiseprotected void replaceDirectory(DirectoryNode newDirectory) throws java.io.IOException
POIDocument
replaceDirectory
in class POIDocument
newDirectory
- the new directoryjava.io.IOException
protected java.lang.String getEncryptedPropertyStreamName()
getEncryptedPropertyStreamName
in class POIDocument
public EncryptionInfo getEncryptionInfo()
getEncryptionInfo
in class POIDocument
null
Copyright 2022 The Apache Software Foundation or its licensors, as applicable.