// 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;
     }
 }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 3
0
        private static void IncreaseIndentation(TextSelection thisSelection, ListItem parentListItem, ListItem immediateListItem)
        {
            if (immediateListItem != null)
            {
                TextRangeEditLists.IndentListItems(thisSelection);
            }
            else if (parentListItem != null)
            {
                TextRangeEditLists.ConvertParagraphsToListItems(thisSelection, TextMarkerStyle.Decimal);
                TextRangeEditLists.IndentListItems(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)
                    {
                        // Increment BlockUIContainer's leading margin.
                        TextRangeEdit.IncrementParagraphLeadingMargin(thisSelection, /*increment:*/ 20, PropertyValueAction.IncreaseByAbsoluteValue);
                    }
                    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");

                        if (paragraph.TextIndent < 0)
                        {
                            // Reset text indent to 0.
                            TextRangeEdit.SetParagraphProperty(thisSelection.Start, thisSelection.End, Paragraph.TextIndentProperty, 0.0, PropertyValueAction.SetValue);
                        }
                        else if (paragraph.TextIndent < 20)
                        {
                            // Reset text indent to 20.
                            TextRangeEdit.SetParagraphProperty(thisSelection.Start, thisSelection.End, Paragraph.TextIndentProperty, 20.0, PropertyValueAction.SetValue);
                        }
                        else
                        {
                            // Increment paragraph leading margin.
                            TextRangeEdit.IncrementParagraphLeadingMargin(thisSelection, /*increment:*/ 20, PropertyValueAction.IncreaseByAbsoluteValue);
                        }
                    }
                }
                else
                {
                    // For non-empty selection, always increment paragraph margin.
                    TextRangeEdit.IncrementParagraphLeadingMargin(thisSelection, /*increment:*/ 20, PropertyValueAction.IncreaseByAbsoluteValue);
                }
            }
        }
        // Token: 0x06003877 RID: 14455 RVA: 0x000FCEBC File Offset: 0x000FB0BC
        private static void IncreaseIndentation(TextSelection thisSelection, ListItem parentListItem, ListItem immediateListItem)
        {
            if (immediateListItem != null)
            {
                TextRangeEditLists.IndentListItems(thisSelection);
                return;
            }
            if (parentListItem != null)
            {
                TextRangeEditLists.ConvertParagraphsToListItems(thisSelection, TextMarkerStyle.Decimal);
                TextRangeEditLists.IndentListItems(thisSelection);
                return;
            }
            if (!thisSelection.IsEmpty)
            {
                TextRangeEdit.IncrementParagraphLeadingMargin(thisSelection, 20.0, PropertyValueAction.IncreaseByAbsoluteValue);
                return;
            }
            Block paragraphOrBlockUIContainer = thisSelection.Start.ParagraphOrBlockUIContainer;

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

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