// 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();
        }
        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);
            }
        }
Ejemplo n.º 3
0
        // Token: 0x06006B26 RID: 27430 RVA: 0x001EEDF4 File Offset: 0x001ECFF4
        internal bool InterruptFormatting(int dcpCur, int vrCur)
        {
            BackgroundFormatInfo backgroundFormatInfo = base.StructuralCache.BackgroundFormatInfo;

            if (!BackgroundFormatInfo.IsBackgroundFormatEnabled)
            {
                return(false);
            }
            if (base.StructuralCache.CurrentFormatContext.FinitePage)
            {
                return(false);
            }
            if (vrCur < TextDpi.ToTextDpi(double.IsPositiveInfinity(backgroundFormatInfo.ViewportHeight) ? 500.0 : backgroundFormatInfo.ViewportHeight))
            {
                return(false);
            }
            if (backgroundFormatInfo.BackgroundFormatStopTime > DateTime.UtcNow)
            {
                return(false);
            }
            if (!backgroundFormatInfo.DoesFinalDTRCoverRestOfText)
            {
                return(false);
            }
            if (dcpCur + base.ParagraphStartCharacterPosition <= backgroundFormatInfo.LastCPUninterruptible)
            {
                return(false);
            }
            base.StructuralCache.BackgroundFormatInfo.CPInterrupted = dcpCur + base.ParagraphStartCharacterPosition;
            return(true);
        }
Ejemplo n.º 4
0
        internal void FormatCellFinite(Size subpageSize, IntPtr breakRecordIn, bool isEmptyOk, uint fswdir, PTS.FSKSUPPRESSHARDBREAKBEFOREFIRSTPARA fsksuppresshardbreakbeforefirstparaIn, out PTS.FSFMTR fsfmtr, out int dvrUsed, out IntPtr breakRecordOut)
        {
            if (this.CellParagraph.StructuralCache.DtrList != null)
            {
                this.CellParagraph.InvalidateStructure(TextContainerHelper.GetCPFromElement(this.CellParagraph.StructuralCache.TextContainer, this.CellParagraph.Element, ElementEdge.BeforeStart));
            }
            PTS.FSPAP fspap = default(PTS.FSPAP);
            this.CellParagraph.GetParaProperties(ref fspap);
            PTS.FSRECT fsrect = default(PTS.FSRECT);
            fsrect.u  = (fsrect.v = 0);
            fsrect.du = TextDpi.ToTextDpi(subpageSize.Width);
            fsrect.dv = TextDpi.ToTextDpi(subpageSize.Height);
            bool   condition = breakRecordIn != IntPtr.Zero;
            IntPtr value;

            PTS.FSBBOX fsbbox;
            IntPtr     zero;

            PTS.FSKCLEAR fskclear;
            int          num;

            this.CellParagraph.FormatParaFinite(this, breakRecordIn, PTS.FromBoolean(true), IntPtr.Zero, PTS.FromBoolean(isEmptyOk), PTS.FromBoolean(condition), fswdir, ref fsrect, null, PTS.FSKCLEAR.fskclearNone, fsksuppresshardbreakbeforefirstparaIn, out fsfmtr, out value, out breakRecordOut, out dvrUsed, out fsbbox, out zero, out fskclear, out num);
            if (zero != IntPtr.Zero)
            {
                MarginCollapsingState marginCollapsingState = base.PtsContext.HandleToObject(zero) as MarginCollapsingState;
                PTS.ValidateHandle(marginCollapsingState);
                dvrUsed += marginCollapsingState.Margin;
                marginCollapsingState.Dispose();
                zero = IntPtr.Zero;
            }
            this._paraHandle.Value = value;
        }
Ejemplo n.º 5
0
        /// <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;
        }
