Beispiel #1
0
        internal int GetRowProperties(
            IntPtr pfsclient,                       // IN:  
            IntPtr nmRow,                           // IN:  
            uint fswdirTable,                       // IN:  
            out PTS.FSTABLEROWPROPS rowprops)       // OUT: 
        {
            int fserr = PTS.fserrNone;
            try
            {
                RowParagraph rowParagraph = PtsContext.HandleToObject(nmRow) as RowParagraph;
                PTS.ValidateHandle(rowParagraph);

                rowParagraph.GetRowProperties(fswdirTable, out rowprops);
            }
            catch (Exception e)
            {
                rowprops = new PTS.FSTABLEROWPROPS();
                PtsContext.CallbackException = e;
                fserr = PTS.fserrCallbackException;
            }
            catch
            {
                rowprops = new PTS.FSTABLEROWPROPS();
                PtsContext.CallbackException = new System.Exception("Caught a non CLS Exception");
                fserr = PTS.fserrCallbackException;
            }
            return (fserr);
        }
        /// <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);

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