Example #1
0
        // Token: 0x060034B0 RID: 13488 RVA: 0x000EAA6C File Offset: 0x000E8C6C
        private void PreCoalesceRow(DocumentNode dn, ref bool fVMerged)
        {
            DocumentNodeArray rowsCells        = dn.GetRowsCells();
            RowFormat         rowFormat        = dn.FormatState.RowFormat;
            DocumentNode      parentOfType     = dn.GetParentOfType(DocumentNodeType.dnTable);
            ColumnStateArray  columnStateArray = (parentOfType != null) ? parentOfType.ColumnStateArray : null;
            int num = (rowsCells.Count < rowFormat.CellCount) ? rowsCells.Count : rowFormat.CellCount;
            int i   = 0;
            int j   = 0;

            while (j < num)
            {
                DocumentNode documentNode = rowsCells.EntryAt(j);
                CellFormat   cellFormat   = rowFormat.NthCellFormat(j);
                long         cellX        = cellFormat.CellX;
                if (cellFormat.IsVMerge)
                {
                    fVMerged = true;
                }
                if (cellFormat.IsHMergeFirst)
                {
                    for (j++; j < num; j++)
                    {
                        cellFormat = rowFormat.NthCellFormat(j);
                        if (cellFormat.IsVMerge)
                        {
                            fVMerged = true;
                        }
                        if (cellFormat.IsHMerge)
                        {
                            rowsCells.EntryAt(j).ColSpan = 0;
                        }
                    }
                }
                else
                {
                    j++;
                }
                if (columnStateArray != null)
                {
                    int num2 = i;
                    while (i < columnStateArray.Count)
                    {
                        ColumnState columnState = columnStateArray.EntryAt(i);
                        i++;
                        if (columnState.CellX == cellX || columnState.CellX > cellX)
                        {
                            break;
                        }
                    }
                    if (i - num2 > documentNode.ColSpan)
                    {
                        documentNode.ColSpan = i - num2;
                    }
                }
            }
        }
Example #2
0
        // Token: 0x06003489 RID: 13449 RVA: 0x000E9858 File Offset: 0x000E7A58
        internal int GetMinUnfilledRowIndex()
        {
            int num = -1;

            for (int i = 0; i < this.Count; i++)
            {
                ColumnState columnState = this.EntryAt(i);
                if (!columnState.IsFilled && (num < 0 || num > columnState.Row.Index) && !columnState.Row.FormatState.RowFormat.IsVMerge)
                {
                    num = columnState.Row.Index;
                }
            }
            return(num);
        }
        internal ColumnStateArray ComputeColumns()
        {
            DocumentNodeArray dna = DNA;
            Debug.Assert(Type == DocumentNodeType.dnTable);

            DocumentNodeArray dnaRows = GetTableRows();
            ColumnStateArray cols = new ColumnStateArray();

            for (int i = 0; i < dnaRows.Count; i++)
            {
                DocumentNode dnRow = dnaRows.EntryAt(i);
                RowFormat rf = dnRow.FormatState.RowFormat;

                long prevCellX = 0;
                for (int j = 0; j < rf.CellCount; j++)
                {
                    CellFormat cf = rf.NthCellFormat(j);
                    bool bHandled = false;
                    long prevColX = 0;

                    // Ignore merged cells
                    if (cf.IsHMerge)
                    {
                        continue;
                    }

                    for (int k = 0; k < cols.Count; k++)
                    {
                        ColumnState cs = (ColumnState)cols[k];

                        if (cs.CellX == cf.CellX)
                        {
                            if (!cs.IsFilled && prevColX == prevCellX)
                            {
                                cs.IsFilled = true;
                            }
                            bHandled = true;
                            break;
                        }
                        else if (cs.CellX > cf.CellX)
                        {
                            // Hmmm, need to insert a new cell here
                            ColumnState csNew = new ColumnState();
                            csNew.Row = dnRow;
                            csNew.CellX = cf.CellX;
                            csNew.IsFilled = (prevColX == prevCellX);
                            cols.Insert(k, csNew);
                            bHandled = true;
                            break;
                        }

                        prevColX = cs.CellX;
                    }

                    // New cell at the end
                    if (!bHandled)
                    {
                        ColumnState csNew = new ColumnState();
                        csNew.Row = dnRow;
                        csNew.CellX = cf.CellX;
                        csNew.IsFilled = (prevColX == prevCellX);
                        cols.Add(csNew);
                    }

                    prevCellX = cf.CellX;
                }
            }

            return cols;
        }