Ejemplo n.º 6
0
        internal void Arrange(int du, int dv, PTS.FSRECT rcTable, FlowDirection tableFlowDirection, PageContext pageContext)
        {
            CalculatedColumn[] calculatedColumns   = this._tableParaClient.CalculatedColumns;
            double             internalCellSpacing = this.Table.InternalCellSpacing;
            double             num = -internalCellSpacing;
            int num2 = this.Cell.ColumnIndex + this.Cell.ColumnSpan - 1;

            do
            {
                num += calculatedColumns[num2].DurWidth + internalCellSpacing;
            }while (--num2 >= this.ColumnIndex);
            if (tableFlowDirection != base.PageFlowDirection)
            {
                PTS.FSRECT pageRect = pageContext.PageRect;
                PTS.Validate(PTS.FsTransformRectangle(PTS.FlowDirectionToFswdir(base.PageFlowDirection), ref pageRect, ref rcTable, PTS.FlowDirectionToFswdir(tableFlowDirection), out rcTable));
            }
            this._rect.u  = du + rcTable.u;
            this._rect.v  = dv + rcTable.v;
            this._rect.du = TextDpi.ToTextDpi(num);
            this._rect.dv = TextDpi.ToTextDpi(this._arrangeHeight);
            if (tableFlowDirection != base.PageFlowDirection)
            {
                PTS.FSRECT pageRect2 = pageContext.PageRect;
                PTS.Validate(PTS.FsTransformRectangle(PTS.FlowDirectionToFswdir(tableFlowDirection), ref pageRect2, ref this._rect, PTS.FlowDirectionToFswdir(base.PageFlowDirection), out this._rect));
            }
            this._flowDirectionParent = tableFlowDirection;
            this._flowDirection       = (FlowDirection)base.Paragraph.Element.GetValue(FrameworkElement.FlowDirectionProperty);
            this._pageContext         = pageContext;
            this.OnArrange();
            if (this._paraHandle.Value != IntPtr.Zero)
            {
                PTS.Validate(PTS.FsClearUpdateInfoInSubpage(base.PtsContext.Context, this._paraHandle.Value), base.PtsContext);
            }
        }
Ejemplo n.º 7
0
        // ------------------------------------------------------------------
        // GetPageDimensions
        // ------------------------------------------------------------------

        /// <summary>
        /// Get page dimensions
        /// </summary>
        /// <param name="fswdir">
        /// OUT: direction of main text
        /// </param>
        /// <param name="fHeaderFooterAtTopBottom">
        /// OUT: header/footer position on the page
        /// </param>
        /// <param name="durPage">
        /// OUT: page width
        /// </param>
        /// <param name="dvrPage">
        /// OUT: page height
        /// </param>
        /// <param name="fsrcMargin">
        /// OUT: rectangle within page margins
        /// </param>
        internal void GetPageDimensions(
            out uint fswdir,
            out int fHeaderFooterAtTopBottom,
            out int durPage,
            out int dvrPage,
            ref PTS.FSRECT fsrcMargin)
        {
            // Set page dimentions
            Size pageSize = _structuralCache.CurrentFormatContext.PageSize;

            durPage = TextDpi.ToTextDpi(pageSize.Width);
            dvrPage = TextDpi.ToTextDpi(pageSize.Height);

            // Set page margin
            Thickness pageMargin = _structuralCache.CurrentFormatContext.PageMargin;

            TextDpi.EnsureValidPageMargin(ref pageMargin, pageSize);
            fsrcMargin.u  = TextDpi.ToTextDpi(pageMargin.Left);
            fsrcMargin.v  = TextDpi.ToTextDpi(pageMargin.Top);
            fsrcMargin.du = durPage - TextDpi.ToTextDpi(pageMargin.Left + pageMargin.Right);
            fsrcMargin.dv = dvrPage - TextDpi.ToTextDpi(pageMargin.Top + pageMargin.Bottom);

            StructuralCache.PageFlowDirection = (FlowDirection)_structuralCache.PropertyOwner.GetValue(FrameworkElement.FlowDirectionProperty);
            fswdir = PTS.FlowDirectionToFswdir(StructuralCache.PageFlowDirection);

            //

            fHeaderFooterAtTopBottom = PTS.False;
        }
