From 56ea8e3809038698f4420bdad9554fde32f95a61 Mon Sep 17 00:00:00 2001 From: Peter Forstmeier Date: Wed, 25 Jan 2006 12:55:03 +0000 Subject: [PATCH] More fixes from FxCop git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1036 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- src/AddIns/Misc/SharpReport/SharpReport.sln | 2 +- .../BaseClasses/AbstractColumn.cs | 28 +++++++-------- .../BaseClasses/AbstractParameter.cs | 6 ++-- .../BaseClasses/SqlParameter.cs | 25 ++++--------- .../BaseItems/BaseReportItem.cs | 14 ++++---- .../BaseItems/BaseReportObject.cs | 28 +++++++-------- .../BaseItems/Graphics/BaseImageItem.cs | 2 +- .../BaseItems/Graphics/BaseRectangleItem.cs | 2 +- .../SharpReportCore/BaseSettings.cs | 2 +- .../SharpReportCore/ConnectionObject.cs | 4 +-- .../DataManager/Comparer/GroupSeperator.cs | 2 +- .../DataManager/DataManager.cs | 18 +++++----- .../ListStrategy/BaseListStrategy.cs | 27 +++++++------- .../ListStrategy/CollectionStrategy.cs | 4 +-- .../DataManager/ListStrategy/TableStrategy.cs | 6 ++-- .../DataManager/SqlQueryChecker.cs | 18 +++++----- .../Events/SharpReportEventArgs.cs | 2 +- .../Events/SharpReportParametersEventArgs.cs | 2 +- .../Exceptions/IllegalFileFormat.cs | 15 ++++++-- .../Exceptions/MissingDataSourceException.cs | 8 ++++- .../Exceptions/SharpReportException.cs | 9 +++-- .../SharpReportWrongItemException.cs | 35 +++++++++++-------- .../Interfaces/ISectionRender.cs | 18 ---------- .../Printing/AbstractRenderer.cs | 7 ++-- .../Printing/FormatOutputEventArgs.cs | 28 +++++++-------- .../Printing/Formatter/AbstractFormatter.cs | 4 +-- .../Printing/Formatter/DefaultFormatter.cs | 24 ++++++------- .../Printing/Graphics/FillPatterns.cs | 3 +- .../Printing/RenderDataReport.cs | 4 +-- .../SharpReportCore/ReportSettings.cs | 8 ++--- .../SharpReportCore/SharpReportCore.csproj | 1 - .../SharpReportCore/SharpReportEngine.cs | 6 ++-- .../Visitors/LoadModelVisitor.cs | 2 +- .../SharpReportCore/Xml/XmlFormReader.cs | 4 +-- 34 files changed, 182 insertions(+), 186 deletions(-) delete mode 100644 src/AddIns/Misc/SharpReport/SharpReportCore/Interfaces/ISectionRender.cs diff --git a/src/AddIns/Misc/SharpReport/SharpReport.sln b/src/AddIns/Misc/SharpReport/SharpReport.sln index a86d9b4589..8a4c03e910 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport.sln +++ b/src/AddIns/Misc/SharpReport/SharpReport.sln @@ -1,5 +1,5 @@ Microsoft Visual Studio Solution File, Format Version 9.00 -# SharpDevelop 2.0.0.1009 +# SharpDevelop 2.0.0.1034 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpReportCore", "SharpReportCore\SharpReportCore.csproj", "{4B2239FF-8FD6-431D-9D22-1B8049BA6917}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpReport", "SharpReport\SharpReport.csproj", "{F5563727-8309-4AC3-BACA-EB28EFD8A1D0}" diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseClasses/AbstractColumn.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseClasses/AbstractColumn.cs index b77742935a..c298d43949 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseClasses/AbstractColumn.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseClasses/AbstractColumn.cs @@ -7,24 +7,22 @@ // the code is regenerated. // //------------------------------------------------------------------------------ - - -using System; +using System; - - /// - /// This class is used as an Abtract Class for all Columns like, AvailableFields,Sorting,Grouping etc. - /// - /// - /// - /// created by - Forstmeier Peter - /// created on - 26.05.2005 16:19:45 - /// - /// +/// +/// This class is used as an Abtract Class for all Columns like, AvailableFields,Sorting,Grouping etc. +/// +/// +/// +/// created by - Forstmeier Peter +/// created on - 26.05.2005 16:19:45 +/// +/// namespace SharpReportCore { public class AbstractColumn : object { - string columnName = String.Empty; - Type dataType = null; + + string columnName; + Type dataType; public AbstractColumn() { diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseClasses/AbstractParameter.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseClasses/AbstractParameter.cs index 0b6fbabd07..37b7676d2b 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseClasses/AbstractParameter.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseClasses/AbstractParameter.cs @@ -22,9 +22,9 @@ namespace SharpReportCore { public class AbstractParameter : object { string parameterName; - string prompt = String.Empty; - bool nullable = false; - object defaultValue = null; + string prompt; + bool nullable; + object defaultValue; public AbstractParameter() { } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseClasses/SqlParameter.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseClasses/SqlParameter.cs index 813e8ab5ca..a856fb3d77 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseClasses/SqlParameter.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseClasses/SqlParameter.cs @@ -28,8 +28,8 @@ namespace SharpReportCore { public class SqlParameter : AbstractParameter { DbType dataType; - object defaultValue = null; - bool allowBlank = false; + object defaultValue; +// bool allowBlank; ParameterDirection parameterDirection = ParameterDirection.InputOutput; #region Constructor @@ -183,25 +183,14 @@ namespace SharpReportCore { } - /// - /// Is this parameter used in an Query - /// -// public bool UsedInQuery { +// /// +// /// Is a Blank value allowed +// /// +// public bool AllowBlank { // get { -// return usedInQuery; -// } -// set { -// usedInQuery = value; +// return allowBlank; // } // } - /// - /// Is a Blank value allowed - /// - public bool AllowBlank { - get { - return allowBlank; - } - } /// /// When no value is entered, use this value /// diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseReportItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseReportItem.cs index 43eb3aac31..a0d6c7f385 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseReportItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseReportItem.cs @@ -23,9 +23,9 @@ namespace SharpReportCore { public class BaseReportItem : SharpReportCore.BaseReportObject, IItemRenderer,IComponent{ - private int offset = 0; - private int margin = 0; - private bool drawBorder = false; + private int offset; + private int margin; + private bool drawBorder; private Color foreColor; private Font font; @@ -35,7 +35,7 @@ namespace SharpReportCore { public event EventHandler Disposed; public BaseReportItem() :base(){ - site = null; + } #region Event's handling @@ -46,13 +46,13 @@ namespace SharpReportCore { /// the formatString /// Value to return when there is null in toFormat /// - protected string FireFormatOutput(string toFormat,string formatString, string nullValue) { + protected string FireFormatOutput(string toFormat,string format, string nullValue) { if (FormatOutput != null) { FormatOutputEventArgs ea = new FormatOutputEventArgs (toFormat, - formatString, + format, nullValue); FormatOutput (this,ea); - return ea.FormatedString; + return ea.FormatedValue; } return toFormat; } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseReportObject.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseReportObject.cs index 71fee2308e..13fce85449 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseReportObject.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseReportObject.cs @@ -25,25 +25,25 @@ using System.Drawing; /// namespace SharpReportCore { - public class BaseReportObject : ISectionRenderer,INotifyPropertyChanged { + public class BaseReportObject : IBaseRenderer,INotifyPropertyChanged { private string name; - private object parent = null; + private object parent; private bool visible = true; - private bool canGrow = false; - private bool canShrink = false; - private bool pageBreakBefore = false; - private bool pageBreakAfter = false; + private bool canGrow ; + private bool canShrink ; + private bool pageBreakBefore; + private bool pageBreakAfter; private bool suspend = true; private Size size; private Point location; private Color backColor; - private int sectionOffset = 0; - private int sectionMargin = 0; + private int sectionOffset; + private int sectionMargin; - public event EventHandler BeforePrint; - public event EventHandler AfterPrint; + public event EventHandler BeforePrinting; + public event EventHandler AfterPrinting; #region SharpReportCore.IPropertyChange interface implementation @@ -193,15 +193,15 @@ namespace SharpReportCore { } public void OnAfterPrint (PointF afterPrint) { - if (this.AfterPrint != null) { + if (this.AfterPrinting != null) { AfterPrintEventArgs rea = new AfterPrintEventArgs (afterPrint); - AfterPrint(this, rea); + AfterPrinting(this, rea); } } public void OnBeforePrint () { - if (this.BeforePrint != null) { - BeforePrint (this,EventArgs.Empty); + if (this.BeforePrinting != null) { + BeforePrinting (this,EventArgs.Empty); } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseImageItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseImageItem.cs index 802342123e..3cdf356038 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseImageItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseImageItem.cs @@ -29,7 +29,7 @@ namespace SharpReportCore { /// string fileName; Image image; - bool scaleImageToSize = false; + bool scaleImageToSize; public BaseImageItem():base() { } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs index 5846db2c4e..1b393b80fe 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs @@ -25,7 +25,7 @@ using System.Drawing; namespace SharpReportCore { public class BaseRectangleItem : SharpReportCore.BaseGraphicItem,IContainer { - private ArrayList arrayList = null; + private ArrayList arrayList; RectangleShape shape = new RectangleShape(); public BaseRectangleItem() { diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseSettings.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseSettings.cs index 7146ef3b76..cbf59f3ab4 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseSettings.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseSettings.cs @@ -45,7 +45,7 @@ namespace SharpReportCore { private bool includeSettings; //if file is read, supress events - private bool initDone = false; + private bool initDone; private GraphicsUnit graphicsUnit; private Margins defaultMargins = new Margins (50,50,50,50); diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/ConnectionObject.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/ConnectionObject.cs index 0899c284e4..44040d10d1 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/ConnectionObject.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/ConnectionObject.cs @@ -32,8 +32,8 @@ namespace SharpReportCore { public ConnectionObject(string connectionString, string password, string username) { - if (connectionString == "") { - throw new ArgumentNullException("ConnectionObject:ConnectionString"); + if (String.IsNullOrEmpty(connectionString)) { + throw new ArgumentNullException("connectionString"); } this.connectionString = connectionString; this.password = password; diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/Comparer/GroupSeperator.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/Comparer/GroupSeperator.cs index d3ef3f3e48..b9ba41f091 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/Comparer/GroupSeperator.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/Comparer/GroupSeperator.cs @@ -27,7 +27,7 @@ namespace SharpReportCore { int groupLevel = 0; // GroupSeperator parent = null; - IHierarchicalArray childs = null; + IHierarchicalArray childs ; public GroupSeperator(ColumnCollection owner, int listIndex, object[] values,int groupLevel): base(owner,listIndex,values) { diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataManager.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataManager.cs index c8d4b885f6..c6d143be07 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataManager.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataManager.cs @@ -12,6 +12,7 @@ using System.Data; using System.Data.OleDb; using System.Collections; using System.ComponentModel; +using System.Globalization; using SharpReportCore; using System.Windows.Forms; @@ -39,14 +40,14 @@ namespace SharpReportCore { int currentRow = -1; ReportSettings reportSettings; - object dataSource = null; - string dataMember = string.Empty; + object dataSource; + string dataMember; ConnectionObject connectionObject; - IDbConnection connection = null; - IDataViewStrategy dataViewStrategy = null; + IDbConnection connection; + IDataViewStrategy dataViewStrategy; - private ListChangedEventArgs resetList = new ListChangedEventArgs(ListChangedType.Reset,-1,-1); +// private ListChangedEventArgs resetList = new ListChangedEventArgs(ListChangedType.Reset,-1,-1); public event ListChangedEventHandler ListChanged; public event EventHandler GroupChanged; @@ -169,7 +170,7 @@ System.Console.WriteLine("CheckAndSetReportSettings"); if (ds.Tables.Count > 0) { DataTable tbl; - if (this.dataMember == "") { + if (String.IsNullOrEmpty(this.dataMember)){ tbl = ds.Tables[0]; } else { DataTableCollection tcol = ds.Tables; @@ -231,7 +232,7 @@ System.Console.WriteLine("CheckAndSetReportSettings"); CheckForAndBuildParams(command,reportSettings); OleDbDataAdapter adapter = new OleDbDataAdapter(command); DataSet ds = new DataSet(); - + ds.Locale = CultureInfo.CurrentCulture; adapter.Fill (ds); System.Console.WriteLine("\t {0} in Table",ds.Tables[0].Rows.Count); return ds; @@ -277,7 +278,8 @@ System.Console.WriteLine("CheckAndSetReportSettings"); string colName = col.ColumnName; AbstractColumn c = this.dataViewStrategy.AvailableFields.Find (colName); if (c == null) { - string str = String.Format ("<{0}> is not a member of <{1}>",colName,this.reportSettings.ReportName); + string str = String.Format (CultureInfo.CurrentCulture, + "<{0}> is not a member of <{1}>",colName,this.reportSettings.ReportName); throw new SharpReportException(str); } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/BaseListStrategy.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/BaseListStrategy.cs index 804985493c..f0215fb32e 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/BaseListStrategy.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/BaseListStrategy.cs @@ -24,14 +24,14 @@ using SharpReportCore; namespace SharpReportCore { public abstract class BaseListStrategy :IDataViewStrategy { - private bool isSorted = false; - private bool isFiltered = false; - private bool isGrouped = false; + private bool isSorted; + private bool isFiltered; + private bool isGrouped; //Index to plain Datat private SharpArrayList indexList; - private ReportSettings reportSettings = null; - private IHierarchicalArray hierarchicalList = null; + private ReportSettings reportSettings; + private IHierarchicalArray hierarchicalList; private ListChangedEventArgs resetList = new ListChangedEventArgs(ListChangedType.Reset,-1,-1); @@ -40,7 +40,8 @@ namespace SharpReportCore { public event EventHandler GroupChanged; #region Constructor - public BaseListStrategy(ReportSettings reportSettings) { + + protected BaseListStrategy(ReportSettings reportSettings) { this.reportSettings = reportSettings; this.indexList = new SharpArrayList(typeof(BaseComparer),"IndexList"); } @@ -48,7 +49,7 @@ namespace SharpReportCore { #endregion #region Event's - protected void FireGroupChange (object source,GroupSeperator groupSeperator) { + protected void NotifyGroupChange (object source,GroupSeperator groupSeperator) { if (this.GroupChanged != null) { this.GroupChanged (source,new GroupChangedEventArgs(groupSeperator)); @@ -56,7 +57,7 @@ namespace SharpReportCore { } - protected void FireResetList(){ + protected void NotifyResetList(){ if (this.ListChanged != null) { this.ListChanged (this,this.resetList); } @@ -81,9 +82,9 @@ namespace SharpReportCore { protected void CheckSortArray (ArrayList arr,string text){ - System.Console.WriteLine(""); +// System.Console.WriteLine(""); System.Console.WriteLine("{0}",text); - string tabs = String.Empty; +// string tabs = String.Empty; if (arr != null) { int row = 0; @@ -157,6 +158,8 @@ namespace SharpReportCore { public bool IsFiltered { get { return this.isFiltered; + } set { + this.isFiltered = value; } } @@ -175,7 +178,7 @@ namespace SharpReportCore { this.isGrouped = true; this.isSorted = true; } else { - throw new NullReferenceException ("BaseListStrategy:Group Sorry, no IndexList"); + throw new SharpReportException ("BaseListStrategy:Group Sorry, no IndexList"); } } @@ -285,7 +288,7 @@ namespace SharpReportCore { } public virtual void Reset() { - this.FireResetList(); + this.NotifyResetList(); } public virtual void Bind() { diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/CollectionStrategy.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/CollectionStrategy.cs index 5833b07026..bf21af0726 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/CollectionStrategy.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/CollectionStrategy.cs @@ -29,7 +29,7 @@ namespace SharpReportCore { private object firstItem; private object current; - private PropertyDescriptorCollection listProperties = null; + private PropertyDescriptorCollection listProperties; public CollectionStrategy(IList list,string dataMember,ReportSettings reportSettings):base(reportSettings) { if (list.Count > 0) { @@ -211,7 +211,7 @@ namespace SharpReportCore { this.Sort (); this.Reset(); - base.FireResetList(); + base.NotifyResetList(); } public override void Fill(IItemRenderer item) { diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/TableStrategy.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/TableStrategy.cs index 04aae9e64c..88b44de30f 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/TableStrategy.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/TableStrategy.cs @@ -259,7 +259,7 @@ namespace SharpReportCore { if ((base.ReportSettings.GroupColumnsCollection != null) && (base.ReportSettings.GroupColumnsCollection.Count > 0)) { this.Group (); Reset(); - base.FireResetList(); + base.NotifyResetList(); return; } @@ -267,7 +267,7 @@ namespace SharpReportCore { this.Sort (); } Reset(); - base.FireResetList(); + base.NotifyResetList(); } @@ -350,7 +350,7 @@ namespace SharpReportCore { GroupSeperator sep = bc as GroupSeperator; if (sep != null) { - base.FireGroupChange(this,sep); + base.NotifyGroupChange(this,sep); } row = this.view[((BaseComparer)base.IndexList[value]).ListIndex]; } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/SqlQueryChecker.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/SqlQueryChecker.cs index da690cad64..fda414d547 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/SqlQueryChecker.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/SqlQueryChecker.cs @@ -21,35 +21,33 @@ namespace SharpReportCore internal string DELETE = "DELETE"; internal string INSERT = "INSERT"; internal string noValidMessage = "is no valid Member of SqlString"; - private string queryString; public SqlQueryCkecker(){ } public void Check (string queryString) { - if (queryString != "") { - this.queryString = queryString.ToUpper(CultureInfo.CurrentCulture); + if (!String.IsNullOrEmpty(queryString)) { + queryString = queryString.ToUpper(CultureInfo.CurrentCulture); - if (this.queryString.IndexOf (this.UPDATE) > -1) { - string str = String.Format("{0} is no valid Member of SqlString",this.UPDATE); + if (queryString.IndexOf (this.UPDATE) > -1) { this.Invalid (this.UPDATE); } - if (this.queryString.IndexOf(this.DELETE) > -1) { + if (queryString.IndexOf(this.DELETE) > -1) { this.Invalid (this.DELETE); - string str = String.Format("{0} is no valid Member of SqlString",this.DELETE); } - if (this.queryString.IndexOf(this.INSERT) > -1) { + if (queryString.IndexOf(this.INSERT) > -1) { this.Invalid (this.INSERT); - string str = String.Format("{0} is no valid Member of SqlString",this.DELETE); } } } private void Invalid (string invalidArgument) { - string str = String.Format("{0} {1}",invalidArgument,this.noValidMessage); + + string str = String.Format(CultureInfo.CurrentCulture, + "{0} {1}",invalidArgument,this.noValidMessage); throw new SharpReportCore.SharpReportException(str); } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Events/SharpReportEventArgs.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Events/SharpReportEventArgs.cs index 96fbac8eb8..c6c285c34e 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Events/SharpReportEventArgs.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Events/SharpReportEventArgs.cs @@ -27,7 +27,7 @@ namespace SharpReportCore { /// Default constructor - initializes all fields to default values /// - bool cancel = false; + bool cancel; int pageNumber ; diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Events/SharpReportParametersEventArgs.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Events/SharpReportParametersEventArgs.cs index 73e65e1e8f..56185af4e2 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Events/SharpReportParametersEventArgs.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Events/SharpReportParametersEventArgs.cs @@ -24,7 +24,7 @@ namespace SharpReportCore { public class SharpReportParametersEventArgs : System.EventArgs { - AbstractParametersCollection sqlParametersCollection = null; + AbstractParametersCollection sqlParametersCollection; string reportName; public SharpReportParametersEventArgs () { diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Exceptions/IllegalFileFormat.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Exceptions/IllegalFileFormat.cs index d88ae176b4..205602205e 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Exceptions/IllegalFileFormat.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Exceptions/IllegalFileFormat.cs @@ -9,6 +9,7 @@ //------------------------------------------------------------------------------ using System; +using System.Runtime.Serialization; /// /// This exception is throw'n when something is wrong with the File Format @@ -18,21 +19,31 @@ using System; /// created on - 25.04.2005 14:29:20 /// namespace SharpReportCore { - + [Serializable()] public class IllegalFileFormatException : System.Exception { static string errMess = " Could not read file , file corrupt (SharpReportFile is improperly formatted)"; private string localisedMessage = String.Empty; public IllegalFileFormatException():base (errMess){ - } + public IllegalFileFormatException(string errorMessage, + Exception exception):base (errorMessage,exception){ + + } public IllegalFileFormatException(string localisedMessage):base(localisedMessage) { this.localisedMessage = localisedMessage; } + + protected IllegalFileFormatException(SerializationInfo info, + StreamingContext context) : base(info, context){ + // Implement type-specific serialization constructor logic. + } + + public string LocalisedMessage { get { return localisedMessage; diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Exceptions/MissingDataSourceException.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Exceptions/MissingDataSourceException.cs index ce981de148..2b3248b02c 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Exceptions/MissingDataSourceException.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Exceptions/MissingDataSourceException.cs @@ -9,7 +9,7 @@ //------------------------------------------------------------------------------ using System; - +using System.Runtime.Serialization; /// /// Throwen when no valid SharpReportCore is available or when SharpReportCore == null /// @@ -22,6 +22,7 @@ using System; /// namespace SharpReportCore { + [Serializable()] public class MissingDataSourceException : System.Exception { string errorMessage = String.Empty; @@ -38,6 +39,11 @@ namespace SharpReportCore { Exception exception):base (errorMessage,exception){ } + + protected MissingDataSourceException(SerializationInfo info, + StreamingContext context) : base(info, context){ + // Implement type-specific serialization constructor logic. + } public string ErrorMessage { get { return errorMessage; diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Exceptions/SharpReportException.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Exceptions/SharpReportException.cs index ca534d2250..4b726db787 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Exceptions/SharpReportException.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Exceptions/SharpReportException.cs @@ -10,7 +10,7 @@ using System; -using System.Windows.Forms; +using System.Runtime.Serialization; /// /// This Class throws the Standart SharpReport Error @@ -21,7 +21,8 @@ using System.Windows.Forms; /// /// namespace SharpReportCore { - public class SharpReportException : System.Exception { + [Serializable()] + public class SharpReportException : System.Exception { string errorMessage = String.Empty; @@ -36,6 +37,10 @@ namespace SharpReportCore { } + protected SharpReportException(SerializationInfo info, + StreamingContext context) : base(info, context){ + // Implement type-specific serialization constructor logic. + } public string ErrorMessage { get { return errorMessage; diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Exceptions/SharpReportWrongItemException.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Exceptions/SharpReportWrongItemException.cs index 5de35e013d..e57eca3c34 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Exceptions/SharpReportWrongItemException.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Exceptions/SharpReportWrongItemException.cs @@ -7,35 +7,40 @@ // the code is regenerated. // //------------------------------------------------------------------------------ +using System; +using System.Runtime.Serialization; -namespace SharpReportCore { - using System; - - - /// - /// This Exception is throwen - /// - /// - /// created by - Forstmeier Peter - /// created on - 28.09.2005 14:00:34 - /// - public class SharpReportUnkownItemException : System.Exception { +/// +/// This Exception is throwen +/// +/// +/// created by - Forstmeier Peter +/// created on - 28.09.2005 14:00:34 +/// +namespace SharpReportCore { + [Serializable()] + public class UnkownItemException : System.Exception { string errorMessage = String.Empty; - public SharpReportUnkownItemException():base() { + public UnkownItemException():base() { this.errorMessage = "Unkown ReportItemType"; } - public SharpReportUnkownItemException(string errorMessage):base(errorMessage) + public UnkownItemException(string errorMessage):base(errorMessage) { this.errorMessage = errorMessage; } - public SharpReportUnkownItemException(string errorMessage, + public UnkownItemException(string errorMessage, Exception exception):base (errorMessage,exception){ } + protected UnkownItemException(SerializationInfo info, + StreamingContext context) : base(info, context){ + // Implement type-specific serialization constructor logic. + } + public string ErrorMessage { get { return errorMessage; diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Interfaces/ISectionRender.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Interfaces/ISectionRender.cs deleted file mode 100644 index d22e1c5f21..0000000000 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Interfaces/ISectionRender.cs +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Created by SharpDevelop. - * User: Forstmeier Helmut - * Date: 29.11.2004 - * Time: 16:53 - * - * To change this template use Tools | Options | Coding | Edit Standard Headers. - */ - -using System; - -namespace SharpReportCore{ - /// - /// Section Interface - /// - public interface ISectionRenderer :IBaseRenderer{ - } -} diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs index 108bb6c46c..024b51161e 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs @@ -50,11 +50,10 @@ namespace SharpReportCore { private Point detailEnds; private DefaultFormatter defaultFormatter; - private bool cancel = false; + private bool cancel; - public AbstractRenderer(ReportModel model){ -// System.Console.WriteLine("\tConstructor of ABstractRenderer"); + protected AbstractRenderer(ReportModel model){ this.reportSettings = model.ReportSettings; this.sections = model.SectionCollection; Init(); @@ -208,7 +207,7 @@ namespace SharpReportCore { void FormatBaseReportItem (object sender, FormatOutputEventArgs e) { if (sender is BaseDataItem) { BaseDataItem i = (BaseDataItem)sender; - e.FormatedString = defaultFormatter.FormatItem (i); + e.FormatedValue = defaultFormatter.FormatItem (i); } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/FormatOutputEventArgs.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/FormatOutputEventArgs.cs index cb6c43d85c..90099a7e1e 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/FormatOutputEventArgs.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/FormatOutputEventArgs.cs @@ -17,25 +17,25 @@ namespace SharpReportCore { /// /// Default constructor - initializes all fields to default values /// - private string formatString = String.Empty; - private string stringToFormat = String.Empty; - private string nullValue = String.Empty; - private string formatedString = String.Empty; + private string format; + private string valueToFormat; + private string nullValue; + private string formatedValue; public FormatOutputEventArgs() { } - public FormatOutputEventArgs(string stringToFormat,string formatString, string nullValue ) + public FormatOutputEventArgs(string valueToFormat,string format, string nullValue ) { - this.formatString = formatString; + this.format = format; this.nullValue = nullValue; - this.stringToFormat = stringToFormat; + this.valueToFormat = valueToFormat; } #region Property's - public string FormatString { + public string Format { get { - return formatString; + return format; } } public string NullValue { @@ -43,18 +43,18 @@ namespace SharpReportCore { return nullValue; } } - public string StringToFormat { + public string ValueToFormat { get { - return stringToFormat; + return valueToFormat; } } - public string FormatedString { + public string FormatedValue { get { - return formatedString; + return formatedValue; } set { - formatedString = value; + formatedValue = value; } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Formatter/AbstractFormatter.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Formatter/AbstractFormatter.cs index 03d1bd0e3a..ec84c5dd52 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Formatter/AbstractFormatter.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Formatter/AbstractFormatter.cs @@ -38,8 +38,8 @@ namespace SharpReportCore { public AbstractFormatter() { } - protected bool CheckFormat (string formatString) { - if (formatString.Length > 0) { + protected bool CheckFormat (string format) { + if (format.Length > 0) { return true; } else { return false; diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Formatter/DefaultFormatter.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Formatter/DefaultFormatter.cs index efa42c4fa5..1c4d8f1b3b 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Formatter/DefaultFormatter.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Formatter/DefaultFormatter.cs @@ -76,9 +76,9 @@ namespace SharpReportCore{ return retValue; } - public string BoolValue (string toFormat, string formatString){ + public string BoolValue (string toFormat, string format){ string str = String.Empty; - if (base.CheckFormat(formatString) == true) { + if (base.CheckFormat(format) == true) { if (base.CheckValue (toFormat)) { try { @@ -97,13 +97,13 @@ namespace SharpReportCore{ return str; } - public string IntegerValues(string intType,string toFormat, string formatString) { + public string IntegerValues(string valueType,string toFormat, string format) { string str = String.Empty; - if (base.CheckFormat(formatString) == true) { + if (base.CheckFormat(format) == true) { if (base.CheckValue (toFormat)) { try { int number; - switch (intType) { + switch (valueType) { case "16": number = Int16.Parse (toFormat, System.Globalization.NumberStyles.Any, @@ -121,7 +121,7 @@ namespace SharpReportCore{ throw new ArgumentException("DefaultFormater:IntegerValues Unknown intType "); } - str = number.ToString (formatString); + str = number.ToString (format); } catch (Exception e) { string s = String.Format("\tDecimalValue < {0} > {1}",toFormat,e.Message); @@ -138,9 +138,9 @@ namespace SharpReportCore{ return str; } - public string DecimalValues(string toFormat, string formatString) { + public string DecimalValues(string toFormat, string format) { string str = String.Empty; - if (base.CheckFormat(formatString) == true) { + if (base.CheckFormat(format) == true) { if (base.CheckValue (toFormat)) { try { @@ -149,7 +149,7 @@ namespace SharpReportCore{ CultureInfo.CurrentCulture.NumberFormat); // decimal dec = Convert.ToDecimal (toFormat,NumberFormatInfo.InvariantInfo); - str = dec.ToString (formatString); + str = dec.ToString (format); } catch (Exception e) { string s = String.Format("\tDecimalValue < {0} > {1}",toFormat,e.Message); @@ -166,13 +166,13 @@ namespace SharpReportCore{ return str; } - public string DateValues(string toFormat, string formatString) { + public string DateValues(string toFormat, string format) { - if (base.CheckFormat(formatString) == true) { + if (base.CheckFormat(format) == true) { try { DateTime date = DateTime.Parse (toFormat.Trim(), CultureInfo.CurrentCulture.DateTimeFormat); - string str = date.ToString(formatString, + string str = date.ToString(format, DateTimeFormatInfo.CurrentInfo); return str.Trim(); diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/FillPatterns.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/FillPatterns.cs index a657b215aa..11a61702e3 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/FillPatterns.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/FillPatterns.cs @@ -33,7 +33,8 @@ namespace SharpReportCore { Color color; Brush brush; - public AbstractFillPattern(Color color) { + + protected AbstractFillPattern(Color color) { this.color = color; } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs index 65d17c1be7..9b886ca31f 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs @@ -40,8 +40,8 @@ using SharpReportCore; namespace SharpReportCore { public class RenderDataReport : SharpReportCore.AbstractRenderer { - private DataManager dataManager = null; - private PointF currentPoint = new PointF (0,0); + private DataManager dataManager; + private PointF currentPoint; public RenderDataReport(ReportModel model):base (model){ } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/ReportSettings.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/ReportSettings.cs index 60d394dd29..bb1a072150 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/ReportSettings.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/ReportSettings.cs @@ -38,9 +38,9 @@ namespace SharpReportCore{ /// This class stores all the basic settings of an Report /// /// - public class ReportSettings : BaseSettings,SharpReportCore.IStoreable, - SharpReportCore.ISectionRenderer,IDisposable{ + public class ReportSettings : BaseSettings,SharpReportCore.IStoreable, + IBaseRenderer,IDisposable{ private string connectionString; private string commandText; @@ -90,7 +90,7 @@ namespace SharpReportCore{ /// - /// Set the values for all Columns that inherit + /// Set the values for all Columns that inherit /// from like for sorting etc /// /// See XMLFormReader @@ -379,7 +379,7 @@ namespace SharpReportCore{ SaveCollectionItems(ctrl,column,prop); xmlSection.AppendChild(ctrl); } - } catch (Exception) { + } catch (Exception) { throw; } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj index 809b75de9d..599405e7ee 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj @@ -89,7 +89,6 @@ - diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs index 2f2ac10f8c..4a2ae2704b 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs @@ -38,13 +38,11 @@ using SharpReportCore; namespace SharpReportCore { public class SharpReportEngine : object,IDisposable { - private PreviewControl previewControl = null; + private PreviewControl previewControl; - private ConnectionObject connectionObject = null; + private ConnectionObject connectionObject; public event EventHandler NoData; -// public event EventSharpReportEventHandler NoData; -// public event SharpReportParametersEventHandler ParametersRequest; public event EventHandler ParametersRequest; public SharpReportEngine() { diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/LoadModelVisitor.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/LoadModelVisitor.cs index d86b526081..059616ce12 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/LoadModelVisitor.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/LoadModelVisitor.cs @@ -87,7 +87,7 @@ namespace SharpReportCore { rpt.Visible = true; rpt.ResumeLayout(); } else { - SharpReportUnkownItemException e = new SharpReportUnkownItemException(); + UnkownItemException e = new UnkownItemException(); throw e; } } catch (Exception ) { diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Xml/XmlFormReader.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Xml/XmlFormReader.cs index 8e0502c99b..b2ff48b40b 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Xml/XmlFormReader.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Xml/XmlFormReader.cs @@ -153,8 +153,8 @@ namespace SharpReportCore { fontElement.Attributes.Append(att); } - public static Font MakeFont(string fontString) { - string s = fontString.Replace(';',','); + public static Font MakeFont(string font) { + string s = font.Replace(';',','); return (Font)XmlFormReader.StringToTypedValue(s,typeof(Font),CultureInfo.InstalledUICulture); } ///