Exemple #1
0
        internal 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)
        {
            m_pageContext.EvaluatePageHeaderFooter = false;
            PageSection pageHeader   = m_reportSectionDef.Page.PageHeader;
            PageSection pageFooter   = m_reportSectionDef.Page.PageFooter;
            bool        renderHeader = false;
            bool        renderFooter = false;

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

            m_body.UpdateItem(lastBodyInfo);
            m_body.CalculatePage(rplWriter, lastBodyInfo, m_pageContext, null, null, 0.0, ref parentHeight, interactivity);
            m_pageContext.ApplyPageName(page);
            m_itemsOnPage++;
            if (m_pageContext.CancelPage)
            {
                m_body = null;
                return(false);
            }
            WriteBodyColumnsToStream(rplWriter);
            CreateReportSectionSizes(rplWriter);
            CheckForLastSectionOnPage(heightToBeUsed, lastSection, ref lastSectionOnPage);
            if (rplWriter != null || (interactivity != null && !interactivity.Done && interactivity.NeedPageHeaderFooter))
            {
                if (!m_reportSectionDef.NeedsReportItemsOnPage)
                {
                    InitialCheckForHeader(pageHeader, page, totalPages, firstSectionOnPage, ref renderHeader);
                    InitialCheckForFooter(pageFooter, page, totalPages, lastSection, ref renderFooter);
                }
                FinalCheckForHeader(pageHeader, page, lastSection && Done, firstSectionOnPage, ref renderHeader);
                FinalCheckForFooter(pageFooter, page, lastSection && Done, lastSectionOnPage, ref renderFooter);
                if (pageHeader != null || pageFooter != null)
                {
                    string pageName = m_pageContext.PageTotalInfo.GetPageName(page);
                    m_reportSectionDef.SetPageName(pageName);
                    m_reportSectionDef.GetPageSections();
                }
                PageContext pageContext = new PageContext(m_pageContext, PageContext.PageContextFlags.FullOnPage, PageContext.IgnorePBReasonFlag.HeaderFooter);
                if (renderFooter)
                {
                    if ((m_pageContext.VersionPicker == RPLVersionEnum.RPL2008 || pageContext.VersionPicker == RPLVersionEnum.RPL2008WithImageConsolidation) & lastSectionOnPage)
                    {
                        delayedFooter = true;
                    }
                    if (!delayedFooter)
                    {
                        pageContext.RPLSectionArea = PageContext.RPLReportSectionArea.Footer;
                        m_footer = new PageHeadFoot(pageFooter, m_reportSectionDef.Width, pageContext);
                        if (m_pageContext.VersionPicker == RPLVersionEnum.RPL2008 || m_pageContext.VersionPicker == RPLVersionEnum.RPL2008WithImageConsolidation)
                        {
                            m_footer.CalculateItem(rplWriter, pageContext, isHeader: false, interactivity, native: false);
                        }
                        else
                        {
                            m_footer.CalculateItem(rplWriter, pageContext, isHeader: false, interactivity, native: true);
                        }
                        m_itemsOnPage++;
                    }
                    if (m_pageContext.CancelPage)
                    {
                        m_body   = null;
                        m_footer = null;
                        return(false);
                    }
                }
                if (renderHeader)
                {
                    if (m_pageContext.VersionPicker == RPLVersionEnum.RPL2008 || pageContext.VersionPicker == RPLVersionEnum.RPL2008WithImageConsolidation)
                    {
                        if (firstSectionOnPage)
                        {
                            delayedHeader = true;
                        }
                    }
                    else if (page > 1 && firstSectionOnPage && !pageHeader.PrintOnLastPage && !m_pageContext.AddFirstPageHeaderFooter)
                    {
                        delayedHeader = true;
                    }
                    if (!delayedHeader)
                    {
                        pageContext.RPLSectionArea = PageContext.RPLReportSectionArea.Header;
                        m_header = new PageHeadFoot(pageHeader, m_reportSectionDef.Width, pageContext);
                        if (m_pageContext.VersionPicker == RPLVersionEnum.RPL2008 || m_pageContext.VersionPicker == RPLVersionEnum.RPL2008WithImageConsolidation)
                        {
                            m_header.CalculateItem(rplWriter, pageContext, isHeader: true, interactivity, native: false);
                        }
                        else
                        {
                            m_header.CalculateItem(rplWriter, pageContext, isHeader: true, interactivity, native: true);
                        }
                        m_itemsOnPage++;
                    }
                    if (m_pageContext.CancelPage)
                    {
                        m_body   = null;
                        m_footer = null;
                        m_header = null;
                        return(false);
                    }
                }
            }
            if (!delayedHeader || m_pageContext.VersionPicker == RPLVersionEnum.RPL2008 || m_pageContext.VersionPicker == RPLVersionEnum.RPL2008WithImageConsolidation)
            {
                UpdateReportSectionSizes(rplWriter);
                WriteEndItemToStream(rplWriter);
            }
            lastBodyInfo = null;
            return(true);
        }
        internal 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 = 2.5399999618530273 + sectionPaginationSettings.FooterHeight;
                PageSection pageHeader = nextSection.ROMReportSection.Page.PageHeader;
                if (pageHeader != null && pageHeader.PrintBetweenSections)
                {
                    num += sectionPaginationSettings.HeaderHeight;
                }
            }
            double      num2        = 0.0;
            PageSection pageHeader2 = m_reportSection.Page.PageHeader;
            PageSection pageFooter  = m_reportSection.Page.PageFooter;
            bool        flag2       = pageHeader2?.PrintBetweenSections ?? false;
            bool        flag3       = pageFooter?.PrintBetweenSections ?? false;

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

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

            m_pageContext.EvaluatePageHeaderFooter = false;
            if (needsReportItemsOnPage && flag6)
            {
                if ((flag2 && !isFirstSectionOnPage) || HasHeaderOnPage(pageNumber, totalPages))
                {
                    flag4 = true;
                }
                if (HasFooterOnPage(pageNumber, totalPages) || (flag3 && !flag))
                {
                    flag5 = true;
                }
                if (flag4 || flag5)
                {
                    m_pageContext.EvaluatePageHeaderFooter = true;
                }
            }
            if (rplWriter != null)
            {
                m_columns = new List <ColumnDetail>(m_sectionPageSettings.Columns);
                WriteStartItemToStream(rplWriter);
            }
            long num3 = 0L;

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

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

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