System\Windows\Controls\TextBox.cs (34)
159TextPointer newStart = this.TextContainer.CreatePointerAtOffset(start, LogicalDirection.Forward);
171TextPointer newEnd = new TextPointer(newStart, length, LogicalDirection.Forward);
187this.TextContainer.DeleteContentInternal((TextPointer)this.TextContainer.Start, (TextPointer)this.TextContainer.End);
206TextPointer textPointer = GetTextPositionFromPointInternal(point, snapToText);
237TextPointer textPointer = GetStartPositionOfLine(lineIndex);
262TextPointer position = this.TextContainer.CreatePointerAtOffset(charIndex, LogicalDirection.Forward);
292TextPointer textPointerStart = GetStartPositionOfLine(lineIndex);
293TextPointer textPointerEnd = GetEndPositionOfLine(lineIndex);
368TextPointer textPointer = GetStartPositionOfLine(lineIndex);
385TextPointer startOfLine;
386TextPointer endOfLine;
437TextPointer textPointer = TextContainer.CreatePointerAtOffset(charIndex, LogicalDirection.Backward);
477TextPointer position = this.TextContainer.CreatePointerAtOffset(charIndex, LogicalDirection.Forward);
809TextPointer newEnd = new TextPointer(TextSelectionInternal.Start, value, LogicalDirection.Forward);
853TextPointer newStart = TextContainer.CreatePointerAtOffset(value, LogicalDirection.Forward);
865TextPointer newEnd = new TextPointer(newStart, selectionLength, LogicalDirection.Forward);
1071return new RangeContentEnumerator((TextPointer)this.TextContainer.Start, (TextPointer)this.TextContainer.End);
1343internal TextPointer StartPosition
1347return (TextPointer)this.TextContainer.Start;
1354internal TextPointer EndPosition
1358return (TextPointer)this.TextContainer.End;
1402private bool GetRectangleFromTextPositionInternal(TextPointer position, bool relativeToTextBox, out Rect rect)
1423private TextPointer GetStartPositionOfLine(int lineIndex)
1437TextPointer textPointer;
1441textPointer = (TextPointer)TextEditor.GetTextView(this.RenderScope).GetTextPositionFromPoint(point, /* snap to text */ true);
1442textPointer = (TextPointer)TextEditor.GetTextView(this.RenderScope).GetLineRange(textPointer).Start.CreatePointer(textPointer.LogicalDirection);
1452private TextPointer GetEndPositionOfLine(int lineIndex)
1466TextPointer textPointer;
1470textPointer = (TextPointer)TextEditor.GetTextView(this.RenderScope).GetTextPositionFromPoint(point, /* snap to text */ true);
1471textPointer = (TextPointer)TextEditor.GetTextView(this.RenderScope).GetLineRange(textPointer).End.CreatePointer(textPointer.LogicalDirection);
1653TextContainer.DeleteContentInternal((TextPointer)TextContainer.Start, (TextPointer)TextContainer.End);
System\Windows\Documents\TextContainer.cs (56)
209internal void SetValue(TextPointer position, DependencyProperty property, object value)
250internal void SetValues(TextPointer position, LocalValueEnumerator values)
437internal TextPointer CreatePointerAtOffset(int offset, LogicalDirection direction)
460internal TextPointer CreatePointerAtCharOffset(int charOffset, LogicalDirection direction)
514context = TextPointer.GetPointerContextForward(node, edge);
519context = TextPointer.GetPointerContextBackward(node, edge);
539offset = TextPointer.GetSymbolOffset(this, node, node.GetEdgeFromOffsetNoBias(nodeOffset));
559textNode = TextPointer.GetAdjacentTextNodeSibling(node, node.GetEdgeFromOffsetNoBias(nodeOffset), direction);
563return textNode == null ? 0 : TextPointer.GetTextInRun(this, textNode.GetSymbolOffset(this.Generation), textNode, nodeOffset, direction, textBuffer, startIndex, count);
578adjacentElement = TextPointer.GetAdjacentElement(node, node.GetEdgeFromOffset(nodeOffset, direction), direction);
596scopingNode = TextPointer.GetScopingNode(node, node.GetEdgeFromOffsetNoBias(nodeOffset));
648moved = TextPointer.GetNextNodeAndEdge(node, edge, this.PlainTextOnly, out node, out edge);
653moved = TextPointer.GetPreviousNodeAndEdge(node, edge, this.PlainTextOnly, out node, out edge);
754internal void AddChange(TextPointer startPosition, int symbolCount, int charCount, PrecursorTextChangeType textChange)
761internal void AddChange(TextPointer startPosition, int symbolCount, int charCount, PrecursorTextChangeType textChange, DependencyProperty property, bool affectsRenderOnly)
772internal void AddChange(TextPointer startPosition, TextPointer endPosition,
817internal void InsertTextInternal(TextPointer position, object text)
821TextPointer originalPosition;
932internal void InsertElementInternal(TextPointer startPosition, TextPointer endPosition, TextElement element)
937TextPointer startEdgePosition;
938TextPointer endEdgePosition;
1167internal void InsertEmbeddedObjectInternal(TextPointer position, DependencyObject embeddedObject)
1172TextPointer insertPosition;
1214internal void DeleteContentInternal(TextPointer startPosition, TextPointer endPosition)
1220TextPointer deletePosition;
1582internal bool IsAtCaretUnitBoundary(TextPointer position)
1600TextPointer positionForwardGravity = position.GetPositionAtOffset(0, LogicalDirection.Forward);
1624internal TextPointer Start
1628TextPointer startPosition;
1655internal TextPointer End
1659TextPointer endPosition;
2228private int InsertElementToSiblingTree(TextPointer startPosition, TextPointer endPosition, TextTreeTextElementNode elementNode)
2262private int InsertElementToSiblingTreeComplex(TextPointer startPosition, TextPointer endPosition, TextTreeTextElementNode elementNode,
2292private int DeleteContentFromSiblingTree(SplayTreeNode containingNode, TextPointer startPosition, TextPointer endPosition, bool newFirstIMEVisibleNode, out int charCount)
2416private int CutTopLevelLogicalNodes(TextTreeNode containingNode, TextPointer startPosition, TextPointer endPosition, out int charCount)
2426TextPointer newTreeStart;
2618private int CutContent(TextPointer startPosition, TextPointer endPosition, out int charCount, out SplayTreeNode leftSubTree, out SplayTreeNode middleSubTree, out SplayTreeNode rightSubTree)
2767TextPointer startPosition;
2768TextPointer endPosition;
3249private void ValidateSetValue(TextPointer position)
3354private void FireChangeEvent(TextPointer startPosition, TextPointer endPosition, int symbolCount,
3413private TextTreeTextElementNode GetNextIMEVisibleNode(TextPointer startPosition, TextPointer endPosition)
3431TextPointer startEdgePosition = new TextPointer(this, node, ElementEdge.BeforeStart);
3443TextPointer startEdgePosition = new TextPointer(this, node, ElementEdge.BeforeStart);
3507internal ExtractChangeEventArgs(TextContainer textTree, TextPointer startPosition, TextTreeTextElementNode node,
3577private readonly TextPointer _startPosition;
System\Windows\Documents\TextPointer.cs (63)
36/// a <see cref="TextPointer.GetOffsetToPosition"/> method).</para>
40/// <see cref="TextPointer.LogicalDirection"/> property.</para>
46/// get from a TextPointer using method <see cref="TextPointer.GetPointerContext"/>.</para>
62/// using traversal methods like <see cref="TextPointer.GetNextContextPosition"/>,
63/// <see cref="TextPointer.GetNextInsertionPosition"/>, <see cref="TextPointer.GetPositionAtOffset(int)"/>,
255internal TextPointer(TextPointer textPointer)
263internal TextPointer(TextPointer position, int offset)
271internal TextPointer(TextPointer position, LogicalDirection direction)
277internal TextPointer(TextPointer position, int offset, LogicalDirection direction)
311internal TextPointer CreatePointer()
317internal TextPointer CreatePointer(LogicalDirection gravity)
430public bool IsInSameDocument(TextPointer textPosition)
452/// text container as this TextPointer (you can use <see cref="TextPointer.IsInSameDocument"/>
455public int CompareTo(TextPointer position)
675public int GetOffsetToPosition(TextPointer position)
868public TextPointer GetPositionAtOffset(int offset)
895/// <para>See examples in <seealso cref="TextPointer.GetPositionAtOffset(int)"/> method with one parameter.</para>
897public TextPointer GetPositionAtOffset(int offset, LogicalDirection direction)
899TextPointer position = new TextPointer(this, direction);
985public TextPointer GetNextContextPosition(LogicalDirection direction)
987return (TextPointer)((ITextPointer)this).GetNextContextPosition(direction);
1058public TextPointer GetInsertionPosition(LogicalDirection direction)
1060return (TextPointer)((ITextPointer)this).GetInsertionPosition(direction);
1064internal TextPointer GetInsertionPosition()
1085/// "insertion position" in the <see cref="TextPointer.GetInsertionPosition(LogicalDirection)"/>
1125public TextPointer GetNextInsertionPosition(LogicalDirection direction)
1127return (TextPointer)((ITextPointer)this).GetNextInsertionPosition(direction);
1167public TextPointer GetLineStartPosition(int count)
1171TextPointer lineStartPosition = GetLineStartPosition(count, out actualCount);
1207public TextPointer GetLineStartPosition(int count, out int actualCount)
1211TextPointer position = new TextPointer(this);
1277TextPointer insertPosition;
1341TextPointer deleteToPosition = new TextPointer(this, count);
1413public TextPointer InsertParagraphBreak()
1435TextPointer position;
1458public TextPointer InsertLineBreak()
1463TextPointer position;
1609TextPointer position = new TextPointer(this);
1620if (position.CompareTo((TextPointer)lineRange.Start) <= 0)
1679/// <para>The <see cref="TextPointer.Parent"/> property for this
1684public TextPointer DocumentStart
1696/// <para>The <see cref="TextPointer.Parent"/> property for this
1701public TextPointer DocumentEnd
1849internal void MoveToPosition(TextPointer textPosition)
2334internal TextPointer GetFrozenPointer(LogicalDirection logicalDirection)
2340return (TextPointer)TextPointerBase.GetFrozenPointer(this, logicalDirection);
2350return CompareTo((TextPointer)position);
2380return GetOffsetToPosition((TextPointer)position);
2428TextPointer textPointer;
2434textPointer = (TextPointer)position;
2609MoveToPosition((TextPointer)position);
2676TextPointer position;
2699position = (TextPointer)_tree.TextView.GetNextCaretUnitPosition(this, oppositeDirection);
2711TextPointer position;
2728position = (TextPointer)_tree.TextView.GetNextCaretUnitPosition(this, direction);
2744TextPointer position;
2759position = (TextPointer)_tree.TextView.GetBackspaceCaretUnitPosition(this);
2788TextRangeEditTables.DeleteContent(this, (TextPointer)limit);
3538TextPointer position = this;
3575internal static DependencyObject GetCommonAncestor(TextPointer position1, TextPointer position2)
3888private void InitializeOffset(TextPointer position, int distance, LogicalDirection direction)
System\Windows\Documents\TextRange.cs (27)
57public TextRange(TextPointer position1, TextPointer position2) :
79internal TextRange(TextPointer position1, TextPointer position2, bool useRestrictiveXamlXmlReader) :
383return _textSegments[0].Start is TextPointer;
649public bool Contains(TextPointer textPointer)
680public void Select(TextPointer position1, TextPointer position2)
695internal void SelectWord(TextPointer textPointer)
1262public TextPointer Start
1266return (TextPointer)((ITextRange)this).Start;
1276public TextPointer End
1280return (TextPointer)((ITextRange)this).End;
1315return ((TextPointer)this.Start).ContainingFrameworkElement;
1584TextPointer startPosition = TextRangeEditTables.EnsureInsertionPosition(this.Start);
1609TextPointer insertionPosition = TextRangeEdit.SplitFormattingElements(this.Start, /*keepEmptyFormatting:*/false);
1641TextRangeEdit.SetParagraphProperty((TextPointer)textSegment.Start, (TextPointer)textSegment.End, formattingProperty, value, propertyValueAction);
1645TextRangeEdit.SetInlineProperty((TextPointer)textSegment.Start, (TextPointer)textSegment.End, formattingProperty, value, propertyValueAction);
1650TextRangeEdit.SetInlineProperty((TextPointer)textSegment.Start, (TextPointer)textSegment.End, formattingProperty, value, propertyValueAction);
1667TextRangeEdit.SetParagraphProperty((TextPointer)textSegment.Start, (TextPointer)textSegment.End, formattingProperty, value, propertyValueAction);
1684TextRangeEdit.CharacterResetFormatting((TextPointer)this.Start, (TextPointer)this.End);
1704return TextRangeEditTables.InsertTable((TextPointer)this.End, rowCount, columnCount);
System\Windows\Documents\TextRangeEdit.cs (76)
29internal static TextElement InsertElementClone(TextPointer start, TextPointer end, TextElement element)
49internal static TextPointer SplitFormattingElements(TextPointer splitPosition, bool keepEmptyFormatting)
54internal static TextPointer SplitFormattingElement(TextPointer splitPosition, bool keepEmptyFormatting)
162private static bool ExtractEmptyFormattingElements(TextPointer position)
226internal static void SetInlineProperty(TextPointer start, TextPointer end, DependencyProperty formattingProperty, object value, PropertyValueAction propertyValueAction)
254internal static bool MergeFormattingInlines(TextPointer position)
321private static void RemoveUnnecessarySpans(TextPointer position)
407internal static void CharacterResetFormatting(TextPointer start, TextPointer end)
435TextPointer mergePosition = parent.ElementStart;
522internal static TextPointer SplitElement(TextPointer position)
590internal static TextPointer InsertParagraphBreak(TextPointer position, bool moveIntoSecondParagraph)
633TextPointer breakPosition = position;
678internal static TextPointer InsertLineBreak(TextPointer position)
717internal static void SetParagraphProperty(TextPointer start, TextPointer end, DependencyProperty property, object value)
740internal static void SetParagraphProperty(TextPointer start, TextPointer end, DependencyProperty property, object value, PropertyValueAction propertyValueAction)
748end = (TextPointer)TextRangeEdit.GetAdjustedRangeEnd(start, end);
784private static void SetParagraphPropertyWorker(TextPointer start, TextPointer end, DependencyProperty property, object value, PropertyValueAction propertyValueAction)
805TextPointer contentStart = block.ContentStart.GetPositionAtOffset(0, LogicalDirection.Forward); // Normalize forward;
807TextPointer contentEnd = block.ContentEnd;
967TextPointer start = firstChild.ElementStart.GetFrozenPointer(LogicalDirection.Backward);
968TextPointer end = lastChild.ElementEnd.GetFrozenPointer(LogicalDirection.Forward);
1025private static Block GetNextBlock(TextPointer pointer, TextPointer limit)
1265internal static void MergeFlowDirection(TextPointer position)
1297TextPointer previousPosition = position.CreatePointer();
1306TextPointer nextPosition = position.CreatePointer();
1343internal static bool CanApplyStructuralInlineProperty(TextPointer start, TextPointer end)
1345return ValidateApplyStructuralInlineProperty(start, end, TextPointer.GetCommonAncestor(start, end), null);
1415if (!(start is TextPointer))
1422TextPointer startPosition = (TextPointer)start;
1423TextPointer endPosition = (TextPointer)end;
1510private static void MergeEmptyParagraphsAndBlockUIContainers(TextPointer startPosition, TextPointer endPosition)
1560private static void DeleteEquiScopedContent(TextPointer start, TextPointer end)
1604TextPointer previousPosition = new TextPointer(start);
1608TextPointer nextPosition = new TextPointer(start);
1687private static bool DeleteContentBetweenPositions(TextPointer one, TextPointer two)
1715private static TextPointer SplitFormattingElements(TextPointer splitPosition, bool keepEmptyFormatting, TextElement limitingAncestor)
1746private static TextPointer SplitFormattingElements(TextPointer splitPosition, bool keepEmptyFormatting, bool preserveStructuralFormatting, TextElement limitingAncestor)
1869private static void SetNonStructuralInlineProperty(TextPointer start, TextPointer end, DependencyProperty formattingProperty, object value, PropertyValueAction propertyValueAction)
1893TextPointer nextRunPosition = run.ElementEnd.GetPositionAtOffset(0, LogicalDirection.Forward);
1944private static void SetStructuralInlineProperty(TextPointer start, TextPointer end, DependencyProperty formattingProperty, object value)
1946DependencyObject commonAncestor = TextPointer.GetCommonAncestor(start, end);
2051TextPointer end = SplitFormattingElements(child.ElementEnd, /*keepEmptyFormatting*/false, limit);
2077private static Run GetNextRun(TextPointer pointer, TextPointer limit)
2107private static void ClearPropertyValueFromSpansAndRuns(TextPointer start, TextPointer end, DependencyProperty formattingProperty)
2132private static void ApplyStructuralInlinePropertyAcrossRun(TextPointer start, TextPointer end, Run run, DependencyProperty formattingProperty, object value)
2157private static void ApplyStructuralInlinePropertyAcrossInline(TextPointer start, TextPointer end, TextElement commonAncestor, DependencyProperty formattingProperty, object value)
2214private static void ApplyStructuralInlinePropertyAcrossParagraphs(TextPointer start, TextPointer end, DependencyProperty formattingProperty, object value)
2254private static bool ValidateApplyStructuralInlineProperty(TextPointer start, TextPointer end, DependencyObject commonAncestor, DependencyProperty property)
System\Windows\Documents\TextRangeEditTables.cs (58)
47if (!(range.Start is TextPointer))
55if (table != GetTableFromPosition((TextPointer)range.TextSegments[0].Start))
60TableCell firstCell = GetTableCellFromPosition((TextPointer)range.TextSegments[0].Start);
67TextPointer lastCellPointer = (TextPointer)range.TextSegments[0].End.GetNextInsertionPosition(LogicalDirection.Backward);
108internal static Table GetTableFromPosition(TextPointer position)
120private static TableRow GetTableRowFromPosition(TextPointer position)
132internal static TableCell GetTableCellFromPosition(TextPointer position)
180if (!(anchorPosition is TextPointer) || !(movingPosition is TextPointer))
195TextPointer)anchorPosition, (TextPointer)movingPosition,
226TextPointer anchorPosition, TextPointer movingPosition,
281TextPointer anchorPosition, TextPointer movingPosition,
372TextPointer anchorPosition, TextPointer movingPosition,
428internal static TextPointer GetNextTableCellRangeInsertionPosition(TextSelection selection, LogicalDirection direction)
432TextPointer movingPosition = selection.MovingPosition;
438if (TextRangeEditTables.IsTableCellRange(selection.AnchorPosition, (TextPointer)movingPosition,
558internal static TextPointer GetNextRowEndMovingPosition(TextSelection selection, LogicalDirection direction)
576Invariant.Assert(((ITextSelection)selection).Start is TextPointer);
587internal static TextPointer GetNextRowStartMovingPosition(TextSelection selection, LogicalDirection direction)
590Invariant.Assert(((ITextSelection)selection).Start is TextPointer);
628internal static Table InsertTable(TextPointer insertionPosition, int rowCount, int columnCount)
707internal static TextPointer EnsureInsertionPosition(TextPointer position)
773internal static TextPointer GetAdjustedRowEndPosition(Table currentTable, TextPointer rowEndPosition)
775TextPointer position;
778TextPointer nextInsertionPosition = rowEndPosition;
806private static TextPointer CreateInsertionPositionInIncompleteContent(TextPointer position)
871TextPointer insertionPosition;
886private static TextPointer CreateImplicitRun(TextPointer position)
888TextPointer insertionPosition;
913private static TextPointer CreateImplicitParagraph(TextPointer position)
915TextPointer insertionPosition;
934internal static void DeleteContent(TextPointer start, TextPointer end)
940TextPointer whatWasEnd = end;
1074TableCell cell = GetTableCellFromPosition((TextPointer)textSegment.Start);
1075TextPointer end = ((TextPointer)textSegment.End).GetNextInsertionPosition(LogicalDirection.Backward);
1081TextPointer cellEnd = cell.ElementEnd;
1120TextPointer currentRowPosition = rowCount > 0 ? textRange.End : textRange.Start;
1958private static TextSegment NewNormalizedTextSegment(TextPointer startPosition, TextPointer endPosition)
1988TextPointer start = startCell.ContentStart.GetInsertionPosition(LogicalDirection.Forward);
1992TextPointer end = endCell.ContentEnd.GetNextInsertionPosition(LogicalDirection.Forward);
2041TextPointer anchorPosition, TextPointer movingPosition,
2127TextPointer anchorPosition, TextPointer movingPosition,
2166TextPointer position,
System\Windows\Documents\TextRangeSerialization.cs (19)
592if (elementTypeStandardized == typeof(Table) && textReader is TextPointer)
595WriteTableColumnsInformation(range, (Table)((TextPointer)textReader).Parent, xmlWriter, xamlTypeMapper);
697WriteInheritablePropertiesForFlowDocument((DependencyObject)((TextPointer)context).Parent, xmlWriter, complexProperties);
950TextPointer textPointer = context as TextPointer;
1261TextPointer insertionPosition = TextRangeEditTables.EnsureInsertionPosition(range.End);
1294private static void PasteMergeableTextFragment(TextElement fragment, TextRange range, TextPointer insertionPosition)
1296TextPointer fragmentStart;
1297TextPointer fragmentEnd;
1404private static bool SplitParagraphForPasting(ref TextPointer insertionPosition)
1412TextPointer positionBeforeParagraph = insertionPosition;
1452private static void MergeParagraphsAtPosition(TextPointer position, bool mergingOnFragmentStart)
1454TextPointer navigator = position;
1507private static void ValidateMergingPositions(Type itemType, TextPointer start, TextPointer end)
1555private static void ApplyContextualProperties(TextPointer start, TextPointer end, TextElement propertyBag)
1598private static void ApplyContextualProperty(Type targetType, TextPointer start, TextPointer end, DependencyProperty property, object value)