diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/Report.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/Report.cs index ca639ea0a5..9a35e9ffc5 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/Report.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/Report.cs @@ -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 { diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSectionControlbase.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSectionControlbase.cs index 7b87ca33b6..bd08fc21d1 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSectionControlbase.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSectionControlbase.cs @@ -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{ 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{ 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; } } diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/SideTab/BuildSideTab.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SideTab/BuildSideTab.cs index f40fbbb287..1bad8cb5f9 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/SideTab/BuildSideTab.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SideTab/BuildSideTab.cs @@ -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); diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ContainerControl.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ContainerControl.cs index 1a700f3a1e..473e246f5a 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ContainerControl.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ContainerControl.cs @@ -33,6 +33,7 @@ namespace SharpReport.Designer{ base.OnPaint(e); } + #region overrides /* protected override CreateParams CreateParams{ diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportTableControl.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportTableControl.cs index a85d1c8978..cbd6e528e4 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportTableControl.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportTableControl.cs @@ -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 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 ControlHelper.DrawHeadLine(this,pea); } - - + public override string ToString() { @@ -71,6 +89,7 @@ namespace SharpReport.Designer this.Invalidate(); } } + #region FormsDesigner /// @@ -100,6 +119,7 @@ namespace SharpReport.Designer private void InitializeComponent() { + this.SuspendLayout(); // diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/PageNumber.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/PageNumber.cs index ff08245be7..0485a92fab 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/PageNumber.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/PageNumber.cs @@ -10,12 +10,11 @@ using System; -using System.Drawing; using System.ComponentModel; -using System.Drawing.Printing; +using System.Drawing; -using SharpReportCore; using SharpReport.Designer; + /// /// This Function print's the PageNumber /// Localise it by just overriding the Text Property diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportRectangleItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportRectangleItem.cs index 0ff3e2870a..9ff8c29dab 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportRectangleItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportRectangleItem.cs @@ -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() { diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportRowItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportRowItem.cs index e591f8d4f0..15c0d10926 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportRowItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportRowItem.cs @@ -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); diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTableItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTableItem.cs index 521a0166a9..62422f5da3 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTableItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTableItem.cs @@ -8,6 +8,7 @@ */ using System; +using System.Drawing; using System.ComponentModel; using SharpReport.Designer; @@ -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{ } private void OnAdd (object sender, CollectionItemEventArgs 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 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{ } #endregion - public override string ToString() { - return this.GetType().Name; - } + #region Events from Control //Tracker @@ -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 diff --git a/src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs b/src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs index bb772f4405..6e975c0484 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs @@ -189,7 +189,6 @@ namespace SharpReport{ /// ReportModel /// 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{ private AbstractRenderer BuildStandartRenderer (ReportModel model) { - System.Console.WriteLine("Manager:BuildStandartRenderr"); if (model == null) { throw new ArgumentNullException("model"); diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Visitors/SaveReportVisitor.cs b/src/AddIns/Misc/SharpReport/SharpReport/Visitors/SaveReportVisitor.cs index f1a2469d10..f0d0e8a17d 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Visitors/SaveReportVisitor.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Visitors/SaveReportVisitor.cs @@ -8,11 +8,8 @@ */ using System; -using System.Xml; -using SharpReportCore; - -using SharpReport.Designer; using System.Windows.Forms; +using System.Xml; namespace SharpReport.Visitors{ diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseReportItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseReportItem.cs index 1cb2f28926..b22bcce5e6 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseReportItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseReportItem.cs @@ -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 { return this.font; } set { + this.font = value; NotifyPropertyChanged ("Font"); } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs index b08c0c93b2..5419812330 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs @@ -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; } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseCircleItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseCircleItem.cs index 82a196b79e..1584c671f0 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseCircleItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseCircleItem.cs @@ -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), diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseImageItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseImageItem.cs index 9a12aa2234..da0177bb15 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseImageItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseImageItem.cs @@ -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, diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseLineItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseLineItem.cs index 58ddeed6a4..b00eb06fea 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseLineItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseLineItem.cs @@ -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); diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs index 7c1afbcce6..12e8a888dc 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs @@ -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), diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs index df56b1972a..dd1560996e 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs @@ -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{ 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); diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractDataRenderer.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractDataRenderer.cs index e7bd94a933..baec0960bc 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractDataRenderer.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractDataRenderer.cs @@ -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{ 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); diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs index 310b6ce08e..53929bd946 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs @@ -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; /// /// Base Class for Rendering Reports @@ -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(OnSectionPrinting); this.CurrentSection.SectionPrinted += new EventHandler(OnSectionPrinted); } protected void RemoveSectionEvents () { + System.Console.WriteLine("RemoveSectionEvents for <{0}>",this.CurrentSection.Name); + System.Console.WriteLine(""); this.CurrentSection.SectionPrinting -= new EventHandler(OnSectionPrinting); this.CurrentSection.SectionPrinted -= new EventHandler(OnSectionPrinted); } @@ -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 { 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 { 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 { 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 { 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 { 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) { diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs index a728548099..fb295672da 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs @@ -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 { 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 { 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 "); base.RemoveSectionEvents(); diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderFormSheetReport.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderFormSheetReport.cs index 75925ae667..e43740a068 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderFormSheetReport.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderFormSheetReport.cs @@ -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); - } /// /// Detail Section /// /// /// 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 { 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 { /// /// /// + 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 { #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 "); +// base.RemoveSectionEvents(); + rpea.PrintPageEventArgs.HasMorePages = false; } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs index 2df8fd6934..a2439f7192 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs @@ -227,7 +227,6 @@ namespace SharpReportCore { private void OnSectionPrinting (object sender,SectionRenderEventArgs e) { if (this.SectionRendering != null) { - System.Console.WriteLine(""); this.SectionRendering(this,e); } }