Beispiel #1
0
        // ------------------------------------------------------------------
        // Get length of content hidden by ellipses.
        //
        //      wrappingWidth - Wrapping width for the line.
        //
        // Returns: Length of collapsed content (number of characters hidden
        //          by ellipses).
        // ------------------------------------------------------------------
        internal int GetEllipsesLength()
        {
            // There are no ellipses, if:
            // * there is no overflow in the line
            // * text trimming is turned off
            if (!_line.HasOverflowed)
            {
                return(0);
            }
            if (_owner.ParagraphProperties.TextTrimming == TextTrimming.None)
            {
                return(0);
            }

            // Create collapsed text line to get length of collapsed content.
            System.Windows.Media.TextFormatting.TextLine collapsedLine = _line.Collapse(GetCollapsingProps(_wrappingWidth, _owner.ParagraphProperties));
            Debug.Assert(collapsedLine.HasCollapsed, "Line has not been collapsed");
            IList <TextCollapsedRange> collapsedRanges = collapsedLine.GetTextCollapsedRanges();

            if (collapsedRanges != null)
            {
                Debug.Assert(collapsedRanges.Count == 1, "Multiple collapsed ranges are not supported.");
                TextCollapsedRange collapsedRange = collapsedRanges[0];
                return(collapsedRange.Length);
            }
            return(0);
        }
        // Token: 0x0600686E RID: 26734 RVA: 0x001D7558 File Offset: 0x001D5758
        internal int GetEllipsesLength()
        {
            if (!this._line.HasOverflowed)
            {
                return(0);
            }
            if (this.TextParagraph.Properties.TextTrimming == TextTrimming.None)
            {
                return(0);
            }
            TextLine textLine = this._line.Collapse(new TextCollapsingProperties[]
            {
                this.GetCollapsingProps(this._wrappingWidth, this.TextParagraph.Properties)
            });

            Invariant.Assert(textLine.HasCollapsed, "Line has not been collapsed");
            IList <TextCollapsedRange> textCollapsedRanges = textLine.GetTextCollapsedRanges();

            if (textCollapsedRanges != null)
            {
                Invariant.Assert(textCollapsedRanges.Count == 1, "Multiple collapsed ranges are not supported.");
                TextCollapsedRange textCollapsedRange = textCollapsedRanges[0];
                return(textCollapsedRange.Length);
            }
            return(0);
        }
Beispiel #3
0
        // Token: 0x0600663A RID: 26170 RVA: 0x001CBB54 File Offset: 0x001C9D54
        internal int GetEllipsesLength()
        {
            if (!this._line.HasOverflowed)
            {
                return(0);
            }
            if (this._owner.ParagraphProperties.TextTrimming == TextTrimming.None)
            {
                return(0);
            }
            TextLine textLine = this._line.Collapse(new TextCollapsingProperties[]
            {
                this.GetCollapsingProps(this._wrappingWidth, this._owner.ParagraphProperties)
            });
            IList <TextCollapsedRange> textCollapsedRanges = textLine.GetTextCollapsedRanges();

            if (textCollapsedRanges != null)
            {
                TextCollapsedRange textCollapsedRange = textCollapsedRanges[0];
                return(textCollapsedRange.Length);
            }
            return(0);
        }