//------------------------------------------------------------------- // CollapseMargin //------------------------------------------------------------------- internal override void CollapseMargin( BaseParaClient paraClient, // IN: MarginCollapsingState mcs, // IN: input margin collapsing state uint fswdir, // IN: current direction (of the track, in which margin collapsing is happening) bool suppressTopSpace, // IN: suppress empty space at the top of page out int dvr) // OUT: dvr, calculated based on margin collapsing state { MbpInfo mbp = MbpInfo.FromElement(Element, StructuralCache.TextFormatterHost.PixelsPerDip); MarginCollapsingState mcsNew; int margin; MarginCollapsingState.CollapseTopMargin(PtsContext, mbp, mcs, out mcsNew, out margin); if (suppressTopSpace) { dvr = 0; } else { dvr = margin; if (mcsNew != null) { dvr += mcsNew.Margin; } } if (mcsNew != null) { mcsNew.Dispose(); } }
protected override void OnArrange() { base.OnArrange(); // Query paragraph details PTS.FSSUBTRACKDETAILS subtrackDetails; PTS.Validate(PTS.FsQuerySubtrackDetails(PtsContext.Context, _paraHandle.Value, out subtrackDetails)); // Adjust rectangle and offset to take into account MBPs MbpInfo mbp = MbpInfo.FromElement(Paragraph.Element); if (ParentFlowDirection != PageFlowDirection) { mbp.MirrorMargin(); } _rect.u += mbp.MarginLeft; _rect.du -= mbp.MarginLeft + mbp.MarginRight; _rect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.du); _rect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.dv); uint fswdirSubtrack = PTS.FlowDirectionToFswdir(_flowDirection); // There is possibility to get empty track. if (subtrackDetails.cParas != 0) { // Get list of paragraphs PTS.FSPARADESCRIPTION [] arrayParaDesc; PtsHelper.ParaListFromSubtrack(PtsContext, _paraHandle.Value, ref subtrackDetails, out arrayParaDesc); PtsHelper.ArrangeParaList(PtsContext, subtrackDetails.fsrc, arrayParaDesc, fswdirSubtrack); } }
protected override void OnArrange() { base.OnArrange(); PTS.FSFLOATERDETAILS floaterDetails; PTS.Validate(PTS.FsQueryFloaterDetails(PtsContext.Context, _paraHandle.Value, out floaterDetails)); // Get paragraph's rectangle. _rect = floaterDetails.fsrcFloater; MbpInfo mbp = MbpInfo.FromElement(Paragraph.Element, Paragraph.StructuralCache.TextFormatterHost.PixelsPerDip); if (ParentFlowDirection != PageFlowDirection) { mbp.MirrorMargin(); PTS.FSRECT pageRect = _pageContext.PageRect; PTS.Validate(PTS.FsTransformRectangle(PTS.FlowDirectionToFswdir(ParentFlowDirection), ref pageRect, ref _rect, PTS.FlowDirectionToFswdir(PageFlowDirection), out _rect)); } _rect.u += mbp.MarginLeft; _rect.du -= mbp.MarginLeft + mbp.MarginRight; _rect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.du); _rect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.dv); }
/// <summary> /// GetRowProperties /// </summary> /// <param name="fswdirTable">Flow direction for table</param> /// <param name="rowprops">Row properties structure</param> internal void GetRowProperties( uint fswdirTable, // IN: out PTS.FSTABLEROWPROPS rowprops) // OUT: { // local variables PTS.FSKROWHEIGHTRESTRICTION fskrowheight; int dvrAboveBelow; bool isLastRowOfRowGroup = (Row.Index == Row.RowGroup.Rows.Count - 1); // Note: PTS generally does not accept rows with no real cells // (Defintinion: real cell is // a) cell with no vertical merge; // OR // b) vertically merged cell ending in this row) // However PTS accepts a row with no real cells if it has explicit height set. // So fskrowheight is set to "0" if // a) user said so; // b) no real cells found; GetRowHeight(out fskrowheight, out dvrAboveBelow); // initialize output parameter(s) rowprops = new PTS.FSTABLEROWPROPS(); rowprops.fskrowbreak = PTS.FSKROWBREAKRESTRICTION.fskrowbreakAnywhere; rowprops.fskrowheight = fskrowheight; rowprops.dvrRowHeightRestriction = 0; rowprops.dvrAboveRow = dvrAboveBelow; rowprops.dvrBelowRow = dvrAboveBelow; int cellSpacing = TextDpi.ToTextDpi(Table.InternalCellSpacing); // Clip MBP values to structural cache's current format context size. Also use current format context's page height to // clip cell spacing MbpInfo mbpInfo = MbpInfo.FromElement(Table, StructuralCache.TextFormatterHost.PixelsPerDip); if (Row.Index == 0 && Table.IsFirstNonEmptyRowGroup(Row.RowGroup.Index)) { rowprops.dvrAboveTopRow = mbpInfo.BPTop + cellSpacing / 2; } else { rowprops.dvrAboveTopRow = dvrAboveBelow; } if (isLastRowOfRowGroup && Table.IsLastNonEmptyRowGroup(Row.RowGroup.Index)) { rowprops.dvrBelowBottomRow = mbpInfo.BPBottom + cellSpacing / 2; } else { rowprops.dvrBelowBottomRow = dvrAboveBelow; } rowprops.dvrAboveRowBreak = cellSpacing / 2; rowprops.dvrBelowRowBreak = cellSpacing / 2; rowprops.cCells = Row.FormatCellCount; }
//------------------------------------------------------ // // Protected Methods // //------------------------------------------------------ #region Protected Methods #endregion Protected Methods //------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ #region Internal Methods /// <summary> /// Collapse Margins /// </summary> /// <param name="paraClient">Para client</param> /// <param name="mcs">input margin collapsing state</param> /// <param name="fswdir">current direction (of the track, in which margin collapsing is happening)</param> /// <param name="suppressTopSpace">suppress empty space at the top of page</param> /// <param name="dvr">dvr, calculated based on margin collapsing state</param> internal override void CollapseMargin( BaseParaClient paraClient, // IN: MarginCollapsingState mcs, // IN: input margin collapsing state uint fswdir, // IN: current direction (of the track, in which margin collapsing is happening) bool suppressTopSpace, // IN: suppress empty space at the top of page out int dvr) // OUT: dvr, calculated based on margin collapsing state { if (suppressTopSpace && (StructuralCache.CurrentFormatContext.FinitePage || mcs == null)) { dvr = 0; } else { MbpInfo mbp = MbpInfo.FromElement(Table, StructuralCache.TextFormatterHost.PixelsPerDip); MarginCollapsingState mcsOut = null; MarginCollapsingState.CollapseTopMargin(PtsContext, mbp, mcs, out mcsOut, out dvr); if (mcsOut != null) { dvr = mcsOut.Margin; mcsOut.Dispose(); mcsOut = null; } } }
// Token: 0x06006B6E RID: 27502 RVA: 0x001F0978 File Offset: 0x001EEB78 internal override void ValidateVisual(PTS.FSKUPDATE fskupdInherited) { MbpInfo mbpInfo = MbpInfo.FromElement(base.Paragraph.Element, base.Paragraph.StructuralCache.TextFormatterHost.PixelsPerDip); PtsHelper.UpdateMirroringTransform(base.PageFlowDirection, base.ThisFlowDirection, this._visual, TextDpi.FromTextDpi(2 * this._rect.u + this._rect.du)); UIElementIsland uielementIsland = ((UIElementParagraph)base.Paragraph).UIElementIsland; if (uielementIsland != null) { if (this._visual.Children.Count != 1 || this._visual.Children[0] != uielementIsland) { Visual visual = VisualTreeHelper.GetParent(uielementIsland) as Visual; if (visual != null) { ContainerVisual containerVisual = visual as ContainerVisual; Invariant.Assert(containerVisual != null, "Parent should always derives from ContainerVisual."); containerVisual.Children.Remove(uielementIsland); } this._visual.Children.Clear(); this._visual.Children.Add(uielementIsland); } uielementIsland.Offset = new PTS.FSVECTOR(this._rect.u + mbpInfo.BPLeft, this._rect.v + mbpInfo.BPTop).FromTextDpi(); } else { this._visual.Children.Clear(); } Brush backgroundBrush = (Brush)base.Paragraph.Element.GetValue(TextElement.BackgroundProperty); this._visual.DrawBackgroundAndBorder(backgroundBrush, mbpInfo.BorderBrush, mbpInfo.Border, this._rect.FromTextDpi(), this.IsFirstChunk, this.IsLastChunk); }
//------------------------------------------------------------------- // // Private Methods // //------------------------------------------------------------------- #region Private Methods /// <summary> /// Adjust the width available for the Floater. /// </summary> private void AdjustDurAvailable(double specifiedWidth, ref int durAvailable, out int subpageWidth) { // If width on floater is specified, use the specified value. // Use page size from current format context to limit MBP MbpInfo mbp = MbpInfo.FromElement(Element, StructuralCache.TextFormatterHost.PixelsPerDip); if (!Double.IsNaN(specifiedWidth)) { TextDpi.EnsureValidPageWidth(ref specifiedWidth); // If specified width is greater than available width, do not exceed available width int durSpecified = TextDpi.ToTextDpi(specifiedWidth); if ((durSpecified + mbp.MarginRight + mbp.MarginLeft) <= durAvailable) { // Set durAvailable to durSpecified plus margins, which will be added later. // Set subpage width to specified width less border and padding durAvailable = durSpecified + mbp.MarginLeft + mbp.MarginRight; subpageWidth = Math.Max(1, durSpecified - (mbp.BPLeft + mbp.BPRight)); } else { // Use durAvailable, less MBP to set subpage width. We cannot set figure to specified width subpageWidth = Math.Max(1, durAvailable - (mbp.MBPLeft + mbp.MBPRight)); } } else { // No width specified. Use durAvailable, less MBP to set subpage width. subpageWidth = Math.Max(1, durAvailable - (mbp.MBPLeft + mbp.MBPRight)); } }
// Token: 0x0600680B RID: 26635 RVA: 0x001D3C64 File Offset: 0x001D1E64 internal override void ArrangeFloater(PTS.FSRECT rcFloater, PTS.FSRECT rcHostPara, uint fswdirParent, PageContext pageContext) { if (this.IsFloaterHorizontallyCentered(rcFloater, rcHostPara)) { rcFloater.u = rcHostPara.u + (rcHostPara.du - rcFloater.du) / 2; } this._rect = rcFloater; MbpInfo mbpInfo = MbpInfo.FromElement(base.Paragraph.Element, base.Paragraph.StructuralCache.TextFormatterHost.PixelsPerDip); this._rect.v = this._rect.v + mbpInfo.MarginTop; this._rect.dv = this._rect.dv - (mbpInfo.MarginTop + mbpInfo.MarginBottom); this._rect.u = this._rect.u + mbpInfo.MarginLeft; this._rect.du = this._rect.du - (mbpInfo.MarginLeft + mbpInfo.MarginRight); this._flowDirectionParent = PTS.FswdirToFlowDirection(fswdirParent); this._flowDirection = (FlowDirection)base.Paragraph.Element.GetValue(FrameworkElement.FlowDirectionProperty); this._pageContext = pageContext; if (base.ThisFlowDirection != base.PageFlowDirection) { mbpInfo.MirrorBP(); } this._contentRect.u = this._rect.u + mbpInfo.BPLeft; this._contentRect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), this._rect.du - mbpInfo.BPRight - mbpInfo.BPLeft); this._contentRect.v = this._rect.v + mbpInfo.BPTop; this._contentRect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), this._rect.dv - mbpInfo.BPBottom - mbpInfo.BPTop); this._paddingRect.u = this._rect.u + mbpInfo.BorderLeft; this._paddingRect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), this._rect.du - mbpInfo.BorderRight - mbpInfo.BorderLeft); this._paddingRect.v = this._rect.v + mbpInfo.BorderTop; this._paddingRect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), this._rect.dv - mbpInfo.BorderBottom - mbpInfo.BorderTop); this.OnArrange(); }
internal override void ValidateVisual(PTS.FSKUPDATE fskupdInherited) { // Query paragraph details PTS.FSSUBTRACKDETAILS subtrackDetails; PTS.Validate(PTS.FsQuerySubtrackDetails(PtsContext.Context, _paraHandle.Value, out subtrackDetails)); // Draw border and background info. // Adjust rectangle and offset to take into account MBPs MbpInfo mbp = MbpInfo.FromElement(Paragraph.Element); if (ThisFlowDirection != PageFlowDirection) { mbp.MirrorBP(); } Brush backgroundBrush = (Brush)Paragraph.Element.GetValue(TextElement.BackgroundProperty); _visual.DrawBackgroundAndBorder(backgroundBrush, mbp.BorderBrush, mbp.Border, _rect.FromTextDpi(), IsFirstChunk, IsLastChunk); // There might be possibility to get empty sub-track, skip the sub-track in such case. if (subtrackDetails.cParas != 0) { // Get list of paragraphs PTS.FSPARADESCRIPTION [] arrayParaDesc; PtsHelper.ParaListFromSubtrack(PtsContext, _paraHandle.Value, ref subtrackDetails, out arrayParaDesc); // Render list of paragraphs PtsHelper.UpdateParaListVisuals(PtsContext, _visual.Children, fskupdInherited, arrayParaDesc); } else { _visual.Children.Clear(); } }
//------------------------------------------------------------------- // // Private methods // //------------------------------------------------------------------- #region Private Methods /// <summary> /// Format UIElement /// </summary> private void FormatUIElement(int durAvailable, out PTS.FSBBOX fsbbox) { MbpInfo mbp = MbpInfo.FromElement(Element, StructuralCache.TextFormatterHost.PixelsPerDip); double elementHeight; double elementWidth = TextDpi.FromTextDpi(Math.Max(1, durAvailable - (mbp.MBPLeft + mbp.MBPRight))); if (SizeToFigureParent) { // Only child of a figure whose height is set. Size to figure's page height less figure's MBP and BlockUIContainer's MBP // NOTE: BlockUIContainer margins are always extracted before formatting, either from Figure height or page height if (StructuralCache.CurrentFormatContext.FinitePage) { elementHeight = StructuralCache.CurrentFormatContext.PageHeight; } else { Figure figure = (Figure)((BlockUIContainer)Element).Parent; Invariant.Assert(figure.Height.IsAbsolute); elementHeight = figure.Height.Value; } elementHeight = Math.Max(TextDpi.FromTextDpi(1), elementHeight - TextDpi.FromTextDpi(mbp.MBPTop + mbp.MBPBottom)); UIElementIsland.DoLayout(new Size(elementWidth, elementHeight), false, false); // Create fsbbox. Set width to available width since we want block ui container to occupy the full column // and UIElement to be algined within it. Set dv to elementHeight. fsbbox.fsrc = new PTS.FSRECT(); fsbbox.fsrc.du = durAvailable; fsbbox.fsrc.dv = TextDpi.ToTextDpi(elementHeight) + mbp.BPTop + mbp.BPBottom; fsbbox.fDefined = PTS.True; } else { // Either BlockUIContainer is not the only child of a figure or the figure's height is unspecified. // In this case, size to height of strcutural cache's current page less page margins and container MBP. // This is consistent with figure's behavior on sizing to content // Always measure at infinity for bottomless, consistent constraint. if (StructuralCache.CurrentFormatContext.FinitePage) { Thickness pageMargin = StructuralCache.CurrentFormatContext.DocumentPageMargin; elementHeight = StructuralCache.CurrentFormatContext.DocumentPageSize.Height - pageMargin.Top - pageMargin.Bottom - TextDpi.FromTextDpi(mbp.MBPTop + mbp.MBPBottom); elementHeight = Math.Max(TextDpi.FromTextDpi(1), elementHeight); } else { elementHeight = Double.PositiveInfinity; } Size uiIslandSize = UIElementIsland.DoLayout(new Size(elementWidth, elementHeight), false, true); // Create fsbbox. Set width to available width since we want block ui container to occupy the full column // and UIElement to be algined within it fsbbox.fsrc = new PTS.FSRECT(); fsbbox.fsrc.du = durAvailable; fsbbox.fsrc.dv = TextDpi.ToTextDpi(uiIslandSize.Height) + mbp.BPTop + mbp.BPBottom; fsbbox.fDefined = PTS.True; } }
// Token: 0x06006B60 RID: 27488 RVA: 0x001F0134 File Offset: 0x001EE334 internal override void FormatFloaterContentFinite(FloaterBaseParaClient paraClient, IntPtr pbrkrecIn, int fBRFromPreviousPage, IntPtr footnoteRejector, int fEmptyOk, int fSuppressTopSpace, uint fswdir, int fAtMaxWidth, int durAvailable, int dvrAvailable, PTS.FSKSUPPRESSHARDBREAKBEFOREFIRSTPARA fsksuppresshardbreakbeforefirstparaIn, out PTS.FSFMTR fsfmtr, out IntPtr pfsFloatContent, out IntPtr pbrkrecOut, out int durFloaterWidth, out int dvrFloaterHeight, out PTS.FSBBOX fsbbox, out int cPolygons, out int cVertices) { Invariant.Assert(paraClient is UIElementParaClient); Invariant.Assert(base.Element is BlockUIContainer); if (fAtMaxWidth == 0 && fEmptyOk == 1) { durFloaterWidth = (dvrFloaterHeight = 0); cPolygons = (cVertices = 0); fsfmtr = default(PTS.FSFMTR); fsfmtr.kstop = PTS.FSFMTRKSTOP.fmtrNoProgressOutOfSpace; fsfmtr.fContainsItemThatStoppedBeforeFootnote = 0; fsfmtr.fForcedProgress = 0; fsbbox = default(PTS.FSBBOX); fsbbox.fDefined = 0; pbrkrecOut = IntPtr.Zero; pfsFloatContent = IntPtr.Zero; return; } cPolygons = (cVertices = 0); fsfmtr.fForcedProgress = PTS.FromBoolean(fAtMaxWidth == 0); if (((BlockUIContainer)base.Element).Child != null) { this.EnsureUIElementIsland(); this.FormatUIElement(durAvailable, out fsbbox); } else { this.ClearUIElementIsland(); MbpInfo mbpInfo = MbpInfo.FromElement(base.Element, base.StructuralCache.TextFormatterHost.PixelsPerDip); fsbbox.fsrc = default(PTS.FSRECT); fsbbox.fsrc.du = durAvailable; fsbbox.fsrc.dv = mbpInfo.BPTop + mbpInfo.BPBottom; } durFloaterWidth = fsbbox.fsrc.du; dvrFloaterHeight = fsbbox.fsrc.dv; if (dvrAvailable < dvrFloaterHeight && fEmptyOk == 1) { durFloaterWidth = (dvrFloaterHeight = 0); fsfmtr = default(PTS.FSFMTR); fsfmtr.kstop = PTS.FSFMTRKSTOP.fmtrNoProgressOutOfSpace; fsbbox = default(PTS.FSBBOX); fsbbox.fDefined = 0; pfsFloatContent = IntPtr.Zero; } else { fsbbox.fDefined = 1; pfsFloatContent = paraClient.Handle; if (dvrAvailable < dvrFloaterHeight) { Invariant.Assert(fEmptyOk == 0); fsfmtr.fForcedProgress = 1; } fsfmtr.kstop = PTS.FSFMTRKSTOP.fmtrGoalReached; } pbrkrecOut = IntPtr.Zero; fsfmtr.fContainsItemThatStoppedBeforeFootnote = 0; }
protected override void OnArrange() { base.OnArrange(); ((SubpageParagraph)base.Paragraph).UpdateSegmentLastFormatPositions(); PTS.FSSUBPAGEDETAILS fssubpagedetails; PTS.Validate(PTS.FsQuerySubpageDetails(base.PtsContext.Context, this._paraHandle.Value, out fssubpagedetails)); MbpInfo mbpInfo = MbpInfo.FromElement(base.Paragraph.Element, base.Paragraph.StructuralCache.TextFormatterHost.PixelsPerDip); if (base.ThisFlowDirection != base.PageFlowDirection) { mbpInfo.MirrorBP(); } if (!this.IsFirstChunk) { mbpInfo.Border = new Thickness(mbpInfo.Border.Left, 0.0, mbpInfo.Border.Right, mbpInfo.Border.Bottom); mbpInfo.Padding = new Thickness(mbpInfo.Padding.Left, 0.0, mbpInfo.Padding.Right, mbpInfo.Padding.Bottom); } if (!this.IsLastChunk) { mbpInfo.Border = new Thickness(mbpInfo.Border.Left, mbpInfo.Border.Top, mbpInfo.Border.Right, 0.0); mbpInfo.Padding = new Thickness(mbpInfo.Padding.Left, mbpInfo.Padding.Top, mbpInfo.Padding.Right, 0.0); } this._contentRect.u = this._rect.u + mbpInfo.BPLeft; this._contentRect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), this._rect.du - mbpInfo.BPRight - mbpInfo.BPLeft); this._contentRect.v = this._rect.v + mbpInfo.BPTop; this._contentRect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), this._rect.dv - mbpInfo.BPBottom - mbpInfo.BPTop); this._paddingRect.u = this._rect.u + mbpInfo.BorderLeft; this._paddingRect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), this._rect.du - mbpInfo.BorderRight - mbpInfo.BorderLeft); this._paddingRect.v = this._rect.v + mbpInfo.BorderTop; this._paddingRect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), this._rect.dv - mbpInfo.BorderBottom - mbpInfo.BorderTop); if (PTS.ToBoolean(fssubpagedetails.fSimple)) { this._pageContextOfThisPage.PageRect = new PTS.FSRECT(fssubpagedetails.u.simple.trackdescr.fsrc); base.Paragraph.StructuralCache.CurrentArrangeContext.PushNewPageData(this._pageContextOfThisPage, fssubpagedetails.u.simple.trackdescr.fsrc, base.Paragraph.StructuralCache.CurrentArrangeContext.FinitePage); PtsHelper.ArrangeTrack(base.PtsContext, ref fssubpagedetails.u.simple.trackdescr, fssubpagedetails.u.simple.fswdir); base.Paragraph.StructuralCache.CurrentArrangeContext.PopPageData(); return; } this._pageContextOfThisPage.PageRect = new PTS.FSRECT(fssubpagedetails.u.complex.fsrc); if (fssubpagedetails.u.complex.cBasicColumns != 0) { PTS.FSTRACKDESCRIPTION[] array; PtsHelper.TrackListFromSubpage(base.PtsContext, this._paraHandle.Value, ref fssubpagedetails, out array); for (int i = 0; i < array.Length; i++) { base.Paragraph.StructuralCache.CurrentArrangeContext.PushNewPageData(this._pageContextOfThisPage, array[i].fsrc, base.Paragraph.StructuralCache.CurrentArrangeContext.FinitePage); PtsHelper.ArrangeTrack(base.PtsContext, ref array[i], fssubpagedetails.u.complex.fswdir); base.Paragraph.StructuralCache.CurrentArrangeContext.PopPageData(); } } }
// Token: 0x06006B63 RID: 27491 RVA: 0x001F0474 File Offset: 0x001EE674 internal override void GetMCSClientAfterFloater(uint fswdirTrack, MarginCollapsingState mcs, out IntPtr pmcsclientOut) { MbpInfo mbp = MbpInfo.FromElement(base.Element, base.StructuralCache.TextFormatterHost.PixelsPerDip); MarginCollapsingState marginCollapsingState; int num; MarginCollapsingState.CollapseBottomMargin(base.PtsContext, mbp, null, out marginCollapsingState, out num); if (marginCollapsingState != null) { pmcsclientOut = marginCollapsingState.Handle; return; } pmcsclientOut = IntPtr.Zero; }
// Token: 0x060067D8 RID: 26584 RVA: 0x001D20E0 File Offset: 0x001D02E0 internal void ArrangeFigure(PTS.FSRECT rcFigure, PTS.FSRECT rcHostPara, uint fswdirParent, PageContext pageContext) { this._rect = rcFigure; MbpInfo mbpInfo = MbpInfo.FromElement(base.Paragraph.Element, base.Paragraph.StructuralCache.TextFormatterHost.PixelsPerDip); this._rect.v = this._rect.v + mbpInfo.MarginTop; this._rect.dv = this._rect.dv - (mbpInfo.MarginTop + mbpInfo.MarginBottom); this._rect.u = this._rect.u + mbpInfo.MarginLeft; this._rect.du = this._rect.du - (mbpInfo.MarginLeft + mbpInfo.MarginRight); this._pageContext = pageContext; this._flowDirectionParent = PTS.FswdirToFlowDirection(fswdirParent); this._flowDirection = (FlowDirection)base.Paragraph.Element.GetValue(FrameworkElement.FlowDirectionProperty); this.OnArrange(); }
// Token: 0x06006AC8 RID: 27336 RVA: 0x001E9078 File Offset: 0x001E7278 internal override void CollapseMargin(BaseParaClient paraClient, MarginCollapsingState mcs, uint fswdir, bool suppressTopSpace, out int dvr) { if (suppressTopSpace && (base.StructuralCache.CurrentFormatContext.FinitePage || mcs == null)) { dvr = 0; return; } MbpInfo mbp = MbpInfo.FromElement(this.Table, base.StructuralCache.TextFormatterHost.PixelsPerDip); MarginCollapsingState marginCollapsingState = null; MarginCollapsingState.CollapseTopMargin(base.PtsContext, mbp, mcs, out marginCollapsingState, out dvr); if (marginCollapsingState != null) { dvr = marginCollapsingState.Margin; marginCollapsingState.Dispose(); marginCollapsingState = null; } }
protected override void OnArrange() { base.OnArrange(); PTS.FSFLOATERDETAILS fsfloaterdetails; PTS.Validate(PTS.FsQueryFloaterDetails(base.PtsContext.Context, this._paraHandle.Value, out fsfloaterdetails)); this._rect = fsfloaterdetails.fsrcFloater; MbpInfo mbpInfo = MbpInfo.FromElement(base.Paragraph.Element, base.Paragraph.StructuralCache.TextFormatterHost.PixelsPerDip); if (base.ParentFlowDirection != base.PageFlowDirection) { mbpInfo.MirrorMargin(); PTS.FSRECT pageRect = this._pageContext.PageRect; PTS.Validate(PTS.FsTransformRectangle(PTS.FlowDirectionToFswdir(base.ParentFlowDirection), ref pageRect, ref this._rect, PTS.FlowDirectionToFswdir(base.PageFlowDirection), out this._rect)); } this._rect.u = this._rect.u + mbpInfo.MarginLeft; this._rect.du = this._rect.du - (mbpInfo.MarginLeft + mbpInfo.MarginRight); this._rect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), this._rect.du); this._rect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), this._rect.dv); }
// Token: 0x06006B64 RID: 27492 RVA: 0x001F04C4 File Offset: 0x001EE6C4 private void FormatUIElement(int durAvailable, out PTS.FSBBOX fsbbox) { MbpInfo mbpInfo = MbpInfo.FromElement(base.Element, base.StructuralCache.TextFormatterHost.PixelsPerDip); double width = TextDpi.FromTextDpi(Math.Max(1, durAvailable - (mbpInfo.MBPLeft + mbpInfo.MBPRight))); double num; if (this.SizeToFigureParent) { if (base.StructuralCache.CurrentFormatContext.FinitePage) { num = base.StructuralCache.CurrentFormatContext.PageHeight; } else { Figure figure = (Figure)((BlockUIContainer)base.Element).Parent; Invariant.Assert(figure.Height.IsAbsolute); num = figure.Height.Value; } num = Math.Max(TextDpi.FromTextDpi(1), num - TextDpi.FromTextDpi(mbpInfo.MBPTop + mbpInfo.MBPBottom)); this.UIElementIsland.DoLayout(new Size(width, num), false, false); fsbbox.fsrc = default(PTS.FSRECT); fsbbox.fsrc.du = durAvailable; fsbbox.fsrc.dv = TextDpi.ToTextDpi(num) + mbpInfo.BPTop + mbpInfo.BPBottom; fsbbox.fDefined = 1; return; } if (base.StructuralCache.CurrentFormatContext.FinitePage) { Thickness documentPageMargin = base.StructuralCache.CurrentFormatContext.DocumentPageMargin; num = base.StructuralCache.CurrentFormatContext.DocumentPageSize.Height - documentPageMargin.Top - documentPageMargin.Bottom - TextDpi.FromTextDpi(mbpInfo.MBPTop + mbpInfo.MBPBottom); num = Math.Max(TextDpi.FromTextDpi(1), num); } else { num = double.PositiveInfinity; } Size size = this.UIElementIsland.DoLayout(new Size(width, num), false, true); fsbbox.fsrc = default(PTS.FSRECT); fsbbox.fsrc.du = durAvailable; fsbbox.fsrc.dv = TextDpi.ToTextDpi(size.Height) + mbpInfo.BPTop + mbpInfo.BPBottom; fsbbox.fDefined = 1; }
//------------------------------------------------------------------- // GetMCSClientAfterFloater //------------------------------------------------------------------- internal override void GetMCSClientAfterFloater( uint fswdirTrack, // IN: direction of Track MarginCollapsingState mcs, // IN: input margin collapsing state out IntPtr pmcsclientOut) // OUT: MCSCLIENT that floater will return to track { MarginCollapsingState mcsNew; int margin; MbpInfo mbp = MbpInfo.FromElement(Element, StructuralCache.TextFormatterHost.PixelsPerDip); MarginCollapsingState.CollapseBottomMargin(PtsContext, mbp, null, out mcsNew, out margin); if (mcsNew != null) { pmcsclientOut = mcsNew.Handle; } else { pmcsclientOut = IntPtr.Zero; } }
// Token: 0x06006ACC RID: 27340 RVA: 0x001E9198 File Offset: 0x001E7398 internal void GetMCSClientAfterTable(uint fswdirTrack, IntPtr pmcsclientIn, out IntPtr ppmcsclientOut) { ppmcsclientOut = IntPtr.Zero; MbpInfo mbp = MbpInfo.FromElement(this.Table, base.StructuralCache.TextFormatterHost.PixelsPerDip); MarginCollapsingState mcsCurrent = null; if (pmcsclientIn != IntPtr.Zero) { mcsCurrent = (base.PtsContext.HandleToObject(pmcsclientIn) as MarginCollapsingState); } MarginCollapsingState marginCollapsingState = null; int num; MarginCollapsingState.CollapseBottomMargin(base.PtsContext, mbp, mcsCurrent, out marginCollapsingState, out num); if (marginCollapsingState != null) { ppmcsclientOut = marginCollapsingState.Handle; } }
// ------------------------------------------------------------------ // Arrange floater // // rcFloater - rectangle of the floater // rcHostPara - rectangle of the host text paragraph. // ------------------------------------------------------------------ internal override void ArrangeFloater(PTS.FSRECT rcFloater, PTS.FSRECT rcHostPara, uint fswdirParent, PageContext pageContext) { // If alignment is set to Stretch and floater width is less than para width, center it if (IsFloaterHorizontallyCentered(rcFloater, rcHostPara)) { rcFloater.u = rcHostPara.u + (rcHostPara.du - rcFloater.du) / 2; } // Set paragraph rectangle (relative to the page) _rect = rcFloater; // Adjust rect to account for margins // Add margin values to rect offsets and subtract them from rect widths MbpInfo mbp = MbpInfo.FromElement(Paragraph.Element, Paragraph.StructuralCache.TextFormatterHost.PixelsPerDip); _rect.v += mbp.MarginTop; _rect.dv -= mbp.MarginTop + mbp.MarginBottom; _rect.u += mbp.MarginLeft; _rect.du -= mbp.MarginLeft + mbp.MarginRight; _flowDirectionParent = PTS.FswdirToFlowDirection(fswdirParent); _flowDirection = (FlowDirection)Paragraph.Element.GetValue(FrameworkElement.FlowDirectionProperty); _pageContext = pageContext; if (ThisFlowDirection != PageFlowDirection) { mbp.MirrorBP(); } _contentRect.u = _rect.u + mbp.BPLeft; _contentRect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.du - mbp.BPRight - mbp.BPLeft); _contentRect.v = _rect.v + mbp.BPTop; _contentRect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.dv - mbp.BPBottom - mbp.BPTop); _paddingRect.u = _rect.u + mbp.BorderLeft; _paddingRect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.du - mbp.BorderRight - mbp.BorderLeft); _paddingRect.v = _rect.v + mbp.BorderTop; _paddingRect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.dv - mbp.BorderBottom - mbp.BorderTop); // Do paragraph specifc arrange OnArrange(); }
// Token: 0x06006828 RID: 26664 RVA: 0x001D5528 File Offset: 0x001D3728 private void AdjustDurAvailable(double specifiedWidth, ref int durAvailable, out int subpageWidth) { MbpInfo mbpInfo = MbpInfo.FromElement(base.Element, base.StructuralCache.TextFormatterHost.PixelsPerDip); if (double.IsNaN(specifiedWidth)) { subpageWidth = Math.Max(1, durAvailable - (mbpInfo.MBPLeft + mbpInfo.MBPRight)); return; } TextDpi.EnsureValidPageWidth(ref specifiedWidth); int num = TextDpi.ToTextDpi(specifiedWidth); if (num + mbpInfo.MarginRight + mbpInfo.MarginLeft <= durAvailable) { durAvailable = num + mbpInfo.MarginLeft + mbpInfo.MarginRight; subpageWidth = Math.Max(1, num - (mbpInfo.BPLeft + mbpInfo.BPRight)); return; } subpageWidth = Math.Max(1, durAvailable - (mbpInfo.MBPLeft + mbpInfo.MBPRight)); }
/// <summary> /// Validates visual node associated with paragraph. /// </summary> internal override void ValidateVisual(PTS.FSKUPDATE fskupdInherited) { // Obtain all mbd info MbpInfo mbp = MbpInfo.FromElement(Paragraph.Element, Paragraph.StructuralCache.TextFormatterHost.PixelsPerDip); // MIRROR entire element to interface with underlying layout tree. // Border/Padding does not need to be mirrored, as it'll be mirrored with the content. PtsHelper.UpdateMirroringTransform(PageFlowDirection, ThisFlowDirection, _visual, TextDpi.FromTextDpi(2 * _rect.u + _rect.du)); // Add UIElementIsland to visual tree and set appropiate offset. UIElementIsland uiElementIsland = ((UIElementParagraph)Paragraph).UIElementIsland; if (uiElementIsland != null) { if (_visual.Children.Count != 1 || _visual.Children[0] != uiElementIsland) { // Disconnect UIElementIsland from its old parent. Visual currentParent = VisualTreeHelper.GetParent(uiElementIsland) as Visual; if (currentParent != null) { ContainerVisual parent = currentParent as ContainerVisual; Invariant.Assert(parent != null, "Parent should always derives from ContainerVisual."); parent.Children.Remove(uiElementIsland); } _visual.Children.Clear(); _visual.Children.Add(uiElementIsland); } uiElementIsland.Offset = new PTS.FSVECTOR(_rect.u + mbp.BPLeft, _rect.v + mbp.BPTop).FromTextDpi(); } else { _visual.Children.Clear(); } // Draw background and borders. Brush backgroundBrush = (Brush)Paragraph.Element.GetValue(TextElement.BackgroundProperty); _visual.DrawBackgroundAndBorder(backgroundBrush, mbp.BorderBrush, mbp.Border, _rect.FromTextDpi(), IsFirstChunk, IsLastChunk); }
// Token: 0x06006B61 RID: 27489 RVA: 0x001F02F8 File Offset: 0x001EE4F8 internal override void FormatFloaterContentBottomless(FloaterBaseParaClient paraClient, int fSuppressTopSpace, uint fswdir, int fAtMaxWidth, int durAvailable, int dvrAvailable, out PTS.FSFMTRBL fsfmtrbl, out IntPtr pfsFloatContent, out int durFloaterWidth, out int dvrFloaterHeight, out PTS.FSBBOX fsbbox, out int cPolygons, out int cVertices) { Invariant.Assert(paraClient is UIElementParaClient); Invariant.Assert(base.Element is BlockUIContainer); if (fAtMaxWidth == 0) { durFloaterWidth = durAvailable + 1; dvrFloaterHeight = dvrAvailable + 1; cPolygons = (cVertices = 0); fsfmtrbl = PTS.FSFMTRBL.fmtrblInterrupted; fsbbox = default(PTS.FSBBOX); fsbbox.fDefined = 0; pfsFloatContent = IntPtr.Zero; return; } cPolygons = (cVertices = 0); if (((BlockUIContainer)base.Element).Child != null) { this.EnsureUIElementIsland(); this.FormatUIElement(durAvailable, out fsbbox); pfsFloatContent = paraClient.Handle; fsfmtrbl = PTS.FSFMTRBL.fmtrblGoalReached; fsbbox.fDefined = 1; durFloaterWidth = fsbbox.fsrc.du; dvrFloaterHeight = fsbbox.fsrc.dv; return; } this.ClearUIElementIsland(); MbpInfo mbpInfo = MbpInfo.FromElement(base.Element, base.StructuralCache.TextFormatterHost.PixelsPerDip); fsbbox.fsrc = default(PTS.FSRECT); fsbbox.fsrc.du = durAvailable; fsbbox.fsrc.dv = mbpInfo.BPTop + mbpInfo.BPBottom; fsbbox.fDefined = 1; pfsFloatContent = paraClient.Handle; fsfmtrbl = PTS.FSFMTRBL.fmtrblGoalReached; durFloaterWidth = fsbbox.fsrc.du; dvrFloaterHeight = fsbbox.fsrc.dv; }
internal override void ValidateVisual(PTS.FSKUPDATE fskupdInherited) { PTS.FSSUBTRACKDETAILS fssubtrackdetails; PTS.Validate(PTS.FsQuerySubtrackDetails(base.PtsContext.Context, this._paraHandle.Value, out fssubtrackdetails)); MbpInfo mbpInfo = MbpInfo.FromElement(base.Paragraph.Element, base.Paragraph.StructuralCache.TextFormatterHost.PixelsPerDip); if (base.ThisFlowDirection != base.PageFlowDirection) { mbpInfo.MirrorBP(); } Brush backgroundBrush = (Brush)base.Paragraph.Element.GetValue(TextElement.BackgroundProperty); this._visual.DrawBackgroundAndBorder(backgroundBrush, mbpInfo.BorderBrush, mbpInfo.Border, this._rect.FromTextDpi(), this.IsFirstChunk, this.IsLastChunk); if (fssubtrackdetails.cParas != 0) { PTS.FSPARADESCRIPTION[] arrayParaDesc; PtsHelper.ParaListFromSubtrack(base.PtsContext, this._paraHandle.Value, ref fssubtrackdetails, out arrayParaDesc); PtsHelper.UpdateParaListVisuals(base.PtsContext, this._visual.Children, fskupdInherited, arrayParaDesc); return; } this._visual.Children.Clear(); }
/// <summary> /// GetMCSClientAfterTable /// </summary> /// <param name="fswdirTrack">Direction of Track</param> /// <param name="pmcsclientIn">Margin collapsing state</param> /// <param name="ppmcsclientOut">Margin collapsing state</param> internal void GetMCSClientAfterTable( uint fswdirTrack, IntPtr pmcsclientIn, out IntPtr ppmcsclientOut) { ppmcsclientOut = IntPtr.Zero; MbpInfo mbp = MbpInfo.FromElement(Table, StructuralCache.TextFormatterHost.PixelsPerDip); MarginCollapsingState mcs = null; if (pmcsclientIn != IntPtr.Zero) { mcs = PtsContext.HandleToObject(pmcsclientIn) as MarginCollapsingState; } MarginCollapsingState mcsNew = null; int margin; MarginCollapsingState.CollapseBottomMargin(PtsContext, mbp, mcs, out mcsNew, out margin); if (mcsNew != null) { ppmcsclientOut = mcsNew.Handle; } }
// ------------------------------------------------------------------ // Arrange figure // // rcFigure - rectangle of the figure // rcHostPara - rectangle of the host text paragraph. // ------------------------------------------------------------------ internal void ArrangeFigure(PTS.FSRECT rcFigure, PTS.FSRECT rcHostPara, uint fswdirParent, PageContext pageContext) { // Set paragraph rectangle (relative to the page) _rect = rcFigure; // Adjust rect to account for margins // Add margin values to rect offsets and subtract them from rect widths MbpInfo mbp = MbpInfo.FromElement(Paragraph.Element); _rect.v += mbp.MarginTop; _rect.dv -= mbp.MarginTop + mbp.MarginBottom; _rect.u += mbp.MarginLeft; _rect.du -= mbp.MarginLeft + mbp.MarginRight; _pageContext = pageContext; // Cache flow directions _flowDirectionParent = PTS.FswdirToFlowDirection(fswdirParent); _flowDirection = (FlowDirection)Paragraph.Element.GetValue(FrameworkElement.FlowDirectionProperty); // Do paragraph specifc arrange OnArrange(); }
// Token: 0x06006A20 RID: 27168 RVA: 0x001E3634 File Offset: 0x001E1834 internal void GetRowProperties(uint fswdirTable, out PTS.FSTABLEROWPROPS rowprops) { bool flag = this.Row.Index == this.Row.RowGroup.Rows.Count - 1; PTS.FSKROWHEIGHTRESTRICTION fskrowheight; int num; this.GetRowHeight(out fskrowheight, out num); rowprops = default(PTS.FSTABLEROWPROPS); rowprops.fskrowbreak = PTS.FSKROWBREAKRESTRICTION.fskrowbreakAnywhere; rowprops.fskrowheight = fskrowheight; rowprops.dvrRowHeightRestriction = 0; rowprops.dvrAboveRow = num; rowprops.dvrBelowRow = num; int num2 = TextDpi.ToTextDpi(this.Table.InternalCellSpacing); MbpInfo mbpInfo = MbpInfo.FromElement(this.Table, base.StructuralCache.TextFormatterHost.PixelsPerDip); if (this.Row.Index == 0 && this.Table.IsFirstNonEmptyRowGroup(this.Row.RowGroup.Index)) { rowprops.dvrAboveTopRow = mbpInfo.BPTop + num2 / 2; } else { rowprops.dvrAboveTopRow = num; } if (flag && this.Table.IsLastNonEmptyRowGroup(this.Row.RowGroup.Index)) { rowprops.dvrBelowBottomRow = mbpInfo.BPBottom + num2 / 2; } else { rowprops.dvrBelowBottomRow = num; } rowprops.dvrAboveRowBreak = num2 / 2; rowprops.dvrBelowRowBreak = num2 / 2; rowprops.cCells = this.Row.FormatCellCount; }
// Token: 0x06006B5E RID: 27486 RVA: 0x001F0080 File Offset: 0x001EE280 internal override void CollapseMargin(BaseParaClient paraClient, MarginCollapsingState mcs, uint fswdir, bool suppressTopSpace, out int dvr) { MbpInfo mbp = MbpInfo.FromElement(base.Element, base.StructuralCache.TextFormatterHost.PixelsPerDip); MarginCollapsingState marginCollapsingState; int num; MarginCollapsingState.CollapseTopMargin(base.PtsContext, mbp, mcs, out marginCollapsingState, out num); if (suppressTopSpace) { dvr = 0; } else { dvr = num; if (marginCollapsingState != null) { dvr += marginCollapsingState.Margin; } } if (marginCollapsingState != null) { marginCollapsingState.Dispose(); } }
protected override void OnArrange() { base.OnArrange(); PTS.FSSUBTRACKDETAILS fssubtrackdetails; PTS.Validate(PTS.FsQuerySubtrackDetails(base.PtsContext.Context, this._paraHandle.Value, out fssubtrackdetails)); MbpInfo mbpInfo = MbpInfo.FromElement(base.Paragraph.Element, base.Paragraph.StructuralCache.TextFormatterHost.PixelsPerDip); if (base.ParentFlowDirection != base.PageFlowDirection) { mbpInfo.MirrorMargin(); } this._rect.u = this._rect.u + mbpInfo.MarginLeft; this._rect.du = this._rect.du - (mbpInfo.MarginLeft + mbpInfo.MarginRight); this._rect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), this._rect.du); this._rect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), this._rect.dv); uint fswdirTrack = PTS.FlowDirectionToFswdir(this._flowDirection); if (fssubtrackdetails.cParas != 0) { PTS.FSPARADESCRIPTION[] arrayParaDesc; PtsHelper.ParaListFromSubtrack(base.PtsContext, this._paraHandle.Value, ref fssubtrackdetails, out arrayParaDesc); PtsHelper.ArrangeParaList(base.PtsContext, fssubtrackdetails.fsrc, arrayParaDesc, fswdirTrack); } }
internal override void FormatFloaterContentBottomless( FloaterBaseParaClient paraClient, // IN: int fSuppressTopSpace, // IN: suppress empty space at the top of the page uint fswdir, // IN: direction of track int fAtMaxWidth, // IN: formating is at full width of column int durAvailable, // IN: width of available space int dvrAvailable, // IN: height of available space out PTS.FSFMTRBL fsfmtrbl, // OUT: result of formatting out IntPtr pfsFloatContent, // OUT: opaque for PTS pointer pointer to formatted content out int durFloaterWidth, // OUT: floater width out int dvrFloaterHeight, // OUT: floater height out PTS.FSBBOX fsbbox, // OUT: floater bbox out int cPolygons, // OUT: number of polygons out int cVertices) // OUT: total number of vertices in all polygons { uint fswdirPara = PTS.FlowDirectionToFswdir(((FlowDirection)Element.GetValue(FrameworkElement.FlowDirectionProperty))); Invariant.Assert(paraClient is FloaterParaClient); int subpageWidth, urSubpageMargin, durSubpageMargin, vrSubpageMargin; int dvrTopSpace, fPageBecomesUninterruptable; int cColumns; PTS.FSCOLUMNINFO[] columnInfoCollection; IntPtr pmcsclientOut; MbpInfo mbp; double specifiedWidth; // If horizontal alignment is Stretch and we are not formatting at max width, // we cannot proceed. if (IsFloaterRejected(PTS.ToBoolean(fAtMaxWidth), TextDpi.FromTextDpi(durAvailable))) { // Set foater width, height to be greater than available values to signal to PTS that floater does not fit in the space durFloaterWidth = durAvailable + 1; dvrFloaterHeight = dvrAvailable + 1; cPolygons = cVertices = 0; fsfmtrbl = PTS.FSFMTRBL.fmtrblInterrupted; fsbbox = new PTS.FSBBOX(); fsbbox.fDefined = PTS.False; pfsFloatContent = IntPtr.Zero; } else { // Initialize the subpage size. PTS subpage margin is always set to 0 for Floaters. // If width on floater is specified, use the specified value. // Margin, border and padding of the floater is extracted from available subpage width. mbp = MbpInfo.FromElement(Element, StructuralCache.TextFormatterHost.PixelsPerDip); specifiedWidth = CalculateWidth(TextDpi.FromTextDpi(durAvailable)); AdjustDurAvailable(specifiedWidth, ref durAvailable, out subpageWidth); durSubpageMargin = subpageWidth; urSubpageMargin = vrSubpageMargin = 0; // Initialize column info. Floater always has just 1 column. cColumns = 1; columnInfoCollection = new PTS.FSCOLUMNINFO[cColumns]; columnInfoCollection[0].durBefore = 0; columnInfoCollection[0].durWidth = subpageWidth; // Create subpage InvalidateMainTextSegment(); CreateSubpageBottomlessHelper(PtsContext, _mainTextSegment.Handle, PTS.True, fswdir, subpageWidth, urSubpageMargin, durSubpageMargin, vrSubpageMargin, cColumns, columnInfoCollection, out fsfmtrbl, out pfsFloatContent, out dvrFloaterHeight, out fsbbox, out pmcsclientOut, out dvrTopSpace, out fPageBecomesUninterruptable); if (fsfmtrbl != PTS.FSFMTRBL.fmtrblCollision) { // PTS subpage does not support autosizing, but Floater needs to autosize to its // content. To workaround this problem, second format of subpage is performed, if // necessary. It means that if the width of bounding box is smaller than subpage's // width, second formatting is performed. // However, if HorizontalAlignment is set to Stretch we should not reformat because // floater should be at full column width if (PTS.ToBoolean(fsbbox.fDefined)) { if (fsbbox.fsrc.du < subpageWidth && Double.IsNaN(specifiedWidth) && HorizontalAlignment != HorizontalAlignment.Stretch) { // There is a need to reformat PTS subpage, so destroy any resourcces allocated by PTS // during previous formatting. if (pfsFloatContent != IntPtr.Zero) { PTS.Validate(PTS.FsDestroySubpage(PtsContext.Context, pfsFloatContent), PtsContext); } if (pmcsclientOut != IntPtr.Zero) { MarginCollapsingState mcs = PtsContext.HandleToObject(pmcsclientOut) as MarginCollapsingState; PTS.ValidateHandle(mcs); mcs.Dispose(); pmcsclientOut = IntPtr.Zero; } // Create subpage with new width. subpageWidth = durSubpageMargin = fsbbox.fsrc.du + 1; // add 1/300px to avoid rounding errors columnInfoCollection[0].durWidth = subpageWidth; CreateSubpageBottomlessHelper(PtsContext, _mainTextSegment.Handle, PTS.True, fswdir, subpageWidth, urSubpageMargin, durSubpageMargin, vrSubpageMargin, cColumns, columnInfoCollection, out fsfmtrbl, out pfsFloatContent, out dvrFloaterHeight, out fsbbox, out pmcsclientOut, out dvrTopSpace, out fPageBecomesUninterruptable); } } else { subpageWidth = TextDpi.ToTextDpi(TextDpi.MinWidth); } // Destroy objects created by PTS, but not used here. if (pmcsclientOut != IntPtr.Zero) { MarginCollapsingState mcs = PtsContext.HandleToObject(pmcsclientOut) as MarginCollapsingState; PTS.ValidateHandle(mcs); mcs.Dispose(); pmcsclientOut = IntPtr.Zero; } // Get the size of the floater. For height PTS already reports calculated value. // But width is the same as subpage width. durFloaterWidth = subpageWidth + mbp.MBPLeft + mbp.MBPRight; dvrFloaterHeight += mbp.MBPTop + mbp.MBPBottom; // Check if floater width fits in available width. It may exceed available width because borders // and padding are added. if (dvrFloaterHeight > dvrAvailable || (durFloaterWidth > durAvailable && !PTS.ToBoolean(fAtMaxWidth)) ) { // Get rid of any previous formatting if (pfsFloatContent != IntPtr.Zero) { PTS.Validate(PTS.FsDestroySubpage(PtsContext.Context, pfsFloatContent), PtsContext); } Debug.Assert(pmcsclientOut == IntPtr.Zero); cPolygons = cVertices = 0; pfsFloatContent = IntPtr.Zero; } else { // Width and height are OK, format floater // Adjust bounding box to cover entire floater. fsbbox.fsrc.u = 0; fsbbox.fsrc.v = 0; fsbbox.fsrc.du = durFloaterWidth; fsbbox.fsrc.dv = dvrFloaterHeight; // Tight wrap is disabled for now. cPolygons = cVertices = 0; } } else { Debug.Assert(pmcsclientOut == IntPtr.Zero); durFloaterWidth = dvrFloaterHeight = 0; cPolygons = cVertices = 0; pfsFloatContent = IntPtr.Zero; } } // Update handle to PTS subpage. ((FloaterParaClient)paraClient).SubpageHandle = pfsFloatContent; }