ListItemParagraph represents a single list item.
Inheritance: MS.Internal.PtsHost.ContainerParagraph
示例#1
0
        // Token: 0x060068B0 RID: 26800 RVA: 0x001D8BE4 File Offset: 0x001D6DE4
        protected override BaseParagraph GetParagraph(ITextPointer textPointer, bool fEmptyOk)
        {
            Invariant.Assert(textPointer is TextPointer);
            BaseParagraph baseParagraph = null;

            while (baseParagraph == null)
            {
                TextPointerContext pointerContext = textPointer.GetPointerContext(LogicalDirection.Forward);
                if (pointerContext == TextPointerContext.ElementStart)
                {
                    TextElement adjacentElementFromOuterPosition = ((TextPointer)textPointer).GetAdjacentElementFromOuterPosition(LogicalDirection.Forward);
                    if (adjacentElementFromOuterPosition is ListItem)
                    {
                        baseParagraph = new ListItemParagraph(adjacentElementFromOuterPosition, base.StructuralCache);
                        break;
                    }
                    if (adjacentElementFromOuterPosition is List)
                    {
                        baseParagraph = new ListParagraph(adjacentElementFromOuterPosition, base.StructuralCache);
                        break;
                    }
                    if (((TextPointer)textPointer).IsFrozen)
                    {
                        textPointer = textPointer.CreatePointer();
                    }
                    textPointer.MoveToPosition(adjacentElementFromOuterPosition.ElementEnd);
                }
                else if (pointerContext == TextPointerContext.ElementEnd)
                {
                    if (base.Element == ((TextPointer)textPointer).Parent)
                    {
                        break;
                    }
                    if (((TextPointer)textPointer).IsFrozen)
                    {
                        textPointer = textPointer.CreatePointer();
                    }
                    textPointer.MoveToNextContextPosition(LogicalDirection.Forward);
                }
                else
                {
                    if (((TextPointer)textPointer).IsFrozen)
                    {
                        textPointer = textPointer.CreatePointer();
                    }
                    textPointer.MoveToNextContextPosition(LogicalDirection.Forward);
                }
            }
            if (baseParagraph != null)
            {
                base.StructuralCache.CurrentFormatContext.DependentMax = (TextPointer)textPointer;
            }
            return(baseParagraph);
        }
示例#2
0
        /// <summary> 
        /// Determine paragraph type at the current TextPointer and
        /// create it. Only ListItem elements are considered. Any other 
        /// content is skipped.
        /// </summary>
        /// <param name="textPointer">
        /// TextPointer at which paragraph is to be created 
        /// </param>
        /// <param name="fEmptyOk"> 
        /// True if empty paragraph is acceptable 
        /// </param>
        /// <returns> 
        /// BaseParagraph that was created
        /// </returns>
        protected override BaseParagraph GetParagraph(ITextPointer textPointer, bool fEmptyOk)
        { 
            Invariant.Assert(textPointer is TextPointer);
 
            BaseParagraph paragraph = null; 

            while (paragraph == null) 
            {
                TextPointerContext runType = textPointer.GetPointerContext(LogicalDirection.Forward);
                if (runType == TextPointerContext.ElementStart)
                { 
                    TextElement element = ((TextPointer)textPointer).GetAdjacentElementFromOuterPosition(LogicalDirection.Forward);
                    if (element is ListItem) 
                    { 
                        //
 



 

 
                        paragraph = new ListItemParagraph(element, StructuralCache); 
                        break;
                    } 
                    else if (element is List)
                    {
                        //
 

 
 

 

                        paragraph = new ListParagraph(element, StructuralCache);
                        break;
                    } 
                    // Skip all elements, which are not valid list item children
                    if (((TextPointer)textPointer).IsFrozen) 
                    { 
                        // Need to clone TextPointer before moving it.
                        textPointer = textPointer.CreatePointer(); 
                    }
                    textPointer.MoveToPosition(element.ElementEnd);
                }
                else if (runType == TextPointerContext.ElementEnd) 
                {
                    // End of list, if the same as Owner of associated element 
                    // Skip content otherwise 
                    if (Element == ((TextPointer)textPointer).Parent)
                    { 
                        break;
                    }
                    if (((TextPointer)textPointer).IsFrozen)
                    { 
                        // Need to clone TextPointer before moving it.
                        textPointer = textPointer.CreatePointer(); 
                    } 
                    textPointer.MoveToNextContextPosition(LogicalDirection.Forward);
                } 
                else
                {
                    // Skip content
                    if (((TextPointer)textPointer).IsFrozen) 
                    {
                        // Need to clone TextPointer before moving it. 
                        textPointer = textPointer.CreatePointer(); 
                    }
                    textPointer.MoveToNextContextPosition(LogicalDirection.Forward); 
                }
            }

            if (paragraph != null) 
            {
                StructuralCache.CurrentFormatContext.DependentMax = (TextPointer)textPointer; 
            } 

            return paragraph; 
        }
