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 9a89d5ed5a..181e4e4f06 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 @@ -98,8 +98,8 @@ namespace ICSharpCode.Reports.Addin.ReportWizard ICSharpCode.Reports.Core.BaseRowItem row = new ICSharpCode.Reports.Core.BaseRowItem(); AdjustContainer(parent,row); - - int defY = parent.Location.Y + GlobalValues.ControlMargins.Top; + + int defY = GlobalValues.ControlMargins.Top; int ctrlWidth = CalculateControlWidth(row,colDetail); int startX = parent.Location.X + GlobalValues.ControlMargins.Left; @@ -134,34 +134,18 @@ namespace ICSharpCode.Reports.Addin.ReportWizard } #endregion - /* - protected static ReportItemCollection AddItemsToSection (ICSharpCode.Reports.Core.BaseSection section,ReportItemCollection items) - { - int defY = section.Location.Y + GlobalValues.ControlMargins.Top; - int ctrlWidth = CalculateControlWidth(section,items); - int startX = section.Location.X + GlobalValues.ControlMargins.Left; - var vv = new ReportItemCollection(); - foreach (var ir in items) { - Point np = new Point(startX,defY); - startX += ctrlWidth; - ir.Location = np; -// section.Items.Add(ir); - vv.Add(ir); - } - return vv; - } - */ + protected ReportItemCollection AddItemsToContainer (ReportItemCollection items) { - int locationY = 10; - int locationX = this.ParentItem.Location.X + GlobalValues.ControlMargins.Left; + int locationX = GlobalValues.ControlMargins.Left; + var minCtrlWidth = CalculateControlWidth(ParentItem,items); var col = new ReportItemCollection(); foreach (var ir in items) { - ir.Location = new Point(locationX,locationY); + ir.Location = new Point(locationX,GlobalValues.ControlMargins.Top); col.Add(ir); locationX += minCtrlWidth; } @@ -184,13 +168,13 @@ namespace ICSharpCode.Reports.Addin.ReportWizard dataItem.ColumnName = ReportModel.ReportSettings.GroupColumnsCollection[0].ColumnName; dataItem.DataType = ReportModel.ReportSettings.GroupColumnsCollection[0].DataTypeName; - dataItem.Location = new Point (10,5); + dataItem.Location = new Point (GlobalValues.ControlMargins.Left,GlobalValues.ControlMargins.Top); dataItem.Size = new Size (150,20); dataItem.Text = ReportModel.ReportSettings.GroupColumnsCollection[0].ColumnName; ICSharpCode.Reports.Core.BaseGroupedRow groupHeader = new ICSharpCode.Reports.Core.BaseGroupedRow(); groupHeader.Location = headerLocation; - groupHeader.Size = new Size (300,30); + groupHeader.Size = new Size (300,dataItem.Size.Height + GlobalValues.ControlMargins.Top + GlobalValues.ControlMargins.Bottom); groupHeader.Items.Add(dataItem); return groupHeader; } 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 e691758393..f70730169f 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 @@ -35,6 +35,7 @@ namespace ICSharpCode.Reports.Addin.ReportWizard base.CreatePageHeader(); ICSharpCode.Reports.Core.BaseRowItem row = CreateRowWithTextColumns(base.ReportModel.PageHeader, this.reportItems); + AdjustContainer(ParentItem,row); base.ReportModel.PageHeader.Items.Add(row); } @@ -44,32 +45,23 @@ namespace ICSharpCode.Reports.Addin.ReportWizard if (section == null) { throw new ArgumentNullException("section"); } - + if (base.ReportModel.ReportSettings.GroupColumnsCollection.Count > 0) { - var groupheader = base.CreateGroupHeader(new Point (5,10)); + var groupheader = base.CreateGroupHeader(new Point (GlobalValues.ControlMargins.Left,GlobalValues.ControlMargins.Top)); base.ReportModel.DetailSection.Items.Add(groupheader); 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) { - var items = base.AddItemsToContainer(this.reportItems); - ParentItem.Items.AddRange(items); - ParentItem.Size = new Size(ParentItem.Size.Width,40); - section.Items.Add(ParentItem as BaseReportItem); - } - else - { - //var items1 = AddItemsToSection (base.ReportModel.DetailSection,this.reportItems); - //AddItemsToSection (base.ReportModel.DetailSection,this.reportItems); - //section.Items.AddRange(items1); + section.Size = new Size(section.Size.Width,90); } + var items = base.AddItemsToContainer(this.reportItems); + ParentItem.Items.AddRange(items); + ParentItem.Size = new Size(ParentItem.Size.Width,items[0].Size.Height + GlobalValues.ControlMargins.Top + GlobalValues.ControlMargins.Bottom); + section.Items.Add(ParentItem as BaseReportItem); } #endregion diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/ReportLayout/TableLayout.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/ReportLayout/TableLayout.cs index 2e7ee955bb..d703c69ca9 100644 --- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/ReportLayout/TableLayout.cs +++ b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/ReportLayout/TableLayout.cs @@ -57,15 +57,17 @@ namespace ICSharpCode.Reports.Addin.ReportWizard insertLocation = new Point(margin.Left,insertLocation.Y + groupHeader.Size.Height + margin.Bottom + margin.Top); } + //Insert details allways ICSharpCode.Reports.Core.BaseRowItem detailRow = new ICSharpCode.Reports.Core.BaseRowItem(); AdjustContainer (ParentItem,detailRow); detailRow.Location = insertLocation; + detailRow.Size = new Size(detailRow.Size.Width,30); int defX = AbstractLayout.CalculateControlWidth(detailRow,reportItems); - int startX = detailRow.Location.X + margin.Left; + int startX = margin.Left; foreach (ICSharpCode.Reports.Core.BaseReportItem ir in this.reportItems) { @@ -76,26 +78,22 @@ namespace ICSharpCode.Reports.Addin.ReportWizard detailRow.Items.Add(ir); } - insertLocation = new Point(margin.Left,insertLocation.Y + detailRow.Size.Height + margin.Bottom + margin.Top); - ParentItem.Items.Add (detailRow); - - ParentItem.Size = CalculateContainerSize(ParentItem,margin); - + ParentItem.Size = CalculateContainerSize(ParentItem); section.Size = new Size (section.Size.Width,ParentItem.Size.Height + margin.Top + margin.Bottom); - } - private Size CalculateContainerSize(ISimpleContainer container,System.Drawing.Printing.Margins margin) + private Size CalculateContainerSize(ISimpleContainer container) { - int h = margin.Top; + int h = GlobalValues.ControlMargins.Top; foreach (ICSharpCode.Reports.Core.BaseReportItem item in container.Items) { - h = h + item.Size.Height + margin.Bottom; + h = h + item.Size.Height + GlobalValues.ControlMargins.Bottom; } - h = h + 3*margin.Bottom; + h = h + 3*GlobalValues.ControlMargins.Bottom; + return new Size (container.Size.Width,h); } } diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseClasses/Printing/Layouter.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseClasses/Printing/Layouter.cs index 85e01eb9e0..9e38e5336c 100644 --- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseClasses/Printing/Layouter.cs +++ b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseClasses/Printing/Layouter.cs @@ -39,17 +39,12 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing System.Collections.Generic.IEnumerable canGrowShrinkCollection = from bt in container.Items where bt.CanGrow == true select bt; if (canGrowShrinkCollection.Count() > 0 ) { - - int bottomPadding = container.Size.Height - (container.Items[0].Location.Y + container.Items[0].Size.Height); - Rectangle surroundingRec = FindSurroundingRectangle(graphics,canGrowShrinkCollection); - desiredContainerRectangle = new Rectangle(container.Location.X, container.Location.Y, container.Size.Width, - surroundingRec.Size.Height + bottomPadding ); + surroundingRec.Size.Height + GlobalValues.ControlMargins.Top + GlobalValues.ControlMargins.Bottom); } - return desiredContainerRectangle; } @@ -63,6 +58,7 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing throw new ArgumentNullException("section"); } + Console.WriteLine("layouter for {0}",section.Name); IEnumerable canGrowShrinkCollection = from bt in section.Items where bt.CanGrow == true select bt; @@ -73,17 +69,13 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing if (canGrowShrinkCollection.Count() > 0) { - //Console.WriteLine ("xx layout section"); - - int bottomPadding = section.Size.Height - (section.Items[0].Size.Height + section.Items[0].Location.Y); - Rectangle surroundingRec = FindSurroundingRectangle(graphics,canGrowShrinkCollection); if (surroundingRec.Height > desiredSectionRectangle .Height) { desiredSectionRectangle = new Rectangle(section.Location.X, section .Location.Y, section .Size.Width, - surroundingRec.Size.Height + bottomPadding); + surroundingRec.Size.Height + GlobalValues.ControlMargins.Top + GlobalValues.ControlMargins.Bottom ); } } return desiredSectionRectangle; diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseClasses/Printing/PrintHelper.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseClasses/Printing/PrintHelper.cs index 2c472cb13d..6f44c4da66 100644 --- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseClasses/Printing/PrintHelper.cs +++ b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseClasses/Printing/PrintHelper.cs @@ -25,7 +25,7 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing { Rectangle textRect = layouter.Layout(graphics,row); if (textRect.Height > row.Size.Height) { - row.Size = new Size(row.Size.Width,textRect.Height); + row.Size = new Size(row.Size.Width,textRect.Height + 5); } } 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 1304a07bcb..b01242f60b 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 @@ -123,7 +123,7 @@ namespace ICSharpCode.Reports.Core.Exporter Rectangle sectionRectangle = new Rectangle(0,0,section.Size.Width,section.Size.Height); if (!sectionRectangle.Contains(desiredRectangle)) { - section.Size = new Size(section.Size.Width,desiredRectangle.Size.Height); + section.Size = new Size(section.Size.Width,desiredRectangle.Size.Height + GlobalValues.ControlMargins.Top + GlobalValues.ControlMargins.Bottom); } list = StandardPrinter.ConvertPlainCollection(section.Items,offset); diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/BaseConverter.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/BaseConverter.cs index 7732655d62..5724e21f70 100644 --- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/BaseConverter.cs +++ b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/BaseConverter.cs @@ -112,12 +112,17 @@ namespace ICSharpCode.Reports.Core.Exporter protected Point ConvertGroupChilds(ExporterCollection mylist, BaseSection section, ISimpleContainer simpleContainer, int defaultLeftPos, Point currentPosition) { + Console.WriteLine("---start --ConvertStandardRow {0} - section {1}",simpleContainer.Size,section.Size); PrepareContainerForConverting(section,simpleContainer); Point curPos = BaseConverter.BaseConvert(mylist,simpleContainer,defaultLeftPos,currentPosition); - AfterConverting (mylist); + Console.WriteLine("---end --ConvertStandardRow detail {0} - section {1}",simpleContainer.Size,section.Size); +// Console.WriteLine(); +// Console.WriteLine(); + AfterConverting (section,mylist); return curPos; } + protected bool PageBreakAfterGroupChange(ISimpleContainer container) { var groupedRows = BaseConverter.FindGroups(container); @@ -179,7 +184,7 @@ namespace ICSharpCode.Reports.Core.Exporter #endregion - protected void SaveSize(Size size) + protected void SaveSectionSize(Size size) { this.saveSize = size; } @@ -206,11 +211,10 @@ namespace ICSharpCode.Reports.Core.Exporter } - protected void AfterConverting (ExporterCollection convertedList) + protected void AfterConverting (BaseSection section,ExporterCollection convertedList) { StandardPrinter.EvaluateRow(Evaluator,convertedList); -// section.Items[0].Size = base.RestoreSize; -// section.SectionOffset += section.Size.Height + 3 * GlobalValues.GapBetweenContainer; + section.Items[0].Size = RestoreSize; } @@ -219,7 +223,7 @@ namespace ICSharpCode.Reports.Core.Exporter FillRow(simpleContainer); PrepareContainerForConverting(section,simpleContainer); Point curPos = BaseConverter.BaseConvert(mylist,simpleContainer,defaultLeftPos,currentPosition); - AfterConverting (mylist); + AfterConverting (section,mylist); return curPos; } 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 c1c07d7843..15171c6dc3 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 @@ -58,40 +58,69 @@ namespace ICSharpCode.Reports.Core.Exporter BaseSection section = parent as BaseSection; int defaultLeftPos = parent.Location.X; - + + Size groupSize = Size.Empty; + Size childSize = Size.Empty; + + if (section.Items.IsGrouped) + { + groupSize = section.Items[0].Size; + childSize = section.Items[1].Size; + } + Rectangle pageBreakRect = Rectangle.Empty; do { - + base.SaveSectionSize(section.Size); PrintHelper.AdjustSectionLocation (section); section.Size = this.SectionBounds.DetailSectionRectangle.Size; - base.SaveSize(section.Items[0].Size); // did we have GroupedItems at all - if (section.Items.IsGrouped) { - + if (section.Items.IsGrouped) + { // GetType child navigator IDataNavigator childNavigator = base.DataNavigator.GetChildNavigator(); base.Evaluator.SinglePage.IDataNavigator = childNavigator; - // Convert Grouping Header currentPosition = ConvertGroupHeader(exporterCollection,section,defaultLeftPos,currentPosition); + section.Size = base.RestoreSize; + section.Items[0].Size = groupSize; + section.Items[1].Size = childSize; + childNavigator.Reset(); childNavigator.MoveNext(); +// Console.WriteLine("-------------------after group"); +// +// Console.WriteLine ("section {0}",section.Size); +// Console.WriteLine ("group {0}",section.Items[0].Size); +// Console.WriteLine ("detail {0}",section.Items[1].Size); +// Console.WriteLine(); + //Convert children if (childNavigator != null) { StandardPrinter.AdjustBackColor(simpleContainer,GlobalValues.DefaultBackColor); - - do { + do + { + Console.WriteLine("-----------------childs"); + +// Console.WriteLine ("section {0}",section.Size); +// Console.WriteLine ("group {0}",section.Items[0].Size); +// Console.WriteLine ("detail {0}",section.Items[1].Size); +// Console.WriteLine(); + section.Size = base.RestoreSize; + section.Items[0].Size = groupSize; + section.Items[1].Size = childSize; + + childNavigator.Fill(simpleContainer.Items); currentPosition = ConvertGroupChilds (exporterCollection,section, simpleContainer,defaultLeftPos,currentPosition); pageBreakRect = PrintHelper.CalculatePageBreakRectangle((BaseReportItem)section.Items[1],currentPosition); - + section.Items[1].Size = base.RestoreSize; if (PrintHelper.IsPageFull(pageBreakRect,base.SectionBounds )) { currentPosition = ForcePageBreak (exporterCollection,section); } @@ -113,6 +142,7 @@ namespace ICSharpCode.Reports.Core.Exporter { // No Grouping at all currentPosition = ConvertStandardRow (exporterCollection,section,simpleContainer,defaultLeftPos,currentPosition); + section.Size = base.RestoreSize; } pageBreakRect = PrintHelper.CalculatePageBreakRectangle((BaseReportItem)section.Items[0],currentPosition); @@ -138,7 +168,7 @@ namespace ICSharpCode.Reports.Core.Exporter base.ForcePageBreak(exporterCollection,section); return CalculateStartPosition(); } - + private Point CalculateStartPosition() { @@ -160,14 +190,14 @@ namespace ICSharpCode.Reports.Core.Exporter StandardPrinter.EvaluateRow(base.Evaluator,list); exportList.AddRange(list); - AfterConverting (list); + AfterConverting (section,list); retVal = new Point (leftPos,offset.Y + groupCollection[0].Size.Height + 20 + (3 *GlobalValues.GapBetweenContainer)); } else { retVal = ConvertStandardRow(exportList,section,groupedRows[0],leftPos,offset); } return retVal; } - + private static void ShouldDrawBorder (BaseSection section,ExporterCollection list) { diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/GroupedTableConverter.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/GroupedTableConverter.cs index eb0f01e465..4cfb48edcc 100644 --- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/GroupedTableConverter.cs +++ b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/GroupedTableConverter.cs @@ -69,7 +69,7 @@ namespace ICSharpCode.Reports.Core.Exporter simpleContainer.Location = new Point (simpleContainer.Location.X,simpleContainer.Location.Y); simpleContainer.Parent = (BaseReportItem)this.table; - base.SaveSize( new Size (simpleContainer.Size.Width,simpleContainer.Size.Height)); + base.SaveSectionSize( new Size (simpleContainer.Size.Width,simpleContainer.Size.Height)); if (PrintHelper.IsTextOnlyRow(simpleContainer) ) { headerRow = simpleContainer; @@ -136,7 +136,7 @@ namespace ICSharpCode.Reports.Core.Exporter { // No Grouping at all - base.SaveSize(simpleContainer.Size); + base.SaveSectionSize(simpleContainer.Size); simpleContainer = table.Items[1] as ISimpleContainer; do { @@ -191,7 +191,7 @@ namespace ICSharpCode.Reports.Core.Exporter StandardPrinter.EvaluateRow(base.Evaluator,list); exportList.AddRange(list); - AfterConverting (list); + AfterConverting (section,list); retVal = new Point (leftPos,offset.Y + groupCollection[0].Size.Height + 20 + (3 *GlobalValues.GapBetweenContainer)); } else { retVal = ConvertStandardRow(exportList,section,groupedRow[0],leftPos,offset); diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Globals/GlobalValues.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Globals/GlobalValues.cs index 4544bdb3e5..84dd7863f6 100644 --- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Globals/GlobalValues.cs +++ b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Globals/GlobalValues.cs @@ -95,12 +95,7 @@ namespace ICSharpCode.Reports.Core { /// /// The value on witch the Control is drawing bigger than the text inside /// - /* - public static int EnlargeControl - { - get {return enlargeControl;} - } - */ + public static Margins ControlMargins {