System\Windows\Controls\TextBox.cs (34)
161TextPointer newStart = this.TextContainer.CreatePointerAtOffset(start, LogicalDirection.Forward);
173TextPointer newEnd = new TextPointer(newStart, length, LogicalDirection.Forward);
189this.TextContainer.DeleteContentInternal((TextPointer)this.TextContainer.Start, (TextPointer)this.TextContainer.End);
208TextPointer textPointer = GetTextPositionFromPointInternal(point, snapToText);
239TextPointer textPointer = GetStartPositionOfLine(lineIndex);
264TextPointer position = this.TextContainer.CreatePointerAtOffset(charIndex, LogicalDirection.Forward);
294TextPointer textPointerStart = GetStartPositionOfLine(lineIndex);
295TextPointer textPointerEnd = GetEndPositionOfLine(lineIndex);
370TextPointer textPointer = GetStartPositionOfLine(lineIndex);
387TextPointer startOfLine;
388TextPointer endOfLine;
439TextPointer textPointer = TextContainer.CreatePointerAtOffset(charIndex, LogicalDirection.Backward);
479TextPointer position = this.TextContainer.CreatePointerAtOffset(charIndex, LogicalDirection.Forward);
811TextPointer newEnd = new TextPointer(TextSelectionInternal.Start, value, LogicalDirection.Forward);
855TextPointer newStart = TextContainer.CreatePointerAtOffset(value, LogicalDirection.Forward);
867TextPointer newEnd = new TextPointer(newStart, selectionLength, LogicalDirection.Forward);
1073return new RangeContentEnumerator((TextPointer)this.TextContainer.Start, (TextPointer)this.TextContainer.End);
1345internal TextPointer StartPosition
1349return (TextPointer)this.TextContainer.Start;
1356internal TextPointer EndPosition
1360return (TextPointer)this.TextContainer.End;
1404private bool GetRectangleFromTextPositionInternal(TextPointer position, bool relativeToTextBox, out Rect rect)
1425private TextPointer GetStartPositionOfLine(int lineIndex)
1439TextPointer textPointer;
1443textPointer = (TextPointer)TextEditor.GetTextView(this.RenderScope).GetTextPositionFromPoint(point, /* snap to text */ true);
1444textPointer = (TextPointer)TextEditor.GetTextView(this.RenderScope).GetLineRange(textPointer).Start.CreatePointer(textPointer.LogicalDirection);
1454private TextPointer GetEndPositionOfLine(int lineIndex)
1468TextPointer textPointer;
1472textPointer = (TextPointer)TextEditor.GetTextView(this.RenderScope).GetTextPositionFromPoint(point, /* snap to text */ true);
1473textPointer = (TextPointer)TextEditor.GetTextView(this.RenderScope).GetLineRange(textPointer).End.CreatePointer(textPointer.LogicalDirection);
1655TextContainer.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;
929internal void InsertElementInternal(TextPointer startPosition, TextPointer endPosition, TextElement element)
934TextPointer startEdgePosition;
935TextPointer endEdgePosition;
1164internal void InsertEmbeddedObjectInternal(TextPointer position, DependencyObject embeddedObject)
1169TextPointer insertPosition;
1211internal void DeleteContentInternal(TextPointer startPosition, TextPointer endPosition)
1217TextPointer deletePosition;
1576internal bool IsAtCaretUnitBoundary(TextPointer position)
1594TextPointer positionForwardGravity = position.GetPositionAtOffset(0, LogicalDirection.Forward);
1618internal TextPointer Start
1622TextPointer startPosition;
1649internal TextPointer End
1653TextPointer endPosition;
2216private int InsertElementToSiblingTree(TextPointer startPosition, TextPointer endPosition, TextTreeTextElementNode elementNode)
2250private int InsertElementToSiblingTreeComplex(TextPointer startPosition, TextPointer endPosition, TextTreeTextElementNode elementNode,
2280private int DeleteContentFromSiblingTree(SplayTreeNode containingNode, TextPointer startPosition, TextPointer endPosition, bool newFirstIMEVisibleNode, out int charCount)
2395private int CutTopLevelLogicalNodes(TextTreeNode containingNode, TextPointer startPosition, TextPointer endPosition, out int charCount)
2405TextPointer newTreeStart;
2597private int CutContent(TextPointer startPosition, TextPointer endPosition, out int charCount, out SplayTreeNode leftSubTree, out SplayTreeNode middleSubTree, out SplayTreeNode rightSubTree)
2743TextPointer startPosition;
2744TextPointer endPosition;
3222private void ValidateSetValue(TextPointer position)
3327private void FireChangeEvent(TextPointer startPosition, TextPointer endPosition, int symbolCount,
3386private TextTreeTextElementNode GetNextIMEVisibleNode(TextPointer startPosition, TextPointer endPosition)
3404TextPointer startEdgePosition = new TextPointer(this, node, ElementEdge.BeforeStart);
3416TextPointer startEdgePosition = new TextPointer(this, node, ElementEdge.BeforeStart);
3480internal ExtractChangeEventArgs(TextContainer textTree, TextPointer startPosition, TextTreeTextElementNode node,
3550private 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)
51public TextRange(TextPointer position1, TextPointer position2) :
73internal TextRange(TextPointer position1, TextPointer position2, bool useRestrictiveXamlXmlReader) :
377return _textSegments[0].Start is TextPointer;
643public bool Contains(TextPointer textPointer)
674public void Select(TextPointer position1, TextPointer position2)
689internal void SelectWord(TextPointer textPointer)
1254public TextPointer Start
1258return (TextPointer)((ITextRange)this).Start;
1268public TextPointer End
1272return (TextPointer)((ITextRange)this).End;
1307return ((TextPointer)this.Start).ContainingFrameworkElement;
1576TextPointer startPosition = TextRangeEditTables.EnsureInsertionPosition(this.Start);
1602TextPointer insertionPosition = TextRangeEdit.SplitFormattingElements(this.Start, /*keepEmptyFormatting:*/false);
1634TextRangeEdit.SetParagraphProperty((TextPointer)textSegment.Start, (TextPointer)textSegment.End, formattingProperty, value, propertyValueAction);
1638TextRangeEdit.SetInlineProperty((TextPointer)textSegment.Start, (TextPointer)textSegment.End, formattingProperty, value, propertyValueAction);
1643TextRangeEdit.SetInlineProperty((TextPointer)textSegment.Start, (TextPointer)textSegment.End, formattingProperty, value, propertyValueAction);
1660TextRangeEdit.SetParagraphProperty((TextPointer)textSegment.Start, (TextPointer)textSegment.End, formattingProperty, value, propertyValueAction);
1677TextRangeEdit.CharacterResetFormatting((TextPointer)this.Start, (TextPointer)this.End);
1697return 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)
711internal static TextPointer EnsureInsertionPosition(TextPointer position)
777internal static TextPointer GetAdjustedRowEndPosition(Table currentTable, TextPointer rowEndPosition)
779TextPointer position;
782TextPointer nextInsertionPosition = rowEndPosition;
810private static TextPointer CreateInsertionPositionInIncompleteContent(TextPointer position)
875TextPointer insertionPosition;
890private static TextPointer CreateImplicitRun(TextPointer position)
892TextPointer insertionPosition;
917private static TextPointer CreateImplicitParagraph(TextPointer position)
919TextPointer insertionPosition;
938internal static void DeleteContent(TextPointer start, TextPointer end)
944TextPointer whatWasEnd = end;
1078TableCell cell = GetTableCellFromPosition((TextPointer)textSegment.Start);
1079TextPointer end = ((TextPointer)textSegment.End).GetNextInsertionPosition(LogicalDirection.Backward);
1085TextPointer cellEnd = cell.ElementEnd;
1124TextPointer currentRowPosition = rowCount > 0 ? textRange.End : textRange.Start;
1962private static TextSegment NewNormalizedTextSegment(TextPointer startPosition, TextPointer endPosition)
1992TextPointer start = startCell.ContentStart.GetInsertionPosition(LogicalDirection.Forward);
1996TextPointer end = endCell.ContentEnd.GetNextInsertionPosition(LogicalDirection.Forward);
2045TextPointer anchorPosition, TextPointer movingPosition,
2131TextPointer anchorPosition, TextPointer movingPosition,
2170TextPointer 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)