Browse Source

Fixed Unbound printing for FormSheet Reports

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1608 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Peter Forstmeier 19 years ago
parent
commit
c725be440a
  1. 25
      src/AddIns/Misc/SharpReport/SharpReport/Designer/Report.cs
  2. 18
      src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSectionControlbase.cs
  3. 8
      src/AddIns/Misc/SharpReport/SharpReport/Designer/SideTab/BuildSideTab.cs
  4. 1
      src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ContainerControl.cs
  5. 26
      src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportTableControl.cs
  6. 5
      src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/PageNumber.cs
  7. 4
      src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportRectangleItem.cs
  8. 1
      src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportRowItem.cs
  9. 66
      src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTableItem.cs
  10. 2
      src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs
  11. 5
      src/AddIns/Misc/SharpReport/SharpReport/Visitors/SaveReportVisitor.cs
  12. 4
      src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseReportItem.cs
  13. 2
      src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs
  14. 2
      src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseCircleItem.cs
  15. 2
      src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseImageItem.cs
  16. 2
      src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseLineItem.cs
  17. 2
      src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs
  18. 5
      src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs
  19. 7
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractDataRenderer.cs
  20. 59
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs
  21. 26
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs
  22. 70
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderFormSheetReport.cs
  23. 1
      src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs

25
src/AddIns/Misc/SharpReport/SharpReport/Designer/Report.cs

