Browse Source

Refactoring to start with SubReports

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/reports@5967 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Peter Forstmeier 16 years ago
parent
commit
1fd0f95112
  1. 3
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseItems/BaseTableItem.cs
  2. 5
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseItems/BaseTextItem.cs
  3. 106
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Printing/AbstractDataRenderer.cs
  4. 43
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Printing/AbstractRenderer.cs
  5. 6
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Printing/RenderDataReport.cs
  6. 1
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/old_Exporter/ExportColumns/ExportText.cs

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

@ -84,7 +84,7 @@ namespace ICSharpCode.Reports.Core { @@ -84,7 +84,7 @@ namespace ICSharpCode.Reports.Core {
if (rpea == null) {
throw new ArgumentNullException("rpea");
}
//
Point saveLocation = this.Location;
Point currentPosition = new Point(this.startSection.Location.X,this.startSection.Location.Y);
Point tableStart = currentPosition;
@ -174,6 +174,7 @@ namespace ICSharpCode.Reports.Core { @@ -174,6 +174,7 @@ namespace ICSharpCode.Reports.Core {
}
public void RenderTable (BaseReportItem parent,SectionBounds sectionBounds,ReportPageEventArgs rpea,ILayouter layouter)
{

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

@ -111,6 +111,8 @@ namespace ICSharpCode.Reports.Core @@ -111,6 +111,8 @@ namespace ICSharpCode.Reports.Core
if (rpea == null) {
throw new ArgumentNullException("rpea");
}
TextDrawer.DrawString(rpea.PrintPageEventArgs.Graphics,
toPrint,this.Font,
new SolidBrush(this.ForeColor),
@ -118,6 +120,9 @@ namespace ICSharpCode.Reports.Core @@ -118,6 +120,9 @@ namespace ICSharpCode.Reports.Core
this.stringTrimming,this.contentAlignment);
//TextDrawer.DrawString(rpea.PrintPageEventArgs.Graphics,toPrint,CreateItemStyle());
rpea.LocationAfterDraw = new Point (this.Location.X + this.Size.Width,
this.Location.Y + this.Size.Height);
}

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

@ -55,6 +55,69 @@ namespace ICSharpCode.Reports.Core @@ -55,6 +55,69 @@ namespace ICSharpCode.Reports.Core
#endregion
protected void RenderTable (BaseReportItem parent,ITableContainer tableContainer,ReportPageEventArgs rpea)
{
if (rpea == null) {
throw new ArgumentNullException("rpea");
}
Point saveLocation = tableContainer.Location;
Point currentPosition = new Point(this.CurrentSection.Location.X,this.CurrentSection.Location.Y);
Point tableStart = currentPosition;
// base.Render(rpea);
int defaultLeftPos = PrintHelper.DrawingAreaRelativeToParent(parent,tableContainer).Left;
tableContainer.Items.SortByLocation();
rpea.SinglePage.StartRow = this.dataNavigator.CurrentRow;
foreach (BaseRowItem row in tableContainer.Items)
{
if (row != null)
{
row.Parent = tableContainer as BaseReportItem;
if (PrintHelper.IsTextOnlyRow(row) )
{
// currentPosition = this.PrintTextRow (rpea,row,defaultLeftPos,currentPosition);
// currentPosition = this.RenderContainer(parent,tableContainer,rpea);
this.RenderContainer(parent,row,rpea);
tableContainer.Location = saveLocation;
}
else {
do {
if (PrintHelper.IsPageFull(new Rectangle(currentPosition,row.Size),this.SectionBounds)) {
tableContainer.Location = saveLocation;
rpea.SinglePage.EndRow = this.dataNavigator.CurrentRow;
AbstractRenderer.PageBreak(rpea);
return;
}
// currentPosition = this.PrintDataRow (rpea,row,defaultLeftPos,currentPosition);
}
while (this.dataNavigator.MoveNext());
}
}
}
/*
if (this.DrawBorder) {
Border border = new Border(new BaseLine (this.ForeColor,System.Drawing.Drawing2D.DashStyle.Solid,1));
border.DrawBorder(rpea.PrintPageEventArgs.Graphics,
new Rectangle(parent.Location.X,tableStart.Y,
parent.Size.Width,currentPosition.Y + 5));
}
*/
rpea.LocationAfterDraw = new Point(rpea.LocationAfterDraw.X,rpea.LocationAfterDraw.Y + 20);
// base.NotifyAfterPrint (rpea.LocationAfterDraw);
}
protected Point RenderItems (ReportPageEventArgs rpea)
{
base.SinglePage.IDataNavigator = this.dataNavigator;
@ -70,7 +133,7 @@ namespace ICSharpCode.Reports.Core @@ -70,7 +133,7 @@ namespace ICSharpCode.Reports.Core
}
}
if (hasContainer) {
return RenderSimpleContainer(this.CurrentSection,container,rpea);
return RenderSectionWithSimpleContainer(this.CurrentSection,container,rpea);
} else {
return base.RenderSection(rpea);
@ -80,10 +143,10 @@ namespace ICSharpCode.Reports.Core @@ -80,10 +143,10 @@ namespace ICSharpCode.Reports.Core
private Point RenderSimpleContainer (BaseSection section,
private Point RenderSectionWithSimpleContainer (BaseSection section,
ISimpleContainer container,
ReportPageEventArgs rpea)
{
Point drawPoint = Point.Empty;
if (section.Visible){
@ -113,12 +176,13 @@ namespace ICSharpCode.Reports.Core @@ -113,12 +176,13 @@ namespace ICSharpCode.Reports.Core
ISimpleContainer cont = item as ISimpleContainer;
RenderChilds (this.CurrentSection,cont,rpea);
RenderContainer (this.CurrentSection,cont,rpea);
item.Location = saveLocation;
drawPoint = new Point(item.Location.X,
section.SectionOffset + section.Size.Height);
rpea.LocationAfterDraw = new Point (rpea.LocationAfterDraw.X,section.SectionOffset + section.Size.Height);
}
@ -135,43 +199,19 @@ namespace ICSharpCode.Reports.Core @@ -135,43 +199,19 @@ namespace ICSharpCode.Reports.Core
void RenderChilds (BaseReportItem parent,ISimpleContainer simpleContainer,ReportPageEventArgs rpea)
private void RenderContainer (BaseReportItem parent,ISimpleContainer simpleContainer,ReportPageEventArgs rpea)
{
if (simpleContainer != null) {
BaseReportItem item = simpleContainer as BaseReportItem;
if ((simpleContainer.Items != null) && (simpleContainer.Items.Count > 0)) {
if (simpleContainer.Items != null) {
base.RenderPlainCollection(item,simpleContainer.Items,new Point(parent.Location.X + simpleContainer.Location.X,
item.SectionOffset + item.Location.Y),rpea);
foreach (BaseReportItem child in simpleContainer.Items) {
child.Parent = item;
Point saveLocation = new Point (child.Location.X,child.Location.Y);
child.Location = new Point(parent.Location.X + simpleContainer.Location.X + child.Location.X,
item.SectionOffset + item.Location.Y + child.Location.Y);
if (item.BackColor != GlobalValues.DefaultBackColor) {
child.BackColor = item.BackColor;
}
BaseTextItem textItem = child as BaseTextItem;
if (textItem != null) {
string str = textItem.Text;
textItem.Text = Evaluator.Evaluate(textItem.Text);
textItem.Render(rpea);
textItem.Text = str;
} else {
child.Render (rpea);
}
child.Location = saveLocation;
}
}
}
}

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

@ -230,6 +230,11 @@ namespace ICSharpCode.Reports.Core @@ -230,6 +230,11 @@ namespace ICSharpCode.Reports.Core
// PrintHelper.DebugRectangle(rpea.PrintPageEventArgs.Graphics,Pens.Blue,new Rectangle(CurrentSection.Location,CurrentSection.Size));
}
RenderPlainCollection (this.CurrentSection,this.CurrentSection.Items,new Point(this.CurrentSection.Location.X,
this.CurrentSection.SectionOffset),rpea);
/*
foreach (BaseReportItem item in this.CurrentSection.Items) {
if (item.Parent == null) {
item.Parent = this.CurrentSection;
@ -249,6 +254,8 @@ namespace ICSharpCode.Reports.Core @@ -249,6 +254,8 @@ namespace ICSharpCode.Reports.Core
}
*/
if ((this.CurrentSection.CanGrow == false)&& (this.CurrentSection.CanShrink == false)) {
return new Point(this.CurrentSection.Location.X,
this.CurrentSection.Size.Height);
@ -259,6 +266,42 @@ namespace ICSharpCode.Reports.Core @@ -259,6 +266,42 @@ namespace ICSharpCode.Reports.Core
}
protected void RenderPlainCollection (BaseReportItem parent,ReportItemCollection items, Point offset,ReportPageEventArgs rpea)
{
if (items.Count > 0) {
foreach (BaseReportItem child in items) {
child.Parent = parent;
Point saveLocation = new Point (child.Location.X,child.Location.Y);
child.Location = new Point(offset.X + child.Location.X,
offset.Y + child.Location.Y);
if (parent.BackColor != GlobalValues.DefaultBackColor) {
child.BackColor = parent.BackColor;
}
BaseTextItem textItem = child as BaseTextItem;
if (textItem != null) {
string str = textItem.Text;
textItem.Text = Evaluator.Evaluate(textItem.Text);
textItem.Render(rpea);
textItem.Text = str;
} else {
child.Render (rpea);
}
child.Location = saveLocation;
}
}
}
#region PrintDocument Events
private void CalculatePageBounds ()

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

@ -163,10 +163,12 @@ namespace ICSharpCode.Reports.Core { @@ -163,10 +163,12 @@ namespace ICSharpCode.Reports.Core {
tableContainer.StartLayoutAt(base.Sections[0]);
}
// base.RenderTable(base.CurrentSection,this.SectionBounds,rpea,this.Layout);
tableContainer.RenderTable(base.CurrentSection,this.SectionBounds,rpea,this.Layout);
tableContainer.RenderTable(this.CurrentSection,this.SectionBounds,rpea,this.Layout);
base.RenderTable (base.CurrentSection,tableContainer,rpea);
this.ReportDocument.DetailsDone = true;
}

1
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/old_Exporter/ExportColumns/ExportText.cs

@ -32,6 +32,7 @@ namespace ICSharpCode.Reports.Core.old_Exporter { @@ -32,6 +32,7 @@ namespace ICSharpCode.Reports.Core.old_Exporter {
#region overrides
public override void DrawItem(PdfWriter pdfWriter,
ICSharpCode.Reports.Core.old_Exporter.ExportRenderer.PdfUnitConverter converter)
{

Loading…
Cancel
Save