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;
        }
        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;
            }
        }
        internal void FormatCellFinite(Size subpageSize, IntPtr breakRecordIn, bool isEmptyOk, uint fswdir, 
                                       PTS.FSKSUPPRESSHARDBREAKBEFOREFIRSTPARA fsksuppresshardbreakbeforefirstparaIn,
                                       out PTS.FSFMTR fsfmtr, out int dvrUsed, out IntPtr breakRecordOut)
        {
            IntPtr pfspara;
            PTS.FSBBOX fsbbox;
            IntPtr pmcsclientOut;
            PTS.FSKCLEAR fskclearOut;
            int dvrTopSpace;
            PTS.FSPAP fspap;

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

            // Ensures segment is created for paragraph
            fspap = new PTS.FSPAP();
            CellParagraph.GetParaProperties(ref fspap);

            PTS.FSRECT rectCell;

            rectCell = new PTS.FSRECT();

            rectCell.u = rectCell.v = 0;

            rectCell.du = TextDpi.ToTextDpi(subpageSize.Width);
            rectCell.dv = TextDpi.ToTextDpi(subpageSize.Height);

            // Suppress top space if cell is broken, but not otherwise
            bool suppressTopSpace = (breakRecordIn != IntPtr.Zero) ? true : false;

            CellParagraph.FormatParaFinite(this, breakRecordIn,
                                           PTS.FromBoolean(true),
                                           IntPtr.Zero,
                                           PTS.FromBoolean(isEmptyOk),
                                           PTS.FromBoolean(suppressTopSpace),
                                           fswdir,
                                           ref rectCell,
                                           null,
                                           PTS.FSKCLEAR.fskclearNone,
                                           fsksuppresshardbreakbeforefirstparaIn,
                                           out fsfmtr,
                                           out pfspara,
                                           out breakRecordOut,
                                           out dvrUsed,
                                           out fsbbox,
                                           out pmcsclientOut,
                                           out fskclearOut,
                                           out dvrTopSpace);

            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;
        }