public void NextPage(RPLWriter rplWriter, int totalPages)
        {
            this.WriteStartItemToStream(rplWriter);
            double               num                  = 0.0;
            ReportSection        reportSection        = this.m_sections[0];
            int                  count                = this.m_sections.Count;
            double               num2                 = 0.0;
            List <ReportSection> list                 = new List <ReportSection>();
            List <ReportSection> list2                = new List <ReportSection>();
            bool                 isFirstSectionOnPage = true;
            RoundedDouble        roundedDouble        = new RoundedDouble(this.m_pageContext.UsablePageHeight);

            for (int i = 0; i < this.m_sections.Count; i++)
            {
                ReportSection reportSection2 = this.m_sections[i];
                ReportSection nextSection    = null;
                if (i < this.m_sections.Count - 1)
                {
                    nextSection = this.m_sections[i + 1];
                }
                double num3 = reportSection2.NextPage(rplWriter, this.m_pageContext.PageNumber, totalPages, num, roundedDouble.Value - num, nextSection, isFirstSectionOnPage);
                if (num3 > 0.0)
                {
                    num += num3;
                    list2.Add(reportSection2);
                }
                num2 = Math.Max(num2, reportSection2.LeftEdge);
                if (reportSection2.Done)
                {
                    list.Add(reportSection2);
                }
                if (roundedDouble == num)
                {
                    break;
                }
                isFirstSectionOnPage = false;
            }
            if (num2 == 0.0)
            {
                foreach (ReportSection item in list)
                {
                    this.m_sections.Remove(item);
                }
            }
            if (rplWriter != null)
            {
                reportSection.WriteDelayedSectionHeader(rplWriter, this.Done);
                this.WriteEndItemToStream(rplWriter, list2);
            }
            if (this.m_pageContext.PropertyCacheState == PageContext.CacheState.RPLStream)
            {
                this.m_pageContext.ItemPropsStart = null;
                this.m_pageContext.SharedImages   = null;
            }
        }
        public void SetContext()
        {
            ReportSectionCollection reportSections = this.m_report.ReportSections;

            for (int i = 0; i < reportSections.Count; i++)
            {
                AspNetCore.ReportingServices.OnDemandReportRendering.ReportSection reportSection = ((ReportElementCollectionBase <AspNetCore.ReportingServices.OnDemandReportRendering.ReportSection>)reportSections)[i];
                ReportSection reportSection2 = new ReportSection(reportSection, this.m_pageContext, this.m_pageSettings, this.m_pageSettings.SectionPaginationSettings[i]);
                reportSection2.SetContext();
                this.m_sections.Add(reportSection2);
            }
        }
        public void WriteEndItemToStream(RPLWriter rplWriter, List <ReportSection> sectionsOnPage)
        {
            BinaryWriter binaryWriter = rplWriter.BinaryWriter;

            if (binaryWriter != null)
            {
                rplWriter.BinaryWriter.Write((byte)255);
                Stream baseStream = binaryWriter.BaseStream;
                long   position   = baseStream.Position;
                binaryWriter.Write((byte)16);
                binaryWriter.Write(this.m_pageOffset);
                int count = sectionsOnPage.Count;
                binaryWriter.Write(count);
                for (int i = 0; i < count; i++)
                {
                    sectionsOnPage[i].WriteMeasurement(binaryWriter);
                }
                this.m_pageOffset = baseStream.Position;
                binaryWriter.Write((byte)254);
                binaryWriter.Write(position);
                binaryWriter.Write((byte)255);
                position = baseStream.Position;
                binaryWriter.Write((byte)18);
                binaryWriter.Write(this.m_offset);
                binaryWriter.Write(1);
                binaryWriter.Write(this.m_pageOffset);
                binaryWriter.Write((byte)254);
                binaryWriter.Write(position);
                binaryWriter.Write((byte)255);
            }
            else
            {
                int            count2         = sectionsOnPage.Count;
                ReportSection  reportSection  = sectionsOnPage[0];
                RPLPageLayout  pageLayout     = reportSection.WritePageLayout(rplWriter, this.m_pageContext);
                RPLPageContent rPLPageContent = new RPLPageContent(count2, pageLayout);
                for (int j = 0; j < count2; j++)
                {
                    RPLMeasurement rPLMeasurement = null;
                    sectionsOnPage[j].AddToPage(rPLPageContent, out rPLMeasurement);
                    rPLPageContent.ReportSectionSizes[j] = rPLMeasurement;
                }
                rplWriter.Report.RPLPaginatedPages[0] = rPLPageContent;
            }
        }
