System\Windows\Controls\TextBox.cs (34)
160TextPointer newStart = this.TextContainer.CreatePointerAtOffset(start, LogicalDirection.Forward);
172TextPointer newEnd = new TextPointer(newStart, length, LogicalDirection.Forward);
188this.TextContainer.DeleteContentInternal((TextPointer)this.TextContainer.Start, (TextPointer)this.TextContainer.End);
207TextPointer textPointer = GetTextPositionFromPointInternal(point, snapToText);
238TextPointer textPointer = GetStartPositionOfLine(lineIndex);
263TextPointer position = this.TextContainer.CreatePointerAtOffset(charIndex, LogicalDirection.Forward);
293TextPointer textPointerStart = GetStartPositionOfLine(lineIndex);
294TextPointer textPointerEnd = GetEndPositionOfLine(lineIndex);
369TextPointer textPointer = GetStartPositionOfLine(lineIndex);
386TextPointer startOfLine;
387TextPointer endOfLine;
438TextPointer textPointer = TextContainer.CreatePointerAtOffset(charIndex, LogicalDirection.Backward);
478TextPointer position = this.TextContainer.CreatePointerAtOffset(charIndex, LogicalDirection.Forward);
810TextPointer newEnd = new TextPointer(TextSelectionInternal.Start, value, LogicalDirection.Forward);
854TextPointer newStart = TextContainer.CreatePointerAtOffset(value, LogicalDirection.Forward);
866TextPointer newEnd = new TextPointer(newStart, selectionLength, LogicalDirection.Forward);
1072return new RangeContentEnumerator((TextPointer)this.TextContainer.Start, (TextPointer)this.TextContainer.End);
1344internal TextPointer StartPosition
1348return (TextPointer)this.TextContainer.Start;
1355internal TextPointer EndPosition
1359return (TextPointer)this.TextContainer.End;
1403private bool GetRectangleFromTextPositionInternal(TextPointer position, bool relativeToTextBox, out Rect rect)
1424private TextPointer GetStartPositionOfLine(int lineIndex)
1438TextPointer textPointer;
1442textPointer = (TextPointer)TextEditor.GetTextView(this.RenderScope).GetTextPositionFromPoint(point, /* snap to text */ true);
1443textPointer = (TextPointer)TextEditor.GetTextView(this.RenderScope).GetLineRange(textPointer).Start.CreatePointer(textPointer.LogicalDirection);
1453private TextPointer GetEndPositionOfLine(int lineIndex)
1467TextPointer textPointer;
1471textPointer = (TextPointer)TextEditor.GetTextView(this.RenderScope).GetTextPositionFromPoint(point, /* snap to text */ true);
1472textPointer = (TextPointer)TextEditor.GetTextView(this.RenderScope).GetLineRange(textPointer).End.CreatePointer(textPointer.LogicalDirection);
1654TextContainer.DeleteContentInternal((TextPointer)TextContainer.Start, (TextPointer)TextContainer.End);
System\Windows\Documents\TextContainer.cs (56)
208internal void SetValue(TextPointer position, DependencyProperty property, object value)
249internal void SetValues(TextPointer position, LocalValueEnumerator values)
436internal TextPointer CreatePointerAtOffset(int offset, LogicalDirection direction)
459internal TextPointer CreatePointerAtCharOffset(int charOffset, LogicalDirection direction)
513context = TextPointer.GetPointerContextForward(node, edge);
518context = TextPointer.GetPointerContextBackward(node, edge);
538offset = TextPointer.GetSymbolOffset(this, node, node.GetEdgeFromOffsetNoBias(nodeOffset));
558textNode = TextPointer.GetAdjacentTextNodeSibling(node, node.GetEdgeFromOffsetNoBias(nodeOffset), direction);
562return textNode == null ? 0 : TextPointer.GetTextInRun(this, textNode.GetSymbolOffset(this.Generation), textNode, nodeOffset, direction, textBuffer, startIndex, count);
577adjacentElement = TextPointer.GetAdjacentElement(node, node.GetEdgeFromOffset(nodeOffset, direction), direction);
595scopingNode = TextPointer.GetScopingNode(node, node.GetEdgeFromOffsetNoBias(nodeOffset));
647moved = TextPointer.GetNextNodeAndEdge(node, edge, this.PlainTextOnly, out node, out edge);
652moved = TextPointer.GetPreviousNodeAndEdge(node, edge, this.PlainTextOnly, out node, out edge);
753internal void AddChange(TextPointer startPosition, int symbolCount, int charCount, PrecursorTextChangeType textChange)
760internal void AddChange(TextPointer startPosition, int symbolCount, int charCount, PrecursorTextChangeType textChange, DependencyProperty property, bool affectsRenderOnly)
771internal void AddChange(TextPointer startPosition, TextPointer endPosition,
816internal void InsertTextInternal(TextPointer position, object text)
820TextPointer originalPosition;
928internal void InsertElementInternal(TextPointer startPosition, TextPointer endPosition, TextElement element)
933TextPointer startEdgePosition;
934TextPointer endEdgePosition;
1163internal void InsertEmbeddedObjectInternal(TextPointer position, DependencyObject embeddedObject)
1168TextPointer insertPosition;
1210internal void DeleteContentInternal(TextPointer startPosition, TextPointer endPosition)
1216TextPointer deletePosition;
1575internal bool IsAtCaretUnitBoundary(TextPointer position)
1593TextPointer positionForwardGravity = position.GetPositionAtOffset(0, LogicalDirection.Forward);
1617internal TextPointer Start
1621TextPointer startPosition;
1648internal TextPointer End
1652TextPointer endPosition;
2215private int InsertElementToSiblingTree(TextPointer startPosition, TextPointer endPosition, TextTreeTextElementNode elementNode)
2249private int InsertElementToSiblingTreeComplex(TextPointer startPosition, TextPointer endPosition, TextTreeTextElementNode elementNode,
2279private int DeleteContentFromSiblingTree(SplayTreeNode containingNode, TextPointer startPosition, TextPointer endPosition, bool newFirstIMEVisibleNode, out int charCount)
2391private int CutTopLevelLogicalNodes(TextTreeNode containingNode, TextPointer startPosition, TextPointer endPosition, out int charCount)
2401TextPointer newTreeStart;
2593private int CutContent(TextPointer startPosition, TextPointer endPosition, out int charCount, out SplayTreeNode leftSubTree, out SplayTreeNode middleSubTree, out SplayTreeNode rightSubTree)
2739TextPointer startPosition;
2740TextPointer endPosition;
3215private void ValidateSetValue(TextPointer position)
3320private void FireChangeEvent(TextPointer startPosition, TextPointer endPosition, int symbolCount,
3379private TextTreeTextElementNode GetNextIMEVisibleNode(TextPointer startPosition, TextPointer endPosition)
3397TextPointer startEdgePosition = new TextPointer(this, node, ElementEdge.BeforeStart);
3409TextPointer startEdgePosition = new TextPointer(this, node, ElementEdge.BeforeStart);
3473internal ExtractChangeEventArgs(TextContainer textTree, TextPointer startPosition, TextTreeTextElementNode node,
3543private readonly TextPointer _startPosition;
System\Windows\Documents\TextPointer.cs (63)
35/// a <see cref="TextPointer.GetOffsetToPosition"/> method).</para>
39/// <see cref="TextPointer.LogicalDirection"/> property.</para>
45/// get from a TextPointer using method <see cref="TextPointer.GetPointerContext"/>.</para>
61/// using traversal methods like <see cref="TextPointer.GetNextContextPosition"/>,
62/// <see cref="TextPointer.GetNextInsertionPosition"/>, <see cref="TextPointer.GetPositionAtOffset(int)"/>,
254internal TextPointer(TextPointer textPointer)
262internal TextPointer(TextPointer position, int offset)
270internal TextPointer(TextPointer position, LogicalDirection direction)
276internal TextPointer(TextPointer position, int offset, LogicalDirection direction)
310internal TextPointer CreatePointer()
316internal TextPointer CreatePointer(LogicalDirection gravity)
429public bool IsInSameDocument(TextPointer textPosition)
451/// text container as this TextPointer (you can use <see cref="TextPointer.IsInSameDocument"/>
454public int CompareTo(TextPointer position)
674public int GetOffsetToPosition(TextPointer position)
867public TextPointer GetPositionAtOffset(int offset)
894/// <para>See examples in <seealso cref="TextPointer.GetPositionAtOffset(int)"/> method with one parameter.</para>
896public TextPointer GetPositionAtOffset(int offset, LogicalDirection direction)
898TextPointer position = new TextPointer(this, direction);
984public TextPointer GetNextContextPosition(LogicalDirection direction)
986return (TextPointer)((ITextPointer)this).GetNextContextPosition(direction);
1057public TextPointer GetInsertionPosition(LogicalDirection direction)
1059return (TextPointer)((ITextPointer)this).GetInsertionPosition(direction);
1063internal TextPointer GetInsertionPosition()
1084/// "insertion position" in the <see cref="TextPointer.GetInsertionPosition(LogicalDirection)"/>
1124public TextPointer GetNextInsertionPosition(LogicalDirection direction)
1126return (TextPointer)((ITextPointer)this).GetNextInsertionPosition(direction);
1166public TextPointer GetLineStartPosition(int count)
1170TextPointer lineStartPosition = GetLineStartPosition(count, out actualCount);
1206public TextPointer GetLineStartPosition(int count, out int actualCount)
1210TextPointer position = new TextPointer(this);
1276TextPointer insertPosition;
1340TextPointer deleteToPosition = new TextPointer(this, count);
1412public TextPointer InsertParagraphBreak()
1434TextPointer position;
1457public TextPointer InsertLineBreak()
1462TextPointer position;
1608TextPointer position = new TextPointer(this);
1619if (position.CompareTo((TextPointer)lineRange.Start) <= 0)
1678/// <para>The <see cref="TextPointer.Parent"/> property for this
1683public TextPointer DocumentStart
1695/// <para>The <see cref="TextPointer.Parent"/> property for this
1700public TextPointer DocumentEnd
1848internal void MoveToPosition(TextPointer textPosition)
2333internal TextPointer GetFrozenPointer(LogicalDirection logicalDirection)
2339return (TextPointer)TextPointerBase.GetFrozenPointer(this, logicalDirection);
2349return CompareTo((TextPointer)position);
2379return GetOffsetToPosition((TextPointer)position);
2427TextPointer textPointer;
2433textPointer = (TextPointer)position;
2608MoveToPosition((TextPointer)position);
2675TextPointer position;
2698position = (TextPointer)_tree.TextView.GetNextCaretUnitPosition(this, oppositeDirection);
2710TextPointer position;
2727position = (TextPointer)_tree.TextView.GetNextCaretUnitPosition(this, direction);
2743TextPointer position;
2758position = (TextPointer)_tree.TextView.GetBackspaceCaretUnitPosition(this);
2787TextRangeEditTables.DeleteContent(this, (TextPointer)limit);
3537TextPointer position = this;
3574internal static DependencyObject GetCommonAncestor(TextPointer position1, TextPointer position2)
3887private void InitializeOffset(TextPointer position, int distance, LogicalDirection direction)
System\Windows\Documents\TextRange.cs (27)
50public TextRange(TextPointer position1, TextPointer position2) :
72internal TextRange(TextPointer position1, TextPointer position2, bool useRestrictiveXamlXmlReader) :
376return _textSegments[0].Start is TextPointer;
642public bool Contains(TextPointer textPointer)
673public void Select(TextPointer position1, TextPointer position2)
688internal void SelectWord(TextPointer textPointer)
1253public TextPointer Start
1257return (TextPointer)((ITextRange)this).Start;
1267public TextPointer End
1271return (TextPointer)((ITextRange)this).End;
1306return ((TextPointer)this.Start).ContainingFrameworkElement;
1575TextPointer startPosition = TextRangeEditTables.EnsureInsertionPosition(this.Start);
1601TextPointer insertionPosition = TextRangeEdit.SplitFormattingElements(this.Start, /*keepEmptyFormatting:*/false);
1633TextRangeEdit.SetParagraphProperty((TextPointer)textSegment.Start, (TextPointer)textSegment.End, formattingProperty, value, propertyValueAction);
1637TextRangeEdit.SetInlineProperty((TextPointer)textSegment.Start, (TextPointer)textSegment.End, formattingProperty, value, propertyValueAction);
1642TextRangeEdit.SetInlineProperty((TextPointer)textSegment.Start, (TextPointer)textSegment.End, formattingProperty, value, propertyValueAction);
1659TextRangeEdit.SetParagraphProperty((TextPointer)textSegment.Start, (TextPointer)textSegment.End, formattingProperty, value, propertyValueAction);
1676TextRangeEdit.CharacterResetFormatting((TextPointer)this.Start, (TextPointer)this.End);
1696return TextRangeEditTables.InsertTable((TextPointer)this.End, rowCount, columnCount);
System\Windows\Documents\TextRangeEdit.cs (76)
28internal static TextElement InsertElementClone(TextPointer start, TextPointer end, TextElement element)
48internal static TextPointer SplitFormattingElements(TextPointer splitPosition, bool keepEmptyFormatting)
53internal static TextPointer SplitFormattingElement(TextPointer splitPosition, bool keepEmptyFormatting)
161private static bool ExtractEmptyFormattingElements(TextPointer position)
225internal static void SetInlineProperty(TextPointer start, TextPointer end, DependencyProperty formattingProperty, object value, PropertyValueAction propertyValueAction)
253internal static bool MergeFormattingInlines(TextPointer position)
320private static void RemoveUnnecessarySpans(TextPointer position)
406internal static void CharacterResetFormatting(TextPointer start, TextPointer end)
434TextPointer mergePosition = parent.ElementStart;
521internal static TextPointer SplitElement(TextPointer position)
589internal static TextPointer InsertParagraphBreak(TextPointer position, bool moveIntoSecondParagraph)
632TextPointer breakPosition = position;
677internal static TextPointer InsertLineBreak(TextPointer position)
716internal static void SetParagraphProperty(TextPointer start, TextPointer end, DependencyProperty property, object value)
739internal static void SetParagraphProperty(TextPointer start, TextPointer end, DependencyProperty property, object value, PropertyValueAction propertyValueAction)
747end = (TextPointer)TextRangeEdit.GetAdjustedRangeEnd(start, end);
783private static void SetParagraphPropertyWorker(TextPointer start, TextPointer end, DependencyProperty property, object value, PropertyValueAction propertyValueAction)
804TextPointer contentStart = block.ContentStart.GetPositionAtOffset(0, LogicalDirection.Forward); // Normalize forward;
806TextPointer contentEnd = block.ContentEnd;
966TextPointer start = firstChild.ElementStart.GetFrozenPointer(LogicalDirection.Backward);
967TextPointer end = lastChild.ElementEnd.GetFrozenPointer(LogicalDirection.Forward);
1024private static Block GetNextBlock(TextPointer pointer, TextPointer limit)
1264internal static void MergeFlowDirection(TextPointer position)
1296TextPointer previousPosition = position.CreatePointer();
1305TextPointer nextPosition = position.CreatePointer();
1342internal static bool CanApplyStructuralInlineProperty(TextPointer start, TextPointer end)
1344return ValidateApplyStructuralInlineProperty(start, end, TextPointer.GetCommonAncestor(start, end), null);
1414if (!(start is TextPointer))
1421TextPointer startPosition = (TextPointer)start;
1422TextPointer endPosition = (TextPointer)end;
1509private static void MergeEmptyParagraphsAndBlockUIContainers(TextPointer startPosition, TextPointer endPosition)
1559private static void DeleteEquiScopedContent(TextPointer start, TextPointer end)
1603TextPointer previousPosition = new TextPointer(start);
1607TextPointer nextPosition = new TextPointer(start);
1686private static bool DeleteContentBetweenPositions(TextPointer one, TextPointer two)
1714private static TextPointer SplitFormattingElements(TextPointer splitPosition, bool keepEmptyFormatting, TextElement limitingAncestor)
1745private static TextPointer SplitFormattingElements(TextPointer splitPosition, bool keepEmptyFormatting, bool preserveStructuralFormatting, TextElement limitingAncestor)
1868private static void SetNonStructuralInlineProperty(TextPointer start, TextPointer end, DependencyProperty formattingProperty, object value, PropertyValueAction propertyValueAction)
1892TextPointer nextRunPosition = run.ElementEnd.GetPositionAtOffset(0, LogicalDirection.Forward);
1943private static void SetStructuralInlineProperty(TextPointer start, TextPointer end, DependencyProperty formattingProperty, object value)
1945DependencyObject commonAncestor = TextPointer.GetCommonAncestor(start, end);
2050TextPointer end = SplitFormattingElements(child.ElementEnd, /*keepEmptyFormatting*/false, limit);
2076private static Run GetNextRun(TextPointer pointer, TextPointer limit)
2106private static void ClearPropertyValueFromSpansAndRuns(TextPointer start, TextPointer end, DependencyProperty formattingProperty)
2131private static void ApplyStructuralInlinePropertyAcrossRun(TextPointer start, TextPointer end, Run run, DependencyProperty formattingProperty, object value)
2156private static void ApplyStructuralInlinePropertyAcrossInline(TextPointer start, TextPointer end, TextElement commonAncestor, DependencyProperty formattingProperty, object value)
2213private static void ApplyStructuralInlinePropertyAcrossParagraphs(TextPointer start, TextPointer end, DependencyProperty formattingProperty, object value)
2253private static bool ValidateApplyStructuralInlineProperty(TextPointer start, TextPointer end, DependencyObject commonAncestor, DependencyProperty property)
System\Windows\Documents\TextRangeEditTables.cs (58)
46if (!(range.Start is TextPointer))
54if (table != GetTableFromPosition((TextPointer)range.TextSegments[0].Start))
59TableCell firstCell = GetTableCellFromPosition((TextPointer)range.TextSegments[0].Start);
66TextPointer lastCellPointer = (TextPointer)range.TextSegments[0].End.GetNextInsertionPosition(LogicalDirection.Backward);
107internal static Table GetTableFromPosition(TextPointer position)
119private static TableRow GetTableRowFromPosition(TextPointer position)
131internal static TableCell GetTableCellFromPosition(TextPointer position)
179if (!(anchorPosition is TextPointer) || !(movingPosition is TextPointer))
194TextPointer)anchorPosition, (TextPointer)movingPosition,
225TextPointer anchorPosition, TextPointer movingPosition,
280TextPointer anchorPosition, TextPointer movingPosition,
371TextPointer anchorPosition, TextPointer movingPosition,
427internal static TextPointer GetNextTableCellRangeInsertionPosition(TextSelection selection, LogicalDirection direction)
431TextPointer movingPosition = selection.MovingPosition;
437if (TextRangeEditTables.IsTableCellRange(selection.AnchorPosition, (TextPointer)movingPosition,
557internal static TextPointer GetNextRowEndMovingPosition(TextSelection selection, LogicalDirection direction)
575Invariant.Assert(((ITextSelection)selection).Start is TextPointer);
586internal static TextPointer GetNextRowStartMovingPosition(TextSelection selection, LogicalDirection direction)
589Invariant.Assert(((ITextSelection)selection).Start is TextPointer);
627internal static Table InsertTable(TextPointer insertionPosition, int rowCount, int columnCount)
710internal static TextPointer EnsureInsertionPosition(TextPointer position)
776internal static TextPointer GetAdjustedRowEndPosition(Table currentTable, TextPointer rowEndPosition)
778TextPointer position;
781TextPointer nextInsertionPosition = rowEndPosition;
809private static TextPointer CreateInsertionPositionInIncompleteContent(TextPointer position)
874TextPointer insertionPosition;
889private static TextPointer CreateImplicitRun(TextPointer position)
891TextPointer insertionPosition;
916private static TextPointer CreateImplicitParagraph(TextPointer position)
918TextPointer insertionPosition;
937internal static void DeleteContent(TextPointer start, TextPointer end)
943TextPointer whatWasEnd = end;
1077TableCell cell = GetTableCellFromPosition((TextPointer)textSegment.Start);
1078TextPointer end = ((TextPointer)textSegment.End).GetNextInsertionPosition(LogicalDirection.Backward);
1084TextPointer cellEnd = cell.ElementEnd;
1123TextPointer currentRowPosition = rowCount > 0 ? textRange.End : textRange.Start;
1961private static TextSegment NewNormalizedTextSegment(TextPointer startPosition, TextPointer endPosition)
1991TextPointer start = startCell.ContentStart.GetInsertionPosition(LogicalDirection.Forward);
1995TextPointer end = endCell.ContentEnd.GetNextInsertionPosition(LogicalDirection.Forward);
2044TextPointer anchorPosition, TextPointer movingPosition,
2130TextPointer anchorPosition, TextPointer movingPosition,
2169TextPointer position,
System\Windows\Documents\TextRangeSerialization.cs (19)
591if (elementTypeStandardized == typeof(Table) && textReader is TextPointer)
594WriteTableColumnsInformation(range, (Table)((TextPointer)textReader).Parent, xmlWriter, xamlTypeMapper);
696WriteInheritablePropertiesForFlowDocument((DependencyObject)((TextPointer)context).Parent, xmlWriter, complexProperties);
949TextPointer textPointer = context as TextPointer;
1260TextPointer insertionPosition = TextRangeEditTables.EnsureInsertionPosition(range.End);
1293private static void PasteMergeableTextFragment(TextElement fragment, TextRange range, TextPointer insertionPosition)
1295TextPointer fragmentStart;
1296TextPointer fragmentEnd;
1403private static bool SplitParagraphForPasting(ref TextPointer insertionPosition)
1411TextPointer positionBeforeParagraph = insertionPosition;
1451private static void MergeParagraphsAtPosition(TextPointer position, bool mergingOnFragmentStart)
1453TextPointer navigator = position;
1506private static void ValidateMergingPositions(Type itemType, TextPointer start, TextPointer end)
1554private static void ApplyContextualProperties(TextPointer start, TextPointer end, TextElement propertyBag)
1597private static void ApplyContextualProperty(Type targetType, TextPointer start, TextPointer end, DependencyProperty property, object value)