@ -181,15 +181,32 @@ namespace SharpReport.Designer{ @@ -181,15 +181,32 @@ namespace SharpReport.Designer{
private void CustomizeItem ( ItemDragDropEventArgs iddea,
ReportItemCollection itemCollection,
BaseReportItem baseReportItem) {
GlobalEnums.ReportItemType rptType = (GlobalEnums.ReportItemType)
GlobalEnums.StringToEnum(typeof(GlobalEnums.ReportItemType),iddea.ItemName);
System.Console.WriteLine("Report:CustomizeItem");
// GlobalEnums.ReportItemType rptType = (GlobalEnums.ReportItemType)
// GlobalEnums.StringToEnum(typeof(GlobalEnums.ReportItemType),iddea.ItemName);
baseReportItem.Name = nameService.CreateName(itemCollection,
baseReportItem.Name);
System.Console.WriteLine("Report:CustomizeItem Name {0}",baseReportItem.Name);
System.Console.WriteLine("\t {0}",baseReportItem.Name);
System.Console.WriteLine("\tFont in base {0}",baseReportItem.Font.ToString());
System.Console.WriteLine("\t{0}",this.reportSettings.DefaultFont.ToString());
System.ComponentModel.TypeConverter converter =
System.ComponentModel.TypeDescriptor.GetConverter( typeof(Font));
string s1 = (string)converter.ConvertTo((this.reportSettings.DefaultFont),typeof(string));
string s2 = converter.ConvertToInvariantString(this.reportSettings.DefaultFont);
System.Console.WriteLine("{0}",s1);
System.Console.WriteLine("{0}",s2);
Font f1 = (Font)converter.ConvertFromString(s1);
Font f2 = (Font)converter.ConvertFromInvariantString(s2);
Font f3 = new Font (f1, FontStyle.Bold |FontStyle.Underline);
string s3 = converter.ConvertToInvariantString(f3);
System.Console.WriteLine("{0}",s3);
System.Console.WriteLine("!!");
System.Console.WriteLine("{0} / {1}",f1.Name,f2.Size);
System.Console.WriteLine("{0} / {1}",f2.Name,f2.Size);
if (baseReportItem.Parent == this.selectedSection) {
baseReportItem.Location = new Point(iddea.ItemAtPoint.X,iddea.ItemAtPoint.Y);
} else {

18
src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSectionControlbase.cs

@ -339,8 +339,6 @@ namespace SharpReport.Designer{ @@ -339,8 +339,6 @@ namespace SharpReport.Designer{
private bool CheckDraggedControl (DragEventArgs dea) {
string str = this.DragObjectToString (dea);
System.Console.WriteLine("ReportSectionControlBase");
System.Console.WriteLine("valid {0}",this.designableFactory.Contains(str));
return this.designableFactory.Contains(str);
}
@ -371,7 +369,9 @@ namespace SharpReport.Designer{ @@ -371,7 +369,9 @@ namespace SharpReport.Designer{
void BodyPanelDragEnter(object sender, System.Windows.Forms.DragEventArgs dea){
dragAllowed = CheckDragElement(dea);
string s = DragObjectToString (dea);
this.draggedItem = this.designableFactory.Create(s);
}
void BodyPanelDragLeave(object sender, System.EventArgs e){
@ -400,13 +400,25 @@ namespace SharpReport.Designer{ @@ -400,13 +400,25 @@ namespace SharpReport.Designer{
private IContainerItem IsValidContainer(DragEventArgs dea) {
Point point = new Point(dea.X,dea.Y);
// System.Console.WriteLine("ReportSectionControlBase:IsValidContainer");
for (int i = 0; i < this.bodyPanel.Controls.Count; i++) {
Control c = this.bodyPanel.Controls[i];
Rectangle r = c.ClientRectangle;
if (r.Contains(c.PointToClient(point))) {
// System.Console.WriteLine("\tfound Control {0} ",c.Name);
IContainerItem ia = c as IContainerItem;
ContainerControl cc = c as ContainerControl;
if (cc != null) {
System.Console.WriteLine("\tContainerControl {0}",cc.Name);
} else {
// System.Console.WriteLine("\tNo ContainerControl");
}
// if (ia != null) {
// System.Console.WriteLine("\t\tContainer is {0}",c.Name);
// } else {
// System.Console.WriteLine("\t\tNo COntainer{0}",c.Name);
// }
return ia;
}
}

8
src/AddIns/Misc/SharpReport/SharpReport/Designer/SideTab/BuildSideTab.cs

@ -88,12 +88,12 @@ namespace SharpReport @@ -88,12 +88,12 @@ namespace SharpReport
GlobalEnums.ReportItemType.ReportImageItem.ToString(),
bitmap);
tab.Items.Add (t);
t = sideTab.SideTabItemFactory.CreateSideTabItem( ResourceService.GetString("SharpReport.Toolbar.Rectangle"),
GlobalEnums.ReportItemType.ReportRectangleItem.ToString(),
ResourceService.GetBitmap("Icons.16x16.SharpReport.Rectangle"));
// t = sideTab.SideTabItemFactory.CreateSideTabItem( ResourceService.GetString("SharpReport.Toolbar.Rectangle"),
// GlobalEnums.ReportItemType.ReportRectangleItem.ToString(),
// GlobalValues.RectangleBitmap());
// ResourceService.GetBitmap("Icons.16x16.SharpReport.Rectangle"));
t = sideTab.SideTabItemFactory.CreateSideTabItem( ResourceService.GetString("SharpReport.Toolbar.Rectangle"),
GlobalEnums.ReportItemType.ReportRectangleItem.ToString(),
GlobalValues.RectangleBitmap());
tab.Items.Add (t);

1
src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ContainerControl.cs

@ -33,6 +33,7 @@ namespace SharpReport.Designer{ @@ -33,6 +33,7 @@ namespace SharpReport.Designer{
base.OnPaint(e);
}
#region overrides
/*
protected override CreateParams CreateParams{

26
src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportTableControl.cs

@ -23,6 +23,9 @@ namespace SharpReport.Designer @@ -23,6 +23,9 @@ namespace SharpReport.Designer
{
private RectangleShape shape = new RectangleShape();
private bool drawBorder;
private Padding padding = new Padding (5);
private ReportRowControl row1;
public ReportTableControl()
{
//
@ -39,7 +42,23 @@ namespace SharpReport.Designer @@ -39,7 +42,23 @@ namespace SharpReport.Designer
h = GlobalValues.PreferedSize.Height * 3 + 30;
w = (GlobalValues.PreferedSize.Width * 2) + 10;
// this.Size = new Size(w,h);
this.Size = new Size(w,h);
this.row1 = new ReportRowControl();
this.row1.Location = new Point (this.Padding.Left,this.Padding.Top);
this.row1.Size = new Size (this.Width - this.Padding.Left - this.Padding.Right,this.row1.Size.Height);
this.row1.BackColor = Color.AliceBlue;
this.Controls.Add(row1);
this.Resize += new EventHandler(OnResize);
}
private void OnResize (object sender, EventArgs e) {
System.Console.WriteLine("");
System.Console.WriteLine("TabaleControl:Resize");
System.Console.WriteLine("");
this.row1.Location = new Point (this.Padding.Left,this.Padding.Top);
this.row1.Size = new Size (this.Width - this.Padding.Left - this.Padding.Right,this.row1.Size.Height);
}
#region overrides
@ -53,8 +72,7 @@ namespace SharpReport.Designer @@ -53,8 +72,7 @@ namespace SharpReport.Designer
ControlHelper.DrawHeadLine(this,pea);
}
public override string ToString() {
@ -71,6 +89,7 @@ namespace SharpReport.Designer @@ -71,6 +89,7 @@ namespace SharpReport.Designer
this.Invalidate();
}
}
#region FormsDesigner
/// <summary>
@ -100,6 +119,7 @@ namespace SharpReport.Designer @@ -100,6 +119,7 @@ namespace SharpReport.Designer
private void InitializeComponent()
{
this.SuspendLayout();
//

5
src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/PageNumber.cs

@ -10,12 +10,11 @@ @@ -10,12 +10,11 @@
using System;
using System.Drawing;
using System.ComponentModel;
using System.Drawing.Printing;
using System.Drawing;
using SharpReportCore;
using SharpReport.Designer;
/// <summary>
/// This Function print's the PageNumber
/// Localise it by just overriding the Text Property

4
src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportRectangleItem.cs

@ -93,8 +93,8 @@ namespace SharpReport.ReportItems{ @@ -93,8 +93,8 @@ namespace SharpReport.ReportItems{
#region overrides
public override void Render(SharpReportCore.ReportPageEventArgs e) {
base.Render(e);
public override void Render(SharpReportCore.ReportPageEventArgs rpea) {
base.Render(rpea);
}
public override void Dispose() {

1
src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportRowItem.cs

@ -38,7 +38,6 @@ namespace SharpReport.ReportItems @@ -38,7 +38,6 @@ namespace SharpReport.ReportItems
private void Setup(){
visualControl = new ReportRowControl();
// ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this);
this.visualControl.Click += new EventHandler(OnControlSelect);
this.visualControl.VisualControlChanged += new EventHandler (OnControlChanged);

66
src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTableItem.cs

@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
*/
using System;
using System.Drawing;
using System.ComponentModel;
using SharpReport.Designer;
@ -28,25 +29,23 @@ namespace SharpReport.ReportItems{ @@ -28,25 +29,23 @@ namespace SharpReport.ReportItems{
public ReportTableItem (string tableName):base(tableName) {
Setup();
base.Name = this.visualControl.Name;
}
private void Setup (){
visualControl = new ReportTableControl();
// ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this);
//
this.visualControl.Click += new EventHandler(OnControlSelect);
this.visualControl.VisualControlChanged += new EventHandler (OnControlChanged);
this.visualControl.LocationChanged += new EventHandler (OnControlChanged);
// //Event from Tracker
this.visualControl.PropertyChanged += new PropertyChangedEventHandler (ControlPropertyChange);
//
this.visualControl.PropertyChanged += new PropertyChangedEventHandler (ControlPropertyChange);
base.PropertyChanged += new PropertyChangedEventHandler (BasePropertyChange);
//
base.Items.Added += OnAdd;
base.Items.Removed += OnRemove;
System.Console.WriteLine("ReporttableItem ctrlName {0}",this.visualControl.Name);
}
#endregion
@ -64,17 +63,21 @@ namespace SharpReport.ReportItems{ @@ -64,17 +63,21 @@ namespace SharpReport.ReportItems{
}
private void OnAdd (object sender, CollectionItemEventArgs<IItemRenderer> e){
System.Console.WriteLine("TableItem:OnAdd");
IDesignable des = e.Item as IDesignable;
if (des != null) {
this.visualControl.Controls.Add (des.VisualControl);
des.Selected += ChildSelected;
des.PropertyChanged += ChildPropertyChange;
System.Console.WriteLine("\t Added <{0}>",e.Item.Name);
}
}
private void OnRemove (object sender, CollectionItemEventArgs<IItemRenderer> e){
System.Console.WriteLine("TableItem:OnRemove");
IDesignable des = e.Item as IDesignable;
System.Console.WriteLine("\t <{0}>",des.Name);
if (des != null) {
this.visualControl.Controls.Remove(des.VisualControl);
des.Selected -= ChildSelected;
@ -83,9 +86,7 @@ namespace SharpReport.ReportItems{ @@ -83,9 +86,7 @@ namespace SharpReport.ReportItems{
}
#endregion
public override string ToString() {
return this.GetType().Name;
}
#region Events from Control
//Tracker
@ -139,6 +140,53 @@ namespace SharpReport.ReportItems{ @@ -139,6 +140,53 @@ namespace SharpReport.ReportItems{
}
#endregion
#region overrides
public override Size Size {
get {
return base.Size;
}
set {
base.Size = value;
if (this.visualControl != null) {
this.visualControl.Size = value;
}
this.HandlePropertyChanged("Size");
}
}
public override Point Location {
get {
return base.Location;
}
set {
base.Location = value;
if (this.visualControl != null) {
this.visualControl.Location = value;
}
this.HandlePropertyChanged("Location");
}
}
public override Font Font {
get {
return base.Font;
}
set {
base.Font = value;
if (this.visualControl != null) {
this.visualControl.Font = value;
}
this.HandlePropertyChanged("Font");
}
}
public override string ToString(){
return this.GetType().Name;
}
#endregion
#region IDesignable

2
src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs

@ -189,7 +189,6 @@ namespace SharpReport{ @@ -189,7 +189,6 @@ namespace SharpReport{
/// <param name="model"><see cref="">ReportModel</see></param>
/// <param name="showInUserControl"></param>
public void ReportPreview (ReportModel model,bool standAlone) {
System.Console.WriteLine("Manager:ReportPreview");
if (model == null) {
throw new ArgumentNullException("model");
}
@ -209,7 +208,6 @@ namespace SharpReport{ @@ -209,7 +208,6 @@ namespace SharpReport{
private AbstractRenderer BuildStandartRenderer (ReportModel model) {
System.Console.WriteLine("Manager:BuildStandartRenderr");
if (model == null) {
throw new ArgumentNullException("model");

5
src/AddIns/Misc/SharpReport/SharpReport/Visitors/SaveReportVisitor.cs

@ -8,11 +8,8 @@ @@ -8,11 +8,8 @@
*/
using System;
using System.Xml;
using SharpReportCore;
using SharpReport.Designer;
using System.Windows.Forms;
using System.Xml;
namespace SharpReport.Visitors{

4
src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseReportItem.cs

@ -67,8 +67,7 @@ namespace SharpReportCore { @@ -67,8 +67,7 @@ namespace SharpReportCore {
#endregion
#region virtual method's
protected RectangleF DrawingRectangle (ReportPageEventArgs e,SizeF measureSize) {
protected RectangleF DrawingRectangle (SizeF measureSize) {
PointF upperLeft = new PointF (this.Location.X ,
this.Location.Y + this.SectionOffset);
SizeF lowerRight = new SizeF(0,0);
@ -132,6 +131,7 @@ namespace SharpReportCore { @@ -132,6 +131,7 @@ namespace SharpReportCore {
return this.font;
}
set {
this.font = value;
NotifyPropertyChanged ("Font");
}

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

@ -89,7 +89,7 @@ namespace SharpReportCore { @@ -89,7 +89,7 @@ namespace SharpReportCore {
protected RectangleF PrepareRectangle (ReportPageEventArgs rpea,string text) {
SizeF measureSize = MeasureReportItem (rpea,text);
RectangleF rect = base.DrawingRectangle (rpea,measureSize);
RectangleF rect = base.DrawingRectangle (measureSize);
return rect;
}

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

@ -27,7 +27,7 @@ namespace SharpReportCore { @@ -27,7 +27,7 @@ namespace SharpReportCore {
public override void Render(ReportPageEventArgs rpea) {
base.Render (rpea);
RectangleF rect = base.DrawingRectangle (rpea,this.Size);
RectangleF rect = base.DrawingRectangle (this.Size);
shape.FillShape(rpea.PrintPageEventArgs.Graphics,
new SolidFillPattern(this.BackColor),

2
src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseImageItem.cs

@ -66,7 +66,7 @@ namespace SharpReportCore { @@ -66,7 +66,7 @@ namespace SharpReportCore {
this.Location.Y + this.image.Height);
} else {
SizeF measureSize = base.MeasureReportItem (rpea,this);
RectangleF rect = base.DrawingRectangle (rpea,measureSize);
RectangleF rect = base.DrawingRectangle (measureSize);
g.DrawImage(image,
rect);
rpea.LocationAfterDraw = new Point (this.Location.X + (int)rect.Width,

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

@ -30,7 +30,7 @@ namespace SharpReportCore { @@ -30,7 +30,7 @@ namespace SharpReportCore {
public override void Render(ReportPageEventArgs rpea) {
base.Render (rpea);
RectangleF rect = base.DrawingRectangle (rpea,this.Size);
RectangleF rect = base.DrawingRectangle (this.Size);
shape.DrawShape (rpea.PrintPageEventArgs.Graphics,
new BaseLine (this.ForeColor,base.DashStyle,base.Thickness),
rect);

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

@ -32,7 +32,7 @@ namespace SharpReportCore { @@ -32,7 +32,7 @@ namespace SharpReportCore {
public override void Render(ReportPageEventArgs rpea) {
base.Render(rpea);
RectangleF rect = base.DrawingRectangle (rpea,this.Size);
RectangleF rect = base.DrawingRectangle (this.Size);
shape.FillShape(rpea.PrintPageEventArgs.Graphics,
new SolidFillPattern(this.BackColor),

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

@ -49,7 +49,7 @@ namespace SharpReportCore{ @@ -49,7 +49,7 @@ namespace SharpReportCore{
protected RectangleF PrepareRectangle (ReportPageEventArgs e) {
SizeF measureSize = new SizeF ((SizeF)this.Size);
RectangleF rect = base.DrawingRectangle (e,measureSize);
RectangleF rect = base.DrawingRectangle (measureSize);
return rect;
}
@ -59,8 +59,7 @@ namespace SharpReportCore{ @@ -59,8 +59,7 @@ namespace SharpReportCore{
if (rpea == null) {
throw new ArgumentNullException("rpea");
}
// System.Console.WriteLine("");
// System.Console.WriteLine("--Start of {0}",this.ToString());
base.Render(rpea);
RectangleF rect = PrepareRectangle (rpea);

7
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractDataRenderer.cs

@ -50,9 +50,11 @@ namespace SharpReportCore{ @@ -50,9 +50,11 @@ namespace SharpReportCore{
}
if (hasContainer) {
return DoContainerControl(this.CurrentSection,container,rpea);
} else {
return base.RenderSection(rpea);
}
}
@ -63,16 +65,19 @@ namespace SharpReportCore{ @@ -63,16 +65,19 @@ namespace SharpReportCore{
if (container == null) {
return section.Size.Height;
}
// System.Console.WriteLine("AbstractDataRenderer:DoContainerControl {0}",((BaseReportItem)container).ToString());
this.DataNavigator.Fill(container.Items);
Point drawPoint = new Point(0,0);
if (section.Visible){
// System.Console.WriteLine("\tcall section.Render");
section.Render (rpea);
// System.Console.WriteLine("\tback from section.Render");
foreach (BaseReportItem item in section.Items) {
if (item.Parent == null) {
item.Parent = section;
}
item.SectionOffset = section.SectionOffset;
// System.Console.WriteLine("\trender <{0}> with Boder set to {1}",item.Name,item.DrawBorder);
item.Render(rpea);
drawPoint.Y = section.SectionOffset + section.Size.Height;
rpea.LocationAfterDraw = new Point (rpea.LocationAfterDraw.X,section.SectionOffset + section.Size.Height);

59
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs

@ -8,12 +8,9 @@ @@ -8,12 +8,9 @@
using System;
using System.Globalization;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Printing;
using SharpReportCore;
using System.Globalization;
/// <summary>
/// Base Class for Rendering Reports
@ -82,12 +79,15 @@ namespace SharpReportCore { @@ -82,12 +79,15 @@ namespace SharpReportCore {
#region Event handling for SectionRendering
protected void AddSectionEvents () {
System.Console.WriteLine("AddSectionEvents for <{0}>",this.CurrentSection.Name);
this.CurrentSection.SectionPrinting += new EventHandler<SectionEventArgs>(OnSectionPrinting);
this.CurrentSection.SectionPrinted += new EventHandler<SectionEventArgs>(OnSectionPrinted);
}
protected void RemoveSectionEvents () {
System.Console.WriteLine("RemoveSectionEvents for <{0}>",this.CurrentSection.Name);
System.Console.WriteLine("");
this.CurrentSection.SectionPrinting -= new EventHandler<SectionEventArgs>(OnSectionPrinting);
this.CurrentSection.SectionPrinted -= new EventHandler<SectionEventArgs>(OnSectionPrinted);
}
@ -98,7 +98,6 @@ namespace SharpReportCore { @@ -98,7 +98,6 @@ namespace SharpReportCore {
SectionRenderEventArgs ea = new SectionRenderEventArgs (e.Section,
this.reportDocument.PageNumber,0,
(GlobalEnums.enmSection)this.sectionInUse);
BaseSection s = (BaseSection)sender;
this.Rendering(this,ea);
}
}
@ -129,6 +128,8 @@ namespace SharpReportCore { @@ -129,6 +128,8 @@ namespace SharpReportCore {
CultureInfo.InvariantCulture);
this.AddSectionEvents();
}
protected virtual void BodyStart (object sender,ReportPageEventArgs rpea) {
// System.Console.WriteLine("\tAbstract - PrintBodyStart");
this.SectionInUse = Convert.ToInt16(GlobalEnums.enmSection.ReportDetail,
@ -140,14 +141,13 @@ namespace SharpReportCore { @@ -140,14 +141,13 @@ namespace SharpReportCore {
protected virtual void PrintDetail (object sender,ReportPageEventArgs rpea) {
SectionInUse = Convert.ToInt16(GlobalEnums.enmSection.ReportDetail,
CultureInfo.InvariantCulture);
// this.AddSectionEvents();
// System.Console.WriteLine("\tAbstract - PrintDetail");
this.AddSectionEvents();
}
protected virtual void BodyEnd (object sender,ReportPageEventArgs rpea) {
// System.Console.WriteLine("\tAbstarct - PrintBodyEnd");
this.SectionInUse = Convert.ToInt16(GlobalEnums.enmSection.ReportFooter,
this.SectionInUse = Convert.ToInt16(GlobalEnums.enmSection.ReportFooter,
CultureInfo.InvariantCulture);
}
@ -287,11 +287,24 @@ namespace SharpReportCore { @@ -287,11 +287,24 @@ namespace SharpReportCore {
this.CurrentSection.Size.Height);
}
protected bool IsRoomForFooter(Point loc) {
// System.Console.WriteLine("AbstractRenderer:isRoomForFooter");
Rectangle r = new Rectangle( this.page.ReportFooterRectangle.Left,
loc.Y,
this.page.ReportFooterRectangle.Width,
this.page.ReportFooterRectangle.Height);
Rectangle s = new Rectangle (this.page.ReportFooterRectangle.Left,
loc.Y,
this.page.ReportFooterRectangle.Width,
this.page.PageFooterRectangle.Top - loc.Y -1);
return s.Contains(r);
}
protected virtual int RenderSection (ReportPageEventArgs rpea) {
Point drawPoint = new Point(0,0);
// System.Console.WriteLine("AbstarctRenderer:Rendersection <{0}>",this.CurrentSection.Name);
if (this.CurrentSection.Visible){
this.CurrentSection.Render (rpea);
@ -299,7 +312,19 @@ namespace SharpReportCore { @@ -299,7 +312,19 @@ namespace SharpReportCore {
if (item.Parent == null) {
item.Parent = this.CurrentSection;
}
//test for container
IContainerItem container = item as IContainerItem;
// if (container != null) {
// System.Console.WriteLine("\tContainer {0}",item.Name);
//
// } else {
// System.Console.WriteLine("\tStandart Offset for <{0}>",item.Name);
//
// }
item.SectionOffset = this.CurrentSection.SectionOffset;
// System.Console.WriteLine("\trender start at offset {0}",item.SectionOffset);
item.Render(rpea);
drawPoint.Y = this.CurrentSection.SectionOffset + this.CurrentSection.Size.Height;
rpea.LocationAfterDraw = new Point (rpea.LocationAfterDraw.X,
@ -424,21 +449,9 @@ namespace SharpReportCore { @@ -424,21 +449,9 @@ namespace SharpReportCore {
0);
}
page.ReportHeaderRectangle = r1;
// System.Console.WriteLine("ReportHeader {0}",page.ReportHeaderRectangle);
page.PageHeaderRectangle = this.MeasurePageHeader(r1,e);
// System.Console.WriteLine("PageHeader {0}",page.PageHeaderRectangle);
page.PageFooterRectangle = this.MeasurePageFooter (e);
// System.Console.WriteLine("DrawArea {0}",page.DetailArea);
// System.Console.WriteLine("PageFooter {0}",page.PageFooterRectangle);
page.PageFooterRectangle = this.MeasurePageFooter (e);
page.ReportFooterRectangle = this.MeasureReportFooter(e);
// System.Console.WriteLine("ReportFooter {0}",page.ReportFooterRectangle);
// System.Console.WriteLine("DetailStarts {0}",page.DetailStart);
// System.Console.WriteLine("");
// AbstractRenderer.DebugRectangle (e,page.PageHeaderRectangle);
// AbstractRenderer.DebugRectangle (e,page.DetailArea);
// AbstractRenderer.DebugRectangle (e,page.PageFooterRectangle);
}
protected virtual void ReportQueryPage (object sender,QueryPageSettingsEventArgs qpea) {

26
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs

@ -101,20 +101,6 @@ namespace SharpReportCore { @@ -101,20 +101,6 @@ namespace SharpReportCore {
base.DoItems(rpea);
}
private bool IsRoomForFooter(Point loc) {
Rectangle r = new Rectangle( base.Page.ReportFooterRectangle.Left,
loc.Y,
base.Page.ReportFooterRectangle.Width,
base.Page.ReportFooterRectangle.Height);
Rectangle s = new Rectangle (base.Page.ReportFooterRectangle.Left,
loc.Y,
base.Page.ReportFooterRectangle.Width,
base.Page.PageFooterRectangle.Top - loc.Y -1);
return s.Contains(r);
}
#endregion
#region test
@ -178,22 +164,19 @@ namespace SharpReportCore { @@ -178,22 +164,19 @@ namespace SharpReportCore {
protected override void BodyStart(object sender, ReportPageEventArgs rpea) {
System.Console.WriteLine("");
System.Console.WriteLine("BodyStart");
base.BodyStart (sender,rpea);
this.currentPoint = new PointF (base.CurrentSection.Location.X,
base.page.DetailStart.Y);
base.CurrentSection.SectionOffset = (int)this.page.DetailStart.Y + AbstractRenderer.Gap;
System.Console.WriteLine("\tAdd SectionEvents");
base.AddSectionEvents();
// base.AddSectionEvents();
}
protected override void PrintDetail(object sender, ReportPageEventArgs rpea){
Rectangle sectionRect;
bool firstOnPage = true;
base.PrintDetail(sender, rpea);
// no loop if there is no data
if (! this.dataNavigator.HasMoreData ) {
@ -249,16 +232,13 @@ namespace SharpReportCore { @@ -249,16 +232,13 @@ namespace SharpReportCore {
this.ReportDocument.DetailsDone = true;
// test for reportfooter
if (!IsRoomForFooter (rpea.LocationAfterDraw)) {
if (!base.IsRoomForFooter (rpea.LocationAfterDraw)) {
AbstractRenderer.PageBreak(rpea);
}
}
protected override void BodyEnd(object sender, ReportPageEventArgs rpea) {
System.Console.WriteLine("");
System.Console.WriteLine("BodyEnd ");
base.BodyEnd (sender,rpea);
System.Console.WriteLine("\tRemoveEvents reason <finish>");
base.RemoveSectionEvents();

70
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderFormSheetReport.cs

@ -35,58 +35,41 @@ namespace SharpReportCore { @@ -35,58 +35,41 @@ namespace SharpReportCore {
public class RenderFormSheetReport : AbstractRenderer {
private PointF currentPoint = new PointF (0,0);
#region Constructor
public RenderFormSheetReport (ReportModel model):base( model){
}
#endregion
#region Draw the different report Sections
private void DoReportHeader (ReportPageEventArgs rpea){
base.RenderSection (rpea);
#region print all the sections
protected override void ReportQueryPage(object sender, QueryPageSettingsEventArgs qpea) {
base.ReportQueryPage (sender,qpea);
}
private void DoPageHeader (PointF startAt,ReportPageEventArgs rpea){
this.CurrentSection.SectionOffset = base.Page.PageHeaderRectangle.Location.Y;
base.RenderSection (rpea);
protected override void ReportBegin(object sender, PrintEventArgs pea) {
base.ReportBegin (sender,pea);
}
private void DoPageEnd (ReportPageEventArgs rpea){
base.PrintPageEnd(this,rpea);
this.CurrentSection.SectionOffset = base.Page.PageFooterRectangle.Location.Y;
protected override void PrintReportHeader (object sender, ReportPageEventArgs rpea) {
base.PrintReportHeader (sender,rpea);
base.RenderSection (rpea);
}
//TODO how should we handle ReportFooter, print it on an seperate page ????
private void DoReportFooter (PointF startAt,ReportPageEventArgs rpea){
this.CurrentSection.SectionOffset = base.Page.ReportFooterRectangle.Location.Y;
protected override void PrintPageHeader (object sender, ReportPageEventArgs rpea) {
base.PrintPageHeader (sender,rpea);
this.CurrentSection.SectionOffset = base.Page.PageHeaderRectangle.Location.Y;
base.RenderSection (rpea);
this.RemoveSectionEvents();
}
#endregion
#region print all the sections
protected override void PrintReportHeader (object sender, ReportPageEventArgs e) {
base.PrintReportHeader (sender,e);
DoReportHeader (e);
}
protected override void PrintPageHeader (object sender, ReportPageEventArgs e) {
base.PrintPageHeader (sender,e);
DoPageHeader (this.currentPoint,e);
}
/// <summary>
/// Detail Section
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected override void BodyStart (object sender,ReportPageEventArgs rpea) {
// System.Console.WriteLine("BodyStart");
base.BodyStart (sender,rpea);
this.currentPoint = new PointF (base.CurrentSection.Location.X,
base.page.DetailStart.Y);
@ -98,10 +81,17 @@ namespace SharpReportCore { @@ -98,10 +81,17 @@ namespace SharpReportCore {
this.CurrentSection.SectionOffset = base.Page.PageHeaderRectangle.Bottom;
base.RenderSection(rpea);
base.RemoveSectionEvents();
base.ReportDocument.DetailsDone = true;
// test for reportfooter
if (!base.IsRoomForFooter (rpea.LocationAfterDraw)) {
AbstractRenderer.PageBreak(rpea);
}
}
protected override void PrintReportFooter(object sender, ReportPageEventArgs rpea){
base.PrintReportFooter(sender, rpea);
this.CurrentSection.SectionOffset = (int)rpea.LocationAfterDraw.Y;
base.RenderSection(rpea);
base.RemoveSectionEvents();
}
@ -111,8 +101,11 @@ namespace SharpReportCore { @@ -111,8 +101,11 @@ namespace SharpReportCore {
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected override void PrintPageEnd(object sender, ReportPageEventArgs rpea) {
this.DoPageEnd (rpea);
base.PrintPageEnd(this,rpea);
this.CurrentSection.SectionOffset = base.Page.PageFooterRectangle.Location.Y;
base.RenderSection (rpea);
}
#endregion
@ -120,14 +113,15 @@ namespace SharpReportCore { @@ -120,14 +113,15 @@ namespace SharpReportCore {
#region event's
protected override void BodyEnd (object sender,ReportPageEventArgs rpea) {
// System.Console.WriteLine("");
// System.Console.WriteLine("BodyEnd ");
base.BodyEnd (sender,rpea);
this.DoReportFooter (new PointF(0,base.CurrentSection.SectionOffset + base.CurrentSection.Size.Height),
rpea);
// System.Console.WriteLine("\tRemoveEvents reason <finish>");
// base.RemoveSectionEvents();
rpea.PrintPageEventArgs.HasMorePages = false;
}

1
src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs

@ -227,7 +227,6 @@ namespace SharpReportCore { @@ -227,7 +227,6 @@ namespace SharpReportCore {
private void OnSectionPrinting (object sender,SectionRenderEventArgs e) {
if (this.SectionRendering != null) {
System.Console.WriteLine("");
this.SectionRendering(this,e);
}
}

Loading…
Cancel
Save