Ejemplo n.º 8
0
        //-------------------------------------------------------------------
        //
        //  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));
            }
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
        //-------------------------------------------------------------------
        //
        // 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;
            }
        }
Ejemplo n.º 11
0
        // Token: 0x06006862 RID: 26722 RVA: 0x001D6B08 File Offset: 0x001D4D08
        internal void GetDurFigureAnchor(FigureParagraph paraFigure, uint fswdir, out int dur)
        {
            int    cpfromElement            = TextContainerHelper.GetCPFromElement(this._paraClient.Paragraph.StructuralCache.TextContainer, paraFigure.Element, ElementEdge.BeforeStart);
            int    firstCharacterIndex      = cpfromElement - this._cpPara;
            double distanceFromCharacterHit = this._line.GetDistanceFromCharacterHit(new CharacterHit(firstCharacterIndex, 0));

            dur = TextDpi.ToTextDpi(distanceFromCharacterHit);
        }
Ejemplo n.º 12
0
        // Token: 0x06006B33 RID: 27443 RVA: 0x001EF62C File Offset: 0x001ED82C
        internal void CalcLineAscentDescent(int dcp, ref int dvrAscent, ref int dvrDescent)
        {
            this.EnsureLineProperties();
            int num  = dvrAscent + dvrDescent;
            int num2 = TextDpi.ToTextDpi(this._lineProperties.CalcLineAdvanceForTextParagraph(this, dcp, TextDpi.FromTextDpi(num)));

            if (num != num2)
            {
                double num3 = 1.0 * (double)num2 / (1.0 * (double)num);
                dvrAscent  = (int)((double)dvrAscent * num3);
                dvrDescent = (int)((double)dvrDescent * num3);
            }
        }
        // Token: 0x06006A25 RID: 27173 RVA: 0x001E3A68 File Offset: 0x001E1C68
        internal void GetRowHeight(out PTS.FSKROWHEIGHTRESTRICTION fskrowheight, out int dvrAboveBelow)
        {
            bool flag = this.Row.Index == this.Row.RowGroup.Rows.Count - 1;

            if (this.Row.HasRealCells || (flag && this._spannedCells.Length != 0))
            {
                fskrowheight  = PTS.FSKROWHEIGHTRESTRICTION.fskrowheightNatural;
                dvrAboveBelow = TextDpi.ToTextDpi(this.Table.InternalCellSpacing / 2.0);
                return;
            }
            fskrowheight  = PTS.FSKROWHEIGHTRESTRICTION.fskrowheightExactNoBreak;
            dvrAboveBelow = 0;
        }
