org.odftoolkit.simple.presentation
Class Slide

java.lang.Object
  extended by org.odftoolkit.simple.Component
      extended by org.odftoolkit.simple.presentation.Slide
All Implemented Interfaces:
ChartContainer, FrameContainer, TextboxContainer, TableContainer, ListContainer

public class Slide
extends Component
implements ListContainer, TableContainer, TextboxContainer, ChartContainer

Slide represents the presentation slide feature of the ODF document. Slide provides methods to get the slide index,get the content of the current slide, etc.


Nested Class Summary
static class Slide.SlideBuilder
          This is a tool class which supplies all of the slide creation detail.
static class Slide.SlideLayout
          A slide layout is a slide with some predefine place holder.
 
Method Summary
 List addList()
          Add a new List to this container.
 List addList(ListDecorator decorator)
          Add a List with specified ListDecorator to this container.
 Table addTable()
          Add a new Table to this container.
 Table addTable(int numRows, int numCols)
          Add a new Table to this container with a specified row number and column number.
 Textbox addTextbox()
          Add a text box
 Textbox addTextbox(FrameRectangle position)
          Add a text box with a specific size at a specific position
 void clearList()
          Remove all Lists from this container.
 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.
 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
 OdfElement getFrameContainerElement()
          Get the ODF element which can have as child element directly according to ODF specification.
static Slide getInstance(DrawPageElement pageElement)
          Get a presentation slide instance by an instance of DrawPageElement.
 OdfElement getListContainerElement()
          Get the ODF element which can have as child element directly according to ODF specification.
 Iterator<List> getListIterator()
          Return an Iterator of the Lists in this ListContainer.
 Notes getNotesPage()
          Get the Notes page of this slide
 DrawPageElement getOdfElement()
          Return an instance of DrawPageElement which represents presentation slide feature.
 int getSlideIndex()
          Get the current slide index in the owner document.
 String getSlideName()
          Get the current slide name.
 Table.TableBuilder getTableBuilder()
          Return the table builder of this document.
 Table getTableByName(String name)
          Return an instance of table feature with the specific table name.
 OdfElement getTableContainerElement()
          Get the ODF element which can have as child element directly according to ODF specification.
protected  TableContainer getTableContainerImpl()
           
 List<Table> getTableList()
          Return a list of table features in this document.
 Textbox getTextboxByName(String name)
          Return a text box whose name is a given value.
 List<Textbox> getTextboxByUsage(PresentationDocument.PresentationClass usage)
          This method is only useful in presentation slide.
 Iterator<Textbox> getTextboxIterator()
          Return an Iterator of the text objects in this container.
 boolean removeList(List list)
          Remove the existing List from this container.
 boolean removeTextbox(Textbox box)
          Remove the text box
 void setSlideName(String name)
          Set the current slide name.
 
Methods inherited from class org.odftoolkit.simple.Component
getComponentByElement, getOwnerDocument, registerComponent, unregisterComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Slide getInstance(DrawPageElement pageElement)
Get a presentation slide instance by an instance of DrawPageElement.

Parameters:
pageElement - an instance of DrawPageElement
Returns:
an instance of Slide that can represent pageElement

getOdfElement

public DrawPageElement getOdfElement()
Return an instance of DrawPageElement which represents presentation slide feature.

Specified by:
getOdfElement in class Component
Returns:
an instance of DrawPageElement

getSlideIndex

public int getSlideIndex()
Get the current slide index in the owner document.

Returns:
the slide index in the owner document

-1, if the odf element which can represent this slide is not in the document DOM tree


getSlideName

public String getSlideName()
Get the current slide name.

If the "draw:name" attribute is not present there, create an unique name for this slide

Returns:
the name of the current slide

setSlideName

public void setSlideName(String name)
Set the current slide name.

It must be unique slide name in the current presentation. If not, an IllegalArgumentException will be thrown. If the given name is null, an IllegalArgumentException will also be thrown.

Parameters:
name - the new name of the current slide
Throws:
IllegalArgumentException - if the given name is null or it is not unique in the current presentation.

