diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/ICSharpCode.Reporting.csproj b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/ICSharpCode.Reporting.csproj index 51ab7b81d2..7b0ea97bfb 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/ICSharpCode.Reporting.csproj +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/ICSharpCode.Reporting.csproj @@ -60,21 +60,27 @@ - - + + + + + + - + + - - + + + @@ -86,6 +92,7 @@ + diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/BaseClasses/Page.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/BaseClasses/Page.cs index 338140109c..ff18084857 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/BaseClasses/Page.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/BaseClasses/Page.cs @@ -8,37 +8,30 @@ */ using System; using System.Collections.Generic; +using System.Drawing; + using ICSharpCode.Reporting.Interfaces; +using ICSharpCode.Reporting.Interfaces.Export; namespace ICSharpCode.Reporting.BaseClasses { /// /// Description of Page. /// - /// - - - - - - public interface IPage{ - bool IsFirstPage {get;set;} - IPageInfo PageInfo {get;} - List Items {get; set;} - } - - - + /// + public class Page:IPage { - public Page(IPageInfo pageInfo) + public Page(IPageInfo pageInfo,Size pageSize) { if (pageInfo == null) { throw new ArgumentNullException("pageInfo"); } PageInfo = pageInfo; - Items = new List(); + Name = "Page"; + Size = pageSize; + ExportedItems = new List(); } public bool IsFirstPage {get;set;} @@ -46,6 +39,22 @@ namespace ICSharpCode.Reporting.BaseClasses public IPageInfo PageInfo {get;private set;} - public List Items {get; set;} + + public string Name {get;set;} + + + public System.Drawing.Size Size {get;set;} + + + public System.Drawing.Point Location {get;set;} + + + public List ExportedItems {get;set;} + + + public IExportContainer CreateExportColumn() + { + throw new NotImplementedException(); + } } } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/BaseClasses/PageInfo.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/BaseClasses/PageInfo.cs index 26fcb16930..ecaf63ecbe 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/BaseClasses/PageInfo.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/BaseClasses/PageInfo.cs @@ -7,6 +7,7 @@ * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; +using ICSharpCode.Reporting.Interfaces.Export; namespace ICSharpCode.Reporting.BaseClasses { @@ -14,17 +15,7 @@ namespace ICSharpCode.Reporting.BaseClasses /// Description of PageInfo. /// /// - public interface IPageInfo - { - int PageNumber {get;set;} - int TotalPages {get;set;} - string ReportName {get;set;} - string ReportFileName {get;set;} - string ReportFolder {get;} - DateTime ExecutionTime {get;set;} -// System.Collections.Hashtable ParameterHash {get;set;} -// IDataNavigator IDataNavigator {get;set;} - } + public class PageInfo:IPageInfo diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Factories/ExportColumnFactory.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Factories/ExportColumnFactory.cs index f5dbfffdda..9fe670841a 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Factories/ExportColumnFactory.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Factories/ExportColumnFactory.cs @@ -7,7 +7,9 @@ * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; +using ICSharpCode.Reporting.BaseClasses; using ICSharpCode.Reporting.Interfaces; +using ICSharpCode.Reporting.Interfaces.Export; using ICSharpCode.Reporting.Items; using ICSharpCode.Reporting.PageBuilder.ExportColumns; @@ -22,8 +24,9 @@ namespace ICSharpCode.Reporting.Factories { } - public IExportColumn CreateItem (IReportItem item) { - return item.CreateExportColumn(); + public IExportColumn CreateItem (IPrintableObject item) { + var export = item.CreateExportColumn(); + return export; } } } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IExportColumn.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Export/IExportColumn.cs similarity index 66% rename from src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IExportColumn.cs rename to src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Export/IExportColumn.cs index 5b9d213c5b..46b20c97f0 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IExportColumn.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Export/IExportColumn.cs @@ -7,14 +7,14 @@ * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; +using ICSharpCode.Reporting.BaseClasses; -namespace ICSharpCode.Reporting.Interfaces +namespace ICSharpCode.Reporting.Interfaces.Export { /// /// Description of IExportColumn. /// - public interface IExportColumn + public interface IExportColumn:IReportObject { - } } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Export/IExportContainer.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Export/IExportContainer.cs new file mode 100644 index 0000000000..1e78e7ef57 --- /dev/null +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Export/IExportContainer.cs @@ -0,0 +1,23 @@ +/* + * Created by SharpDevelop. + * User: Peter Forstmeier + * Date: 12.04.2013 + * Time: 20:28 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Collections.Generic; +using ICSharpCode.Reporting.PageBuilder.ExportColumns; + +namespace ICSharpCode.Reporting.Interfaces.Export +{ + /// + /// Description of IExportContainer. + /// + public interface IExportContainer:IExportColumn + { + List ExportedItems {get;set;} + + } +} diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Export/IPage.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Export/IPage.cs new file mode 100644 index 0000000000..dbda99b25b --- /dev/null +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Export/IPage.cs @@ -0,0 +1,22 @@ +/* + * Created by SharpDevelop. + * User: Peter Forstmeier + * Date: 11.04.2013 + * Time: 19:58 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Collections.Generic; + +namespace ICSharpCode.Reporting.Interfaces.Export +{ + /// + /// Description of IPage. + /// + public interface IPage:IExportContainer + { + bool IsFirstPage {get;set;} + IPageInfo PageInfo {get;} + } +} diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Export/IPageInfo.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Export/IPageInfo.cs new file mode 100644 index 0000000000..35d39a3fc6 --- /dev/null +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Export/IPageInfo.cs @@ -0,0 +1,24 @@ +/* + * Created by SharpDevelop. + * User: Peter Forstmeier + * Date: 11.04.2013 + * Time: 19:59 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; + +namespace ICSharpCode.Reporting.Interfaces.Export +{ + /// + /// Description of IPageInfo. + /// + public interface IPageInfo + { + int PageNumber {get;set;} + int TotalPages {get;set;} + string ReportName {get;set;} + string ReportFileName {get;set;} + string ReportFolder {get;} + } +} diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportItem.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IPrintableObject.cs similarity index 59% rename from src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportItem.cs rename to src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IPrintableObject.cs index 861d15616b..84b34835ef 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportItem.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IPrintableObject.cs @@ -8,24 +8,23 @@ */ using System; using System.Drawing; +using ICSharpCode.Reporting.Interfaces.Export; namespace ICSharpCode.Reporting.Interfaces { /// /// Description of IPrintObject. /// - public interface IReportItem + public interface IReportObject { string Name{get;set;} Size Size {get;set;} Point Location {get;set;} -// Font Font {get;set;} -//// bool VisibleInReport {get;set;} -// Color BackColor {get;set;} -// Color FrameColor {get;set;} -// int SectionOffset {get;set;} -// bool CanGrow {get;set;} -// bool CanShrink {get;set;} -IExportColumn CreateExportColumn(); } + + + public interface IPrintableObject:IReportObject { + IExportColumn CreateExportColumn(); + } + } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/ISection.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportContainer.cs similarity index 55% rename from src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/ISection.cs rename to src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportContainer.cs index 3c81b7fd42..cb36b06e63 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/ISection.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportContainer.cs @@ -1,22 +1,24 @@ /* * Created by SharpDevelop. * User: Peter Forstmeier - * Date: 08.04.2013 - * Time: 19:50 + * Date: 16.04.2013 + * Time: 19:53 * * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; using System.Collections.Generic; +using ICSharpCode.Reporting.Interfaces.Export; using ICSharpCode.Reporting.Items; namespace ICSharpCode.Reporting.Interfaces { /// - /// Description of ISection. + /// Description of IReportContainer. /// - public interface ISection:IReportItem + public interface IReportContainer :IReportObject { - List Items {get;} + List Items {get;set;} + IExportContainer CreateExportColumn(); } } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportCreator.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportCreator.cs index b3e3e7b935..76a774bae8 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportCreator.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportCreator.cs @@ -9,6 +9,7 @@ using System; using System.Collections.Generic; using ICSharpCode.Reporting.BaseClasses; +using ICSharpCode.Reporting.Interfaces.Export; namespace ICSharpCode.Reporting.Interfaces { diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportModel.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportModel.cs index 1d813dd2dd..98bdb9b927 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportModel.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportModel.cs @@ -19,15 +19,19 @@ namespace ICSharpCode.Reporting.Interfaces { ReportSettings ReportSettings {get;set;} List SectionCollection {get;} - + /* ISection ReportHeader {get;} ISection PageHeader {get;} ISection DetailSection {get;} ISection PageFooter {get;} ISection ReportFooter {get;} - /* + GlobalEnums.PushPullModel DataModel {get;} */ - + IReportContainer ReportHeader {get;} + IReportContainer PageHeader {get;} + IReportContainer DetailSection {get;} + IReportContainer PageFooter {get;} + IReportContainer ReportFooter {get;} } } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseSection.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseSection.cs index 97ace09839..5a462315be 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseSection.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseSection.cs @@ -9,28 +9,27 @@ using System; using System.Collections.Generic; using ICSharpCode.Reporting.Interfaces; +using ICSharpCode.Reporting.Interfaces.Export; +using ICSharpCode.Reporting.PageBuilder.ExportColumns; namespace ICSharpCode.Reporting.Items { /// /// Description of BaseSection. /// - public class BaseSection:ReportItem,ISection + public class BaseSection:ReportContainer,IReportContainer { #region Constructors public BaseSection() { - Console.WriteLine("---------- baseSection -------"); - Items = new List(); + Items = new List(); } - public BaseSection (string sectionName) - { - base.Name = sectionName; + public BaseSection (string name) { + Name = name; } - - public List Items {get;private set;} + #endregion } } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseTextItem.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseTextItem.cs index 3aea1edaf2..002882f7ea 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseTextItem.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseTextItem.cs @@ -9,6 +9,7 @@ using System; using System.Drawing; using ICSharpCode.Reporting.Interfaces; +using ICSharpCode.Reporting.Interfaces.Export; using ICSharpCode.Reporting.PageBuilder.ExportColumns; namespace ICSharpCode.Reporting.Items @@ -16,12 +17,12 @@ namespace ICSharpCode.Reporting.Items /// /// Description of BaseTextItem. /// - public interface ITextItem:IReportItem + public interface ITextItem:IPrintableObject { Font Font {get;set;} } - public class BaseTextItem:ReportItem,ITextItem + public class BaseTextItem:PrintableItem,ITextItem { public BaseTextItem(){ } @@ -30,7 +31,11 @@ namespace ICSharpCode.Reporting.Items public override IExportColumn CreateExportColumn() { - return new ExportText(); + var ex = new ExportText(); + ex.Name = Name; + ex.Location = Location; + ex.Size = Size; + return ex; } } } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/PrintableItem.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/PrintableItem.cs new file mode 100644 index 0000000000..d9533d64cd --- /dev/null +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/PrintableItem.cs @@ -0,0 +1,23 @@ +/* + * Created by SharpDevelop. + * User: Peter Forstmeier + * Date: 06.04.2013 + * Time: 20:15 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Drawing; +using ICSharpCode.Reporting.Interfaces; +using ICSharpCode.Reporting.Interfaces.Export; + +namespace ICSharpCode.Reporting.Items +{ + public class PrintableItem : ReportItem,IPrintableObject + { + public virtual IExportColumn CreateExportColumn() + { + return null; + } + } +} diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportContainer.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportContainer.cs new file mode 100644 index 0000000000..d50f2e9a16 --- /dev/null +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportContainer.cs @@ -0,0 +1,40 @@ +/* + * Created by SharpDevelop. + * User: Peter Forstmeier + * Date: 16.04.2013 + * Time: 19:51 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Collections.Generic; +using ICSharpCode.Reporting.Interfaces; +using ICSharpCode.Reporting.Interfaces.Export; +using ICSharpCode.Reporting.PageBuilder.ExportColumns; + +namespace ICSharpCode.Reporting.Items +{ + /// + /// Description of ReportContainer. + /// + public class ReportContainer:ReportItem,IReportContainer + { + public ReportContainer() + { + } + + + public List Items {get;set;} + + + + public IExportContainer CreateExportColumn() + { + return new ExportContainer(){ + Name = this.Name, + Size = this.Size, + Location = this.Location + }; + } + } +} diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportItem.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportItem.cs index a82d8a10ed..4d5fa0007b 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportItem.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportItem.cs @@ -9,27 +9,32 @@ using System; using System.Drawing; using ICSharpCode.Reporting.Interfaces; +using ICSharpCode.Reporting.Interfaces.Export; namespace ICSharpCode.Reporting.Items { /// /// Description of ReportItem. /// - public class ReportItem:IReportItem + + + + public class ReportItem : IReportObject { public ReportItem() { } + + + public string Name { get; set; } + + public Point Location { get; set; } + + public Size Size { get; set; } + - - public string Name {get;set;} - - public Point Location {get;set;} - - public Size Size {get;set;} - - public virtual IExportColumn CreateExportColumn() { - return null; - } } + + + } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportModel.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportModel.cs index 7deca52706..fd075d565c 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportModel.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportModel.cs @@ -22,15 +22,12 @@ namespace ICSharpCode.Reporting.Items public ReportModel() { SectionCollection = new List(); -// foreach (GlobalEnums.ReportSection sec in Enum.GetValues(typeof(GlobalEnums.ReportSection))) { -// SectionCollection.Add (SectionFactory.Create(sec.ToString())); -// } } #region Sections - public ISection ReportHeader + public IReportContainer ReportHeader { get { return (BaseSection)SectionCollection[0]; @@ -38,7 +35,7 @@ namespace ICSharpCode.Reporting.Items } - public ISection PageHeader + public IReportContainer PageHeader { get { return (BaseSection)SectionCollection[1]; @@ -46,7 +43,7 @@ namespace ICSharpCode.Reporting.Items } - public ISection DetailSection + public IReportContainer DetailSection { get { return (BaseSection)SectionCollection[2]; @@ -54,14 +51,14 @@ namespace ICSharpCode.Reporting.Items } - public ISection PageFooter + public IReportContainer PageFooter { get { return (BaseSection)SectionCollection[3]; } } - public ISection ReportFooter + public IReportContainer ReportFooter { get { return (BaseSection)SectionCollection[4]; diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportSettings.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportSettings.cs index 3b6a194ce8..90fe57248b 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportSettings.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportSettings.cs @@ -92,6 +92,24 @@ namespace ICSharpCode.Reporting.Items } } + +// [Category("Page Settings")] + public int BottomMargin {get;set;} + + +// [Category("Page Settings")] + public int TopMargin {get;set;} + + + +// [Category("Page Settings")] + public int LeftMargin {get;set;} + + + +// [Category("Page Settings")] + public int RightMargin {get;set;} + private Size pageSize; public Size PageSize { diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/BasePageBuilder.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/BasePageBuilder.cs index 8631ceb0b3..646f1fa821 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/BasePageBuilder.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/BasePageBuilder.cs @@ -12,6 +12,7 @@ using System.Drawing; using ICSharpCode.Reporting.BaseClasses; using ICSharpCode.Reporting.Interfaces; +using ICSharpCode.Reporting.Interfaces.Export; namespace ICSharpCode.Reporting.PageBuilder { @@ -34,7 +35,7 @@ namespace ICSharpCode.Reporting.PageBuilder protected IPage InitNewPage(){ var pi = CreatePageInfo(); - return new Page(pi); + return new Page(pi,ReportModel.ReportSettings.PageSize); } IPageInfo CreatePageInfo() @@ -43,7 +44,6 @@ namespace ICSharpCode.Reporting.PageBuilder pi.PageNumber = Pages.Count +1; pi.ReportName = ReportModel.ReportSettings.ReportName; pi.ReportFileName = ReportModel.ReportSettings.FileName; -// pi.ReportName = ReportModel.ReportSettings.ReportName; return pi; } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/ContainerConverter.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/ContainerConverter.cs new file mode 100644 index 0000000000..d03a5adbda --- /dev/null +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/ContainerConverter.cs @@ -0,0 +1,53 @@ +/* + * Created by SharpDevelop. + * User: Peter Forstmeier + * Date: 08.04.2013 + * Time: 19:49 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Collections.Generic; +using System.Drawing; + +using ICSharpCode.Reporting.Factories; +using ICSharpCode.Reporting.Interfaces; +using ICSharpCode.Reporting.Interfaces.Export; +using ICSharpCode.Reporting.Items; +using ICSharpCode.Reporting.PageBuilder.ExportColumns; + +namespace ICSharpCode.Reporting.PageBuilder.Converter +{ + /// + /// Description of SectionConverter. + /// + internal class ContainerConverter + { + private ExportColumnFactory factory; + + public ContainerConverter(IReportContainer container,Point currentLocation ) + { + Container = container; + CurrentLocation = currentLocation; + factory = new ExportColumnFactory(); + } + + + public IExportContainer Convert() { + Console.WriteLine("Convert section for location {0}",CurrentLocation); + var exportContainer = (ExportContainer)Container.CreateExportColumn(); + exportContainer.Location = CurrentLocation; + var itemsList = new List(); + foreach (var element in Container.Items) { + var item = factory.CreateItem(element); + itemsList.Add(item); + } + exportContainer.ExportedItems.AddRange(itemsList); + return exportContainer; + } + + internal IReportContainer Container {get; private set;} + + internal Point CurrentLocation {get; private set;} + } +} diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/SectionConverter.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/SectionConverter.cs deleted file mode 100644 index 3a4f864145..0000000000 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/SectionConverter.cs +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Created by SharpDevelop. - * User: Peter Forstmeier - * Date: 08.04.2013 - * Time: 19:49 - * - * To change this template use Tools | Options | Coding | Edit Standard Headers. - */ -using System; -using System.Collections.Generic; -using System.Drawing; - -using ICSharpCode.Reporting.Factories; -using ICSharpCode.Reporting.Interfaces; -using ICSharpCode.Reporting.PageBuilder.ExportColumns; - -namespace ICSharpCode.Reporting.PageBuilder.Converter -{ - /// - /// Description of SectionConverter. - /// - internal class SectionConverter - { - private Point currentPoint; - private ExportColumnFactory factory; - - public SectionConverter(ISection section,Point currentPoint ) - { - Section = section; - this.currentPoint = currentPoint; - factory = new ExportColumnFactory(); - } - - public List Convert(){ - var l = new List(); - foreach (var element in Section.Items) { - - var item = factory.CreateItem(element); - l.Add(item); - } - - return l; - } - - public ISection Section {get; private set;} - } -} diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/BaseExportColumn.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportColumn.cs similarity index 59% rename from src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/BaseExportColumn.cs rename to src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportColumn.cs index d0c384ddad..5188a6594b 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/BaseExportColumn.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportColumn.cs @@ -7,15 +7,24 @@ * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; +using System.Drawing; +using ICSharpCode.Reporting.BaseClasses; using ICSharpCode.Reporting.Interfaces; +using ICSharpCode.Reporting.Interfaces.Export; namespace ICSharpCode.Reporting.PageBuilder.ExportColumns { /// /// Description of BaseExportColumn. /// - public class BaseExportColumn:IExportColumn + public class ExportColumn:IExportColumn { + public string Name {get;set;} + + public Size Size {get;set;} + + public Point Location {get;set;} + } } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportContainer.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportContainer.cs new file mode 100644 index 0000000000..561acc680f --- /dev/null +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportContainer.cs @@ -0,0 +1,28 @@ +/* + * Created by SharpDevelop. + * User: Peter Forstmeier + * Date: 12.04.2013 + * Time: 20:27 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Collections.Generic; +using ICSharpCode.Reporting.Interfaces.Export; + +namespace ICSharpCode.Reporting.PageBuilder.ExportColumns +{ + /// + /// Description of BaseExportContainer. + /// + public class ExportContainer:ExportColumn,IExportContainer + { + public ExportContainer() + { + ExportedItems = new List(); + } + + public List ExportedItems {get;set;} + + } +} diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportText.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportText.cs index e2a542198f..54f865b707 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportText.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportText.cs @@ -13,10 +13,11 @@ namespace ICSharpCode.Reporting.PageBuilder.ExportColumns /// /// Description of ExportText. /// - public class ExportText:BaseExportColumn + public class ExportText:ExportColumn { public ExportText() { } + } } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/FormPageBuilder.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/FormPageBuilder.cs index f61fbe9ddc..d542cfbe62 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/FormPageBuilder.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/FormPageBuilder.cs @@ -10,7 +10,9 @@ using System; using System.Drawing; using ICSharpCode.Reporting.BaseClasses; using ICSharpCode.Reporting.Interfaces; +using ICSharpCode.Reporting.Interfaces.Export; using ICSharpCode.Reporting.PageBuilder.Converter; +using ICSharpCode.Reporting.PageBuilder.ExportColumns; namespace ICSharpCode.Reporting.PageBuilder { @@ -38,21 +40,71 @@ namespace ICSharpCode.Reporting.PageBuilder void BuildReportHeader() { if (Pages.Count == 0) { - - CurrentLocation = new Point(10,10); - var sc = new SectionConverter(ReportModel.ReportHeader,base.CurrentLocation); - var itemsList = sc.Convert(); - CurrentPage.Items.AddRange(itemsList); + var sc = new ContainerConverter(ReportModel.ReportHeader,CurrentLocation); + var header =sc.Convert(); + CurrentPage.ExportedItems.Add(header); + var r = new Rectangle(header.Location.X,header.Location.Y,header.Size.Width,header.Size.Height); + CurrentLocation = new Point (ReportModel.ReportSettings.LeftMargin,r.Bottom + 10); } } + void BuildPageHeader() + { + var sc = new ContainerConverter(ReportModel.PageHeader,CurrentLocation); + var header =sc.Convert(); + CurrentPage.ExportedItems.Add(header); + } + + void BuilDetail() + { + Console.WriteLine("Build DetailSection {0} - {1} - {2}",ReportModel.ReportSettings.PageSize.Width,ReportModel.ReportSettings.LeftMargin,ReportModel.ReportSettings.RightMargin); + } + + + void BuildPageFooter() + { + Console.WriteLine("Build PageFooter {0} - {1}",ReportModel.ReportSettings.PageSize.Height,ReportModel.ReportSettings.BottomMargin); + CurrentLocation = new Point(ReportModel.ReportSettings.LeftMargin, + ReportModel.ReportSettings.PageSize.Height - ReportModel.ReportSettings.BottomMargin - ReportModel.PageFooter.Size.Height); + + var sc = new ContainerConverter(ReportModel.PageFooter,CurrentLocation); + var header =sc.Convert(); + CurrentPage.ExportedItems.Add(header); + } void WritePages() { CurrentPage = base.InitNewPage(); + CurrentLocation = new Point(ReportModel.ReportSettings.LeftMargin,ReportModel.ReportSettings.TopMargin); this.BuildReportHeader(); + BuildPageHeader(); + BuilDetail(); + BuildPageFooter(); base.AddPage(CurrentPage); - var x = ReportModel; + + Console.WriteLine("<{0}> Pages created",Pages.Count); + + foreach (var page in Pages) { + ShowPage(page); + } + + } + + + + + + void ShowPage( IExportContainer container) + { + foreach (var item in container.ExportedItems) { + + if (item is IExportContainer) { + Console.WriteLine("Container: {0}- {1} - {2}",item.Name,item.Location,item.Size); + ShowPage(item as IExportContainer); + } else { + Console.WriteLine("\tItem {0} -relativ location <{1}> - {2}",item.Name,item.Location,item.Size); + } + } } } } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/ICSharpCode.Reporting.Test.csproj b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/ICSharpCode.Reporting.Test.csproj index 1fa451579b..eeada9a834 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/ICSharpCode.Reporting.Test.csproj +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/ICSharpCode.Reporting.Test.csproj @@ -63,6 +63,7 @@ + diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/PageBuilder/BaseConvertFixture.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/PageBuilder/BaseConvertFixture.cs index 213c669031..9e0679ebbe 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/PageBuilder/BaseConvertFixture.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/PageBuilder/BaseConvertFixture.cs @@ -25,18 +25,26 @@ namespace ICSharpCode.Reporting.Test.PageBuilder public void CurrentPageContainOneItem() { reportCreator.BuildExportList(); var page = reportCreator.Pages[0]; - Assert.That(page.Items.Count, Is.EqualTo(1)); + Assert.That(page.ExportedItems.Count, Is.EqualTo(3)); } [Test] - public void PageItemIsBaseExportColumn() { + public void PageItemIsBaseExportContainer() { reportCreator.BuildExportList(); var page = reportCreator.Pages[0]; - Assert.That(page.Items[0],Is.InstanceOf(typeof(ExportText))); + Assert.That(page.ExportedItems[0],Is.InstanceOf(typeof(ExportContainer))); } + [Test] + public void ExportContainerContainsExportText() { + reportCreator.BuildExportList(); + var page = reportCreator.Pages[0]; + var firstItem = (ExportContainer)page.ExportedItems[0]; + var result = firstItem.ExportedItems[0]; + Assert.That(result,Is.InstanceOf(typeof(ExportText))); + } [SetUp] public void LoadFromStream() { diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/PageBuilder/ContainerConverterFixture.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/PageBuilder/ContainerConverterFixture.cs new file mode 100644 index 0000000000..13460e0adb --- /dev/null +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/PageBuilder/ContainerConverterFixture.cs @@ -0,0 +1,74 @@ +/* + * Created by SharpDevelop. + * User: Peter Forstmeier + * Date: 17.04.2013 + * Time: 20:14 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Drawing; +using ICSharpCode.Reporting.Interfaces; +using ICSharpCode.Reporting.Interfaces.Export; +using ICSharpCode.Reporting.Items; +using ICSharpCode.Reporting.PageBuilder.Converter; +using ICSharpCode.Reporting.PageBuilder.ExportColumns; +using NUnit.Framework; + +namespace ICSharpCode.Reporting.Test.PageBuilder +{ + [TestFixture] + public class ContainerConverterFixture + { + private IReportContainer container; + + + [Test] + public void ConverterReturnExportContainer() { + var converter = new ContainerConverter(container,new Point(30,30)); + var result = converter.Convert(); + Assert.That(result,Is.InstanceOf(typeof(IExportContainer))); + } + + + [Test] + public void ConverterReturnExportContainerwithTwoItems() + { + var converter = new ContainerConverter(container,new Point(30,30)); + var result = converter.Convert(); + Assert.That(result.ExportedItems.Count,Is.EqualTo(2)); + } + + + [Test] + public void LocationIsAdjusted() { + var pp = new Point(30,30); + var converter = new ContainerConverter(container,pp); + var result = converter.Convert(); + Assert.That(result.Location,Is.EqualTo(pp)); + } + [TestFixtureSetUp] + public void Init() + { + container = new BaseSection(){ + Size = new Size (720,60), + Location = new Point(50,50), + Name ="Section" + }; + + var item1 = new BaseTextItem(){ + Name = "Item1", + Location = new Point(10,10), + Size = new Size (60,20) + }; + + var item2 = new BaseTextItem(){ + Name = "Item2", + Location = new Point(80,10), + Size = new Size (60,20) + }; + container.Items.Add(item1); + container.Items.Add(item2); + } + } +} diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/PageBuilder/PageBuilderFixture.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/PageBuilder/PageBuilderFixture.cs index a3e4450b62..2408207dc7 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/PageBuilder/PageBuilderFixture.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/PageBuilder/PageBuilderFixture.cs @@ -11,6 +11,7 @@ using System.IO; using System.Reflection; using ICSharpCode.Reporting.Interfaces; +using ICSharpCode.Reporting.Interfaces.Export; using ICSharpCode.Reporting.PageBuilder; using NUnit.Framework; @@ -30,7 +31,6 @@ namespace ICSharpCode.Reporting.Test.PageBuilder } - #region Pages [Test] @@ -58,7 +58,6 @@ namespace ICSharpCode.Reporting.Test.PageBuilder public void CurrentPageIsFirstPage() { reportCreator.BuildExportList(); Assert.That(reportCreator.Pages[0].IsFirstPage,Is.True); - Assert.That(reportCreator.Pages[0].IsFirstPage,Is.True); } #endregion @@ -68,8 +67,8 @@ namespace ICSharpCode.Reporting.Test.PageBuilder [Test] public void PageInfoPageNumberIsOne() { reportCreator.BuildExportList(); - var pi = reportCreator.Pages[0].PageInfo; - Assert.That(pi.PageNumber,Is.EqualTo(1)); + var pageInfo = reportCreator.Pages[0].PageInfo; + Assert.That(pageInfo.PageNumber,Is.EqualTo(1)); } @@ -78,6 +77,26 @@ namespace ICSharpCode.Reporting.Test.PageBuilder reportCreator.BuildExportList(); var pi = reportCreator.Pages[0].PageInfo; Assert.That(pi.ReportName,Is.EqualTo("Report1")); + Console.WriteLine("----------------"); + foreach (var page in reportCreator.Pages) { + ShowPage(page); + } + } + + + void ShowPage( IExportContainer container) + { + foreach (var item in container.ExportedItems) { + + if (item is IExportContainer) { + Console.WriteLine("DoContainer {0} - {1} - {2}",item.Name,item.Location,item.Size); + ShowPage(item as IExportContainer); + } else { + Console.WriteLine("\tItem {0} - {1} - {2}",item.Name,item.Location,item.Size); + } + + + } } #endregion