Browse Source
Improved VB -> C# converter. Add Grouping (only one Column) to SharpReport Fixed exception when opening a solution containing web projects. Fixed SD2-711: Clear all bookmarks menu option selected when bookmarks pad not visible git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1199 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
65 changed files with 1381 additions and 1324 deletions
@ -1,103 +0,0 @@
@@ -1,103 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <autogenerated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version: 1.1.4322.2032
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </autogenerated>
|
||||
//------------------------------------------------------------------------------
|
||||
using System; |
||||
using System.Text; |
||||
using System.ComponentModel; |
||||
using SharpReportCore; |
||||
|
||||
|
||||
/// <summary>
|
||||
/// TODO - Add class summary
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// created by - Forstmeier Helmut
|
||||
/// created on - 27.11.2005 14:59:28
|
||||
/// </remarks>
|
||||
namespace SharpReportCore { |
||||
public class GroupComparer : SharpReportCore.BaseComparer{ |
||||
|
||||
public GroupComparer(ColumnCollection owner, int listIndex, object[] values): |
||||
base(owner,listIndex,values) { |
||||
} |
||||
|
||||
internal int CompareTo(GroupComparer value) |
||||
{ |
||||
// we shouldn't get to this point
|
||||
if (value == null) |
||||
throw new ArgumentNullException("value"); |
||||
|
||||
if (value.ObjectArray.Length != base.ObjectArray.Length) |
||||
throw new InvalidOperationException("Differnet size of compare data"); |
||||
|
||||
int compare = 0; |
||||
|
||||
for (int index = 0; index < base.ObjectArray.Length; index++) |
||||
{ |
||||
object leftValue = base.ObjectArray[index]; |
||||
object rightValue = value.ObjectArray[index]; |
||||
// Indizes sind hier deckungsgleich
|
||||
|
||||
GroupColumn groupColumn = (GroupColumn)base.ColumnCollection[index]; |
||||
|
||||
bool descending = (groupColumn.SortDirection == ListSortDirection.Descending); |
||||
|
||||
// null means equl
|
||||
if (leftValue == null || leftValue == System.DBNull.Value) |
||||
{ |
||||
if (rightValue != null && rightValue != System.DBNull.Value) |
||||
{ |
||||
return (descending) ? 1 : -1; |
||||
} |
||||
|
||||
// Beide Null
|
||||
continue; |
||||
} |
||||
|
||||
if (rightValue == null || rightValue == System.DBNull.Value) |
||||
{ |
||||
return (descending) ? -1 : 1; |
||||
} |
||||
|
||||
|
||||
if (leftValue.GetType() != rightValue.GetType()) |
||||
throw new InvalidOperationException("Compare of different types is not supported"); |
||||
|
||||
if (leftValue.GetType() == typeof(string)) |
||||
{ |
||||
compare = String.Compare((string)leftValue, (string)rightValue, |
||||
!groupColumn.CaseSensitive, base.ColumnCollection.Culture); |
||||
} |
||||
else |
||||
{ |
||||
compare = ((IComparable)leftValue).CompareTo(rightValue); |
||||
} |
||||
|
||||
// Sind ungleich, tauschen je nach Richtung
|
||||
if (compare != 0) |
||||
{ |
||||
return (descending) ? -compare : compare; |
||||
} |
||||
} |
||||
|
||||
// Gleich Werte, dann Index bercksichtigen
|
||||
return this.ListIndex.CompareTo(value.ListIndex); |
||||
} |
||||
|
||||
|
||||
|
||||
public override int CompareTo(object obj) { |
||||
base.CompareTo(obj); |
||||
return this.CompareTo((GroupComparer)obj); |
||||
} |
||||
|
||||
|
||||
|
||||
} |
||||
} |
@ -1,45 +0,0 @@
@@ -1,45 +0,0 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Forstmeier Helmut |
||||
* Date: 04.08.2005 |
||||
* Time: 09:06 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections; |
||||
|
||||
namespace SharpReportCore { |
||||
|
||||
|
||||
public interface IExtendedList{ |
||||
|
||||
///<summary>
|
||||
/// Build the Hash/IndexList we need for indexing the DataSource
|
||||
/// </summary>
|
||||
void BuildHashList (IList list); |
||||
|
||||
/// <summary>
|
||||
/// This List is used as an Index to the DataSource
|
||||
/// ListItems are added by derived Classes
|
||||
/// </summary>
|
||||
IList IndexList{ |
||||
get; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// returns the Name of the <see cref="ExtendedListArray"></see>
|
||||
/// </summary>
|
||||
string Name { |
||||
get; |
||||
} |
||||
|
||||
///<summary>
|
||||
/// CurrentPosition in <see cref="SharpArrayList"></see>
|
||||
/// </summary>
|
||||
int CurrentPosition { |
||||
get;set; |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,41 +0,0 @@
@@ -1,41 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <autogenerated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version: 1.1.4322.2032
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </autogenerated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace SharpReportCore { |
||||
using System; |
||||
using SharpReportCore; |
||||
using System.Collections; |
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// created by - Forstmeier peter
|
||||
/// created on - 02.12.2005 13:42:08
|
||||
/// </remarks>
|
||||
public class IHierarchicalArray : ArrayList,IHierarchicalEnumerable { |
||||
|
||||
/// <summary>
|
||||
/// Default constructor - initializes all fields to default values
|
||||
/// </summary>
|
||||
public IHierarchicalArray(){ |
||||
} |
||||
|
||||
|
||||
#region SharpReportCore.IHierarchicalEnumerable interface implementation
|
||||
public IHierarchyData GetHierarchyData(Object enumeratedItem) { |
||||
return enumeratedItem as IHierarchyData; |
||||
|
||||
} |
||||
#endregion
|
||||
|
||||
|
||||
} |
||||
} |
@ -1,306 +1,229 @@
@@ -1,306 +1,229 @@
|
||||
using System; |
||||
using System.Data; |
||||
using System.Diagnostics; |
||||
using System.Reflection; |
||||
using System.Collections; |
||||
using System.ComponentModel; |
||||
|
||||
|
||||
using System.Collections.Generic; |
||||
using System.Collections.ObjectModel; |
||||
|
||||
namespace SharpReportCore |
||||
{ |
||||
|
||||
/// <summary>
|
||||
/// This class act'S as a IndexList to
|
||||
/// <see cref="SharpBaseList"></see>
|
||||
/// </summary>
|
||||
public class SharpArrayList : ArrayList, IBindingList ,ITypedList,IExtendedList |
||||
{ |
||||
Type elementType; |
||||
public class SharpIndexCollection :List<BaseComparer> { |
||||
string name; |
||||
int currentPosition; |
||||
|
||||
bool allowNew = true; |
||||
bool allowEdit = true; |
||||
bool allowRemove = true; |
||||
bool supportsSearching ; |
||||
bool supportsSorting ; |
||||
bool isSorted; |
||||
|
||||
private ListChangedEventArgs resetEvent = new ListChangedEventArgs(ListChangedType.Reset, -1); |
||||
|
||||
public event ListChangedEventHandler ListChanged; |
||||
|
||||
|
||||
public SharpArrayList(Type elementType,string name){ |
||||
this.Clear(); |
||||
this.elementType = elementType; |
||||
this.name = name; |
||||
Reset(); |
||||
public SharpIndexCollection():this ("SharpIndexList"){ |
||||
} |
||||
|
||||
#region ITypedList Member
|
||||
|
||||
public PropertyDescriptorCollection GetItemProperties(PropertyDescriptor[] listAccessors){ |
||||
if (listAccessors != null && listAccessors.Length > 0){ |
||||
Type t = this.elementType; |
||||
for(int i = 0; i < listAccessors.Length; i++){ |
||||
PropertyDescriptor pd = listAccessors[i]; |
||||
// System.Diagnostics.Debug.WriteLine("*** " + t.FullName + ": " + pd.Name);
|
||||
t = (Type) PropertyTypeHash.Instance[t, pd.Name]; |
||||
} |
||||
// System.Diagnostics.Debug.WriteLine("*** New Collection for " + t.FullName);
|
||||
// if t is null an empty list will be generated
|
||||
return SharpTypeDescriptor.GetProperties(t); |
||||
} |
||||
return SharpTypeDescriptor.GetProperties(elementType); |
||||
} |
||||
|
||||
public static Type GetElementType(IList list, |
||||
Type parentType, |
||||
string propertyName){ |
||||
SharpArrayList al = list as SharpArrayList; |
||||
if (al == null) |
||||
return null; |
||||
return al.elementType; |
||||
} |
||||
#if longVersion
|
||||
public static Type GetElementType(IList list, |
||||
Type parentType, |
||||
string propertyName){ |
||||
SharpArrayList al = null; |
||||
object element = null; |
||||
al = CheckForArrayList(list); |
||||
if (al == null){ |
||||
if (list.Count > 0){ |
||||
element = list[0]; |
||||
} |
||||
} |
||||
if (al == null && element == null){ |
||||
PropertyInfo pi = parentType.GetProperty(propertyName); |
||||
if (pi != null){ |
||||
object parentObject = null; |
||||
try{ |
||||
parentObject = Activator.CreateInstance(parentType); |
||||
} |
||||
catch(Exception ex) {} |
||||
|
||||
if (parentObject != null){ |
||||
list = pi.GetValue(parentObject, null) as IList; |
||||
al = CheckForArrayList(list); |
||||
} |
||||
} |
||||
} |
||||
if (al != null){ |
||||
return al.elementType; |
||||
} |
||||
else if (element != null){ |
||||
return element.GetType(); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
|
||||
private static SharpArrayList CheckForArrayList(object l){ |
||||
IList list = l as IList; |
||||
if (list == null) |
||||
return null; |
||||
if (list.GetType().FullName == "System.Collections.ArrayList+ReadOnlyArrayList"){ |
||||
FieldInfo fi = list.GetType().GetField("_list", BindingFlags.NonPublic | BindingFlags.Instance); |
||||
if (fi != null){ |
||||
list = (IList) fi.GetValue(list); |
||||
} |
||||
} |
||||
return list as SharpArrayList; |
||||
} |
||||
#endif
|
||||
|
||||
|
||||
|
||||
public string GetListName(PropertyDescriptor[] listAccessors){ |
||||
return elementType.Name; |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
protected void Reset(){ |
||||
this.currentPosition = 0; |
||||
this.OnListChange (resetEvent); |
||||
} |
||||
|
||||
private void OnListChange (ListChangedEventArgs handler) { |
||||
if (this.ListChanged != null) { |
||||
this.ListChanged (this,handler); |
||||
} |
||||
public SharpIndexCollection(string name){ |
||||
this.name = name; |
||||
} |
||||
|
||||
|
||||
#region System.ComponentModel.IBindingList interface implementation
|
||||
public bool AllowNew { |
||||
#region properties
|
||||
|
||||
public int CurrentPosition { |
||||
get { |
||||
return this.allowNew; |
||||
return currentPosition; |
||||
} |
||||
} |
||||
|
||||
public bool AllowEdit { |
||||
get { |
||||
return this.allowEdit; |
||||
set { |
||||
currentPosition = value; |
||||
} |
||||
} |
||||
|
||||
public bool AllowRemove { |
||||
public string Name { |
||||
get { |
||||
return this.allowRemove; |
||||
return name; |
||||
} |
||||
} |
||||
|
||||
public bool SupportsChangeNotification { |
||||
get { |
||||
return true; |
||||
} |
||||
} |
||||
|
||||
public bool SupportsSearching { |
||||
get { |
||||
return this.supportsSearching; |
||||
} |
||||
set { |
||||
this.supportsSearching = value; |
||||
} |
||||
} |
||||
#endregion
|
||||
} |
||||
|
||||
/// <summary>
|
||||
/// This class act's as a store of the original Data
|
||||
/// </summary>
|
||||
|
||||
public class SharpDataCollection<T> : IList<T>,ITypedList{ |
||||
Collection<T> list = new Collection<T>(); |
||||
Type elementType; |
||||
|
||||
public bool SupportsSorting { |
||||
get { |
||||
return this.supportsSorting; |
||||
} |
||||
set { |
||||
this.supportsSorting = value; |
||||
} |
||||
public SharpDataCollection(Type elementType) |
||||
{ |
||||
this.elementType = elementType; |
||||
} |
||||
|
||||
public bool IsSorted { |
||||
|
||||
public T this[int index] { |
||||
get { |
||||
return this.isSorted; |
||||
return list[index]; |
||||
} |
||||
set { |
||||
this.isSorted = value; |
||||
T oldValue = list[index]; |
||||
if (!object.Equals(oldValue, value)) { |
||||
list[index] = value; |
||||
} |
||||
} |
||||
} |
||||
|
||||
public System.ComponentModel.PropertyDescriptor SortProperty { |
||||
public int Count { |
||||
[DebuggerStepThrough] |
||||
get { |
||||
return null; |
||||
return list.Count; |
||||
} |
||||
} |
||||
|
||||
public System.ComponentModel.ListSortDirection SortDirection { |
||||
public bool IsReadOnly { |
||||
get { |
||||
return ListSortDirection.Ascending; |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
public void RemoveSort() { |
||||
throw new NotImplementedException("RemoveSort"); |
||||
} |
||||
//TODO Test fehlt
|
||||
public void RemoveIndex(System.ComponentModel.PropertyDescriptor property) { |
||||
throw new NotImplementedException("RemoveIndex"); |
||||
public int IndexOf(T item) |
||||
{ |
||||
return list.IndexOf(item); |
||||
} |
||||
|
||||
//TODO Test fehlt
|
||||
public int Find(System.ComponentModel.PropertyDescriptor property, object key) { |
||||
// return 0;
|
||||
throw new NotImplementedException("Find"); |
||||
public void Insert(int index, T item) |
||||
{ |
||||
list.Insert(index, item); |
||||
} |
||||
//TODO Test fehlt
|
||||
public void ApplySort(System.ComponentModel.PropertyDescriptor property, System.ComponentModel.ListSortDirection direction) { |
||||
throw new NotImplementedException("ApplySort"); |
||||
} |
||||
//TODO Test fehlt
|
||||
public void AddIndex(System.ComponentModel.PropertyDescriptor property) { |
||||
throw new NotImplementedException("AddIndex"); |
||||
|
||||
public void RemoveAt(int index) |
||||
{ |
||||
// T item = list[index];
|
||||
list.RemoveAt(index); |
||||
} |
||||
|
||||
public object AddNew() { |
||||
throw new NotImplementedException("AddNew"); |
||||
public void Add(T item) |
||||
{ |
||||
list.Add(item); |
||||
} |
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region overrides
|
||||
public override int Add(object value) { |
||||
if (this.elementType.GetType().IsAssignableFrom (value.GetType())) { |
||||
System.Console.WriteLine("type ok"); |
||||
} |
||||
if ((value.GetType().IsSubclassOf(this.elementType))||( value.GetType() == this.elementType)){ |
||||
if (this.allowNew) { |
||||
int i = base.Add(value); |
||||
this.OnListChange (new ListChangedEventArgs(ListChangedType.ItemAdded,i)); |
||||
return i; |
||||
} else { |
||||
throw new NotSupportedException("SharpArrayList:Add(object)"); |
||||
} |
||||
} else { |
||||
string str = String.Format("Add:Wrong Type {0} {1}",this.elementType,value.GetType()); |
||||
throw new ArgumentException(str); |
||||
public void AddRange(IList range) |
||||
{ |
||||
foreach(T t in range) { |
||||
Add(t); |
||||
} |
||||
} |
||||
|
||||
|
||||
public override void AddRange(System.Collections.ICollection c) { |
||||
foreach (object o in c) { |
||||
this.Add (o); |
||||
} |
||||
public void Clear(){ |
||||
list = new Collection<T>(); |
||||
} |
||||
|
||||
|
||||
public override void RemoveAt(int index) { |
||||
if (this.allowRemove) { |
||||
if (index > -1) { |
||||
base.RemoveAt(index); |
||||
this.OnListChange (new ListChangedEventArgs(ListChangedType.ItemDeleted,index)); |
||||
} |
||||
} else { |
||||
throw new NotSupportedException("SharpArrayList:RemoveAt (index)"); |
||||
} |
||||
public bool Contains(T item) |
||||
{ |
||||
return list.Contains(item); |
||||
} |
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region SharpReport.Data.IExtendedList interface implementation
|
||||
public string Name { |
||||
get { |
||||
return this.name; |
||||
} |
||||
|
||||
public void CopyTo(T[] array, int arrayIndex) |
||||
{ |
||||
list.CopyTo(array, arrayIndex); |
||||
} |
||||
|
||||
public int CurrentPosition { |
||||
get { |
||||
return currentPosition; |
||||
public bool Remove(T item) |
||||
{ |
||||
if (list.Remove(item)) { |
||||
return true; |
||||
} |
||||
set { |
||||
currentPosition = value; |
||||
return false; |
||||
} |
||||
#region ITypedList Member
|
||||
|
||||
public PropertyDescriptorCollection GetItemProperties(PropertyDescriptor[] listAccessors){ |
||||
if (listAccessors != null && listAccessors.Length > 0){ |
||||
Type t = this.elementType; |
||||
|
||||
for(int i = 0; i < listAccessors.Length; i++){ |
||||
PropertyDescriptor pd = listAccessors[i]; |
||||
t = (Type) PropertyTypeHash.Instance[t, pd.Name]; |
||||
} |
||||
// if t is null an empty list will be generated
|
||||
return SharpTypeDescriptor.GetProperties(t); |
||||
} |
||||
return SharpTypeDescriptor.GetProperties(elementType); |
||||
} |
||||
public string GetListName(PropertyDescriptor[] listAccessors){ |
||||
return elementType.Name; |
||||
} |
||||
|
||||
|
||||
public IList IndexList { |
||||
get { |
||||
return(IList)this; |
||||
public static Type GetElementType(IList list, Type parentType, string propertyName) |
||||
{ |
||||
SharpDataCollection<T> al = null; |
||||
object element = null; |
||||
al = CheckForArrayList(list); |
||||
if (al == null) |
||||
{ |
||||
if (list.Count > 0) |
||||
{ |
||||
element = list[0]; |
||||
} |
||||
} |
||||
if (al == null && element == null) |
||||
{ |
||||
PropertyInfo pi = parentType.GetProperty(propertyName); |
||||
if (pi != null) |
||||
{ |
||||
object parentObject = null; |
||||
try |
||||
{ |
||||
parentObject = Activator.CreateInstance(parentType); |
||||
} |
||||
catch(Exception) {} |
||||
if (parentObject != null) |
||||
{ |
||||
list = pi.GetValue(parentObject, null) as IList; |
||||
al = CheckForArrayList(list); |
||||
} |
||||
} |
||||
} |
||||
if (al != null) |
||||
{ |
||||
return al.elementType; |
||||
} |
||||
else if (element != null) |
||||
{ |
||||
return element.GetType(); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
public void BuildHashList(IList list) { |
||||
throw new NotImplementedException("SharpArrayList:BuildHashList"); |
||||
/* |
||||
this.Clear(); |
||||
for (int i = 0;i < list.Count ;i++ ) { |
||||
// this.Add (new PlainIndexItem(i,"satz " + i.ToString()));
|
||||
private static SharpDataCollection<T> CheckForArrayList(object l) |
||||
{ |
||||
IList list = l as IList; |
||||
if (list == null) |
||||
return null; |
||||
if (list.GetType().FullName == "System.Collections.ArrayList+ReadOnlyArrayList") |
||||
{ |
||||
FieldInfo fi = list.GetType().GetField("_list", BindingFlags.NonPublic | BindingFlags.Instance); |
||||
if (fi != null) |
||||
{ |
||||
list = (IList) fi.GetValue(list); |
||||
} |
||||
} |
||||
this.OnListChange (new ListChangedEventArgs(ListChangedType.Reset,-1,-1)); |
||||
*/ |
||||
return list as SharpDataCollection<T>; |
||||
} |
||||
#endregion
|
||||
|
||||
[DebuggerStepThrough] |
||||
public IEnumerator<T> GetEnumerator() |
||||
{ |
||||
return list.GetEnumerator(); |
||||
} |
||||
|
||||
[DebuggerStepThrough] |
||||
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() |
||||
{ |
||||
return list.GetEnumerator(); |
||||
} |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue