From 5a414db60692b9ddaa81e7e7772888067ebab34d Mon Sep 17 00:00:00 2001 From: peterforstmeier Date: Tue, 12 Jul 2011 20:30:09 +0200 Subject: [PATCH] work on GapList.cs --- .../SampleReports/Ilist/ContributorsList.srd | 305 +++++++++--------- .../SharpReportSamples/ContributorsList.cs | 1 + .../src/SharpReportSamples/MainForm.cs | 6 +- .../Project/Exporter/BasePager.cs | 30 +- .../Converters/GroupedRowConverter.cs | 1 + .../Project/Exporter/FormPageBuilder.cs | 6 + .../Project/Exporter/GapList.cs | 14 +- .../Project/Globals/GlobalValues.cs | 80 +---- .../Project/WPF/FixedDocumentCreator.cs | 20 +- 9 files changed, 224 insertions(+), 239 deletions(-) diff --git a/samples/SharpDevelopReports/SampleReports/Ilist/ContributorsList.srd b/samples/SharpDevelopReports/SampleReports/Ilist/ContributorsList.srd index 1b7b660a2c..0426263d32 100644 --- a/samples/SharpDevelopReports/SampleReports/Ilist/ContributorsList.srd +++ b/samples/SharpDevelopReports/SampleReports/Ilist/ContributorsList.srd @@ -2,282 +2,279 @@ - Microsoft Sans Serif, 10pt - PushData - 50 - True - - - No Data for this Report + Report1 + DataReport + 50 + 50 50 + 50 827, 1169 - 5, 5, 5, 5 - 50 - Text - False - Report1 - 50 - Millimeter - - DataReport + 5, 5, 5, 5 + + + + + + Text + PushData + No Data for this Report + Microsoft Sans Serif, 10pt + True + 50, 50 786, 35 - ReportHeader - False - 50 - 0 Window - - 50, 50 + 0 + 50 False + False + + Black + ReportHeader + 50, 100 786, 108 - ReportPageHeader - False - 50 - 0 Window + 0 + 50 + False + False + 429, 63 + 100, 20 White - False + Microsoft Sans Serif, 12pt, style=Bold None - Job - 429, 63 TopLeft - True - False - Microsoft Sans Serif, 12pt, style=Bold False - - Job + False + Job + False WindowFrame - 100, 20 ControlText + True + Job + 234, 63 + 100, 20 White - False + Microsoft Sans Serif, 12pt, style=Bold None - Lastname - 234, 63 TopLeft - True - False - Microsoft Sans Serif, 12pt, style=Bold False - - Lastname + False + Lastname + False WindowFrame - 100, 20 ControlText + True + Lastname - File 47, 6 - ReportImageControl 661, 42 - False Window - ..\..\..\..\..\..\SharpDevelop3.0_CHECKOUT\SharpDevelop\samples\SharpDevelopReports\SampleReports\Logos\Bannerbeige2.gif - D:\SharpDevelop3.0_CHECKOUT\SharpDevelop\samples\SharpDevelopReports\SampleReports\Logos\Bannerbeige2.gif + D:\git_Sharpdevelop_Reporting\samples\SharpDevelopReports\SampleReports\Logos\Bannerbeige2.gif + False + File + ..\..\Logos\Bannerbeige2.gif + ReportImageControl - Flat - 0, 3 47, 87 - 661, 18 - Flat - Solid White - Flat ControlText + 0, 3 614, 3 + Flat + Flat + Flat + Solid 2 + + 46, 63 + 109, 20 White - False + Microsoft Sans Serif, 12pt, style=Bold EllipsisCharacter - Firstname - 46, 63 TopLeft - True - False - Microsoft Sans Serif, 12pt, style=Bold False - - reportTextItem1 + False + Firstname + False WindowFrame - 109, 20 ControlText + True + reportTextItem1 - 50, 100 - False + Black + ReportPageHeader - 750, 51 - ReportDetail - False - 50 - 0 + 50, 223 + 750, 60 Window + 0 + 50 + False + False 3, 10 - - Row + 699, 47 + White + False + ControlText + True + WindowFrame - System.String - First - Microsoft Sans Serif, 10pt 43, 12 + 147, 25 + White + Microsoft Sans Serif, 10pt + EllipsisCharacter + MiddleLeft False + False + System.String + First + False + WindowFrame ControlText - EllipsisCharacter + True First - False - False - MiddleLeft - White - unbound1 - True - 147, 25 - WindowFrame - System.String - last - Microsoft Sans Serif, 10pt 231, 12 - False - ControlText + 139, 25 + White + Microsoft Sans Serif, 10pt EllipsisCharacter - last - False - False MiddleLeft - White - - unbound2 - True - 139, 25 + False + False + System.String + Last + False WindowFrame + ControlText + True + Last + unbound2 - System.String - Job - Microsoft Sans Serif, 10pt 426, 10 + 216, 25 + White + Microsoft Sans Serif, 10pt + EllipsisCharacter + MiddleLeft False + False + System.String + Job + False + WindowFrame ControlText - EllipsisCharacter + True Job - False -------------- - False - MiddleLeft - White - unbound3 - True - 216, 25 - WindowFrame - False + 0 - WindowFrame - 699, 40 - White - True - ControlText + Row - 50, 223 - False + Black + ReportDetail + 50, 298 750, 49 - ReportPageFooter - False - 50 - 0 Window + 0 + 50 + False + False + 45, 24 + 483, 20 White - False + Microsoft Sans Serif, 8.25pt None - =Globals!ReportFolder - 45, 24 TopLeft - True - False - Microsoft Sans Serif, 8.25pt False - - =Globals!ReportFolder + False + =Globals!ReportFolder + False WindowFrame - 483, 20 ControlText + True + =Globals!ReportFolder - Flat - 0, 0 45, 3 - object_177a5444_b8e0_4202_87d2_05cdc7cd1194 663, 15 - Flat - Solid White - Flat ControlText + 0, 0 656, 0 + Flat + Flat + Flat + Solid 2 + object_177a5444_b8e0_4202_87d2_05cdc7cd1194 + 602, 24 + 100, 20 White - False + Microsoft Sans Serif, 8.25pt None - ='Page ' + Globals!PageNumber - 602, 24 TopLeft - True - False - Microsoft Sans Serif, 8.25pt False - - ='Page ' + Globals!PageNumber + False + ='Page ' + Globals!PageNumber + False WindowFrame - 100, 20 ControlText + True + ='Page ' + Globals!PageNumber - 50, 289 - False + Black + ReportPageFooter + 50, 362 750, 55 - ReportFooter - False - 50 - 0 Window - - 50, 353 + 0 + 50 False + False + + Black + ReportFooter \ No newline at end of file diff --git a/samples/SharpDevelopReports/src/SharpReportSamples/ContributorsList.cs b/samples/SharpDevelopReports/src/SharpReportSamples/ContributorsList.cs index e3f44d5bb9..a21a80ae0e 100644 --- a/samples/SharpDevelopReports/src/SharpReportSamples/ContributorsList.cs +++ b/samples/SharpDevelopReports/src/SharpReportSamples/ContributorsList.cs @@ -41,6 +41,7 @@ namespace SharpReportSamples list.Add(new Contributor("Nathan","Allen","")); list.Add(new Contributor("Troy","Simpson","Prg.")); list.Add(new Contributor("David","Alpert","Prg.")); + list.Add(new Contributor("Fred","Flintstone",null)); return list; } } diff --git a/samples/SharpDevelopReports/src/SharpReportSamples/MainForm.cs b/samples/SharpDevelopReports/src/SharpReportSamples/MainForm.cs index 29d01db355..1e021521b9 100644 --- a/samples/SharpDevelopReports/src/SharpReportSamples/MainForm.cs +++ b/samples/SharpDevelopReports/src/SharpReportSamples/MainForm.cs @@ -153,9 +153,9 @@ namespace SharpReportSamples private void RunContributors (string fileName) { ReportModel model = ReportEngine.LoadReportModel(fileName); - Console.WriteLine(model.ReportSettings.PageSize); - model.ReportSettings.PageSize = new Size(model.ReportSettings.PageSize.Width,400); - Console.WriteLine(model.ReportSettings.PageSize); +// Console.WriteLine(model.ReportSettings.PageSize); +// model.ReportSettings.PageSize = new Size(model.ReportSettings.PageSize.Width,400); +// Console.WriteLine(model.ReportSettings.PageSize); // sorting is done here, but, be carefull, misspelled fieldnames will cause an exception 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 a70a899f1b..85efff506a 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 @@ -18,6 +18,8 @@ namespace ICSharpCode.Reports.Core.Exporter { private PagesCollection pages; private readonly object pageLock = new object(); + +// private Point currentBottom; public event EventHandler PageCreated; public event EventHandler SectionRendering; @@ -75,9 +77,11 @@ namespace ICSharpCode.Reports.Core.Exporter #region Converters + protected ExporterCollection ConvertSection (BaseSection section,int dataRow) { + Point currentBottom = Point.Empty; FireSectionRenderEvent (section ,dataRow); PrintHelper.AdjustParent(section,section.Items); PrintHelper.AdjustSectionLocation(section); @@ -103,11 +107,10 @@ namespace ICSharpCode.Reports.Core.Exporter { ISimpleContainer simpleContainer = item as ISimpleContainer; -// Offset = new Point(Offset.X,Offset.Y + gapCalculator.GapBetweenItems[i] ); - if (simpleContainer != null) { Offset = new Point(Offset.X,Offset.Y + gapCalculator.GapBetweenItems[i] ); +// Offset = new Point(Offset.X,Offset.Y + 5); var containerSize = simpleContainer.Size; EvaluationHelper.EvaluateReportItems(evaluator,simpleContainer.Items); @@ -116,27 +119,40 @@ namespace ICSharpCode.Reports.Core.Exporter LayoutHelper.SetLayoutForRow(Graphics,layouter, simpleContainer); /* * */ -// Console.WriteLine("--"); + + + /* section.Items.ForEach(delegate(BaseReportItem aitem) { // Console.WriteLine(item.Location); }); var h = section.Items.FindHighestElement(); - section.MeasureOverride(section.Size); - /* - * */ - + */ + section.MeasureOverride(section.Size); + /** */ Offset = BaseConverter.ConvertContainer(convertedSection,simpleContainer,Offset.X,Offset); simpleContainer.Size = containerSize; } else { var converteditem = ExportHelper.ConvertLineItem(item,Offset); + + if (converteditem.StyleDecorator.DisplayRectangle.Bottom > currentBottom.Y) { + currentBottom = new Point(converteditem.StyleDecorator.Location.X,converteditem.StyleDecorator.DisplayRectangle.Bottom); + } + convertedSection.Add((BaseExportColumn)converteditem ); + } i ++; } Offset = new Point (Offset.X,Offset.Y + gapCalculator.LastGap); +// Offset = new Point (Offset.X,Offset.Y + 5); + + if (currentBottom.Y > Offset.Y) { + Offset = new Point (Offset.X,currentBottom.Y); + } +// Offset = new Point (Offset.X,Offset.Y + gapCalculator.LastGap); } SectionBounds.Offset = Offset; return convertedSection; 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 c38825f200..d037f96c60 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,6 +58,7 @@ namespace ICSharpCode.Reports.Core.Exporter { ExporterCollection exporterCollection = new ExporterCollection(); base.CurrentPosition = base.SectionBounds.Offset; + var p = base.CurrentPosition; BaseSection section = parent as BaseSection; DefaultLeftPosition = parent.Location.X; diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/FormPageBuilder.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/FormPageBuilder.cs index 7e271194de..55c642b6cd 100644 --- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/FormPageBuilder.cs +++ b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/FormPageBuilder.cs @@ -46,9 +46,12 @@ namespace ICSharpCode.Reports.Core.Exporter { if (base.Pages.Count == 0) { + SectionBounds.Offset = new Point(base.SectionBounds.MarginBounds.Left,base.SectionBounds.MarginBounds.Top); + Console.WriteLine("a reportheader {0}",SectionBounds.Offset); ExporterCollection convertedList = base.ConvertSection (base.ReportModel.ReportHeader,0); base.SinglePage.Items.AddRange(convertedList); + Console.WriteLine("reportheader {0}",SectionBounds.Offset); } } @@ -57,13 +60,16 @@ namespace ICSharpCode.Reports.Core.Exporter if (SectionBounds.Offset.Y < base.ReportModel.PageHeader.SectionOffset) { SectionBounds.Offset = new Point(SectionBounds.Offset.X,base.ReportModel.PageHeader.SectionOffset); } + Console.WriteLine("a pageheader {0}",SectionBounds.Offset); ExporterCollection convertedList = base.ConvertSection (base.ReportModel.PageHeader,0); base.SinglePage.Items.AddRange(convertedList); base.SectionBounds.CalculatePageBounds(base.ReportModel); + Console.WriteLine("pageheader {0}",SectionBounds.Offset); } protected override void BuildDetailInternal(BaseSection section) { + Console.WriteLine("a detail {0}",SectionBounds.Offset); base.BuildDetailInternal(section); SectionBounds.Offset = new Point(SectionBounds.Offset.X,base.ReportModel.DetailSection.Location.Y); ExporterCollection convertedList = base.ConvertSection (base.ReportModel.DetailSection,0); diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/GapList.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/GapList.cs index c32ac5db39..c3c2c4d43c 100644 --- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/GapList.cs +++ b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/GapList.cs @@ -27,6 +27,9 @@ namespace ICSharpCode.Reports.Core.Exporter for (int i = 0; i < section.Items.Count; i++) { GapBetweenItems[i] = CalculateGap(oldItem,section.Items[i]); } + for (int i = 0; i < section.Items.Count; i++) { + Console.WriteLine(GapBetweenItems[i]); + } GapBetweenItems[section.Items.Count] = CalculateLastGap(section); } @@ -35,8 +38,15 @@ namespace ICSharpCode.Reports.Core.Exporter { if (oldItem == item) { return 0; - } else { - return item.Location.Y - (oldItem.Location.Y + oldItem.Size.Height) ; + } + else + { + if (oldItem.Location.Y + oldItem.Size.Height < item.Location.Y ) { + return item.Location.Y - (oldItem.Location.Y + oldItem.Size.Height) ; + } else + { + return 0; + } } } 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 81ffb9788a..a75a35c943 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 @@ -31,6 +31,9 @@ namespace ICSharpCode.Reports.Core.Globals private const string tableName = "Table"; private const int defaultZoomfactor = 1; private const int gapBetweenRows = 1; + //WPF + private const double defaultCornerRadius = 2; + private static double defaulThickness = 2; private GlobalValues() { @@ -39,7 +42,6 @@ namespace ICSharpCode.Reports.Core.Globals #region some usefull functions and methodes - private static bool IsSpoolerRunning() { ServiceController[] services; @@ -74,22 +76,6 @@ namespace ICSharpCode.Reports.Core.Globals #endregion - #region Formatting - /// - /// Build a StringFormat witch is used allover the code to - /// Format all String's the same way. - /// - /// a StringFormat object - /* - public static StringFormat StandardStringFormat() - { - StringFormat sFormat = StringFormat.GenericTypographic; - sFormat.FormatFlags |= StringFormatFlags.LineLimit; - return sFormat; - } - */ - #endregion - #region numeric Constant /// @@ -107,12 +93,8 @@ namespace ICSharpCode.Reports.Core.Globals /// The default Size of a Section /// used in - public static int DefaultSectionHeight - { - get { - return 60; - } - } + public static int DefaultSectionHeight {get {return 60;}} + /// /// Default zoom Factor for all typ's of preview @@ -125,12 +107,7 @@ namespace ICSharpCode.Reports.Core.Globals - public static Size PreferedSize - { - get { - return new Size(100,20); - } - } + public static Size PreferedSize {get {return new Size(100,20);}} public static Size DefaultPageSize {get {return new Size(827,1169);}} @@ -142,15 +119,6 @@ namespace ICSharpCode.Reports.Core.Globals #region String Constant's - /* - public static string ReportString - { - get { - return reportString; - } - } - */ - public static string ReportExtension { get { @@ -172,10 +140,7 @@ namespace ICSharpCode.Reports.Core.Globals } } -// public static string UnboundName -// { -// get {return unbound;} -// } + public static string TableName { @@ -184,29 +149,9 @@ namespace ICSharpCode.Reports.Core.Globals } } - /* - public static string FunctionStartTag - { - get {return "{=";} - } - - - public static string FunctionEndTag - { - get {return "}";} - } - */ - - /* - public static string StringParserStartTag - { - get {return "${";} - - } - */ - #endregion + #region Printing public static int GapBetweenContainer { @@ -291,6 +236,15 @@ namespace ICSharpCode.Reports.Core.Globals #endregion + + #region Wpf + + public static double DefaultCornerRadius {get {return defaultCornerRadius;}} + public static double DefaultBorderThickness {get {return defaulThickness;}} + + #endregion + + #region Icons /// diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/WPF/FixedDocumentCreator.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/WPF/FixedDocumentCreator.cs index 9ababfd4fb..5da5cb6e68 100644 --- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/WPF/FixedDocumentCreator.cs +++ b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/WPF/FixedDocumentCreator.cs @@ -79,8 +79,12 @@ namespace ICSharpCode.Reports.Core.WPF var text = column as ExportText; if (text != null) { var t = CreateTextBlock(text); + if (column.StyleDecorator.DrawBorder) { - border = CreateBorder(column.StyleDecorator as BaseStyleDecorator); + border = CreateBorder(column.StyleDecorator as BaseStyleDecorator, + GlobalValues.DefaultBorderThickness, + GlobalValues.DefaultCornerRadius ); + border.Child = t; element = border; } @@ -104,12 +108,12 @@ namespace ICSharpCode.Reports.Core.WPF #region GraphicsElement (Line etc) - System.Windows.Controls.Border CreateBorder( BaseStyleDecorator column) + System.Windows.Controls.Border CreateBorder( BaseStyleDecorator column,double thickness,double cornerRadius) { var border = new System.Windows.Controls.Border(); border.Padding = new Thickness(1); - border.BorderThickness = new Thickness(2); - border.CornerRadius = new CornerRadius(2); + border.BorderThickness = new Thickness(thickness); + border.CornerRadius = new CornerRadius(cornerRadius); border.BorderBrush = ConvertBrush(column.ForeColor); return border; } @@ -157,13 +161,9 @@ namespace ICSharpCode.Reports.Core.WPF } else { - - var border = CreateBorder(decorator as BaseStyleDecorator); - RectangleShape rs = decorator.Shape as RectangleShape; - border.CornerRadius = new CornerRadius(rs.CornerRadius); - - border.BorderThickness = new Thickness(decorator.Thickness); + var border = CreateBorder(decorator as BaseStyleDecorator,decorator.Thickness,rs.CornerRadius); + border.BorderBrush = ConvertBrush(decorator.ForeColor); border.Background = ConvertBrush(decorator.BackColor);