Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cleanup in BaseConverter.cs

  • Loading branch information...
commit d724ce4a2b9711fda185294452676ad69c2356fb 1 parent 4155ddd
@PeterForstmeier PeterForstmeier authored
View
52 src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/BaseConverter.cs
@@ -53,7 +53,6 @@ public class BaseConverter:IBaseConverter
}
-
#region PageBreak
protected void BuildNewPage(ExporterCollection myList,BaseSection section)
@@ -69,6 +68,7 @@ protected void FirePageFull (ExporterCollection items)
EventHelper.Raise<NewPageEventArgs>(PageFull,this,new NewPageEventArgs(items));
}
+
#endregion
@@ -105,6 +105,17 @@ protected static ExporterCollection ConvertItems (ISimpleContainer row,Point of
}
+ #region Grouping
+
+ protected Point ConvertGroupChilds(ExporterCollection mylist, BaseSection section, ISimpleContainer simpleContainer, int defaultLeftPos, Point currentPosition)
+ {
+ PrepareContainerForConverting(section,simpleContainer);
+ Point curPos = BaseConverter.BaseConvert(mylist,simpleContainer,defaultLeftPos,currentPosition);
+ AfterConverting (mylist);
+ return curPos;
+ }
+
+ #endregion
#region IBaseConverter
@@ -140,6 +151,8 @@ public virtual ExporterCollection Convert(BaseReportItem parent, BaseReportItem
public Graphics Graphics {get;set;}
#endregion
+
+
protected void SaveSize(Size size)
{
this.saveSize = size;
@@ -158,13 +171,6 @@ protected IExpressionEvaluatorFacade Evaluator
}
- protected void FillRow (ISimpleContainer row)
- {
- DataNavigator.Fill(row.Items);
- }
-
-
-
protected void PrepareContainerForConverting(BaseSection section,ISimpleContainer simpleContainer)
{
if (section != null) {
@@ -174,17 +180,41 @@ protected void PrepareContainerForConverting(BaseSection section,ISimpleContaine
}
- private void LayoutRow (ISimpleContainer row)
+ protected void AfterConverting (ExporterCollection convertedList)
{
- PrintHelper.SetLayoutForRow(Graphics,Layouter,row);
+ StandardPrinter.EvaluateRow(Evaluator,convertedList);
+// section.Items[0].Size = base.RestoreSize;
+// section.SectionOffset += section.Size.Height + 3 * GlobalValues.GapBetweenContainer;
}
-
+
+ protected Point ConvertStandardRow(ExporterCollection mylist, BaseSection section, ISimpleContainer simpleContainer, int defaultLeftPos, Point currentPosition)
+ {
+ FillRow(simpleContainer);
+ PrepareContainerForConverting(section,simpleContainer);
+ Point curPos = BaseConverter.BaseConvert(mylist,simpleContainer,defaultLeftPos,currentPosition);
+ AfterConverting (mylist);
+ return curPos;
+ }
+
+
protected static Point BaseConvert(ExporterCollection myList,ISimpleContainer container,int leftPos,Point curPos)
{
ExporterCollection ml = BaseConverter.ConvertItems (container, curPos);
myList.AddRange(ml);
return new Point (leftPos,curPos.Y + container.Size.Height + (3 *GlobalValues.GapBetweenContainer));
}
+
+
+ private void FillRow (ISimpleContainer row)
+ {
+ DataNavigator.Fill(row.Items);
+ }
+
+
+ private void LayoutRow (ISimpleContainer row)
+ {
+ PrintHelper.SetLayoutForRow(Graphics,Layouter,row);
+ }
}
}
View
43 src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/GroupedRowConverter.cs
@@ -22,8 +22,8 @@ public class GroupedRowConverter:BaseConverter
private BaseReportItem parent;
public GroupedRowConverter(IDataNavigator dataNavigator,
- ExporterPage singlePage, ILayouter layouter):base(dataNavigator,singlePage,layouter)
- {
+ ExporterPage singlePage, ILayouter layouter):base(dataNavigator,singlePage,layouter)
+ {
}
public override ExporterCollection Convert(BaseReportItem parent, BaseReportItem item)
@@ -45,7 +45,7 @@ public override ExporterCollection Convert(BaseReportItem parent, BaseReportItem
ExporterCollection myList = new ExporterCollection();
BaseConverter.BaseConvert (myList,simpleContainer,parent.Location.X,
- new Point(base.SectionBounds.DetailStart.X,base.SectionBounds.DetailStart.Y));
+ new Point(base.SectionBounds.DetailStart.X,base.SectionBounds.DetailStart.Y));
return myList;
} else {
@@ -63,7 +63,7 @@ private ExporterCollection ConvertDataRow (ISimpleContainer simpleContainer)
int defaultLeftPos = parent.Location.X;
Rectangle pageBreakRect = Rectangle.Empty;
-
+
do {
PrintHelper.AdjustSectionLocation (section);
@@ -85,9 +85,9 @@ private ExporterCollection ConvertDataRow (ISimpleContainer simpleContainer)
childNavigator.MoveNext();
//Convert children
- if (childNavigator != null) {
+ if (childNavigator != null) {
StandardPrinter.AdjustBackColor(simpleContainer,GlobalValues.DefaultBackColor);
-
+
do {
childNavigator.Fill(simpleContainer.Items);
@@ -173,41 +173,14 @@ private Point ConvertGroupHeader(ExporterCollection exportList,BaseSection secti
StandardPrinter.EvaluateRow(base.Evaluator,list);
exportList.AddRange(list);
- AfterConverting (section,list);
+ AfterConverting (list);
retVal = new Point (leftPos,offset.Y + groupCollection[0].Size.Height + 20 + (3 *GlobalValues.GapBetweenContainer));
} else {
retVal = ConvertStandardRow(exportList,section,groupedRow[0],leftPos,offset);
}
return retVal;
}
-
-
- private Point ConvertGroupChilds(ExporterCollection mylist, BaseSection section, ISimpleContainer simpleContainer, int defaultLeftPos, Point currentPosition)
- {
- PrepareContainerForConverting(section,simpleContainer);
- Point curPos = BaseConverter.BaseConvert(mylist,simpleContainer,defaultLeftPos,currentPosition);
- AfterConverting (section,mylist);
- return curPos;
- }
-
-
- private Point ConvertStandardRow(ExporterCollection mylist, BaseSection section, ISimpleContainer simpleContainer, int defaultLeftPos, Point currentPosition)
- {
- base.FillRow(simpleContainer);
- PrepareContainerForConverting(section,simpleContainer);
- Point curPos = BaseConverter.BaseConvert(mylist,simpleContainer,defaultLeftPos,currentPosition);
- AfterConverting (section,mylist);
- return curPos;
- }
-
-
- private void AfterConverting (BaseSection section,ExporterCollection mylist)
- {
- StandardPrinter.EvaluateRow(base.Evaluator,mylist);
- section.Items[0].Size = base.RestoreSize;
- section.SectionOffset += section.Size.Height + 3 * GlobalValues.GapBetweenContainer;
- }
-
+
private static void ShouldDrawBorder (BaseSection section,ExporterCollection list)
{
View
40 src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/GroupedTableConverter.cs
@@ -46,6 +46,8 @@ public override ExporterCollection Convert (BaseReportItem parent,BaseReportItem
private ExporterCollection ConvertInternal(ExporterCollection exporterCollection)
{
+ BaseSection section = table.Parent as BaseSection;
+
Point currentPosition = new Point(PrintHelper.DrawingAreaRelativeToParent(this.table.Parent,this.table).Location.X,
base.SectionBounds.DetailStart.Y);
@@ -89,7 +91,7 @@ private ExporterCollection ConvertInternal(ExporterCollection exporterCollection
base.Evaluator.SinglePage.IDataNavigator = childNavigator;
// Convert Grouping Header
- currentPosition = ConvertGroupHeader(exporterCollection,(BaseSection)table.Parent,defaultLeftPos,currentPosition);
+ currentPosition = ConvertGroupHeader(exporterCollection,section,defaultLeftPos,currentPosition);
childNavigator.Reset();
childNavigator.MoveNext();
@@ -103,7 +105,8 @@ private ExporterCollection ConvertInternal(ExporterCollection exporterCollection
childNavigator.Fill(simpleContainer.Items);
- currentPosition = ConvertGroupChilds (exporterCollection,(BaseSection)table.Parent,
+ currentPosition = ConvertGroupChilds (exporterCollection,
+ section,
simpleContainer,defaultLeftPos,currentPosition);
}
@@ -119,14 +122,11 @@ private ExporterCollection ConvertInternal(ExporterCollection exporterCollection
{
// No Grouping at all
- // DataRegion
-
base.SaveSize(simpleContainer.Size);
simpleContainer = table.Items[1] as ISimpleContainer;
do {
- //
- BaseSection section = this.table.Parent as BaseSection;
+
PrintHelper.AdjustSectionLocation(section);
pageBreakRect = PrintHelper.CalculatePageBreakRectangle((BaseReportItem)simpleContainer,currentPosition);
@@ -160,6 +160,7 @@ private ExporterCollection ConvertInternal(ExporterCollection exporterCollection
//Copy from GroupedRow
+
private Point ConvertGroupHeader(ExporterCollection exportList,BaseSection section,int leftPos,Point offset)
{
var retVal = Point.Empty;
@@ -176,7 +177,7 @@ private Point ConvertGroupHeader(ExporterCollection exportList,BaseSection secti
StandardPrinter.EvaluateRow(base.Evaluator,list);
exportList.AddRange(list);
- AfterConverting (section,list);
+ AfterConverting (list);
retVal = new Point (leftPos,offset.Y + groupCollection[0].Size.Height + 20 + (3 *GlobalValues.GapBetweenContainer));
} else {
retVal = ConvertStandardRow(exportList,section,groupedRow[0],leftPos,offset);
@@ -184,31 +185,6 @@ private Point ConvertGroupHeader(ExporterCollection exportList,BaseSection secti
return retVal;
}
-
- private Point ConvertGroupChilds(ExporterCollection mylist, BaseSection section, ISimpleContainer simpleContainer, int defaultLeftPos, Point currentPosition)
- {
- PrepareContainerForConverting(section,simpleContainer);
- Point curPos = BaseConverter.BaseConvert(mylist,simpleContainer,defaultLeftPos,currentPosition);
- AfterConverting (section,mylist);
- return curPos;
- }
-
- private void AfterConverting (BaseSection section,ExporterCollection mylist)
- {
- Console.WriteLine("AfterConverting");
- StandardPrinter.EvaluateRow(base.Evaluator,mylist);
-// section.Items[0].Size = base.RestoreSize;
-// section.SectionOffset += section.Size.Height + 3 * GlobalValues.GapBetweenContainer;
- }
-
- private Point ConvertStandardRow(ExporterCollection mylist, BaseSection section, ISimpleContainer simpleContainer, int defaultLeftPos, Point currentPosition)
- {
- base.FillRow(simpleContainer);
- PrepareContainerForConverting(section,simpleContainer);
- Point curPos = BaseConverter.BaseConvert(mylist,simpleContainer,defaultLeftPos,currentPosition);
- AfterConverting (section,mylist);
- return curPos;
- }
}
}
View
4 src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/TableConverter.cs
@@ -78,7 +78,7 @@ private ExporterCollection ConvertInternal(ExporterCollection mylist)
BaseSection section = this.baseTable.Parent as BaseSection;
PrintHelper.AdjustSectionLocation(section);
- base.FillRow(simpleContainer);
+// base.FillRow(simpleContainer);
StandardPrinter.EvaluateRow(base.Evaluator,mylist);
@@ -154,7 +154,7 @@ private ExporterCollection old_ConvertInternal(ExporterCollection mylist)
BaseSection section = this.baseTable.Parent as BaseSection;
PrintHelper.AdjustSectionLocation(section);
- base.FillRow(simpleContainer);
+// base.FillRow(simpleContainer);
StandardPrinter.EvaluateRow(base.Evaluator,mylist);
Please sign in to comment.
Something went wrong with that request. Please try again.