Browse Source

Different Types of Decorator's (Base,text and Graphic)

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1998 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Peter Forstmeier 19 years ago
parent
commit
eb9b3b780f
  1. 2
      src/AddIns/Misc/SharpReport/SharpReport.sln
  2. 6
      src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseDataItem.cs
  3. 7
      src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseGraphicItem.cs
  4. 12
      src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs
  5. 5
      src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseCircleItem.cs
  6. 4
      src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseLineItem.cs
  7. 4
      src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs
  8. 2
      src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs
  9. 79
      src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/BaseStyleDecorator.cs
  10. 48
      src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/Decorators/GraphicStyleDecorator.cs
  11. 69
      src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/Decorators/TextStyleDecorator.cs
  12. 4
      src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/ExportColumns/BaseExportColumn.cs
  13. 26
      src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/ExportColumns/ExportGraphic.cs
  14. 2
      src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/ExportColumns/ExportText.cs
  15. 4
      src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/ExportColumns/IExportColumnBuilder .cs
  16. 11
      src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/PageBuilder.cs
  17. 2
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/TextDrawer.cs
  18. 4
      src/AddIns/Misc/SharpReport/SharpReportCore/ReportViewer/ReportViewer.cs
  19. 3
      src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj

2
src/AddIns/Misc/SharpReport/SharpReport.sln

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# SharpDevelop 2.1.0.1987
# SharpDevelop 2.1.0.1997
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpReportCore", "SharpReportCore\SharpReportCore.csproj", "{4B2239FF-8FD6-431D-9D22-1B8049BA6917}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpReport", "SharpReport\SharpReport.csproj", "{F5563727-8309-4AC3-BACA-EB28EFD8A1D0}"

6
src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseDataItem.cs

