Пример #1
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="dcp">
 /// Embedded object's character position.
 /// </param>
 /// <param name="uiElementIsland">
 /// UIElementIsland associated with embedded object.
 /// </param>
 /// <param name="para">
 /// TextParagraph associated with embedded object.
 /// </param>
 internal InlineObject(int dcp, UIElementIsland uiElementIsland, TextParagraph para)
     : base(dcp)
 {
     _para            = para;
     _uiElementIsland = uiElementIsland;
     _uiElementIsland.DesiredSizeChanged += new DesiredSizeChangedEventHandler(_para.OnUIElementDesiredSizeChanged);
 }
 // ------------------------------------------------------------------
 // Constructor.
 //
 //      PtsContext - Context
 //      TextParagraphCache - Contained line break
 // ------------------------------------------------------------------
 internal OptimalBreakSession(TextParagraph textParagraph, TextParaClient textParaClient, TextParagraphCache TextParagraphCache, OptimalTextSource optimalTextSource) : base(textParagraph.PtsContext)
 {
     _textParagraph      = textParagraph;
     _textParaClient     = textParaClient;
     _textParagraphCache = TextParagraphCache;
     _optimalTextSource  = optimalTextSource;
 }
Пример #3
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="cch">Number of text position in the text array occupied by the inline object.</param>
        /// <param name="element">UIElement representing the inline object.</param>
        /// <param name="textProps">Text run properties for the inline object.</param>
        /// <param name="host">Paragraph - the host of the inline object.</param>
        internal InlineObjectRun(int cch, UIElement element, TextRunProperties textProps, TextParagraph host)
        {
            _cch       = cch;
            _textProps = textProps;
            _host      = host;

            _inlineUIContainer = (InlineUIContainer)LogicalTreeHelper.GetParent(element);
        }
Пример #4
0
 // Token: 0x060067C2 RID: 26562 RVA: 0x001D159B File Offset: 0x001CF79B
 internal InlineObject(int dcp, UIElementIsland uiElementIsland, TextParagraph para) : base(dcp)
 {
     this._para            = para;
     this._uiElementIsland = uiElementIsland;
     this._uiElementIsland.DesiredSizeChanged += this._para.OnUIElementDesiredSizeChanged;
 }
        // Token: 0x060067A3 RID: 26531 RVA: 0x001D08E0 File Offset: 0x001CEAE0
        protected virtual BaseParagraph GetParagraph(ITextPointer textPointer, bool fEmptyOk)
        {
            BaseParagraph baseParagraph = null;

            switch (textPointer.GetPointerContext(LogicalDirection.Forward))
            {
            case TextPointerContext.None:
                Invariant.Assert(textPointer.CompareTo(textPointer.TextContainer.End) == 0);
                if (!fEmptyOk)
                {
                    baseParagraph = new TextParagraph(base.Element, base.StructuralCache);
                }
                break;

            case TextPointerContext.Text:
                if (textPointer.TextContainer.Start.CompareTo(textPointer) > 0 && (!(base.Element is TextElement) || ((TextElement)base.Element).ContentStart != textPointer))
                {
                    throw new InvalidOperationException(SR.Get("TextSchema_TextIsNotAllowedInThisContext", new object[]
                    {
                        base.Element.GetType().Name
                    }));
                }
                baseParagraph = new TextParagraph(base.Element, base.StructuralCache);
                break;

            case TextPointerContext.EmbeddedElement:
                baseParagraph = new TextParagraph(base.Element, base.StructuralCache);
                break;

            case TextPointerContext.ElementStart:
            {
                TextElement adjacentElementFromOuterPosition = ((TextPointer)textPointer).GetAdjacentElementFromOuterPosition(LogicalDirection.Forward);
                if (adjacentElementFromOuterPosition is List)
                {
                    baseParagraph = new ListParagraph(adjacentElementFromOuterPosition, base.StructuralCache);
                }
                else if (adjacentElementFromOuterPosition is Table)
                {
                    baseParagraph = new TableParagraph(adjacentElementFromOuterPosition, base.StructuralCache);
                }
                else if (adjacentElementFromOuterPosition is BlockUIContainer)
                {
                    baseParagraph = new UIElementParagraph(adjacentElementFromOuterPosition, base.StructuralCache);
                }
                else if (adjacentElementFromOuterPosition is Block || adjacentElementFromOuterPosition is ListItem)
                {
                    baseParagraph = new ContainerParagraph(adjacentElementFromOuterPosition, base.StructuralCache);
                }
                else if (adjacentElementFromOuterPosition is Inline)
                {
                    baseParagraph = new TextParagraph(base.Element, base.StructuralCache);
                }
                else
                {
                    Invariant.Assert(false);
                }
                break;
            }

            case TextPointerContext.ElementEnd:
                Invariant.Assert(textPointer is TextPointer);
                Invariant.Assert(base.Element == ((TextPointer)textPointer).Parent);
                if (!fEmptyOk)
                {
                    baseParagraph = new TextParagraph(base.Element, base.StructuralCache);
                }
                break;
            }
            if (baseParagraph != null)
            {
                base.StructuralCache.CurrentFormatContext.DependentMax = (TextPointer)textPointer;
            }
            return(baseParagraph);
        }