Ejemplo n.º 14
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();
                }
            }
        }
        // ------------------------------------------------------------------
        // Determines what offset is required to convert a paragraph aligned figure into a column aligned figure.
        // ------------------------------------------------------------------
        private int CalculateParagraphToColumnOffset(FigureHorizontalAnchor horizontalAnchor, PTS.FSRECT fsrcInColumn)
        {
            Invariant.Assert(FigureHelper.IsHorizontalColumnAnchor(horizontalAnchor));

            int uComparisonPoint;

            // Depending on anchoring, only the anchored edge (center) is guaranteed to be inside of the column, so finding affected column
            // requires us to compare against the anchored edge U position.
            if (horizontalAnchor == FigureHorizontalAnchor.ColumnLeft)
            {
                uComparisonPoint = fsrcInColumn.u;
            }
            else if (horizontalAnchor == FigureHorizontalAnchor.ColumnRight)
            {
                uComparisonPoint = fsrcInColumn.u + fsrcInColumn.du - 1; // du is non-inclusive
            }
            else
            {
                uComparisonPoint = fsrcInColumn.u + (fsrcInColumn.du / 2) - 1; // du is non-inclusive
            }


            double columnWidth, gap, rule;
            int    cColumns;

            FigureHelper.GetColumnMetrics(StructuralCache, out cColumns, out columnWidth, out gap, out rule);

            Invariant.Assert(cColumns > 0);

            int duColumnTotal  = TextDpi.ToTextDpi(columnWidth + gap);
            int affectedColumn = (uComparisonPoint - StructuralCache.CurrentFormatContext.PageMarginRect.u) / duColumnTotal;
            int columnLeft     = StructuralCache.CurrentFormatContext.PageMarginRect.u + affectedColumn * duColumnTotal;
            int columnDU       = TextDpi.ToTextDpi(columnWidth);

            int totalMarginLeft  = columnLeft - fsrcInColumn.u;
            int totalMarginRight = (columnLeft + columnDU) - (fsrcInColumn.u + fsrcInColumn.du);

            if (horizontalAnchor == FigureHorizontalAnchor.ColumnLeft)
            {
                return(totalMarginLeft);
            }
            else if (horizontalAnchor == FigureHorizontalAnchor.ColumnRight)
            {
                return(totalMarginRight);
            }
            else
            {
                return((totalMarginRight + totalMarginLeft) / 2);
            }
        }
        //------------------------------------------------------
        //
        //  Public Methods
        //
        //------------------------------------------------------

        #region Public Methods

        #endregion Public Methods

        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------

        #region Internal Methods

        /// <summary>
        /// Arrange.
        /// </summary>
        /// <param name="du">U offset component of the cell's visual.</param>
        /// <param name="dv">V offset component of the cell's visual.</param>
        /// <param name="rcTable">Table's rectangle.. (in page flow dir)</param>
        /// <param name="tableFlowDirection">Table's flow direction</param>
        /// <param name="pageContext">Page context</param>
        internal void Arrange(int du, int dv, PTS.FSRECT rcTable, FlowDirection tableFlowDirection, PageContext pageContext)
        {
            //
            // Determine cell width based on column widths.
            //
            CalculatedColumn[] calculatedColumns = _tableParaClient.CalculatedColumns;
            Debug.Assert(calculatedColumns != null &&
                         (Cell.ColumnIndex + Cell.ColumnSpan) <= calculatedColumns.Length);

            double durCellSpacing = Table.InternalCellSpacing;
            double durCellWidth   = -durCellSpacing;

            // find the width sum of all columns the cell spans
            int i = Cell.ColumnIndex + Cell.ColumnSpan - 1;

            do
            {
                durCellWidth += calculatedColumns[i].DurWidth + durCellSpacing;
            } while (--i >= ColumnIndex);

            if (tableFlowDirection != PageFlowDirection)
            {
                PTS.FSRECT pageRect = pageContext.PageRect;

                PTS.Validate(PTS.FsTransformRectangle(PTS.FlowDirectionToFswdir(PageFlowDirection), ref pageRect, ref rcTable, PTS.FlowDirectionToFswdir(tableFlowDirection), out rcTable));
            }

            _rect.u  = du + rcTable.u;
            _rect.v  = dv + rcTable.v;
            _rect.du = TextDpi.ToTextDpi(durCellWidth);
            _rect.dv = TextDpi.ToTextDpi(_arrangeHeight);

            if (tableFlowDirection != PageFlowDirection)
            {
                PTS.FSRECT pageRect = pageContext.PageRect;

                PTS.Validate(PTS.FsTransformRectangle(PTS.FlowDirectionToFswdir(tableFlowDirection), ref pageRect, ref _rect, PTS.FlowDirectionToFswdir(PageFlowDirection), out _rect));
            }

            _flowDirectionParent = tableFlowDirection;
            _flowDirection       = (FlowDirection)Paragraph.Element.GetValue(FrameworkElement.FlowDirectionProperty);
            _pageContext         = pageContext;

            OnArrange();

            if (_paraHandle.Value != IntPtr.Zero)
            {
                PTS.Validate(PTS.FsClearUpdateInfoInSubpage(PtsContext.Context, _paraHandle.Value), PtsContext);
            }
        }
 internal unsafe void CalcHorizontalBBoxOfRow(int cCells, IntPtr *rgnmCell, IntPtr *rgpfsCell, out int urBBox, out int durBBox)
 {
     urBBox  = 0;
     durBBox = 0;
     for (int i = 0; i < cCells; i++)
     {
         if (rgpfsCell[(IntPtr)i * (IntPtr)sizeof(IntPtr) / (IntPtr)sizeof(IntPtr)] != IntPtr.Zero)
         {
             CellParaClient cellParaClient = base.PtsContext.HandleToObject(rgpfsCell[(IntPtr)i * (IntPtr)sizeof(IntPtr) / (IntPtr)sizeof(IntPtr)]) as CellParaClient;
             PTS.ValidateHandle(cellParaClient);
             durBBox = TextDpi.ToTextDpi(cellParaClient.TableParaClient.TableDesiredWidth);
             return;
         }
     }
 }
        // Token: 0x060067ED RID: 26605 RVA: 0x001D3304 File Offset: 0x001D1504
        internal void CalcFigurePosition(FigureParaClient paraClient, uint fswdir, ref PTS.FSRECT fsrcPage, ref PTS.FSRECT fsrcMargin, ref PTS.FSRECT fsrcTrack, ref PTS.FSRECT fsrcFigurePreliminary, int fMustPosition, int fInTextLine, out int fPushToNextTrack, out PTS.FSRECT fsrcFlow, out PTS.FSRECT fsrcOverlap, out PTS.FSBBOX fsbbox, out PTS.FSRECT fsrcSearch)
        {
            Figure figure = (Figure)base.Element;
            FigureHorizontalAnchor horizontalAnchor = figure.HorizontalAnchor;
            FigureVerticalAnchor   verticalAnchor   = figure.VerticalAnchor;

            fsrcSearch = this.CalculateSearchArea(horizontalAnchor, verticalAnchor, ref fsrcPage, ref fsrcMargin, ref fsrcTrack, ref fsrcFigurePreliminary);
            if (verticalAnchor == FigureVerticalAnchor.ParagraphTop && fsrcFigurePreliminary.v != fsrcMargin.v && fsrcFigurePreliminary.v + fsrcFigurePreliminary.dv > fsrcTrack.v + fsrcTrack.dv && !PTS.ToBoolean(fMustPosition))
            {
                fPushToNextTrack = 1;
            }
            else
            {
                fPushToNextTrack = 0;
            }
            fsrcFlow = fsrcFigurePreliminary;
            if (FigureHelper.IsHorizontalColumnAnchor(horizontalAnchor))
            {
                fsrcFlow.u += this.CalculateParagraphToColumnOffset(horizontalAnchor, fsrcFigurePreliminary);
            }
            fsrcFlow.u += TextDpi.ToTextDpi(figure.HorizontalOffset);
            fsrcFlow.v += TextDpi.ToTextDpi(figure.VerticalOffset);
            fsrcOverlap = fsrcFlow;
            if (!FigureHelper.IsHorizontalPageAnchor(horizontalAnchor) && horizontalAnchor != FigureHorizontalAnchor.ColumnCenter && horizontalAnchor != FigureHorizontalAnchor.ContentCenter)
            {
                int    num;
                double d;
                double d2;
                double num2;
                FigureHelper.GetColumnMetrics(base.StructuralCache, out num, out d, out d2, out num2);
                int num3 = TextDpi.ToTextDpi(d);
                int num4 = TextDpi.ToTextDpi(d2);
                int num5 = num3 + num4;
                int num6 = fsrcOverlap.du / num5;
                int du   = (num6 + 1) * num5 - num4;
                fsrcOverlap.du = du;
                if (horizontalAnchor == FigureHorizontalAnchor.ContentRight || horizontalAnchor == FigureHorizontalAnchor.ColumnRight)
                {
                    fsrcOverlap.u = fsrcFlow.u + fsrcFlow.du + num4 - fsrcOverlap.du;
                }
                fsrcSearch.u  = fsrcOverlap.u;
                fsrcSearch.du = fsrcOverlap.du;
            }
            fsbbox          = default(PTS.FSBBOX);
            fsbbox.fDefined = 1;
            fsbbox.fsrc     = fsrcFlow;
        }
        /// <summary>
        /// FormatCellBottomless
        /// </summary>
        /// <param name="fswdir">Text Direction</param>
        /// <param name="width">Width of cell (height is specified by row props)</param>
        /// <param name="fmtrbl">bottomless format result</param>
        /// <param name="dvrUsed">dvr Used</param>
        internal void FormatCellBottomless(uint fswdir, double width, out PTS.FSFMTRBL fmtrbl, out int dvrUsed)
        {
            IntPtr pfspara;

            PTS.FSBBOX fsbbox;
            IntPtr     pmcsclientOut;

            PTS.FSKCLEAR fskclearOut;
            int          dvrTopSpace;
            int          fPageBecomesUninterruptable;

            PTS.FSPAP fspap;


            if (CellParagraph.StructuralCache.DtrList != null)
            {
                CellParagraph.InvalidateStructure(TextContainerHelper.GetCPFromElement(CellParagraph.StructuralCache.TextContainer, CellParagraph.Element, ElementEdge.BeforeStart));
            }

            fspap = new PTS.FSPAP();
            CellParagraph.GetParaProperties(ref fspap);

            CellParagraph.FormatParaBottomless(this, PTS.FromBoolean(false),
                                               fswdir, 0, TextDpi.ToTextDpi(width),
                                               0, null, PTS.FSKCLEAR.fskclearNone,
                                               PTS.FromBoolean(true),
                                               out fmtrbl,
                                               out pfspara,
                                               out dvrUsed,
                                               out fsbbox,
                                               out pmcsclientOut,
                                               out fskclearOut,
                                               out dvrTopSpace,
                                               out fPageBecomesUninterruptable);

            if (pmcsclientOut != IntPtr.Zero)
            {
                MarginCollapsingState mcs = PtsContext.HandleToObject(pmcsclientOut) as MarginCollapsingState;
                PTS.ValidateHandle(mcs);
                dvrUsed += mcs.Margin;
                mcs.Dispose();
                pmcsclientOut = IntPtr.Zero;
            }

            _paraHandle.Value = pfspara;
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Returns row height for this row, depending on cell content (Real/Foreign/Etc)
        /// </summary>
        internal void GetRowHeight(out PTS.FSKROWHEIGHTRESTRICTION fskrowheight, out int dvrAboveBelow)
        {
            bool isLastRowOfRowGroup = (Row.Index == Row.RowGroup.Rows.Count - 1);

            if (Row.HasRealCells ||
                (isLastRowOfRowGroup && _spannedCells.Length > 0))
            {
                // Use current format context's page height to limit vertical cell spacing
                fskrowheight  = PTS.FSKROWHEIGHTRESTRICTION.fskrowheightNatural;
                dvrAboveBelow = TextDpi.ToTextDpi(Table.InternalCellSpacing / 2.0);
            }
            else
            {
                fskrowheight  = PTS.FSKROWHEIGHTRESTRICTION.fskrowheightExactNoBreak;
                dvrAboveBelow = 0;
            }
        }
        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;
        }
