org.odftoolkit.odfdom.incubator.search
Class TextSelection

java.lang.Object
  extended by org.odftoolkit.odfdom.incubator.search.Selection
      extended by org.odftoolkit.odfdom.incubator.search.TextSelection

Deprecated. As of release 0.8.8, replaced by org.odftoolkit.simple.common.navigation.TextSelection in Simple API.

public class TextSelection
extends Selection

A TextSelection can describe a sub element in a mParagraph element or a mHeading element. it is recognized by the container element(which type should be OdfTextParagraph or OdfTextHeadingt), the start index of the text content of the container element and the text content of this selection.


Method Summary
 void addHref(URL url)
          Deprecated. Add a hypertext reference to the selection
 void applyStyle(OdfStyleBase style)
          Deprecated. Apply a style to the selection so that the text style of this selection will append the specified style
 void cut()
          Deprecated. Delete the selection from the document the other matched selection in the same container element will be updated automatically because the start index of the following selections will be changed when the previous selection has been deleted
 OdfElement getContainerElement()
          Deprecated. Get the mParagraph element or mHeading element that contain this text
 OdfElement getElement()
          Deprecated. Get the mParagraph element or mHeading element that contain this TextSelection
 int getIndex()
          Deprecated. Get the start index of the text content of its container element
 String getText()
          Deprecated. Get the text content of this TextSelection
 void pasteAtEndOf(Selection positionItem)
          Deprecated. Paste this selection just after a specific selection.
 void pasteAtFrontOf(Selection positionItem)
          Deprecated. Paste this selection just before a specific selection.
protected  void refresh(int offset)
          Deprecated. A quick method to update the mIndex of this selection
protected  void refreshAfterFrontalDelete(Selection deleteItem)
          Deprecated. when a selected item has been delete, the selections after this deleted selection should be refresh because these selections mIndex will be changed
protected  void refreshAfterFrontalInsert(Selection pasteItem)
          Deprecated. when a selected item has been inserted, the selection after the inserted item should be refresh because these selections mIndex will be changed
 void replaceWith(String newText)
          Deprecated. Replace the text content of selection with a new string
 String toString()
          Deprecated. return a String Object representing this selection value the text content of the selection, start index in the container element and the text content of the container element will be provided
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getElement

public OdfElement getElement()
Deprecated. 
Get the mParagraph element or mHeading element that contain this TextSelection

Overrides:
getElement in class Selection
Returns:
OdfElement the container element

getContainerElement

public OdfElement getContainerElement()
Deprecated. 
Get the mParagraph element or mHeading element that contain this text

Returns:
OdfElement

getIndex

public int getIndex()
Deprecated. 
Get the start index of the text content of its container element

Overrides:
getIndex in class Selection
Returns:
index the start index of the text content of its container element

getText

public String getText()
Deprecated. 
Get the text content of this TextSelection

Returns:
text the text content

cut

public void cut()
         throws InvalidNavigationException
Deprecated. 
Delete the selection from the document the other matched selection in the same container element will be updated automatically because the start index of the following selections will be changed when the previous selection has been deleted

Specified by:
cut in class Selection
Throws:
InvalidNavigationException - if the selection is unavailable.

applyStyle

public void applyStyle(OdfStyleBase style)
                throws InvalidNavigationException
Deprecated. 
Apply a style to the selection so that the text style of this selection will append the specified style

Parameters:
style - the style can be from the current document or user defined
Throws:
InvalidNavigationException - if the selection is unavailable.

replaceWith

public void replaceWith(String newText)
                 throws InvalidNavigationException
Deprecated. 
Replace the text content of selection with a new string

Parameters:
newText - the replace text String
Throws:
InvalidNavigationException - if the selection is unavailable.

pasteAtFrontOf

public void pasteAtFrontOf(Selection positionItem)
                    throws InvalidNavigationException
Deprecated. 
Paste this selection just before a specific selection.

Specified by:
pasteAtFrontOf in class Selection
Parameters:
positionItem - a selection that is used to point out the position
Throws:
InvalidNavigationException - if the selection is unavailable.

pasteAtEndOf

public void pasteAtEndOf(Selection positionItem)
                  throws InvalidNavigationException
Deprecated. 
Paste this selection just after a specific selection.

Specified by:
pasteAtEndOf in class Selection
Parameters:
positionItem - a selection that is used to point out the position
Throws:
InvalidNavigationException - if the selection is unavailable.

addHref

public void addHref(URL url)
             throws InvalidNavigationException
Deprecated. 
Add a hypertext reference to the selection

Parameters:
url - the url of the hypertext reference
Throws:
InvalidNavigationException - if the selection is unavailable.

refreshAfterFrontalDelete

protected void refreshAfterFrontalDelete(Selection deleteItem)
Deprecated. 
Description copied from class: Selection
when a selected item has been delete, the selections after this deleted selection should be refresh because these selections mIndex will be changed

Specified by:
refreshAfterFrontalDelete in class Selection
Parameters:
deleteItem - the deleted selection

refreshAfterFrontalInsert

protected void refreshAfterFrontalInsert(Selection pasteItem)
Deprecated. 
Description copied from class: Selection
when a selected item has been inserted, the selection after the inserted item should be refresh because these selections mIndex will be changed

Specified by:
refreshAfterFrontalInsert in class Selection
Parameters:
pasteItem - the inserted selection

refresh

protected void refresh(int offset)
Deprecated. 
Description copied from class: Selection
A quick method to update the mIndex of this selection

Specified by:
refresh in class Selection
Parameters:
offset - the offset that the mIndex should be added

toString

public String toString()
Deprecated. 
return a String Object representing this selection value the text content of the selection, start index in the container element and the text content of the container element will be provided

Overrides:
toString in class Object
Returns:
a String representation of the value of this TextSelection


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