public void CalculateDelayedFooter(RPLWriter rplWriter, Interactivity interactivity)
        {
            PageSection pageFooter  = this.m_reportSectionDef.Page.PageFooter;
            PageContext pageContext = new PageContext(this.m_pageContext, PageContext.PageContextFlags.FullOnPage, PageContext.IgnorePBReasonFlag.HeaderFooter);

            pageContext.RPLSectionArea = PageContext.RPLReportSectionArea.Footer;
            this.m_footer = new PageHeadFoot(pageFooter, this.m_reportSectionDef.Width, pageContext);
            this.m_footer.CalculateItem(rplWriter, pageContext, false, interactivity, true);
            this.m_itemsOnPage++;
        }
 public void Reset()
 {
     this.m_header           = null;
     this.m_footer           = null;
     this.m_rplReportSection = null;
     this.m_bodyOffset       = 0L;
     this.m_offset           = 0L;
     this.m_itemRenderSizes  = null;
     this.m_sectionIndex     = -1;
     this.m_bodyHelper       = null;
     this.m_itemsOnPage      = 0;
     if (this.Done)
     {
         this.m_body = null;
     }
 }
        private void WriteEndItemToRPLStream2008(BinaryWriter spbifWriter, int itemsOnPage, PageHeadFoot header, PageHeadFoot footer, double reportWidth, double reportHeight)
        {
            Stream baseStream = spbifWriter.BaseStream;

            if (header != null)
            {
                reportWidth = Math.Max(reportWidth, header.ItemRenderSizes.Width);
            }
            if (footer != null)
            {
                reportWidth = Math.Max(reportWidth, footer.ItemRenderSizes.Width);
            }
            long position = baseStream.Position;

            spbifWriter.Write((byte)16);
            spbifWriter.Write(this.m_pageContentOffset);
            spbifWriter.Write(itemsOnPage);
            spbifWriter.Write(0f);
            spbifWriter.Write(0f);
            spbifWriter.Write((float)reportWidth);
            spbifWriter.Write((float)reportHeight);
            spbifWriter.Write(0);
            spbifWriter.Write((byte)0);
            spbifWriter.Write(this.m_columnsOffset);
            if (header != null)
            {
                header.ItemRenderSizes.Width = reportWidth;
                header.WritePageItemRenderSizes(spbifWriter);
            }
            if (footer != null)
            {
                footer.ItemRenderSizes.Width = reportWidth;
                footer.WritePageItemRenderSizes(spbifWriter);
            }
            this.m_pageContentOffset = baseStream.Position;
            spbifWriter.Write((byte)254);
            spbifWriter.Write(position);
            spbifWriter.Write((byte)255);
            long position2 = baseStream.Position;

            spbifWriter.Write((byte)18);
            spbifWriter.Write(this.m_offset);
            spbifWriter.Write(1);
            spbifWriter.Write(this.m_pageContentOffset);
            spbifWriter.Write((byte)254);
            spbifWriter.Write(position2);
            spbifWriter.Write((byte)255);
        }
 public void WriteEndItemToStream(RPLWriter rplWriter, int sectionStartIndex, int itemsOnPage, PageHeadFoot header, PageHeadFoot footer, double bodyWidth, double bodyHeight, string pageName)
 {
     if (rplWriter != null)
     {
         BinaryWriter binaryWriter = rplWriter.BinaryWriter;
         if (binaryWriter != null)
         {
             if (this.m_pageContext.VersionPicker == RPLVersionEnum.RPL2008 || this.m_pageContext.VersionPicker == RPLVersionEnum.RPL2008WithImageConsolidation)
             {
                 this.WriteEndItemToRPLStream2008(binaryWriter, itemsOnPage, header, footer, bodyWidth, bodyHeight);
             }
             else
             {
                 this.WriteEndItemToRPLStream(binaryWriter, pageName);
             }
         }
         else
         {
             this.WriteEndItemToRPLOM(rplWriter, sectionStartIndex, pageName);
         }
     }
 }
        public bool CalculatePage(RPLWriter rplWriter, int page, int totalPages, int regionPageNumber, int regionTotalPages, bool firstSectionOnPage, bool lastSection, Interactivity interactivity, double heightToBeUsed, ref PageItemHelper lastBodyInfo, ref bool delayedHeader, ref bool delayedFooter, ref bool lastSectionOnPage)
        {
            this.m_pageContext.EvaluatePageHeaderFooter = false;
            PageSection pageHeader = this.m_reportSectionDef.Page.PageHeader;
            PageSection pageFooter = this.m_reportSectionDef.Page.PageFooter;
            bool        flag       = false;
            bool        flag2      = false;

            if (pageHeader != null || pageFooter != null)
            {
                this.m_reportSectionDef.SetPage(regionPageNumber, regionTotalPages, page, totalPages);
            }
            if ((rplWriter != null || (interactivity != null && !interactivity.Done && interactivity.NeedPageHeaderFooter)) && this.m_reportSectionDef.NeedsReportItemsOnPage)
            {
                this.InitialCheckForHeader(pageHeader, page, totalPages, firstSectionOnPage, ref flag);
                this.InitialCheckForFooter(pageFooter, page, totalPages, lastSection, ref flag2);
                if (flag || flag2)
                {
                    this.m_pageContext.EvaluatePageHeaderFooter = true;
                }
            }
            this.WriteStartItemToStream(rplWriter);
            double num = 0.0;

            this.m_body.UpdateItem(lastBodyInfo);
            this.m_body.CalculatePage(rplWriter, lastBodyInfo, this.m_pageContext, null, null, 0.0, ref num, interactivity);
            this.m_pageContext.ApplyPageName(page);
            this.m_itemsOnPage++;
            if (this.m_pageContext.CancelPage)
            {
                this.m_body = null;
                return(false);
            }
            this.WriteBodyColumnsToStream(rplWriter);
            this.CreateReportSectionSizes(rplWriter);
            this.CheckForLastSectionOnPage(heightToBeUsed, lastSection, ref lastSectionOnPage);
            if (rplWriter != null || (interactivity != null && !interactivity.Done && interactivity.NeedPageHeaderFooter))
            {
                if (!this.m_reportSectionDef.NeedsReportItemsOnPage)
                {
                    this.InitialCheckForHeader(pageHeader, page, totalPages, firstSectionOnPage, ref flag);
                    this.InitialCheckForFooter(pageFooter, page, totalPages, lastSection, ref flag2);
                }
                this.FinalCheckForHeader(pageHeader, page, lastSection && this.Done, firstSectionOnPage, ref flag);
                this.FinalCheckForFooter(pageFooter, page, lastSection && this.Done, lastSectionOnPage, ref flag2);
                if (pageHeader != null || pageFooter != null)
                {
                    string pageName = this.m_pageContext.PageTotalInfo.GetPageName(page);
                    this.m_reportSectionDef.SetPageName(pageName);
                    this.m_reportSectionDef.GetPageSections();
                }
                PageContext pageContext = new PageContext(this.m_pageContext, PageContext.PageContextFlags.FullOnPage, PageContext.IgnorePBReasonFlag.HeaderFooter);
                if (flag2)
                {
                    if ((this.m_pageContext.VersionPicker == RPLVersionEnum.RPL2008 || pageContext.VersionPicker == RPLVersionEnum.RPL2008WithImageConsolidation) && lastSectionOnPage)
                    {
                        delayedFooter = true;
                    }
                    if (!delayedFooter)
                    {
                        pageContext.RPLSectionArea = PageContext.RPLReportSectionArea.Footer;
                        this.m_footer = new PageHeadFoot(pageFooter, this.m_reportSectionDef.Width, pageContext);
                        if (this.m_pageContext.VersionPicker == RPLVersionEnum.RPL2008 || this.m_pageContext.VersionPicker == RPLVersionEnum.RPL2008WithImageConsolidation)
                        {
                            this.m_footer.CalculateItem(rplWriter, pageContext, false, interactivity, false);
                        }
                        else
                        {
                            this.m_footer.CalculateItem(rplWriter, pageContext, false, interactivity, true);
                        }
                        this.m_itemsOnPage++;
                    }
                    if (this.m_pageContext.CancelPage)
                    {
                        this.m_body   = null;
                        this.m_footer = null;
                        return(false);
                    }
                }
                if (flag)
                {
                    if (this.m_pageContext.VersionPicker == RPLVersionEnum.RPL2008 || pageContext.VersionPicker == RPLVersionEnum.RPL2008WithImageConsolidation)
                    {
                        if (firstSectionOnPage)
                        {
                            delayedHeader = true;
                        }
                    }
                    else if (page > 1 && firstSectionOnPage && !pageHeader.PrintOnLastPage && !this.m_pageContext.AddFirstPageHeaderFooter)
                    {
                        delayedHeader = true;
                    }
                    if (!delayedHeader)
                    {
                        pageContext.RPLSectionArea = PageContext.RPLReportSectionArea.Header;
                        this.m_header = new PageHeadFoot(pageHeader, this.m_reportSectionDef.Width, pageContext);
                        if (this.m_pageContext.VersionPicker == RPLVersionEnum.RPL2008 || this.m_pageContext.VersionPicker == RPLVersionEnum.RPL2008WithImageConsolidation)
                        {
                            this.m_header.CalculateItem(rplWriter, pageContext, true, interactivity, false);
                        }
                        else
                        {
                            this.m_header.CalculateItem(rplWriter, pageContext, true, interactivity, true);
                        }
                        this.m_itemsOnPage++;
                    }
                    if (this.m_pageContext.CancelPage)
                    {
                        this.m_body   = null;
                        this.m_footer = null;
                        this.m_header = null;
                        return(false);
                    }
                }
            }
            if (!delayedHeader || this.m_pageContext.VersionPicker == RPLVersionEnum.RPL2008 || this.m_pageContext.VersionPicker == RPLVersionEnum.RPL2008WithImageConsolidation)
            {
                this.UpdateReportSectionSizes(rplWriter);
                this.WriteEndItemToStream(rplWriter);
            }
            lastBodyInfo = null;
            return(true);
        }