From 3112eb55fa9ca5f8947761b0014fd668736ccb5a Mon Sep 17 00:00:00 2001 From: peterforstmeier Date: Sun, 5 Sep 2010 20:01:40 +0200 Subject: [PATCH] Adjust ListLayout --- .../ReportLayout/AbstractLayout.cs | 13 ++- .../ReportWizard/ReportLayout/ListLayout.cs | 24 ++--- .../Project/Exporter/BasePager.cs | 8 +- .../Converters/GroupedRowConverter.cs | 87 +------------------ 4 files changed, 21 insertions(+), 111 deletions(-) diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/ReportLayout/AbstractLayout.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/ReportLayout/AbstractLayout.cs index 21d5de2cbf..6969d34dd6 100644 --- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/ReportLayout/AbstractLayout.cs +++ b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/ReportLayout/AbstractLayout.cs @@ -160,19 +160,18 @@ namespace ICSharpCode.Reports.Addin.ReportWizard } - protected void AddItemsToContainer (ICSharpCode.Reports.Core.BaseSection section,ReportItemCollection items,Point start) + protected void AddItemsToContainer (ICSharpCode.Reports.Core.BaseSection section,ReportItemCollection items) { section.Items.Add(this.parentItem as BaseReportItem); + int locationY = 10; + int locationX = this.parentItem.Location.X + GlobalValues.ControlMargins.Left; + int minCtrlWidth = this.parentItem.Size.Width / items.Count; - int defY = this.parentItem.Location.Y + start.Y; - int defX = this.parentItem.Size.Width / items.Count; - int startX = this.parentItem.Location.X + GlobalValues.ControlMargins.Left; foreach (var ir in items) { - Point np = new Point(startX,defY); - startX += defX; - ir.Location = np; + ir.Location = new Point(locationX,locationY); this.parentItem.Items.Add(ir); + locationX += minCtrlWidth; } } diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/ReportLayout/ListLayout.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/ReportLayout/ListLayout.cs index 868d87c1df..df928da8f3 100644 --- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/ReportLayout/ListLayout.cs +++ b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/ReportLayout/ListLayout.cs @@ -47,15 +47,17 @@ namespace ICSharpCode.Reports.Addin.ReportWizard if (section == null) { throw new ArgumentNullException("section"); } - - Point p = new Point (5,5); + if (base.ReportModel.ReportSettings.GroupColumnsCollection.Count > 0) { - p = InsertGroupHeader(); - AdjustParent(section); + InsertGroupHeader(); + ParentItem.Location = new Point(ParentItem.Location.X,50); + ParentItem.Size = new Size(ParentItem.Size.Width,40); + section.Size = new Size(section.Size.Width,100); } if (base.ParentItem != null) { - base.AddItemsToContainer(base.ReportModel.DetailSection,this.reportItems,p); + base.AddItemsToContainer(base.ReportModel.DetailSection,this.reportItems); + ParentItem.Size = new Size(ParentItem.Size.Width,40); } else{ AddItemsToSection (base.ReportModel.DetailSection,this.reportItems); @@ -64,14 +66,7 @@ namespace ICSharpCode.Reports.Addin.ReportWizard } - void AdjustParent(ICSharpCode.Reports.Core.BaseSection section) - { - base.ParentItem.Size = new Size(base.ParentItem.Size.Width,base.ParentItem.Size.Height + 30); - section.Size = new Size(section.Size.Width,section.Size.Height + 30); - } - - - private Point InsertGroupHeader() + private void InsertGroupHeader() { ICSharpCode.Reports.Core.BaseDataItem dataItem = new ICSharpCode.Reports.Core.BaseDataItem(); dataItem.ColumnName = base.ReportModel.ReportSettings.GroupColumnsCollection[0].ColumnName; @@ -81,11 +76,10 @@ namespace ICSharpCode.Reports.Addin.ReportWizard dataItem.Text = base.ReportModel.ReportSettings.GroupColumnsCollection[0].ColumnName; ICSharpCode.Reports.Core.BaseGroupedRow groupHeader = new ICSharpCode.Reports.Core.BaseGroupedRow(); - groupHeader.Location = new Point(10,10); + groupHeader.Location = new Point(5,10); groupHeader.Size = new Size (300,30); groupHeader.Items.Add(dataItem); base.ReportModel.DetailSection.Items.Add(groupHeader); - return new Point (5,45); } #endregion diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/BasePager.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/BasePager.cs index f3fd805209..07411b6bac 100644 --- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/BasePager.cs +++ b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/BasePager.cs @@ -224,12 +224,12 @@ namespace ICSharpCode.Reports.Core.Exporter } } ExportText et = be as ExportText; - if (et != null) {Console.WriteLine("nav {0}",evaluatorFassade.SinglePage.IDataNavigator.CurrentRow); - -// et.Text = evaluatorFassade.Evaluate(et.Text); + if (et != null) { + Console.WriteLine("nav {0}",evaluatorFassade.SinglePage.IDataNavigator.CurrentRow); + Console.WriteLine("-- {0}",et.Text); + et.Text = evaluatorFassade.Evaluate(et.Text); } } - } diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/GroupedRowConverter.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/GroupedRowConverter.cs index 5ca539eb05..c93c003832 100644 --- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/GroupedRowConverter.cs +++ b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/GroupedRowConverter.cs @@ -148,89 +148,6 @@ namespace ICSharpCode.Reports.Core.Exporter } - - private ExporterCollection old_ConvertDataRow (ISimpleContainer simpleContainer) - { - ExporterCollection mylist = new ExporterCollection(); - Point currentPosition = new Point(base.SectionBounds.DetailStart.X,base.SectionBounds.DetailStart.Y); - BaseSection section = parent as BaseSection; - - int defaultLeftPos = parent.Location.X; - - do { - - PrintHelper.AdjustSectionLocation (section); - section.Size = this.SectionBounds.DetailSectionRectangle.Size; - base.SaveSize(section.Items[0].Size); - - // Grouping Header - - if (section.Items.IsGrouped) { - 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 - { - // No Grouping - currentPosition = ConvertStandardRow (mylist,section,simpleContainer,defaultLeftPos,currentPosition); - } - - // Group Children ---------------------- - /* - 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(); - } - */ - ShouldDrawBorder (section,mylist); - - } - while (base.DataNavigator.MoveNext()); - - SectionBounds.ReportFooterRectangle = new Rectangle(SectionBounds.ReportFooterRectangle.Left, - section.Location.Y + section.Size.Height, - SectionBounds.ReportFooterRectangle.Width, - SectionBounds.ReportFooterRectangle.Height); - return mylist; - } - - - private Point ConvertGroupHeader(ExporterCollection mylist,BaseSection section,ISimpleContainer simpleContainer,int leftPos,Point offset) { Point retVal = Point.Empty; @@ -241,7 +158,7 @@ namespace ICSharpCode.Reports.Core.Exporter base.DataNavigator.Fill(groupCollection); base.FireSectionRendering(section); ExporterCollection list = StandardPrinter.ConvertPlainCollection(groupCollection,offset); -// StandardPrinter.EvaluateRow(base.Evaluator,list); + StandardPrinter.EvaluateRow(base.Evaluator,list); mylist.AddRange(list); AfterConverting (section,list); retVal = new Point (leftPos,offset.Y + groupCollection[0].Size.Height + 20 + (3 *GlobalValues.GapBetweenContainer)); @@ -259,7 +176,7 @@ namespace ICSharpCode.Reports.Core.Exporter base.DataNavigator.Fill(groupCollection); base.FireSectionRendering(section); ExporterCollection list = StandardPrinter.ConvertPlainCollection(groupCollection,offset); -// StandardPrinter.EvaluateRow(base.Evaluator,list); + StandardPrinter.EvaluateRow(base.Evaluator,list); mylist.AddRange(list); AfterConverting (section,list);