DocumentPosition
Represents position in RadDocument.
Definition
Namespace:Telerik.WinForms.Documents
Assembly:Telerik.WinControls.RichTextEditor.dll
Syntax:
public class DocumentPosition : IComparable<DocumentPosition>, IDisposable
Inheritance: objectDocumentPosition
Implements:
Constructors
Initializes a new instance of the DocumentPosition class.
public DocumentPosition(DocumentLayoutBox documentBox, bool trackDocumentChangeEvents)
The DocumentLayoutBox of RadDocument in which the position will be used.
trackDocumentChangeEventsboolIndicates whether the position is anchored to the end of the word. If true, the position is kept between the same characters when there is a modification in the content before the position.
Initializes a new instance of the DocumentPosition class.
public DocumentPosition(DocumentLayoutBox documentBox)
The DocumentLayoutBox of RadDocument.
Initializes a new instance of the DocumentPosition class.
public DocumentPosition(DocumentPosition documentPosition, bool trackDocumentChangeEvents)
The document position to copy.
trackDocumentChangeEventsboolIndicates whether the position is anchored to the end of the word. If true, the position is kept between the same characters when there is a modification in the content before the position.
Initializes a new instance of the DocumentPosition class.
public DocumentPosition(DocumentPosition documentPosition)
The document position to copy.
Initializes a new instance of the DocumentPosition class.
public DocumentPosition(RadDocument document, bool trackDocumentChangeEvents)
An instance of RadDocument in which the position will be used.
trackDocumentChangeEventsboolIndicates whether the position is anchored to the end of the word. If true, the position is kept between the same characters when there is a modification in the content before the position.
Initializes a new instance of the DocumentPosition class.
public DocumentPosition(RadDocument document)
An instance of RadDocument in which the position will be used.
Properties
Determines whether the DocumentPosition is at the end of the document.
public bool IsPositionAtDocumentEnd { get; }
Determines whether the DocumentPosition is at the start of the document.
public bool IsPositionAtDocumentStart { get; }
Determines whether the DocumentPosition is at the end of a Paragraph.
public bool IsPositionAtParagraphEnd { get; }
Determines whether the DocumentPosition is at the start of a Paragraph.
public bool IsPositionAtParagraphStart { get; }
Determines whether the DocumentPosition is at the end of a TableCell.
public bool IsPositionAtTableCellEnd { get; }
Determines whether the DocumentPosition is at the start of a TableCell.
public bool IsPositionAtTableCellStart { get; }
Determines whether the DocumentPosition is at the start of a TableRow.
public bool IsPositionAtTableRowStart { get; }
Gets a value indicating whether this position is inside table.
public bool IsPositionInsideTable { get; }
true if this position is inside table; otherwise, false.
Methods
Compares the current object with another object of the same type.
public int CompareTo(DocumentPosition other)
An object to compare with this object.
Returns:A value that indicates the relative order of the objects being compared. The return value has the following meanings: Value Meaning Less than zero This object is less than the other parameter.Zero This object is equal to other. Greater than zero This object is greater than other.
Implements:
Disposes this DocumentPosition.
public void Dispose()
Implements:
Gets the current InlineLayoutBox.
public InlineLayoutBox GetCurrentInlineBox()
The current InlineLayoutBox. If such cannot be found, the method returns null.
Gets the current ParagraphLayoutBox.
public ParagraphLayoutBox GetCurrentParagraphBox()
The current ParagraphLayoutBox. If such cannot be found, the method returns null.
Gets the current SectionLayoutBox.
public SectionLayoutBox GetCurrentSectionBox()
The current SectionLayoutBox. If such cannot be found, the method returns null.
Gets the current SpanLayoutBox.
public SpanLayoutBox GetCurrentSpanBox()
The current SpanLayoutBox. If such cannot be found, the method returns null.
Gets the current TableLayoutBox.
public TableLayoutBox GetCurrentTableBox()
The current TableLayoutBox. If such cannot be found, the method returns null.
Gets the current TableCellLayoutBox.
public TableCellLayoutBox GetCurrentTableCellBox()
The current TableCellLayoutBox. If such cannot be found, the method returns null.
Gets the current TableRowLayoutBox.
public TableRowLayoutBox GetCurrentTableRowBox()
The current TableRowLayoutBox. If such cannot be found, the method returns null.
Gets the current word.
Returns a hash code for this instance.
public override int GetHashCode()
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
Overrides:
Gets the index of the position in the current span.
Gets the index of the position in the current SpanLayoutBox.
public int GetIndexInCurrentSpanBox()
The index of the position in the current SpanLayoutBox.
Gets the next InlineLayoutBox.
public InlineLayoutBox GetNextInlineBox()
The next InlineLayoutBox. If such cannot be found, the method returns null.
Gets the next SpanLayoutBox.
public SpanLayoutBox GetNextSpanBox()
The next SpanLayoutBox. If such cannot be found, the method returns null.
Gets the previous InlineLayoutBox.
public InlineLayoutBox GetPreviousInlineBox()
The previous InlineLayoutBox. If such cannot be found, the method returns null.
Gets the previous SpanLayoutBox.
public SpanLayoutBox GetPreviousSpanBox()
The previous SpanLayoutBox. If such cannot be found, the method returns null.
Moves the position down.
public bool MoveDown()
True if the position is moved successfully. Otherwise, false.
Moves the position to the end of the current line.
public bool MoveToCurrentLineEnd()
True if the position is moved successfully. Otherwise, false.
Moves the position to the start of the current line.
public bool MoveToCurrentLineStart()
True if the position is moved successfully. Otherwise, false.
Moves the position to the end of the current word.
public void MoveToCurrentWordEnd()
Moves the position to the start of the current word.
public void MoveToCurrentWordStart()
Moves the position to the end of a document element.
public void MoveToDocumentElementEnd(DocumentElement element)
The document element.
Moves the position to the start of a document element.
public void MoveToDocumentElementStart(DocumentElement element)
The document element.
Moves the position to the last position in the document.
public void MoveToDocumentEnd()
Moves the position to the first position in the document.
public void MoveToDocumentStart()
Moves the position to InlineLayoutBox.
public void MoveToInline(InlineLayoutBox inlineLayoutBox, int index)
The InlineLayoutBox.
indexintThe index in the InlineLayoutBox.
Moves the position to the next possible position in the document.
public bool MoveToNext()
True if the position is moved successfully. Otherwise, false.
Moves the position to the next InlineLayoutBox.
public bool MoveToNextInlineBox()
True if the position is moved successfully. Otherwise, false.
Moves the position to the first position on the next page.
public void MoveToNextPageStart()
Moves the position to the first position in the next paragraph.
public void MoveToNextParagraphStart()
Moves the position to the next SpanLayoutBox.
public bool MoveToNextSpanBox()
True if the position is moved successfully. Otherwise, false.
Moves the position to the start of the next word.
public bool MoveToNextWordStart()
True if the position is moved successfully. Otherwise, false.
Moves the position to the start of a page.
public void MoveToPage(int pageNumber)
The number of the page the position should be moved to.
Moves the position to the last position in the current paragraph.
public void MoveToParagraphEnd()
Moves the position to the first position in the current paragraph.
public void MoveToParagraphStart()
Moves the position to a specific position in the document.
public void MoveToPosition(DocumentPosition newPosition)
The new position.
Moves the position to the previous possible position in the document.
public bool MoveToPrevious()
True if the position is moved successfully. Otherwise, false.
Moves the position to the previous InlineLayoutBox.
public bool MoveToPreviousInlineBox()
True if the position is moved successfully. Otherwise, false.
Moves the position to the last position on the previous page.
public void MoveToPreviousPageEnd()
Moves the position to the last position in the previous paragraph.
public void MoveToPreviousParagraphEnd()
Moves the position to the first position in the previous paragraph.
public void MoveToPreviousParagraphStart()
Moves the position to the previous SpanLayoutBox.
public bool MoveToPreviousSpanBox()
True if the position is moved successfully. Otherwise, false.
Moves the position to the start of the previous word.
public bool MoveToPreviousWordStart()
True if the position is moved successfully. Otherwise, false.
Moves the position to the last position in the current table cell.
public void MoveToTableCellEnd()
Moves the position to the first position in the current table cell.
public void MoveToTableCellStart()
Moves the position up.
Moves the position vertically with specified offset.
public void MoveVertically(float verticalOffset)
The vertical offset.
Called after changing the location of the position.
protected virtual void OnLocationChanged(bool changesCursorInitialLocation)
if set to true [changes cursor initial location].
Called before changing the location of the position.
protected virtual void OnLocationChanging()
Called when position is changed.
protected virtual void OnPositionChanged()
Called when position is changing.
protected virtual void OnPositionChanging()
Resets the position to the first position in the document.
public void Reset()
Moves the position to the nearest possible to a given point.
Events
Occurs when changing the coordinates of a position.
For the caret position, this can be also achieved by typing, using the arrows keys or by clicking somewhere in the document.
public event EventHandler LocationChanged
Occurs before changing the coordinates of a position.
For the caret position, this can be also achieved by typing, using the arrows keys or by clicking somewhere in the document.
public event EventHandler LocationChanging
Occurs when the position is moved.
For the caret position, this can be also achieved using the arrows keys or by clicking somewhere in the document.
public event EventHandler PositionChanged
Occurs before the position is moved.
For the caret position, this can be also achieved using the arrows keys or by clicking somewhere in the document.
public event EventHandler PositionChanging
Operators
Implements the operator !=.
public static bool operator !=(DocumentPosition position1, DocumentPosition position2)
The first position.
position2DocumentPositionThe second position.
Returns:The result of the operator.
Implements the operator <.
public static bool operator <(DocumentPosition position1, DocumentPosition position2)
The first position.
position2DocumentPositionThe second position.
Returns:The result of the operator.
Implements the operator <=.
public static bool operator <=(DocumentPosition position1, DocumentPosition position2)
The first position.
position2DocumentPositionThe second position.
Returns:The result of the operator.
Implements the operator ==.
public static bool operator ==(DocumentPosition position1, DocumentPosition position2)
The first position.
position2DocumentPositionThe second position.
Returns:The result of the operator.
Implements the operator >.
public static bool operator >(DocumentPosition position1, DocumentPosition position2)
The first position.
position2DocumentPositionThe second position.
Returns:The result of the operator.
Implements the operator >=.
public static bool operator >=(DocumentPosition position1, DocumentPosition position2)
The first position.
position2DocumentPositionThe second position.
Returns:The result of the operator.