internal bool EmptyRow(RPLMeasurement[] repItemColl, bool ignoreLines, int rowIndex, bool renderHeight, ref int skipHeight)
        {
            int           i             = m_firstVisibleColumn;
            bool          result        = true;
            PageTableCell pageTableCell = null;

            for (; i < NrCols; i++)
            {
                pageTableCell = GetCell(i + rowIndex);
                if (!pageTableCell.InUse)
                {
                    continue;
                }
                RPLMeasurement measurement = pageTableCell.Measurement;
                if (measurement != null || !ignoreLines)
                {
                    result = false;
                    if (!renderHeight && skipHeight < pageTableCell.RowSpan)
                    {
                        skipHeight = pageTableCell.RowSpan;
                    }
                    break;
                }
            }
            return(result);
        }
        private void RemoveConsumeContainerWhiteSpaceRows(float lastRowHeight)
        {
            int num = m_nrRows - 2;

            for (int i = 0; i < m_nrCols; i++)
            {
                PageTableCell cell = GetCell(num, i);
                int           num2 = 1;
                while (cell == null)
                {
                    cell = GetCell(num - num2, i);
                    if (cell == null)
                    {
                        num2++;
                        if (num2 > num)
                        {
                            break;
                        }
                    }
                }
                if (cell != null)
                {
                    cell.ConsumedByEmptyWhiteSpace = true;
                    cell.DYValue.Value            += lastRowHeight;
                    cell.KeepBottomBorder          = true;
                }
            }
            RemoveLastRow();
        }
        private void RemoveConsumeContainerWhiteSpaceColumns(float lastColWidth)
        {
            int num = m_nrCols - 2;

            for (int i = 0; i < m_nrRows; i++)
            {
                PageTableCell cell = GetCell(i, num);
                int           num2 = 1;
                while (cell == null)
                {
                    cell = GetCell(i, num - num2);
                    if (cell == null)
                    {
                        num2++;
                        if (num2 > num)
                        {
                            break;
                        }
                    }
                }
                if (cell != null)
                {
                    cell.ConsumedByEmptyWhiteSpace = true;
                    cell.DXValue.Value            += lastColWidth;
                    cell.KeepRightBorder           = true;
                }
            }
            RemoveLastCol();
        }
        private void AttachVerticalBorder(int xCellFound, int yCellFound, RPLMeasurement measurement, RPLLine currReportItem, bool leftBorder)
        {
            int           num           = yCellFound;
            PageTableCell pageTableCell = m_tableGrid[xCellFound + num * m_nrCols];
            double        num2          = pageTableCell.DYValue.Value;

            if (leftBorder)
            {
                pageTableCell.BorderLeft = currReportItem;
            }
            else
            {
                pageTableCell.BorderRight = currReportItem;
            }
            while ((double)measurement.Height - num2 > 0.0001)
            {
                num++;
                if (num < m_nrRows)
                {
                    pageTableCell = m_tableGrid[xCellFound + num * m_nrCols];
                    num2         += (double)pageTableCell.DYValue.Value;
                    if (leftBorder)
                    {
                        pageTableCell.BorderLeft = currReportItem;
                    }
                    else
                    {
                        pageTableCell.BorderRight = currReportItem;
                    }
                    continue;
                }
                break;
            }
        }
        internal bool NeedExtraRow()
        {
            int           num           = m_firstVisibleRow * m_nrCols;
            PageTableCell pageTableCell = null;

            for (int i = m_firstVisibleColumn; i < m_nrCols; i += pageTableCell.ColSpan)
            {
                pageTableCell = m_tableGrid[i + num];
                if (pageTableCell.ColSpan != 1 && (pageTableCell.InUse || pageTableCell.RowSpan > 1 || pageTableCell.HasBorder))
                {
                    m_needExtraRow = true;
                    break;
                }
            }
            if (m_needExtraRow)
            {
                for (int j = 0; j < m_nrCols; j++)
                {
                    if (!m_tableGrid[j].Eaten && !m_tableGrid[j].InUse && m_tableGrid[j].BorderLeft == null)
                    {
                        pageTableCell = m_tableGrid[j];
                        for (; j + 1 < m_nrCols && !m_tableGrid[j + 1].Eaten && !m_tableGrid[j + 1].InUse && m_tableGrid[j + 1].BorderTop == m_tableGrid[j + 1].BorderTop && m_tableGrid[j + 1].BorderBottom == m_tableGrid[j + 1].BorderBottom && m_tableGrid[j + 1].BorderLeft == null; j++)
                        {
                            pageTableCell.ColSpan++;
                            m_tableGrid[j + 1].Eaten = true;
                        }
                    }
                }
            }
            return(m_needExtraRow);
        }
        private void ComputeColRowSpan(RPLMeasurement reportItem, int xCellFound, int yCellFound, ref int colSpans, ref int rowSpans)
        {
            float num   = 0f;
            float num2  = 0f;
            int   num3  = 0;
            int   num4  = 0;
            int   num5  = yCellFound * m_nrCols;
            int   index = xCellFound + num5;

            num      = m_tableGrid[index].DXValue.Value;
            num3     = xCellFound;
            colSpans = 1;
            for (; (double)(reportItem.Width - num) > 0.0001; num += m_tableGrid[num3 + num5].DXValue.Value)
            {
                num3++;
                if (num3 >= m_nrCols)
                {
                    break;
                }
                colSpans++;
            }
            num2     = m_tableGrid[index].DYValue.Value;
            num4     = yCellFound;
            rowSpans = 1;
            for (; (double)(reportItem.Height - num2) > 0.0001; num2 += m_tableGrid[xCellFound + m_nrCols * num4].DYValue.Value)
            {
                num4++;
                if (num4 >= m_nrRows)
                {
                    break;
                }
                rowSpans++;
            }
            for (int i = yCellFound; i < yCellFound + rowSpans; i++)
            {
                for (int j = xCellFound; j < xCellFound + colSpans; j++)
                {
                    PageTableCell cell = GetCell(i, j);
                    cell.FirstHorzMerge = (j == xCellFound && colSpans > 1);
                    cell.FirstVertMerge = (i == yCellFound && rowSpans > 1);
                    cell.HorzMerge      = (j > xCellFound);
                    cell.VertMerge      = (i > yCellFound);
                }
            }
        }
 private void RemoveLastCol()
 {
     for (int num = m_nrRows; num > 0; num--)
     {
         int num2 = num * m_nrCols - 1;
         if (num < m_nrRows)
         {
             for (int i = 1; i < m_nrCols; i++)
             {
                 PageTableCell cell = GetCell(num2 + i);
                 if (cell != null && (cell.Eaten || cell.InUse))
                 {
                     cell.UsedCell -= cell.UsedCell / m_nrCols;
                 }
             }
         }
         m_tableGrid.RemoveAt(num2);
     }
     m_nrCols--;
 }
        private void AttachHorizontalBorder(int xCellFound, int yCellFound, RPLMeasurement measurement, RPLLine currReportItem, bool topBorder)
        {
            double        num           = 0.0;
            int           num2          = 0;
            int           num3          = 0;
            PageTableCell pageTableCell = null;
            int           num4          = 1;

            num2          = xCellFound;
            num3          = yCellFound * m_nrCols;
            pageTableCell = m_tableGrid[num2 + num3];
            num           = pageTableCell.DXValue.Value;
            if (topBorder)
            {
                pageTableCell.BorderTop = currReportItem;
            }
            else
            {
                pageTableCell.BorderBottom = currReportItem;
            }
            while ((double)measurement.Width - num > 0.0001)
            {
                num2++;
                if (num2 < m_nrCols)
                {
                    pageTableCell = m_tableGrid[num2 + num3];
                    num          += (double)pageTableCell.DXValue.Value;
                    num4++;
                    if (topBorder)
                    {
                        pageTableCell.BorderTop = currReportItem;
                    }
                    else
                    {
                        pageTableCell.BorderBottom = currReportItem;
                    }
                    continue;
                }
                break;
            }
        }
        private bool HasEmptyRightColumns(ref float lastColWidth)
        {
            bool result = false;
            int  col    = m_nrCols - 1;

            lastColWidth = 0f;
            for (int i = 0; i < m_nrRows; i++)
            {
                PageTableCell cell = GetCell(i, col);
                if (!cell.Eaten || m_tableGrid[cell.UsedCell].InUse)
                {
                    if (cell.InUse || cell.HasBorder || cell.Eaten)
                    {
                        result = true;
                        break;
                    }
                    lastColWidth = Math.Max(cell.DXValue.Value, lastColWidth);
                }
            }
            return(result);
        }
        private bool HasEmptyBottomRows(ref float lastRowHeight)
        {
            bool result = false;
            int  row    = m_nrRows - 1;

            lastRowHeight = 0f;
            for (int i = 0; i < m_nrCols; i++)
            {
                PageTableCell cell = GetCell(row, i);
                if (!cell.Eaten || m_tableGrid[cell.UsedCell].InUse)
                {
                    if (cell.InUse || cell.HasBorder || cell.Eaten)
                    {
                        result = true;
                        break;
                    }
                    lastRowHeight = Math.Max(cell.DYValue.Value, lastRowHeight);
                }
            }
            return(result);
        }
        internal void EmptyRowsCells()
        {
            int           num           = 0;
            int           num2          = 0;
            bool          flag          = false;
            int           num3          = 0;
            PageTableCell pageTableCell = null;
            int           num4          = 0;
            int           num5          = 0;
            List <int>    list          = new List <int>();
            int           num6          = 0;
            int           num7          = 0;
            int           num8          = 0;

            for (num = 0; num < m_nrRows; num++)
            {
                flag = false;
                int num9 = m_nrCols * num4;
                if (m_tableGrid[num3].DYValue < 0.2f)
                {
                    for (num2 = 0; num2 < m_nrCols; num2++)
                    {
                        if (flag)
                        {
                            break;
                        }
                        pageTableCell = m_tableGrid[num3 + num2];
                        flag          = (pageTableCell.InUse || pageTableCell.BorderBottom != null || pageTableCell.BorderTop != null);
                    }
                    if (!flag)
                    {
                        num4++;
                        num5 = num3;
                        num2 = 0;
                        while (num2 < m_nrCols)
                        {
                            if (m_tableGrid[num3 + num2].Eaten)
                            {
                                int usedCell = m_tableGrid[num3 + num2].UsedCell;
                                m_tableGrid[usedCell].RowSpan--;
                                num2 += m_tableGrid[usedCell].ColSpan;
                            }
                            else
                            {
                                num2++;
                            }
                        }
                        m_tableGrid.RemoveRange(num3, m_nrCols);
                        m_nrRows--;
                        num--;
                        num3 -= m_nrCols;
                    }
                }
                else
                {
                    flag = true;
                }
                if (flag && num4 > 0)
                {
                    for (num2 = 0; num2 < m_nrCols; num2++)
                    {
                        pageTableCell = m_tableGrid[num3 + num2];
                        if (!pageTableCell.InUse || pageTableCell.UsedCell < num5)
                        {
                            continue;
                        }
                        num6 = pageTableCell.RowSpan;
                        num7 = pageTableCell.ColSpan;
                        int num10 = 0;
                        for (int i = 0; i < num6; i++)
                        {
                            num10 = num3 + num2 + i * m_nrCols;
                            for (int j = 0; j < num7; j++)
                            {
                                m_tableGrid[num10 + j].UsedCell -= num9;
                            }
                        }
                    }
                }
                num3 += m_nrCols;
            }
            if (m_nrRows > 0)
            {
                for (num2 = 0; num2 < m_nrCols; num2++)
                {
                    flag = false;
                    if (!(m_tableGrid[num2].DXValue < 0.2f))
                    {
                        continue;
                    }
                    num  = 0;
                    num3 = 0;
                    while (num < m_nrRows && !flag)
                    {
                        pageTableCell = m_tableGrid[num3 + num2];
                        flag          = (pageTableCell.InUse || pageTableCell.BorderLeft != null || pageTableCell.BorderRight != null);
                        num++;
                        num3 += m_nrCols;
                    }
                    if (flag)
                    {
                        continue;
                    }
                    list.Add(num2);
                    num = 0;
                    while (num < m_nrRows)
                    {
                        if (m_tableGrid[num * m_nrCols + num2].Eaten)
                        {
                            int usedCell2 = m_tableGrid[num * m_nrCols + num2].UsedCell;
                            m_tableGrid[usedCell2].ColSpan--;
                            num += m_tableGrid[usedCell2].RowSpan;
                        }
                        else
                        {
                            num++;
                        }
                    }
                }
            }
            for (int k = 0; k < list.Count; k++)
            {
                for (int l = 0; l < m_nrRows; l++)
                {
                    num8 = l * m_nrCols + list[k] - l - k;
                    m_tableGrid.RemoveAt(num8);
                    for (int m = 0; m < m_nrCols - 1; m++)
                    {
                        if (num8 + m >= m_tableGrid.Count)
                        {
                            continue;
                        }
                        PageTableCell cell = GetCell(num8 + m);
                        if (cell != null && (cell.Eaten || cell.InUse))
                        {
                            int usedCell3 = cell.UsedCell;
                            cell.UsedCell -= usedCell3 / m_nrCols;
                            if (list[k] < usedCell3 % m_nrCols)
                            {
                                cell.UsedCell--;
                            }
                        }
                    }
                }
                m_nrCols--;
            }
        }
        private void FillAndFindOverlap(RPLItemMeasurement[] repItemCollection, double delta)
        {
            bool               flag               = false;
            int                num                = -1;
            int                num2               = -1;
            int                colSpans           = 0;
            int                rowSpans           = 0;
            int                num3               = 0;
            PageTableCell      pageTableCell      = null;
            int                num4               = 0;
            RPLItemMeasurement rPLItemMeasurement = null;
            RPLElement         rPLElement         = null;

            while (num4 < repItemCollection.Length)
            {
                num  = -1;
                num2 = -1;
                flag = false;
                rPLItemMeasurement = repItemCollection[num4];
                if (SkipReportItem(rPLItemMeasurement))
                {
                    num4++;
                    continue;
                }
                rPLElement = rPLItemMeasurement.Element;
                flag       = FindRItemCell(rPLItemMeasurement, ref num, ref num2, delta);
                if (!flag && !(rPLElement is RPLLine))
                {
                    num4++;
                    continue;
                }
                RPLLine rPLLine = rPLElement as RPLLine;
                if (rPLLine != null)
                {
                    RPLLinePropsDef rPLLinePropsDef = rPLLine.ElementPropsDef as RPLLinePropsDef;
                    float           width           = rPLItemMeasurement.Width;
                    if ((width >= 0f && width < 0.01f) || (width < 0f && width > -0.01f))
                    {
                        if (!flag)
                        {
                            int  num5  = 0;
                            bool flag2 = true;
                            while (flag2 && num5 < m_nrRows)
                            {
                                if (m_tableGrid[num5 * m_nrCols].YValue == (float)((double)rPLItemMeasurement.Top - delta))
                                {
                                    num2  = num5;
                                    flag2 = false;
                                }
                                num5++;
                            }
                            num = m_nrCols - 1;
                            if (!flag2)
                            {
                                AttachVerticalBorder(num, num2, rPLItemMeasurement, (RPLLine)rPLElement, leftBorder: false);
                            }
                        }
                        else
                        {
                            AttachVerticalBorder(num, num2, rPLItemMeasurement, (RPLLine)rPLElement, leftBorder: true);
                        }
                        num4++;
                        continue;
                    }
                    width = rPLItemMeasurement.Height;
                    if ((width >= 0f && width < 0.01f) || (width < 0f && width > -0.01f))
                    {
                        if (!flag)
                        {
                            int  num6  = 0;
                            bool flag3 = true;
                            while (flag3 && num6 < m_nrCols)
                            {
                                if (m_tableGrid[num6].XValue == rPLItemMeasurement.Left)
                                {
                                    num   = num6;
                                    flag3 = false;
                                }
                                num6++;
                            }
                            num2 = m_nrRows - 1;
                            AttachHorizontalBorder(num, num2, rPLItemMeasurement, (RPLLine)rPLElement, topBorder: false);
                        }
                        else
                        {
                            AttachHorizontalBorder(num, num2, rPLItemMeasurement, (RPLLine)rPLElement, topBorder: true);
                        }
                        num4++;
                        continue;
                    }
                }
                num3          = num + m_nrCols * num2;
                pageTableCell = m_tableGrid[num3];
                if ((pageTableCell.InUse || pageTableCell.Eaten) && rPLElement is RPLLine && rPLItemMeasurement.Width != 0f && rPLItemMeasurement.Height != 0f)
                {
                    num4++;
                    continue;
                }
                ComputeColRowSpan(rPLItemMeasurement, num, num2, ref colSpans, ref rowSpans);
                AttachRItem(num, num2, colSpans, rowSpans, rPLItemMeasurement);
                num4++;
            }
        }