diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/Report.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/Report.cs index 9a35e9ffc5..6d790696bc 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/Report.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/Report.cs @@ -138,7 +138,7 @@ namespace SharpReport.Designer{ visualFooter.ReportItemsHandling += new ItemDragDropEventHandler (OnAddReportItem); } - private Rectangle SectionClientArea (SharpReport.Designer.ReportSectionControlBase ctrl) { + private Rectangle SectionClientArea (SharpReport.Designer.ReportSectionControlBase ctrl) { Rectangle rect = new Rectangle(); rect.X = ctrl.Location.X; rect.Y = ctrl.Location.Y + ctrl.Head.Height; @@ -188,25 +188,26 @@ namespace SharpReport.Designer{ baseReportItem.Name = nameService.CreateName(itemCollection, 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()); + baseReportItem.Font = this.reportSettings.DefaultFont; + +// 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("ConvertTo - {0}",s1); +// System.Console.WriteLine("ConvertToInvariantString {0}",s2); - 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("ConvertToInvariantString {0}",s3); - 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); +// 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/SharpReportCore/BaseItems/BaseTextItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs index 5419812330..f21e383905 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs @@ -45,10 +45,10 @@ namespace SharpReportCore { #endregion - protected string FormatOutput(string valueToFormat,string formatString, + protected string FormatOutput(string valueToFormat,string format, TypeCode typeCode, string nullValue ){ - return standartFormatter.FormatItem(valueToFormat,formatString, + return standartFormatter.FormatItem(valueToFormat,format, typeCode,nullValue); } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BasePageNumber.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BasePageNumber.cs index 6a2037dfc9..1afe4a1b97 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BasePageNumber.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BasePageNumber.cs @@ -32,6 +32,9 @@ namespace SharpReportCore { } public override void Render(ReportPageEventArgs rpea) { + if (rpea == null) { + throw new ArgumentNullException("rpea"); + } base.Render(rpea); string formattedString = base.FormatOutput(rpea.PageNumber.ToString(CultureInfo.InvariantCulture), diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BaseToday.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BaseToday.cs index 9ffd5284eb..b7d9549ec3 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BaseToday.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BaseToday.cs @@ -28,6 +28,9 @@ namespace SharpReportCore { } public override void Render(ReportPageEventArgs rpea) { + if (rpea == null) { + throw new ArgumentNullException("rpea"); + } base.Render(rpea); string f; diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseCircleItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseCircleItem.cs index 1584c671f0..a8f7660643 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseCircleItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseCircleItem.cs @@ -26,6 +26,9 @@ namespace SharpReportCore { } public override void Render(ReportPageEventArgs rpea) { + if (rpea == null) { + throw new ArgumentNullException("rpea"); + } base.Render (rpea); RectangleF rect = base.DrawingRectangle (this.Size); diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseImageItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseImageItem.cs index da0177bb15..91b34f5f0a 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseImageItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseImageItem.cs @@ -57,6 +57,9 @@ namespace SharpReportCore { #region overrides public override void Render(ReportPageEventArgs rpea) { + if (rpea == null) { + throw new ArgumentNullException("rpea"); + } base.Render(rpea); Graphics g = rpea.PrintPageEventArgs.Graphics; if (this.image != null) { diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseLineItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseLineItem.cs index b00eb06fea..a1d7edc9cd 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseLineItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseLineItem.cs @@ -29,6 +29,9 @@ namespace SharpReportCore { } public override void Render(ReportPageEventArgs rpea) { + if (rpea == null) { + throw new ArgumentNullException("rpea"); + } base.Render (rpea); RectangleF rect = base.DrawingRectangle (this.Size); shape.DrawShape (rpea.PrintPageEventArgs.Graphics, diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs index 12e8a888dc..a164f8123a 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs @@ -31,6 +31,9 @@ namespace SharpReportCore { } public override void Render(ReportPageEventArgs rpea) { + if (rpea == null) { + throw new ArgumentNullException("rpea"); + } base.Render(rpea); RectangleF rect = base.DrawingRectangle (this.Size); diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs index 53929bd946..80eb7ff58d 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs @@ -208,7 +208,7 @@ namespace SharpReportCore { protected Rectangle MeasureReportHeader (PrintPageEventArgs ppea) { if (ppea == null) { - throw new ArgumentNullException("rpea"); + throw new ArgumentNullException("ppea"); } Rectangle rect = new Rectangle(); diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/RectangleShape.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/RectangleShape.cs index 7f79fc5f84..fda05be153 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/RectangleShape.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/RectangleShape.cs @@ -36,9 +36,9 @@ namespace SharpReportCore { } - public override GraphicsPath CreatePath(RectangleF rect){ + public override GraphicsPath CreatePath(RectangleF rectangle){ GraphicsPath path1 = new GraphicsPath(); - path1.AddRectangle(rect); + path1.AddRectangle(rectangle); return path1; } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/StandardFormatter.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/StandardFormatter.cs index 05880e8aa6..891baacb49 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/StandardFormatter.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/StandardFormatter.cs @@ -23,11 +23,11 @@ namespace SharpReportCore { //TODO why not TypeCode tc = Type.GetTypeCode( Type.GetType(this.dataType)); - public string FormatItem (string valueToFormat,string formatString, + public string FormatItem (string valueToFormat,string format, TypeCode typeCode,string nullValue) { string retValue = String.Empty; - if (String.IsNullOrEmpty(formatString)) { + if (String.IsNullOrEmpty(format)) { retValue = valueToFormat; return retValue; } @@ -35,16 +35,16 @@ namespace SharpReportCore { switch (typeCode) { case TypeCode.Int16: case TypeCode.Int32: - retValue = IntegerValues (valueToFormat,formatString); + retValue = IntegerValues (valueToFormat,format); break; case TypeCode.DateTime: - retValue = DateValues(valueToFormat,formatString); + retValue = DateValues(valueToFormat,format); break; case TypeCode.Boolean: - retValue = BoolValue (valueToFormat,formatString); + retValue = BoolValue (valueToFormat,format); break; case TypeCode.Decimal: - retValue = DecimalValues (valueToFormat,formatString); + retValue = DecimalValues (valueToFormat,format); break; case TypeCode.Double: diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/ReportSettings.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/ReportSettings.cs index 69608e2b09..60eef4c659 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/ReportSettings.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/ReportSettings.cs @@ -21,18 +21,13 @@ using System; using System.ComponentModel; -using System.Data; using System.Drawing; using System.Drawing.Printing; using System.Globalization; using System.Reflection; -using System.Text; -using System.Windows.Forms; using System.Xml; using System.Xml.Serialization; -using SharpReportCore; - namespace SharpReportCore{ /// /// This class stores all the basic settings of an Report @@ -256,6 +251,17 @@ namespace SharpReportCore{ XmlIgnoreAttribute xmlIgnoreAttribute = (XmlIgnoreAttribute)attributes[typeof(XmlIgnoreAttribute)]; DefaultValueAttribute defaultValue = (DefaultValueAttribute)attributes[typeof(DefaultValueAttribute)]; + //CHeck for + // [XmlAttribute("titleFont")] + //public string TestName { + +// XmlAttributeAttribute test = (XmlAttributeAttribute)attributes[typeof(XmlAttributeAttribute)]; +// if (test != null) { +// +// System.Windows.Forms.MessageBox.Show (test.AttributeName + "found"); +// } + + if (xmlIgnoreAttribute == null){ if (p.CanWrite) { if (defaultValue == null) { @@ -272,6 +278,7 @@ namespace SharpReportCore{ } } } +// System.Windows.Forms.MessageBox.Show("fertig"); } @@ -641,7 +648,15 @@ namespace SharpReportCore{ #endregion #region OutPut Settings + string bla; + [XmlAttributeAttribute("titleFont")] + public string TestName { + get { + return "Name = testName"; + } + set { bla = value;} + } [Category("Output Settings")] public Font DefaultFont { diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/AbstractModelVisitor.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/AbstractModelVisitor.cs index 4573089fec..af44945261 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/AbstractModelVisitor.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/AbstractModelVisitor.cs @@ -62,6 +62,9 @@ namespace SharpReportCore { } protected XmlNodeList BuildControlList(XmlElement section) { + if (section == null) { + throw new ArgumentNullException("section"); + } return section.SelectNodes (this.nodesQuery); } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Xml/XmlFormReader.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Xml/XmlFormReader.cs index bef326db8c..29da4096a6 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Xml/XmlFormReader.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Xml/XmlFormReader.cs @@ -6,16 +6,12 @@ // using System; -using System.Drawing.Printing; -using System.Xml; -using System.Collections; using System.Drawing; +using System.Globalization; using System.Reflection; -using System.Windows.Forms; -using System.ComponentModel; using System.Text.RegularExpressions; -using System.Globalization; - +using System.Windows.Forms; +using System.Xml; namespace SharpReportCore { /// @@ -143,19 +139,23 @@ namespace SharpReportCore { } return Return; } - public static void BuildFontElement (Font font, XmlElement fontElement) { + + System.ComponentModel.TypeConverter converter = + System.ComponentModel.TypeDescriptor.GetConverter( typeof(Font)); + string fontString = converter.ConvertToInvariantString(font); + XmlAttribute att = fontElement.OwnerDocument.CreateAttribute ("value"); - string str = XmlFormReader.TypedValueToString (font,CultureInfo.InvariantCulture).Replace (",","."); - string fontString = str.Replace (';',','); att.InnerText = fontString; fontElement.Attributes.Append(att); } + public static Font MakeFont(string font) { - string s = font.Replace(';',','); - return (Font)XmlFormReader.StringToTypedValue(s,typeof(Font),CultureInfo.InstalledUICulture); + System.ComponentModel.TypeConverter converter = + System.ComponentModel.TypeDescriptor.GetConverter( typeof(Font)); + return (Font)converter.ConvertFromInvariantString(font); } /// /// Sets a property called propertyName in object o to val. This method performs @@ -202,8 +202,8 @@ namespace SharpReportCore { propertyInfo.SetValue(o, Color.FromName(color), null); } } else if (propertyInfo.PropertyType == typeof(Font)) { - Font fnt = (Font)XmlFormReader.StringToTypedValue (value,typeof(Font), - CultureInfo.InvariantCulture); + Font fnt = XmlFormReader.MakeFont(value); + if (fnt != null) { propertyInfo.SetValue(o,fnt,null); } else {