// Token: 0x06006B3B RID: 27451 RVA: 0x001EF8CC File Offset: 0x001EDACC internal Size MeasureChild(InlineObjectRun inlineObject) { if (this._currentLine == null) { return(((OptimalTextSource)base.StructuralCache.TextFormatterHost.Context).MeasureChild(inlineObject)); } return(this._currentLine.MeasureChild(inlineObject)); }
// Token: 0x060068EA RID: 26858 RVA: 0x001D98EC File Offset: 0x001D7AEC internal Size MeasureChild(InlineObjectRun inlineObject) { double height = this._paraClient.Paragraph.StructuralCache.CurrentFormatContext.DocumentPageSize.Height; if (!this._paraClient.Paragraph.StructuralCache.CurrentFormatContext.FinitePage) { height = double.PositiveInfinity; } return(inlineObject.UIElementIsland.DoLayout(new Size(TextDpi.FromTextDpi(this._durTrack), height), true, true)); }
/// <summary> /// Measure child UIElement. /// </summary> /// <param name="inlineObject"> /// Element whose size we are measuring /// </param> /// <returns> /// Size of the child UIElement /// </returns> internal Size MeasureChild(InlineObjectRun inlineObject) { // Always measure at infinity for bottomless, consistent constraint. double pageHeight = _paraClient.Paragraph.StructuralCache.CurrentFormatContext.DocumentPageSize.Height; if (!_paraClient.Paragraph.StructuralCache.CurrentFormatContext.FinitePage) { pageHeight = Double.PositiveInfinity; } return(inlineObject.UIElementIsland.DoLayout(new Size(TextDpi.FromTextDpi(_durTrack), pageHeight), true, true)); }
// Token: 0x06006890 RID: 26768 RVA: 0x001D80F4 File Offset: 0x001D62F4 protected TextRun HandleEmbeddedObject(int dcp, StaticTextPointer position) { Invariant.Assert(position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.EmbeddedElement, "TextPointer does not point to embedded object."); DependencyObject dependencyObject = position.GetAdjacentElement(LogicalDirection.Forward) as DependencyObject; TextRun result; if (dependencyObject is UIElement) { TextRunProperties textProps = new TextProperties(dependencyObject, position, true, true, this._paraClient.Paragraph.StructuralCache.TextFormatterHost.PixelsPerDip); result = new InlineObjectRun(TextContainerHelper.EmbeddedObjectLength, (UIElement)dependencyObject, textProps, this._paraClient.Paragraph as TextParagraph); } else { result = new TextHidden(TextContainerHelper.EmbeddedObjectLength); } return(result); }
// Token: 0x06006867 RID: 26727 RVA: 0x001D6F10 File Offset: 0x001D5110 internal Size MeasureChild(InlineObjectRun inlineObject) { Size result; if (this._formattingContext.MeasureMode) { double height = this._paraClient.Paragraph.StructuralCache.CurrentFormatContext.DocumentPageSize.Height; if (!this._paraClient.Paragraph.StructuralCache.CurrentFormatContext.FinitePage) { height = double.PositiveInfinity; } result = inlineObject.UIElementIsland.DoLayout(new Size(this._trackWidth, height), true, true); } else { result = inlineObject.UIElementIsland.Root.DesiredSize; } return(result); }
/// <summary> /// Fetch the next run at embedded object position. /// </summary> /// <param name="dcp"> /// Character offset of this run. /// </param> /// <param name="position"> /// Current position in the text array. /// </param> protected TextRun HandleEmbeddedObject(int dcp, StaticTextPointer position) { Invariant.Assert(position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.EmbeddedElement, "TextPointer does not point to embedded object."); TextRun run = null; DependencyObject embeddedObject = position.GetAdjacentElement(LogicalDirection.Forward) as DependencyObject; if (embeddedObject is UIElement) { // Extract the aggregated properties into something that the textrun can use. TextRunProperties textProps = new TextProperties(embeddedObject, position, true /* inline objects */, true /* get background */); // Create inline object run. run = new InlineObjectRun(TextContainerHelper.EmbeddedObjectLength, (UIElement)embeddedObject, textProps, _paraClient.Paragraph as TextParagraph); } else { // If the embedded object is of an unknown type, treat it as hidden content. run = new TextHidden(TextContainerHelper.EmbeddedObjectLength); } return(run); }
/// <summary> /// Fetch the next run at embedded object position. /// </summary> /// <param name="dcp"> /// Character offset of this run. /// </param> /// <param name="position"> /// Current position in the text array. /// </param> protected TextRun HandleEmbeddedObject(int dcp, StaticTextPointer position) { Invariant.Assert(position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.EmbeddedElement, "TextPointer does not point to embedded object."); TextRun run = null; DependencyObject embeddedObject = position.GetAdjacentElement(LogicalDirection.Forward) as DependencyObject; if (embeddedObject is UIElement) { // Extract the aggregated properties into something that the textrun can use. TextRunProperties textProps = new TextProperties(embeddedObject, position, true /* inline objects */, true /* get background */); // Create inline object run. run = new InlineObjectRun(TextContainerHelper.EmbeddedObjectLength, (UIElement)embeddedObject, textProps, _paraClient.Paragraph as TextParagraph); } else { // If the embedded object is of an unknown type, treat it as hidden content. run = new TextHidden(TextContainerHelper.EmbeddedObjectLength); } return run; }
/// <summary> /// Measure child UIElement. /// </summary> /// <param name="inlineObject"> /// Element whose size we are measuring /// </param> /// <returns> /// Size of the child UIElement /// </returns> internal Size MeasureChild(InlineObjectRun inlineObject) { // Measure inline object only during measure pass. Otherwise // use cached data. Size desiredSize; if (_formattingContext.MeasureMode) { Debug.Assert(!DoubleUtil.IsNaN(_trackWidth), "Track width must be set for measure pass."); // Always measure at infinity for bottomless, consistent constraint. double pageHeight = _paraClient.Paragraph.StructuralCache.CurrentFormatContext.DocumentPageSize.Height; if (!_paraClient.Paragraph.StructuralCache.CurrentFormatContext.FinitePage) { pageHeight = Double.PositiveInfinity; } desiredSize = inlineObject.UIElementIsland.DoLayout(new Size(_trackWidth, pageHeight), true, true); } else { desiredSize = inlineObject.UIElementIsland.Root.DesiredSize; } return desiredSize; }
/// <summary> /// Measure child UIElement. /// </summary> /// <param name="inlineObject"> /// Element whose size we are measuring /// </param> /// <returns> /// Size of the child UIElement /// </returns> internal Size MeasureChild(InlineObjectRun inlineObject) { // Always measure at infinity for bottomless, consistent constraint. double pageHeight = _paraClient.Paragraph.StructuralCache.CurrentFormatContext.DocumentPageSize.Height; if (!_paraClient.Paragraph.StructuralCache.CurrentFormatContext.FinitePage) { pageHeight = Double.PositiveInfinity; } return inlineObject.UIElementIsland.DoLayout(new Size(TextDpi.FromTextDpi(_durTrack), pageHeight), true, true); }
// Token: 0x06006868 RID: 26728 RVA: 0x001D6FA4 File Offset: 0x001D51A4 internal ContainerVisual CreateVisual() { LineVisual lineVisual = new LineVisual(); this._host.Context = this; try { IList <TextSpan <TextRun> > list = this._runs; TextLine textLine = this._line; if (this._line.HasOverflowed && this.TextParagraph.Properties.TextTrimming != TextTrimming.None) { textLine = this._line.Collapse(new TextCollapsingProperties[] { this.GetCollapsingProps(this._wrappingWidth, this.TextParagraph.Properties) }); Invariant.Assert(textLine.HasCollapsed, "Line has not been collapsed"); list = textLine.GetTextRunSpans(); } if (this.HasInlineObjects()) { VisualCollection children = lineVisual.Children; DependencyObject element = this._paraClient.Paragraph.Element; FlowDirection parentFD = (FlowDirection)element.GetValue(FrameworkElement.FlowDirectionProperty); int num = this._dcp; foreach (TextSpan <TextRun> textSpan in list) { TextRun value = textSpan.Value; if (value is InlineObjectRun) { InlineObjectRun inlineObjectRun = (InlineObjectRun)value; FlowDirection flowDirection; Rect boundsFromPosition = this.GetBoundsFromPosition(num, value.Length, out flowDirection); Visual visual = VisualTreeHelper.GetParent(inlineObjectRun.UIElementIsland) as Visual; if (visual != null) { ContainerVisual containerVisual = visual as ContainerVisual; Invariant.Assert(containerVisual != null, "Parent should always derives from ContainerVisual."); containerVisual.Children.Remove(inlineObjectRun.UIElementIsland); } if (!textLine.HasCollapsed || boundsFromPosition.Left + inlineObjectRun.UIElementIsland.Root.DesiredSize.Width < textLine.Width) { if (inlineObjectRun.UIElementIsland.Root is FrameworkElement) { DependencyObject parent = ((FrameworkElement)inlineObjectRun.UIElementIsland.Root).Parent; FlowDirection childFD = (FlowDirection)parent.GetValue(FrameworkElement.FlowDirectionProperty); PtsHelper.UpdateMirroringTransform(parentFD, childFD, inlineObjectRun.UIElementIsland, boundsFromPosition.Width); } children.Add(inlineObjectRun.UIElementIsland); inlineObjectRun.UIElementIsland.Offset = new Vector(boundsFromPosition.Left, boundsFromPosition.Top); } } num += textSpan.Length; } } double x = TextDpi.FromTextDpi(this.CalculateUOffsetShift()); DrawingContext drawingContext = lineVisual.Open(); textLine.Draw(drawingContext, new Point(x, 0.0), this._mirror ? InvertAxes.Horizontal : InvertAxes.None); drawingContext.Close(); lineVisual.WidthIncludingTrailingWhitespace = textLine.WidthIncludingTrailingWhitespace - this._indent; } finally { this._host.Context = null; } return(lineVisual); }