internal PageItemHelper WritePaginationInfo()
        {
            PageItemRepeatWithHelper pageItemRepeatWithHelper = new PageItemRepeatWithHelper(13);

            pageItemRepeatWithHelper.RelativeTop         = m_relativeTop;
            pageItemRepeatWithHelper.RelativeBottom      = m_relativeBottom;
            pageItemRepeatWithHelper.RelativeTopToBottom = m_relativeTopToBottom;
            pageItemRepeatWithHelper.DataRegionIndex     = m_dataRegionIndex;
            if (m_renderItemSize != null)
            {
                pageItemRepeatWithHelper.RenderItemSize = m_renderItemSize.WritePaginationInfo();
            }
            return(pageItemRepeatWithHelper);
        }
 internal void UpdateItem(PageItemHelper itemHelper, RPLWriter rplWriter, PageContext pageContext)
 {
     if (itemHelper != null)
     {
         PageItemRepeatWithHelper pageItemRepeatWithHelper = itemHelper as PageItemRepeatWithHelper;
         RSTrace.RenderingTracer.Assert(pageItemRepeatWithHelper != null, "This should be a RepeatWith");
         m_relativeTop         = pageItemRepeatWithHelper.RelativeTop;
         m_relativeBottom      = pageItemRepeatWithHelper.RelativeBottom;
         m_relativeTopToBottom = pageItemRepeatWithHelper.RelativeTopToBottom;
         m_dataRegionIndex     = pageItemRepeatWithHelper.DataRegionIndex;
         if (pageItemRepeatWithHelper.RenderItemSize != null)
         {
             m_renderItemSize = pageItemRepeatWithHelper.RenderItemSize.GetNewItem();
         }
         if (m_pageItem != null)
         {
             PageContext pageContext2 = new PageContext(pageContext, PageContext.PageContextFlags.FullOnPage, PageContext.IgnorePBReasonFlag.Repeated);
             m_pageItem.CalculateRepeatWithPage(rplWriter, pageContext2, null);
         }
     }
 }
        private static void ReadPageItemContainerProperties(PageItemContainerHelper item, BinaryReader reader, long offsetEndPage)
        {
            RSTrace.RenderingTracer.Assert(item != null, "The item helper is null.");
            RSTrace.RenderingTracer.Assert(reader != null, "The pagination stream is null.");
            RSTrace.RenderingTracer.Assert(offsetEndPage > 0, "The pagination stream is corrupt.");
            byte b = reader.ReadByte();

            while (b != byte.MaxValue && reader.BaseStream.Position <= offsetEndPage)
            {
                switch (b)
                {
                case 6:
                    item.ItemsCreated = reader.ReadBoolean();
                    break;

                case 11:
                    item.PrevPageEnd = reader.ReadDouble();
                    break;

                case 9:
                {
                    if (reader.ReadByte() != 3)
                    {
                        throw new InvalidDataException(SPBRes.InvalidPaginationStream);
                    }
                    PageItemHelper pageItemHelper = new PageItemHelper(3);
                    ReadPageItemProperties(pageItemHelper, reader, offsetEndPage);
                    item.RightEdgeItem = pageItemHelper;
                    break;
                }

                case 7:
                {
                    int   num3   = reader.ReadInt32();
                    int[] array3 = new int[num3];
                    for (int k = 0; k < num3; k++)
                    {
                        array3[k] = reader.ReadInt32();
                    }
                    item.IndexesLeftToRight = array3;
                    break;
                }

                case 20:
                {
                    int   num4   = reader.ReadInt32();
                    int[] array4 = new int[num4];
                    for (int l = 0; l < num4; l++)
                    {
                        array4[l] = reader.ReadInt32();
                    }
                    item.IndexesTopToBottom = array4;
                    break;
                }

                case 10:
                {
                    int num2 = reader.ReadInt32();
                    PageItemHelper[] array2 = new PageItemHelper[num2];
                    for (int j = 0; j < num2; j++)
                    {
                        byte b3 = reader.ReadByte();
                        switch (b3)
                        {
                        case 5:
                        case 6:
                            ReadPageItemContainerProperties((PageItemContainerHelper)(array2[j] = new PageItemContainerHelper(b3)), reader, offsetEndPage);
                            break;

                        case 1:
                        case 2:
                        case 3:
                        case 8:
                        case 9:
                        case 10:
                        case 12:
                        case 15:
                        case 17:
                            array2[j] = new PageItemHelper(b3);
                            ReadPageItemProperties(array2[j], reader, offsetEndPage);
                            break;

                        case 4:
                            array2[j] = new PageItemHelper(b3);
                            ReadSubReportProperties(array2[j], reader, offsetEndPage);
                            break;

                        case 11:
                            ReadTablixProperties((PageTablixHelper)(array2[j] = new PageTablixHelper(b3)), reader, offsetEndPage);
                            break;

                        case 14:
                            reader.ReadByte();
                            array2[j] = null;
                            break;

                        default:
                            throw new InvalidDataException(SPBRes.InvalidTokenPaginationItems(b3.ToString("x", CultureInfo.InvariantCulture)));
                        }
                    }
                    item.Children = array2;
                    break;
                }

                case 8:
                {
                    int num = reader.ReadInt32();
                    PageItemRepeatWithHelper[] array = new PageItemRepeatWithHelper[num];
                    for (int i = 0; i < num; i++)
                    {
                        byte b2 = reader.ReadByte();
                        array[i] = new PageItemRepeatWithHelper(b2);
                        if (b2 != 14)
                        {
                            ReadRepeatWithItemProperties(array[i], reader, offsetEndPage);
                            continue;
                        }
                        reader.ReadByte();
                        array[i] = null;
                    }
                    item.RepeatWithItems = array;
                    break;
                }

                default:
                    item.ProcessPageItemToken(b, reader, offsetEndPage);
                    break;
                }
                b = reader.ReadByte();
            }
            if (reader.BaseStream.Position > offsetEndPage)
            {
                throw new InvalidDataException(SPBRes.InvalidPaginationStream);
            }
        }
        private static void ReadRepeatWithItemProperties(PageItemRepeatWithHelper item, BinaryReader reader, long offsetEndPage)
        {
            RSTrace.RenderingTracer.Assert(item != null, "The item helper is null.");
            RSTrace.RenderingTracer.Assert(reader != null, "The pagination stream is null.");
            RSTrace.RenderingTracer.Assert(offsetEndPage > 0, "The pagination stream is corrupt.");
            byte b = reader.ReadByte();

            while (b != byte.MaxValue && reader.BaseStream.Position <= offsetEndPage)
            {
                switch (b)
                {
                case 12:
                    item.RelativeTop = reader.ReadDouble();
                    break;

                case 13:
                    item.RelativeBottom = reader.ReadDouble();
                    break;

                case 14:
                    item.RelativeTopToBottom = reader.ReadDouble();
                    break;

                case 15:
                    item.DataRegionIndex = reader.ReadInt32();
                    break;

                case 1:
                    item.RenderItemSize = new ItemSizes();
                    if (item.RenderItemSize.ReadPaginationInfo(reader, offsetEndPage) != 0)
                    {
                        throw new InvalidDataException(SPBRes.InvalidPaginationStream);
                    }
                    break;

                case 2:
                    item.RenderItemSize = new PaddItemSizes();
                    if (item.RenderItemSize.ReadPaginationInfo(reader, offsetEndPage) != 0)
                    {
                        throw new InvalidDataException(SPBRes.InvalidPaginationStream);
                    }
                    break;

                case 19:
                {
                    byte           b2             = reader.ReadByte();
                    PageItemHelper pageItemHelper = null;
                    switch (b2)
                    {
                    case 5:
                    case 6:
                        ReadPageItemContainerProperties((PageItemContainerHelper)(pageItemHelper = new PageItemContainerHelper(b2)), reader, offsetEndPage);
                        break;

                    case 1:
                    case 8:
                    case 9:
                    case 12:
                        pageItemHelper = new PageItemHelper(b2);
                        ReadPageItemProperties(pageItemHelper, reader, offsetEndPage);
                        break;

                    default:
                        throw new InvalidDataException(SPBRes.InvalidTokenPaginationItems(b2.ToString("x", CultureInfo.InvariantCulture)));
                    }
                    item.ChildPage = pageItemHelper;
                    break;
                }

                default:
                    throw new InvalidDataException(SPBRes.InvalidTokenPaginationProperties(b.ToString("x", CultureInfo.InvariantCulture)));
                }
                b = reader.ReadByte();
            }
            if (reader.BaseStream.Position > offsetEndPage)
            {
                throw new InvalidDataException(SPBRes.InvalidPaginationStream);
            }
        }