Ejemplo n.º 23
0
        // ------------------------------------------------------------------
        // 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();
        }
Ejemplo n.º 24
0
        internal unsafe static void GetColumnsInfo(ColumnPropertiesGroup columnProperties, double lineHeight, double pageWidth, double pageFontSize, FontFamily pageFontFamily, int cColumns, PTS.FSCOLUMNINFO *pfscolinfo, bool enableColumns)
        {
            double columnRuleWidth = columnProperties.ColumnRuleWidth;
            double num;
            double num2;
            double num3;

            PtsHelper.GetColumnMetrics(columnProperties, pageWidth, pageFontSize, pageFontFamily, enableColumns, cColumns, ref lineHeight, out num, out num2, out num3);
            if (!columnProperties.IsColumnWidthFlexible)
            {
                for (int i = 0; i < cColumns; i++)
                {
                    pfscolinfo[i].durBefore = TextDpi.ToTextDpi((i == 0) ? 0.0 : num3);
                    pfscolinfo[i].durWidth  = TextDpi.ToTextDpi(num);
                    pfscolinfo[i].durBefore = Math.Max(0, pfscolinfo[i].durBefore);
                    pfscolinfo[i].durWidth  = Math.Max(1, pfscolinfo[i].durWidth);
                }
                return;
            }
            for (int j = 0; j < cColumns; j++)
            {
                if (columnProperties.ColumnSpaceDistribution == ColumnSpaceDistribution.Right)
                {
                    pfscolinfo[j].durWidth = TextDpi.ToTextDpi((j == cColumns - 1) ? (num + num2) : num);
                }
                else if (columnProperties.ColumnSpaceDistribution == ColumnSpaceDistribution.Left)
                {
                    pfscolinfo[j].durWidth = TextDpi.ToTextDpi((j == 0) ? (num + num2) : num);
                }
                else
                {
                    pfscolinfo[j].durWidth = TextDpi.ToTextDpi(num + num2 / (double)cColumns);
                }
                if (pfscolinfo[j].durWidth > TextDpi.ToTextDpi(pageWidth))
                {
                    pfscolinfo[j].durWidth = TextDpi.ToTextDpi(pageWidth);
                }
                pfscolinfo[j].durBefore = TextDpi.ToTextDpi((j == 0) ? 0.0 : num3);
                pfscolinfo[j].durBefore = Math.Max(0, pfscolinfo[j].durBefore);
                pfscolinfo[j].durWidth  = Math.Max(1, pfscolinfo[j].durWidth);
            }
        }
