示例#1
0
        /// <summary>
        /// Calculates the spanned cells for this paragraph from the spanned cells for the previous paragraph.
        /// This needs to be done to share the spanned cell paragraphs.
        /// </summary>
        internal void CalculateRowSpans()
        {
            RowParagraph rowPrevious = null;

            if (Row.Index != 0 && Previous != null)
            {
                rowPrevious = ((RowParagraph)Previous);
            }

            Invariant.Assert(_cellParagraphs == null);

            _cellParagraphs = new CellParagraph[Row.Cells.Count];

            for (int cellIndex = 0; cellIndex < Row.Cells.Count; cellIndex++)
            {
                _cellParagraphs[cellIndex] = new CellParagraph(Row.Cells[cellIndex], StructuralCache);
            }

            Invariant.Assert(_spannedCells == null);

            if (Row.SpannedCells != null)
            {
                _spannedCells = new CellParagraph[Row.SpannedCells.Length];
            }
            else
            {
                _spannedCells = new CellParagraph[0];
            }

            for (int index = 0; index < _spannedCells.Length; index++)
            {
                _spannedCells[index] = FindCellParagraphForCell(rowPrevious, Row.SpannedCells[index]);
            }
        }
        // Token: 0x06006ADA RID: 27354 RVA: 0x001E9480 File Offset: 0x001E7680
        private bool InvalidateRowStructure(RowParagraph rowParagraph, int startPosition)
        {
            bool result = true;

            for (int i = 0; i < rowParagraph.Cells.Length; i++)
            {
                CellParagraph cellParagraph = rowParagraph.Cells[i];
                if (cellParagraph.ParagraphEndCharacterPosition < startPosition || !cellParagraph.InvalidateStructure(startPosition))
                {
                    result = false;
                }
            }
            return(result);
        }
示例#3
0
        //------------------------------------------------------
        //
        //  Private methods
        //
        //------------------------------------------------------
        #region Private Methods

        // ------------------------------------------------------------------
        // Invalidate accumulated format caches for the row.
        // ------------------------------------------------------------------
        private bool InvalidateRowStructure(RowParagraph rowParagraph, int startPosition)
        {
            bool isEntireTableInvalid = true;

            for (int iCell = 0; iCell < rowParagraph.Cells.Length; iCell++)
            {
                CellParagraph cellParagraph = rowParagraph.Cells[iCell];

                if (cellParagraph.ParagraphEndCharacterPosition < startPosition ||
                    !cellParagraph.InvalidateStructure(startPosition))
                {
                    isEntireTableInvalid = false;
                }
            }
            return(isEntireTableInvalid);
        }
        /// <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;
        }
        /// <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;
            }
        }
        /// <summary>
        /// Calculates the spanned cells for this paragraph from the spanned cells for the previous paragraph.
        /// This needs to be done to share the spanned cell paragraphs.
        /// </summary>
        internal void CalculateRowSpans()
        {
            RowParagraph rowPrevious = null;

            if(Row.Index != 0 && Previous != null)
            {
                rowPrevious = ((RowParagraph)Previous);
            }

            Invariant.Assert(_cellParagraphs == null);

            _cellParagraphs = new CellParagraph[Row.Cells.Count];

            for(int cellIndex = 0; cellIndex < Row.Cells.Count; cellIndex++)
            {
                _cellParagraphs[cellIndex] = new CellParagraph(Row.Cells[cellIndex], StructuralCache);
            }

            Invariant.Assert(_spannedCells == null);

            if (Row.SpannedCells != null)
            {
                _spannedCells = new CellParagraph[Row.SpannedCells.Length];
            }
            else
            {
                _spannedCells = new CellParagraph[0];
            }

            for(int index = 0; index < _spannedCells.Length; index++)
            {
                _spannedCells[index] = FindCellParagraphForCell(rowPrevious, Row.SpannedCells[index]);
            }
        }
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------

        #region Constructors

        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="cellParagraph">Cell paragraph.</param>
        /// <param name="tableParaClient">Table paraclient.</param>
        internal CellParaClient(CellParagraph cellParagraph, TableParaClient tableParaClient) : base(cellParagraph)
        {
            _tableParaClient = tableParaClient;
        }
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------

        #region Constructors

        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="cellParagraph">Cell paragraph.</param>
        /// <param name="tableParaClient">Table paraclient.</param>
        internal CellParaClient(CellParagraph cellParagraph, TableParaClient tableParaClient) : base(cellParagraph)
        {
            _tableParaClient = tableParaClient;
        }
        /// <summary>
        /// FormatCellFinite - Calls same apis that PTS does for formatting
        /// </summary>
        /// <param name="subpageSize">Subpage size.</param>
        /// <param name="breakRecordIn">Subpage break record.</param>
        /// <param name="isEmptyOk">Is an empty cell ok?</param>
        /// <param name="fswdir">Text Direction</param>
        /// <param name="fsksuppresshardbreakbeforefirstparaIn">Suppress hard break before first para</param>
        /// <param name="fsfmtr">Format result</param>
        /// <param name="dvrUsed">dvr Used</param>
        /// <param name="breakRecordOut">Resultant break record for end of page</param>
        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 != IntPtr.Zero)
            {
                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;
        }