private void CalculatePropagatedPageBreak() { Microsoft.ReportingServices.ReportRendering.DataRegion dataRegion = (Microsoft.ReportingServices.ReportRendering.DataRegion)m_owner.RenderReportItem; bool thisOrAnscestorHasToggle = dataRegion.SharedHidden == Microsoft.ReportingServices.ReportRendering.SharedHiddenState.Sometimes; PageBreakLocation pageBreakLocation = PageBreakHelper.GetPageBreakLocation(dataRegion.PageBreakAtStart, dataRegion.PageBreakAtEnd); if (m_members != null && m_members.Count > 0) { pageBreakLocation = PageBreakHelper.MergePageBreakLocations(CalculatePropagatedPageBreak(m_members, thisOrAnscestorHasToggle, OwnerTablix.SnapshotTablixType == DataRegion.Type.Table), pageBreakLocation); } OwnerTablix.SetPageBreakLocation(pageBreakLocation); }
private PageBreakLocation CalculatePropagatedPageBreak(DataRegionMemberCollection <TablixMember> members, bool thisOrAnscestorHasToggle, bool isTable) { PageBreakLocation result = PageBreakLocation.None; bool flag = false; ShimTablixMember shimTablixMember = null; for (int i = 0; i < members.Count; i++) { ShimTablixMember shimTablixMember2 = (ShimTablixMember)members[i]; if (shimTablixMember2.IsStatic) { if (isTable) { if (shimTablixMember2.RepeatOnNewPage) { flag = true; } } else if (shimTablixMember2.Children != null && shimTablixMember2.Children.Count > 0) { result = CalculatePropagatedPageBreak(shimTablixMember2.Children, thisOrAnscestorHasToggle, isTable: false); } continue; } shimTablixMember = shimTablixMember2; break; } if (shimTablixMember != null) { thisOrAnscestorHasToggle |= (shimTablixMember.Visibility != null && shimTablixMember.Visibility.HiddenState == SharedHiddenState.Sometimes); PageBreakLocation pageBreakLocation = PageBreakLocation.None; Microsoft.ReportingServices.ReportRendering.Group currentShimRenderGroup = shimTablixMember.Group.CurrentShimRenderGroup; if (currentShimRenderGroup != null) { pageBreakLocation = PageBreakHelper.GetPageBreakLocation(currentShimRenderGroup.PageBreakAtStart, currentShimRenderGroup.PageBreakAtEnd); } if (shimTablixMember.Children != null) { pageBreakLocation = PageBreakHelper.MergePageBreakLocations(CalculatePropagatedPageBreak(shimTablixMember.Children, thisOrAnscestorHasToggle, isTable), pageBreakLocation); } shimTablixMember.SetPropagatedPageBreak(pageBreakLocation); if ((!isTable || flag) && pageBreakLocation != 0) { if (!thisOrAnscestorHasToggle) { result = pageBreakLocation; } shimTablixMember.SetPropagatedPageBreak(PageBreakLocation.Between); } } return(result); }