6 changed files with 3 additions and 206 deletions
@ -1,157 +0,0 @@ |
|||||||
/* |
|
||||||
* Created by SharpDevelop. |
|
||||||
* User: Peter Forstmeier |
|
||||||
* Date: 10.10.2010 |
|
||||||
* Time: 17:37 |
|
||||||
* |
|
||||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
|
||||||
*/ |
|
||||||
using System; |
|
||||||
using System.Drawing; |
|
||||||
using ICSharpCode.Reports.Core.BaseClasses.Printing; |
|
||||||
using ICSharpCode.Reports.Core.Globals; |
|
||||||
using ICSharpCode.Reports.Core.Interfaces; |
|
||||||
using ICSharpCode.Reports.Expressions.ReportingLanguage; |
|
||||||
|
|
||||||
namespace ICSharpCode.Reports.Core |
|
||||||
{ |
|
||||||
/// <summary>
|
|
||||||
/// Description of RenderTable.
|
|
||||||
/// </summary>
|
|
||||||
public class RenderTable:IBaseRenderer |
|
||||||
{ |
|
||||||
|
|
||||||
IDataNavigator dataNavigator; |
|
||||||
Rectangle parentRectangle; |
|
||||||
ISinglePage singlePage; |
|
||||||
ILayouter layouter; |
|
||||||
ReportPageEventArgs reportPageEventArgs; |
|
||||||
BaseSection currentSection; |
|
||||||
|
|
||||||
public RenderTable(IDataNavigator datanavigator,Rectangle parentRectangle,ISinglePage singlePage,ILayouter layouter,BaseSection section) |
|
||||||
{ |
|
||||||
this.dataNavigator = datanavigator; |
|
||||||
|
|
||||||
this.parentRectangle = parentRectangle; |
|
||||||
this.singlePage = singlePage; |
|
||||||
this.layouter = layouter; |
|
||||||
this.currentSection = section; |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public event EventHandler<ICSharpCode.Reports.Core.Events.NewPageEventArgs> PageFull; |
|
||||||
|
|
||||||
public event EventHandler<SectionRenderEventArgs> SectionRendering; |
|
||||||
|
|
||||||
|
|
||||||
public void Render (ISimpleContainer table,ReportPageEventArgs rpea,IExpressionEvaluatorFacade evaluator) |
|
||||||
{ |
|
||||||
if (this.dataNavigator.CurrentRow < 0 ) { |
|
||||||
this.dataNavigator.MoveNext(); |
|
||||||
} |
|
||||||
this.reportPageEventArgs = rpea; |
|
||||||
Point saveLocation = table.Location; |
|
||||||
Rectangle pageBreakRect = Rectangle.Empty; |
|
||||||
|
|
||||||
Point currentPosition = new Point(PrintHelper.DrawingAreaRelativeToParent(this.currentSection,table).Location.X, |
|
||||||
this.currentSection.Location.Y); |
|
||||||
table.Items.SortByLocation(); |
|
||||||
|
|
||||||
Size rs = Size.Empty; |
|
||||||
|
|
||||||
|
|
||||||
// ISimpleContainer headerRow = null;
|
|
||||||
|
|
||||||
var simpleContainer = table.Items[0] as ISimpleContainer; |
|
||||||
|
|
||||||
// foreach (BaseRowItem row in table.Items)
|
|
||||||
// {
|
|
||||||
rs = simpleContainer.Size; |
|
||||||
PrintHelper.AdjustParent(table,table.Items); |
|
||||||
|
|
||||||
// if (PrintHelper.IsTextOnlyRow(simpleContainer) )
|
|
||||||
// {
|
|
||||||
|
|
||||||
LayoutHelper.SetLayoutForRow(ReportPageEventArgs.PrintPageEventArgs.Graphics,Layouter,simpleContainer); |
|
||||||
|
|
||||||
var r = StandardPrinter.RenderContainer(simpleContainer,evaluator,currentPosition,ReportPageEventArgs); |
|
||||||
|
|
||||||
currentPosition = PrintHelper.ConvertRectangleToCurentPosition (r); |
|
||||||
|
|
||||||
table.Location = saveLocation; |
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
//---------------
|
|
||||||
simpleContainer = table.Items[1] as ISimpleContainer; |
|
||||||
|
|
||||||
int adjust = simpleContainer.Location.Y - saveLocation.Y; |
|
||||||
simpleContainer.Location = new Point(simpleContainer.Location.X,simpleContainer.Location.Y - adjust - 3 * GlobalValues.GapBetweenContainer); |
|
||||||
rs = simpleContainer.Size; |
|
||||||
|
|
||||||
do { |
|
||||||
|
|
||||||
pageBreakRect = PrintHelper.CalculatePageBreakRectangle((BaseReportItem)table,currentPosition); |
|
||||||
|
|
||||||
if (PrintHelper.IsPageFull(pageBreakRect,this.SectionBounds)) { |
|
||||||
table.Location = saveLocation; |
|
||||||
AbstractRenderer.PageBreak(ReportPageEventArgs); |
|
||||||
return; |
|
||||||
} |
|
||||||
|
|
||||||
this.dataNavigator.Fill(simpleContainer.Items); |
|
||||||
|
|
||||||
LayoutHelper.SetLayoutForRow(ReportPageEventArgs.PrintPageEventArgs.Graphics,Layouter,simpleContainer); |
|
||||||
|
|
||||||
r = StandardPrinter.RenderContainer(simpleContainer,evaluator,currentPosition,ReportPageEventArgs); |
|
||||||
|
|
||||||
currentPosition = PrintHelper.ConvertRectangleToCurentPosition (r); |
|
||||||
|
|
||||||
simpleContainer.Size = rs; |
|
||||||
} |
|
||||||
while (this.dataNavigator.MoveNext()); |
|
||||||
//-----
|
|
||||||
// }
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public ICSharpCode.Reports.Core.BaseClasses.SectionBounds SectionBounds { |
|
||||||
get { |
|
||||||
return this.singlePage.SectionBounds; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public IDataNavigator DataNavigator { |
|
||||||
get { |
|
||||||
return this.dataNavigator; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public System.Drawing.Rectangle ParentRectangle { |
|
||||||
get { |
|
||||||
return this.parentRectangle; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public ISinglePage SinglePage { |
|
||||||
get { |
|
||||||
return this.singlePage; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public ILayouter Layouter { |
|
||||||
get { |
|
||||||
return this.layouter; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public System.Drawing.Graphics Graphics {get;set;} |
|
||||||
|
|
||||||
|
|
||||||
public ReportPageEventArgs ReportPageEventArgs { |
|
||||||
get { return reportPageEventArgs; } |
|
||||||
set { reportPageEventArgs = value; } |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,37 +0,0 @@ |
|||||||
/* |
|
||||||
* Created by SharpDevelop. |
|
||||||
* User: Peter Forstmeier |
|
||||||
* Date: 10.10.2010 |
|
||||||
* Time: 17:28 |
|
||||||
* |
|
||||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
|
||||||
*/ |
|
||||||
using System; |
|
||||||
using System.Drawing; |
|
||||||
using ICSharpCode.Reports.Core.Interfaces; |
|
||||||
|
|
||||||
namespace ICSharpCode.Reports.Core |
|
||||||
{ |
|
||||||
/// <summary>
|
|
||||||
/// Description of RendererFactory.
|
|
||||||
/// </summary>
|
|
||||||
public static class PrintRendererFactory |
|
||||||
{ |
|
||||||
|
|
||||||
public static IBaseRenderer CreateRenderer (BaseReportItem itemToConvert,IDataNavigator dataNavigator, |
|
||||||
ISinglePage singlePage,ILayouter layouter,BaseSection section) |
|
||||||
{ |
|
||||||
|
|
||||||
Type t = itemToConvert.GetType(); |
|
||||||
if (t.Equals(typeof(BaseTableItem))) { |
|
||||||
return new RenderTable(dataNavigator,Rectangle.Empty,singlePage,layouter,section); |
|
||||||
} |
|
||||||
|
|
||||||
if (t.Equals(typeof(BaseRowItem))) { |
|
||||||
// return new GroupedRowConverter (dataNavigator,singlePage,layouter);
|
|
||||||
// Console.WriteLine("render Row");
|
|
||||||
} |
|
||||||
return null; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
Loading…
Reference in new issue