// Token: 0x060085BD RID: 34237 RVA: 0x0024AA08 File Offset: 0x00248C08 private ITextPointer GetDropPosition(Visual target, Point point) { Invariant.Assert(target != null); Invariant.Assert(this._textEditor.TextView.IsValid); if (target != this._textEditor.TextView.RenderScope && target != null && this._textEditor.TextView.RenderScope.IsAncestorOf(target)) { GeneralTransform generalTransform = target.TransformToAncestor(this._textEditor.TextView.RenderScope); generalTransform.TryTransform(point, out point); } ITextPointer textPointer = this.TextView.GetTextPositionFromPoint(point, true); if (textPointer != null) { textPointer = textPointer.GetInsertionPosition(textPointer.LogicalDirection); if (this._textEditor.AcceptsRichContent) { TextSegment normalizedLineRange = TextEditorSelection.GetNormalizedLineRange(this.TextView, textPointer); if (!normalizedLineRange.IsNull && textPointer.CompareTo(normalizedLineRange.End) < 0 && !TextPointerBase.IsAtWordBoundary(textPointer, LogicalDirection.Forward) && this._dragSourceTextRange != null && TextPointerBase.IsAtWordBoundary(this._dragSourceTextRange.Start, LogicalDirection.Forward) && TextPointerBase.IsAtWordBoundary(this._dragSourceTextRange.End, LogicalDirection.Forward)) { TextSegment wordRange = TextPointerBase.GetWordRange(textPointer); string textInternal = TextRangeBase.GetTextInternal(wordRange.Start, wordRange.End); int offsetToPosition = wordRange.Start.GetOffsetToPosition(textPointer); textPointer = ((offsetToPosition < textInternal.Length / 2) ? wordRange.Start : wordRange.End); } } } return(textPointer); }
// Token: 0x0600350D RID: 13581 RVA: 0x000F0444 File Offset: 0x000EE644 private string GetText() { double top = this._selectionRect.Top; double bottom = this._selectionRect.Bottom; double left = this._selectionRect.Left; double right = this._selectionRect.Right; double num = 0.0; double num2 = 0.0; int count = this._page.Children.Count; ArrayList arrayList = new ArrayList(); FixedNode[] array = this._panel.FixedContainer.FixedTextBuilder.GetFirstLine(this._pageIndex); while (array != null && array.Length != 0) { RubberbandSelector.TextPositionPair textPositionPair = null; foreach (FixedNode node in array) { Glyphs glyphsElement = this._page.GetGlyphsElement(node); if (glyphsElement != null) { int num3; int charIndex; bool flag; if (this.IntersectGlyphs(glyphsElement, top, left, bottom, right, out num3, out charIndex, out flag, out num, out num2)) { if (textPositionPair == null || num3 > 0) { textPositionPair = new RubberbandSelector.TextPositionPair(); textPositionPair.first = this._GetTextPosition(node, num3); arrayList.Add(textPositionPair); } textPositionPair.second = this._GetTextPosition(node, charIndex); if (!flag) { textPositionPair = null; } } else { textPositionPair = null; } } } int num4 = 1; array = this._panel.FixedContainer.FixedTextBuilder.GetNextLine(array[0], true, ref num4); } string text = ""; foreach (object obj in arrayList) { RubberbandSelector.TextPositionPair textPositionPair2 = (RubberbandSelector.TextPositionPair)obj; text = text + TextRangeBase.GetTextInternal(textPositionPair2.first, textPositionPair2.second) + "\r\n"; } return(text); }
// Token: 0x06004A4F RID: 19023 RVA: 0x0014F910 File Offset: 0x0014DB10 internal override object GetValue(BaseValueSourceInternal valueSource) { string textInternal = TextRangeBase.GetTextInternal(this._textContainer.Start, this._textContainer.End); TextBox textBox = this._textContainer.Parent as TextBox; if (textBox != null) { textBox.OnDeferredTextReferenceResolved(this, textInternal); } return(textInternal); }
//------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ #region Internal Methods // Does the real work to calculate the current TextProperty value. internal override object GetValue(BaseValueSourceInternal valueSource) { string s = TextRangeBase.GetTextInternal(_textContainer.Start, _textContainer.End); TextBox tb = _textContainer.Parent as TextBox; if (tb != null) { tb.OnDeferredTextReferenceResolved(this, s); } return(s); }
/// <summary> /// Calculates a TextPointer indended for dropping the text. /// </summary> /// <param name="target"></param> /// <param name="point"></param> /// <returns> /// ITextPointer intended for dropping the selected text. /// Adjusts the dropping point to a word boundary (beginning of word) /// in case if source range contains whole words. /// The position returned is oriented towards a character /// under the mouse pointer. /// </returns> private ITextPointer GetDropPosition(Visual target, Point point) { Invariant.Assert(target != null); Invariant.Assert(_textEditor.TextView.IsValid); // caller must guarantee this. // Convert point to RenderScope if (target != _textEditor.TextView.RenderScope && target != null && (_textEditor.TextView.RenderScope).IsAncestorOf(target)) { GeneralTransform transform = target.TransformToAncestor(_textEditor.TextView.RenderScope); transform.TryTransform(point, out point); } ITextPointer dropPosition = this.TextView.GetTextPositionFromPoint(point, /*snapToText:*/ true); // For rich text content we adjust drop position to word boundary if (dropPosition != null) { // Normalize drop position dropPosition = dropPosition.GetInsertionPosition(dropPosition.LogicalDirection); if (_textEditor.AcceptsRichContent) { TextSegment lineRange = TextEditorSelection.GetNormalizedLineRange(this.TextView, dropPosition); if (!lineRange.IsNull && // The drop position must be before of end of line dropPosition.CompareTo(lineRange.End) < 0 && // We check if we are not at word boundary already: !TextPointerBase.IsAtWordBoundary(dropPosition, /*insideWordDirection:*/ LogicalDirection.Forward) && // We do not do it if the source range was not on word boundaries from both ends _dragSourceTextRange != null && // TextPointerBase.IsAtWordBoundary(_dragSourceTextRange.Start, LogicalDirection.Forward) && // TextPointerBase.IsAtWordBoundary(_dragSourceTextRange.End, LogicalDirection.Forward)) { // Move to word boundary. Select closest one to a dropPosition. TextSegment wordSegment = TextPointerBase.GetWordRange(dropPosition); string wordText = TextRangeBase.GetTextInternal(wordSegment.Start, wordSegment.End); int indexInWord = wordSegment.Start.GetOffsetToPosition(dropPosition); dropPosition = (indexInWord < (wordText.Length / 2)) ? wordSegment.Start : wordSegment.End; } } } return(dropPosition); }
/// <summary> /// Instructs the control to ignore this error and any duplicates for /// the remainder of its lifetime. /// </summary> public void IgnoreAll() { _speller.IgnoreAll(TextRangeBase.GetTextInternal(_start, _end)); }
//gets text within selected area private string GetText() { double top = _selectionRect.Top; double bottom = _selectionRect.Bottom; double left = _selectionRect.Left; double right = _selectionRect.Right; double lastBaseline = 0; double baseline = 0; double lastHeight = 0; double height = 0; int nChildren = _page.Children.Count; ArrayList ranges = new ArrayList(); //text ranges in area FixedNode[] nodesInLine = _panel.FixedContainer.FixedTextBuilder.GetFirstLine(_pageIndex); while (nodesInLine != null && nodesInLine.Length > 0) { TextPositionPair textRange = null; //current text range foreach (FixedNode node in nodesInLine) { Glyphs g = _page.GetGlyphsElement(node); if (g != null) { int begin, end; //first and last index in range bool includeEnd; //is the end of this glyphs included in selection? if (IntersectGlyphs(g, top, left, bottom, right, out begin, out end, out includeEnd, out baseline, out height)) { if (textRange == null || begin > 0) { //begin new text range textRange = new TextPositionPair(); textRange.first = _GetTextPosition(node, begin); ranges.Add(textRange); } textRange.second = _GetTextPosition(node, end); if (!includeEnd) { // so future textRanges aren't concatenated with this one textRange = null; } } else { //this Glyphs completely outside selected region textRange = null; } lastBaseline = baseline; lastHeight = height; } } int count = 1; nodesInLine = _panel.FixedContainer.FixedTextBuilder.GetNextLine(nodesInLine[0], true, ref count); } string text = ""; foreach (TextPositionPair range in ranges) { Debug.Assert(range.first != null && range.second != null); text = text + TextRangeBase.GetTextInternal(range.first, range.second) + "\r\n"; //CRLF } return(text); }
// Token: 0x06004A49 RID: 19017 RVA: 0x0014F8B4 File Offset: 0x0014DAB4 internal override object GetValue(BaseValueSourceInternal valueSource) { return(TextRangeBase.GetTextInternal(this._run.ContentStart, this._run.ContentEnd)); }
/// <summary>Instructs the control to ignore this error and any duplicates for the remainder of the lifetime of the control.</summary> // Token: 0x06005B57 RID: 23383 RVA: 0x0019C184 File Offset: 0x0019A384 public void IgnoreAll() { this._speller.IgnoreAll(TextRangeBase.GetTextInternal(this._start, this._end)); }