Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1909 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
16 changed files with 985 additions and 41 deletions
@ -0,0 +1,53 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Forstmeier Peter |
||||||
|
* Date: 05.10.2006 |
||||||
|
* Time: 16:05 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using System.Runtime.Serialization; |
||||||
|
using System.Security.Permissions; |
||||||
|
namespace SharpReportCore { |
||||||
|
[Serializable()] |
||||||
|
public class MissingDataManagerException : System.Exception { |
||||||
|
|
||||||
|
string errorMessage = String.Empty; |
||||||
|
|
||||||
|
public MissingDataManagerException():base() { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public MissingDataManagerException(string errorMessage):base(errorMessage ){ |
||||||
|
this.errorMessage = errorMessage; |
||||||
|
} |
||||||
|
|
||||||
|
public MissingDataManagerException(string errorMessage, |
||||||
|
Exception exception):base (errorMessage,exception){ |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
protected MissingDataManagerException(SerializationInfo info, |
||||||
|
StreamingContext context) : base(info, context){ |
||||||
|
// Implement type-specific serialization constructor logic.
|
||||||
|
} |
||||||
|
public string ErrorMessage { |
||||||
|
get { |
||||||
|
return errorMessage; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
[SecurityPermissionAttribute(SecurityAction.Demand, |
||||||
|
SerializationFormatter = true)] |
||||||
|
|
||||||
|
public override void GetObjectData(SerializationInfo info, StreamingContext context){ |
||||||
|
if (info == null) { |
||||||
|
throw new ArgumentNullException("info"); |
||||||
|
} |
||||||
|
info.AddValue("errorMessage", this.errorMessage); |
||||||
|
base.GetObjectData(info, context); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,129 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Forstmeier Helmut |
||||||
|
* Date: 26.09.2006 |
||||||
|
* Time: 14:33 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Drawing; |
||||||
|
|
||||||
|
namespace SharpReportCore.Exporters |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of LineStyle.
|
||||||
|
/// </summary>
|
||||||
|
public class BaseStyleDecorator{ |
||||||
|
|
||||||
|
private bool drawBorder; |
||||||
|
private Color backColor; |
||||||
|
private Color foreColor; |
||||||
|
private Point location; |
||||||
|
private Size size; |
||||||
|
private Font font; |
||||||
|
|
||||||
|
private StringFormat stringFormat; |
||||||
|
private StringTrimming stringTrimming; |
||||||
|
private ContentAlignment contentAlignment; |
||||||
|
|
||||||
|
public BaseStyleDecorator():this(Color.White,Color.Black){ |
||||||
|
} |
||||||
|
|
||||||
|
public BaseStyleDecorator(Color backColor, Color foreColor) |
||||||
|
{ |
||||||
|
this.backColor = backColor; |
||||||
|
this.foreColor = foreColor; |
||||||
|
} |
||||||
|
|
||||||
|
public bool DrawBorder { |
||||||
|
get { |
||||||
|
return drawBorder; |
||||||
|
} |
||||||
|
set { |
||||||
|
drawBorder = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public Color BackColor { |
||||||
|
get { |
||||||
|
return backColor; |
||||||
|
} |
||||||
|
set { |
||||||
|
backColor = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public Color ForeColor { |
||||||
|
get { |
||||||
|
return foreColor; |
||||||
|
} |
||||||
|
set { |
||||||
|
foreColor = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public Point Location { |
||||||
|
get { |
||||||
|
return location; |
||||||
|
} |
||||||
|
set { |
||||||
|
location = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public Size Size { |
||||||
|
get { |
||||||
|
return size; |
||||||
|
} |
||||||
|
set { |
||||||
|
size = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
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 class TextDecorator :BaseStyleDecorator |
||||||
|
{ |
||||||
|
TextDecorator () :base() { |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,60 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Forstmeier Helmut |
||||||
|
* Date: 09.10.2006 |
||||||
|
* Time: 09:40 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Drawing; |
||||||
|
|
||||||
|
namespace SharpReportCore.Exporters |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of BaseLineItem.
|
||||||
|
/// </summary>
|
||||||
|
public class BaseExportColumn :IPerformLine |
||||||
|
{ |
||||||
|
BaseStyleDecorator styleDecorator; |
||||||
|
bool isContainer; |
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
public BaseExportColumn(){ |
||||||
|
this.styleDecorator = new BaseStyleDecorator(Color.White,Color.Black); |
||||||
|
} |
||||||
|
|
||||||
|
// public BaseExportColumn(BaseStyleDecorator styleDecorator)
|
||||||
|
// {
|
||||||
|
// this.styleDecorator = styleDecorator;
|
||||||
|
// }
|
||||||
|
|
||||||
|
public BaseExportColumn(BaseStyleDecorator itemStyle, bool isContainer) |
||||||
|
{ |
||||||
|
this.styleDecorator = itemStyle; |
||||||
|
this.isContainer = isContainer; |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public virtual BaseStyleDecorator StyleDecorator { |
||||||
|
get { |
||||||
|
return styleDecorator; |
||||||
|
} |
||||||
|
set { |
||||||
|
this.styleDecorator = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public bool IsContainer { |
||||||
|
get { |
||||||
|
return isContainer; |
||||||
|
} |
||||||
|
set { |
||||||
|
isContainer = value; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,46 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Forstmeier Helmut |
||||||
|
* Date: 09.10.2006 |
||||||
|
* Time: 22:14 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
namespace SharpReportCore.Exporters |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of ContainerItem.
|
||||||
|
/// </summary>
|
||||||
|
public class ExportContainer:BaseExportColumn |
||||||
|
{ |
||||||
|
// List<IPerformLine> items;
|
||||||
|
ExporterCollection<BaseExportColumn> items; |
||||||
|
public ExportContainer():base(){ |
||||||
|
base.IsContainer = true; |
||||||
|
} |
||||||
|
|
||||||
|
public ExportContainer (BaseStyleDecorator itemStyle):base(itemStyle,true){ |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public void AddLineItem (BaseExportColumn item) { |
||||||
|
if (item == null) { |
||||||
|
throw new ArgumentNullException("item"); |
||||||
|
} |
||||||
|
this.items.Add(item); |
||||||
|
} |
||||||
|
|
||||||
|
public ExporterCollection<BaseExportColumn> Items { |
||||||
|
get { |
||||||
|
if (this.items == null) { |
||||||
|
items = new ExporterCollection<BaseExportColumn>(); |
||||||
|
} |
||||||
|
return items; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,52 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Forstmeier Helmut |
||||||
|
* Date: 26.09.2006 |
||||||
|
* Time: 14:33 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Drawing; |
||||||
|
|
||||||
|
namespace SharpReportCore.Exporters { |
||||||
|
/// <summary>
|
||||||
|
/// Description of LineItem.
|
||||||
|
/// </summary>
|
||||||
|
public class ExportText :BaseExportColumn,IPerformLine{ |
||||||
|
string text; |
||||||
|
|
||||||
|
public ExportText():base(){ |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public ExportText (BaseStyleDecorator itemStyle,bool isContainer):base(itemStyle,isContainer){ |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public string Text { |
||||||
|
get { |
||||||
|
return text; |
||||||
|
} |
||||||
|
set { |
||||||
|
text = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override BaseStyleDecorator StyleDecorator { |
||||||
|
get { |
||||||
|
return base.StyleDecorator; |
||||||
|
} |
||||||
|
set { |
||||||
|
base.StyleDecorator = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override string ToString() |
||||||
|
{ |
||||||
|
return this.text; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,29 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Forstmeier Helmut |
||||||
|
* Date: 03.10.2006 |
||||||
|
* Time: 11:47 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Drawing; |
||||||
|
using SharpReportCore.Exporters; |
||||||
|
|
||||||
|
namespace SharpReportCore |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of Interface1.
|
||||||
|
/// </summary>
|
||||||
|
public interface IExportColumnBuilder{ |
||||||
|
BaseExportColumn CreateExportColumn (Graphics graphics); |
||||||
|
} |
||||||
|
|
||||||
|
public interface IPerformLine{ |
||||||
|
BaseStyleDecorator StyleDecorator { |
||||||
|
get;set; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,53 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Forstmeier Helmut |
||||||
|
* Date: 20.09.2006 |
||||||
|
* Time: 09:36 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Diagnostics; |
||||||
|
using System.Globalization; |
||||||
|
using System.Drawing; |
||||||
|
|
||||||
|
using System.Drawing.Printing; |
||||||
|
|
||||||
|
namespace SharpReportCore.Exporters{ |
||||||
|
|
||||||
|
public class ExportItemsConverter{ |
||||||
|
Graphics graphics; |
||||||
|
int offset; |
||||||
|
|
||||||
|
public ExportItemsConverter (Graphics graphics) { |
||||||
|
this.graphics = graphics; |
||||||
|
} |
||||||
|
|
||||||
|
public ExportText ConvertToLineItems (IItemRenderer r) { |
||||||
|
IExportColumnBuilder lineBuilder = r as IExportColumnBuilder; |
||||||
|
ExportText lineItem = null; |
||||||
|
if (lineBuilder != null) { |
||||||
|
|
||||||
|
lineItem = (ExportText)lineBuilder.CreateExportColumn(this.graphics); |
||||||
|
lineItem.StyleDecorator.Location = new Point(lineItem.StyleDecorator.Location.X, |
||||||
|
lineItem.StyleDecorator.Location.Y + offset); |
||||||
|
} else { |
||||||
|
System.Console.WriteLine("Can't Convert <{0}> to ILineBuilder",r.Name); |
||||||
|
} |
||||||
|
return lineItem; |
||||||
|
} |
||||||
|
|
||||||
|
public int Offset { |
||||||
|
get { |
||||||
|
return offset; |
||||||
|
} |
||||||
|
set { |
||||||
|
offset = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,300 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Forstmeier Helmut |
||||||
|
* Date: 20.09.2006 |
||||||
|
* Time: 09:36 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Diagnostics; |
||||||
|
using System.Globalization; |
||||||
|
using System.Drawing; |
||||||
|
|
||||||
|
using System.Drawing.Printing; |
||||||
|
|
||||||
|
namespace SharpReportCore.Exporters |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of PageBuilder.
|
||||||
|
/// </summary>
|
||||||
|
public class PageBuilder |
||||||
|
{ |
||||||
|
List<SinglePage> pages; |
||||||
|
ReportModel reportModel; |
||||||
|
DataManager dataManager; |
||||||
|
DataNavigator dataNavigator; |
||||||
|
ExportItemsConverter lineItemsConverter; |
||||||
|
|
||||||
|
// public delegate List <IPerformLine> ConverterDelegate (LineItemsConverter c,BaseSection s,SinglePage p);
|
||||||
|
public delegate List <BaseExportColumn> ConverterDelegate (BaseSection s,SinglePage p); |
||||||
|
#region Constructor
|
||||||
|
public PageBuilder () { |
||||||
|
pages = new List<SinglePage>(); |
||||||
|
} |
||||||
|
|
||||||
|
public PageBuilder(ReportModel reportModel,DataManager dataManager):this(){ |
||||||
|
if (reportModel == null) { |
||||||
|
throw new ArgumentNullException("reportModel"); |
||||||
|
} |
||||||
|
if (dataManager == null) { |
||||||
|
throw new ArgumentNullException("dataManager"); |
||||||
|
} |
||||||
|
this.reportModel = reportModel; |
||||||
|
this.dataManager = dataManager; |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region template
|
||||||
|
/* |
||||||
|
// Events from ReportDocument
|
||||||
|
reportDocument.QueryPageSettings += new QueryPageSettingsEventHandler (ReportQueryPage); |
||||||
|
reportDocument.BeginPrint += new PrintEventHandler(ReportBegin); |
||||||
|
reportDocument.PrintPage += new PrintPageEventHandler(ReportPageStart); |
||||||
|
reportDocument.EndPrint += new PrintEventHandler(ReportEnd); |
||||||
|
|
||||||
|
// homemade events
|
||||||
|
reportDocument.BodyStart += new EventHandler<ReportPageEventArgs> (BodyStart); |
||||||
|
|
||||||
|
reportDocument.BodyEnd += new EventHandler<ReportPageEventArgs> (BodyEnd); |
||||||
|
|
||||||
|
//
|
||||||
|
reportDocument.RenderReportHeader += new EventHandler<ReportPageEventArgs> (PrintReportHeader); |
||||||
|
reportDocument.RenderPageHeader += new EventHandler<ReportPageEventArgs> (PrintPageHeader); |
||||||
|
reportDocument.RenderDetails += new EventHandler<ReportPageEventArgs> (PrintDetail); |
||||||
|
reportDocument.RenderPageEnd += new EventHandler<ReportPageEventArgs> (PrintPageEnd); |
||||||
|
reportDocument.RenderReportEnd += new EventHandler<ReportPageEventArgs> (PrintReportFooter); |
||||||
|
|
||||||
|
*/ |
||||||
|
#endregion
|
||||||
|
|
||||||
|
private SinglePage CreateNewPage () { |
||||||
|
PageSettings ps = this.reportModel.ReportSettings.PageSettings; |
||||||
|
ps.Margins = this.reportModel.ReportSettings.DefaultMargins; |
||||||
|
SectionBounds sb = null; |
||||||
|
if (this.pages.Count == 0) { |
||||||
|
sb = new SectionBounds(ps,true); |
||||||
|
} else { |
||||||
|
sb = new SectionBounds(ps,false); |
||||||
|
} |
||||||
|
|
||||||
|
SinglePage sp = new SinglePage(sb); |
||||||
|
return sp; |
||||||
|
} |
||||||
|
|
||||||
|
private void BuildReportHeader (SinglePage page) { |
||||||
|
BaseSection section = this.reportModel.ReportHeader; |
||||||
|
// System.Console.WriteLine("ReportHeader with {0} items ",section.Items.Count);
|
||||||
|
|
||||||
|
// LineItemsConverter conv = new LineItemsConverter(graphics);
|
||||||
|
this.lineItemsConverter.Offset = page.SectionBounds.ReportHeaderRectangle.Top; |
||||||
|
System.Console.WriteLine("ReportHeader start at {0} with {1} items", |
||||||
|
this.lineItemsConverter.Offset, |
||||||
|
section.Items.Count); |
||||||
|
List <BaseExportColumn>l = section.Items.ConvertAll <BaseExportColumn> (this.lineItemsConverter.ConvertToLineItems); |
||||||
|
page.Items.AddRange(l); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
private void BuildPageHeader (SinglePage page) { |
||||||
|
BaseSection section = this.reportModel.PageHeader; |
||||||
|
// System.Console.WriteLine("PageHeader with {0} items ",section.Items.Count);
|
||||||
|
|
||||||
|
// LineItemsConverter conv = new LineItemsConverter(graphics);
|
||||||
|
this.lineItemsConverter.Offset = page.SectionBounds.PageHeaderRectangle.Top; |
||||||
|
System.Console.WriteLine("Page Header start at {0} with {1} Items", |
||||||
|
this.lineItemsConverter.Offset, |
||||||
|
section.Items.Count); |
||||||
|
List <BaseExportColumn>l = section.Items.ConvertAll <BaseExportColumn> (this.lineItemsConverter.ConvertToLineItems); |
||||||
|
page.Items.AddRange(l); |
||||||
|
|
||||||
|
// System.Console.WriteLine("\tList<string> {0}",l.Count);
|
||||||
|
// System.Console.WriteLine("\tpages.items.coun {0}",page.Items.Count);
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void BuildDetails (SinglePage page,Graphics graphics) { |
||||||
|
|
||||||
|
bool firstOnPage = true; |
||||||
|
|
||||||
|
if (! dataNavigator.HasMoreData ) { |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
if (this.pages.Count == 0) { |
||||||
|
dataNavigator.MoveNext(); |
||||||
|
} |
||||||
|
|
||||||
|
BaseSection section = this.reportModel.DetailSection; |
||||||
|
section.SectionOffset = page.SectionBounds.DetailStart.Y; |
||||||
|
do { |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
dataNavigator.Fill(section.Items); |
||||||
|
|
||||||
|
if (!firstOnPage) { |
||||||
|
section.SectionOffset = section.SectionOffset + section.Size.Height + 2 * page.SectionBounds.Gap; |
||||||
|
} |
||||||
|
|
||||||
|
MeasurementService.FitSectionToItems (section,graphics); |
||||||
|
List <BaseExportColumn>convertedList = new List<BaseExportColumn>(); |
||||||
|
|
||||||
|
ConverterDelegate converterDelegate; |
||||||
|
|
||||||
|
if (section.Items[0] is IContainerItem) { |
||||||
|
converterDelegate = new ConverterDelegate(DoContainerJob); |
||||||
|
} else { |
||||||
|
converterDelegate = new ConverterDelegate(DoJob); |
||||||
|
} |
||||||
|
|
||||||
|
convertedList = converterDelegate(section,page); |
||||||
|
|
||||||
|
page.Items.AddRange(convertedList); |
||||||
|
firstOnPage = false; |
||||||
|
} |
||||||
|
while (dataNavigator.MoveNext()); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
private List <BaseExportColumn> DoContainerJob (BaseSection section,SinglePage page) { |
||||||
|
|
||||||
|
IExportColumnBuilder builder = section.Items[0] as IExportColumnBuilder; |
||||||
|
|
||||||
|
this.lineItemsConverter.Offset = section.SectionOffset; |
||||||
|
|
||||||
|
if (builder != null) { |
||||||
|
System.Console.WriteLine("Create RowList with Location {0}",this.lineItemsConverter.Offset); |
||||||
|
|
||||||
|
Graphics g = reportModel.ReportSettings.PageSettings.PrinterSettings.CreateMeasurementGraphics(); |
||||||
|
|
||||||
|
ExportContainer lineItem = (ExportContainer)builder.CreateExportColumn(g); |
||||||
|
|
||||||
|
IContainerItem containerItem = section.Items[0] as IContainerItem; |
||||||
|
|
||||||
|
// reread
|
||||||
|
this.dataNavigator.Fill(containerItem.Items); |
||||||
|
List <BaseExportColumn> childList = containerItem.Items.ConvertAll <BaseExportColumn> (this.lineItemsConverter.ConvertToLineItems); |
||||||
|
|
||||||
|
lineItem.Items.AddRange(childList); |
||||||
|
|
||||||
|
childList.ForEach(display); |
||||||
|
|
||||||
|
List <BaseExportColumn> containerList = new List<BaseExportColumn>(); |
||||||
|
containerList.Add (lineItem); |
||||||
|
g.Dispose(); |
||||||
|
return containerList; |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
private List <BaseExportColumn> DoJob (BaseSection section,SinglePage page) { |
||||||
|
|
||||||
|
this.lineItemsConverter.Offset = section.SectionOffset; |
||||||
|
System.Console.WriteLine("Plain Item {0}/{1}",section.SectionOffset,page.SectionBounds.DetailStart); |
||||||
|
List <BaseExportColumn>list = section.Items.ConvertAll <BaseExportColumn> (this.lineItemsConverter.ConvertToLineItems); |
||||||
|
|
||||||
|
if (list.Count > 0) { |
||||||
|
|
||||||
|
bool istrue = list.TrueForAll(delegate(BaseExportColumn item){ |
||||||
|
if (item.StyleDecorator.Location.Y + item.StyleDecorator.Size.Height > page.SectionBounds.DetailEnds.Y) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
// System.Console.WriteLine("{0} / {1}",
|
||||||
|
// item.ItemStyle.Location.Y + item.ItemStyle.Size.Height,
|
||||||
|
// page.SectionBounds.DetailEnds.Y);
|
||||||
|
return true; |
||||||
|
}); |
||||||
|
} |
||||||
|
// list.ForEach(display);
|
||||||
|
return list; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void display (IPerformLine li) { |
||||||
|
// System.Console.WriteLine("\tdisplay {0}",li.ToString());
|
||||||
|
ExportText l = li as ExportText; |
||||||
|
if (l != null) { |
||||||
|
System.Console.WriteLine("\t\t{0} / {1} ",l.StyleDecorator.Location,l.Text); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
private void BuildPageFooter (SinglePage page) { |
||||||
|
BaseSection section = this.reportModel.PageFooter; |
||||||
|
|
||||||
|
this.lineItemsConverter.Offset = page.SectionBounds.PageFooterRectangle.Top; |
||||||
|
// System.Console.WriteLine("Page Footer start at {0} with {1} Items",
|
||||||
|
// this.lineItemsConverter.Offset,
|
||||||
|
// section.Items.Count);
|
||||||
|
List <BaseExportColumn>l = section.Items.ConvertAll <BaseExportColumn> (this.lineItemsConverter.ConvertToLineItems); |
||||||
|
page.Items.AddRange(l); |
||||||
|
} |
||||||
|
|
||||||
|
private void Write (SinglePage page) { |
||||||
|
this.dataNavigator = this.dataManager.GetNavigator; |
||||||
|
Graphics graphics = reportModel.ReportSettings.PageSettings.PrinterSettings.CreateMeasurementGraphics(); |
||||||
|
this.lineItemsConverter = new ExportItemsConverter(graphics); |
||||||
|
if (this.pages.Count == 0) { |
||||||
|
BuildReportHeader (page); |
||||||
|
} |
||||||
|
|
||||||
|
BuildPageHeader(page) ; |
||||||
|
BuildDetails (page,graphics); |
||||||
|
BuildPageFooter (page); |
||||||
|
graphics.Dispose(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public void AddPage (SinglePage page) { |
||||||
|
if (page == null) { |
||||||
|
throw new ArgumentNullException("page"); |
||||||
|
} |
||||||
|
this.pages.Add(page); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public void CreateReport () { |
||||||
|
SinglePage page = this.CreateNewPage(); |
||||||
|
page.CalculatePageBounds(this.reportModel); |
||||||
|
Write(page); |
||||||
|
this.pages.Add(page); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public int PageCount{ |
||||||
|
get { |
||||||
|
return this.pages.Count; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public SinglePage FirstPage { |
||||||
|
get { |
||||||
|
if (this.pages.Count > 0) { |
||||||
|
return pages[0]; |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public SinglePage LastPage { |
||||||
|
get { |
||||||
|
if (this.pages.Count > 0) { |
||||||
|
return pages[pages.Count -1]; |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,101 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Forstmeier Helmut |
||||||
|
* Date: 19.09.2006 |
||||||
|
* Time: 22:18 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Drawing; |
||||||
|
using System.Drawing.Printing; |
||||||
|
|
||||||
|
namespace SharpReportCore.Exporters |
||||||
|
{ |
||||||
|
|
||||||
|
public class SinglePage |
||||||
|
{ |
||||||
|
// List<IPerformLine> items;
|
||||||
|
ExporterCollection<BaseExportColumn> items; |
||||||
|
SectionBounds sectionBounds; |
||||||
|
|
||||||
|
|
||||||
|
public SinglePage():this (new SectionBounds(new PageSettings())){ |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public SinglePage(SectionBounds sectionBounds) |
||||||
|
{ |
||||||
|
this.sectionBounds = sectionBounds; |
||||||
|
// items = new List <IPerformLine>();
|
||||||
|
items = new ExporterCollection<BaseExportColumn>(); |
||||||
|
} |
||||||
|
|
||||||
|
public void CalculatePageBounds (ReportModel reportModel) { |
||||||
|
|
||||||
|
Graphics graphics = reportModel.ReportSettings.PageSettings.PrinterSettings.CreateMeasurementGraphics(); |
||||||
|
Rectangle rectangle; |
||||||
|
|
||||||
|
if (this.sectionBounds.Firstpage) { |
||||||
|
rectangle = sectionBounds.MeasureReportHeader(reportModel.ReportHeader,graphics); |
||||||
|
|
||||||
|
|
||||||
|
} else { |
||||||
|
rectangle = new Rectangle (reportModel.ReportSettings.DefaultMargins.Left, |
||||||
|
reportModel.ReportSettings.DefaultMargins.Top, |
||||||
|
this.sectionBounds.MarginBounds.Width, |
||||||
|
0); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
reportModel.ReportHeader.SectionOffset = reportModel.ReportSettings.DefaultMargins.Top; |
||||||
|
sectionBounds.ReportHeaderRectangle = rectangle; |
||||||
|
|
||||||
|
//PageHeader
|
||||||
|
|
||||||
|
this.sectionBounds.MeasurePageHeader(reportModel.PageHeader, |
||||||
|
rectangle,graphics); |
||||||
|
//
|
||||||
|
|
||||||
|
//PageFooter
|
||||||
|
|
||||||
|
this.sectionBounds.MeasurePageFooter (reportModel.PageFooter,graphics); |
||||||
|
|
||||||
|
//ReportFooter
|
||||||
|
|
||||||
|
sectionBounds.ReportFooterRectangle = this.sectionBounds.MeasureReportFooter(reportModel.ReportFooter, |
||||||
|
graphics); |
||||||
|
graphics.Dispose(); |
||||||
|
} |
||||||
|
|
||||||
|
public void AddLineItem (BaseExportColumn item) { |
||||||
|
if (item == null) { |
||||||
|
throw new ArgumentNullException("item"); |
||||||
|
} |
||||||
|
this.items.Add(item); |
||||||
|
} |
||||||
|
|
||||||
|
public ExporterCollection<BaseExportColumn> Items { |
||||||
|
get { |
||||||
|
if (this.items == null) { |
||||||
|
items = new ExporterCollection<BaseExportColumn>(); |
||||||
|
} |
||||||
|
return items; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public SectionBounds SectionBounds { |
||||||
|
get { |
||||||
|
return sectionBounds; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public class ExporterCollection<T> : List<T> |
||||||
|
where T : BaseExportColumn { |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue