System\Windows\Controls\TextBox.cs (34)
166TextPointer newStart = this.TextContainer.CreatePointerAtOffset(start, LogicalDirection.Forward);
178TextPointer newEnd = new TextPointer(newStart, length, LogicalDirection.Forward);
194this.TextContainer.DeleteContentInternal((TextPointer)this.TextContainer.Start, (TextPointer)this.TextContainer.End);
213TextPointer textPointer = GetTextPositionFromPointInternal(point, snapToText);
244TextPointer textPointer = GetStartPositionOfLine(lineIndex);
269TextPointer position = this.TextContainer.CreatePointerAtOffset(charIndex, LogicalDirection.Forward);
299TextPointer textPointerStart = GetStartPositionOfLine(lineIndex);
300TextPointer textPointerEnd = GetEndPositionOfLine(lineIndex);
375TextPointer textPointer = GetStartPositionOfLine(lineIndex);
392TextPointer startOfLine;
393TextPointer endOfLine;
444TextPointer textPointer = TextContainer.CreatePointerAtOffset(charIndex, LogicalDirection.Backward);
484TextPointer position = this.TextContainer.CreatePointerAtOffset(charIndex, LogicalDirection.Forward);
816TextPointer newEnd = new TextPointer(TextSelectionInternal.Start, value, LogicalDirection.Forward);
860TextPointer newStart = TextContainer.CreatePointerAtOffset(value, LogicalDirection.Forward);
872TextPointer newEnd = new TextPointer(newStart, selectionLength, LogicalDirection.Forward);
1078return new RangeContentEnumerator((TextPointer)this.TextContainer.Start, (TextPointer)this.TextContainer.End);
1350internal TextPointer StartPosition
1354return (TextPointer)this.TextContainer.Start;
1361internal TextPointer EndPosition
1365return (TextPointer)this.TextContainer.End;
1409private bool GetRectangleFromTextPositionInternal(TextPointer position, bool relativeToTextBox, out Rect rect)
1430private TextPointer GetStartPositionOfLine(int lineIndex)
1444TextPointer textPointer;
1448textPointer = (TextPointer)TextEditor.GetTextView(this.RenderScope).GetTextPositionFromPoint(point, /* snap to text */ true);
1449textPointer = (TextPointer)TextEditor.GetTextView(this.RenderScope).GetLineRange(textPointer).Start.CreatePointer(textPointer.LogicalDirection);
1459private TextPointer GetEndPositionOfLine(int lineIndex)
1473TextPointer textPointer;
1477textPointer = (TextPointer)TextEditor.GetTextView(this.RenderScope).GetTextPositionFromPoint(point, /* snap to text */ true);
1478textPointer = (TextPointer)TextEditor.GetTextView(this.RenderScope).GetLineRange(textPointer).End.CreatePointer(textPointer.LogicalDirection);
1660TextContainer.DeleteContentInternal((TextPointer)TextContainer.Start, (TextPointer)TextContainer.End);
System\Windows\Documents\TextContainer.cs (56)
214internal void SetValue(TextPointer position, DependencyProperty property, object value)
255internal void SetValues(TextPointer position, LocalValueEnumerator values)
442internal TextPointer CreatePointerAtOffset(int offset, LogicalDirection direction)
465internal TextPointer CreatePointerAtCharOffset(int charOffset, LogicalDirection direction)
519context = TextPointer.GetPointerContextForward(node, edge);
524context = TextPointer.GetPointerContextBackward(node, edge);
544offset = TextPointer.GetSymbolOffset(this, node, node.GetEdgeFromOffsetNoBias(nodeOffset));
564textNode = TextPointer.GetAdjacentTextNodeSibling(node, node.GetEdgeFromOffsetNoBias(nodeOffset), direction);
568return textNode == null ? 0 : TextPointer.GetTextInRun(this, textNode.GetSymbolOffset(this.Generation), textNode, nodeOffset, direction, textBuffer, startIndex, count);
583adjacentElement = TextPointer.GetAdjacentElement(node, node.GetEdgeFromOffset(nodeOffset, direction), direction);
601scopingNode = TextPointer.GetScopingNode(node, node.GetEdgeFromOffsetNoBias(nodeOffset));
653moved = TextPointer.GetNextNodeAndEdge(node, edge, this.PlainTextOnly, out node, out edge);
658moved = TextPointer.GetPreviousNodeAndEdge(node, edge, this.PlainTextOnly, out node, out edge);
759internal void AddChange(TextPointer startPosition, int symbolCount, int charCount, PrecursorTextChangeType textChange)
766internal void AddChange(TextPointer startPosition, int symbolCount, int charCount, PrecursorTextChangeType textChange, DependencyProperty property, bool affectsRenderOnly)
777internal void AddChange(TextPointer startPosition, TextPointer endPosition,
822internal void InsertTextInternal(TextPointer position, object text)
826TextPointer originalPosition;
937internal void InsertElementInternal(TextPointer startPosition, TextPointer endPosition, TextElement element)
942TextPointer startEdgePosition;
943TextPointer endEdgePosition;
1172internal void InsertEmbeddedObjectInternal(TextPointer position, DependencyObject embeddedObject)
1177TextPointer insertPosition;
1219internal void DeleteContentInternal(TextPointer startPosition, TextPointer endPosition)
1225TextPointer deletePosition;
1587internal bool IsAtCaretUnitBoundary(TextPointer position)
1605TextPointer positionForwardGravity = position.GetPositionAtOffset(0, LogicalDirection.Forward);
1629internal TextPointer Start
1633TextPointer startPosition;
1660internal TextPointer End
1664TextPointer endPosition;
2233private int InsertElementToSiblingTree(TextPointer startPosition, TextPointer endPosition, TextTreeTextElementNode elementNode)
2267private int InsertElementToSiblingTreeComplex(TextPointer startPosition, TextPointer endPosition, TextTreeTextElementNode elementNode,
2297private int DeleteContentFromSiblingTree(SplayTreeNode containingNode, TextPointer startPosition, TextPointer endPosition, bool newFirstIMEVisibleNode, out int charCount)
2421private int CutTopLevelLogicalNodes(TextTreeNode containingNode, TextPointer startPosition, TextPointer endPosition, out int charCount)
2431TextPointer newTreeStart;
2623private int CutContent(TextPointer startPosition, TextPointer endPosition, out int charCount, out SplayTreeNode leftSubTree, out SplayTreeNode middleSubTree, out SplayTreeNode rightSubTree)
2772TextPointer startPosition;
2773TextPointer endPosition;
3254private void ValidateSetValue(TextPointer position)
3359private void FireChangeEvent(TextPointer startPosition, TextPointer endPosition, int symbolCount,
3418private TextTreeTextElementNode GetNextIMEVisibleNode(TextPointer startPosition, TextPointer endPosition)
3436TextPointer startEdgePosition = new TextPointer(this, node, ElementEdge.BeforeStart);
3448TextPointer startEdgePosition = new TextPointer(this, node, ElementEdge.BeforeStart);
3512internal ExtractChangeEventArgs(TextContainer textTree, TextPointer startPosition, TextTreeTextElementNode node,
3582private readonly TextPointer _startPosition;
System\Windows\Documents\TextPointer.cs (63)
41/// a <see cref="TextPointer.GetOffsetToPosition"/> method).</para>
45/// <see cref="TextPointer.LogicalDirection"/> property.</para>
51/// get from a TextPointer using method <see cref="TextPointer.GetPointerContext"/>.</para>
67/// using traversal methods like <see cref="TextPointer.GetNextContextPosition"/>,
68/// <see cref="TextPointer.GetNextInsertionPosition"/>, <see cref="TextPointer.GetPositionAtOffset(int)"/>,
260internal TextPointer(TextPointer textPointer)
268internal TextPointer(TextPointer position, int offset)
276internal TextPointer(TextPointer position, LogicalDirection direction)
282internal TextPointer(TextPointer position, int offset, LogicalDirection direction)
316internal TextPointer CreatePointer()
322internal TextPointer CreatePointer(LogicalDirection gravity)
435public bool IsInSameDocument(TextPointer textPosition)
457/// text container as this TextPointer (you can use <see cref="TextPointer.IsInSameDocument"/>
460public int CompareTo(TextPointer position)
680public int GetOffsetToPosition(TextPointer position)
873public TextPointer GetPositionAtOffset(int offset)
900/// <para>See examples in <seealso cref="TextPointer.GetPositionAtOffset(int)"/> method with one parameter.</para>
902public TextPointer GetPositionAtOffset(int offset, LogicalDirection direction)
904TextPointer position = new TextPointer(this, direction);
990public TextPointer GetNextContextPosition(LogicalDirection direction)
992return (TextPointer)((ITextPointer)this).GetNextContextPosition(direction);
1063public TextPointer GetInsertionPosition(LogicalDirection direction)
1065return (TextPointer)((ITextPointer)this).GetInsertionPosition(direction);
1069internal TextPointer GetInsertionPosition()
1090/// "insertion position" in the <see cref="TextPointer.GetInsertionPosition(LogicalDirection)"/>
1130public TextPointer GetNextInsertionPosition(LogicalDirection direction)
1132return (TextPointer)((ITextPointer)this).GetNextInsertionPosition(direction);
1172public TextPointer GetLineStartPosition(int count)
1176TextPointer lineStartPosition = GetLineStartPosition(count, out actualCount);
1212public TextPointer GetLineStartPosition(int count, out int actualCount)
1216TextPointer position = new TextPointer(this);
1282TextPointer insertPosition;
1346TextPointer deleteToPosition = new TextPointer(this, count);
1418public TextPointer InsertParagraphBreak()
1440TextPointer position;
1463public TextPointer InsertLineBreak()
1468TextPointer position;
1614TextPointer position = new TextPointer(this);
1625if (position.CompareTo((TextPointer)lineRange.Start) <= 0)
1684/// <para>The <see cref="TextPointer.Parent"/> property for this
1689public TextPointer DocumentStart
1701/// <para>The <see cref="TextPointer.Parent"/> property for this
1706public TextPointer DocumentEnd
1854internal void MoveToPosition(TextPointer textPosition)
2339internal TextPointer GetFrozenPointer(LogicalDirection logicalDirection)
2345return (TextPointer)TextPointerBase.GetFrozenPointer(this, logicalDirection);
2355return CompareTo((TextPointer)position);
2385return GetOffsetToPosition((TextPointer)position);
2433TextPointer textPointer;
2439textPointer = (TextPointer)position;
2614MoveToPosition((TextPointer)position);
2681TextPointer position;
2704position = (TextPointer)_tree.TextView.GetNextCaretUnitPosition(this, oppositeDirection);
2716TextPointer position;
2733position = (TextPointer)_tree.TextView.GetNextCaretUnitPosition(this, direction);
2749TextPointer position;
2764position = (TextPointer)_tree.TextView.GetBackspaceCaretUnitPosition(this);
2793TextRangeEditTables.DeleteContent(this, (TextPointer)limit);
3543TextPointer position = this;
3580internal static DependencyObject GetCommonAncestor(TextPointer position1, TextPointer position2)
3893private void InitializeOffset(TextPointer position, int distance, LogicalDirection direction)
System\Windows\Documents\TextRange.cs (27)
60public TextRange(TextPointer position1, TextPointer position2) :
82internal TextRange(TextPointer position1, TextPointer position2, bool useRestrictiveXamlXmlReader) :
386return _textSegments[0].Start is TextPointer;
652public bool Contains(TextPointer textPointer)
683public void Select(TextPointer position1, TextPointer position2)
698internal void SelectWord(TextPointer textPointer)
1265public TextPointer Start
1269return (TextPointer)((ITextRange)this).Start;
1279public TextPointer End
1283return (TextPointer)((ITextRange)this).End;
1318return ((TextPointer)this.Start).ContainingFrameworkElement;
1587TextPointer startPosition = TextRangeEditTables.EnsureInsertionPosition(this.Start);
1612TextPointer insertionPosition = TextRangeEdit.SplitFormattingElements(this.Start, /*keepEmptyFormatting:*/false);
1644TextRangeEdit.SetParagraphProperty((TextPointer)textSegment.Start, (TextPointer)textSegment.End, formattingProperty, value, propertyValueAction);
1648TextRangeEdit.SetInlineProperty((TextPointer)textSegment.Start, (TextPointer)textSegment.End, formattingProperty, value, propertyValueAction);
1653TextRangeEdit.SetInlineProperty((TextPointer)textSegment.Start, (TextPointer)textSegment.End, formattingProperty, value, propertyValueAction);
1670TextRangeEdit.SetParagraphProperty((TextPointer)textSegment.Start, (TextPointer)textSegment.End, formattingProperty, value, propertyValueAction);
1687TextRangeEdit.CharacterResetFormatting((TextPointer)this.Start, (TextPointer)this.End);
1707return TextRangeEditTables.InsertTable((TextPointer)this.End, rowCount, columnCount);
System\Windows\Documents\TextRangeEdit.cs (76)
31internal static TextElement InsertElementClone(TextPointer start, TextPointer end, TextElement element)
51internal static TextPointer SplitFormattingElements(TextPointer splitPosition, bool keepEmptyFormatting)
56internal static TextPointer SplitFormattingElement(TextPointer splitPosition, bool keepEmptyFormatting)
164private static bool ExtractEmptyFormattingElements(TextPointer position)
228internal static void SetInlineProperty(TextPointer start, TextPointer end, DependencyProperty formattingProperty, object value, PropertyValueAction propertyValueAction)
256internal static bool MergeFormattingInlines(TextPointer position)
323private static void RemoveUnnecessarySpans(TextPointer position)
409internal static void CharacterResetFormatting(TextPointer start, TextPointer end)
437TextPointer mergePosition = parent.ElementStart;
524internal static TextPointer SplitElement(TextPointer position)
592internal static TextPointer InsertParagraphBreak(TextPointer position, bool moveIntoSecondParagraph)
635TextPointer breakPosition = position;
680internal static TextPointer InsertLineBreak(TextPointer position)
719internal static void SetParagraphProperty(TextPointer start, TextPointer end, DependencyProperty property, object value)
742internal static void SetParagraphProperty(TextPointer start, TextPointer end, DependencyProperty property, object value, PropertyValueAction propertyValueAction)
750end = (TextPointer)TextRangeEdit.GetAdjustedRangeEnd(start, end);
786private static void SetParagraphPropertyWorker(TextPointer start, TextPointer end, DependencyProperty property, object value, PropertyValueAction propertyValueAction)
807TextPointer contentStart = block.ContentStart.GetPositionAtOffset(0, LogicalDirection.Forward); // Normalize forward;
809TextPointer contentEnd = block.ContentEnd;
969TextPointer start = firstChild.ElementStart.GetFrozenPointer(LogicalDirection.Backward);
970TextPointer end = lastChild.ElementEnd.GetFrozenPointer(LogicalDirection.Forward);
1027private static Block GetNextBlock(TextPointer pointer, TextPointer limit)
1267internal static void MergeFlowDirection(TextPointer position)
1299TextPointer previousPosition = position.CreatePointer();
1308TextPointer nextPosition = position.CreatePointer();
1345internal static bool CanApplyStructuralInlineProperty(TextPointer start, TextPointer end)
1347return ValidateApplyStructuralInlineProperty(start, end, TextPointer.GetCommonAncestor(start, end), null);
1417if (!(start is TextPointer))
1424TextPointer startPosition = (TextPointer)start;
1425TextPointer endPosition = (TextPointer)end;
1512private static void MergeEmptyParagraphsAndBlockUIContainers(TextPointer startPosition, TextPointer endPosition)
1562private static void DeleteEquiScopedContent(TextPointer start, TextPointer end)
1606TextPointer previousPosition = new TextPointer(start);
1610TextPointer nextPosition = new TextPointer(start);
1689private static bool DeleteContentBetweenPositions(TextPointer one, TextPointer two)
1717private static TextPointer SplitFormattingElements(TextPointer splitPosition, bool keepEmptyFormatting, TextElement limitingAncestor)
1748private static TextPointer SplitFormattingElements(TextPointer splitPosition, bool keepEmptyFormatting, bool preserveStructuralFormatting, TextElement limitingAncestor)
1871private static void SetNonStructuralInlineProperty(TextPointer start, TextPointer end, DependencyProperty formattingProperty, object value, PropertyValueAction propertyValueAction)
1895TextPointer nextRunPosition = run.ElementEnd.GetPositionAtOffset(0, LogicalDirection.Forward);
1946private static void SetStructuralInlineProperty(TextPointer start, TextPointer end, DependencyProperty formattingProperty, object value)
1948DependencyObject commonAncestor = TextPointer.GetCommonAncestor(start, end);
2053TextPointer end = SplitFormattingElements(child.ElementEnd, /*keepEmptyFormatting*/false, limit);
2079private static Run GetNextRun(TextPointer pointer, TextPointer limit)
2109private static void ClearPropertyValueFromSpansAndRuns(TextPointer start, TextPointer end, DependencyProperty formattingProperty)
2134private static void ApplyStructuralInlinePropertyAcrossRun(TextPointer start, TextPointer end, Run run, DependencyProperty formattingProperty, object value)
2159private static void ApplyStructuralInlinePropertyAcrossInline(TextPointer start, TextPointer end, TextElement commonAncestor, DependencyProperty formattingProperty, object value)
2216private static void ApplyStructuralInlinePropertyAcrossParagraphs(TextPointer start, TextPointer end, DependencyProperty formattingProperty, object value)
2256private static bool ValidateApplyStructuralInlineProperty(TextPointer start, TextPointer end, DependencyObject commonAncestor, DependencyProperty property)
System\Windows\Documents\TextRangeEditTables.cs (58)
49if (!(range.Start is TextPointer))
57if (table != GetTableFromPosition((TextPointer)range.TextSegments[0].Start))
62TableCell firstCell = GetTableCellFromPosition((TextPointer)range.TextSegments[0].Start);
69TextPointer lastCellPointer = (TextPointer)range.TextSegments[0].End.GetNextInsertionPosition(LogicalDirection.Backward);
110internal static Table GetTableFromPosition(TextPointer position)
122private static TableRow GetTableRowFromPosition(TextPointer position)
134internal static TableCell GetTableCellFromPosition(TextPointer position)
182if (!(anchorPosition is TextPointer) || !(movingPosition is TextPointer))
197TextPointer)anchorPosition, (TextPointer)movingPosition,
228TextPointer anchorPosition, TextPointer movingPosition,
283TextPointer anchorPosition, TextPointer movingPosition,
374TextPointer anchorPosition, TextPointer movingPosition,
430internal static TextPointer GetNextTableCellRangeInsertionPosition(TextSelection selection, LogicalDirection direction)
434TextPointer movingPosition = selection.MovingPosition;
440if (TextRangeEditTables.IsTableCellRange(selection.AnchorPosition, (TextPointer)movingPosition,
560internal static TextPointer GetNextRowEndMovingPosition(TextSelection selection, LogicalDirection direction)
578Invariant.Assert(((ITextSelection)selection).Start is TextPointer);
589internal static TextPointer GetNextRowStartMovingPosition(TextSelection selection, LogicalDirection direction)
592Invariant.Assert(((ITextSelection)selection).Start is TextPointer);
630internal static Table InsertTable(TextPointer insertionPosition, int rowCount, int columnCount)
709internal static TextPointer EnsureInsertionPosition(TextPointer position)
775internal static TextPointer GetAdjustedRowEndPosition(Table currentTable, TextPointer rowEndPosition)
777TextPointer position;
780TextPointer nextInsertionPosition = rowEndPosition;
808private static TextPointer CreateInsertionPositionInIncompleteContent(TextPointer position)
873TextPointer insertionPosition;
888private static TextPointer CreateImplicitRun(TextPointer position)
890TextPointer insertionPosition;
915private static TextPointer CreateImplicitParagraph(TextPointer position)
917TextPointer insertionPosition;
936internal static void DeleteContent(TextPointer start, TextPointer end)
942TextPointer whatWasEnd = end;
1076TableCell cell = GetTableCellFromPosition((TextPointer)textSegment.Start);
1077TextPointer end = ((TextPointer)textSegment.End).GetNextInsertionPosition(LogicalDirection.Backward);
1083TextPointer cellEnd = cell.ElementEnd;
1122TextPointer currentRowPosition = rowCount > 0 ? textRange.End : textRange.Start;
1960private static TextSegment NewNormalizedTextSegment(TextPointer startPosition, TextPointer endPosition)
1990TextPointer start = startCell.ContentStart.GetInsertionPosition(LogicalDirection.Forward);
1994TextPointer end = endCell.ContentEnd.GetNextInsertionPosition(LogicalDirection.Forward);
2043TextPointer anchorPosition, TextPointer movingPosition,
2129TextPointer anchorPosition, TextPointer movingPosition,
2168TextPointer position,
System\Windows\Documents\TextRangeSerialization.cs (19)
598if (elementTypeStandardized == typeof(Table) && textReader is TextPointer)
601WriteTableColumnsInformation(range, (Table)((TextPointer)textReader).Parent, xmlWriter, xamlTypeMapper);
703WriteInheritablePropertiesForFlowDocument((DependencyObject)((TextPointer)context).Parent, xmlWriter, complexProperties);
956TextPointer textPointer = context as TextPointer;
1267TextPointer insertionPosition = TextRangeEditTables.EnsureInsertionPosition(range.End);
1300private static void PasteMergeableTextFragment(TextElement fragment, TextRange range, TextPointer insertionPosition)
1302TextPointer fragmentStart;
1303TextPointer fragmentEnd;
1410private static bool SplitParagraphForPasting(ref TextPointer insertionPosition)
1418TextPointer positionBeforeParagraph = insertionPosition;
1458private static void MergeParagraphsAtPosition(TextPointer position, bool mergingOnFragmentStart)
1460TextPointer navigator = position;
1513private static void ValidateMergingPositions(Type itemType, TextPointer start, TextPointer end)
1561private static void ApplyContextualProperties(TextPointer start, TextPointer end, TextElement propertyBag)
1604private static void ApplyContextualProperty(Type targetType, TextPointer start, TextPointer end, DependencyProperty property, object value)