internal ReportSection(Microsoft.ReportingServices.OnDemandReportRendering.ReportSection reportSection, PageContext pageContext, PaginationSettings paginationSettings, SectionPaginationSettings sectionPaginationSettings)
 {
     m_reportSection       = reportSection;
     m_pageContext         = pageContext;
     m_pageSettings        = paginationSettings;
     m_sectionPageSettings = sectionPaginationSettings;
 }
Example #2
0
        private void Init(Microsoft.ReportingServices.OnDemandReportRendering.Report report)
        {
            Page page = report.ReportSections[0].Page;

            PageHeightStr = page.PageHeight.ToString();
            PageWidthStr  = page.PageWidth.ToString();
            MarginTop     = page.TopMargin.ToMillimeters();
            MarginLeft    = page.LeftMargin.ToMillimeters();
            MarginBottom  = page.BottomMargin.ToMillimeters();
            MarginRight   = page.RightMargin.ToMillimeters();
            int count = report.ReportSections.Count;

            m_sectionPaginationSettings = new SectionPaginationSettings[count];
            for (int i = 0; i < count; i++)
            {
                m_sectionPaginationSettings[i] = new SectionPaginationSettings(report.ReportSections[i]);
            }
        }
        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);
        }