Browse Source

Refactor Converters/GroupedRowConverter.cs for better Pagebreak

pull/1/head
peterforstmeier 15 years ago
parent
commit
8182b94643
  1. 46
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/GroupedRowConverter.cs

46
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/GroupedRowConverter.cs

@ -90,7 +90,7 @@ namespace ICSharpCode.Reports.Core.Exporter
do { do {
currentPosition = ConvertGroupChilds (exporterCollection,section,simpleContainer,defaultLeftPos,currentPosition); currentPosition = ConvertGroupChilds (exporterCollection,section,simpleContainer,defaultLeftPos,currentPosition);
curRect = new Rectangle(new Point (simpleContainer.Location.X,currentPosition.Y), section.Size); curRect = PageBreakRectangle((BaseReportItem)section.Items[1],currentPosition,section);
if (PrintHelper.IsPageFull(curRect,base.SectionBounds )) { if (PrintHelper.IsPageFull(curRect,base.SectionBounds )) {
BuildNewPage(exporterCollection,section); BuildNewPage(exporterCollection,section);
@ -99,16 +99,15 @@ namespace ICSharpCode.Reports.Core.Exporter
} }
while ( base.DataNavigator.ChildMoveNext()); while ( base.DataNavigator.ChildMoveNext());
} }
} }
else else
{ {
// No Grouping // No Grouping
currentPosition = ConvertStandardRow (exporterCollection,section,simpleContainer,defaultLeftPos,currentPosition); currentPosition = ConvertStandardRow (exporterCollection,section,simpleContainer,defaultLeftPos,currentPosition);
} }
curRect = PageBreakRectangle((BaseReportItem)section.Items[0],currentPosition,section);
curRect = new Rectangle(new Point (simpleContainer.Location.X,currentPosition.Y), section.Size); //PageBreakNeeded(exporterCollection,section,curRect,currentPosition);
if (PrintHelper.IsPageFull(curRect,base.SectionBounds)) { if (PrintHelper.IsPageFull(curRect,base.SectionBounds)) {
BuildNewPage(exporterCollection,section); BuildNewPage(exporterCollection,section);
currentPosition = CalculateStartPosition (); currentPosition = CalculateStartPosition ();
@ -127,6 +126,12 @@ namespace ICSharpCode.Reports.Core.Exporter
} }
Rectangle PageBreakRectangle(BaseReportItem simpleContainer,Point curPos,BaseSection section)
{
return new Rectangle(new Point (simpleContainer.Location.X,curPos.Y), simpleContainer.Size);
}
private Point CalculateStartPosition() private Point CalculateStartPosition()
{ {
@ -162,6 +167,28 @@ namespace ICSharpCode.Reports.Core.Exporter
if (section.Items.IsGrouped) { if (section.Items.IsGrouped) {
currentPosition = ConvertGroupHeader(mylist,section,simpleContainer,defaultLeftPos,currentPosition); currentPosition = ConvertGroupHeader(mylist,section,simpleContainer,defaultLeftPos,currentPosition);
//
if (base.DataNavigator.HasChildren) {
StandardPrinter.AdjustBackColor(simpleContainer,GlobalValues.DefaultBackColor);
base.DataNavigator.SwitchGroup();
do {
currentPosition = ConvertGroupChilds (mylist,section,simpleContainer,defaultLeftPos,currentPosition);
}
while ( base.DataNavigator.ChildMoveNext());
}
// end grouping -----------------
if (PrintHelper.IsPageFull(new Rectangle(new Point (simpleContainer.Location.X,currentPosition.Y), section.Size),base.SectionBounds)) {
base.FirePageFull(mylist);
section.SectionOffset = base.SinglePage.SectionBounds.PageHeaderRectangle.Location.Y;
currentPosition = new Point(base.SectionBounds.PageHeaderRectangle.X,base.SectionBounds.PageHeaderRectangle.Y);
mylist.Clear();
}
//
} }
else else
{ {
@ -169,15 +196,14 @@ namespace ICSharpCode.Reports.Core.Exporter
currentPosition = ConvertStandardRow (mylist,section,simpleContainer,defaultLeftPos,currentPosition); currentPosition = ConvertStandardRow (mylist,section,simpleContainer,defaultLeftPos,currentPosition);
} }
// Group Children ---------------------- // Group Children ----------------------
/*
if (base.DataNavigator.HasChildren) { if (base.DataNavigator.HasChildren) {
StandardPrinter.AdjustBackColor(simpleContainer,GlobalValues.DefaultBackColor); StandardPrinter.AdjustBackColor(simpleContainer,GlobalValues.DefaultBackColor);
base.DataNavigator.SwitchGroup(); base.DataNavigator.SwitchGroup();
do { do {
// currentPosition = ConvertGroupChilds (mylist,section,simpleContainer,defaultLeftPos,currentPosition); currentPosition = ConvertGroupChilds (mylist,section,simpleContainer,defaultLeftPos,currentPosition);
} }
while ( base.DataNavigator.ChildMoveNext()); while ( base.DataNavigator.ChildMoveNext());
} }
@ -190,7 +216,7 @@ namespace ICSharpCode.Reports.Core.Exporter
currentPosition = new Point(base.SectionBounds.PageHeaderRectangle.X,base.SectionBounds.PageHeaderRectangle.Y); currentPosition = new Point(base.SectionBounds.PageHeaderRectangle.X,base.SectionBounds.PageHeaderRectangle.Y);
mylist.Clear(); mylist.Clear();
} }
*/
ShouldDrawBorder (section,mylist); ShouldDrawBorder (section,mylist);
} }
@ -245,9 +271,7 @@ namespace ICSharpCode.Reports.Core.Exporter
{ {
base.DataNavigator.FillChild(simpleContainer.Items); base.DataNavigator.FillChild(simpleContainer.Items);
PrepareContainerForConverting(section,simpleContainer); PrepareContainerForConverting(section,simpleContainer);
// base.FireSectionRendering(section);
Point curPos = BaseConverter.BaseConvert(mylist,simpleContainer,defaultLeftPos,currentPosition); Point curPos = BaseConverter.BaseConvert(mylist,simpleContainer,defaultLeftPos,currentPosition);
// StandardPrinter.EvaluateRow(base.Evaluator,mylist);
AfterConverting (section,mylist); AfterConverting (section,mylist);
return curPos; return curPos;
} }

Loading…
Cancel
Save