// Token: 0x06003B84 RID: 15236 RVA: 0x0010F178 File Offset: 0x0010D378 internal static void IndentListItems(TextRange range) { ListItem immediateListItem = TextPointerBase.GetImmediateListItem(range.Start); ListItem immediateListItem2 = TextPointerBase.GetImmediateListItem((TextPointer)TextRangeEdit.GetAdjustedRangeEnd(range.Start, range.End)); if (immediateListItem == null || immediateListItem2 == null || immediateListItem.Parent != immediateListItem2.Parent || !(immediateListItem.Parent is List)) { return; } ListItem previousListItem = immediateListItem.PreviousListItem; if (previousListItem == null) { return; } List element = (List)immediateListItem.Parent; List list = (List)TextRangeEdit.InsertElementClone(immediateListItem.ElementStart, immediateListItem2.ElementEnd, element); previousListItem.Reposition(previousListItem.ContentStart, list.ElementEnd); Paragraph paragraph = immediateListItem2.Blocks.FirstBlock as Paragraph; if (paragraph != null) { List list2 = paragraph.NextBlock as List; if (list2 != null && list2.NextBlock == null) { immediateListItem2.Reposition(immediateListItem2.ContentStart, list2.ElementStart); list2.Reposition(null, null); } } TextRangeEditLists.MergeLists(list.ElementStart); }
// Token: 0x06003870 RID: 14448 RVA: 0x000FCC00 File Offset: 0x000FAE00 internal static void DecreaseIndentation(TextEditor This) { TextSelection textSelection = (TextSelection)This.Selection; ListItem listItem = TextPointerBase.GetListItem(textSelection.Start); ListItem immediateListItem = TextPointerBase.GetImmediateListItem(textSelection.Start); TextEditorLists.DecreaseIndentation(textSelection, listItem, immediateListItem); }
// 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); } } }
internal static void IndentListItems(TextRange range) { ListItem firstListItem = TextPointerBase.GetImmediateListItem(range.Start); ListItem lastListItem = TextPointerBase.GetImmediateListItem((TextPointer)TextRangeEdit.GetAdjustedRangeEnd(range.Start, range.End)); // The range must be in a sequence of ListItems belonging to one List wrapper if (firstListItem == null || lastListItem == null || firstListItem.Parent != lastListItem.Parent || !(firstListItem.Parent is List)) { return; } // Identify a ListItem which will become a leading item for this potential sublist ListItem leadingListItem = firstListItem.PreviousListItem; if (leadingListItem == null) { // There is no leading list item for this group. Indentation is impossible return; } // Get current List List list = (List)firstListItem.Parent; // Wrap these items into a List - inheriting all properties from our current list List indentedList = (List)TextRangeEdit.InsertElementClone(firstListItem.ElementStart, lastListItem.ElementEnd, list); // Wrap the leading ListItem to include the sublist leadingListItem.Reposition(leadingListItem.ContentStart, indentedList.ElementEnd); // Unwrap sublist from the last selected list item (to keep it on its level) Paragraph leadingParagraphOfLastItem = lastListItem.Blocks.FirstBlock as Paragraph; if (leadingParagraphOfLastItem != null) { // Unindenting all items of a sublist - if it is the only following element of a list List nestedListOfLastItem = leadingParagraphOfLastItem.NextBlock as List; if (nestedListOfLastItem != null && nestedListOfLastItem.NextBlock == null) { lastListItem.Reposition(lastListItem.ContentStart, nestedListOfLastItem.ElementStart); nestedListOfLastItem.Reposition(null, null); } } // Merge with neighboring lists MergeLists(indentedList.ElementStart); // No need in merging at nestedList.ElementEnd as ListItem ends there. }
// 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); } } }