Browse Source

Fixed a problem with Fonts, make some changes from FxCop

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1617 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Peter Forstmeier 19 years ago
parent
commit
62be911f47
  1. 37
      src/AddIns/Misc/SharpReport/SharpReport/Designer/Report.cs
  2. 4
      src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs
  3. 3
      src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BasePageNumber.cs
  4. 3
      src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BaseToday.cs
  5. 3
      src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseCircleItem.cs
  6. 3
      src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseImageItem.cs
  7. 3
      src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseLineItem.cs
  8. 3
      src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs
  9. 2
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs
  10. 4
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/RectangleShape.cs
  11. 12
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/StandardFormatter.cs
  12. 25
      src/AddIns/Misc/SharpReport/SharpReportCore/ReportSettings.cs
  13. 3
      src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/AbstractModelVisitor.cs
  14. 28
      src/AddIns/Misc/SharpReport/SharpReportCore/Xml/XmlFormReader.cs

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

@ -138,7 +138,7 @@ namespace SharpReport.Designer{ @@ -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{ @@ -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 {

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

@ -45,10 +45,10 @@ namespace SharpReportCore { @@ -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);
}

3
src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BasePageNumber.cs

@ -32,6 +32,9 @@ namespace SharpReportCore { @@ -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),

3
src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BaseToday.cs

@ -28,6 +28,9 @@ namespace SharpReportCore { @@ -28,6 +28,9 @@ namespace SharpReportCore {
}
public override void Render(ReportPageEventArgs rpea) {
if (rpea == null) {
throw new ArgumentNullException("rpea");
}
base.Render(rpea);
string f;

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

@ -26,6 +26,9 @@ namespace SharpReportCore { @@ -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);

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

@ -57,6 +57,9 @@ namespace SharpReportCore { @@ -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) {

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

@ -29,6 +29,9 @@ namespace SharpReportCore { @@ -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,

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

@ -31,6 +31,9 @@ namespace SharpReportCore { @@ -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);

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

@ -208,7 +208,7 @@ namespace SharpReportCore { @@ -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();

4
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/RectangleShape.cs

@ -36,9 +36,9 @@ namespace SharpReportCore { @@ -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;
}

12
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/StandardFormatter.cs

@ -23,11 +23,11 @@ namespace SharpReportCore { @@ -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 { @@ -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:

25
src/AddIns/Misc/SharpReport/SharpReportCore/ReportSettings.cs

@ -21,18 +21,13 @@ @@ -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{
/// <summary>
/// This class stores all the basic settings of an Report
@ -256,6 +251,17 @@ namespace SharpReportCore{ @@ -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{ @@ -272,6 +278,7 @@ namespace SharpReportCore{
}
}
}
// System.Windows.Forms.MessageBox.Show("fertig");
}
@ -641,7 +648,15 @@ namespace SharpReportCore{ @@ -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 {

3
src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/AbstractModelVisitor.cs

@ -62,6 +62,9 @@ namespace SharpReportCore { @@ -62,6 +62,9 @@ namespace SharpReportCore {
}
protected XmlNodeList BuildControlList(XmlElement section) {
if (section == null) {
throw new ArgumentNullException("section");
}
return section.SelectNodes (this.nodesQuery);
}

28
src/AddIns/Misc/SharpReport/SharpReportCore/Xml/XmlFormReader.cs

@ -6,16 +6,12 @@ @@ -6,16 +6,12 @@
// </file>
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 {
/// <summary>
@ -143,19 +139,23 @@ 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);
}
/// <summary>
/// Sets a property called propertyName in object <code>o</code> to <code>val</code>. This method performs
@ -202,8 +202,8 @@ namespace SharpReportCore { @@ -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 {

Loading…
Cancel
Save