@ -65,11 +65,9 @@ namespace SharpReportCore { @@ -65,11 +65,9 @@ namespace SharpReportCore {
#endregion
#region IExportColumnBuilder implementation
// public new IPerformLine CreateExportColumn(Graphics graphics)
public new BaseExportColumn CreateExportColumn(Graphics graphics)
{
public new BaseExportColumn CreateExportColumn(Graphics graphics){
string toPrint = CheckForNullValue();
BaseStyleDecorator st = base.CreateItemStyle(graphics);
TextStyleDecorator st = base.CreateItemStyle(graphics);
ExportText item = new ExportText(st,false);
item.Text = base.FormatOutput(toPrint,
this.FormatString,

7
src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseGraphicItem.cs

@ -31,13 +31,14 @@ namespace SharpReportCore { @@ -31,13 +31,14 @@ namespace SharpReportCore {
public BaseGraphicItem():base() {
}
protected BaseStyleDecorator CreateItemStyle (BaseShape shape) {
BaseStyleDecorator style = new BaseStyleDecorator();
protected GraphicStyleDecorator CreateItemStyle (BaseShape shape) {
GraphicStyleDecorator style = new GraphicStyleDecorator(shape);
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;

12
src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs

@ -49,16 +49,15 @@ namespace SharpReportCore { @@ -49,16 +49,15 @@ namespace SharpReportCore {
public BaseExportColumn CreateExportColumn(Graphics graphics){
BaseStyleDecorator st = this.CreateItemStyle(graphics);
TextStyleDecorator st = this.CreateItemStyle(graphics);
ExportText item = new ExportText(st,false);
item.Text = this.text;
return item;
}
protected BaseStyleDecorator CreateItemStyle (Graphics g) {
BaseStyleDecorator style = new BaseStyleDecorator();
protected TextStyleDecorator CreateItemStyle (Graphics g) {
TextStyleDecorator style = new TextStyleDecorator();
SizeF measureSizeF = new SizeF ();
measureSizeF = g.MeasureString(text,
this.Font,
@ -76,10 +75,9 @@ namespace SharpReportCore { @@ -76,10 +75,9 @@ namespace SharpReportCore {
style.StringFormat = this.stringFormat;
style.StringTrimming = this.stringTrimming;
style.ContentAlignment = this.contentAlignment;
return style;
}
#endregion
protected string FormatOutput(string valueToFormat,string format,

5
src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseCircleItem.cs

@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
using System;
using System.Drawing;
using SharpReportCore.Exporters;
/// <summary>
///This class drwas a Circle
/// </summary>
@ -31,9 +32,9 @@ namespace SharpReportCore { @@ -31,9 +32,9 @@ namespace SharpReportCore {
#region IExportColumnBuilder
public BaseExportColumn CreateExportColumn(Graphics graphics){
BaseStyleDecorator style = base.CreateItemStyle(this.shape);
GraphicStyleDecorator style = base.CreateItemStyle(this.shape);
ExportGraphic item = new ExportGraphic(style,false);
return item;
return item as ExportGraphic;
}
#endregion

4
src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseLineItem.cs

@ -36,9 +36,9 @@ namespace SharpReportCore { @@ -36,9 +36,9 @@ namespace SharpReportCore {
#region IExportColumnBuilder implementation
public BaseExportColumn CreateExportColumn(Graphics graphics){
BaseStyleDecorator style = base.CreateItemStyle(this.shape);
GraphicStyleDecorator style = base.CreateItemStyle(this.shape);
ExportGraphic item = new ExportGraphic(style,false);
return item;
return item as ExportGraphic;
}
#endregion

4
src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs

@ -34,9 +34,9 @@ namespace SharpReportCore { @@ -34,9 +34,9 @@ namespace SharpReportCore {
#region IExportColumnBuilder
public BaseExportColumn CreateExportColumn(Graphics graphics){
BaseStyleDecorator style = base.CreateItemStyle(this.shape);
GraphicStyleDecorator style = base.CreateItemStyle(this.shape);
ExportGraphic item = new ExportGraphic(style,false);
return item;
return item as ExportGraphic;
}
#endregion

2
src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs

@ -58,7 +58,7 @@ namespace SharpReportCore{ @@ -58,7 +58,7 @@ namespace SharpReportCore{
protected BaseStyleDecorator CreateItemStyle (Graphics g) {
BaseStyleDecorator style = new BaseStyleDecorator();
style.BackColor = this.BackColor;
style.ForeColor = this.ForeColor;
style.Location = this.Location;

79
src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/BaseStyleDecorator.cs

@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Drawing2D;
namespace SharpReportCore.Exporters
{
/// <summary>
@ -22,15 +22,6 @@ namespace SharpReportCore.Exporters @@ -22,15 +22,6 @@ namespace SharpReportCore.Exporters
private Color foreColor;
private Point location;
private Size size;
private Font font;
private StringFormat stringFormat;
private StringTrimming stringTrimming;
private ContentAlignment contentAlignment;
private BaseShape shape;
private int thickness = 1;
private DashStyle dashStyle = DashStyle.Solid;
public BaseStyleDecorator():this(Color.White,Color.Black){
}
@ -86,42 +77,8 @@ namespace SharpReportCore.Exporters @@ -86,42 +77,8 @@ namespace SharpReportCore.Exporters
}
}
public Font Font {
get {
return font;
}
set {
font = value;
}
}
public StringFormat StringFormat {
get {
return stringFormat;
}
set {
stringFormat = value;
}
}
public StringTrimming StringTrimming {
get {
return stringTrimming;
}
set {
stringTrimming = value;
}
}
public ContentAlignment ContentAlignment {
get {
return contentAlignment;
}
set {
contentAlignment = value;
}
}
public Rectangle DisplayRectangle {
get {
return new Rectangle(this.location.X,this.location.Y,
@ -129,36 +86,6 @@ namespace SharpReportCore.Exporters @@ -129,36 +86,6 @@ namespace SharpReportCore.Exporters
}
}
public void DrawGraphic (Graphics graphics) {
if (graphics == null) {
throw new ArgumentNullException("graphics");
}
this.shape.DrawShape(graphics,
new BaseLine (this.foreColor,this.dashStyle,this.thickness),
this.DisplayRectangle);
}
public BaseShape Shape {
get { return shape; }
set { shape = value; }
}
public int Thickness {
get { return thickness; }
set { thickness = value; }
}
public DashStyle DashStyle {
get { return dashStyle; }
set { dashStyle = value; }
}
}
public class TextDecorator :BaseStyleDecorator
{
TextDecorator () :base() {
}
}
}

48
src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/Decorators/GraphicStyleDecorator.cs

@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
/*
* Erstellt mit SharpDevelop.
* Benutzer: Forstmeier Peter
* Datum: 29.10.2006
* Zeit: 14:52
*
* Sie können diese Vorlage unter Extras > Optionen > Codeerstellung > Standardheader ändern.
*/
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace SharpReportCore.Exporters
{
/// <summary>
/// Description of GraphicStyleDecorator.
/// </summary>
public class GraphicStyleDecorator:BaseStyleDecorator
{
private BaseShape shape;
private int thickness = 1;
private DashStyle dashStyle = DashStyle.Solid;
public GraphicStyleDecorator(BaseShape shape):base(){
if (shape == null) {
throw new ArgumentNullException("shape");
}
this.shape = shape;
}
public BaseShape Shape {
get { return shape; }
set { shape = value; }
}
public int Thickness {
get { return thickness; }
set { thickness = value; }
}
public DashStyle DashStyle {
get { return dashStyle; }
set { dashStyle = value; }
}
}
}

69
src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/Decorators/TextStyleDecorator.cs

@ -0,0 +1,69 @@ @@ -0,0 +1,69 @@
/*
* Erstellt mit SharpDevelop.
* Benutzer: Forstmeier Peter
* Datum: 29.10.2006
* Zeit: 14:27
*
* Sie können diese Vorlage unter Extras > Optionen > Codeerstellung > Standardheader ändern.
*/
using System;
using System.Drawing;
namespace SharpReportCore.Exporters
{
/// <summary>
/// Description of TextStyleDecorator.
/// </summary>
public class TextStyleDecorator:BaseStyleDecorator
{
private Font font;
private StringFormat stringFormat;
private StringTrimming stringTrimming;
private ContentAlignment contentAlignment;
public TextStyleDecorator():base()
{
}
public Font Font {
get {
return font;
}
set {
font = value;
}
}
public StringFormat StringFormat {
get {
return stringFormat;
}
set {
stringFormat = value;
}
}
public StringTrimming StringTrimming {
get {
return stringTrimming;
}
set {
stringTrimming = value;
}
}
public ContentAlignment ContentAlignment {
get {
return contentAlignment;
}
set {
contentAlignment = value;
}
}
}
}

4
src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/ExportColumns/BaseExportColumn.cs

@ -15,8 +15,8 @@ namespace SharpReportCore.Exporters @@ -15,8 +15,8 @@ namespace SharpReportCore.Exporters
/// <summary>
/// Description of BaseLineItem.
/// </summary>
public class BaseExportColumn :IPerformLine
{
public class BaseExportColumn{
BaseStyleDecorator styleDecorator;
bool isContainer;

26
src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/ExportColumns/ExportGraphic.cs

@ -8,13 +8,14 @@ @@ -8,13 +8,14 @@
*/
using System;
using System.Drawing;
namespace SharpReportCore.Exporters
{
/// <summary>
/// Description of ExportGraphic.
/// </summary>
public class ExportGraphic:BaseExportColumn,IPerformLine
public class ExportGraphic:BaseExportColumn
{
public ExportGraphic():base()
{
@ -22,15 +23,24 @@ namespace SharpReportCore.Exporters @@ -22,15 +23,24 @@ namespace SharpReportCore.Exporters
public ExportGraphic (BaseStyleDecorator itemStyle,bool isContainer):base(itemStyle,isContainer){
}
public override BaseStyleDecorator StyleDecorator {
get {
return base.StyleDecorator;
}
set {
base.StyleDecorator = value;
public void DrawGraphic (Graphics graphics) {
if (graphics == null) {
throw new ArgumentNullException("graphics");
}
GraphicStyleDecorator style = (GraphicStyleDecorator) base.StyleDecorator;
style.Shape.DrawShape(graphics,
new BaseLine (style.ForeColor,style.DashStyle,style.Thickness),
style.DisplayRectangle);
}
// public override BaseStyleDecorator StyleDecorator {
// get {
// return base.StyleDecorator as GraphicStyleDecorator;
// }
// set {
// base.StyleDecorator = value;
// }
// }
}
}

2
src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/ExportColumns/ExportText.cs

@ -13,7 +13,7 @@ namespace SharpReportCore.Exporters { @@ -13,7 +13,7 @@ namespace SharpReportCore.Exporters {
/// <summary>
/// Description of LineItem.
/// </summary>
public class ExportText :BaseExportColumn,IPerformLine{
public class ExportText :BaseExportColumn{
string text;
public ExportText():base(){

4
src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/ExportColumns/IExportColumnBuilder .cs

@ -19,11 +19,11 @@ namespace SharpReportCore @@ -19,11 +19,11 @@ namespace SharpReportCore
public interface IExportColumnBuilder{
BaseExportColumn CreateExportColumn (Graphics graphics);
}
/*
public interface IPerformLine{
BaseStyleDecorator StyleDecorator {
get;set;
}
}
*/
}

11
src/AddIns/Misc/SharpReport/SharpReportCore/Exporter/PageBuilder.cs

@ -206,15 +206,16 @@ namespace SharpReportCore.Exporters @@ -206,15 +206,16 @@ namespace SharpReportCore.Exporters
BaseSection section = this.reportModel.PageFooter;
this.DoConvert (this.reportModel.PageFooter,this.singlePage.SectionBounds.PageFooterRectangle.Top);
}
private void display (IPerformLine li) {
/*
private void display (BaseStyleDecorator li) {
// private void display (IPerformLine li) {
// System.Console.WriteLine("\tdisplay {0}",li.ToString());
ExportText l = li as ExportText;
if (l != null) {
// ExportText l = li as ExportText;
if (li != null) {
System.Console.WriteLine("\t\t{0} / {1} ",l.StyleDecorator.Location,l.Text);
}
}
*/
private void Write () {
this.dataNavigator = this.dataManager.GetNavigator;
Graphics graphics = reportModel.ReportSettings.PageSettings.PrinterSettings.CreateMeasurementGraphics();

2
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/TextDrawer.cs

@ -68,7 +68,7 @@ namespace SharpReportCore { @@ -68,7 +68,7 @@ namespace SharpReportCore {
}
public static void PaintString (Graphics graphics,string text,
SharpReportCore.Exporters.BaseStyleDecorator decorator) {
SharpReportCore.Exporters.TextStyleDecorator decorator) {
// d.DrawString(gr,
// ex.ToString(),

4
src/AddIns/Misc/SharpReport/SharpReportCore/ReportViewer/ReportViewer.cs

@ -91,10 +91,10 @@ namespace SharpReportCore.ReportViewer @@ -91,10 +91,10 @@ namespace SharpReportCore.ReportViewer
// System.Console.WriteLine("{0}",ex.GetType());
ExportGraphic eg = ex as ExportGraphic;
if (eg != null) {
eg.StyleDecorator.DrawGraphic(gr);
eg.DrawGraphic(gr);
} else {
TextDrawer.PaintString(gr,ex.ToString(),ex.StyleDecorator);
TextDrawer.PaintString(gr,ex.ToString(),(TextStyleDecorator)ex.StyleDecorator);
}
} else {

3
src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj

@ -155,6 +155,8 @@ @@ -155,6 +155,8 @@
</EmbeddedResource>
<Compile Include="Exporter\ExporterCollection.cs" />
<Compile Include="Exporter\ExportColumns\ExportGraphic.cs" />
<Compile Include="Exporter\Decorators\TextStyleDecorator.cs" />
<Compile Include="Exporter\Decorators\GraphicStyleDecorator.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="BaseItems" />
@ -185,6 +187,7 @@ @@ -185,6 +187,7 @@
<Content Include="ReportViewer\Resources\Icons.16x16.Print.png" />
<Content Include="ReportViewer\Resources\Icons.16x16.BrowserBefore.png" />
<Content Include="ReportViewer\Resources\Icons.16x16.BrowserAfter.png" />
<Folder Include="Exporter\Decorators" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>
Loading…
Cancel
Save