// Token: 0x060038DA RID: 14554 RVA: 0x00100F68 File Offset: 0x000FF168 private static void OnQueryStatusSpellingError(object target, CanExecuteRoutedEventArgs args) { TextEditor textEditor = TextEditor._GetTextEditor(target); if (textEditor == null) { return; } SpellingError spellingErrorAtSelection = TextEditorSpelling.GetSpellingErrorAtSelection(textEditor); args.CanExecute = (spellingErrorAtSelection != null); }
// Token: 0x060038DC RID: 14556 RVA: 0x0010101C File Offset: 0x000FF21C private static ITextPointer GetNextNonWhiteSpacePosition(ITextPointer position, ITextPointer limit) { Invariant.Assert(limit != null); while (position.CompareTo(limit) != 0) { char c; position = TextEditorSpelling.GetNextTextPosition(position, limit, LogicalDirection.Forward, out c); if (position == null || !char.IsWhiteSpace(c)) { return(position); } position = position.CreatePointer(1); } return(null); }
// Token: 0x060038D9 RID: 14553 RVA: 0x00100F3C File Offset: 0x000FF13C private static void OnIgnoreSpellingError(object target, ExecutedRoutedEventArgs args) { TextEditor textEditor = TextEditor._GetTextEditor(target); if (textEditor == null) { return; } SpellingError spellingErrorAtSelection = TextEditorSpelling.GetSpellingErrorAtSelection(textEditor); if (spellingErrorAtSelection == null) { return; } spellingErrorAtSelection.IgnoreAll(); }
// Token: 0x060038D7 RID: 14551 RVA: 0x00100D38 File Offset: 0x000FEF38 private static void OnCorrectSpellingError(object target, ExecutedRoutedEventArgs args) { TextEditor textEditor = TextEditor._GetTextEditor(target); if (textEditor == null) { return; } string text = args.Parameter as string; if (text == null) { return; } SpellingError spellingErrorAtSelection = TextEditorSpelling.GetSpellingErrorAtSelection(textEditor); if (spellingErrorAtSelection == null) { return; } using (textEditor.Selection.DeclareChangeBlock()) { ITextPointer textPointer; ITextPointer position; bool flag = TextEditorSpelling.IsErrorAtNonMergeableInlineEdge(spellingErrorAtSelection, out textPointer, out position); ITextPointer textPointer2; if (flag && textPointer is TextPointer) { ((TextPointer)textPointer).DeleteTextInRun(textPointer.GetOffsetToPosition(position)); textPointer.InsertTextInRun(text); textPointer2 = textPointer.CreatePointer(text.Length, LogicalDirection.Forward); } else { textEditor.Selection.Select(spellingErrorAtSelection.Start, spellingErrorAtSelection.End); if (textEditor.AcceptsRichContent) { ((TextSelection)textEditor.Selection).SpringloadCurrentFormatting(); } XmlLanguage xmlLanguage = (XmlLanguage)spellingErrorAtSelection.Start.GetValue(FrameworkElement.LanguageProperty); textEditor.SetSelectedText(text, xmlLanguage.GetSpecificCulture()); textPointer2 = textEditor.Selection.End; } textEditor.Selection.Select(textPointer2, textPointer2); } }
// Token: 0x060038D5 RID: 14549 RVA: 0x00100C20 File Offset: 0x000FEE20 internal static SpellingError GetSpellingErrorAtSelection(TextEditor This) { if (This.Speller == null) { return(null); } if (TextEditorSpelling.IsSelectionIgnoringErrors(This.Selection)) { return(null); } LogicalDirection logicalDirection = This.Selection.IsEmpty ? This.Selection.Start.LogicalDirection : LogicalDirection.Forward; char c; ITextPointer textPointer = TextEditorSpelling.GetNextTextPosition(This.Selection.Start, null, logicalDirection, out c); if (textPointer == null) { logicalDirection = ((logicalDirection == LogicalDirection.Forward) ? LogicalDirection.Backward : LogicalDirection.Forward); textPointer = TextEditorSpelling.GetNextTextPosition(This.Selection.Start, null, logicalDirection, out c); } else if (char.IsWhiteSpace(c)) { if (This.Selection.IsEmpty) { logicalDirection = ((logicalDirection == LogicalDirection.Forward) ? LogicalDirection.Backward : LogicalDirection.Forward); textPointer = TextEditorSpelling.GetNextTextPosition(This.Selection.Start, null, logicalDirection, out c); } else { logicalDirection = LogicalDirection.Forward; textPointer = TextEditorSpelling.GetNextNonWhiteSpacePosition(This.Selection.Start, This.Selection.End); if (textPointer == null) { logicalDirection = LogicalDirection.Backward; textPointer = TextEditorSpelling.GetNextTextPosition(This.Selection.Start, null, logicalDirection, out c); } } } if (textPointer != null) { return(This.Speller.GetError(textPointer, logicalDirection, false)); } return(null); }