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

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

            for (int i = 0; i < this.m_nrCols; i++)
            {
                PageTableCell cell = this.GetCell(num, i);
                int           num2 = 1;
                while (cell == null)
                {
                    cell = this.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;
                }
            }
            this.RemoveLastRow();
        }
        private void RemoveConsumeContainerWhiteSpaceColumns(float lastColWidth)
        {
            int num = this.m_nrCols - 2;

            for (int i = 0; i < this.m_nrRows; i++)
            {
                PageTableCell cell = this.GetCell(i, num);
                int           num2 = 1;
                while (cell == null)
                {
                    cell = this.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;
                }
            }
            this.RemoveLastCol();
        }
        private void AttachVerticalBorder(int xCellFound, int yCellFound, RPLMeasurement measurement, RPLLine currReportItem, bool leftBorder)
        {
            int           num           = yCellFound;
            PageTableCell pageTableCell = this.m_tableGrid[xCellFound + num * this.m_nrCols];
            double        num2          = (double)pageTableCell.DYValue.Value;

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

            for (int i = this.m_firstVisibleColumn; i < this.m_nrCols; i += pageTableCell.ColSpan)
            {
                pageTableCell = this.m_tableGrid[i + num];
                if (pageTableCell.ColSpan != 1 && (pageTableCell.InUse || pageTableCell.RowSpan > 1 || pageTableCell.HasBorder))
                {
                    this.m_needExtraRow = true;
                    break;
                }
            }
            if (this.m_needExtraRow)
            {
                for (int j = 0; j < this.m_nrCols; j++)
                {
                    if (!this.m_tableGrid[j].Eaten && !this.m_tableGrid[j].InUse && this.m_tableGrid[j].BorderLeft == null)
                    {
                        pageTableCell = this.m_tableGrid[j];
                        for (; j + 1 < this.m_nrCols && !this.m_tableGrid[j + 1].Eaten && !this.m_tableGrid[j + 1].InUse && this.m_tableGrid[j + 1].BorderTop == this.m_tableGrid[j + 1].BorderTop && this.m_tableGrid[j + 1].BorderBottom == this.m_tableGrid[j + 1].BorderBottom && this.m_tableGrid[j + 1].BorderLeft == null; j++)
                        {
                            pageTableCell.ColSpan++;
                            this.m_tableGrid[j + 1].Eaten = true;
                        }
                    }
                }
            }
            return(this.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 * this.m_nrCols;
            int   index = xCellFound + num5;

            num      = this.m_tableGrid[index].DXValue.Value;
            num3     = xCellFound;
            colSpans = 1;
            for (; (double)(reportItem.Width - num) > 0.0001; num += this.m_tableGrid[num3 + num5].DXValue.Value)
            {
                num3++;
                if (num3 >= this.m_nrCols)
                {
                    break;
                }
                colSpans++;
            }
            num2     = this.m_tableGrid[index].DYValue.Value;
            num4     = yCellFound;
            rowSpans = 1;
            for (; (double)(reportItem.Height - num2) > 0.0001; num2 += this.m_tableGrid[xCellFound + this.m_nrCols * num4].DYValue.Value)
            {
                num4++;
                if (num4 >= this.m_nrRows)
                {
                    break;
                }
                rowSpans++;
            }
            for (int i = yCellFound; i < yCellFound + rowSpans; i++)
            {
                for (int j = xCellFound; j < xCellFound + colSpans; j++)
                {
                    PageTableCell cell = this.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 = this.m_nrRows; num > 0; num--)
     {
         int num2 = num * this.m_nrCols - 1;
         if (num < this.m_nrRows)
         {
             for (int i = 1; i < this.m_nrCols; i++)
             {
                 PageTableCell cell = this.GetCell(num2 + i);
                 if (cell != null && (cell.Eaten || cell.InUse))
                 {
                     cell.UsedCell -= cell.UsedCell / this.m_nrCols;
                 }
             }
         }
         this.m_tableGrid.RemoveAt(num2);
     }
     this.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 * this.m_nrCols;
            pageTableCell = this.m_tableGrid[num2 + num3];
            num           = (double)pageTableCell.DXValue.Value;
            if (topBorder)
            {
                pageTableCell.BorderTop = currReportItem;
            }
            else
            {
                pageTableCell.BorderBottom = currReportItem;
            }
            while ((double)measurement.Width - num > 0.0001)
            {
                num2++;
                if (num2 >= this.m_nrCols)
                {
                    break;
                }
                pageTableCell = this.m_tableGrid[num2 + num3];
                num          += (double)pageTableCell.DXValue.Value;
                num4++;
                if (topBorder)
                {
                    pageTableCell.BorderTop = currReportItem;
                }
                else
                {
                    pageTableCell.BorderBottom = currReportItem;
                }
            }
        }
        private bool HasEmptyRightColumns(ref float lastColWidth)
        {
            bool result = false;
            int  col    = this.m_nrCols - 1;

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

            lastRowHeight = 0f;
            for (int i = 0; i < this.m_nrCols; i++)
            {
                PageTableCell cell = this.GetCell(row, i);
                if (cell.Eaten && !this.m_tableGrid[cell.UsedCell].InUse)
                {
                    continue;
                }
                if (!cell.InUse && !cell.HasBorder && !cell.Eaten)
                {
                    lastRowHeight = Math.Max(cell.DYValue.Value, lastRowHeight);
                    continue;
                }
                result = true;
                break;
            }
            return(result);
        }
        public 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 < this.m_nrRows; num++)
            {
                flag = false;
                int num9 = this.m_nrCols * num4;
                if (this.m_tableGrid[num3].DYValue < 0.2f)
                {
                    for (num2 = 0; num2 < this.m_nrCols; num2++)
                    {
                        if (flag)
                        {
                            break;
                        }
                        pageTableCell = this.m_tableGrid[num3 + num2];
                        flag          = (pageTableCell.InUse || pageTableCell.BorderBottom != null || pageTableCell.BorderTop != null);
                    }
                    if (!flag)
                    {
                        num4++;
                        num5 = num3;
                        num2 = 0;
                        while (num2 < this.m_nrCols)
                        {
                            if (this.m_tableGrid[num3 + num2].Eaten)
                            {
                                int usedCell = this.m_tableGrid[num3 + num2].UsedCell;
                                this.m_tableGrid[usedCell].RowSpan--;
                                num2 += this.m_tableGrid[usedCell].ColSpan;
                            }
                            else
                            {
                                num2++;
                            }
                        }
                        this.m_tableGrid.RemoveRange(num3, this.m_nrCols);
                        this.m_nrRows--;
                        num--;
                        num3 -= this.m_nrCols;
                    }
                }
                else
                {
                    flag = true;
                }
                if (flag && num4 > 0)
                {
                    for (num2 = 0; num2 < this.m_nrCols; num2++)
                    {
                        pageTableCell = this.m_tableGrid[num3 + num2];
                        if (pageTableCell.InUse && pageTableCell.UsedCell >= num5)
                        {
                            num6 = pageTableCell.RowSpan;
                            num7 = pageTableCell.ColSpan;
                            int num10 = 0;
                            for (int i = 0; i < num6; i++)
                            {
                                num10 = num3 + num2 + i * this.m_nrCols;
                                for (int j = 0; j < num7; j++)
                                {
                                    pageTableCell           = this.m_tableGrid[num10 + j];
                                    pageTableCell.UsedCell -= num9;
                                }
                            }
                        }
                    }
                }
                num3 += this.m_nrCols;
            }
            if (this.m_nrRows > 0)
            {
                for (num2 = 0; num2 < this.m_nrCols; num2++)
                {
                    flag = false;
                    if (this.m_tableGrid[num2].DXValue < 0.2f)
                    {
                        num  = 0;
                        num3 = 0;
                        while (num < this.m_nrRows && !flag)
                        {
                            pageTableCell = this.m_tableGrid[num3 + num2];
                            flag          = (pageTableCell.InUse || pageTableCell.BorderLeft != null || pageTableCell.BorderRight != null);
                            num++;
                            num3 += this.m_nrCols;
                        }
                        if (!flag)
                        {
                            list.Add(num2);
                            num = 0;
                            while (num < this.m_nrRows)
                            {
                                if (this.m_tableGrid[num * this.m_nrCols + num2].Eaten)
                                {
                                    int usedCell2 = this.m_tableGrid[num * this.m_nrCols + num2].UsedCell;
                                    this.m_tableGrid[usedCell2].ColSpan--;
                                    num += this.m_tableGrid[usedCell2].RowSpan;
                                }
                                else
                                {
                                    num++;
                                }
                            }
                        }
                    }
                }
            }
            for (int k = 0; k < list.Count; k++)
            {
                for (int l = 0; l < this.m_nrRows; l++)
                {
                    num8 = l * this.m_nrCols + list[k] - l - k;
                    this.m_tableGrid.RemoveAt(num8);
                    for (int m = 0; m < this.m_nrCols - 1; m++)
                    {
                        if (num8 + m < this.m_tableGrid.Count)
                        {
                            PageTableCell cell = this.GetCell(num8 + m);
                            if (cell != null && (cell.Eaten || cell.InUse))
                            {
                                int usedCell3 = cell.UsedCell;
                                cell.UsedCell -= usedCell3 / this.m_nrCols;
                                if (list[k] < usedCell3 % this.m_nrCols)
                                {
                                    cell.UsedCell--;
                                }
                            }
                        }
                    }
                }
                this.m_nrCols--;
            }
        }
        private void FillAndFindOverlap(RPLItemMeasurement[] repItemCollection, double delta)
        {
            bool               flag               = false;
            int                num                = -1;
            int                num2               = -1;
            int                colSpan            = 0;
            int                rowSpan            = 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 (PageTableLayout.SkipReportItem(rPLItemMeasurement))
                {
                    num4++;
                }
                else
                {
                    rPLElement = rPLItemMeasurement.Element;
                    flag       = this.FindRItemCell(rPLItemMeasurement, ref num, ref num2, delta);
                    if (!flag && !(rPLElement is RPLLine))
                    {
                        num4++;
                    }
                    else
                    {
                        RPLLine rPLLine = rPLElement as RPLLine;
                        if (rPLLine != null)
                        {
                            RPLElementPropsDef elementPropsDef = rPLLine.ElementPropsDef;
                            float width = rPLItemMeasurement.Width;
                            if (width >= 0.0 && width < 0.0099999997764825821)
                            {
                                goto IL_00b8;
                            }
                            if (width < 0.0 && width > -0.0099999997764825821)
                            {
                                goto IL_00b8;
                            }
                            width = rPLItemMeasurement.Height;
                            if (width >= 0.0 && width < 0.0099999997764825821)
                            {
                                goto IL_0176;
                            }
                            if (width < 0.0 && width > -0.0099999997764825821)
                            {
                                goto IL_0176;
                            }
                        }
                        num3          = num + this.m_nrCols * num2;
                        pageTableCell = this.m_tableGrid[num3];
                        if ((pageTableCell.InUse || pageTableCell.Eaten) && rPLElement is RPLLine && rPLItemMeasurement.Width != 0.0 && rPLItemMeasurement.Height != 0.0)
                        {
                            num4++;
                            continue;
                        }
                        this.ComputeColRowSpan(rPLItemMeasurement, num, num2, ref colSpan, ref rowSpan);
                        this.AttachRItem(num, num2, colSpan, rowSpan, rPLItemMeasurement);
                        num4++;
                    }
                }
                continue;
IL_00b8:
                if (!flag)
                {
                    int  num5  = 0;
                    bool flag2 = true;
                    while (flag2 && num5 < this.m_nrRows)
                    {
                        if (this.m_tableGrid[num5 * this.m_nrCols].YValue == (float)((double)rPLItemMeasurement.Top - delta))
                        {
                            num2  = num5;
                            flag2 = false;
                        }
                        num5++;
                    }
                    num = this.m_nrCols - 1;
                    if (!flag2)
                    {
                        this.AttachVerticalBorder(num, num2, rPLItemMeasurement, (RPLLine)rPLElement, false);
                    }
                }
                else
                {
                    this.AttachVerticalBorder(num, num2, rPLItemMeasurement, (RPLLine)rPLElement, true);
                }
                num4++;
                continue;
IL_0176:
                if (!flag)
                {
                    int  num6  = 0;
                    bool flag3 = true;
                    while (flag3 && num6 < this.m_nrCols)
                    {
                        if (this.m_tableGrid[num6].XValue == rPLItemMeasurement.Left)
                        {
                            num   = num6;
                            flag3 = false;
                        }
                        num6++;
                    }
                    num2 = this.m_nrRows - 1;
                    this.AttachHorizontalBorder(num, num2, rPLItemMeasurement, (RPLLine)rPLElement, false);
                }
                else
                {
                    this.AttachHorizontalBorder(num, num2, rPLItemMeasurement, (RPLLine)rPLElement, true);
                }
                num4++;
            }
        }