示例#3
0
        /// <summary>
        /// Determine paragraph type at the current TextPointer and
        /// create it. Only ListItem elements are considered. Any other
        /// content is skipped.
        /// </summary>
        /// <param name="textPointer">
        /// TextPointer at which paragraph is to be created
        /// </param>
        /// <param name="fEmptyOk">
        /// True if empty paragraph is acceptable
        /// </param>
        /// <returns>
        /// BaseParagraph that was created
        /// </returns>
        protected override BaseParagraph GetParagraph(ITextPointer textPointer, bool fEmptyOk)
        {
            Invariant.Assert(textPointer is TextPointer);

            BaseParagraph paragraph = null;

            while (paragraph == null)
            {
                TextPointerContext runType = textPointer.GetPointerContext(LogicalDirection.Forward);
                if (runType == TextPointerContext.ElementStart)
                {
                    TextElement element = ((TextPointer)textPointer).GetAdjacentElementFromOuterPosition(LogicalDirection.Forward);
                    if (element is ListItem)
                    {
                        //      Need to handle visibility collapsed.
                        //Visibility visibility = Retriever.Visibility(treePtr.CPPtr.Element);
                        //if (visibility != Visibility.Collapsed)
                        //{
                        //    para = new
                        //}
                        //else skip the element
                        paragraph = new ListItemParagraph(element, StructuralCache);
                        break;
                    }
                    else if (element is List)
                    {
                        //      Need to handle visibility collapsed.
                        //Visibility visibility = Retriever.Visibility(treePtr.CPPtr.Element);
                        //if (visibility != Visibility.Collapsed)
                        //{
                        //    para = new
                        //}
                        //else skip the element
                        paragraph = new ListParagraph(element, StructuralCache);
                        break;
                    }
                    // Skip all elements, which are not valid list item children
                    if (((TextPointer)textPointer).IsFrozen)
                    {
                        // Need to clone TextPointer before moving it.
                        textPointer = textPointer.CreatePointer();
                    }
                    textPointer.MoveToPosition(element.ElementEnd);
                }
                else if (runType == TextPointerContext.ElementEnd)
                {
                    // End of list, if the same as Owner of associated element
                    // Skip content otherwise
                    if (Element == ((TextPointer)textPointer).Parent)
                    {
                        break;
                    }
                    if (((TextPointer)textPointer).IsFrozen)
                    {
                        // Need to clone TextPointer before moving it.
                        textPointer = textPointer.CreatePointer();
                    }
                    textPointer.MoveToNextContextPosition(LogicalDirection.Forward);
                }
                else
                {
                    // Skip content
                    if (((TextPointer)textPointer).IsFrozen)
                    {
                        // Need to clone TextPointer before moving it.
                        textPointer = textPointer.CreatePointer();
                    }
                    textPointer.MoveToNextContextPosition(LogicalDirection.Forward);
                }
            }

            if (paragraph != null)
            {
                StructuralCache.CurrentFormatContext.DependentMax = (TextPointer)textPointer;
            }

            return(paragraph);
        }