From 4daad4ca7444bffed39ac0621b61bc4333afb6ea Mon Sep 17 00:00:00 2001 From: Peter Forstmeier Date: Sun, 29 Oct 2006 10:42:10 +0000 Subject: [PATCH] Exporter can handle Line, Rectangle and Circle git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1996 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../BaseItems/BaseGraphicItem.cs | 23 +++++++++++++++---- .../BaseItems/Graphics/BaseCircleItem.cs | 14 ++++++++++- .../BaseItems/Graphics/BaseLineItem.cs | 18 +++------------ .../BaseItems/Graphics/BaseRectangleItem.cs | 18 +++++++++++++-- .../SharpReportCore/Exporter/PageBuilder.cs | 4 +++- 5 files changed, 53 insertions(+), 24 deletions(-) diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseGraphicItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseGraphicItem.cs index 46753b52e0..5d4fbb4cd7 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseGraphicItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseGraphicItem.cs @@ -8,12 +8,14 @@ // //------------------------------------------------------------------------------ -namespace SharpReportCore { - using System; - using System.ComponentModel; - using System.Drawing; - using System.Drawing.Drawing2D; +using System; +using System.ComponentModel; +using System.Drawing; +using System.Drawing.Drawing2D; + +using SharpReportCore.Exporters; +namespace SharpReportCore { /// /// Baseclass for all Graphical Items /// @@ -29,6 +31,17 @@ namespace SharpReportCore { public BaseGraphicItem():base() { } + protected BaseStyleDecorator CreateItemStyle (BaseShape shape) { + BaseStyleDecorator style = new BaseStyleDecorator(); + style.Size = this.Size; + style.Location = this.Location; + style.BackColor = this.BackColor; + style.ForeColor = this.ForeColor; + style.Shape = shape; + style.Thickness = this.thickness; + style.DashStyle = this.dashStyle; + return style; + } protected static SizeF MeasureReportItem (IItemRenderer item) { if (item == null) { diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseCircleItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseCircleItem.cs index a8f7660643..cff20bb040 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseCircleItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseCircleItem.cs @@ -10,6 +10,7 @@ using System; using System.Drawing; +using SharpReportCore.Exporters; /// ///This class drwas a Circle /// @@ -18,13 +19,24 @@ using System.Drawing; /// created on - 29.09.2005 11:54:19 /// namespace SharpReportCore { - public class BaseCircleItem : SharpReportCore.BaseGraphicItem { + public class BaseCircleItem : SharpReportCore.BaseGraphicItem,IExportColumnBuilder { EllipseShape shape = new EllipseShape(); + #region Constructor public BaseCircleItem():base() { } + #endregion + + #region IExportColumnBuilder + public BaseExportColumn CreateExportColumn(Graphics graphics){ + BaseStyleDecorator style = base.CreateItemStyle(this.shape); + ExportGraphic item = new ExportGraphic(style,false); + return item; + } + + #endregion public override void Render(ReportPageEventArgs rpea) { if (rpea == null) { throw new ArgumentNullException("rpea"); diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseLineItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseLineItem.cs index 8df2cb2d48..de028709c5 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseLineItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseLineItem.cs @@ -36,23 +36,11 @@ namespace SharpReportCore { #region IExportColumnBuilder implementation public BaseExportColumn CreateExportColumn(Graphics graphics){ - BaseStyleDecorator st = this.CreateItemStyle(graphics); - ExportGraphic item = new ExportGraphic(st,false); + BaseStyleDecorator style = base.CreateItemStyle(this.shape); + ExportGraphic item = new ExportGraphic(style,false); return item; } - - private BaseStyleDecorator CreateItemStyle (Graphics g) { - BaseStyleDecorator style = new BaseStyleDecorator(); - style.Shape = this.shape; - style.Size = this.Size; - style.Location = this.Location; - style.BackColor = this.BackColor; - style.ForeColor = this.ForeColor; - style.Thickness = base.Thickness; - style.DashStyle = base.DashStyle; - return style; - } - + #endregion public override void Render(ReportPageEventArgs rpea) { if (rpea == null) { diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs index e678c33fcd..b7fb57827f 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs @@ -11,7 +11,7 @@ using System; using System.Drawing; - +using SharpReportCore.Exporters; /// /// This class draws a Rectangle /// @@ -20,13 +20,27 @@ using System.Drawing; /// created on - 29.09.2005 11:57:30 /// namespace SharpReportCore { - public class BaseRectangleItem : SharpReportCore.BaseGraphicItem { + public class BaseRectangleItem : SharpReportCore.BaseGraphicItem,IExportColumnBuilder { RectangleShape shape = new RectangleShape(); + #region Constructor + public BaseRectangleItem() { } + #endregion + + #region IExportColumnBuilder + + public BaseExportColumn CreateExportColumn(Graphics graphics){ + BaseStyleDecorator style = base.CreateItemStyle(this.shape); + ExportGraphic item = new ExportGraphic(style,false); + return item; + } + + #endregion + public override void Render(ReportPageEventArgs rpea) { if (rpea == null) { throw new ArgumentNullException("rpea"); diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/PageBuilder.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/PageBuilder.cs index 1dfa05ef8e..a7d567cbd4 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/PageBuilder.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/PageBuilder.cs @@ -27,7 +27,9 @@ namespace SharpReportCore.Exporters ExportItemsConverter lineItemsConverter; internal delegate ExporterCollection ConverterDelegate (BaseSection s); + #region Constructor + public PageBuilder () { pages = new PagesCollection(); } @@ -65,7 +67,7 @@ namespace SharpReportCore.Exporters this.lineItemsConverter.Offset = offset; List list = section.Items.ConvertAll (this.lineItemsConverter.ConvertToLineItems); - list.ForEach(display); +// list.ForEach(display); /* if (list.Count > 0) { list.ForEach(delegate(BaseExportColumn item){