Ejemplo n.º 25
0
        // 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));
        }
Ejemplo n.º 26
0
        // Token: 0x06006883 RID: 26755 RVA: 0x001D7C20 File Offset: 0x001D5E20
        internal int CalculateUOffsetShift()
        {
            int num;
            int num2;

            if (this.IsUOffsetAdjusted)
            {
                num  = TextDpi.ToTextDpi(this._line.WidthIncludingTrailingWhitespace);
                num2 = TextDpi.ToTextDpi(this._line.Width) - num;
                Invariant.Assert(num2 <= 0);
            }
            else
            {
                num  = TextDpi.ToTextDpi(this._line.Width);
                num2 = 0;
            }
            int num3 = 0;

            if ((this._textAlignment == TextAlignment.Center || this._textAlignment == TextAlignment.Right) && !this.ShowEllipses)
            {
                if (num > TextDpi.ToTextDpi(this._wrappingWidth))
                {
                    num3 = num - TextDpi.ToTextDpi(this._wrappingWidth);
                }
                else
                {
                    num3 = 0;
                }
            }
            int result;

            if (this._textAlignment == TextAlignment.Center)
            {
                result = (num3 + num2) / 2;
            }
            else
            {
                result = num3 + num2;
            }
            return(result);
        }
        // Token: 0x060067F3 RID: 26611 RVA: 0x001D35D4 File Offset: 0x001D17D4
        private int CalculateParagraphToColumnOffset(FigureHorizontalAnchor horizontalAnchor, PTS.FSRECT fsrcInColumn)
        {
            Invariant.Assert(FigureHelper.IsHorizontalColumnAnchor(horizontalAnchor));
            int num;

            if (horizontalAnchor == FigureHorizontalAnchor.ColumnLeft)
            {
                num = fsrcInColumn.u;
            }
            else if (horizontalAnchor == FigureHorizontalAnchor.ColumnRight)
            {
                num = fsrcInColumn.u + fsrcInColumn.du - 1;
            }
            else
            {
                num = fsrcInColumn.u + fsrcInColumn.du / 2 - 1;
            }
            int    num2;
            double num3;
            double num4;
            double num5;

            FigureHelper.GetColumnMetrics(base.StructuralCache, out num2, out num3, out num4, out num5);
            Invariant.Assert(num2 > 0);
            int num6  = TextDpi.ToTextDpi(num3 + num4);
            int num7  = (num - base.StructuralCache.CurrentFormatContext.PageMarginRect.u) / num6;
            int num8  = base.StructuralCache.CurrentFormatContext.PageMarginRect.u + num7 * num6;
            int num9  = TextDpi.ToTextDpi(num3);
            int num10 = num8 - fsrcInColumn.u;
            int num11 = num8 + num9 - (fsrcInColumn.u + fsrcInColumn.du);

            if (horizontalAnchor == FigureHorizontalAnchor.ColumnLeft)
            {
                return(num10);
            }
            if (horizontalAnchor == FigureHorizontalAnchor.ColumnRight)
            {
                return(num11);
            }
            return((num11 + num10) / 2);
        }
        // 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;
        }
        /// <summary>
        /// UpdateBottomlessCell
        /// </summary>
        /// <param name="fswdir">Text Direction</param>
        /// <param name="width">Width of cell (height is specified by row props)</param>
        /// <param name="fmtrbl">bottomless format result</param>
        /// <param name="dvrUsed">dvr Used</param>
        internal void UpdateBottomlessCell(uint fswdir, double width, out PTS.FSFMTRBL fmtrbl, out int dvrUsed)
        {
            IntPtr pmcsclientOut;

            PTS.FSKCLEAR fskclearOut;
            PTS.FSBBOX   fsbbox;
            int          dvrTopSpace;
            int          fPageBecomesUninterruptable;

            PTS.FSPAP fspap;

            fspap = new PTS.FSPAP();
            CellParagraph.GetParaProperties(ref fspap);

            CellParagraph.UpdateBottomlessPara(_paraHandle.Value, this,
                                               PTS.FromBoolean(false),
                                               fswdir, 0,
                                               TextDpi.ToTextDpi(width),
                                               0, null,
                                               PTS.FSKCLEAR.fskclearNone,
                                               PTS.FromBoolean(true),
                                               out fmtrbl,
                                               out dvrUsed,
                                               out fsbbox,
                                               out pmcsclientOut,
                                               out fskclearOut,
                                               out dvrTopSpace,
                                               out fPageBecomesUninterruptable);
            if (pmcsclientOut != IntPtr.Zero)
            {
                MarginCollapsingState mcs = PtsContext.HandleToObject(pmcsclientOut) as MarginCollapsingState;
                PTS.ValidateHandle(mcs);
                dvrUsed += mcs.Margin;
                mcs.Dispose();
                pmcsclientOut = IntPtr.Zero;
            }
        }
Ejemplo n.º 30
0
        internal unsafe void CalcHorizontalBBoxOfRow(
            int cCells,
            IntPtr *rgnmCell,
            IntPtr *rgpfsCell,
            out int urBBox,
            out int durBBox)
        {
            Debug.Assert(cCells == Row.FormatCellCount);

            urBBox  = 0;
            durBBox = 0;

            for (int index = 0; index < cCells; index++)
            {
                if (rgpfsCell[index] != IntPtr.Zero)
                {
                    CellParaClient cellParaClient = PtsContext.HandleToObject(rgpfsCell[index]) as CellParaClient;
                    PTS.ValidateHandle(cellParaClient);

                    durBBox = TextDpi.ToTextDpi(cellParaClient.TableParaClient.TableDesiredWidth);
                    break;
                }
            }
        }