getNotesPage

public Notes getNotesPage()
Get the Notes page of this slide

Returns:
the instance of Notes which represent the notes page of the current slide

getListContainerElement

public OdfElement getListContainerElement()
Description copied from interface: ListContainer
Get the ODF element which can have as child element directly according to ODF specification. This Element will help to find the position to insert a new List. For example, element is usable with element, so TextDocument will return OfficeTextElement. While Presentation Notes is an indirectly ListContainer, which holds List with the help of its grand-child element , so for Notes, DrawTextBoxElement should be return.

Specified by:
getListContainerElement in interface ListContainer
Returns:
container element which can hold .

addList

public List addList()
Description copied from interface: ListContainer
Add a new List to this container.

Specified by:
addList in interface ListContainer
Returns:
added list.

addList

public List addList(ListDecorator decorator)
Description copied from interface: ListContainer
Add a List with specified ListDecorator to this container.

Specified by:
addList in interface ListContainer
Parameters:
decorator - the specified ListDecorator
Returns:
added list.

clearList

public void clearList()
Description copied from interface: ListContainer
Remove all Lists from this container.

Specified by:
clearList in interface ListContainer

getListIterator

public Iterator<List> getListIterator()
Description copied from interface: ListContainer
Return an Iterator of the Lists in this ListContainer. The Lists are iterated in the same order that they occur in the ListContainer.

Specified by:
getListIterator in interface ListContainer
Returns:
an Iterator of the Lists in this ListContainer
See Also:
Iterator

removeList

public boolean removeList(List list)
Description copied from interface: ListContainer
Remove the existing List from this container.

Specified by:
removeList in interface ListContainer
Returns:
true, if the container contains this List.

addTable

public Table addTable()
Description copied from interface: TableContainer
Add a new Table to this container.

Specified by:
addTable in interface TableContainer
Returns:
added table.

addTable

public Table addTable(int numRows,
                      int numCols)
Description copied from interface: TableContainer
Add a new Table to this container with a specified row number and column number.

The table will be inserted at the end of the tableContainer. An unique table name will be given, you may set a custom table name using the setTableName method.

Specified by:
addTable in interface TableContainer
Parameters:
numRows - the row number
numCols - the column number
Returns:
a new instance of Table

getTableByName

public Table getTableByName(String name)
Description copied from interface: TableContainer
Return an instance of table feature with the specific table name.

Specified by:
getTableByName in interface TableContainer
Parameters:
name - of the table being searched for.
Returns:
an instance of table feature with the specific table name.

getTableList

public List<Table> getTableList()
Description copied from interface: TableContainer
Return a list of table features in this document.

Specified by:
getTableList in interface TableContainer
Returns:
a list of table features in this document.

getTableBuilder

public Table.TableBuilder getTableBuilder()
Description copied from interface: TableContainer
Return the table builder of this document. Every document has a table builder, which supplies all of the table creation realization, for example newTable().

Specified by:
getTableBuilder in interface TableContainer
Returns:
the table builder of this document.

getTableContainerElement

public OdfElement getTableContainerElement()
Description copied from interface: TableContainer
Get the ODF element which can have as child element directly according to ODF specification. This Element will help to find the position to insert a new Table. For example, element is usable with element, so TextDocument will return OfficeTextElement. While Presentation Notes is an indirectly TableContainer, which holds Table with the help of its grand-child element , so for Notes, DrawTextBoxElement should be return.

Specified by:
getTableContainerElement in interface TableContainer
Returns:
container element which can hold .

getTableContainerImpl

protected TableContainer getTableContainerImpl()

addTextbox

public Textbox addTextbox()
Description copied from interface: TextboxContainer
Add a text box

Specified by:
addTextbox in interface TextboxContainer
Returns:
the object of text box

getTextboxIterator

public Iterator<Textbox> getTextboxIterator()
Description copied from interface: TextboxContainer
Return an Iterator of the text objects in this container.

Specified by:
getTextboxIterator in interface TextboxContainer
Returns:
an Iterator of the text objects in this container

