private static void ToggleBullets(TextSelection thisSelection, ListItem parentListItem, ListItem immediateListItem, List list) { if (immediateListItem != null && HasBulletMarker(list)) { if (list.Parent is ListItem) { TextRangeEditLists.UnindentListItems(thisSelection); TextRangeEditLists.ConvertListItemsToParagraphs(thisSelection); } else { TextRangeEditLists.UnindentListItems(thisSelection); } } else if (immediateListItem != null) { list.MarkerStyle = TextMarkerStyle.Disc; } else if (parentListItem != null) { TextRangeEditLists.ConvertParagraphsToListItems(thisSelection, TextMarkerStyle.Disc); TextRangeEditLists.IndentListItems(thisSelection); } else { TextRangeEditLists.ConvertParagraphsToListItems(thisSelection, TextMarkerStyle.Disc); } }
// Token: 0x06003876 RID: 14454 RVA: 0x000FCE58 File Offset: 0x000FB058 private static void ToggleNumbering(TextSelection thisSelection, ListItem parentListItem, ListItem immediateListItem, List list) { if (immediateListItem != null && TextEditorLists.HasNumericMarker(list)) { if (list.Parent is ListItem) { TextRangeEditLists.UnindentListItems(thisSelection); TextRangeEditLists.ConvertListItemsToParagraphs(thisSelection); return; } TextRangeEditLists.UnindentListItems(thisSelection); return; } else { if (immediateListItem != null) { list.MarkerStyle = TextMarkerStyle.Decimal; return; } if (parentListItem != null) { TextRangeEditLists.ConvertParagraphsToListItems(thisSelection, TextMarkerStyle.Decimal); TextRangeEditLists.IndentListItems(thisSelection); return; } TextRangeEditLists.ConvertParagraphsToListItems(thisSelection, TextMarkerStyle.Decimal); return; } }
// Common handler for all list editing commands private static void OnListCommand(object target, ExecutedRoutedEventArgs args) { TextEditor This = TextEditor._GetTextEditor(target); if (This == null || !This._IsEnabled || This.IsReadOnly || !This.AcceptsRichContent || !(This.Selection is TextSelection)) { return; } TextEditorTyping._FlushPendingInputItems(This); if (!TextRangeEditLists.IsListOperationApplicable((TextSelection)This.Selection)) { return; } using (This.Selection.DeclareChangeBlock()) { TextSelection thisSelection = (TextSelection)This.Selection; ListItem parentListItem = TextPointerBase.GetListItem(thisSelection.Start); ListItem immediateListItem = TextPointerBase.GetImmediateListItem(thisSelection.Start); List list = parentListItem == null ? null : (List)parentListItem.Parent; // Forget previously suggested horizontal position TextEditorSelection._ClearSuggestedX(This); // Execute the command if (args.Command == EditingCommands.ToggleBullets) { ToggleBullets(thisSelection, parentListItem, immediateListItem, list); } else if (args.Command == EditingCommands.ToggleNumbering) { ToggleNumbering(thisSelection, parentListItem, immediateListItem, list); } else if (args.Command == EditingCommands.RemoveListMarkers) { TextRangeEditLists.ConvertListItemsToParagraphs(thisSelection); } else if (args.Command == EditingCommands.IncreaseIndentation) { IncreaseIndentation(thisSelection, parentListItem, immediateListItem); } else if (args.Command == EditingCommands.DecreaseIndentation) { DecreaseIndentation(thisSelection, parentListItem, immediateListItem); } else { Invariant.Assert(false); } } }
// Token: 0x06003874 RID: 14452 RVA: 0x000FCCBC File Offset: 0x000FAEBC private static void OnListCommand(object target, ExecutedRoutedEventArgs args) { TextEditor textEditor = TextEditor._GetTextEditor(target); if (textEditor == null || !textEditor._IsEnabled || textEditor.IsReadOnly || !textEditor.AcceptsRichContent || !(textEditor.Selection is TextSelection)) { return; } TextEditorTyping._FlushPendingInputItems(textEditor); if (!TextRangeEditLists.IsListOperationApplicable((TextSelection)textEditor.Selection)) { return; } using (textEditor.Selection.DeclareChangeBlock()) { TextSelection textSelection = (TextSelection)textEditor.Selection; ListItem listItem = TextPointerBase.GetListItem(textSelection.Start); ListItem immediateListItem = TextPointerBase.GetImmediateListItem(textSelection.Start); List list = (listItem == null) ? null : ((List)listItem.Parent); TextEditorSelection._ClearSuggestedX(textEditor); if (args.Command == EditingCommands.ToggleBullets) { TextEditorLists.ToggleBullets(textSelection, listItem, immediateListItem, list); } else if (args.Command == EditingCommands.ToggleNumbering) { TextEditorLists.ToggleNumbering(textSelection, listItem, immediateListItem, list); } else if (args.Command == EditingCommands.RemoveListMarkers) { TextRangeEditLists.ConvertListItemsToParagraphs(textSelection); } else if (args.Command == EditingCommands.IncreaseIndentation) { TextEditorLists.IncreaseIndentation(textSelection, listItem, immediateListItem); } else if (args.Command == EditingCommands.DecreaseIndentation) { TextEditorLists.DecreaseIndentation(textSelection, listItem, immediateListItem); } else { Invariant.Assert(false); } } }