blob: 514f0037cf0c300702a76fdbd06dba64f4e14e6a [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_45) on Tue Mar 28 22:15:32 CEST 2017 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
TextSelection (Simple ODF v0.8.2-incubating - http://odftoolkit)
</TITLE>
<META NAME="date" CONTENT="2017-03-28">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="TextSelection (Simple ODF v0.8.2-incubating - http://odftoolkit)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/TextSelection.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextNavigation.html" title="class in org.odftoolkit.simple.common.navigation"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextStyleNavigation.html" title="class in org.odftoolkit.simple.common.navigation"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?org/odftoolkit/simple/common/navigation/TextSelection.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="TextSelection.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#fields_inherited_from_class_org.odftoolkit.simple.common.navigation.Selection">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.odftoolkit.simple.common.navigation</FONT>
<BR>
Class TextSelection</H2>
<PRE>
<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A>
<IMG SRC="../../../../../resources/inherit.gif" ALT="extended by "><A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html" title="class in org.odftoolkit.simple.common.navigation">org.odftoolkit.simple.common.navigation.Selection</A>
<IMG SRC="../../../../../resources/inherit.gif" ALT="extended by "><B>org.odftoolkit.simple.common.navigation.TextSelection</B>
</PRE>
<DL>
<DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../../../org/odftoolkit/simple/common/navigation/CellSelection.html" title="class in org.odftoolkit.simple.common.navigation">CellSelection</A></DD>
</DL>
<HR>
<DL>
<DT><PRE>public class <B>TextSelection</B><DT>extends <A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html" title="class in org.odftoolkit.simple.common.navigation">Selection</A></DL>
</PRE>
<P>
<code>TextSelection</code> describes a sub element in a paragraph element or
a heading element. It is recognized by the container element, which type
should be <A HREF="http://incubator.apache.org/odftoolkit/odfdom/index.html/apidocs/org/odftoolkit/odfdom/incubator/doc/text/OdfTextParagraph.html?is-external=true" title="class or interface in org.odftoolkit.odfdom.incubator.doc.text"><CODE>OdfTextParagraph</CODE></A> or
<A HREF="http://incubator.apache.org/odftoolkit/odfdom/index.html/apidocs/org/odftoolkit/odfdom/incubator/doc/text/OdfTextHeading.html?is-external=true" title="class or interface in org.odftoolkit.odfdom.incubator.doc.text"><CODE>OdfTextHeading</CODE></A>, the start index of text content in container element and the
text content of this <code>Selection</code>.
<P>
<P>
<HR>
<P>
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
</TABLE>
&nbsp;<A NAME="fields_inherited_from_class_org.odftoolkit.simple.common.navigation.Selection"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Fields inherited from class org.odftoolkit.simple.common.navigation.<A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html" title="class in org.odftoolkit.simple.common.navigation">Selection</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html#search">search</A></CODE></TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextSelection.html#addComment(java.lang.String, java.lang.String)">addComment</A></B>(<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;content,
<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;creator)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Add a comment to the selection.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextSelection.html#addHref(java.net.URL)">addHref</A></B>(<A HREF="http://download.oracle.com/javase/6/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</A>&nbsp;url)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Add a hypertext reference to the selection.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextSelection.html#applyStyle(org.odftoolkit.odfdom.dom.element.OdfStyleBase)">applyStyle</A></B>(<A HREF="http://incubator.apache.org/odftoolkit/odfdom/index.html/apidocs/org/odftoolkit/odfdom/dom/element/OdfStyleBase.html?is-external=true" title="class or interface in org.odftoolkit.odfdom.dom.element">OdfStyleBase</A>&nbsp;style)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Apply a style to the selection so that the text style of this selection
will append the specified style.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://incubator.apache.org/odftoolkit/odfdom/index.html/apidocs/org/odftoolkit/odfdom/dom/element/text/TextSpanElement.html?is-external=true" title="class or interface in org.odftoolkit.odfdom.dom.element.text">TextSpanElement</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextSelection.html#createSpanElement()">createSpanElement</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a span element for this text selection.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextSelection.html#cut()">cut</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://incubator.apache.org/odftoolkit/odfdom/index.html/apidocs/org/odftoolkit/odfdom/pkg/OdfElement.html?is-external=true" title="class or interface in org.odftoolkit.odfdom.pkg">OdfElement</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextSelection.html#getContainerElement()">getContainerElement</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the paragraph element or heading element that contains this text.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://incubator.apache.org/odftoolkit/odfdom/index.html/apidocs/org/odftoolkit/odfdom/pkg/OdfElement.html?is-external=true" title="class or interface in org.odftoolkit.odfdom.pkg">OdfElement</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextSelection.html#getElement()">getElement</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the paragraph element or heading element that contains this
<code>TextSelection</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextSelection.html#getIndex()">getIndex</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the start index of the text content of its container element.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextSelection.html#getText()">getText</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the text content of this <code>TextSelection</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextNavigation.html" title="class in org.odftoolkit.simple.common.navigation">TextNavigation</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextSelection.html#getTextNavigation()">getTextNavigation</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextSelection.html#isSelectionReplaced()">isSelectionReplaced</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextSelection.html" title="class in org.odftoolkit.simple.common.navigation">TextSelection</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextSelection.html#newTextSelection(org.odftoolkit.simple.common.navigation.Navigation, java.lang.String, org.odftoolkit.odfdom.pkg.OdfElement, int)">newTextSelection</A></B>(<A HREF="../../../../../org/odftoolkit/simple/common/navigation/Navigation.html" title="class in org.odftoolkit.simple.common.navigation">Navigation</A>&nbsp;search,
<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;text,
<A HREF="http://incubator.apache.org/odftoolkit/odfdom/index.html/apidocs/org/odftoolkit/odfdom/pkg/OdfElement.html?is-external=true" title="class or interface in org.odftoolkit.odfdom.pkg">OdfElement</A>&nbsp;containerElement,
int&nbsp;index)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a new <code>TextSelection</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextSelection.html#pasteAtEndOf(org.odftoolkit.simple.common.navigation.Selection)">pasteAtEndOf</A></B>(<A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html" title="class in org.odftoolkit.simple.common.navigation">Selection</A>&nbsp;positionItem)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Paste this selection just after a specific selection.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextSelection.html#pasteAtFrontOf(org.odftoolkit.simple.common.navigation.Selection)">pasteAtFrontOf</A></B>(<A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html" title="class in org.odftoolkit.simple.common.navigation">Selection</A>&nbsp;positionItem)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Paste this selection just before a specific selection.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextSelection.html#refresh(int)">refresh</A></B>(int&nbsp;offset)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A quick method to update the index of this <code>Selection</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextSelection.html#refreshAfterFrontalDelete(org.odftoolkit.simple.common.navigation.Selection)">refreshAfterFrontalDelete</A></B>(<A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html" title="class in org.odftoolkit.simple.common.navigation">Selection</A>&nbsp;deleteItem)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;When a selected item has been deleted, the <code>Selection</code>s after
this deleted <code>Selection</code> should be refreshed, as these
<code>Selection</code>s index have been changed.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextSelection.html#refreshAfterFrontalInsert(org.odftoolkit.simple.common.navigation.Selection)">refreshAfterFrontalInsert</A></B>(<A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html" title="class in org.odftoolkit.simple.common.navigation">Selection</A>&nbsp;pasteItem)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;When a selected item has been inserted, the <code>Selection</code> after
the inserted item should be refresh, as these <code>Selection</code>s
index have been changed.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../../org/odftoolkit/simple/common/field/Field.html" title="class in org.odftoolkit.simple.common.field">Field</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextSelection.html#replaceWith(org.odftoolkit.simple.common.field.Field)">replaceWith</A></B>(<A HREF="../../../../../org/odftoolkit/simple/common/field/Field.html" title="class in org.odftoolkit.simple.common.field">Field</A>&nbsp;orgField)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Replace the content with a Field</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../../org/odftoolkit/simple/draw/Image.html" title="class in org.odftoolkit.simple.draw">Image</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextSelection.html#replaceWith(org.odftoolkit.simple.draw.Image)">replaceWith</A></B>(<A HREF="../../../../../org/odftoolkit/simple/draw/Image.html" title="class in org.odftoolkit.simple.draw">Image</A>&nbsp;newImage)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Replace the text content of selection with a new Image.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../../org/odftoolkit/simple/text/Paragraph.html" title="class in org.odftoolkit.simple.text">Paragraph</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextSelection.html#replaceWith(org.odftoolkit.simple.text.Paragraph)">replaceWith</A></B>(<A HREF="../../../../../org/odftoolkit/simple/text/Paragraph.html" title="class in org.odftoolkit.simple.text">Paragraph</A>&nbsp;newParagraph)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Replace the content with a paragraph, the paragraph can be in the same TextDocument or in a different Document.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextSelection.html#replaceWith(java.lang.String)">replaceWith</A></B>(<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;newText)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Replace the text content of selection with a new string.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../../org/odftoolkit/simple/table/Table.html" title="class in org.odftoolkit.simple.table">Table</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextSelection.html#replaceWith(org.odftoolkit.simple.table.Table)">replaceWith</A></B>(<A HREF="../../../../../org/odftoolkit/simple/table/Table.html" title="class in org.odftoolkit.simple.table">Table</A>&nbsp;newTable)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Replace the text content of selection with a new Table.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextSelection.html#replaceWith(org.odftoolkit.simple.TextDocument)">replaceWith</A></B>(<A HREF="../../../../../org/odftoolkit/simple/TextDocument.html" title="class in org.odftoolkit.simple">TextDocument</A>&nbsp;newTextDocument)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Replace the content with a TextDocument with Styles.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../../org/odftoolkit/simple/draw/Image.html" title="class in org.odftoolkit.simple.draw">Image</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextSelection.html#replaceWith(java.net.URI)">replaceWith</A></B>(<A HREF="http://download.oracle.com/javase/6/docs/api/java/net/URI.html?is-external=true" title="class or interface in java.net">URI</A>&nbsp;imageUri)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Replace the text content of selection with a new Image.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextSelection.html#setSelectionReplaced(boolean)">setSelectionReplaced</A></B>(boolean&nbsp;b)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextSelection.html#toString()">toString</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_org.odftoolkit.simple.common.navigation.Selection"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class org.odftoolkit.simple.common.navigation.<A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html" title="class in org.odftoolkit.simple.common.navigation">Selection</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html#getNavigation()">getNavigation</A></CODE></TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="getTextNavigation()"><!-- --></A><H3>
getTextNavigation</H3>
<PRE>
public <A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextNavigation.html" title="class in org.odftoolkit.simple.common.navigation">TextNavigation</A> <B>getTextNavigation</B>()</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="newTextSelection(org.odftoolkit.simple.common.navigation.Navigation, java.lang.String, org.odftoolkit.odfdom.pkg.OdfElement, int)"><!-- --></A><H3>
newTextSelection</H3>
<PRE>
public static <A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextSelection.html" title="class in org.odftoolkit.simple.common.navigation">TextSelection</A> <B>newTextSelection</B>(<A HREF="../../../../../org/odftoolkit/simple/common/navigation/Navigation.html" title="class in org.odftoolkit.simple.common.navigation">Navigation</A>&nbsp;search,
<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;text,
<A HREF="http://incubator.apache.org/odftoolkit/odfdom/index.html/apidocs/org/odftoolkit/odfdom/pkg/OdfElement.html?is-external=true" title="class or interface in org.odftoolkit.odfdom.pkg">OdfElement</A>&nbsp;containerElement,
int&nbsp;index)</PRE>
<DL>
<DD>Create a new <code>TextSelection</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>text</CODE> - the text content of this <code>TextSelection</code><DD><CODE>containerElement</CODE> - the paragraph element or heading element that contains this
<code>TextSelection</code><DD><CODE>index</CODE> - the start index of the text content in container element<DT><B>Since:</B></DT>
<DD>0.5.5</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="getElement()"><!-- --></A><H3>
getElement</H3>
<PRE>
public <A HREF="http://incubator.apache.org/odftoolkit/odfdom/index.html/apidocs/org/odftoolkit/odfdom/pkg/OdfElement.html?is-external=true" title="class or interface in org.odftoolkit.odfdom.pkg">OdfElement</A> <B>getElement</B>()</PRE>
<DL>
<DD>Get the paragraph element or heading element that contains this
<code>TextSelection</code>.
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html#getElement()">getElement</A></CODE> in class <CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html" title="class in org.odftoolkit.simple.common.navigation">Selection</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>OdfElement the container element</DL>
</DD>
</DL>
<HR>
<A NAME="getContainerElement()"><!-- --></A><H3>
getContainerElement</H3>
<PRE>
public <A HREF="http://incubator.apache.org/odftoolkit/odfdom/index.html/apidocs/org/odftoolkit/odfdom/pkg/OdfElement.html?is-external=true" title="class or interface in org.odftoolkit.odfdom.pkg">OdfElement</A> <B>getContainerElement</B>()</PRE>
<DL>
<DD>Get the paragraph element or heading element that contains this text.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>OdfElement</DL>
</DD>
</DL>
<HR>
<A NAME="getIndex()"><!-- --></A><H3>
getIndex</H3>
<PRE>
public int <B>getIndex</B>()</PRE>
<DL>
<DD>Get the start index of the text content of its container element.
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html#getIndex()">getIndex</A></CODE> in class <CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html" title="class in org.odftoolkit.simple.common.navigation">Selection</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>index the start index of the text content of its container
element</DL>
</DD>
</DL>
<HR>
<A NAME="getText()"><!-- --></A><H3>
getText</H3>
<PRE>
public <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>getText</B>()</PRE>
<DL>
<DD>Get the text content of this <code>TextSelection</code>.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>text the text content</DL>
</DD>
</DL>
<HR>
<A NAME="cut()"><!-- --></A><H3>
cut</H3>
<PRE>
public void <B>cut</B>()
throws <A HREF="../../../../../org/odftoolkit/simple/common/navigation/InvalidNavigationException.html" title="class in org.odftoolkit.simple.common.navigation">InvalidNavigationException</A></PRE>
<DL>
<DD>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.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html#cut()">cut</A></CODE> in class <CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html" title="class in org.odftoolkit.simple.common.navigation">Selection</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/InvalidNavigationException.html" title="class in org.odftoolkit.simple.common.navigation">InvalidNavigationException</A></CODE> - if the selection is unavailable.</DL>
</DD>
</DL>
<HR>
<A NAME="applyStyle(org.odftoolkit.odfdom.dom.element.OdfStyleBase)"><!-- --></A><H3>
applyStyle</H3>
<PRE>
public void <B>applyStyle</B>(<A HREF="http://incubator.apache.org/odftoolkit/odfdom/index.html/apidocs/org/odftoolkit/odfdom/dom/element/OdfStyleBase.html?is-external=true" title="class or interface in org.odftoolkit.odfdom.dom.element">OdfStyleBase</A>&nbsp;style)
throws <A HREF="../../../../../org/odftoolkit/simple/common/navigation/InvalidNavigationException.html" title="class in org.odftoolkit.simple.common.navigation">InvalidNavigationException</A></PRE>
<DL>
<DD>Apply a style to the selection so that the text style of this selection
will append the specified style.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>style</CODE> - the style can be from the current document or user defined
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/InvalidNavigationException.html" title="class in org.odftoolkit.simple.common.navigation">InvalidNavigationException</A></CODE> - if the selection is unavailable.</DL>
</DD>
</DL>
<HR>
<A NAME="replaceWith(java.lang.String)"><!-- --></A><H3>
replaceWith</H3>
<PRE>
public void <B>replaceWith</B>(<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;newText)
throws <A HREF="../../../../../org/odftoolkit/simple/common/navigation/InvalidNavigationException.html" title="class in org.odftoolkit.simple.common.navigation">InvalidNavigationException</A></PRE>
<DL>
<DD>Replace the text content of selection with a new string.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>newText</CODE> - the replace text String
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/InvalidNavigationException.html" title="class in org.odftoolkit.simple.common.navigation">InvalidNavigationException</A></CODE> - if the selection is unavailable.</DL>
</DD>
</DL>
<HR>
<A NAME="replaceWith(org.odftoolkit.simple.table.Table)"><!-- --></A><H3>
replaceWith</H3>
<PRE>
public <A HREF="../../../../../org/odftoolkit/simple/table/Table.html" title="class in org.odftoolkit.simple.table">Table</A> <B>replaceWith</B>(<A HREF="../../../../../org/odftoolkit/simple/table/Table.html" title="class in org.odftoolkit.simple.table">Table</A>&nbsp;newTable)
throws <A HREF="../../../../../org/odftoolkit/simple/common/navigation/InvalidNavigationException.html" title="class in org.odftoolkit.simple.common.navigation">InvalidNavigationException</A></PRE>
<DL>
<DD>Replace the text content of selection with a new Table.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>newTable</CODE> - the replace Table
<DT><B>Returns:</B><DD>
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/InvalidNavigationException.html" title="class in org.odftoolkit.simple.common.navigation">InvalidNavigationException</A></CODE> - if the selection is unavailable.</DL>
</DD>
</DL>
<HR>
<A NAME="replaceWith(org.odftoolkit.simple.draw.Image)"><!-- --></A><H3>
replaceWith</H3>
<PRE>
public <A HREF="../../../../../org/odftoolkit/simple/draw/Image.html" title="class in org.odftoolkit.simple.draw">Image</A> <B>replaceWith</B>(<A HREF="../../../../../org/odftoolkit/simple/draw/Image.html" title="class in org.odftoolkit.simple.draw">Image</A>&nbsp;newImage)
throws <A HREF="../../../../../org/odftoolkit/simple/common/navigation/InvalidNavigationException.html" title="class in org.odftoolkit.simple.common.navigation">InvalidNavigationException</A></PRE>
<DL>
<DD>Replace the text content of selection with a new Image.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>newImage</CODE> - the replace Image
<DT><B>Returns:</B><DD>
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/InvalidNavigationException.html" title="class in org.odftoolkit.simple.common.navigation">InvalidNavigationException</A></CODE> - if the selection is unavailable.</DL>
</DD>
</DL>
<HR>
<A NAME="replaceWith(java.net.URI)"><!-- --></A><H3>
replaceWith</H3>
<PRE>
public <A HREF="../../../../../org/odftoolkit/simple/draw/Image.html" title="class in org.odftoolkit.simple.draw">Image</A> <B>replaceWith</B>(<A HREF="http://download.oracle.com/javase/6/docs/api/java/net/URI.html?is-external=true" title="class or interface in java.net">URI</A>&nbsp;imageUri)
throws <A HREF="../../../../../org/odftoolkit/simple/common/navigation/InvalidNavigationException.html" title="class in org.odftoolkit.simple.common.navigation">InvalidNavigationException</A></PRE>
<DL>
<DD>Replace the text content of selection with a new Image.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>imageUri</CODE> - the replace Image URI
<DT><B>Returns:</B><DD>the new Image in the TextDocument,the image name is set to "replace" + System.currentTimeMillis(), please update the name to others by yourself.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/InvalidNavigationException.html" title="class in org.odftoolkit.simple.common.navigation">InvalidNavigationException</A></CODE> - if the selection is unavailable.</DL>
</DD>
</DL>
<HR>
<A NAME="replaceWith(org.odftoolkit.simple.common.field.Field)"><!-- --></A><H3>
replaceWith</H3>
<PRE>
public <A HREF="../../../../../org/odftoolkit/simple/common/field/Field.html" title="class in org.odftoolkit.simple.common.field">Field</A> <B>replaceWith</B>(<A HREF="../../../../../org/odftoolkit/simple/common/field/Field.html" title="class in org.odftoolkit.simple.common.field">Field</A>&nbsp;orgField)
throws <A HREF="../../../../../org/odftoolkit/simple/common/navigation/InvalidNavigationException.html" title="class in org.odftoolkit.simple.common.navigation">InvalidNavigationException</A></PRE>
<DL>
<DD>Replace the content with a Field
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>orgField</CODE> - the reference Field to replace.
<DT><B>Returns:</B><DD>the created field.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/InvalidNavigationException.html" title="class in org.odftoolkit.simple.common.navigation">InvalidNavigationException</A></CODE> - if the selection is unavailable.</DL>
</DD>
</DL>
<HR>
<A NAME="replaceWith(org.odftoolkit.simple.text.Paragraph)"><!-- --></A><H3>
replaceWith</H3>
<PRE>
public <A HREF="../../../../../org/odftoolkit/simple/text/Paragraph.html" title="class in org.odftoolkit.simple.text">Paragraph</A> <B>replaceWith</B>(<A HREF="../../../../../org/odftoolkit/simple/text/Paragraph.html" title="class in org.odftoolkit.simple.text">Paragraph</A>&nbsp;newParagraph)
throws <A HREF="../../../../../org/odftoolkit/simple/common/navigation/InvalidNavigationException.html" title="class in org.odftoolkit.simple.common.navigation">InvalidNavigationException</A></PRE>
<DL>
<DD>Replace the content with a paragraph, the paragraph can be in the same TextDocument or in a different Document.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>newParagraph</CODE> - the reference paragraph to replace.
<DT><B>Returns:</B><DD>the replaced Paragraph.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/InvalidNavigationException.html" title="class in org.odftoolkit.simple.common.navigation">InvalidNavigationException</A></CODE> - if the selection is unavailable.</DL>
</DD>
</DL>
<HR>
<A NAME="replaceWith(org.odftoolkit.simple.TextDocument)"><!-- --></A><H3>
replaceWith</H3>
<PRE>
public void <B>replaceWith</B>(<A HREF="../../../../../org/odftoolkit/simple/TextDocument.html" title="class in org.odftoolkit.simple">TextDocument</A>&nbsp;newTextDocument)
throws <A HREF="../../../../../org/odftoolkit/simple/common/navigation/InvalidNavigationException.html" title="class in org.odftoolkit.simple.common.navigation">InvalidNavigationException</A></PRE>
<DL>
<DD>Replace the content with a TextDocument with Styles.
Note: You need cache the TextNavigation.nextSelection item because after
you replace currtenTextSelection with TextDocument, TextNavigation.nextSelection will search from the inserted Content,
it will make you into a loop if the Search keyword also can be found in the new inserted Content.
</p>
The right way to use this replaceWithTextDocument(TextDocument textDocument) method should like this:
<Code>
<p> search = new TextNavigation("SIMPLE", doc); </p>
<p> TextSelection currtenTextSelection,nextTextSelection=null;</p>
<p> while (search.hasNext()) {</p>
<p> if(nextTextSelection!=null){</p>
<p> currtenTextSelection=nextTextSelection;</p>
<p> }else {</p>
<p> currtenTextSelection = (TextSelection) search.nextSelection();</p>
<p> }</p>
<p> nextTextSelection = (TextSelection) search.nextSelection();</p>
<p> if(currtenTextSelection!=null){</p>
<p> try {</p>
<p> nextTextSelection.replaceWithTextDocument(sourcedoc);</p>
<p> } catch (Exception e) {</p>
<p> e.printStackTrace();</p>
<p> }</p>
<p> }</p>
<p> }</p>
<p> if(nextTextSelection!=null){</p>
<p> try {</p>
<p> nextTextSelection.replaceWithTextDocument(sourcedoc);</p>
<p> } catch (Exception e) {</p>
<p> e.printStackTrace();</p>
<p> }</p>
<p> }</p>
</Code>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>newTextDocument</CODE> - the reference TextDocument to replace.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/InvalidNavigationException.html" title="class in org.odftoolkit.simple.common.navigation">InvalidNavigationException</A></CODE></DL>
</DD>
</DL>
<HR>
<A NAME="createSpanElement()"><!-- --></A><H3>
createSpanElement</H3>
<PRE>
public <A HREF="http://incubator.apache.org/odftoolkit/odfdom/index.html/apidocs/org/odftoolkit/odfdom/dom/element/text/TextSpanElement.html?is-external=true" title="class or interface in org.odftoolkit.odfdom.dom.element.text">TextSpanElement</A> <B>createSpanElement</B>()
throws <A HREF="../../../../../org/odftoolkit/simple/common/navigation/InvalidNavigationException.html" title="class in org.odftoolkit.simple.common.navigation">InvalidNavigationException</A></PRE>
<DL>
<DD>Create a span element for this text selection.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the created text span element for this selection
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/InvalidNavigationException.html" title="class in org.odftoolkit.simple.common.navigation">InvalidNavigationException</A></CODE> - if the selection is unavailable.<DT><B>Since:</B></DT>
<DD>0.5.5</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="pasteAtFrontOf(org.odftoolkit.simple.common.navigation.Selection)"><!-- --></A><H3>
pasteAtFrontOf</H3>
<PRE>
public void <B>pasteAtFrontOf</B>(<A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html" title="class in org.odftoolkit.simple.common.navigation">Selection</A>&nbsp;positionItem)
throws <A HREF="../../../../../org/odftoolkit/simple/common/navigation/InvalidNavigationException.html" title="class in org.odftoolkit.simple.common.navigation">InvalidNavigationException</A></PRE>
<DL>
<DD>Paste this selection just before a specific selection.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html#pasteAtFrontOf(org.odftoolkit.simple.common.navigation.Selection)">pasteAtFrontOf</A></CODE> in class <CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html" title="class in org.odftoolkit.simple.common.navigation">Selection</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>positionItem</CODE> - a selection that is used to point out the position
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/InvalidNavigationException.html" title="class in org.odftoolkit.simple.common.navigation">InvalidNavigationException</A></CODE> - if the selection is unavailable.</DL>
</DD>
</DL>
<HR>
<A NAME="pasteAtEndOf(org.odftoolkit.simple.common.navigation.Selection)"><!-- --></A><H3>
pasteAtEndOf</H3>
<PRE>
public void <B>pasteAtEndOf</B>(<A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html" title="class in org.odftoolkit.simple.common.navigation">Selection</A>&nbsp;positionItem)
throws <A HREF="../../../../../org/odftoolkit/simple/common/navigation/InvalidNavigationException.html" title="class in org.odftoolkit.simple.common.navigation">InvalidNavigationException</A></PRE>
<DL>
<DD>Paste this selection just after a specific selection.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html#pasteAtEndOf(org.odftoolkit.simple.common.navigation.Selection)">pasteAtEndOf</A></CODE> in class <CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html" title="class in org.odftoolkit.simple.common.navigation">Selection</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>positionItem</CODE> - a selection that is used to point out the position
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/InvalidNavigationException.html" title="class in org.odftoolkit.simple.common.navigation">InvalidNavigationException</A></CODE> - if the selection is unavailable.</DL>
</DD>
</DL>
<HR>
<A NAME="setSelectionReplaced(boolean)"><!-- --></A><H3>
setSelectionReplaced</H3>
<PRE>
public void <B>setSelectionReplaced</B>(boolean&nbsp;b)</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="isSelectionReplaced()"><!-- --></A><H3>
isSelectionReplaced</H3>
<PRE>
public boolean <B>isSelectionReplaced</B>()</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="addHref(java.net.URL)"><!-- --></A><H3>
addHref</H3>
<PRE>
public void <B>addHref</B>(<A HREF="http://download.oracle.com/javase/6/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</A>&nbsp;url)
throws <A HREF="../../../../../org/odftoolkit/simple/common/navigation/InvalidNavigationException.html" title="class in org.odftoolkit.simple.common.navigation">InvalidNavigationException</A></PRE>
<DL>
<DD>Add a hypertext reference to the selection.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>url</CODE> - the URL of this hypertext reference
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/InvalidNavigationException.html" title="class in org.odftoolkit.simple.common.navigation">InvalidNavigationException</A></CODE> - if the selection is unavailable.</DL>
</DD>
</DL>
<HR>
<A NAME="addComment(java.lang.String, java.lang.String)"><!-- --></A><H3>
addComment</H3>
<PRE>
public void <B>addComment</B>(<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;content,
<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;creator)
throws <A HREF="../../../../../org/odftoolkit/simple/common/navigation/InvalidNavigationException.html" title="class in org.odftoolkit.simple.common.navigation">InvalidNavigationException</A></PRE>
<DL>
<DD>Add a comment to the selection.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>content</CODE> - the content of this comment.<DD><CODE>creator</CODE> - the creator of this comment, if <code>creator</code> is null,
the value of <code>System.getProperty("user.name")</code> will
be used.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/InvalidNavigationException.html" title="class in org.odftoolkit.simple.common.navigation">InvalidNavigationException</A></CODE> - if the selection is unavailable.<DT><B>Since:</B></DT>
<DD>0.6.5</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="toString()"><!-- --></A><H3>
toString</H3>
<PRE>
public <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>toString</B>()</PRE>
<DL>
<DD>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.
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A></CODE> in class <CODE><A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>a String representation of the value of this
<code>TextSelection</code></DL>
</DD>
</DL>
<HR>
<A NAME="refreshAfterFrontalDelete(org.odftoolkit.simple.common.navigation.Selection)"><!-- --></A><H3>
refreshAfterFrontalDelete</H3>
<PRE>
protected void <B>refreshAfterFrontalDelete</B>(<A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html" title="class in org.odftoolkit.simple.common.navigation">Selection</A>&nbsp;deleteItem)</PRE>
<DL>
<DD><B>Description copied from class: <CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html#refreshAfterFrontalDelete(org.odftoolkit.simple.common.navigation.Selection)">Selection</A></CODE></B></DD>
<DD>When a selected item has been deleted, the <code>Selection</code>s after
this deleted <code>Selection</code> should be refreshed, as these
<code>Selection</code>s index have been changed.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html#refreshAfterFrontalDelete(org.odftoolkit.simple.common.navigation.Selection)">refreshAfterFrontalDelete</A></CODE> in class <CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html" title="class in org.odftoolkit.simple.common.navigation">Selection</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>deleteItem</CODE> - the deleted <code>Selection</code></DL>
</DD>
</DL>
<HR>
<A NAME="refreshAfterFrontalInsert(org.odftoolkit.simple.common.navigation.Selection)"><!-- --></A><H3>
refreshAfterFrontalInsert</H3>
<PRE>
protected void <B>refreshAfterFrontalInsert</B>(<A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html" title="class in org.odftoolkit.simple.common.navigation">Selection</A>&nbsp;pasteItem)</PRE>
<DL>
<DD><B>Description copied from class: <CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html#refreshAfterFrontalInsert(org.odftoolkit.simple.common.navigation.Selection)">Selection</A></CODE></B></DD>
<DD>When a selected item has been inserted, the <code>Selection</code> after
the inserted item should be refresh, as these <code>Selection</code>s
index have been changed.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html#refreshAfterFrontalInsert(org.odftoolkit.simple.common.navigation.Selection)">refreshAfterFrontalInsert</A></CODE> in class <CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html" title="class in org.odftoolkit.simple.common.navigation">Selection</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>pasteItem</CODE> - the inserted <code>Selection</code></DL>
</DD>
</DL>
<HR>
<A NAME="refresh(int)"><!-- --></A><H3>
refresh</H3>
<PRE>
protected void <B>refresh</B>(int&nbsp;offset)</PRE>
<DL>
<DD><B>Description copied from class: <CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html#refresh(int)">Selection</A></CODE></B></DD>
<DD>A quick method to update the index of this <code>Selection</code>.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html#refresh(int)">refresh</A></CODE> in class <CODE><A HREF="../../../../../org/odftoolkit/simple/common/navigation/Selection.html" title="class in org.odftoolkit.simple.common.navigation">Selection</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>offset</CODE> - the offset that the index should be added.</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/TextSelection.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextNavigation.html" title="class in org.odftoolkit.simple.common.navigation"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../../org/odftoolkit/simple/common/navigation/TextStyleNavigation.html" title="class in org.odftoolkit.simple.common.navigation"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?org/odftoolkit/simple/common/navigation/TextSelection.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="TextSelection.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#fields_inherited_from_class_org.odftoolkit.simple.common.navigation.Selection">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright &#169; 2010-2017 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.
</BODY>
</HTML>