|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.odftoolkit.odfdom.pkg.OdfPackageDocument
org.odftoolkit.odfdom.dom.OdfSchemaDocument
org.odftoolkit.simple.Document
org.odftoolkit.simple.PresentationDocument
public class PresentationDocument
This class represents an empty ODF presentation.
Nested Class Summary | |
---|---|
static class |
PresentationDocument.OdfMediaType
This enum contains all possible media types of PresentationDocument documents. |
static class |
PresentationDocument.PresentationClass
It represents the defined values of presentation:class. |
Nested classes/interfaces inherited from class org.odftoolkit.simple.Document |
---|
Document.ScriptType |
Nested classes/interfaces inherited from class org.odftoolkit.odfdom.dom.OdfSchemaDocument |
---|
OdfSchemaDocument.OdfXMLFile |
Nested classes/interfaces inherited from class org.odftoolkit.odfdom.pkg.OdfPackageDocument |
---|
OdfPackageDocument.Resource |
Field Summary |
---|
Fields inherited from class org.odftoolkit.odfdom.dom.OdfSchemaDocument |
---|
mContentDom, mDocumentStyles, mMetaDom, mSettingsDom, mStylesDom |
Fields inherited from class org.odftoolkit.odfdom.pkg.OdfPackageDocument |
---|
mDocumentMediaType, mDocumentPathInPackage, mPackage, ROOT_DOCUMENT_PATH |
Constructor Summary | |
---|---|
protected |
PresentationDocument(OdfPackage pkg,
String internalPath,
PresentationDocument.OdfMediaType odfMediaType)
To avoid data duplication a new document is only created, if not already opened. |
Method Summary | |
---|---|
void |
appendPresentation(PresentationDocument srcDoc)
Append all the slides of the specified presentation document to the current document. |
void |
changeMode(PresentationDocument.OdfMediaType type)
Switches this instance to the given type. |
Slide |
copyForeignSlide(int destIndex,
PresentationDocument srcDoc,
int srcIndex)
Make a copy of slide which locates at the specified position of the source presentation document and insert it to the current presentation document at the new position. |
Slide |
copySlide(int source,
int dest,
String newName)
Make a copy of the slide at a specified position to another position in this presentation. |
Chart |
createChart(String title,
DataSet dataset,
Rectangle rect)
Creates a new Chart for this container. |
Chart |
createChart(String title,
SpreadsheetDocument document,
CellRangeAddressList cellRangeAddr,
boolean firstRowAsLabel,
boolean firstColumnAsLabel,
boolean rowAsDataSeries,
Rectangle rect)
Creates a new Chart for this container. |
Chart |
createChart(String title,
String[] labels,
String[] legends,
double[][] data,
Rectangle rect)
Creates a new Chart for this container. |
void |
deleteChartById(String chartId)
Deletes chart by chart id. |
void |
deleteChartByTitle(String title)
Deletes chart(s) by chart title. |
boolean |
deleteSlideByIndex(int index)
Delete the slide at a specified position in this presentation. |
boolean |
deleteSlideByName(String name)
Delete all the slides with a specified name in this presentation. |
Chart |
getChartById(String chartId)
Gets chart with specified id. |
List<Chart> |
getChartByTitle(String title)
Gets chart list with specified title. |
int |
getChartCount()
Returns the chart count of this container |
OfficePresentationElement |
getContentRoot()
Get the content root of a presentation document. |
Notes.NotesBuilder |
getNotesBuilder()
Return the notes builder of this document. |
Slide.SlideBuilder |
getSlideBuilder()
Return the slide builder of this document. |
Slide |
getSlideByIndex(int index)
Return the slide at a specified position in this presentation. |
Slide |
getSlideByName(String name)
Return the slide which have a specified slide name in this presentation. |
int |
getSlideCount()
Get the number of the slides in this presentation. |
Iterator<Slide> |
getSlides()
Return a list iterator containing all slides in this presentation. |
OdfElement |
getTableContainerElement()
Get the ODF element which can have |
static PresentationDocument |
loadDocument(File file)
Creates an PresentationDocument from the OpenDocument provided by a File. |
static PresentationDocument |
loadDocument(InputStream inputStream)
Creates an PresentationDocument from the OpenDocument provided by a resource Stream. |
static PresentationDocument |
loadDocument(String documentPath)
Loads an PresentationDocument from the provided path. |
void |
moveSlide(int source,
int dest)
Move the slide at a specified position to the destination position. |
static PresentationDocument |
newPresentationDocument()
Creates an empty presentation document. |
static PresentationDocument |
newPresentationTemplateDocument()
Creates an empty presentation template. |
Slide |
newSlide(int index,
String name,
Slide.SlideLayout slideLayout)
New a slide at the specified position with the specified name, and use the specified slide template. |
Methods inherited from class org.odftoolkit.simple.Document |
---|
addTable, addTable, close, getComponentMap, getContentRoot, getEmbeddedDocument, getEmbeddedDocuments, getEmbeddedDocuments, getLocale, getOdfMediaType, getOfficeMetadata, getScriptType, getSectionByName, getSectionIterator, getTableBuilder, getTableByName, getTableContainerImpl, getTableList, insertDocument, loadDocument, loadDocument, loadTemplate, newImage, removeElementLinkedResource, save, save, setLocale, setLocale, setOdfMediaType, toString |
Methods inherited from class org.odftoolkit.odfdom.dom.OdfSchemaDocument |
---|
getBaseURI, getContentDom, getContentStream, getDocumentStyles, getFileDom, getMasterPages, getMetaDom, getMetaStream, getOfficeMasterStyles, getOrCreateDocumentStyles, getSettingsDom, getSettingsStream, getStylesDom, getStylesStream, getTables, getXMLFilePath |
Methods inherited from class org.odftoolkit.odfdom.pkg.OdfPackageDocument |
---|
flushDoms, getDocumentPath, getFileDom, getMediaTypeString, getPackage, isExternalReference, isRootDocument, loadSubDocument, normalizeDocumentPath, removeDocument, save, setMediaTypeString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected PresentationDocument(OdfPackage pkg, String internalPath, PresentationDocument.OdfMediaType odfMediaType)
Method Detail |
---|
public static PresentationDocument newPresentationDocument() throws Exception
Exception
- - if the document could not be createdpublic static PresentationDocument newPresentationTemplateDocument() throws Exception
Exception
- - if the template could not be createdpublic static PresentationDocument loadDocument(InputStream inputStream) throws Exception
Since an InputStream does not provide the arbitrary (non sequentiell) read access needed by PresentationDocument, the InputStream is cached. This usually takes more time compared to the other createInternalDocument methods. An advantage of caching is that there are no problems overwriting an input file.
If the resource stream is not a ODF presentation document, ClassCastException might be thrown.
inputStream
- - the InputStream of the ODF presentation document.
Exception
- - if the document could not be created.public static PresentationDocument loadDocument(String documentPath) throws Exception
PresentationDocument relies on the file being available for read access over the whole lifecycle of PresentationDocument.
If the resource stream is not a ODF presentation document, ClassCastException might be thrown.
documentPath
- - the path from where the document can be loaded
Exception
- - if the document could not be created.public static PresentationDocument loadDocument(File file) throws Exception
PresentationDocument relies on the file being available for read access over the whole lifecycle of PresentationDocument.
If the resource stream is not a ODF presentation document, ClassCastException might be thrown.
file
- - a file representing the ODF presentation document.
Exception
- - if the document could not be created.public OfficePresentationElement getContentRoot() throws Exception
getContentRoot
in class Document
Exception
- if the file DOM could not be created.public void changeMode(PresentationDocument.OdfMediaType type)
type
- the compatible ODF mediatype.public Slide.SlideBuilder getSlideBuilder()
public Notes.NotesBuilder getNotesBuilder()
public Slide getSlideByIndex(int index)
index
- the index of the slide to be returned
public int getSlideCount()
public Slide getSlideByName(String name)
According to the odf specification "The draw:name attribute specifies a name by which this element can be referenced. It is optional but if present, must be unique within the document instance. If not present, an application may generate a unique name."
If the name is null, then return null because all the slide must has its own unique name.
name
- the specified slide name
public Iterator<Slide> getSlides()
public boolean deleteSlideByIndex(int index)
index
- the index of the slide that need to be delete
Throw IndexOutOfBoundsException if the slide index is out of the presentation document slide count.
public boolean deleteSlideByName(String name)
name
- the name of the slide that need to be delete
public Slide copySlide(int source, int dest, String newName)
source
- the source position of the slide need to be copieddest
- the destination position of the slide need to be copiednewName
- the new name of the copied slide
Throw IndexOutOfBoundsException if the slide index is out of the presentation document slide count. If copy the slide at the end of document, destIndex should set the same value with the slide count.
public void moveSlide(int source, int dest)
source
- the current index of the slide that need to be moveddest
- The index of the destination position before the move action
Throw IndexOutOfBoundsException if the slide index is out of the presentation document slide count.
public void appendPresentation(PresentationDocument srcDoc)
srcDoc
- the specified PresentationDocument
that need to
be appendedpublic Slide copyForeignSlide(int destIndex, PresentationDocument srcDoc, int srcIndex)
destIndex
- the new position of the copied slide in the current documentsrcDoc
- the source document of the copied slidesrcIndex
- the slide index of the source document that need to be copied
Throw IndexOutOfBoundsException if the slide index is out of the presentation document slide count If insert the foreign slide at the end of document, destIndex should set the same value with the slide count of the current presentation document.
public Slide newSlide(int index, String name, Slide.SlideLayout slideLayout)
OdfDrawPage.SlideLayout
.
If index is invalid, such as larger than the current document slide number or is negative, then append the new slide at the end of the document.
The slide name can be null.
index
- the new slide positionname
- the new slide nameslideLayout
- the new slide template
Throw IndexOutOfBoundsException if index is out of the presentation document slide count.
public Chart createChart(String title, DataSet dataset, Rectangle rect)
ChartContainer
createChart
in interface ChartContainer
title
- chart title.dataset
- chart data set.rect
- chart rectangle.
public Chart createChart(String title, SpreadsheetDocument document, CellRangeAddressList cellRangeAddr, boolean firstRowAsLabel, boolean firstColumnAsLabel, boolean rowAsDataSeries, Rectangle rect)
ChartContainer
createChart
in interface ChartContainer
title
- chart title.document
- the data source spreadsheet document.cellRangeAddr
- the cell range address list which is used as chart data set.firstRowAsLabel
- whether uses first row as label.firstColumnAsLabel
- whether uses first column as label.rowAsDataSeries
- whether uses data as series.rect
- chart rectangle.
public Chart createChart(String title, String[] labels, String[] legends, double[][] data, Rectangle rect)
ChartContainer
createChart
in interface ChartContainer
title
- chart rectangle.labels
- label stringslegends
- legend stringsdata
- chart data set.rect
- chart rectangle.
public void deleteChartById(String chartId)
ChartContainer
deleteChartById
in interface ChartContainer
chartId
- the id of specified chart.public void deleteChartByTitle(String title)
ChartContainer
deleteChartByTitle
in interface ChartContainer
title
- the title of specified chart(s).public Chart getChartById(String chartId)
ChartContainer
getChartById
in interface ChartContainer
chartId
- the id of this chart.
public List<Chart> getChartByTitle(String title)
ChartContainer
getChartByTitle
in interface ChartContainer
title
- the title of specified chart(s).
public int getChartCount()
ChartContainer
getChartCount
in interface ChartContainer
public OdfElement getTableContainerElement()
TableContainer
getTableContainerElement
in interface TableContainer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |