Browse Source

Layouter

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/reports@6203 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Peter Forstmeier 16 years ago
parent
commit
465cd08f08
  1. 20
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseClasses/Printing/StandardPrinter.cs
  2. 2
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseClasses/SectionBounds.cs
  3. 6
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseItems/BaseReportItem.cs
  4. 16
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseItems/BaseSection.cs
  5. 2
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseItems/BaseTableItem.cs
  6. 4
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseItems/BaseTextItem.cs
  7. 2
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseItems/ErrorItem.cs
  8. 2
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseItems/Graphics/BaseCircleItem.cs
  9. 6
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseItems/Graphics/BaseImageItem.cs
  10. 8
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseItems/Graphics/BaseLineItem.cs
  11. 2
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseItems/Graphics/BaseRectangleItem.cs
  12. 6
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/BasePager.cs
  13. 4
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Printing/AbstractDataRenderer.cs
  14. 61
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Printing/AbstractRenderer.cs
  15. 2
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Printing/RenderDataReport.cs

20
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseClasses/Printing/StandardPrinter.cs

@ -50,7 +50,6 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing
} }
public static void DrawBorder (Graphics graphics,BaseStyleDecorator decorator) public static void DrawBorder (Graphics graphics,BaseStyleDecorator decorator)
{ {
if (decorator.DrawBorder) if (decorator.DrawBorder)
@ -60,7 +59,6 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing
decorator.FrameColor = decorator.ForeColor; decorator.FrameColor = decorator.ForeColor;
} }
Border border = new Border(new BaseLine (decorator.FrameColor,System.Drawing.Drawing2D.DashStyle.Solid,1)); Border border = new Border(new BaseLine (decorator.FrameColor,System.Drawing.Drawing2D.DashStyle.Solid,1));
border.DrawBorder(graphics,decorator.DisplayRectangle); border.DrawBorder(graphics,decorator.DisplayRectangle);
} }
} }
@ -105,10 +103,12 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing
Point saveLocation = new Point (item.Location.X,item.Location.Y); Point saveLocation = new Point (item.Location.X,item.Location.Y);
item.Location = new Point(item.Location.X,
item.Location = new Point(offset.X + item.Location.X,
offset.Y + item.Location.Y); offset.Y + item.Location.Y);
// item.Location = new Point(offset.X + item.Location.X,
// offset.Y + item.Location.Y);
//
var ss = MeasurementService.MeasureReportItem(rpea.PrintPageEventArgs.Graphics,item); var ss = MeasurementService.MeasureReportItem(rpea.PrintPageEventArgs.Graphics,item);
BaseTextItem textItem = item as BaseTextItem; BaseTextItem textItem = item as BaseTextItem;
@ -137,10 +137,12 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing
#region Render Collection #region Render Collection
public static Rectangle RenderPlainCollection (BaseReportItem parent,ReportItemCollection items,IExpressionEvaluatorFacade evaluator, Point offset,ReportPageEventArgs rpea) public static Rectangle RenderPlainCollection (BaseReportItem parent,
ReportItemCollection items,
IExpressionEvaluatorFacade evaluator,
Point offset,
ReportPageEventArgs rpea)
{ {
Rectangle retVal = Rectangle.Empty;
Size size = Size.Empty;
if (items.Count > 0) { if (items.Count > 0) {
foreach (BaseReportItem child in items) { foreach (BaseReportItem child in items) {
@ -178,8 +180,8 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing
BaseReportItem item = simpleContainer as BaseReportItem; BaseReportItem item = simpleContainer as BaseReportItem;
Rectangle retVal = new Rectangle(offset,item.Size); Rectangle retVal = new Rectangle(offset,item.Size);
Point loc = item.Location; Point loc = item.Location;
item.Location = new Point (offset.X + item.Location.X,offset.Y + item.Location.Y); // item.Location = new Point (offset.X + item.Location.X,offset.Y + item.Location.Y);
item.Location = new Point (item.Location.X,offset.Y + item.Location.Y);
item.Render(rpea); item.Render(rpea);
if (simpleContainer.Items != null) { if (simpleContainer.Items != null) {

2
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseClasses/SectionBounds.cs

@ -103,7 +103,7 @@ namespace ICSharpCode.Reports.Core{
this.pageHeaderRectangle = new Rectangle (this.reportHeaderRectangle.Left, this.pageHeaderRectangle = new Rectangle (this.reportHeaderRectangle.Left,
section.SectionOffset, section.SectionOffset,
this.marginBounds.Width, this.marginBounds.Width,
section.Size.Height + this.gap); section.Size.Height + 3 * GlobalValues.GapBetweenContainer);
} }

6
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseItems/BaseReportItem.cs

@ -84,7 +84,7 @@ namespace ICSharpCode.Reports.Core {
bsd.FrameColor = this.FrameColor; bsd.FrameColor = this.FrameColor;
bsd.Location = this.Location; bsd.Location = this.Location;
bsd.Size = this.Size; bsd.Size = this.Size;
bsd.DisplayRectangle = this.DrawingRectangle; bsd.DisplayRectangle = this.DisplayRectangle;
return bsd; return bsd;
} }
@ -98,12 +98,12 @@ namespace ICSharpCode.Reports.Core {
protected void DrawFrame (Graphics graphics,Border border) { protected void DrawFrame (Graphics graphics,Border border) {
if (this.DrawBorder == true) { if (this.DrawBorder == true) {
border.DrawBorder(graphics,this.DrawingRectangle); border.DrawBorder(graphics,this.DisplayRectangle);
} }
} }
protected Rectangle DrawingRectangle protected virtual Rectangle DisplayRectangle
{ {
get { get {
if (Parent != null) { if (Parent != null) {

16
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseItems/BaseSection.cs

@ -49,16 +49,18 @@ namespace ICSharpCode.Reports.Core
{ {
this.NotifyPrinting(); this.NotifyPrinting();
base.Render(rpea); base.Render(rpea);
// if (this.DrawBorder == true) {
// Border b = new Border(new BaseLine (this.FrameColor,System.Drawing.Drawing2D.DashStyle.Solid,1));
//// Rectangle r = new Rectangle (this.Location,this.Size);
//// b.DrawBorder(rpea.PrintPageEventArgs.Graphics,r);
// }
this.NotifyPrinted(); this.NotifyPrinted();
} }
protected override Rectangle DisplayRectangle {
get {
return new Rectangle(Location.X + this.Location.X, this.Location.Y ,
this.Size.Width,this.Size.Height);
}
}
private void NotifyPrinting () private void NotifyPrinting ()
{ {
if (this.SectionPrinting != null) { if (this.SectionPrinting != null) {

2
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseItems/BaseTableItem.cs

@ -48,7 +48,7 @@ namespace ICSharpCode.Reports.Core {
BaseStyleDecorator style = new BaseStyleDecorator(); BaseStyleDecorator style = new BaseStyleDecorator();
style.BackColor = this.BackColor; style.BackColor = this.BackColor;
style.ForeColor = this.ForeColor; style.ForeColor = this.ForeColor;
Rectangle rect = base.DrawingRectangle; Rectangle rect = base.DisplayRectangle;
style.Location = new Point(rect.Left,this.Location.Y); style.Location = new Point(rect.Left,this.Location.Y);
style.Size = this.Size; style.Size = this.Size;
style.DrawBorder = this.DrawBorder; style.DrawBorder = this.DrawBorder;

4
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseItems/BaseTextItem.cs

@ -62,7 +62,7 @@ namespace ICSharpCode.Reports.Core
style.Location = this.Location; style.Location = this.Location;
style.Size = this.Size; style.Size = this.Size;
style.DrawBorder = this.DrawBorder; style.DrawBorder = this.DrawBorder;
style.DisplayRectangle = this.DrawingRectangle; style.DisplayRectangle = this.DisplayRectangle;
style.StringFormat = this.stringFormat; style.StringFormat = this.stringFormat;
style.StringTrimming = this.stringTrimming; style.StringTrimming = this.stringTrimming;
@ -90,7 +90,7 @@ namespace ICSharpCode.Reports.Core
string formated = StandardFormatter.FormatOutput(this.text,this.FormatString,this.DataType,String.Empty); string formated = StandardFormatter.FormatOutput(this.text,this.FormatString,this.DataType,String.Empty);
Print (rpea,formated,base.DrawingRectangle); Print (rpea,formated,base.DisplayRectangle);
base.NotifyAfterPrint (rpea.LocationAfterDraw); base.NotifyAfterPrint (rpea.LocationAfterDraw);
} }

2
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseItems/ErrorItem.cs

@ -42,7 +42,7 @@ namespace ICSharpCode.Reports.Core
this.SetErrorLayout(); this.SetErrorLayout();
Border b = new Border(new BaseLine (this.ForeColor,System.Drawing.Drawing2D.DashStyle.Solid,1)); Border b = new Border(new BaseLine (this.ForeColor,System.Drawing.Drawing2D.DashStyle.Solid,1));
base.DrawFrame(rpea.PrintPageEventArgs.Graphics,b); base.DrawFrame(rpea.PrintPageEventArgs.Graphics,b);
Print (rpea,this.errMess,base.DrawingRectangle); Print (rpea,this.errMess,base.DisplayRectangle);
} }
#region IExportColumnBuilder implementation #region IExportColumnBuilder implementation

2
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseItems/Graphics/BaseCircleItem.cs

@ -47,7 +47,7 @@ namespace ICSharpCode.Reports.Core {
throw new ArgumentNullException("rpea"); throw new ArgumentNullException("rpea");
} }
base.Render (rpea); base.Render (rpea);
Rectangle rect = base.DrawingRectangle; Rectangle rect = base.DisplayRectangle;
shape.FillShape(rpea.PrintPageEventArgs.Graphics, shape.FillShape(rpea.PrintPageEventArgs.Graphics,
new SolidFillPattern(this.BackColor), new SolidFillPattern(this.BackColor),

6
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseItems/Graphics/BaseImageItem.cs

@ -125,8 +125,8 @@ namespace ICSharpCode.Reports.Core {
Graphics g = rpea.PrintPageEventArgs.Graphics; Graphics g = rpea.PrintPageEventArgs.Graphics;
if (this.Image == null){ if (this.Image == null){
this.Image = ErrorBitmap(new Size (base.DrawingRectangle.Width, this.Image = ErrorBitmap(new Size (base.DisplayRectangle.Width,
base.DrawingRectangle.Height) ); base.DisplayRectangle.Height) );
} }
if (this.scaleImageToSize) { if (this.scaleImageToSize) {
@ -135,7 +135,7 @@ namespace ICSharpCode.Reports.Core {
this.Location.Y + this.Image.Height); this.Location.Y + this.Image.Height);
} else { } else {
RectangleF rect = base.DrawingRectangle; RectangleF rect = base.DisplayRectangle;
g.DrawImage(this.Image,rect); g.DrawImage(this.Image,rect);
rpea.LocationAfterDraw = new Point (this.Location.X + (int)rect.Width, rpea.LocationAfterDraw = new Point (this.Location.X + (int)rect.Width,
this.Location.Y + (int)rect.Height); this.Location.Y + (int)rect.Height);

8
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseItems/Graphics/BaseLineItem.cs

@ -78,10 +78,10 @@ namespace ICSharpCode.Reports.Core {
this.startLineCap, this.startLineCap,
this.endLineCap, this.endLineCap,
this.dashLineCap), this.dashLineCap),
new Point(base.DrawingRectangle.Left + this.fromPoint.X, new Point(base.DisplayRectangle.Left + this.fromPoint.X,
this.FromPoint.Y + base.DrawingRectangle.Top), this.FromPoint.Y + base.DisplayRectangle.Top),
new Point (base.DrawingRectangle.Left + this.ToPoint.X, new Point (base.DisplayRectangle.Left + this.ToPoint.X,
this.ToPoint.Y + base.DrawingRectangle.Top)); this.ToPoint.Y + base.DisplayRectangle.Top));
} }

2
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseItems/Graphics/BaseRectangleItem.cs

@ -45,7 +45,7 @@ namespace ICSharpCode.Reports.Core {
throw new ArgumentNullException("rpea"); throw new ArgumentNullException("rpea");
} }
base.Render(rpea); base.Render(rpea);
Rectangle rect = base.DrawingRectangle; Rectangle rect = base.DisplayRectangle;
StandardPrinter.FillBackground(rpea.PrintPageEventArgs.Graphics,this.BaseStyleDecorator); StandardPrinter.FillBackground(rpea.PrintPageEventArgs.Graphics,this.BaseStyleDecorator);
shape.DrawShape (rpea.PrintPageEventArgs.Graphics, shape.DrawShape (rpea.PrintPageEventArgs.Graphics,

6
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/BasePager.cs

@ -99,9 +99,9 @@ namespace ICSharpCode.Reports.Core.Exporter
ExporterCollection list = new ExporterCollection(); ExporterCollection list = new ExporterCollection();
if (section.DrawBorder == true) { // if (section.DrawBorder == true) {
section.Items.Insert(0,CreateDebugItem(section)); // section.Items.Insert(0,CreateDebugItem(section));
} // }
if (section.Items.Count > 0) { if (section.Items.Count > 0) {

4
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Printing/AbstractDataRenderer.cs

@ -130,7 +130,7 @@ namespace ICSharpCode.Reports.Core
row.Size = rs; row.Size = rs;
} }
rpea.LocationAfterDraw = new Point(rpea.LocationAfterDraw.X,rpea.LocationAfterDraw.Y + 20); // rpea.LocationAfterDraw = new Point(rpea.LocationAfterDraw.X,rpea.LocationAfterDraw.Y + 5);
// base.NotifyAfterPrint (rpea.LocationAfterDraw); // base.NotifyAfterPrint (rpea.LocationAfterDraw);
} }
@ -156,8 +156,6 @@ namespace ICSharpCode.Reports.Core
} }
private Point RenderSectionWithSimpleContainer (BaseSection section, private Point RenderSectionWithSimpleContainer (BaseSection section,
ISimpleContainer container, ISimpleContainer container,
Point offset, Point offset,

61
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Printing/AbstractRenderer.cs

@ -211,49 +211,40 @@ namespace ICSharpCode.Reports.Core
{ {
Point currentPosition = Point.Empty; Point currentPosition = Point.Empty;
if (this.CurrentSection.Visible){ this.CurrentSection.Render (rpea);
this.CurrentSection.Render (rpea); Evaluator.SinglePage = this.reportDocument.SinglePage;
if (this.CurrentSection.Items.Count > 0) {
Evaluator.SinglePage = this.reportDocument.SinglePage; Rectangle desiredRectangle = Layout.Layout(rpea.PrintPageEventArgs.Graphics,this.CurrentSection);
if (this.CurrentSection.Items.Count > 0) { Rectangle sectionRectangle = new Rectangle(this.CurrentSection.Location.X,
this.CurrentSection.Location.Y,
this.CurrentSection.Size.Width,
this.CurrentSection.Size.Height);
Rectangle desiredRectangle = Layout.Layout(rpea.PrintPageEventArgs.Graphics,this.CurrentSection);
Rectangle sectionRectangle = new Rectangle(this.CurrentSection.Location.X,
this.CurrentSection.Location.Y,
this.CurrentSection.Size.Width,
this.CurrentSection.Size.Height);
if (desiredRectangle.Height >= sectionRectangle.Height) {
this.CurrentSection.Size = new Size(this.CurrentSection.Size.Width,desiredRectangle.Height + 10);
}
if (this.CurrentSection.DrawBorder) {
StandardPrinter.DrawBorder(rpea.PrintPageEventArgs.Graphics,this.CurrentSection.BaseStyleDecorator);
}
// PrintHelper.DebugRectangle(rpea.PrintPageEventArgs.Graphics,Pens.Blue,new Rectangle(CurrentSection.Location,CurrentSection.Size));
}
if (desiredRectangle.Height >= sectionRectangle.Height) {
this.CurrentSection.Size = new Size(this.CurrentSection.Size.Width,desiredRectangle.Height + 10);
}
Rectangle r = StandardPrinter.RenderPlainCollection (this.CurrentSection,this.CurrentSection.Items,Evaluator,new Point(this.CurrentSection.Location.X, if (this.CurrentSection.DrawBorder) {
this.CurrentSection.SectionOffset),rpea); StandardPrinter.DrawBorder(rpea.PrintPageEventArgs.Graphics,this.CurrentSection.BaseStyleDecorator);
}
currentPosition = PrintHelper.ConvertRectangleToCurentPosition(r);
if ((this.CurrentSection.CanGrow == false)&& (this.CurrentSection.CanShrink == false)) { // PrintHelper.DebugRectangle(rpea.PrintPageEventArgs.Graphics,Pens.Blue,new Rectangle(CurrentSection.Location,CurrentSection.Size));
// return new Point(this.CurrentSection.Location.X,
// this.CurrentSection.Size.Height);
return currentPosition;
}
return currentPosition;
} }
return currentPosition;
Rectangle r = StandardPrinter.RenderPlainCollection (this.CurrentSection,
this.CurrentSection.Items,
Evaluator,
new Point(this.CurrentSection.Location.X,this.CurrentSection.SectionOffset),
rpea);
return PrintHelper.ConvertRectangleToCurentPosition(r);
} }

2
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Printing/RenderDataReport.cs

@ -31,7 +31,7 @@ namespace ICSharpCode.Reports.Core {
public RenderDataReport(IReportModel model, public RenderDataReport(IReportModel model,
IDataManager dataManager, IDataManager dataManager,
ReportDocument reportDocument, ReportDocument reportDocument,
ILayouter layout):base (model,dataManager,reportDocument,layout) ILayouter layout):base (model,dataManager,reportDocument,layout)
{ {
} }

Loading…
Cancel
Save