Esempio n. 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;
                    }
                }
            }
        }
Esempio n. 2
0
        // Token: 0x060034AF RID: 13487 RVA: 0x000EA950 File Offset: 0x000E8B50
        private int PreCoalesceTable(DocumentNode dn)
        {
            int result = 0;
            int index  = dn.Index;
            ColumnStateArray columnStateArray = dn.ComputeColumns();
            int minUnfilledRowIndex           = columnStateArray.GetMinUnfilledRowIndex();

            if (minUnfilledRowIndex > 0)
            {
                DocumentNode documentNode  = new DocumentNode(DocumentNodeType.dnTable);
                DocumentNode documentNode2 = new DocumentNode(DocumentNodeType.dnTableBody);
                documentNode.FormatState           = new FormatState(dn.FormatState);
                documentNode.FormatState.RowFormat = this.EntryAt(minUnfilledRowIndex).FormatState.RowFormat;
                int num  = minUnfilledRowIndex - dn.Index - 1;
                int num2 = dn.ChildCount - num;
                dn.ChildCount = num;
                this.EntryAt(index + 1).ChildCount = num - 1;
                this.InsertNode(minUnfilledRowIndex, documentNode2);
                this.CloseAtHelper(minUnfilledRowIndex, num2);
                this.InsertNode(minUnfilledRowIndex, documentNode);
                this.CloseAtHelper(minUnfilledRowIndex, num2 + 1);
                documentNode2.Parent = documentNode;
                documentNode.Parent  = dn.ClosedParent;
                for (DocumentNode closedParent = documentNode.ClosedParent; closedParent != null; closedParent = closedParent.ClosedParent)
                {
                    closedParent.ChildCount += 2;
                }
                result = 2;
                dn.ColumnStateArray = dn.ComputeColumns();
            }
            else
            {
                dn.ColumnStateArray = columnStateArray;
            }
            return(result);
        }
        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;
        }
Esempio n. 4
0
 // Token: 0x060034B1 RID: 13489 RVA: 0x000EABA4 File Offset: 0x000E8DA4
 private void ProcessTableRowSpan(DocumentNodeArray dnaTables)
 {
     for (int i = 0; i < dnaTables.Count; i++)
     {
         DocumentNode     documentNode     = dnaTables.EntryAt(i);
         ColumnStateArray columnStateArray = documentNode.ColumnStateArray;
         if (columnStateArray != null && columnStateArray.Count != 0)
         {
             int count = columnStateArray.Count;
             DocumentNodeArray tableRows         = documentNode.GetTableRows();
             DocumentNodeArray documentNodeArray = new DocumentNodeArray();
             for (int j = 0; j < count; j++)
             {
                 documentNodeArray.Add(null);
             }
             for (int k = 0; k < tableRows.Count; k++)
             {
                 DocumentNode      documentNode2 = tableRows.EntryAt(k);
                 RowFormat         rowFormat     = documentNode2.FormatState.RowFormat;
                 DocumentNodeArray rowsCells     = documentNode2.GetRowsCells();
                 int num = count;
                 if (rowFormat.CellCount < num)
                 {
                     num = rowFormat.CellCount;
                 }
                 if (rowsCells.Count < num)
                 {
                     num = rowsCells.Count;
                 }
                 int num2 = 0;
                 int num3 = 0;
                 while (num3 < num && num2 < documentNodeArray.Count)
                 {
                     DocumentNode documentNode3 = rowsCells.EntryAt(num3);
                     CellFormat   cellFormat    = rowFormat.NthCellFormat(num3);
                     if (cellFormat.IsVMerge)
                     {
                         DocumentNode documentNode4 = documentNodeArray.EntryAt(num2);
                         if (documentNode4 != null)
                         {
                             documentNode4.RowSpan++;
                         }
                         num2 += documentNode3.ColSpan;
                         documentNode3.ColSpan = 0;
                     }
                     else
                     {
                         if (cellFormat.IsVMergeFirst)
                         {
                             documentNode3.RowSpan   = 1;
                             documentNodeArray[num2] = documentNode3;
                         }
                         else
                         {
                             documentNodeArray[num2] = null;
                         }
                         for (int l = num2 + 1; l < num2 + documentNode3.ColSpan; l++)
                         {
                             documentNodeArray[l] = null;
                         }
                         num2 += documentNode3.ColSpan;
                     }
                     num3++;
                 }
             }
         }
     }
 }