Beispiel #4
0
        public double NextPage(RPLWriter rplWriter, int pageNumber, int totalPages, double top, double availableHeight, ReportSection nextSection, bool isFirstSectionOnPage)
        {
            double num  = 0.0;
            bool   flag = nextSection == null;

            if (!flag)
            {
                SectionPaginationSettings sectionPaginationSettings = nextSection.SectionPaginationSettings;
                num = 12.699999809265137 + sectionPaginationSettings.FooterHeight;
                PageSection pageHeader = nextSection.ROMReportSection.Page.PageHeader;
                if (pageHeader != null && pageHeader.PrintBetweenSections)
                {
                    num += sectionPaginationSettings.HeaderHeight;
                }
            }
            double      num2        = 0.0;
            PageSection pageHeader2 = this.m_reportSection.Page.PageHeader;
            PageSection pageFooter  = this.m_reportSection.Page.PageFooter;
            bool        flag2       = pageHeader2 != null && pageHeader2.PrintBetweenSections;
            bool        flag3       = pageFooter != null && pageFooter.PrintBetweenSections;

            this.m_needsHeaderHeight = (isFirstSectionOnPage ? (pageHeader2 != null) : flag2);
            if (this.m_needsHeaderHeight)
            {
                num2            += this.m_sectionPageSettings.HeaderHeight;
                availableHeight -= num2;
            }
            if (pageFooter != null)
            {
                availableHeight -= this.m_sectionPageSettings.FooterHeight;
            }
            bool flag4 = false;
            bool flag5 = false;

            this.m_reportSection.SetPage(this.m_pageContext.PageNumberRegion, this.m_pageContext.Common.GetTotalPagesRegion(pageNumber), pageNumber, totalPages);
            bool needsReportItemsOnPage = this.m_reportSection.NeedsReportItemsOnPage;
            bool flag6 = this.m_pageContext.PropertyCacheState != PageContext.CacheState.CountPages;

            this.m_pageContext.EvaluatePageHeaderFooter = false;
            if (needsReportItemsOnPage && flag6)
            {
                if (flag2 && !isFirstSectionOnPage)
                {
                    goto IL_015f;
                }
                if (this.HasHeaderOnPage(pageNumber, totalPages))
                {
                    goto IL_015f;
                }
                goto IL_0162;
            }
            goto IL_018a;
IL_018a:
            if (rplWriter != null)
            {
                this.m_columns = new List <ColumnDetail>(this.m_sectionPageSettings.Columns);
                this.WriteStartItemToStream(rplWriter);
            }
            long num3 = 0L;

            if (!this.Done)
            {
                double columnWidth = this.m_sectionPageSettings.ColumnWidth;
                this.m_pageContext.Common.Pagination.CurrentColumnWidth = columnWidth;
                this.m_columnHeight = availableHeight;
                this.m_pageContext.Common.Pagination.CurrentColumnHeight = this.m_columnHeight;
                int           num4           = 0;
                int           columns        = this.m_sectionPageSettings.Columns;
                RoundedDouble roundedDouble  = new RoundedDouble(this.m_topEdge);
                RoundedDouble roundedDouble2 = new RoundedDouble(this.m_leftEdge);
                this.m_pageContext.VerticalPageNumber = this.m_verticalPageNumber;
                while (num4 < columns)
                {
                    bool flag7 = false;
                    if (this.m_leftEdge == 0.0)
                    {
                        if (this.m_pageContext.TextBoxDuplicates != null)
                        {
                            this.m_pageContext.TextBoxDuplicates = null;
                            this.m_reportBody.ResolveDuplicates(this.m_pageContext, this.m_topEdge, null, false);
                        }
                        this.m_reportBody.CalculateVertical(this.m_pageContext, this.m_topEdge, this.m_topEdge + availableHeight, null, new List <PageItem>(), ref flag7, false);
                        this.m_verticalPageNumber++;
                        this.m_pageContext.VerticalPageNumber = this.m_verticalPageNumber;
                    }
                    flag7 = false;
                    this.m_reportBody.CalculateHorizontal(this.m_pageContext, this.m_leftEdge, this.m_leftEdge + columnWidth, null, new List <PageItem>(), ref flag7, false);
                    num3 = this.m_pageContext.PropertyCacheWriter.BaseStream.Position;
                    this.m_reportBody.AddToPage(rplWriter, this.m_pageContext, this.m_leftEdge, this.m_topEdge, this.m_leftEdge + columnWidth, this.m_topEdge + availableHeight, PageItem.RepeatState.None);
                    if (rplWriter != null)
                    {
                        rplWriter.RegisterSectionItemizedData();
                    }
                    this.m_pageContext.PropertyCacheWriter.BaseStream.Seek(num3, SeekOrigin.Begin);
                    if (rplWriter != null)
                    {
                        this.m_columns.Add(new ColumnDetail(0.0 - this.m_leftEdge, 0.0 - this.m_topEdge, this.m_reportBody));
                    }
                    this.m_leftEdge     += columnWidth;
                    roundedDouble2.Value = this.m_leftEdge;
                    if (num4 == 0 && this.m_reportBody.ItemPageSizes.Bottom - this.m_topEdge < availableHeight)
                    {
                        this.m_columnHeight = this.m_reportBody.ItemPageSizes.Bottom - this.m_topEdge;
                    }
                    if (roundedDouble2 >= this.m_reportBody.ItemPageSizes.Width)
                    {
                        this.m_leftEdge     = 0.0;
                        this.m_topEdge     += availableHeight;
                        roundedDouble.Value = this.m_topEdge;
                        this.m_reportBody.ResetHorizontal(true, null);
                        this.m_pageContext.Common.PaginatingHorizontally = false;
                    }
                    else
                    {
                        this.m_pageContext.Common.PaginatingHorizontally = true;
                    }
                    num4++;
                    if (roundedDouble >= this.m_reportBody.ItemPageSizes.Bottom)
                    {
                        this.m_reportBody = null;
                        this.m_topEdge    = 0.0;
                        this.m_leftEdge   = 0.0;
                        break;
                    }
                }
            }
            double num5 = availableHeight - this.m_columnHeight;

            if (this.Done && !flag && pageFooter != null && !flag3)
            {
                num5 += this.m_sectionPageSettings.FooterHeight;
            }
            bool flag8 = false;

            if (num5 < num || flag)
            {
                this.m_columnHeight = availableHeight;
                flag8 = true;
                num2 += this.m_sectionPageSettings.FooterHeight;
            }
            else if (flag3)
            {
                num2 += this.m_sectionPageSettings.FooterHeight;
            }
            this.m_itemPageSizes.Height = num2 + this.m_columnHeight;
            this.m_itemPageSizes.Top    = top;
            this.WriteColumns(rplWriter);
            this.m_columns = null;
            if (this.Done && flag && totalPages == 0)
            {
                totalPages = pageNumber;
            }
            if (flag6)
            {
                flag4 = ((!isFirstSectionOnPage) ? flag2 : this.HasHeaderOnPage(pageNumber, totalPages));
                flag5 = ((!flag8) ? flag3 : this.HasFooterOnPage(pageNumber, totalPages));
            }
            if (flag4 || flag5)
            {
                this.m_pageContext.Common.CheckPageNameChanged();
                this.m_reportSection.SetPageName(this.m_pageContext.PageName);
                this.m_reportSection.GetPageSections();
                if (flag4 && !this.IsHeaderUnknown(isFirstSectionOnPage, pageNumber, totalPages))
                {
                    this.RenderHeader(rplWriter);
                }
                else
                {
                    this.m_header = null;
                    flag4         = false;
                }
                if (flag5)
                {
                    this.RenderFooter(rplWriter);
                }
                else
                {
                    this.m_footer = null;
                }
                if (rplWriter != null && (flag4 || flag5))
                {
                    rplWriter.RegisterSectionHeaderFooter();
                }
            }
            if (!this.IsHeaderUnknown(isFirstSectionOnPage, pageNumber, totalPages))
            {
                this.WriteEndItemToStream(rplWriter);
                this.m_wroteEndToStream = true;
            }
            else
            {
                this.m_wroteEndToStream = false;
            }
            if (rplWriter != null)
            {
                rplWriter.RegisterPageItemizedData();
            }
            return(this.m_itemPageSizes.Height);

IL_015f:
            flag4 = true;
            goto IL_0162;
IL_0162:
            if (this.HasFooterOnPage(pageNumber, totalPages) || (flag3 && !flag))
            {
                flag5 = true;
            }
            if (flag4 || flag5)
            {
                this.m_pageContext.EvaluatePageHeaderFooter = true;
            }
            goto IL_018a;
        }