org.odftoolkit.simple.text
public class Section extends Component implements ParagraphContainer, TableContainer, ListContainer
Modifier and Type | Method and Description |
---|---|
List |
addList()
Add a new List to this container.
|
List |
addList(ListDecorator decorator)
Add a List with specified ListDecorator to this container.
|
Paragraph |
addParagraph(String textContent)
Add paragraph at the end of the container with specified text content.
|
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.
|
void |
clearList()
Remove all Lists from this container.
|
boolean |
equals(Object obj) |
ProtectionKeyDigestProvider |
getDefaultProtectionKeyDigestProvider()
Get the default provider which use SHA-1 standard as the protection key
digest algorithm.
|
static Section |
getInstance(TextSectionElement element)
Get a section instance by an object of
TextSectionElement . |
OdfElement |
getListContainerElement()
Get the ODF element which can have
|
Iterator<List> |
getListIterator()
Return an Iterator of the Lists in this ListContainer.
|
String |
getName()
Return the name of this section
|
TextSectionElement |
getOdfElement()
Return an instance of
TextSectionElement which represents
this section. |
Document |
getOwnerDocument()
Return the ODF document which this section belongs to.
|
Paragraph |
getParagraphByIndex(int index,
boolean isEmptyParagraphSkipped)
Return a paragraph with a given index.
|
Paragraph |
getParagraphByReverseIndex(int reverseIndex,
boolean isEmptyParagraphSkipped)
Return a paragraph with a given index.
|
OdfElement |
getParagraphContainerElement()
Get the ODF element which can have
|
Iterator<Paragraph> |
getParagraphIterator()
Return an Iterator of the paragraph in this container.
|
String |
getProtectedPassword()
Get the protection key of this section.
|
String |
getProtectionKeyDigestAlgorithm()
Get the protection key digest algorithm.
|
ProtectionKeyDigestProvider |
getProtectionKeyDigestProvier()
Get current used provider which provides corresponding protection key
digest algorithm.
|
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
|
protected TableContainer |
getTableContainerImpl() |
List<Table> |
getTableList()
Return a list of table features in this document.
|
boolean |
isProtected()
Return the value of section which specifies whether the section is
protected.
|
void |
remove()
Remove this section from the document.
|
boolean |
removeList(List list)
Remove the existing List from this container.
|
boolean |
removeParagraph(Paragraph para)
Remove paragraph from the container
|
void |
setName(String name)
Set the value of this section name
|
void |
setProtected(boolean isProtected)
Set the value to specify whether the section is protected.
|
void |
setProtectedWithPassword(String key)
Set the password which specifies that an authorization is required for
removing the protection of this section.
|
void |
setProtectionKeyDigestProvider(ProtectionKeyDigestProvider provider)
Set the provider which provides corresponding protection key digest
algorithm.
|
getComponentByElement, registerComponent, unregisterComponent
public static Section getInstance(TextSectionElement element)
TextSectionElement
.element
- - an object of TextSectionElement
Section
that can represent
TextSectionElement
public Document getOwnerDocument()
getOwnerDocument
in class Component
public String getName()
public void setName(String name)
name
- - the value of name to be setpublic void remove()
All the linked resources which are only linked to this section will be removed too.
public TextSectionElement getOdfElement()
TextSectionElement
which represents
this section.getOdfElement
in class Component
TextSectionElement
which represents
this sectionpublic void setProtected(boolean isProtected)
If this value is set to false, the existing password will be removed at the same.
isProtected
- - "true" represents the section cannot be edited through a
user interface. "false" represents the section is allowed to
be edited.public boolean isProtected()
public void setProtectedWithPassword(String key)
If key is empty or null, the attribute of
text:protection-key
and
text:protection-key-digest-algorithm
will be removed.
The authentication procedure can be customized by
setProtectionKeyDigestProvider(ProtectionKeyDigestProvider)
. The default digest algorighom of the protection key is SHA-1:
http://www.w3.org/2000/09/xmldsig#sha1.
key
- -the value of the password.public String getProtectedPassword()
public String getProtectionKeyDigestAlgorithm()
The default value is http://www.w3.org/2000/09/xmldsig#sha1, if no value specified.
public void setProtectionKeyDigestProvider(ProtectionKeyDigestProvider provider)
provider
- - an instance of a protection key digest algorithm providerpublic ProtectionKeyDigestProvider getProtectionKeyDigestProvier()
public ProtectionKeyDigestProvider getDefaultProtectionKeyDigestProvider()
public Paragraph addParagraph(String textContent)
ParagraphContainer
addParagraph
in interface ParagraphContainer
textContent
- - the text contentpublic OdfElement getParagraphContainerElement()
ParagraphContainer
getParagraphContainerElement
in interface ParagraphContainer
public boolean removeParagraph(Paragraph para)
ParagraphContainer
removeParagraph
in interface ParagraphContainer
para
- - the instance of paragraphpublic Paragraph getParagraphByIndex(int index, boolean isEmptyParagraphSkipped)
ParagraphContainer
An index of zero represents the first paragraph.
If empty paragraph is skipped, the empty paragraph won't be counted.
getParagraphByIndex
in interface ParagraphContainer
index
- - the index started from 0.isEmptyParagraphSkipped
- - whether the empty paragraph is skipped or notpublic Paragraph getParagraphByReverseIndex(int reverseIndex, boolean isEmptyParagraphSkipped)
ParagraphContainer
An index of zero represents the last paragraph.
If empty paragraph is skipped, the empty paragraph won't be counted.
getParagraphByReverseIndex
in interface ParagraphContainer
reverseIndex
- - the index started from 0 in reverse order.isEmptyParagraphSkipped
- - whether the empty paragraph is skipped or notpublic Iterator<Paragraph> getParagraphIterator()
ParagraphContainer
getParagraphIterator
in interface ParagraphContainer
protected TableContainer getTableContainerImpl()
public Table addTable()
TableContainer
addTable
in interface TableContainer
public Table addTable(int numRows, int numCols)
TableContainer
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.
addTable
in interface TableContainer
numRows
- the row numbernumCols
- the column numberTable
public Table.TableBuilder getTableBuilder()
TableContainer
getTableBuilder
in interface TableContainer
public Table getTableByName(String name)
TableContainer
getTableByName
in interface TableContainer
name
- of the table being searched for.public OdfElement getTableContainerElement()
TableContainer
getTableContainerElement
in interface TableContainer
public List<Table> getTableList()
TableContainer
getTableList
in interface TableContainer
public List addList()
ListContainer
addList
in interface ListContainer
public List addList(ListDecorator decorator)
ListContainer
addList
in interface ListContainer
decorator
- the specified ListDecoratorpublic void clearList()
ListContainer
clearList
in interface ListContainer
public OdfElement getListContainerElement()
ListContainer
getListContainerElement
in interface ListContainer
public Iterator<List> getListIterator()
ListContainer
getListIterator
in interface ListContainer
Iterator
public boolean removeList(List list)
ListContainer
removeList
in interface ListContainer
Copyright © 2010-2014 The Apache Software Foundation. All Rights Reserved.