removeTextbox

public boolean removeTextbox(Textbox box)
Description copied from interface: TextboxContainer
Remove the text box

Specified by:
removeTextbox in interface TextboxContainer
Parameters:
box - - the instance of text box
Returns:
true if success, false if fails

getFrameContainerElement

public OdfElement getFrameContainerElement()
Description copied from interface: FrameContainer
Get the ODF element which can have as child element directly according to ODF specification. This Element will help to find the position to insert a new draw:frame element.

Specified by:
getFrameContainerElement in interface FrameContainer
Returns:
the parent of draw:frame

addTextbox

public Textbox addTextbox(FrameRectangle position)
Description copied from interface: TextboxContainer
Add a text box with a specific size at a specific position

Specified by:
addTextbox in interface TextboxContainer
Parameters:
position - - the rectangle (position and size) of this text box
Returns:
the object of text box

getTextboxByName

public Textbox getTextboxByName(String name)
Description copied from interface: TextboxContainer
Return a text box whose name is a given value.

Specified by:
getTextboxByName in interface TextboxContainer
Parameters:
name - - the name of the text box
Returns:
a text box whose name is a given value

getTextboxByUsage

public List<Textbox> getTextboxByUsage(PresentationDocument.PresentationClass usage)
Description copied from interface: TextboxContainer
This method is only useful in presentation slide.

This method will return a list of text boxs by the usage in presentation slides.

Specified by:
getTextboxByUsage in interface TextboxContainer
Parameters:
usage - - the usage description
Returns:
a list of text box Null will be returned if the owner document is not a presentation

createChart

public Chart createChart(String title,
                         DataSet dataset,
                         Rectangle rect)
Description copied from interface: ChartContainer
Creates a new Chart for this container.

Specified by:
createChart in interface ChartContainer
Parameters:
title - chart title.
dataset - chart data set.
rect - chart rectangle.
Returns:
the created chart.

createChart

public Chart createChart(String title,
                         SpreadsheetDocument document,
                         CellRangeAddressList cellRangeAddr,
                         boolean firstRowAsLabel,
                         boolean firstColumnAsLabel,
                         boolean rowAsDataSeries,
                         Rectangle rect)
Description copied from interface: ChartContainer
Creates a new Chart for this container.

Specified by:
createChart in interface ChartContainer
Parameters:
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.
Returns:
the created chart.

createChart

public Chart createChart(String title,
                         String[] labels,
                         String[] legends,
                         double[][] data,
                         Rectangle rect)
Description copied from interface: ChartContainer
Creates a new Chart for this container.

Specified by:
createChart in interface ChartContainer
Parameters:
title - chart rectangle.
labels - label strings
legends - legend strings
data - chart data set.
rect - chart rectangle.
Returns:
the created chart.

deleteChartById

public void deleteChartById(String chartId)
Description copied from interface: ChartContainer
Deletes chart by chart id.

Specified by:
deleteChartById in interface ChartContainer
Parameters:
chartId - the id of specified chart.

deleteChartByTitle

public void deleteChartByTitle(String title)
Description copied from interface: ChartContainer
Deletes chart(s) by chart title.

Specified by:
deleteChartByTitle in interface ChartContainer
Parameters:
title - the title of specified chart(s).

getChartById

public Chart getChartById(String chartId)
Description copied from interface: ChartContainer
Gets chart with specified id.

Specified by:
getChartById in interface ChartContainer
Parameters:
chartId - the id of this chart.
Returns:
the chart with specified id.

getChartByTitle

public List<Chart> getChartByTitle(String title)
Description copied from interface: ChartContainer
Gets chart list with specified title.

Specified by:
getChartByTitle in interface ChartContainer
Parameters:
title - the title of specified chart(s).
Returns:
the chart(s) with specified title.

getChartCount

public int getChartCount()
Description copied from interface: ChartContainer
Returns the chart count of this container

Specified by:
getChartCount in interface ChartContainer
Returns:
the chart count of this container


Copyright © 2010-2017 The Apache Software Foundation. All Rights Reserved.