src\Framework\System\Windows\Controls\TextBox.cs (34)
179TextPointer newStart = this.TextContainer.CreatePointerAtOffset(start, LogicalDirection.Forward);
191TextPointer newEnd = new TextPointer(newStart, length, LogicalDirection.Forward);
207this.TextContainer.DeleteContentInternal((TextPointer)this.TextContainer.Start, (TextPointer)this.TextContainer.End);
226TextPointer textPointer = GetTextPositionFromPointInternal(point, snapToText);
259TextPointer textPointer = GetStartPositionOfLine(lineIndex);
286TextPointer position = this.TextContainer.CreatePointerAtOffset(charIndex, LogicalDirection.Forward);
318TextPointer textPointerStart = GetStartPositionOfLine(lineIndex);
319TextPointer textPointerEnd = GetEndPositionOfLine(lineIndex);
396TextPointer textPointer = GetStartPositionOfLine(lineIndex);
413TextPointer startOfLine;
414TextPointer endOfLine;
469TextPointer textPointer = TextContainer.CreatePointerAtOffset(charIndex, LogicalDirection.Backward);
511TextPointer position = this.TextContainer.CreatePointerAtOffset(charIndex, LogicalDirection.Forward);
848TextPointer newEnd = new TextPointer(TextSelectionInternal.Start, value, LogicalDirection.Forward);
895TextPointer newStart = TextContainer.CreatePointerAtOffset(value, LogicalDirection.Forward);
907TextPointer newEnd = new TextPointer(newStart, selectionLength, LogicalDirection.Forward);
1069return new RangeContentEnumerator((TextPointer)this.TextContainer.Start, (TextPointer)this.TextContainer.End);
1342internal TextPointer StartPosition
1346return (TextPointer)this.TextContainer.Start;
1353internal TextPointer EndPosition
1357return (TextPointer)this.TextContainer.End;
1401private bool GetRectangleFromTextPositionInternal(TextPointer position, bool relativeToTextBox, out Rect rect)
1422private TextPointer GetStartPositionOfLine(int lineIndex)
1436TextPointer textPointer;
1440textPointer = (TextPointer)TextEditor.GetTextView(this.RenderScope).GetTextPositionFromPoint(point, /* snap to text */ true);
1441textPointer = (TextPointer)TextEditor.GetTextView(this.RenderScope).GetLineRange(textPointer).Start.CreatePointer(textPointer.LogicalDirection);
1451private TextPointer GetEndPositionOfLine(int lineIndex)
1465TextPointer textPointer;
1469textPointer = (TextPointer)TextEditor.GetTextView(this.RenderScope).GetTextPositionFromPoint(point, /* snap to text */ true);
1470textPointer = (TextPointer)TextEditor.GetTextView(this.RenderScope).GetLineRange(textPointer).End.CreatePointer(textPointer.LogicalDirection);
1653TextContainer.DeleteContentInternal((TextPointer)TextContainer.Start, (TextPointer)TextContainer.End);
src\Framework\System\Windows\Documents\TextContainer.cs (56)
220internal void SetValue(TextPointer position, DependencyProperty property, object value)
267internal void SetValues(TextPointer position, LocalValueEnumerator values)
457internal TextPointer CreatePointerAtOffset(int offset, LogicalDirection direction)
480internal TextPointer CreatePointerAtCharOffset(int charOffset, LogicalDirection direction)
534context = TextPointer.GetPointerContextForward(node, edge);
539context = TextPointer.GetPointerContextBackward(node, edge);
559offset = TextPointer.GetSymbolOffset(this, node, node.GetEdgeFromOffsetNoBias(nodeOffset));
579textNode = TextPointer.GetAdjacentTextNodeSibling(node, node.GetEdgeFromOffsetNoBias(nodeOffset), direction);
583return textNode == null ? 0 : TextPointer.GetTextInRun(this, textNode.GetSymbolOffset(this.Generation), textNode, nodeOffset, direction, textBuffer, startIndex, count);
598adjacentElement = TextPointer.GetAdjacentElement(node, node.GetEdgeFromOffset(nodeOffset, direction), direction);
616scopingNode = TextPointer.GetScopingNode(node, node.GetEdgeFromOffsetNoBias(nodeOffset));
668moved = TextPointer.GetNextNodeAndEdge(node, edge, this.PlainTextOnly, out node, out edge);
673moved = TextPointer.GetPreviousNodeAndEdge(node, edge, this.PlainTextOnly, out node, out edge);
774internal void AddChange(TextPointer startPosition, int symbolCount, int charCount, PrecursorTextChangeType textChange)
781internal void AddChange(TextPointer startPosition, int symbolCount, int charCount, PrecursorTextChangeType textChange, DependencyProperty property, bool affectsRenderOnly)
792internal void AddChange(TextPointer startPosition, TextPointer endPosition,
837internal void InsertTextInternal(TextPointer position, object text)
841TextPointer originalPosition;
952internal void InsertElementInternal(TextPointer startPosition, TextPointer endPosition, TextElement element)
957TextPointer startEdgePosition;
958TextPointer endEdgePosition;
1187internal void InsertEmbeddedObjectInternal(TextPointer position, DependencyObject embeddedObject)
1192TextPointer insertPosition;
1234internal void DeleteContentInternal(TextPointer startPosition, TextPointer endPosition)
1240TextPointer deletePosition;
1602internal bool IsAtCaretUnitBoundary(TextPointer position)
1620TextPointer positionForwardGravity = position.GetPositionAtOffset(0, LogicalDirection.Forward);
1644internal TextPointer Start
1648TextPointer startPosition;
1675internal TextPointer End
1679TextPointer endPosition;
2248private int InsertElementToSiblingTree(TextPointer startPosition, TextPointer endPosition, TextTreeTextElementNode elementNode)
2282private int InsertElementToSiblingTreeComplex(TextPointer startPosition, TextPointer endPosition, TextTreeTextElementNode elementNode,
2312private int DeleteContentFromSiblingTree(SplayTreeNode containingNode, TextPointer startPosition, TextPointer endPosition, bool newFirstIMEVisibleNode, out int charCount)
2436private int CutTopLevelLogicalNodes(TextTreeNode containingNode, TextPointer startPosition, TextPointer endPosition, out int charCount)
2446TextPointer newTreeStart;
2638private int CutContent(TextPointer startPosition, TextPointer endPosition, out int charCount, out SplayTreeNode leftSubTree, out SplayTreeNode middleSubTree, out SplayTreeNode rightSubTree)
2787TextPointer startPosition;
2788TextPointer endPosition;
3270private void ValidateSetValue(TextPointer position)
3375private void FireChangeEvent(TextPointer startPosition, TextPointer endPosition, int symbolCount,
3434private TextTreeTextElementNode GetNextIMEVisibleNode(TextPointer startPosition, TextPointer endPosition)
3452TextPointer startEdgePosition = new TextPointer(this, node, ElementEdge.BeforeStart);
3464TextPointer startEdgePosition = new TextPointer(this, node, ElementEdge.BeforeStart);
3528internal ExtractChangeEventArgs(TextContainer textTree, TextPointer startPosition, TextTreeTextElementNode node,
3598private readonly TextPointer _startPosition;
src\Framework\System\Windows\Documents\TextPointer.cs (57)
43/// a <see cref="TextPointer.GetOffsetToPosition"/> method).</para>
47/// <see cref="TextPointer.LogicalDirection"/> property.</para>
53/// get from a TextPointer using method <see cref="TextPointer.GetPointerContext"/>.</para>
69/// using traversal methods like <see cref="TextPointer.GetNextContextPosition"/>,
70/// <see cref="TextPointer.GetNextInsertionPosition"/>, <see cref="TextPointer.GetPositionAtOffset(int)"/>,
262internal TextPointer(TextPointer textPointer)
273internal TextPointer(TextPointer position, int offset)
284internal TextPointer(TextPointer position, LogicalDirection direction)
290internal TextPointer(TextPointer position, int offset, LogicalDirection direction)
324internal TextPointer CreatePointer()
330internal TextPointer CreatePointer(LogicalDirection gravity)
443public bool IsInSameDocument(TextPointer textPosition)
468/// text container as this TextPointer (you can use <see cref="TextPointer.IsInSameDocument"/>
471public int CompareTo(TextPointer position)
691public int GetOffsetToPosition(TextPointer position)
884public TextPointer GetPositionAtOffset(int offset)
911/// <para>See examples in <seealso cref="TextPointer.GetPositionAtOffset(int)"/> method with one parameter.</para>
913public TextPointer GetPositionAtOffset(int offset, LogicalDirection direction)
915TextPointer position = new TextPointer(this, direction);
1001public TextPointer GetNextContextPosition(LogicalDirection direction)
1003return (TextPointer)((ITextPointer)this).GetNextContextPosition(direction);
1074public TextPointer GetInsertionPosition(LogicalDirection direction)
1076return (TextPointer)((ITextPointer)this).GetInsertionPosition(direction);
1080internal TextPointer GetInsertionPosition()
1101/// "insertion position" in the <see cref="TextPointer.GetInsertionPosition(LogicalDirection)"/>
1141public TextPointer GetNextInsertionPosition(LogicalDirection direction)
1143return (TextPointer)((ITextPointer)this).GetNextInsertionPosition(direction);
1183public TextPointer GetLineStartPosition(int count)
1187TextPointer lineStartPosition = GetLineStartPosition(count, out actualCount);
1223public TextPointer GetLineStartPosition(int count, out int actualCount)
1227TextPointer position = new TextPointer(this);
1296TextPointer insertPosition;
1360TextPointer deleteToPosition = new TextPointer(this, count);
1432public TextPointer InsertParagraphBreak()
1454TextPointer position;
1477public TextPointer InsertLineBreak()
1482TextPointer position;
1628TextPointer position = new TextPointer(this);
1639if (position.CompareTo((TextPointer)lineRange.Start) <= 0)
1698/// <para>The <see cref="TextPointer.Parent"/> property for this
1703public TextPointer DocumentStart
1715/// <para>The <see cref="TextPointer.Parent"/> property for this
1720public TextPointer DocumentEnd
1871internal void MoveToPosition(TextPointer textPosition)
2359internal TextPointer GetFrozenPointer(LogicalDirection logicalDirection)
2365return (TextPointer)TextPointerBase.GetFrozenPointer(this, logicalDirection);
2375return CompareTo((TextPointer)position);
2405return GetOffsetToPosition((TextPointer)position);
2453TextPointer textPointer;
2459textPointer = (TextPointer)position;
2640MoveToPosition((TextPointer)position);
2819TextRangeEditTables.DeleteContent(this, (TextPointer)limit);
3569TextPointer position = this;
3606internal static DependencyObject GetCommonAncestor(TextPointer position1, TextPointer position2)
3919private void InitializeOffset(TextPointer position, int distance, LogicalDirection direction)
src\Framework\System\Windows\Documents\TextRange.cs (25)
62public TextRange(TextPointer position1, TextPointer position2) :
376return _textSegments[0].Start is TextPointer;
642public bool Contains(TextPointer textPointer)
673public void Select(TextPointer position1, TextPointer position2)
688internal 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);
src\Framework\System\Windows\Documents\TextRangeEdit.cs (76)
33internal static TextElement InsertElementClone(TextPointer start, TextPointer end, TextElement element)
53internal static TextPointer SplitFormattingElements(TextPointer splitPosition, bool keepEmptyFormatting)
58internal static TextPointer SplitFormattingElement(TextPointer splitPosition, bool keepEmptyFormatting)
166private static bool ExtractEmptyFormattingElements(TextPointer position)
230internal static void SetInlineProperty(TextPointer start, TextPointer end, DependencyProperty formattingProperty, object value, PropertyValueAction propertyValueAction)
258internal static bool MergeFormattingInlines(TextPointer position)
325private static void RemoveUnnecessarySpans(TextPointer position)
411internal static void CharacterResetFormatting(TextPointer start, TextPointer end)
439TextPointer mergePosition = parent.ElementStart;
526internal static TextPointer SplitElement(TextPointer position)
594internal static TextPointer InsertParagraphBreak(TextPointer position, bool moveIntoSecondParagraph)
637TextPointer breakPosition = position;
682internal static TextPointer InsertLineBreak(TextPointer position)
721internal static void SetParagraphProperty(TextPointer start, TextPointer end, DependencyProperty property, object value)
744internal static void SetParagraphProperty(TextPointer start, TextPointer end, DependencyProperty property, object value, PropertyValueAction propertyValueAction)
752end = (TextPointer)TextRangeEdit.GetAdjustedRangeEnd(start, end);
788private static void SetParagraphPropertyWorker(TextPointer start, TextPointer end, DependencyProperty property, object value, PropertyValueAction propertyValueAction)
809TextPointer contentStart = block.ContentStart.GetPositionAtOffset(0, LogicalDirection.Forward); // Normalize forward;
811TextPointer contentEnd = block.ContentEnd;
971TextPointer start = firstChild.ElementStart.GetFrozenPointer(LogicalDirection.Backward);
972TextPointer end = lastChild.ElementEnd.GetFrozenPointer(LogicalDirection.Forward);
1029private static Block GetNextBlock(TextPointer pointer, TextPointer limit)
1269internal static void MergeFlowDirection(TextPointer position)
1301TextPointer previousPosition = position.CreatePointer();
1310TextPointer nextPosition = position.CreatePointer();
1347internal static bool CanApplyStructuralInlineProperty(TextPointer start, TextPointer end)
1349return ValidateApplyStructuralInlineProperty(start, end, TextPointer.GetCommonAncestor(start, end), null);
1419if (!(start is TextPointer))
1426TextPointer startPosition = (TextPointer)start;
1427TextPointer endPosition = (TextPointer)end;
1514private static void MergeEmptyParagraphsAndBlockUIContainers(TextPointer startPosition, TextPointer endPosition)
1564private static void DeleteEquiScopedContent(TextPointer start, TextPointer end)
1608TextPointer previousPosition = new TextPointer(start);
1612TextPointer nextPosition = new TextPointer(start);
1691private static bool DeleteContentBetweenPositions(TextPointer one, TextPointer two)
1719private static TextPointer SplitFormattingElements(TextPointer splitPosition, bool keepEmptyFormatting, TextElement limitingAncestor)
1750private static TextPointer SplitFormattingElements(TextPointer splitPosition, bool keepEmptyFormatting, bool preserveStructuralFormatting, TextElement limitingAncestor)
1873private static void SetNonStructuralInlineProperty(TextPointer start, TextPointer end, DependencyProperty formattingProperty, object value, PropertyValueAction propertyValueAction)
1897TextPointer nextRunPosition = run.ElementEnd.GetPositionAtOffset(0, LogicalDirection.Forward);
1948private static void SetStructuralInlineProperty(TextPointer start, TextPointer end, DependencyProperty formattingProperty, object value)
1950DependencyObject commonAncestor = TextPointer.GetCommonAncestor(start, end);
2055TextPointer end = SplitFormattingElements(child.ElementEnd, /*keepEmptyFormatting*/false, limit);
2081private static Run GetNextRun(TextPointer pointer, TextPointer limit)
2111private static void ClearPropertyValueFromSpansAndRuns(TextPointer start, TextPointer end, DependencyProperty formattingProperty)
2136private static void ApplyStructuralInlinePropertyAcrossRun(TextPointer start, TextPointer end, Run run, DependencyProperty formattingProperty, object value)
2161private static void ApplyStructuralInlinePropertyAcrossInline(TextPointer start, TextPointer end, TextElement commonAncestor, DependencyProperty formattingProperty, object value)
2218private static void ApplyStructuralInlinePropertyAcrossParagraphs(TextPointer start, TextPointer end, DependencyProperty formattingProperty, object value)
2258private static bool ValidateApplyStructuralInlineProperty(TextPointer start, TextPointer end, DependencyObject commonAncestor, DependencyProperty property)
src\Framework\System\Windows\Documents\TextRangeEditTables.cs (58)
51if (!(range.Start is TextPointer))
59if (table != GetTableFromPosition((TextPointer)range.TextSegments[0].Start))
64TableCell firstCell = GetTableCellFromPosition((TextPointer)range.TextSegments[0].Start);
71TextPointer lastCellPointer = (TextPointer)range.TextSegments[0].End.GetNextInsertionPosition(LogicalDirection.Backward);
113internal static Table GetTableFromPosition(TextPointer position)
125private static TableRow GetTableRowFromPosition(TextPointer position)
137internal static TableCell GetTableCellFromPosition(TextPointer position)
185if (!(anchorPosition is TextPointer) || !(movingPosition is TextPointer))
200TextPointer)anchorPosition, (TextPointer)movingPosition,
231TextPointer anchorPosition, TextPointer movingPosition,
286TextPointer anchorPosition, TextPointer movingPosition,
377TextPointer anchorPosition, TextPointer movingPosition,
433internal static TextPointer GetNextTableCellRangeInsertionPosition(TextSelection selection, LogicalDirection direction)
437TextPointer movingPosition = selection.MovingPosition;
443if (TextRangeEditTables.IsTableCellRange(selection.AnchorPosition, (TextPointer)movingPosition,
563internal static TextPointer GetNextRowEndMovingPosition(TextSelection selection, LogicalDirection direction)
581Invariant.Assert(((ITextSelection)selection).Start is TextPointer);
592internal static TextPointer GetNextRowStartMovingPosition(TextSelection selection, LogicalDirection direction)
595Invariant.Assert(((ITextSelection)selection).Start is TextPointer);
633internal static Table InsertTable(TextPointer insertionPosition, int rowCount, int columnCount)
712internal static TextPointer EnsureInsertionPosition(TextPointer position)
778internal static TextPointer GetAdjustedRowEndPosition(Table currentTable, TextPointer rowEndPosition)
780TextPointer position;
783TextPointer nextInsertionPosition = rowEndPosition;
811private static TextPointer CreateInsertionPositionInIncompleteContent(TextPointer position)
876TextPointer insertionPosition;
891private static TextPointer CreateImplicitRun(TextPointer position)
893TextPointer insertionPosition;
918private static TextPointer CreateImplicitParagraph(TextPointer position)
920TextPointer insertionPosition;
939internal static void DeleteContent(TextPointer start, TextPointer end)
945TextPointer whatWasEnd = end;
1079TableCell cell = GetTableCellFromPosition((TextPointer)textSegment.Start);
1080TextPointer end = ((TextPointer)textSegment.End).GetNextInsertionPosition(LogicalDirection.Backward);
1086TextPointer cellEnd = cell.ElementEnd;
1125TextPointer currentRowPosition = rowCount > 0 ? textRange.End : textRange.Start;
1963private static TextSegment NewNormalizedTextSegment(TextPointer startPosition, TextPointer endPosition)
1993TextPointer start = startCell.ContentStart.GetInsertionPosition(LogicalDirection.Forward);
1997TextPointer end = endCell.ContentEnd.GetNextInsertionPosition(LogicalDirection.Forward);
2046TextPointer anchorPosition, TextPointer movingPosition,
2132TextPointer anchorPosition, TextPointer movingPosition,
2171TextPointer position,
src\Framework\System\Windows\Documents\TextRangeSerialization.cs (19)
604if (elementTypeStandardized == typeof(Table) && textReader is TextPointer)
607WriteTableColumnsInformation(range, (Table)((TextPointer)textReader).Parent, xmlWriter, xamlTypeMapper);
709WriteInheritablePropertiesForFlowDocument((DependencyObject)((TextPointer)context).Parent, xmlWriter, complexProperties);
963TextPointer textPointer = context as TextPointer;
1291TextPointer insertionPosition = TextRangeEditTables.EnsureInsertionPosition(range.End);
1324private static void PasteMergeableTextFragment(TextElement fragment, TextRange range, TextPointer insertionPosition)
1326TextPointer fragmentStart;
1327TextPointer fragmentEnd;
1434private static bool SplitParagraphForPasting(ref TextPointer insertionPosition)
1442TextPointer positionBeforeParagraph = insertionPosition;
1482private static void MergeParagraphsAtPosition(TextPointer position, bool mergingOnFragmentStart)
1484TextPointer navigator = position;
1537private static void ValidateMergingPositions(Type itemType, TextPointer start, TextPointer end)
1581private static void ApplyContextualProperties(TextPointer start, TextPointer end, TextElement propertyBag)
1624private static void ApplyContextualProperty(Type targetType, TextPointer start, TextPointer end, DependencyProperty property, object value)