private void ProcessPageItemToken(byte token, BinaryReader reader, long offsetEndPage)
        {
            RSTrace.RenderingTracer.Assert(reader != null, "The pagination stream is null.");
            RSTrace.RenderingTracer.Assert(offsetEndPage > 0, "The pagination stream is corrupt.");
            switch (token)
            {
            case 1:
                this.m_itemPageSizes = new ItemSizes();
                if (this.m_itemPageSizes.ReadPaginationInfo(reader, offsetEndPage) == 0)
                {
                    break;
                }
                throw new InvalidDataException(SPBRes.InvalidPaginationStream);

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

            case 3:
                this.m_state = (PageItem.State)reader.ReadByte();
                break;

            case 21:
                this.m_defLeftValue = reader.ReadDouble();
                break;

            case 4:
                this.m_pageItemsAbove = PageItemHelper.ReadIntList(reader, offsetEndPage);
                break;

            case 5:
                this.m_pageItemsLeft = PageItemHelper.ReadIntList(reader, offsetEndPage);
                break;

            default:
                throw new InvalidDataException(SPBRes.InvalidTokenPaginationProperties(token.ToString(CultureInfo.InvariantCulture)));
            }
            if (reader.BaseStream.Position <= offsetEndPage)
            {
                return;
            }
            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 != 255 && 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)
                    {
                        break;
                    }
                    throw new InvalidDataException(SPBRes.InvalidPaginationStream);

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

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

                    case 1:
                    case 8:
                    case 9:
                    case 12:
                        pageItemHelper = new PageItemHelper(b2);
                        PageItemHelper.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)
            {
                return;
            }
            throw new InvalidDataException(SPBRes.InvalidPaginationStream);
        }