// 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;
     }
 }
예제 #2
0
 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);
     }
 }
예제 #3
0
        private static void DecreaseIndentation(TextSelection thisSelection, ListItem parentListItem, ListItem immediateListItem)
        {
            if (immediateListItem != null)
            {
                TextRangeEditLists.UnindentListItems(thisSelection);
            }
            else if (parentListItem != null)
            {
                TextRangeEditLists.ConvertParagraphsToListItems(thisSelection, TextMarkerStyle.Disc);
                TextRangeEditLists.UnindentListItems(thisSelection);
            }
            else
            {
                if (thisSelection.IsEmpty)
                {
                    // When selection is empty, handle indentation based on current TextIndent property of the paragraph.
                    Block paragraphOrBlockUIContainer = thisSelection.Start.ParagraphOrBlockUIContainer;
                    if (paragraphOrBlockUIContainer is BlockUIContainer)
                    {
                        // Decrement BlockUIContainer's leading margin.
                        TextRangeEdit.IncrementParagraphLeadingMargin(thisSelection, /*increment:*/ 20, PropertyValueAction.DecreaseByAbsoluteValue);
                    }
                    else
                    {
                        // Create implicit paragraph if at a potential paragraph position, such as empty FlowDocument, TableCell.
                        CreateImplicitParagraphIfNeededAndUpdateSelection(thisSelection);

                        Paragraph paragraph = thisSelection.Start.Paragraph;
                        Invariant.Assert(paragraph != null, "EnsureInsertionPosition must guarantee a position in text content");

                        // When selection is empty, handle indentation based on current TextIndent property of the paragraph.
                        if (paragraph.TextIndent > 20)
                        {
                            // Reset text indent to 20.
                            TextRangeEdit.SetParagraphProperty(thisSelection.Start, thisSelection.End, Paragraph.TextIndentProperty, 20.0, PropertyValueAction.SetValue);
                        }
                        else if (paragraph.TextIndent > 0)
                        {
                            // Reset text indent to 0.
                            TextRangeEdit.SetParagraphProperty(thisSelection.Start, thisSelection.End, Paragraph.TextIndentProperty, 0.0, PropertyValueAction.SetValue);
                        }
                        else
                        {
                            // Decrement paragraph leading margin.
                            TextRangeEdit.IncrementParagraphLeadingMargin(thisSelection, /*increment:*/ 20, PropertyValueAction.DecreaseByAbsoluteValue);
                        }
                    }
                }
                else
                {
                    // For non-empty selection, always decrement paragraph margin.
                    TextRangeEdit.IncrementParagraphLeadingMargin(thisSelection, /*increment:*/ 20, PropertyValueAction.DecreaseByAbsoluteValue);
                }
            }
        }
        // Token: 0x06003878 RID: 14456 RVA: 0x000FCFC8 File Offset: 0x000FB1C8
        private static void DecreaseIndentation(TextSelection thisSelection, ListItem parentListItem, ListItem immediateListItem)
        {
            if (immediateListItem != null)
            {
                TextRangeEditLists.UnindentListItems(thisSelection);
                return;
            }
            if (parentListItem != null)
            {
                TextRangeEditLists.ConvertParagraphsToListItems(thisSelection, TextMarkerStyle.Disc);
                TextRangeEditLists.UnindentListItems(thisSelection);
                return;
            }
            if (!thisSelection.IsEmpty)
            {
                TextRangeEdit.IncrementParagraphLeadingMargin(thisSelection, 20.0, PropertyValueAction.DecreaseByAbsoluteValue);
                return;
            }
            Block paragraphOrBlockUIContainer = thisSelection.Start.ParagraphOrBlockUIContainer;

            if (paragraphOrBlockUIContainer is BlockUIContainer)
            {
                TextRangeEdit.IncrementParagraphLeadingMargin(thisSelection, 20.0, PropertyValueAction.DecreaseByAbsoluteValue);
                return;
            }
            TextEditorLists.CreateImplicitParagraphIfNeededAndUpdateSelection(thisSelection);
            Paragraph paragraph = thisSelection.Start.Paragraph;

            Invariant.Assert(paragraph != null, "EnsureInsertionPosition must guarantee a position in text content");
            if (paragraph.TextIndent > 20.0)
            {
                TextRangeEdit.SetParagraphProperty(thisSelection.Start, thisSelection.End, Paragraph.TextIndentProperty, 20.0, PropertyValueAction.SetValue);
                return;
            }
            if (paragraph.TextIndent > 0.0)
            {
                TextRangeEdit.SetParagraphProperty(thisSelection.Start, thisSelection.End, Paragraph.TextIndentProperty, 0.0, PropertyValueAction.SetValue);
                return;
            }
            TextRangeEdit.IncrementParagraphLeadingMargin(thisSelection, 20.0, PropertyValueAction.DecreaseByAbsoluteValue);
        }