Beispiel #1
0
        // ------------------------------------------------------------------
        // Fetch the next run at element close edge position.
        //
        //      position - current position in the text array
        // ------------------------------------------------------------------
        private TextRun HandleElementEndEdge(StaticTextPointer position)
        {
            Debug.Assert(position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementEnd, "TextPointer does not point to element end edge.");

            TextRun run = null;

            TextElement element = (TextElement)position.GetAdjacentElement(LogicalDirection.Forward);

            Debug.Assert(element != null, "Element should be here.");
            Inline inline = element as Inline;

            if (inline == null)
            {
                run = new TextHidden(_elementEdgeCharacterLength);
            }
            else
            {
                DependencyObject parent = inline.Parent;
                FlowDirection    parentFlowDirection = inline.FlowDirection;

                if (parent != null)
                {
                    parentFlowDirection = (FlowDirection)parent.GetValue(FrameworkElement.FlowDirectionProperty);
                }

                if (inline.FlowDirection != parentFlowDirection)
                {
                    run = new TextEndOfSegment(_elementEdgeCharacterLength);
                }
                else
                {
                    TextDecorationCollection textDecorations = DynamicPropertyReader.GetTextDecorations(inline);
                    if (textDecorations == null || textDecorations.Count == 0)
                    {
                        // (2) End of inline element, hide CloseEdge character and continue
                        run = new TextHidden(_elementEdgeCharacterLength);
                    }
                    else
                    {
                        run = new TextEndOfSegment(_elementEdgeCharacterLength);
                    }
                }
            }
            return(run);
        }
Beispiel #2
0
        /// <summary>
        /// Fetch the next run at element end edge position.
        /// ElementEndEdge; we can have 2 possibilities:
        /// (1) Close edge of element associated with the text paragraph,
        ///     create synthetic LineBreak run to end the current line.
        /// (2) End of inline element, hide CloseEdge character and continue
        /// </summary>
        /// <param name="position"></param>
        /// Position in current text array
        protected TextRun HandleElementEndEdge(StaticTextPointer position)
        {
            Invariant.Assert(position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementEnd, "TextPointer does not point to element end edge.");

            TextRun run;

            if (position.Parent == _paraClient.Paragraph.Element)
            {
                // (1) Close edge of element associated with the text paragraph,
                //     create synthetic LineBreak run to end the current line.
                run = new ParagraphBreakRun(_syntheticCharacterLength, PTS.FSFLRES.fsflrEndOfParagraph);
            }
            else
            {
                TextElement element = (TextElement)position.GetAdjacentElement(LogicalDirection.Forward);
                Debug.Assert(element != null, "Element should be here.");
                Inline           inline = (Inline)element;
                DependencyObject parent = inline.Parent;
                FlowDirection    parentFlowDirection = inline.FlowDirection;

                if (parent != null)
                {
                    parentFlowDirection = (FlowDirection)parent.GetValue(FrameworkElement.FlowDirectionProperty);
                }

                if (inline.FlowDirection != parentFlowDirection)
                {
                    run = new TextEndOfSegment(_elementEdgeCharacterLength);
                }
                else
                {
                    TextDecorationCollection textDecorations = DynamicPropertyReader.GetTextDecorations(inline);
                    if (textDecorations == null || textDecorations.Count == 0)
                    {
                        // (2) End of inline element, hide CloseEdge character and continue
                        run = new TextHidden(_elementEdgeCharacterLength);
                    }
                    else
                    {
                        run = new TextEndOfSegment(_elementEdgeCharacterLength);
                    }
                }
            }
            return(run);
        }
        // Token: 0x0600688F RID: 26767 RVA: 0x001D802C File Offset: 0x001D622C
        protected TextRun HandleElementEndEdge(StaticTextPointer position)
        {
            Invariant.Assert(position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementEnd, "TextPointer does not point to element end edge.");
            TextRun result;

            if (position.Parent == this._paraClient.Paragraph.Element)
            {
                result = new ParagraphBreakRun(LineBase._syntheticCharacterLength, PTS.FSFLRES.fsflrEndOfParagraph);
            }
            else
            {
                TextElement      textElement   = (TextElement)position.GetAdjacentElement(LogicalDirection.Forward);
                Inline           inline        = (Inline)textElement;
                DependencyObject parent        = inline.Parent;
                FlowDirection    flowDirection = inline.FlowDirection;
                if (parent != null)
                {
                    flowDirection = (FlowDirection)parent.GetValue(FrameworkElement.FlowDirectionProperty);
                }
                if (inline.FlowDirection != flowDirection)
                {
                    result = new TextEndOfSegment(LineBase._elementEdgeCharacterLength);
                }
                else
                {
                    TextDecorationCollection textDecorations = DynamicPropertyReader.GetTextDecorations(inline);
                    if (textDecorations == null || textDecorations.Count == 0)
                    {
                        result = new TextHidden(LineBase._elementEdgeCharacterLength);
                    }
                    else
                    {
                        result = new TextEndOfSegment(LineBase._elementEdgeCharacterLength);
                    }
                }
            }
            return(result);
        }
        // Token: 0x06006608 RID: 26120 RVA: 0x001CB13C File Offset: 0x001C933C
        private TextRun HandleElementEndEdge(StaticTextPointer position)
        {
            TextElement textElement = (TextElement)position.GetAdjacentElement(LogicalDirection.Forward);
            Inline      inline      = textElement as Inline;
            TextRun     result;

            if (inline == null)
            {
                result = new TextHidden(ComplexLine._elementEdgeCharacterLength);
            }
            else
            {
                DependencyObject parent        = inline.Parent;
                FlowDirection    flowDirection = inline.FlowDirection;
                if (parent != null)
                {
                    flowDirection = (FlowDirection)parent.GetValue(FrameworkElement.FlowDirectionProperty);
                }
                if (inline.FlowDirection != flowDirection)
                {
                    result = new TextEndOfSegment(ComplexLine._elementEdgeCharacterLength);
                }
                else
                {
                    TextDecorationCollection textDecorations = DynamicPropertyReader.GetTextDecorations(inline);
                    if (textDecorations == null || textDecorations.Count == 0)
                    {
                        result = new TextHidden(ComplexLine._elementEdgeCharacterLength);
                    }
                    else
                    {
                        result = new TextEndOfSegment(ComplexLine._elementEdgeCharacterLength);
                    }
                }
            }
            return(result);
        }