MS\Internal\Documents\TextBoxLine.cs (8)
73switch (position.GetPointerContext(LogicalDirection.Forward))
111ITextPointer position = _owner.Host.TextContainer.CreatePointerAtOffset(dcp, LogicalDirection.Backward);
116int runLength = Math.Min(128, position.GetTextRunLength(LogicalDirection.Backward));
118position.GetTextInRun(LogicalDirection.Backward, text, 0, runLength);
423StaticTextPointer endOfRunPosition = _owner.Host.TextContainer.Highlights.GetNextPropertyChangePosition(position, LogicalDirection.Forward);
435TextDecorationCollection highlightDecorations = highlights.GetHighlightValue(position, LogicalDirection.Forward, typeof(SpellerHighlightLayer)) as TextDecorationCollection;
453&& highlights.GetHighlightValue(position, LogicalDirection.Forward, typeof(TextSelection)) != DependencyProperty.UnsetValue)
482int charactersCopied = position.GetTextInRun(LogicalDirection.Forward, textBuffer, 0, textBuffer.Length);
MS\Internal\Documents\TextBoxView.cs (53)
588if (offset > 0 && position.LogicalDirection == LogicalDirection.Backward)
612if (position.LogicalDirection == LogicalDirection.Forward || position.Offset == 0)
619if (position.LogicalDirection == LogicalDirection.Backward && position.Offset > 0)
660firstLineIndex = Math.Max(firstLineIndex, GetLineIndexFromOffset(startOffset, LogicalDirection.Forward));
661lastLineIndex = Math.Min(lastLineIndex, GetLineIndexFromOffset(endOffset, LogicalDirection.Backward));
700ITextPointer endOfLinePosition = _host.TextContainer.CreatePointerAtOffset(_lineMetrics[lineIndex].EndOffset, LogicalDirection.Backward);
701if (TextPointerBase.IsNextToPlainLineBreak(endOfLinePosition, LogicalDirection.Backward))
740nextLinePosition = _host.TextContainer.CreatePointerAtOffset(_lineMetrics[lineIndex + linesMoved].Offset, LogicalDirection.Forward);
779if (position.LogicalDirection == LogicalDirection.Forward)
784else if (position.LogicalDirection == LogicalDirection.Backward)
809ITextPointer ITextView.GetNextCaretUnitPosition(ITextPointer position, LogicalDirection direction)
815if (position.Offset == 0 && direction == LogicalDirection.Backward)
817return position.GetFrozenPointer(LogicalDirection.Forward);
819else if (position.Offset == _host.TextContainer.SymbolCount && direction == LogicalDirection.Forward)
821return position.GetFrozenPointer(LogicalDirection.Backward);
831if (direction == LogicalDirection.Forward)
844LogicalDirection logicalDirection;
846direction == LogicalDirection.Forward)
852logicalDirection = LogicalDirection.Backward;
856logicalDirection = LogicalDirection.Forward;
860direction == LogicalDirection.Backward)
866logicalDirection = LogicalDirection.Forward;
870logicalDirection = LogicalDirection.Backward;
875logicalDirection = (nextCharacterHit.TrailingLength > 0) ? LogicalDirection.Backward : LogicalDirection.Forward;
894return position.GetFrozenPointer(LogicalDirection.Forward);
897int lineIndex = GetLineIndexFromPosition(position, LogicalDirection.Backward);
907LogicalDirection logicalDirection;
914logicalDirection = LogicalDirection.Forward;
918logicalDirection = LogicalDirection.Backward;
923logicalDirection = (backspaceCharacterHit.TrailingLength > 0) ? LogicalDirection.Backward : LogicalDirection.Forward;
941ITextPointer start = _host.TextContainer.CreatePointerAtOffset(_lineMetrics[lineIndex].Offset, LogicalDirection.Forward);
942ITextPointer end = _host.TextContainer.CreatePointerAtOffset(_lineMetrics[lineIndex].Offset + _lineMetrics[lineIndex].ContentLength, LogicalDirection.Forward);
1264ITextPointer start = _host.TextContainer.CreatePointerAtOffset(_lineMetrics[0].Offset, LogicalDirection.Backward);
1265ITextPointer end = _host.TextContainer.CreatePointerAtOffset(_lineMetrics[_lineMetrics.Count - 1].EndOffset, LogicalDirection.Forward);
1659private int GetLineIndexFromPosition(ITextPointer position, LogicalDirection direction)
1665private int GetLineIndexFromOffset(int offset, LogicalDirection direction)
1667if (offset > 0 && direction == LogicalDirection.Backward)
1713LogicalDirection logicalDirection;
1719logicalDirection = (charIndex.TrailingLength > 0) ? LogicalDirection.Backward : LogicalDirection.Forward;
1894int firstLineIndex = GetLineIndexFromOffset(range.StartIndex, LogicalDirection.Forward);
1896int lastLineIndex = GetLineIndexFromOffset(endOffset, LogicalDirection.Backward);
2016ITextPointer position = _host.TextContainer.CreatePointerAtOffset(unclippedStartOffset, LogicalDirection.Backward);
2017if (TextPointerBase.IsNextToPlainLineBreak(position, LogicalDirection.Backward))
2061ITextPointer endOfLinePosition = _host.TextContainer.CreatePointerAtOffset(endOffset, LogicalDirection.Backward);
2063if (TextPointerBase.IsNextToPlainLineBreak(endOfLinePosition, LogicalDirection.Backward))
2112ITextPointer position = _host.TextContainer.CreatePointerAtOffset(unclippedStartOffset, LogicalDirection.Backward);
2113if (TextPointerBase.IsNextToPlainLineBreak(position, LogicalDirection.Backward))
2140ITextPointer endOfLinePosition = _host.TextContainer.CreatePointerAtOffset(endOffset, LogicalDirection.Backward);
2142if (TextPointerBase.IsNextToPlainLineBreak(endOfLinePosition, LogicalDirection.Backward))
2343int lineIndex = GetLineIndexFromOffset(range.StartIndex, LogicalDirection.Forward);
MS\Internal\Documents\TextContainerHelper.cs (23)
91_textContainer.CreatePointerAtOffset(_cpFirst, LogicalDirection.Forward),
92_textContainer.CreatePointerAtOffset(_cpLast, LogicalDirection.Backward),
101_textContainer.CreatePointerAtOffset(_ranges[i * 2], LogicalDirection.Forward),
102_textContainer.CreatePointerAtOffset(_ranges[i * 2 + 1], LogicalDirection.Backward),
120if (cpPos == _cpFirst && position.LogicalDirection == LogicalDirection.Backward ||
121cpPos == _cpLast && position.LogicalDirection == LogicalDirection.Forward)
137if (cpPos == _ranges[i * 2] && position.LogicalDirection == LogicalDirection.Backward ||
138cpPos == _ranges[i * 2 + 1] && position.LogicalDirection == LogicalDirection.Forward)
156startPosition = _textContainer.CreatePointerAtOffset(IsSimple ? _cpFirst : _ranges[0], LogicalDirection.Forward);
168endPosition = _textContainer.CreatePointerAtOffset(IsSimple ? _cpLast : _ranges[(_size - 1) * 2 + 1], LogicalDirection.Backward);
320if (start.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementStart)
323element = start.GetAdjacentElement(LogicalDirection.Forward);
335start.MoveToNextContextPosition(LogicalDirection.Forward);
341else if (start.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.EmbeddedElement)
344element = start.GetAdjacentElement(LogicalDirection.Forward);
377if (!start.MoveToNextContextPosition(LogicalDirection.Forward))
405object element = position.GetAdjacentElement(LogicalDirection.Forward);
443element = position.GetAdjacentElement(LogicalDirection.Forward);
447positionsStart.Insert(0, position.CreatePointer(LogicalDirection.Forward));
459element = position.GetAdjacentElement(LogicalDirection.Backward);
463positionsEnd.Insert(0, position.CreatePointer(LogicalDirection.Backward));
548textPointer = textContainer.CreatePointerAtOffset(0, LogicalDirection.Forward); // Start
583internal static ITextPointer GetTextPointerFromCP(ITextContainer textContainer, int cp, LogicalDirection direction)
MS\Internal\Documents\TextDocumentView.cs (29)
295internal override ITextPointer GetNextCaretUnitPosition(ITextPointer position, LogicalDirection direction)
478if (position.LogicalDirection == LogicalDirection.Forward)
488if (segment.Start.LogicalDirection == LogicalDirection.Backward)
497if (position.LogicalDirection == LogicalDirection.Backward)
507if (segment.End.LogicalDirection == LogicalDirection.Forward)
520if (position.TextContainer.Start.CompareTo(position) == 0 && position.LogicalDirection == LogicalDirection.Backward)
524else if (position.TextContainer.End.CompareTo(position) == 0 && position.LogicalDirection == LogicalDirection.Forward)
763position = paragraph.StartPosition.CreatePointer(LogicalDirection.Forward);
767position = paragraph.EndPosition.CreatePointer(LogicalDirection.Backward);
866position = blockUIContainer.ContentStart.CreatePointer(LogicalDirection.Forward);
870position = blockUIContainer.ContentEnd.CreatePointer(LogicalDirection.Backward);
880position = paragraph.StartPosition.CreatePointer(LogicalDirection.Forward);
884position = paragraph.EndPosition.CreatePointer(LogicalDirection.Backward);
1544private ITextPointer GetNextCaretUnitPosition(ReadOnlyCollection<ParagraphResult> paragraphs, ReadOnlyCollection<ParagraphResult> floatingElements, ITextPointer position, LogicalDirection direction)
1581private ITextPointer GetNextCaretUnitPosition(ParagraphResult paragraph, ITextPointer position, LogicalDirection direction)
1650private ITextPointer GetNextCaretUnitPosition(ReadOnlyCollection<ColumnResult> columns, ReadOnlyCollection<ParagraphResult> floatingElements, ITextPointer position, LogicalDirection direction)
2361lineRange = new TextSegment(blockUIContainer.ContentStart.CreatePointer(LogicalDirection.Forward), blockUIContainer.ContentEnd.CreatePointer(LogicalDirection.Backward));
2489positionOut = lines[lineIndex].StartPosition.CreatePointer(LogicalDirection.Forward);
2509positionOut = lines[0].StartPosition.CreatePointer(LogicalDirection.Forward);
2521positionOut = lines[lines.Count - 1].StartPosition.CreatePointer(LogicalDirection.Forward);
2861positionOut = blockUIContainer.ContentStart.CreatePointer(LogicalDirection.Forward);
2865positionOut = blockUIContainer.ContentEnd.CreatePointer(LogicalDirection.Backward);
2968positionOut = lines[lineIndex].StartPosition.CreatePointer(LogicalDirection.Forward);
2983positionOut = lines[0].StartPosition.CreatePointer(LogicalDirection.Forward);
2995positionOut = lines[lines.Count - 1].StartPosition.CreatePointer(LogicalDirection.Forward);
3243segmentEnd = _textContainer.Start.CreatePointer(backgroundFormatInfo.CPInterrupted, LogicalDirection.Backward);
3436if (textPointer.LogicalDirection == LogicalDirection.Forward && textPointer.CompareTo(textElement.ElementStart) == 0)
3441if (textPointer.LogicalDirection == LogicalDirection.Backward && textPointer.CompareTo(textElement.ElementEnd) == 0)
MS\Internal\PtsHost\TextParaClient.cs (56)
642RectFromDcpSimpleLines(0, 0, LogicalDirection.Forward, TextPointerContext.Text, ref textDetails.u.full, ref rect, ref vrBaseline);
647RectFromDcpCompositeLines(0, 0, LogicalDirection.Forward, TextPointerContext.Text, ref textDetails.u.full, ref rect, ref vrBaseline);
659internal ITextPointer GetTextPosition(int dcp, LogicalDirection direction)
678if (position.LogicalDirection == LogicalDirection.Backward && dcp > 0)
870internal ITextPointer GetNextCaretUnitPosition(ITextPointer position, LogicalDirection direction)
1090LogicalDirection logicalDirection = (charHit.TrailingLength > 0) ? LogicalDirection.Backward : LogicalDirection.Forward;
1631LogicalDirection orientation,
1683if (orientation == LogicalDirection.Forward)
1696if (orientation == LogicalDirection.Backward && originalDcp > 0 && (context == TextPointerContext.Text || context == TextPointerContext.EmbeddedElement))
1719LogicalDirection orientation,
1780if (orientation == LogicalDirection.Forward)
1790if (orientation == LogicalDirection.Backward && originalDcp > 0 && (context == TextPointerContext.Text || context == TextPointerContext.EmbeddedElement))
2033ITextPointer position = Paragraph.StructuralCache.TextContainer.CreatePointerAtOffset(Paragraph.ParagraphStartCharacterPosition + dcp, LogicalDirection.Forward);
2035return (TextPointerBase.IsNextToAnyBreak(position, LogicalDirection.Backward));
2397if (position.LogicalDirection == LogicalDirection.Backward)
2422else if (position.LogicalDirection == LogicalDirection.Forward)
2500if (position.LogicalDirection == LogicalDirection.Backward)
2546else if (position.LogicalDirection == LogicalDirection.Forward)
2582LogicalDirection direction,
2607if (dcp == lineDesc.dcpFirst && direction == LogicalDirection.Backward)
2622else if (dcp >= lineDesc.dcpLim - 1 && direction == LogicalDirection.Forward)
2651if (direction == LogicalDirection.Forward)
2660LogicalDirection logicalDirection;
2661if ((nextCharacterHit.FirstCharacterIndex + nextCharacterHit.TrailingLength == lineDesc.dcpLim) && direction == LogicalDirection.Forward)
2667logicalDirection = LogicalDirection.Backward;
2671logicalDirection = LogicalDirection.Forward;
2674else if ((nextCharacterHit.FirstCharacterIndex + nextCharacterHit.TrailingLength == lineDesc.dcpFirst) && direction == LogicalDirection.Backward)
2680logicalDirection = LogicalDirection.Forward;
2684logicalDirection = LogicalDirection.Backward;
2689logicalDirection = (nextCharacterHit.TrailingLength > 0) ? LogicalDirection.Backward : LogicalDirection.Forward;
2707LogicalDirection direction,
2741if (dcp == element.dcpFirst && direction == LogicalDirection.Backward)
2781else if (dcp >= element.dcpLim - 1 && direction == LogicalDirection.Forward)
2814if (direction == LogicalDirection.Forward)
2823LogicalDirection logicalDirection;
2824if ((nextCharacterHit.FirstCharacterIndex + nextCharacterHit.TrailingLength == element.dcpLim) && direction == LogicalDirection.Forward)
2830logicalDirection = LogicalDirection.Backward;
2835logicalDirection = LogicalDirection.Forward;
2838else if ((nextCharacterHit.FirstCharacterIndex + nextCharacterHit.TrailingLength == element.dcpFirst) && direction == LogicalDirection.Backward)
2844logicalDirection = LogicalDirection.Forward;
2849logicalDirection = LogicalDirection.Backward;
2854logicalDirection = (nextCharacterHit.TrailingLength > 0) ? LogicalDirection.Backward : LogicalDirection.Forward;
2930LogicalDirection logicalDirection;
2937logicalDirection = LogicalDirection.Forward;
2941logicalDirection = LogicalDirection.Backward;
2946logicalDirection = (backspaceCharacterHit.TrailingLength > 0) ? LogicalDirection.Backward : LogicalDirection.Forward;
3056LogicalDirection logicalDirection;
3063logicalDirection = LogicalDirection.Forward;
3067logicalDirection = LogicalDirection.Backward;
3072logicalDirection = (backspaceCharacterHit.TrailingLength > 0) ? LogicalDirection.Backward : LogicalDirection.Forward;
MS\Internal\Text\ComplexLine.cs (17)
41switch (position.GetPointerContext(LogicalDirection.Forward))
88ITextPointer position = _owner.TextContainer.CreatePointerAtOffset(dcp, LogicalDirection.Backward);
91while (position.GetPointerContext(LogicalDirection.Backward) != TextPointerContext.Text &&
99string precedingTextString = position.GetTextInRun(LogicalDirection.Backward);
282position = new TextPointer(_owner.ContentStart, CalcPositionOffset(charHit), LogicalDirection.Forward);
289type = position.GetPointerContext(LogicalDirection.Forward);
294type = position.GetPointerContext(LogicalDirection.Backward);
305element = position.GetAdjacentElementFromOuterPosition(LogicalDirection.Forward);
333Debug.Assert(position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.Text, "TextPointer does not point to characters.");
352endOfRunPosition = _owner.Highlights.GetNextPropertyChangePosition(position, LogicalDirection.Forward);
367int charactersCopied = position.GetTextInRun(LogicalDirection.Forward, textBuffer, 0, textBuffer.Length);
380Debug.Assert(position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementStart, "TextPointer does not point to element start edge.");
384TextElement element = (TextElement)position.GetAdjacentElement(LogicalDirection.Forward);
471Debug.Assert(position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementEnd, "TextPointer does not point to element end edge.");
475TextElement element = (TextElement)position.GetAdjacentElement(LogicalDirection.Forward);
521Debug.Assert(position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.EmbeddedElement, "TextPointer does not point to embedded object.");
524DependencyObject element = position.GetAdjacentElement(LogicalDirection.Forward) as DependencyObject;
System\Windows\Controls\PasswordTextContainer.cs (20)
211ITextPointer ITextContainer.CreatePointerAtOffset(int offset, LogicalDirection direction)
217ITextPointer ITextContainer.CreatePointerAtCharOffset(int charOffset, LogicalDirection direction)
222ITextPointer ITextContainer.CreateDynamicTextPointer(StaticTextPointer position, LogicalDirection direction)
229return new StaticTextPointer(this, ((ITextContainer)this).CreatePointerAtOffset(offset, LogicalDirection.Forward));
232TextPointerContext ITextContainer.GetPointerContext(StaticTextPointer pointer, LogicalDirection direction)
242int ITextContainer.GetTextInRun(StaticTextPointer position, LogicalDirection direction, char[] textBuffer, int startIndex, int count)
247object ITextContainer.GetAdjacentElement(StaticTextPointer position, LogicalDirection direction)
262StaticTextPointer ITextContainer.GetNextContextPosition(StaticTextPointer position, LogicalDirection direction)
513return new PasswordTextPointer(this, LogicalDirection.Backward, 0);
527return new PasswordTextPointer(this, LogicalDirection.Forward, this.SymbolCount);
669textPosition = new PasswordTextPointer(this, LogicalDirection.Forward, offset);
706index = FindIndex(offset, LogicalDirection.Forward);
739if (position.LogicalDirection == LogicalDirection.Backward)
803private int FindIndex(int offset, LogicalDirection gravity)
817(position.LogicalDirection == gravity || gravity == LogicalDirection.Backward))
838LogicalDirection lastLogicalDirection;
841lastLogicalDirection = LogicalDirection.Backward;
853position.LogicalDirection == LogicalDirection.Backward &&
858Invariant.Assert(lastLogicalDirection != LogicalDirection.Forward);
909Debug.Write($"({position.DebugId}) {position.Offset}/{((position.LogicalDirection == LogicalDirection.Forward) ? "f " : "b ")}");
System\Windows\Controls\TextBox.cs (24)
160TextPointer newStart = this.TextContainer.CreatePointerAtOffset(start, LogicalDirection.Forward);
164newStart = newStart.GetInsertionPosition(LogicalDirection.Forward);
172TextPointer newEnd = new TextPointer(newStart, length, LogicalDirection.Forward);
175newEnd = newEnd.GetInsertionPosition(LogicalDirection.Forward);
215return (textPointer.LogicalDirection == LogicalDirection.Backward) ? offset - 1 : offset;
263TextPointer position = this.TextContainer.CreatePointerAtOffset(charIndex, LogicalDirection.Forward);
438TextPointer textPointer = TextContainer.CreatePointerAtOffset(charIndex, LogicalDirection.Backward);
439textPointer = textPointer.GetInsertionPosition(LogicalDirection.Backward);
444textPointer = textPointer.GetNextInsertionPosition(LogicalDirection.Forward);
448textPointer = textPointer.GetPositionAtOffset(0, LogicalDirection.Backward);
453textPointer = textPointer.GetPositionAtOffset(0, LogicalDirection.Forward);
478TextPointer position = this.TextContainer.CreatePointerAtOffset(charIndex, LogicalDirection.Forward);
479SpellingError spellingError = this.TextEditor.GetSpellingErrorAtPosition(position, LogicalDirection.Forward);
483position = this.TextContainer.CreatePointerAtOffset(charIndex + 1, LogicalDirection.Forward);
484spellingError = this.TextEditor.GetSpellingErrorAtPosition(position, LogicalDirection.Backward);
544public int GetNextSpellingErrorCharacterIndex(int charIndex, LogicalDirection direction)
810TextPointer newEnd = new TextPointer(TextSelectionInternal.Start, value, LogicalDirection.Forward);
813newEnd = newEnd.GetInsertionPosition(LogicalDirection.Forward);
854TextPointer newStart = TextContainer.CreatePointerAtOffset(value, LogicalDirection.Forward);
858newStart = newStart.GetInsertionPosition(LogicalDirection.Forward);
866TextPointer newEnd = new TextPointer(newStart, selectionLength, LogicalDirection.Forward);
869newEnd = newEnd.GetInsertionPosition(LogicalDirection.Forward);
1476if (TextPointerBase.IsNextToPlainLineBreak(textPointer, LogicalDirection.Forward))
1478textPointer.MoveToNextInsertionPosition(LogicalDirection.Forward);
System\Windows\Controls\TextRangeAdaptor.cs (77)
479internal static bool MoveToInsertionPosition(ITextPointer position, LogicalDirection direction)
527TextPointerBase.MoveToNextInsertionPosition(_start, LogicalDirection.Backward);
531TextPointerBase.MoveToNextInsertionPosition(_end, LogicalDirection.Forward);
538MoveToNextWordBoundary(_start, LogicalDirection.Backward);
542MoveToNextWordBoundary(_end, LogicalDirection.Forward);
552TextPointerContext forwardContext = _start.GetPointerContext(LogicalDirection.Forward);
555TextPointerContext backwardContext = _start.GetPointerContext(LogicalDirection.Backward);
563_start.MoveToNextContextPosition(LogicalDirection.Backward);
569TextPointerContext backwardContext = _end.GetPointerContext(LogicalDirection.Backward);
572TextPointerContext forwardContext = _end.GetPointerContext(LogicalDirection.Forward);
580_end.MoveToNextContextPosition(LogicalDirection.Forward);
586_start.SetLogicalDirection(LogicalDirection.Forward);
587_end.SetLogicalDirection(LogicalDirection.Forward);
724private bool MoveToUnitBoundary(ITextPointer position, bool isStart, LogicalDirection direction, TextUnit unit)
762if (moved && direction == LogicalDirection.Forward)
766TextPointerContext context = position.GetPointerContext(LogicalDirection.Forward);
771position.MoveToNextContextPosition(LogicalDirection.Forward);
790if (direction == LogicalDirection.Forward)
808nextLineStart = GetInsertionPosition(nextLineStart, LogicalDirection.Forward);
813position.SetLogicalDirection(isStart ? LogicalDirection.Forward : LogicalDirection.Backward);
835previousLineEnd = GetInsertionPosition(previousLineEnd, LogicalDirection.Backward);
840position.SetLogicalDirection(isStart ? LogicalDirection.Forward : LogicalDirection.Backward);
853if (direction == LogicalDirection.Forward)
860if (nextParagraphStart.MoveToNextInsertionPosition(LogicalDirection.Forward))
870position.SetLogicalDirection(isStart ? LogicalDirection.Forward : LogicalDirection.Backward);
881if (previousParagraphEnd.MoveToNextInsertionPosition(LogicalDirection.Backward))
891position.SetLogicalDirection(isStart ? LogicalDirection.Forward : LogicalDirection.Backward);
920if (direction == LogicalDirection.Forward)
924if (position.GetPointerContext(LogicalDirection.Forward) != TextPointerContext.ElementEnd)
930Invariant.Assert(position.MoveToNextContextPosition(LogicalDirection.Forward));
932MoveToInsertionPosition(position, LogicalDirection.Forward);
938if (position.GetPointerContext(LogicalDirection.Backward) != TextPointerContext.ElementStart)
944Invariant.Assert(position.MoveToNextContextPosition(LogicalDirection.Backward));
946MoveToInsertionPosition(position, LogicalDirection.Backward);
953if (direction == LogicalDirection.Forward)
955if (position.CompareTo(GetInsertionPosition(position.TextContainer.End, LogicalDirection.Backward)) != 0)
963if (position.CompareTo(GetInsertionPosition(position.TextContainer.Start, LogicalDirection.Forward)) != 0)
993LogicalDirection direction = (count > 0) ? LogicalDirection.Forward : LogicalDirection.Backward;
1050if (direction == LogicalDirection.Backward)
1052while (position.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.Text)
1054if (!position.MoveToNextContextPosition(LogicalDirection.Backward))
1074position.SetLogicalDirection(LogicalDirection.Forward);
1091position.MoveToNextInsertionPosition(LogicalDirection.Backward);
1096MoveToInsertionPosition(position, LogicalDirection.Forward);
1111position.MoveToPosition(direction == LogicalDirection.Forward ? paragraphRange.End : paragraphRange.Start);
1142if (direction == LogicalDirection.Backward)
1145MoveToInsertionPosition(position, LogicalDirection.Backward);
1150MoveToInsertionPosition(position, LogicalDirection.Forward);
1162if (direction == LogicalDirection.Forward)
1195return (direction == LogicalDirection.Forward) ? moved : -moved;
1210while (IsElementBoundary(start.GetPointerContext(LogicalDirection.Forward)))
1212if (!start.MoveToNextContextPosition(LogicalDirection.Forward) || start.CompareTo(end) >= 0)
1217while (IsElementBoundary(end.GetPointerContext(LogicalDirection.Backward)))
1219if (!end.MoveToNextContextPosition(LogicalDirection.Backward) || start.CompareTo(end) >= 0)
1234if (!start.MoveToNextContextPosition(LogicalDirection.Forward) || start.CompareTo(end) > 0)
1445return TextPointerBase.IsAtWordBoundary(position, LogicalDirection.Forward);
1453private static bool MoveToNextWordBoundary(ITextPointer position, LogicalDirection direction)
1479position.SetLogicalDirection(LogicalDirection.Forward);
1504private ITextPointer GetInsertionPosition(ITextPointer position, LogicalDirection direction)
1637_end.MoveToNextInsertionPosition(LogicalDirection.Forward);
1672ITextPointer position = _end.CreatePointer(LogicalDirection.Backward);
1683attrEnd = position.CreatePointer(LogicalDirection.Backward);
1690attrStart = position.CreatePointer(LogicalDirection.Forward);
1694if (!position.MoveToNextContextPosition(LogicalDirection.Backward))
1703ITextPointer position = _start.CreatePointer(LogicalDirection.Forward);
1714attrStart = position.CreatePointer(LogicalDirection.Forward);
1721attrEnd = position.CreatePointer(LogicalDirection.Backward);
1725if (!position.MoveToNextContextPosition(LogicalDirection.Forward))
1908_end.MoveToNextInsertionPosition(LogicalDirection.Forward);
1946if (MoveToUnitBoundary(position, start, count < 0 ? LogicalDirection.Backward : LogicalDirection.Forward, unit))
System\Windows\Documents\DocumentSequenceTextContainer.cs (25)
94ITextPointer ITextContainer.CreatePointerAtOffset(int offset, LogicalDirection direction)
100ITextPointer ITextContainer.CreatePointerAtCharOffset(int charOffset, LogicalDirection direction)
105ITextPointer ITextContainer.CreateDynamicTextPointer(StaticTextPointer position, LogicalDirection direction)
112return new StaticTextPointer(this, ((ITextContainer)this).CreatePointerAtOffset(offset, LogicalDirection.Forward));
115TextPointerContext ITextContainer.GetPointerContext(StaticTextPointer pointer, LogicalDirection direction)
125int ITextContainer.GetTextInRun(StaticTextPointer position, LogicalDirection direction, char[] textBuffer, int startIndex, int count)
130object ITextContainer.GetAdjacentElement(StaticTextPointer position, LogicalDirection direction)
145StaticTextPointer ITextContainer.GetNextContextPosition(StaticTextPointer position, LogicalDirection direction)
659if (!highlights.IsContentHighlighted(highlightTransitionPosition, LogicalDirection.Forward))
661highlightTransitionPosition = highlights.GetNextHighlightChangePosition(highlightTransitionPosition, LogicalDirection.Forward);
669selected = highlights.GetHighlightValue(highlightTransitionPosition, LogicalDirection.Forward, typeof(TextSelection));
673highlightTransitionPosition = highlights.GetNextHighlightChangePosition(highlightTransitionPosition, LogicalDirection.Forward);
680if (highlightRangeStart.GetPointerContext(LogicalDirection.Forward) != TextPointerContext.Text)
687TextPointerBase.GetTextWithLimit(highlightRangeStart.CreateDynamicTextPointer(LogicalDirection.Forward), LogicalDirection.Forward, sb, 0, 256, highlightTransitionPosition.CreateDynamicTextPointer(LogicalDirection.Forward));
862internal override object GetHighlightValue(StaticTextPointer textPosition, LogicalDirection direction, Type highlightLayerOwnerType)
883internal override bool IsContentHighlighted(StaticTextPointer textPosition, LogicalDirection direction)
905internal override StaticTextPointer GetNextHighlightChangePosition(StaticTextPointer textPosition, LogicalDirection direction)
948internal override StaticTextPointer GetNextPropertyChangePosition(StaticTextPointer textPosition, LogicalDirection direction)
973private bool EnsureParentPosition(StaticTextPointer textPosition, LogicalDirection direction, out StaticTextPointer parentPosition)
987ITextPointer dynamicTextPointer = textPosition.CreateDynamicTextPointer(LogicalDirection.Forward);
1005private StaticTextPointer GetStaticPositionInChildContainer(StaticTextPointer textPosition, LogicalDirection direction, StaticTextPointer originalPosition)
1011DocumentSequenceTextPointer parentChangePosition = textPosition.CreateDynamicTextPointer(LogicalDirection.Forward) as DocumentSequenceTextPointer;
1024childTp = direction == LogicalDirection.Forward ?
System\Windows\Documents\DocumentSequenceTextPointer.cs (52)
46void ITextPointer.SetLogicalDirection(LogicalDirection direction)
79TextPointerContext ITextPointer.GetPointerContext(LogicalDirection direction)
88int ITextPointer.GetTextRunLength(LogicalDirection direction)
94string ITextPointer.GetTextInRun(LogicalDirection direction)
100/// <see cref="ITextPointer.GetTextInRun(LogicalDirection,char[],int,int)"/>
103int ITextPointer.GetTextInRun(LogicalDirection direction, char[] textBuffer, int startIndex, int count)
112object ITextPointer.GetAdjacentElement(LogicalDirection direction)
121Type ITextPointer.GetElementType(LogicalDirection direction)
189/// <see cref="ITextPointer.CreatePointer(LogicalDirection)"/>
191ITextPointer ITextPointer.CreatePointer(LogicalDirection gravity)
197/// <see cref="ITextPointer.CreatePointer(int,LogicalDirection)"/>
199ITextPointer ITextPointer.CreatePointer(int distance, LogicalDirection gravity)
213ITextPointer ITextPointer.GetFrozenPointer(LogicalDirection logicalDirection)
242ITextPointer ITextPointer.GetNextContextPosition(LogicalDirection direction)
257ITextPointer ITextPointer.GetInsertionPosition(LogicalDirection direction)
268ITextPointer ITextPointer.GetFormatNormalizedPosition(LogicalDirection direction)
277ITextPointer ITextPointer.GetNextInsertionPosition(LogicalDirection direction)
358if (!isAtCaretUnitBoundary && ((ITextPointer)this).LogicalDirection == LogicalDirection.Backward)
366ITextPointer positionForwardGravity = ((ITextPointer)this).CreatePointer(LogicalDirection.Forward);
376LogicalDirection ITextPointer.LogicalDirection
441bool ITextPointer.MoveToNextContextPosition(LogicalDirection direction)
474LogicalDirection gravity = this.ChildPointer.LogicalDirection;
504Rect ITextPointer.GetCharacterRect(LogicalDirection direction)
509bool ITextPointer.MoveToInsertionPosition(LogicalDirection direction)
514bool ITextPointer.MoveToNextInsertionPosition(LogicalDirection direction)
629public static TextPointerContext GetPointerContext(DocumentSequenceTextPointer thisTp, LogicalDirection direction)
640public static int GetTextRunLength(DocumentSequenceTextPointer thisTp, LogicalDirection direction)
648/// <see cref="ITextPointer.GetTextInRun(LogicalDirection,char[],int,int)"/>
651public static int GetTextInRun(DocumentSequenceTextPointer thisTp, LogicalDirection direction, char[] textBuffer, int startIndex, int count)
680public static object GetAdjacentElement(DocumentSequenceTextPointer thisTp, LogicalDirection direction)
691public static Type GetElementType(DocumentSequenceTextPointer thisTp, LogicalDirection direction)
764public static ITextPointer CreatePointer(DocumentSequenceTextPointer thisTp, LogicalDirection gravity)
770/// <see cref="ITextPointer.CreatePointer(int,LogicalDirection)"/>
772public static ITextPointer CreatePointer(DocumentSequenceTextPointer thisTp, int distance, LogicalDirection gravity)
817internal static bool iScan(DocumentSequenceTextPointer thisTp, LogicalDirection direction)
822moved = xGapAwareScan(thisTp, (direction == LogicalDirection.Forward ? 1 : -1));
862private static DocumentSequenceTextPointer xGetClingDSTP(DocumentSequenceTextPointer thisTp, LogicalDirection direction)
874if (direction == LogicalDirection.Forward)
887Debug.Assert(direction == LogicalDirection.Backward);
912private static TextPointerContext xGapAwareGetSymbolType(DocumentSequenceTextPointer thisTp, LogicalDirection direction)
919private static object xGapAwareGetEmbeddedElement(DocumentSequenceTextPointer thisTp, LogicalDirection direction)
963if (tp1.ChildPointer.GetPointerContext(LogicalDirection.Forward) != TextPointerContext.None ||
964tp2.ChildPointer.GetPointerContext(LogicalDirection.Backward) != TextPointerContext.None)
973if (block.ChildContainer.Start.GetPointerContext(LogicalDirection.Forward) != TextPointerContext.None)
1028LogicalDirection scanDir = (distance > 0 ? LogicalDirection.Forward : LogicalDirection.Backward);
1056if (scanDir == LogicalDirection.Backward)
1064if (!((cdb.IsHead && scanDir == LogicalDirection.Backward)
1065|| (cdb.IsTail && scanDir == LogicalDirection.Forward)
1069cdb = (scanDir == LogicalDirection.Forward ? cdb.NextBlock : cdb.PreviousBlock);
1070childTn = (scanDir == LogicalDirection.Forward ?
System\Windows\Documents\FixedDocument.cs (11)
497fixedTextPointer = new FixedTextPointer(true, LogicalDirection.Forward, flowPosition);
1070if (!highlights.IsContentHighlighted(highlightTransitionPosition, LogicalDirection.Forward))
1072highlightTransitionPosition = highlights.GetNextHighlightChangePosition(highlightTransitionPosition, LogicalDirection.Forward);
1083selected = highlights.GetHighlightValue(highlightTransitionPosition, LogicalDirection.Forward, typeof(TextSelection));
1101highlightTransitionPosition = highlights.GetNextHighlightChangePosition(highlightTransitionPosition, LogicalDirection.Forward);
1104while (highlights.GetHighlightValue(highlightTransitionPosition, LogicalDirection.Forward, typeof(TextSelection)) != DependencyProperty.UnsetValue);
1113LogicalDirection.Forward, typeof(HighlightComponent)) as AnnotationHighlightLayer.HighlightSegment;
1117highlightTransitionPosition = highlights.GetNextHighlightChangePosition(highlightTransitionPosition, LogicalDirection.Forward);
1127this.FixedContainer.GetMultiHighlights((FixedTextPointer)highlightRangeStart.CreateDynamicTextPointer(LogicalDirection.Forward),
1128(FixedTextPointer)highlightTransitionPosition.CreateDynamicTextPointer(LogicalDirection.Forward),
1430return new FixedTextPointer(true, LogicalDirection.Forward, flowPosition);
System\Windows\Documents\FixedFindEngine.cs (12)
147end = new DocumentSequenceTextPointer(childBlock, new FixedTextPointer(false, LogicalDirection.Backward, fixedDoc.FixedContainer.FixedTextBuilder.GetPageEndFlowPosition(translatedPageNumber)));
148start = new DocumentSequenceTextPointer(childBlock, new FixedTextPointer(false, LogicalDirection.Forward, fixedDoc.FixedContainer.FixedTextBuilder.GetPageStartFlowPosition(translatedPageNumber)));
152start = new DocumentSequenceTextPointer(childBlock, new FixedTextPointer(false, LogicalDirection.Forward, fixedDoc.FixedContainer.FixedTextBuilder.GetPageStartFlowPosition(translatedPageNumber)));
153end = new DocumentSequenceTextPointer(childBlock, new FixedTextPointer(false, LogicalDirection.Backward, fixedDoc.FixedContainer.FixedTextBuilder.GetPageEndFlowPosition(translatedPageNumber)));
162end = new FixedTextPointer(false, LogicalDirection.Backward, textBuilder.GetPageEndFlowPosition(pageNumber));
163start = new FixedTextPointer(false, LogicalDirection.Forward, textBuilder.GetPageStartFlowPosition(pageNumber));
167start = new FixedTextPointer(false, LogicalDirection.Forward, textBuilder.GetPageStartFlowPosition(pageNumber));
168end = new FixedTextPointer(false, LogicalDirection.Backward, textBuilder.GetPageEndFlowPosition(pageNumber));
300new FixedTextPointer(false, LogicalDirection.Forward,pageStartFlowPosition));
306firstSearchPageStart = new FixedTextPointer(false, LogicalDirection.Forward, endAsFTP.FixedTextContainer.FixedTextBuilder.GetPageStartFlowPosition(pageNumber));
320new FixedTextPointer(false, LogicalDirection.Backward, pageEndFlowPosition));
326firstSearchPageEnd = new FixedTextPointer(false, LogicalDirection.Backward, startAsFTP.FixedTextContainer.FixedTextBuilder.GetPageEndFlowPosition(pageNumber));
System\Windows\Documents\FixedTextContainer.cs (12)
79ITextPointer ITextContainer.CreatePointerAtOffset(int offset, LogicalDirection direction)
85ITextPointer ITextContainer.CreatePointerAtCharOffset(int charOffset, LogicalDirection direction)
90ITextPointer ITextContainer.CreateDynamicTextPointer(StaticTextPointer position, LogicalDirection direction)
97return new StaticTextPointer(this, ((ITextContainer)this).CreatePointerAtOffset(offset, LogicalDirection.Forward));
100TextPointerContext ITextContainer.GetPointerContext(StaticTextPointer pointer, LogicalDirection direction)
110int ITextContainer.GetTextInRun(StaticTextPointer position, LogicalDirection direction, char[] textBuffer, int startIndex, int count)
115object ITextContainer.GetAdjacentElement(StaticTextPointer position, LogicalDirection direction)
130StaticTextPointer ITextContainer.GetNextContextPosition(StaticTextPointer position, LogicalDirection direction)
568_start = new FixedTextPointer(false, LogicalDirection.Backward, new FlowPosition(this, this.FixedTextBuilder.FixedFlowMap.FlowStartEdge, 1));
569_end = new FixedTextPointer(false, LogicalDirection.Forward, new FlowPosition(this, this.FixedTextBuilder.FixedFlowMap.FlowEndEdge, 0));
578FixedTextPointer eStart = new FixedTextPointer(false, LogicalDirection.Backward, pStart);
579FixedTextPointer eEnd = new FixedTextPointer(false, LogicalDirection.Forward, pEnd);
System\Windows\Documents\FixedTextPointer.cs (27)
30internal FixedTextPointer(bool mutable, LogicalDirection gravity, FlowPosition flow)
92TextPointerContext ITextPointer.GetPointerContext(LogicalDirection direction)
102int ITextPointer.GetTextRunLength(LogicalDirection direction)
113string ITextPointer.GetTextInRun(LogicalDirection direction)
119/// <see cref="ITextPointer.GetTextInRun(LogicalDirection,char[],int,int)"/>
122int ITextPointer.GetTextInRun(LogicalDirection direction, char[] textBuffer, int startIndex, int count)
142object ITextPointer.GetAdjacentElement(LogicalDirection direction)
157Type ITextPointer.GetElementType(LogicalDirection direction)
258/// <see cref="ITextPointer.CreatePointer(LogicalDirection)"/>
260ITextPointer ITextPointer.CreatePointer(LogicalDirection gravity)
266/// <see cref="ITextPointer.CreatePointer(int,LogicalDirection)"/>
268ITextPointer ITextPointer.CreatePointer(int distance, LogicalDirection gravity)
292ITextPointer ITextPointer.GetFrozenPointer(LogicalDirection logicalDirection)
301ITextPointer ITextPointer.GetNextContextPosition(LogicalDirection direction)
319ITextPointer ITextPointer.GetInsertionPosition(LogicalDirection direction)
333ITextPointer ITextPointer.GetFormatNormalizedPosition(LogicalDirection direction)
345ITextPointer ITextPointer.GetNextInsertionPosition(LogicalDirection direction)
365void ITextPointer.SetLogicalDirection(LogicalDirection direction)
375bool ITextPointer.MoveToNextContextPosition(LogicalDirection direction)
462Rect ITextPointer.GetCharacterRect(LogicalDirection direction)
470bool ITextPointer.MoveToInsertionPosition(LogicalDirection direction)
478bool ITextPointer.MoveToNextInsertionPosition(LogicalDirection direction)
568if (!isAtCaretUnitBoundary && this.LogicalDirection == LogicalDirection.Backward)
576ITextPointer positionForwardGravity = ((ITextPointer)this).CreatePointer(LogicalDirection.Forward);
586LogicalDirection ITextPointer.LogicalDirection
661internal LogicalDirection LogicalDirection
694private LogicalDirection _gravity;
System\Windows\Documents\FixedTextView.cs (43)
74textPos = _CreateTextPointer(fixedp, LogicalDirection.Backward);
97pos = _CreateTextPointer(fixedp, LogicalDirection.Forward);
104pos = _CreateTextPointer(fixedp, LogicalDirection.Forward);
175if (position.GetPointerContext(LogicalDirection.Forward) != TextPointerContext.None)
334LogicalDirection edge = position.LogicalDirection;
335LogicalDirection scanDir = LogicalDirection.Forward;
356scanDir = LogicalDirection.Backward;
370linesMoved = (scanDir == LogicalDirection.Forward) ? 1 : -1;
395if (scanDir == LogicalDirection.Backward)
501internal override ITextPointer GetNextCaretUnitPosition(ITextPointer position, LogicalDirection direction)
517CharacterHit next = (direction == LogicalDirection.Forward) ?
523LogicalDirection edge = LogicalDirection.Forward;
526edge = LogicalDirection.Backward;
604ITextPointer begin = _CreateTextPointer(new FixedPosition(fixedNodes[0], 0), LogicalDirection.Forward);
605ITextPointer end = _CreateTextPointer(new FixedPosition(lastNode, lastIndex), LogicalDirection.Backward);
637(tp.CompareTo(this.Start) == 0 && (tp.LogicalDirection == LogicalDirection.Forward || this.IsContainerStart)) ||
638(tp.CompareTo(this.End) == 0 && (tp.LogicalDirection == LogicalDirection.Backward || this.IsContainerEnd))
732_start = new FixedTextPointer(false, LogicalDirection.Forward, flowStart);
745_end = new FixedTextPointer(false, LogicalDirection.Backward, flowEnd);
784private void _GlyphRunHitTest(Glyphs g, double xoffset, out int charIndex, out LogicalDirection edge)
787edge = LogicalDirection.Forward;
805edge = (hit.TrailingLength > 0) ? LogicalDirection.Backward : LogicalDirection.Forward;
845LogicalDirection dir;
859itp = ((ITextPointer)this.Start).CreatePointer(LogicalDirection.Forward);
860itp.MoveToInsertionPosition(LogicalDirection.Forward);
864itp = ((ITextPointer)this.End).CreatePointer(LogicalDirection.Backward);
865itp.MoveToInsertionPosition(LogicalDirection.Backward);
874private bool _GetNextLineGlyphs(ref FixedPosition fixedp, ref LogicalDirection edge, double suggestedX, LogicalDirection scanDir)
879FixedNode[] fixedNodes = Container.FixedTextBuilder.GetNextLine(fixedp.Node, (scanDir == LogicalDirection.Forward), ref count);
1072LogicalDirection textdir = ftp.LogicalDirection;
1086textdir = LogicalDirection.Forward;
1089textdir = LogicalDirection.Backward;
1126LogicalDirection dir = LogicalDirection.Forward;
1130dir = LogicalDirection.Backward;
1159private ITextPointer _CreateTextPointer(FixedPosition fixedPosition, LogicalDirection edge)
1181LogicalDirection edge;
1191LogicalDirection dir = textPointer.LogicalDirection;
1192int increment = (dir == LogicalDirection.Forward ? +1 : -1);
System\Windows\Documents\ImmComposition.cs (25)
624caretNavigator = _caretOffset > 0 ? _startComposition.CreatePointer(_caretOffset, LogicalDirection.Forward) : _endComposition;
631ITextPointer startPosition = startNavigator.CreatePointer(LogicalDirection.Forward);
632ITextPointer endPosition = endNavigator.CreatePointer(LogicalDirection.Backward);
633ITextPointer caretPosition = caretNavigator.CreatePointer(LogicalDirection.Forward);
753rectCaret = view.GetRectangleFromTextPosition(_editor.Selection.End.CreatePointer(LogicalDirection.Backward));
1123start = range.Start.CreatePointer(resultLength, LogicalDirection.Forward);
1127ITextPointer caretPosition = _caretOffset >= 0 ? start.CreatePointer(_caretOffset, LogicalDirection.Forward) : end;
1166ITextPointer startAttribute = _startComposition.CreatePointer(startOffset, LogicalDirection.Backward);
1167ITextPointer endAttribute = _startComposition.CreatePointer(i + 1, LogicalDirection.Forward);
1397switch (navigator.GetPointerContext(LogicalDirection.Backward))
1401int copied = navigator.GetTextInRun(LogicalDirection.Backward, buffer, 0, buffer.Length);
1415if (!navigator.GetElementType(LogicalDirection.Backward).IsSubclassOf(typeof(Inline)))
1419navigator.MoveToNextContextPosition(LogicalDirection.Backward);
1428navigator.MoveToNextContextPosition(LogicalDirection.Backward);
1449switch (navigator.GetPointerContext(LogicalDirection.Forward))
1453int copied = navigator.GetTextInRun(LogicalDirection.Forward, buffer, 0, buffer.Length);
1466if (!navigator.GetElementType(LogicalDirection.Forward).IsSubclassOf(typeof(Inline)))
1470navigator.MoveToNextContextPosition(LogicalDirection.Forward);
1478navigator.MoveToNextContextPosition(LogicalDirection.Forward);
1521ITextPointer start = range.Start.CreatePointer(LogicalDirection.Backward);
1526ITextPointer end = start.CreatePointer(LogicalDirection.Forward);
1548switch (position.GetPointerContext(LogicalDirection.Backward))
1564switch (position.GetPointerContext(LogicalDirection.Forward))
1651positionNext.MoveToNextInsertionPosition(LogicalDirection.Forward);
1655positionNext.MoveToNextInsertionPosition(LogicalDirection.Backward);
System\Windows\Documents\ITextContainer.cs (7)
36ITextPointer CreatePointerAtOffset(int offset, LogicalDirection direction);
41ITextPointer CreatePointerAtCharOffset(int charOffset, LogicalDirection direction);
43ITextPointer CreateDynamicTextPointer(StaticTextPointer position, LogicalDirection direction);
47TextPointerContext GetPointerContext(StaticTextPointer pointer, LogicalDirection direction);
51int GetTextInRun(StaticTextPointer position, LogicalDirection direction, char[] textBuffer, int startIndex, int count);
53object GetAdjacentElement(StaticTextPointer position, LogicalDirection direction);
59StaticTextPointer GetNextContextPosition(StaticTextPointer position, LogicalDirection direction);
System\Windows\Documents\NullTextContainer.cs (10)
34_start = new NullTextPointer(this, LogicalDirection.Backward);
35_end = new NullTextPointer(this, LogicalDirection.Forward);
79ITextPointer ITextContainer.CreatePointerAtOffset(int offset, LogicalDirection direction)
85ITextPointer ITextContainer.CreatePointerAtCharOffset(int charOffset, LogicalDirection direction)
90ITextPointer ITextContainer.CreateDynamicTextPointer(StaticTextPointer position, LogicalDirection direction)
97return new StaticTextPointer(this, ((ITextContainer)this).CreatePointerAtOffset(offset, LogicalDirection.Forward));
100TextPointerContext ITextContainer.GetPointerContext(StaticTextPointer pointer, LogicalDirection direction)
110int ITextContainer.GetTextInRun(StaticTextPointer position, LogicalDirection direction, char[] textBuffer, int startIndex, int count)
115object ITextContainer.GetAdjacentElement(StaticTextPointer position, LogicalDirection direction)
130StaticTextPointer ITextContainer.GetNextContextPosition(StaticTextPointer position, LogicalDirection direction)
System\Windows\Documents\Speller.cs (46)
106internal SpellingError GetError(ITextPointer position, LogicalDirection direction, bool forceEvaluation)
140internal ITextPointer GetNextSpellingErrorPosition(ITextPointer position, LogicalDirection direction)
189ExpandToWordBreakAndContext(error.Start, LogicalDirection.Backward, language, out ITextPointer contentStart, out ITextPointer contextStart);
190ExpandToWordBreakAndContext(error.End, LogicalDirection.Forward, language, out ITextPointer contentEnd, out ITextPointer contextEnd);
235if (_statusTable.GetError(pointer, LogicalDirection.Forward, out errorStart, out errorEnd))
245pointer = _statusTable.GetNextErrorTransition(pointer, LogicalDirection.Forward);
662end = GetNextLanguageTransition(start, LogicalDirection.Forward, language, end);
703wordBreakLeft = SearchForWordBreaks(caretPosition, LogicalDirection.Backward, language, 1, false /* stopOnError */);
704wordBreakRight = SearchForWordBreaks(caretPosition, LogicalDirection.Forward, language, 1, false /* stopOnError */);
719FindPositionInSegmentList(textMap, LogicalDirection.Backward, segments, out leftBreakOffset, out rightBreakOffset);
789ExpandToWordBreakAndContext(start, LogicalDirection.Backward, language, out contentStart, out contextStart);
790ExpandToWordBreakAndContext(end, LogicalDirection.Forward, language, out contentEnd, out contextEnd);
1081private void ExpandToWordBreakAndContext(ITextPointer position, LogicalDirection direction, XmlLanguage language,
1091LogicalDirection inwardDirection;
1117inwardDirection = direction == LogicalDirection.Forward ? LogicalDirection.Backward : LogicalDirection.Forward;
1123if (direction == LogicalDirection.Backward)
1158if (direction == LogicalDirection.Backward)
1175if (direction == LogicalDirection.Backward)
1202if (direction == LogicalDirection.Backward)
1231private int FindPositionInSegmentList(TextMap textMap, LogicalDirection direction, ArrayList segments,
1290if (direction == LogicalDirection.Backward)
1311private ITextPointer SearchForWordBreaks(ITextPointer position, LogicalDirection direction, XmlLanguage language, int minWordCount, bool stopOnError)
1329closestErrorPosition = nextErrorTransition.CreateDynamicTextPointer(LogicalDirection.Forward);
1337searchPosition.MoveByOffset(direction == LogicalDirection.Backward ? -ContextBlockSize : +ContextBlockSize);
1342if (direction == LogicalDirection.Backward && closestErrorPosition.CompareTo(searchPosition) > 0 ||
1343direction == LogicalDirection.Forward && closestErrorPosition.CompareTo(searchPosition) < 0)
1353if (direction == LogicalDirection.Backward && closestLanguageTransition.CompareTo(searchPosition) > 0 ||
1354direction == LogicalDirection.Forward && closestLanguageTransition.CompareTo(searchPosition) < 0)
1360if (direction == LogicalDirection.Backward)
1383private ITextPointer GetNextLanguageTransition(ITextPointer position, LogicalDirection direction, XmlLanguage language, ITextPointer haltPosition)
1387while ((direction == LogicalDirection.Forward && navigator.CompareTo(haltPosition) < 0) ||
1388(direction == LogicalDirection.Backward && navigator.CompareTo(haltPosition) > 0))
1397if ((direction == LogicalDirection.Forward && navigator.CompareTo(haltPosition) > 0) ||
1398(direction == LogicalDirection.Backward && navigator.CompareTo(haltPosition) < 0))
1460private void ScanPosition(ITextPointer position, LogicalDirection direction)
1465if (direction == LogicalDirection.Forward)
1654_basePosition = contextStart.GetFrozenPointer(LogicalDirection.Backward);
1681switch (position.GetPointerContext(LogicalDirection.Forward))
1684runCount = position.GetTextRunLength(LogicalDirection.Forward);
1688position.GetTextInRun(LogicalDirection.Forward, _text, _textLength, runCount);
1724position.MoveToNextContextPosition(LogicalDirection.Forward);
1732position.MoveToNextContextPosition(LogicalDirection.Forward);
1799context = pointer.GetPointerContext(LogicalDirection.Forward);
1802TextSchema.IsFormattingType(pointer.GetElementType(LogicalDirection.Forward)))
System\Windows\Documents\SpellerStatusTable.cs (20)
90for (index = FindIndex(searchStart.CreateStaticPointer(), LogicalDirection.Forward); index >= 0 && index < _runList.Count; index++)
126runIndex = FindIndex(start.CreateStaticPointer(), LogicalDirection.Forward);
162internal bool IsRunType(StaticTextPointer textPosition, LogicalDirection direction, RunType runType)
177internal StaticTextPointer GetNextErrorTransition(StaticTextPointer textPosition, LogicalDirection direction)
192else if (direction == LogicalDirection.Forward)
242internal bool GetError(StaticTextPointer textPosition, LogicalDirection direction,
262internal bool GetRun(StaticTextPointer position, LogicalDirection direction, out RunType runType, out StaticTextPointer end)
277end = (direction == LogicalDirection.Forward) ? GetRunEndPosition(index) : run.Position.CreateStaticPointer();
307private int GetErrorIndex(StaticTextPointer textPosition, LogicalDirection direction)
330private int FindIndex(StaticTextPointer position, LogicalDirection direction)
347if (direction == LogicalDirection.Forward && position.CompareTo(run.Position) < 0 ||
348direction == LogicalDirection.Backward && position.CompareTo(run.Position) <= 0)
353else if (direction == LogicalDirection.Forward && position.CompareTo(GetRunEndPosition(index)) >= 0 ||
354direction == LogicalDirection.Backward && position.CompareTo(GetRunEndPosition(index)) > 0)
390startIndex = FindIndex(start.CreateStaticPointer(), LogicalDirection.Forward);
391endIndex = FindIndex(end.CreateStaticPointer(), LogicalDirection.Backward);
426endIndex = FindIndex(end.CreateStaticPointer(), LogicalDirection.Backward);
591index = FindIndex(position.CreateStaticPointer(), LogicalDirection.Backward);
750return GetRunEndPosition(index).CreateDynamicTextPointer(LogicalDirection.Forward);
798_position = position.GetFrozenPointer(LogicalDirection.Backward);
System\Windows\Documents\TextContainer.cs (36)
428ITextPointer ITextContainer.CreatePointerAtOffset(int offset, LogicalDirection direction)
436internal TextPointer CreatePointerAtOffset(int offset, LogicalDirection direction)
445ITextPointer ITextContainer.CreatePointerAtCharOffset(int charOffset, LogicalDirection direction)
459internal TextPointer CreatePointerAtCharOffset(int charOffset, LogicalDirection direction)
472ITextPointer ITextContainer.CreateDynamicTextPointer(StaticTextPointer position, LogicalDirection direction)
499TextPointerContext ITextContainer.GetPointerContext(StaticTextPointer pointer, LogicalDirection direction)
510else if (direction == LogicalDirection.Forward)
512edge = node.GetEdgeFromOffset(nodeOffset, LogicalDirection.Forward);
517edge = node.GetEdgeFromOffset(nodeOffset, LogicalDirection.Backward);
549int ITextContainer.GetTextInRun(StaticTextPointer position, LogicalDirection direction, char[] textBuffer, int startIndex, int count)
565object ITextContainer.GetAdjacentElement(StaticTextPointer position, LogicalDirection direction)
612StaticTextPointer ITextContainer.GetNextContextPosition(StaticTextPointer position, LogicalDirection direction)
629edge = (direction == LogicalDirection.Backward) ? ElementEdge.AfterStart : ElementEdge.BeforeEnd;
635TextTreeTextNode nextTextNode = ((direction == LogicalDirection.Forward) ? node.GetNextNode() : node.GetPreviousNode()) as TextTreeTextNode;
640edge = (direction == LogicalDirection.Backward) ? ElementEdge.BeforeStart : ElementEdge.AfterEnd;
644else if (direction == LogicalDirection.Forward)
646edge = node.GetEdgeFromOffset(nodeOffset, LogicalDirection.Forward);
651edge = node.GetEdgeFromOffset(nodeOffset, LogicalDirection.Backward);
823LogicalDirection direction;
857originalPosition = this.HasListeners ? new TextPointer(position, LogicalDirection.Backward) : null;
869direction = LogicalDirection.Backward;
873direction = LogicalDirection.Forward;
882if ((direction == LogicalDirection.Backward && textNode.AfterEndReferenceCount) ||
883(direction == LogicalDirection.Forward && textNode.BeforeStartReferenceCount))
1040newFirstIMEVisibleNode = startPosition.GetAdjacentTextElementNodeSibling(LogicalDirection.Forward);
1259deletePosition = new TextPointer(startPosition, LogicalDirection.Forward);
1585if (!_rootNode.CaretUnitBoundaryCache && position.LogicalDirection == LogicalDirection.Backward)
1593TextPointer positionForwardGravity = position.GetPositionAtOffset(0, LogicalDirection.Forward);
1628startPosition = new TextPointer(this, _rootNode, ElementEdge.AfterStart, LogicalDirection.Backward);
1659endPosition = new TextPointer(this, _rootNode, ElementEdge.BeforeEnd, LogicalDirection.Forward);
2410node = startPosition.GetAdjacentSiblingNode(LogicalDirection.Forward);
2411stopNode = endPosition.GetAdjacentSiblingNode(LogicalDirection.Forward);
2763startPosition = new TextPointer(this, elementNode, ElementEdge.BeforeStart, LogicalDirection.Backward);
2768endPosition = new TextPointer(this, elementNode, ElementEdge.AfterEnd, LogicalDirection.Backward);
3389TextElement adjacentElement = startPosition.GetAdjacentElement(LogicalDirection.Forward) as TextElement;
3392nextIMEVisibleNode = (TextTreeTextElementNode)endPosition.GetAdjacentSiblingNode(LogicalDirection.Forward);
System\windows\Documents\TextEditorSelection.cs (91)
112ITextPointer lineStart = position.CreatePointer(LogicalDirection.Forward);
114ITextPointer lineEnd = position.CreatePointer(LogicalDirection.Backward);
187LogicalDirection movementDirection = IsFlowDirectionRightToLeftThenTopToBottom(This) ? LogicalDirection.Backward : LogicalDirection.Forward;
203LogicalDirection movementDirection = IsFlowDirectionRightToLeftThenTopToBottom(This) ? LogicalDirection.Forward : LogicalDirection.Backward;
220LogicalDirection movementDirection = IsFlowDirectionRightToLeftThenTopToBottom(This) ? LogicalDirection.Backward : LogicalDirection.Forward;
236LogicalDirection movementDirection = IsFlowDirectionRightToLeftThenTopToBottom(This) ? LogicalDirection.Forward : LogicalDirection.Backward;
312ITextPointer nextPosition = lineEndPosition.GetNextInsertionPosition(LogicalDirection.Forward);
402ITextPointer previousPosition = lineStartPosition.GetNextInsertionPosition(LogicalDirection.Backward);
463if (movingPointer.MoveToNextInsertionPosition(LogicalDirection.Forward))
467This.Selection.SetCaretToPosition(paragraphRange.Start, LogicalDirection.Backward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
472This.Selection.SetCaretToPosition(paragraphRange.End, LogicalDirection.Backward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
516This.Selection.SetCaretToPosition(paragraphRange.Start, LogicalDirection.Backward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
521if (movingPointer.MoveToNextInsertionPosition(LogicalDirection.Backward))
525This.Selection.SetCaretToPosition(paragraphRange.Start, LogicalDirection.Backward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
802ITextPointer caretPosition = lineRange.Start.GetFrozenPointer(LogicalDirection.Forward);
805This.Selection.SetCaretToPosition(caretPosition, LogicalDirection.Forward, /*allowStopAtLineEnd:*/true, /*allowStopNearSpace:*/true);
851LogicalDirection orientation = TextPointerBase.IsNextToPlainLineBreak(lineRange.End, LogicalDirection.Backward) ? LogicalDirection.Forward : LogicalDirection.Backward;
885This.Selection.SetCaretToPosition(This.TextContainer.Start, LogicalDirection.Forward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
914This.Selection.SetCaretToPosition(This.TextContainer.End, LogicalDirection.Backward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
945LogicalDirection movementDirection = IsFlowDirectionRightToLeftThenTopToBottom(This) ? LogicalDirection.Backward : LogicalDirection.Forward;
961LogicalDirection movementDirection = IsFlowDirectionRightToLeftThenTopToBottom(This) ? LogicalDirection.Forward : LogicalDirection.Backward;
977LogicalDirection movementDirection = IsFlowDirectionRightToLeftThenTopToBottom(This) ? LogicalDirection.Backward : LogicalDirection.Forward;
993LogicalDirection movementDirection = IsFlowDirectionRightToLeftThenTopToBottom(This) ? LogicalDirection.Forward : LogicalDirection.Backward;
1011if (This.Selection.ExtendToNextTableRow(LogicalDirection.Forward))
1069ITextPointer nextPosition = lineEndPosition.GetNextInsertionPosition(LogicalDirection.Forward);
1121if (TextPointerBase.IsNextToAnyBreak(newMovingPosition, LogicalDirection.Forward) ||
1122newMovingPosition.GetNextInsertionPosition(LogicalDirection.Forward) == null)
1131newMovingPosition = newMovingPosition.GetInsertionPosition(LogicalDirection.Forward);
1132newMovingPosition = newMovingPosition.GetNextInsertionPosition(LogicalDirection.Forward);
1141newMovingPosition = newMovingPosition.GetFrozenPointer(LogicalDirection.Backward);
1159if (newMovingPosition.GetNextInsertionPosition(LogicalDirection.Forward) == null)
1183if (This.Selection.ExtendToNextTableRow(LogicalDirection.Backward))
1259ITextPointer previousPosition = lineStartPosition.GetNextInsertionPosition(LogicalDirection.Backward);
1320if (movingPointer.MoveToNextInsertionPosition(LogicalDirection.Forward))
1368if (movingPointer.MoveToNextInsertionPosition(LogicalDirection.Backward))
1602ExtendSelectionAndBringIntoView(lineRange.Start.CreatePointer(LogicalDirection.Forward), This);
1654if (TextPointerBase.IsNextToPlainLineBreak(destination, LogicalDirection.Forward) ||
1655TextPointerBase.IsNextToRichLineBreak(destination, LogicalDirection.Forward))
1664destination = destination.GetNextInsertionPosition(LogicalDirection.Forward);
1668else if (TextPointerBase.IsNextToParagraphBreak(destination, LogicalDirection.Forward) &&
1669TextPointerBase.IsNextToParagraphBreak(This.Selection.AnchorPosition, LogicalDirection.Backward))
1673ITextPointer newDestination = destination.GetNextInsertionPosition(LogicalDirection.Forward);
1687destination = destination.GetFrozenPointer(LogicalDirection.Backward);
2036private static void MoveToCharacterLogicalDirection(TextEditor textEditor, LogicalDirection direction, bool extend)
2056ITextPointer movingEnd = (direction == LogicalDirection.Forward ? textEditor.Selection.End : textEditor.Selection.Start);
2066LogicalDirection contentDirection = direction == LogicalDirection.Forward ? LogicalDirection.Backward : LogicalDirection.Forward;
2097private static void NavigateWordLogicalDirection(TextEditor textEditor, LogicalDirection direction)
2114if (direction == LogicalDirection.Forward)
2117if (!textEditor.Selection.IsEmpty && TextPointerBase.IsAtWordBoundary(textEditor.Selection.End, LogicalDirection.Forward))
2120textEditor.Selection.SetCaretToPosition(textEditor.Selection.End, LogicalDirection.Backward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
2127TextPointerBase.MoveToNextWordBoundary(wordBoundary, LogicalDirection.Forward);
2129textEditor.Selection.SetCaretToPosition(wordBoundary, LogicalDirection.Backward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
2137if (!textEditor.Selection.IsEmpty && TextPointerBase.IsAtWordBoundary(textEditor.Selection.Start, LogicalDirection.Forward))
2140textEditor.Selection.SetCaretToPosition(textEditor.Selection.Start, LogicalDirection.Forward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
2147TextPointerBase.MoveToNextWordBoundary(wordBoundary, LogicalDirection.Backward);
2149textEditor.Selection.SetCaretToPosition(wordBoundary, LogicalDirection.Forward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
2172private static void ExtendWordLogicalDirection(TextEditor textEditor, LogicalDirection direction)
2193wordBoundary.SetLogicalDirection(direction == LogicalDirection.Forward ? LogicalDirection.Backward : LogicalDirection.Forward);
2305movingPosition.LogicalDirection == LogicalDirection.Backward &&
2307TextPointerBase.IsNextToAnyBreak(movingPosition, LogicalDirection.Backward))
2309movingPosition = movingPosition.GetNextInsertionPosition(LogicalDirection.Backward);
2313if (TextPointerBase.IsNextToPlainLineBreak(movingPosition, LogicalDirection.Backward))
2315movingPosition = movingPosition.GetFrozenPointer(LogicalDirection.Forward);
2332return This.Selection.IsEmpty ? This.Selection.Start : This.Selection.Start.GetFrozenPointer(LogicalDirection.Forward);
2395ITextPointer position = This.Selection.Start.GetNextInsertionPosition(LogicalDirection.Backward);
2398This.Selection.SetCaretToPosition(position, LogicalDirection.Forward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
2411ITextPointer cellEnd = position.GetNextInsertionPosition(LogicalDirection.Backward);
System\windows\Documents\TextEditorSpelling.cs (22)
35internal static SpellingError GetSpellingErrorAtPosition(TextEditor This, ITextPointer position, LogicalDirection direction)
58LogicalDirection direction = This.Selection.IsEmpty ? This.Selection.Start.LogicalDirection : LogicalDirection.Forward;
66direction = (direction == LogicalDirection.Forward) ? LogicalDirection.Backward : LogicalDirection.Forward;
81direction = (direction == LogicalDirection.Forward) ? LogicalDirection.Backward : LogicalDirection.Forward;
86direction = LogicalDirection.Forward;
90direction = LogicalDirection.Backward;
100internal static ITextPointer GetNextSpellingErrorPosition(TextEditor This, ITextPointer position, LogicalDirection direction)
147caretPosition = textStart.CreatePointer(+correctedText.Length, LogicalDirection.Forward);
183textStart = spellingError.Start.CreatePointer(LogicalDirection.Backward);
185textStart.GetPointerContext(LogicalDirection.Forward) != TextPointerContext.Text)
187textStart.MoveToNextContextPosition(LogicalDirection.Forward);
191textEnd.GetPointerContext(LogicalDirection.Backward) != TextPointerContext.Text)
193textEnd.MoveToNextContextPosition(LogicalDirection.Backward);
196if (textStart.GetPointerContext(LogicalDirection.Forward) != TextPointerContext.Text ||
201Invariant.Assert(textEnd.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.Text &&
252private static ITextPointer GetNextTextPosition(ITextPointer position, ITextPointer limit, LogicalDirection direction, out char character)
315position = GetNextTextPosition(position, limit, LogicalDirection.Forward, out character);
System\windows\Documents\TextEditorTyping.cs (36)
533ITextPointer deletePosition = position.GetNextInsertionPosition(LogicalDirection.Forward);
556This.Selection.ExtendToNextInsertionPosition(LogicalDirection.Forward);
610ITextPointer deletePosition = position.GetNextInsertionPosition(LogicalDirection.Backward);
635position = position.GetFrozenPointer(LogicalDirection.Backward);
642position.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.Text)
664This.Selection.ExtendToNextInsertionPosition(LogicalDirection.Backward);
672else if (backspacePosition.GetPointerContext(LogicalDirection.Backward) != TextPointerContext.Text)
681This.Selection.ExtendToNextInsertionPosition(LogicalDirection.Backward);
713This.Selection.SetCaretToPosition(position, LogicalDirection.Backward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/true);
729LogicalDirection directionOfDelete = position.CompareTo(deletePosition) < 0 ? LogicalDirection.Forward : LogicalDirection.Backward;
736if (directionOfDelete == LogicalDirection.Forward)
763if (directionOfDelete == LogicalDirection.Backward)
800position.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart &&
801position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementEnd)
806while (position.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart)
813position = position.GetNextContextPosition(LogicalDirection.Backward);
814if (position.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart &&
822position = position.GetNextContextPosition(LogicalDirection.Backward);
833if (position.GetPointerContext(LogicalDirection.Backward) != TextPointerContext.ElementStart)
839position.GetPointerContext(LogicalDirection.Forward) != TextPointerContext.ElementEnd)
847while (navigator.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart &&
854if (!(navigator.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart &&
903TextPointerBase.MoveToNextWordBoundary(wordBoundary, LogicalDirection.Forward);
962TextPointerBase.MoveToNextWordBoundary(wordBoundary, LogicalDirection.Backward);
1071This.Selection.SetCaretToPosition(This.Selection.End, LogicalDirection.Forward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
1162This.Selection.SetCaretToPosition(range.Start, LogicalDirection.Forward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
1331if (HandleTabInTables(This, LogicalDirection.Forward))
1363if (HandleTabInTables(This, LogicalDirection.Backward))
1384private static bool HandleTabInTables(TextEditor This, LogicalDirection direction)
1395This.Selection.SetCaretToPosition(This.Selection.Start, LogicalDirection.Backward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
1408if (direction == LogicalDirection.Forward)
1445if (direction == LogicalDirection.Forward)
1543ITextPointer caretPosition = This.Selection.End.CreatePointer(LogicalDirection.Backward);
1546This.Selection.SetCaretToPosition(caretPosition, LogicalDirection.Backward, /*allowStopAtLineEnd:*/true, /*allowStopNearSpace:*/true);
System\Windows\Documents\TextElement.cs (7)
287TextPointer contentStart = new TextPointer(tree, _textElementNode, ElementEdge.AfterStart, LogicalDirection.Backward);
290TextPointer contentEnd = new TextPointer(tree, _textElementNode, ElementEdge.BeforeEnd, LogicalDirection.Forward);
313elementStart = new TextPointer(tree, _textElementNode, ElementEdge.BeforeStart, LogicalDirection.Forward);
346contentStart = new TextPointer(tree, _textElementNode, ElementEdge.AfterStart, LogicalDirection.Backward);
379contentEnd = new TextPointer(tree, _textElementNode, ElementEdge.BeforeEnd, LogicalDirection.Forward);
420elementEnd = new TextPointer(tree, _textElementNode, ElementEdge.AfterEnd, LogicalDirection.Backward);
993beforeStart = new TextPointer(tree, _textElementNode, ElementEdge.BeforeStart, LogicalDirection.Forward);
System\Windows\Documents\TextPointer.cs (97)
270internal TextPointer(TextPointer position, LogicalDirection direction)
276internal TextPointer(TextPointer position, int offset, LogicalDirection direction)
282internal TextPointer(TextContainer textContainer, int offset, LogicalDirection direction)
300Initialize(tree, node, edge, LogicalDirection.Forward, tree.PositionGeneration, false, false, tree.LayoutGeneration);
304internal TextPointer(TextContainer tree, TextTreeNode node, ElementEdge edge, LogicalDirection direction)
316internal TextPointer CreatePointer(LogicalDirection gravity)
495/// is <see cref="System.Windows.Documents.LogicalDirection.Backward"/>, or if it is positioned
497/// <see cref="System.Windows.Documents.LogicalDirection.Forward"/>.</para>
538public TextPointerContext GetPointerContext(LogicalDirection direction)
546return (direction == LogicalDirection.Forward) ? GetPointerContextForward(_node, this.Edge) : GetPointerContextBackward(_node, this.Edge);
560public int GetTextRunLength(LogicalDirection direction)
581if (direction == LogicalDirection.Forward)
597textNode = ((direction == LogicalDirection.Forward) ? textNode.GetNextNode() : textNode.GetPreviousNode()) as TextTreeTextNode;
731public string GetTextInRun(LogicalDirection direction)
769public int GetTextInRun(LogicalDirection direction, char[] textBuffer, int startIndex, int count)
803public DependencyObject GetAdjacentElement(LogicalDirection direction)
896public TextPointer GetPositionAtOffset(int offset, LogicalDirection direction)
984public TextPointer GetNextContextPosition(LogicalDirection direction)
1057public TextPointer GetInsertionPosition(LogicalDirection direction)
1065return GetInsertionPosition(LogicalDirection.Forward);
1084/// "insertion position" in the <see cref="TextPointer.GetInsertionPosition(LogicalDirection)"/>
1124public TextPointer GetNextInsertionPosition(LogicalDirection direction)
1221position.SetLogicalDirection(LogicalDirection.Forward);
1242public Rect GetCharacterRect(LogicalDirection direction)
1324LogicalDirection direction = count < 0 ? LogicalDirection.Backward : LogicalDirection.Forward;
1529public LogicalDirection LogicalDirection
1609TextPointerContext backwardContext = position.GetPointerContext(LogicalDirection.Backward);
1613TextSchema.IsFormattingType(position.GetAdjacentElement(LogicalDirection.Backward).GetType()))
1615position.MoveToNextContextPosition(LogicalDirection.Backward);
1616backwardContext = position.GetPointerContext(LogicalDirection.Backward);
1744internal static int GetTextInRun(TextContainer textContainer, int symbolOffset, TextTreeTextNode textNode, int nodeOffset, LogicalDirection direction, char[] textBuffer, int startIndex, int count)
1776skipCount = (direction == LogicalDirection.Forward) ? nodeOffset : textNode.SymbolCount - nodeOffset;
1793textNode = ((direction == LogicalDirection.Forward) ? textNode.GetNextNode() : textNode.GetPreviousNode()) as TextTreeTextNode;
1797if (direction == LogicalDirection.Backward)
1810internal static DependencyObject GetAdjacentElement(TextTreeNode node, ElementEdge edge, LogicalDirection direction)
1966internal bool MoveToNextContextPosition(LogicalDirection direction)
1979if (direction == LogicalDirection.Forward)
2026internal bool MoveToInsertionPosition(LogicalDirection direction)
2069internal bool MoveToNextInsertionPosition(LogicalDirection direction)
2162internal TextElement GetAdjacentElementFromOuterPosition(LogicalDirection direction)
2180internal void SetLogicalDirection(LogicalDirection direction)
2333internal TextPointer GetFrozenPointer(LogicalDirection logicalDirection)
2342void ITextPointer.SetLogicalDirection(LogicalDirection direction)
2382TextPointerContext ITextPointer.GetPointerContext(LogicalDirection direction)
2387int ITextPointer.GetTextRunLength(LogicalDirection direction)
2393string ITextPointer.GetTextInRun(LogicalDirection direction)
2398int ITextPointer.GetTextInRun(LogicalDirection direction, char[] textBuffer, int startIndex, int count)
2403object ITextPointer.GetAdjacentElement(LogicalDirection direction)
2408Type ITextPointer.GetElementType(LogicalDirection direction)
2445ITextPointer ITextPointer.GetNextContextPosition(LogicalDirection direction)
2460ITextPointer ITextPointer.GetInsertionPosition(LogicalDirection direction)
2471ITextPointer ITextPointer.GetFormatNormalizedPosition(LogicalDirection direction)
2480ITextPointer ITextPointer.GetNextInsertionPosition(LogicalDirection direction)
2574ITextPointer ITextPointer.CreatePointer(LogicalDirection gravity)
2579ITextPointer ITextPointer.CreatePointer(int offset, LogicalDirection gravity)
2590ITextPointer ITextPointer.GetFrozenPointer(LogicalDirection logicalDirection)
2596bool ITextPointer.MoveToNextContextPosition(LogicalDirection direction)
2653Rect ITextPointer.GetCharacterRect(LogicalDirection direction)
2658bool ITextPointer.MoveToInsertionPosition(LogicalDirection direction)
2663bool ITextPointer.MoveToNextInsertionPosition(LogicalDirection direction)
2673internal bool MoveToCaretPosition(LogicalDirection contentDirection)
2676LogicalDirection oppositeDirection;
2697oppositeDirection = (contentDirection == LogicalDirection.Forward) ? LogicalDirection.Backward : LogicalDirection.Forward;
2708internal bool MoveToNextCaretPosition(LogicalDirection direction)
2809internal TextTreeTextNode GetAdjacentTextNodeSibling(LogicalDirection direction)
2816internal static TextTreeTextNode GetAdjacentTextNodeSibling(TextTreeNode node, ElementEdge edge, LogicalDirection direction)
2823internal TextTreeTextElementNode GetAdjacentTextElementNodeSibling(LogicalDirection direction)
2830internal TextTreeTextElementNode GetAdjacentTextElementNode(LogicalDirection direction)
2837internal TextTreeNode GetAdjacentSiblingNode(LogicalDirection direction)
2844internal static TextTreeNode GetAdjacentSiblingNode(TextTreeNode node, ElementEdge edge, LogicalDirection direction)
2848if (direction == LogicalDirection.Forward)
3004if (GetGravityInternal() == LogicalDirection.Forward)
3435symbolType = node.GetPointerContext(LogicalDirection.Forward);
3442symbolType = firstContainedNode.GetPointerContext(LogicalDirection.Forward);
3460symbolType = nextNode.GetPointerContext(LogicalDirection.Forward);
3492symbolType = previousNode.GetPointerContext(LogicalDirection.Backward);
3512symbolType = lastChildNode.GetPointerContext(LogicalDirection.Backward);
3521symbolType = node.GetPointerContext(LogicalDirection.Backward);
3672LogicalDirection ITextPointer.LogicalDirection
3887private void InitializeOffset(TextPointer position, int distance, LogicalDirection direction)
3924private void Initialize(TextContainer tree, TextTreeNode node, ElementEdge edge, LogicalDirection gravity, uint generation,
3984private static void RepositionForGravity(ref TextTreeNode node, ref ElementEdge edge, LogicalDirection gravity)
3995if (gravity == LogicalDirection.Backward)
4008if (gravity == LogicalDirection.Forward)
4021if (gravity == LogicalDirection.Backward)
4034if (gravity == LogicalDirection.Forward)
4052private LogicalDirection GetGravityInternal()
4054return (this.Edge == ElementEdge.BeforeStart || this.Edge == ElementEdge.BeforeEnd) ? LogicalDirection.Forward : LogicalDirection.Backward;
4067internal TextTreeNode GetAdjacentNode(LogicalDirection direction)
4072internal static TextTreeNode GetAdjacentNode(TextTreeNode node, ElementEdge edge, LogicalDirection direction)
4116private TextElement GetElement(LogicalDirection direction)
4135if (GetGravityInternal() == LogicalDirection.Forward)
System\Windows\Documents\TextPointerBase.cs (111)
55internal static string GetTextInRun(ITextPointer position, LogicalDirection direction)
73internal static int GetTextWithLimit(ITextPointer thisPointer, LogicalDirection direction, char[] textBuffer, int startIndex, int count, ITextPointer limit)
82else if (direction == LogicalDirection.Forward && limit.CompareTo(thisPointer) <= 0)
87else if (direction == LogicalDirection.Backward && limit.CompareTo(thisPointer) >= 0)
99if (direction == LogicalDirection.Forward)
181Type forwardType = forwardPosition.GetElementType(LogicalDirection.Forward);
182Type backwardType = backwardPosition.GetElementType(LogicalDirection.Backward);
185TextPointerContext forwardContext = forwardPosition.GetPointerContext(LogicalDirection.Forward);
186TextPointerContext backwardContext = backwardPosition.GetPointerContext(LogicalDirection.Backward);
227TextPointerContext backwardContext = position.GetPointerContext(LogicalDirection.Backward);
228TextPointerContext forwardContext = position.GetPointerContext(LogicalDirection.Forward);
251TextPointerContext forwardContext = position.GetPointerContext(LogicalDirection.Forward);
252TextPointerContext backwardContext = position.GetPointerContext(LogicalDirection.Backward);
256typeof(Table).IsAssignableFrom(position.GetElementType(LogicalDirection.Forward)));
269position.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart;
275position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementEnd;
320BorderingElementCategory category = GetBorderingElementCategory(navigator, LogicalDirection.Forward);
327navigator.MoveToNextContextPosition(LogicalDirection.Forward);
329while (GetBorderingElementCategory(navigator, LogicalDirection.Forward) == BorderingElementCategory.MergeableScopingInline);
335elementType = navigator.GetElementType(LogicalDirection.Forward);
339navigator.MoveToNextContextPosition(LogicalDirection.Forward);
356elementType = navigator.GetElementType(LogicalDirection.Forward);
359navigator.MoveToNextInsertionPosition(LogicalDirection.Forward);
372navigator.MoveToNextContextPosition(LogicalDirection.Forward);
374while (navigator.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementStart);
385return IsAtNonMergeableInlineEdge(position, LogicalDirection.Backward);
391return IsAtNonMergeableInlineEdge(position, LogicalDirection.Forward);
401internal static bool IsAtFormatNormalizedPosition(ITextPointer position, LogicalDirection direction)
406internal static bool IsAtInsertionPosition(ITextPointer position, LogicalDirection direction)
411internal static bool IsAtNormalizedPosition(ITextPointer position, LogicalDirection direction, bool respectCaretUnitBoundaries)
420if (position.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart &&
421position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementEnd)
466internal static bool IsAtWordBoundary(ITextPointer thisPosition, LogicalDirection insideWordDirection)
509return GetWordRange(thisPosition, LogicalDirection.Forward);
521internal static TextSegment GetWordRange(ITextPointer thisPosition, LogicalDirection direction)
544if (moved && IsAtWordBoundary(thisPosition, /*insideWordDirection:*/LogicalDirection.Forward))
551MoveToNextWordBoundary(navigator, direction == LogicalDirection.Backward ? LogicalDirection.Forward : LogicalDirection.Backward);
555if (direction == LogicalDirection.Backward)
564wordStart = RestrictWithinBlock(thisPosition, wordStart, LogicalDirection.Backward);
565wordEnd = RestrictWithinBlock(thisPosition, wordEnd, LogicalDirection.Forward);
570wordStart = wordStart.GetFrozenPointer(LogicalDirection.Backward);
571wordEnd = wordEnd.GetFrozenPointer(LogicalDirection.Forward);
575wordStart = wordEnd.GetFrozenPointer(LogicalDirection.Backward);
583private static ITextPointer RestrictWithinBlock(ITextPointer position, ITextPointer limit, LogicalDirection direction)
585Invariant.Assert(!(direction == LogicalDirection.Backward) || position.CompareTo(limit) >= 0, "for backward direction position must be >= than limit");
586Invariant.Assert(!(direction == LogicalDirection.Forward) || position.CompareTo(limit) <= 0, "for forward direcion position must be <= than linit");
588while (direction == LogicalDirection.Backward ? position.CompareTo(limit) > 0 : position.CompareTo(limit) < 0)
609return limit.GetInsertionPosition(direction == LogicalDirection.Backward ? LogicalDirection.Forward : LogicalDirection.Backward);
618internal static bool IsNextToPlainLineBreak(ITextPointer thisPosition, LogicalDirection direction)
628(direction == LogicalDirection.Backward && IsCharUnicodeNewLine(textBuffer[1]))
630(direction == LogicalDirection.Forward && IsCharUnicodeNewLine(textBuffer[0]))
646internal static bool IsNextToRichLineBreak(ITextPointer thisPosition, LogicalDirection direction)
655internal static bool IsNextToParagraphBreak(ITextPointer thisPosition, LogicalDirection direction)
666internal static bool IsNextToAnyBreak(ITextPointer thisPosition, LogicalDirection direction)
696bool isAtLineWrappingPosition = position.LogicalDirection == LogicalDirection.Forward
711thisPosition.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementEnd &&
712thisPosition.GetPointerContext(LogicalDirection.Backward) != TextPointerContext.ElementStart;
722return thisPosition.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.None &&
723thisPosition.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementEnd &&
724!typeof(Inline).IsAssignableFrom(thisPosition.GetElementType(LogicalDirection.Backward));
738while (pointer.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart)
744pointer = pointer.GetNextContextPosition(LogicalDirection.Backward);
776paragraphOrBlockUIContainer.ElementStart.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart)
853internal static Rect GetCharacterRect(ITextPointer thisPointer, LogicalDirection direction)
859internal static Rect GetCharacterRect(ITextPointer thisPointer, LogicalDirection direction, bool transformToUiScope)
920internal static bool MoveToFormatNormalizedPosition(ITextPointer thisNavigator, LogicalDirection direction)
933internal static bool MoveToInsertionPosition(ITextPointer thisNavigator, LogicalDirection direction)
956internal static bool MoveToNextInsertionPosition(ITextPointer thisNavigator, LogicalDirection direction)
962int increment = direction == LogicalDirection.Forward ? +1 : -1;
979if ((direction == LogicalDirection.Forward && initialPosition.CompareTo(thisNavigator) < 0) ||
980(direction == LogicalDirection.Backward && thisNavigator.CompareTo(initialPosition) < 0))
1010if (direction == LogicalDirection.Backward)
1023while (TextSchema.IsFormattingType(thisNavigator.GetElementType(LogicalDirection.Forward))
1034if (direction == LogicalDirection.Forward)
1064internal static bool MoveToNextWordBoundary(ITextPointer thisNavigator, LogicalDirection movingDirection)
1085if (IsAtWordBoundary(thisNavigator, /*insideWordDirection:*/LogicalDirection.Forward))
1096internal static ITextPointer GetFrozenPointer(ITextPointer thisPointer, LogicalDirection logicalDirection)
1135private static bool NormalizePosition(ITextPointer thisNavigator, LogicalDirection direction, bool respectCaretUnitBoundaries)
1141LogicalDirection oppositeDirection;
1145if (direction == LogicalDirection.Forward)
1148oppositeDirection = LogicalDirection.Backward;
1155oppositeDirection = LogicalDirection.Forward;
1251private static int LeaveNonMergeableInlineBoundary(ITextPointer thisNavigator, LogicalDirection direction, int symbolCount)
1255if (direction == LogicalDirection.Forward && IsAtNonMergeableInlineEnd(thisNavigator))
1257symbolCount += LeaveNonMergeableAncestor(thisNavigator, LogicalDirection.Forward);
1261symbolCount += LeaveNonMergeableAncestor(thisNavigator, LogicalDirection.Backward);
1266if (direction == LogicalDirection.Backward && IsAtNonMergeableInlineStart(thisNavigator))
1268symbolCount += LeaveNonMergeableAncestor(thisNavigator, LogicalDirection.Backward);
1272symbolCount += LeaveNonMergeableAncestor(thisNavigator, LogicalDirection.Forward);
1280private static int LeaveNonMergeableAncestor(ITextPointer thisNavigator, LogicalDirection direction)
1283int increment = (direction == LogicalDirection.Forward) ? +1 : -1;
1328TextPointerContext forwardContext = position.GetPointerContext(LogicalDirection.Forward);
1329TextPointerContext backwardContext = position.GetPointerContext(LogicalDirection.Backward);
1364if (position.GetTextInRun(LogicalDirection.Backward, neighborhood, 0, 1) == 1 &&
1365position.GetTextInRun(LogicalDirection.Forward, neighborhood, 1, 1) == 1)
1423runLength = Math.Min(navigator.GetTextRunLength(LogicalDirection.Backward), SelectionWordBreaker.MinContextLength - preceedingCount);
1427navigator.GetTextInRun(LogicalDirection.Forward, preceedingText, SelectionWordBreaker.MinContextLength - preceedingCount, runLength);
1433navigator.MoveToInsertionPosition(LogicalDirection.Backward);
1435while (navigator.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.Text);
1442runLength = Math.Min(navigator.GetTextRunLength(LogicalDirection.Forward), SelectionWordBreaker.MinContextLength - followingCount);
1444navigator.GetTextInRun(LogicalDirection.Forward, followingText, followingCount, runLength);
1453navigator.MoveToInsertionPosition(LogicalDirection.Forward);
1455while (navigator.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.Text);
1466private static bool IsAtNonMergeableInlineEdge(ITextPointer position, LogicalDirection direction)
1486private static BorderingElementCategory GetBorderingElementCategory(ITextPointer position, LogicalDirection direction)
1488TextPointerContext context = (direction == LogicalDirection.Forward) ? TextPointerContext.ElementEnd : TextPointerContext.ElementStart;
1512private static bool IsNextToRichBreak(ITextPointer thisPosition, LogicalDirection direction, Type lineBreakType)
System\Windows\Documents\TextRangeBase.cs (68)
73textPointer = textPointer.GetFormatNormalizedPosition(LogicalDirection.Forward);
77textPointer = textPointer.GetFormatNormalizedPosition(LogicalDirection.Backward);
191normalizedPosition.MoveToInsertionPosition(LogicalDirection.Backward);
206!TextPointerBase.IsAtWordBoundary(thisRange.Start, LogicalDirection.Forward) && //
207!TextPointerBase.IsAtWordBoundary(thisRange.Start, LogicalDirection.Backward))
282!TextPointerBase.IsNextToAnyBreak(thisRange.End, LogicalDirection.Forward))
288nextPosition.MoveToNextInsertionPosition(LogicalDirection.Forward);
301(TextPointerBase.IsNextToAnyBreak(thisRange.End, LogicalDirection.Backward) ||
304ITextPointer newEnd = thisRange.End.GetNextInsertionPosition(LogicalDirection.Backward);
332SkipParagraphContent(start, LogicalDirection.Backward);
333SkipParagraphContent(end, LogicalDirection.Forward);
340private static void SkipParagraphContent(ITextPointer navigator, LogicalDirection direction)
349(nextContext == TextPointerContext.ElementStart && direction == LogicalDirection.Forward || //
350nextContext == TextPointerContext.ElementEnd && direction == LogicalDirection.Backward) && //
354(nextContext == TextPointerContext.ElementEnd && direction == LogicalDirection.Forward || //
355nextContext == TextPointerContext.ElementStart && direction == LogicalDirection.Backward) && //
410if (position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.Text)
412moved = position.MoveToNextContextPosition(LogicalDirection.Forward);
416moved = position.MoveToInsertionPosition(LogicalDirection.Forward);
421moved = position.MoveToNextInsertionPosition(LogicalDirection.Forward);
471position.MoveToNextContextPosition(LogicalDirection.Backward)) ;
492moved = position.MoveToNextContextPosition(LogicalDirection.Forward);
515endNavigator.MoveToInsertionPosition(LogicalDirection.Backward);
677TextPointerContext symbolType = navigator.GetPointerContext(LogicalDirection.Forward);
693navigator.MoveToNextContextPosition(LogicalDirection.Forward);
703navigator.MoveToNextContextPosition(LogicalDirection.Forward);
708navigator.MoveToNextContextPosition(LogicalDirection.Forward);
711elementType = navigator.GetElementType(LogicalDirection.Forward);
731navigator.MoveToNextContextPosition(LogicalDirection.Forward);
747int runLength = navigator.GetTextRunLength(LogicalDirection.Forward);
749runLength = TextPointerBase.GetTextWithLimit(navigator, LogicalDirection.Forward, charArray, 0, runLength, endPosition);
751navigator.MoveToNextContextPosition(LogicalDirection.Forward);
761bool theParagraphIsTheFirstInCollection = navigator.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart;
762navigator.MoveToNextContextPosition(LogicalDirection.Forward);
764TextPointerContext symbolType = navigator.GetPointerContext(LogicalDirection.Forward);
771navigator.MoveToNextContextPosition(LogicalDirection.Forward);
772symbolType = navigator.GetPointerContext(LogicalDirection.Forward);
795List list = (List)navigator.GetAdjacentElement(LogicalDirection.Forward);
816navigator.MoveToNextContextPosition(LogicalDirection.Forward);
826ListItem listItem = (ListItem)navigator.GetAdjacentElement(LogicalDirection.Forward);
858object element = navigator.GetAdjacentElement(LogicalDirection.Forward);
1250while (start.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart &&
1254start = start.GetNextContextPosition(LogicalDirection.Backward);
1310if (thisRange.Start.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.Text &&
1311thisRange.End.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.Text)
1357(insertPosition.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.None ||
1358insertPosition.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart) &&
1359(insertPosition.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.None ||
1360insertPosition.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementEnd);
1371ITextPointer newStart = insertPosition.GetFrozenPointer(LogicalDirection.Backward);
1372ITextPointer newEnd = insertPosition.CreatePointer(LogicalDirection.Forward);
1377TextPointer insertionPosition = (TextPointer)newStart.CreatePointer(LogicalDirection.Forward);
1415newEnd = newEnd.GetNextInsertionPosition(LogicalDirection.Forward);
1616TextPointerContext context = start.GetPointerContext(LogicalDirection.Forward);
1619start.MoveToNextContextPosition(LogicalDirection.Forward);
1620context = start.GetPointerContext(LogicalDirection.Forward);
1625context = end.GetPointerContext(LogicalDirection.Backward);
1628end.MoveToNextContextPosition(LogicalDirection.Backward);
1629context = end.GetPointerContext(LogicalDirection.Backward);
1633return start.GetAdjacentElement(LogicalDirection.Forward) as UIElement;
1714start = GetNormalizedPosition(thisRange, start, LogicalDirection.Forward);
1721end = GetNormalizedPosition(thisRange, end, LogicalDirection.Backward);
1728if (start.LogicalDirection == LogicalDirection.Backward)
1731start = end.GetFrozenPointer(LogicalDirection.Backward);
1782private static bool IsAtNormalizedPosition(ITextRange thisRange, ITextPointer position, LogicalDirection direction)
1798private static ITextPointer GetNormalizedPosition(ITextRange thisRange, ITextPointer position, LogicalDirection direction)
1956!TextPointerBase.IsAtInsertionPosition(start, LogicalDirection.Forward) ||
1957!TextPointerBase.IsAtInsertionPosition(end, LogicalDirection.Backward))
System\Windows\Documents\TextRangeSerialization.cs (54)
75range.End.GetPointerContext(LogicalDirection.Backward) != TextPointerContext.ElementStart;
204while (rangeEnd.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart)
206rangeEnd = rangeEnd.GetNextContextPosition(LogicalDirection.Backward);
212TextPointerContext runType = textReader.GetPointerContext(LogicalDirection.Forward);
217TextElement nextElement = (TextElement)textReader.GetAdjacentElement(LogicalDirection.Forward);
226textReader.MoveToNextContextPosition(LogicalDirection.Forward);
246textReader.MoveToNextContextPosition(LogicalDirection.Forward);
254textReader.MoveToNextContextPosition(LogicalDirection.Forward);
264if (ignoreWriteHyperlinkEnd && (textReader.GetAdjacentElement(LogicalDirection.Forward) is Hyperlink))
268textReader.MoveToNextContextPosition(LogicalDirection.Forward);
281textReader.MoveToNextContextPosition(LogicalDirection.Forward);
298textReader.MoveToNextContextPosition(LogicalDirection.Forward);
302int textLength = textReader.GetTextRunLength(LogicalDirection.Forward);
305textLength = TextPointerBase.GetTextWithLimit(textReader, LogicalDirection.Forward, text, 0, textLength, rangeEnd);
312textReader.MoveToNextContextPosition(LogicalDirection.Forward);
316object embeddedObject = textReader.GetAdjacentElement(LogicalDirection.Forward);
317textReader.MoveToNextContextPosition(LogicalDirection.Forward);
324textReader.MoveToNextContextPosition(LogicalDirection.Forward);
545InlineUIContainer inlineUIContainer = textReader.GetAdjacentElement(LogicalDirection.Backward) as InlineUIContainer;
546BlockUIContainer blockUIContainer = textReader.GetAdjacentElement(LogicalDirection.Backward) as BlockUIContainer;
1225TextElement uiContainer = fragment.ContentStart.GetAdjacentElement(LogicalDirection.Forward) as TextElement;
1331fragmentEnd = fragment.ElementEnd.GetPositionAtOffset(0, LogicalDirection.Forward); // need forward orientation to stick with the following content during merge at fragmentStart position
1359fragmentEnd = fragmentEnd.GetInsertionPosition(LogicalDirection.Forward);
1413while (positionBeforeParagraph.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart &&
1416positionBeforeParagraph = positionBeforeParagraph.GetNextContextPosition(LogicalDirection.Backward);
1418while (positionBeforeParagraph.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart &&
1422positionBeforeParagraph = positionBeforeParagraph.GetNextContextPosition(LogicalDirection.Backward);
1456if (navigator.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementEnd)
1458navigator = navigator.GetNextContextPosition(LogicalDirection.Backward);
1474if (navigator.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementStart)
1476navigator = navigator.GetNextContextPosition(LogicalDirection.Forward);
1511TextPointerContext forwardFromStart = start.GetPointerContext(LogicalDirection.Forward);
1512TextPointerContext backwardFromEnd = end.GetPointerContext(LogicalDirection.Backward);
1515Invariant.Assert(itemType.IsAssignableFrom(start.GetAdjacentElement(LogicalDirection.Forward).GetType()),
1517Invariant.Assert(itemType.IsAssignableFrom(end.GetAdjacentElement(LogicalDirection.Backward).GetType()),
1521TextPointerContext backwardFromStart = start.GetPointerContext(LogicalDirection.Backward);
1522TextPointerContext forwardFromEnd = end.GetPointerContext(LogicalDirection.Forward);
1524Invariant.Assert(!(backwardFromStart == TextPointerContext.ElementEnd) || itemType.IsAssignableFrom(start.GetAdjacentElement(LogicalDirection.Backward).GetType()),
1527Invariant.Assert(!(forwardFromEnd == TextPointerContext.ElementStart) || itemType.IsAssignableFrom(end.GetAdjacentElement(LogicalDirection.Forward).GetType()),
1549((Section)fragment).HasTrailingParagraphBreakOnPaste = range.End.GetPointerContext(LogicalDirection.Forward) != TextPointerContext.None;
1605start = start.GetNextContextPosition(LogicalDirection.Forward);
1609TextPointerContext passedContext = start.GetPointerContext(LogicalDirection.Backward);
1649start = start.GetNextContextPosition(LogicalDirection.Forward);
1656start = start.GetNextContextPosition(LogicalDirection.Forward);
1846Invariant.Assert(textReader.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementStart);
1851elementEnd.MoveToNextContextPosition(LogicalDirection.Forward);
1873Invariant.Assert(textReader.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementStart);
1874Invariant.Assert(typeof(Hyperlink).IsAssignableFrom(textReader.GetElementType(LogicalDirection.Forward)));
1879Hyperlink hyperlink = (Hyperlink)textReader.GetAdjacentElement(LogicalDirection.Forward);
1884hyperlinkEnd.MoveToNextContextPosition(LogicalDirection.Forward);
1899InlineUIContainer inlineUIContainer = hyperlinkNavigation.GetAdjacentElement(LogicalDirection.Forward) as InlineUIContainer;
1906hyperlinkNavigation.MoveToNextContextPosition(LogicalDirection.Forward);
1921hyperlinkStart = range.Start.CreatePointer(LogicalDirection.Forward);
1922while (hyperlinkStart.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart &&
System\windows\Documents\TextSelection.cs (64)
287((ITextSelection)this).SetCaretToPosition(((ITextRange)this).End, LogicalDirection.Forward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
438void ITextSelection.SetCaretToPosition(ITextPointer caretPosition, LogicalDirection direction, bool allowStopAtLineEnd, bool allowStopNearSpace)
453ITextPointer reversePosition = caretPosition.CreatePointer(direction == LogicalDirection.Forward ? LogicalDirection.Backward : LogicalDirection.Forward);
459TextPointerBase.IsNextToPlainLineBreak(caretPosition, LogicalDirection.Backward) ||
460TextSchema.IsBreak(caretPosition.GetElementType(LogicalDirection.Backward))))
464caretPosition.SetLogicalDirection(LogicalDirection.Forward);
468if (caretPosition.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.Text &&
469caretPosition.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.Text)
491LogicalDirection oppositeDirection = direction == LogicalDirection.Forward ? LogicalDirection.Backward : LogicalDirection.Forward;
568bool ITextSelection.ExtendToNextInsertionPosition(LogicalDirection direction)
603if (newMovingPosition == null && direction == LogicalDirection.Forward)
623LogicalDirection contentDirection = (anchorPosition.CompareTo(newMovingPosition) <= 0) ?
624LogicalDirection.Backward : LogicalDirection.Forward;
640private ITextPointer GetNextTextSegmentInsertionPosition(LogicalDirection direction)
824startPosition = anchorWordRange.Start.GetFrozenPointer(LogicalDirection.Forward);
825movingPosition = cursorWordRange.End.GetFrozenPointer(LogicalDirection.Backward);
829startPosition = anchorWordRange.End.GetFrozenPointer(LogicalDirection.Backward);
830movingPosition = cursorWordRange.Start.GetFrozenPointer(LogicalDirection.Forward);
946anchorWordRange.Contains(cursorPosition.GetInsertionPosition(LogicalDirection.Forward)) ||
947anchorWordRange.Contains(cursorPosition.GetInsertionPosition(LogicalDirection.Backward)))
959TextPointerBase.IsAtWordBoundary(anchorPosition, /*insideWordDirection:*/LogicalDirection.Forward))
973TextPointerBase.IsAtWordBoundary(cursorPosition, /*insideWordDirection:*/LogicalDirection.Forward))
1008bool ITextSelection.ExtendToNextTableRow(LogicalDirection direction)
1036if (direction == LogicalDirection.Forward)
1065movingPosition.MoveToNextInsertionPosition(LogicalDirection.Forward);
1165internal void SetCaretToPosition(TextPointer caretPosition, LogicalDirection direction, bool allowStopAtLineEnd, bool allowStopNearSpace)
1173internal bool ExtendToNextInsertionPosition(LogicalDirection direction)
1370this.SetCaretToPosition(cellStart, LogicalDirection.Backward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
1534Invariant.Assert(this.Start.LogicalDirection == LogicalDirection.Backward);
1535Invariant.Assert(this.End.LogicalDirection == LogicalDirection.Forward);
1740return (This.Start.GetPointerContext(LogicalDirection.Backward) != TextPointerContext.Text &&
1741This.End.GetPointerContext(LogicalDirection.Forward) != TextPointerContext.Text &&
1742This.Start.GetNextInsertionPosition(LogicalDirection.Backward) == null &&
1743This.End.GetNextInsertionPosition(LogicalDirection.Forward) == null);
1978(cursorPosition.LogicalDirection == LogicalDirection.Forward && objectEdgeRect.X < cursorMousePoint.X ||
1979cursorPosition.LogicalDirection == LogicalDirection.Backward && cursorMousePoint.X < objectEdgeRect.X))
1984(cursorPosition.LogicalDirection == LogicalDirection.Forward && objectEdgeRect.X > cursorMousePoint.X ||
1985cursorPosition.LogicalDirection == LogicalDirection.Backward && cursorMousePoint.X > objectEdgeRect.X))
1993(cursorPosition.LogicalDirection == LogicalDirection.Forward && objectEdgeRect.X > cursorMousePoint.X ||
1994cursorPosition.LogicalDirection == LogicalDirection.Backward && cursorMousePoint.X > objectEdgeRect.X))
1999(cursorPosition.LogicalDirection == LogicalDirection.Forward && objectEdgeRect.X < cursorMousePoint.X ||
2000cursorPosition.LogicalDirection == LogicalDirection.Backward && cursorMousePoint.X < objectEdgeRect.X))
2162if ((caretPosition.LogicalDirection == LogicalDirection.Backward && //
2163caretPosition.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart) || //
2170caretPosition.MoveToNextInsertionPosition(LogicalDirection.Backward);
2171caretPosition.SetLogicalDirection(LogicalDirection.Forward);
2179if (caretPosition.LogicalDirection == LogicalDirection.Backward && //
2180caretPosition.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart && //
2181(caretPosition.GetNextInsertionPosition(LogicalDirection.Backward) == null || //
2182TextPointerBase.IsNextToAnyBreak(caretPosition, LogicalDirection.Backward)))
2185caretPosition.SetLogicalDirection(LogicalDirection.Forward);
2259nextCharacterPosition = focusedTextSelection.Start.CreatePointer(LogicalDirection.Forward);
2264nextCharacterPosition.MoveToNextInsertionPosition(LogicalDirection.Forward);
2265nextCharacterPosition.SetLogicalDirection(LogicalDirection.Backward);
2273nextCharacterPosition = focusedTextSelection.End.CreatePointer(LogicalDirection.Backward);
2278nextCharacterPosition.MoveToNextInsertionPosition(LogicalDirection.Backward);
2279nextCharacterPosition.SetLogicalDirection(LogicalDirection.Forward);
2741private LogicalDirection _movingPositionDirection;
System\Windows\Documents\TextStore.cs (73)
366this.TextSelection.SetCaretToPosition(start, LogicalDirection.Backward, /*allowStopAtLineEnd:*/true, /*allowStopNearSpace:*/true);
406navigator = CreatePointerAtCharOffset(startIndex, LogicalDirection.Forward);
407limit = (endIndex >= 0) ? CreatePointerAtCharOffset(endIndex, LogicalDirection.Forward) : null;
414TextPointerContext context = navigator.GetPointerContext(LogicalDirection.Forward);
428TextElement element = (TextElement)((TextPointer)navigator).GetAdjacentElement(LogicalDirection.Forward);
437navigator.MoveToNextContextPosition(LogicalDirection.Forward);
443navigator.MoveToNextContextPosition(LogicalDirection.Forward);
490start = start.GetNextInsertionPosition(LogicalDirection.Forward);
684startNavigator.SetLogicalDirection(LogicalDirection.Backward);
686endNavigator.SetLogicalDirection(LogicalDirection.Forward);
864position = CreatePointerAtCharOffset(index, LogicalDirection.Forward);
977ITextPointer positionCur = position.CreatePointer(LogicalDirection.Backward);
978ITextPointer positionPrev = position.CreatePointer(LogicalDirection.Forward);
979positionPrev.MoveToNextInsertionPosition(LogicalDirection.Backward);
1046startPointer = CreatePointerAtCharOffset(startIndex, LogicalDirection.Forward);
1047startPointer.MoveToInsertionPosition(LogicalDirection.Forward);
1057Rect rectStart = startPointer.GetCharacterRect(LogicalDirection.Forward);
1065endPointer = CreatePointerAtCharOffset(endIndex, LogicalDirection.Backward);
1066endPointer.MoveToInsertionPosition(LogicalDirection.Backward);
1087lineRect = navigator.GetCharacterRect(LogicalDirection.Forward);
1088moved = navigator.MoveToNextInsertionPosition(LogicalDirection.Forward);
1482navigator.MoveToInsertionPosition(LogicalDirection.Forward);
1487if (navigator.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.Text)
1493navigator.GetTextInRun(LogicalDirection.Forward, nextChars, 0, nextChars.Length);
1499TextSelection.ExtendToNextInsertionPosition(LogicalDirection.Forward);
1895internal ITextPointer CreatePointerAtCharOffset(int charOffset, LogicalDirection direction)
2004this.TextSelection.SetCaretToPosition(range.End, LogicalDirection.Backward, /*allowStopAtLineEnd:*/true, /*allowStopNearSpace:*/true);
2378_previousCompositionStart = (_previousCompositionStartOffset == -1) ? null : textEditor.TextContainer.CreatePointerAtOffset(_previousCompositionStartOffset, LogicalDirection.Backward);
2379_previousCompositionEnd = (_previousCompositionEndOffset == -1) ? null : textEditor.TextContainer.CreatePointerAtOffset(_previousCompositionEndOffset, LogicalDirection.Forward);
2397_previousCompositionStart = (_previousCompositionStartOffset == -1) ? null : textEditor.TextContainer.CreatePointerAtOffset(_previousCompositionStartOffset, LogicalDirection.Backward);
2398_previousCompositionEnd = (_previousCompositionEndOffset == -1) ? null : textEditor.TextContainer.CreatePointerAtOffset(_previousCompositionEndOffset, LogicalDirection.Forward);
2445Invariant.Assert(navigator.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.Text);
2452runCount = TextPointerBase.GetTextWithLimit(navigator, LogicalDirection.Forward, text, charsCopied, Math.Min(cchReq, text.Length - charsCopied), limit);
2461runCount = navigator.GetTextRunLength(LogicalDirection.Forward);
2462navigator.MoveToNextContextPosition(LogicalDirection.Forward);
2504Invariant.Assert(navigator.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.EmbeddedElement);
2514navigator.MoveToNextContextPosition(LogicalDirection.Forward);
2546Invariant.Assert(navigator.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementStart || navigator.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementEnd);
2564char ch = (navigator.GetAdjacentElement(LogicalDirection.Forward) is TableCell) ? UnsafeNativeMethods.TS_CHAR_REGION : '\n';
2897start = CreatePointerAtCharOffset(startIndex, LogicalDirection.Backward);
2898end = CreatePointerAtCharOffset(startIndex + length, LogicalDirection.Forward);
2900while (start.CompareTo(end) < 0 && start.GetPointerContext(LogicalDirection.Forward) != TextPointerContext.Text)
2902start.MoveToNextContextPosition(LogicalDirection.Forward);
3025positionNext.MoveToNextInsertionPosition(LogicalDirection.Forward);
3029positionNext.MoveToNextInsertionPosition(LogicalDirection.Backward);
3168Rect lineBounds = start.GetCharacterRect(LogicalDirection.Forward);
3169lineBounds.Union(end.GetCharacterRect(LogicalDirection.Backward));
3172ITextPointer navigator = start.CreatePointer(LogicalDirection.Forward);
3173while (navigator.MoveToNextContextPosition(LogicalDirection.Forward) && navigator.CompareTo(end) < 0)
3175TextPointerContext context = navigator.GetPointerContext(LogicalDirection.Backward);
3179lineBounds.Union(navigator.GetCharacterRect(LogicalDirection.Backward));
3184lineBounds.Union(navigator.GetCharacterRect(LogicalDirection.Backward));
3399TextPointer previousPosition = start.GetNextInsertionPosition(LogicalDirection.Backward);
3412if (start.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart)
3414start = start.GetNextInsertionPosition(LogicalDirection.Backward);
3418start = start.GetNextInsertionPosition(LogicalDirection.Forward);
3426start = start.GetNextInsertionPosition(LogicalDirection.Forward);
3446start = CreatePointerAtCharOffset(startCharOffset, LogicalDirection.Forward);
3447end = (startCharOffset == endCharOffset) ? start : CreatePointerAtCharOffset(endCharOffset, LogicalDirection.Backward);
3452TextPointerContext forwardContext = start.GetPointerContext(LogicalDirection.Forward);
3456TextElement element = start.GetAdjacentElement(LogicalDirection.Forward) as TextElement;
3468start.MoveToNextContextPosition(LogicalDirection.Forward);
3479start = start.GetFormatNormalizedPosition(LogicalDirection.Backward);
3484start = start.GetFormatNormalizedPosition(LogicalDirection.Backward);
3485end = end.GetFormatNormalizedPosition(LogicalDirection.Backward);
3627ITextPointer start = this.TextContainer.CreatePointerAtOffset(record.StartOffsetBefore, LogicalDirection.Backward);
3628ITextPointer end = this.TextContainer.CreatePointerAtOffset(record.EndOffsetBefore, LogicalDirection.Forward);
3789start = end.GetFrozenPointer(LogicalDirection.Backward);
3946ITextPointer anchor = this.TextContainer.CreatePointerAtOffset(appSelectionAnchorOffset, LogicalDirection.Forward);
3947ITextPointer moving = this.TextContainer.CreatePointerAtOffset(appSelectionMovingOffset, LogicalDirection.Forward);
3967ITextPointer anchor = this.TextContainer.CreatePointerAtOffset(imeSelectionAnchorOffset, LogicalDirection.Backward);
3968ITextPointer moving = this.TextContainer.CreatePointerAtOffset(imeSelectionMovingOffset, LogicalDirection.Backward);