// Token: 0x06003836 RID: 14390 RVA: 0x000FAA28 File Offset: 0x000F8C28
        private static void OnResetFormat(object target, ExecutedRoutedEventArgs args)
        {
            TextEditor textEditor = TextEditor._GetTextEditor(target);

            if (textEditor == null || !textEditor._IsEnabled || textEditor.IsReadOnly || !textEditor.AcceptsRichContent || !(textEditor.Selection.Start is TextPointer))
            {
                return;
            }
            TextEditorTyping._FlushPendingInputItems(textEditor);
            using (textEditor.Selection.DeclareChangeBlock())
            {
                TextPointer start = (TextPointer)textEditor.Selection.Start;
                TextPointer end   = (TextPointer)textEditor.Selection.End;
                if (textEditor.Selection.IsEmpty)
                {
                    TextSegment autoWord = TextRangeBase.GetAutoWord(textEditor.Selection);
                    if (autoWord.IsNull)
                    {
                        ((TextSelection)textEditor.Selection).ClearSpringloadFormatting();
                        return;
                    }
                    start = (TextPointer)autoWord.Start;
                    end   = (TextPointer)autoWord.End;
                }
                TextEditorSelection._ClearSuggestedX(textEditor);
                TextRangeEdit.CharacterResetFormatting(start, end);
            }
        }
 // Token: 0x06003AFF RID: 15103 RVA: 0x0010A8DC File Offset: 0x00108ADC
 internal virtual void ClearAllPropertiesVirtual()
 {
     TextRangeBase.BeginChange(this);
     try
     {
         TextRangeEdit.CharacterResetFormatting(this.Start, this.End);
     }
     finally
     {
         TextRangeBase.EndChange(this);
     }
 }
Пример #3
0
        //------------------------------------------------------
        //
        //  Private Methods
        //
        //------------------------------------------------------

        #region Private Methods

        // ................................................................
        //
        // Editing Commands: Character Editing
        //
        // ................................................................

        private static void OnResetFormat(object target, ExecutedRoutedEventArgs args)
        {
            TextEditor This = TextEditor._GetTextEditor(target);

            if (This == null || !This._IsEnabled || This.IsReadOnly || !This.AcceptsRichContent || !(This.Selection.Start is TextPointer))
            {
                return;
            }

            TextEditorTyping._FlushPendingInputItems(This);

            using (This.Selection.DeclareChangeBlock())
            {
                // Positions to clear all inline formatting properties
                TextPointer startResetFormatPosition = (TextPointer)This.Selection.Start;
                TextPointer endResetFormatPosition   = (TextPointer)This.Selection.End;

                if (This.Selection.IsEmpty)
                {
                    TextSegment autoWordRange = TextRangeBase.GetAutoWord(This.Selection);
                    if (autoWordRange.IsNull)
                    {
                        // Clear springloaded formatting
                        ((TextSelection)This.Selection).ClearSpringloadFormatting();
                        return;
                    }
                    else
                    {
                        // If we have a word, apply reset format to it
                        startResetFormatPosition = (TextPointer)autoWordRange.Start;
                        endResetFormatPosition   = (TextPointer)autoWordRange.End;
                    }
                }

                // Forget previously suggested horizontal position
                TextEditorSelection._ClearSuggestedX(This);

                // Clear all inline formattings
                TextRangeEdit.CharacterResetFormatting(startResetFormatPosition, endResetFormatPosition);
            }
        }