Browse Source

Small changes in ReportGenerator and better handling of IDisposable

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1060 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Peter Forstmeier 20 years ago
parent
commit
6991095c10
  1. 52
      src/AddIns/Misc/SharpReport/SharpReport/AutoReport.cs
  2. 3
      src/AddIns/Misc/SharpReport/SharpReport/Designer/IDesignable.cs
  3. 7
      src/AddIns/Misc/SharpReport/SharpReport/Designer/NameService.cs
  4. 24
      src/AddIns/Misc/SharpReport/SharpReport/Designer/Report.cs
  5. 6
      src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSection.cs
  6. 10
      src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSectionControlbase.cs
  7. 2
      src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/SectionChangedEventArgs.cs
  8. 3
      src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/PageNumber.cs
  9. 3
      src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/Today.cs
  10. 3
      src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportCircleItem.cs
  11. 3
      src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportImageItem.cs
  12. 3
      src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportLineItem.cs
  13. 3
      src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportRectangleItem.cs
  14. 2
      src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportDataItem.cs
  15. 3
      src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs
  16. 127
      src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs
  17. 1
      src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/FieldsExplorer.cs
  18. 60
      src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportView.cs
  19. 17
      src/AddIns/Misc/SharpReport/SharpReportCore/Collections/Collections.cs
  20. 4
      src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/Comparer/GroupSeperator.cs
  21. 83
      src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataManager.cs
  22. 15
      src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListHandling/SharpArrayList.cs
  23. 17
      src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/BaseListStrategy.cs
  24. 18
      src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/TableStrategy.cs
  25. 4
      src/AddIns/Misc/SharpReport/SharpReportCore/Interfaces/IDataViewStrategy.cs
  26. 8
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs
  27. 3
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Formatter/DefaultFormatter.cs
  28. 10
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseShape.cs
  29. 8
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/Border.cs
  30. 5
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs
  31. 4
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/TextDrawer.cs
  32. 21
      src/AddIns/Misc/SharpReport/SharpReportCore/ReportModel.cs
  33. 40
      src/AddIns/Misc/SharpReport/SharpReportCore/ReportSettings.cs
  34. 40
      src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs
  35. 23
      src/AddIns/Misc/SharpReport/SharpReportWizard/GeneratorCommands.cs
  36. 55
      src/AddIns/Misc/SharpReport/SharpReportWizard/Generators/AbstractReportGenerator.cs
  37. 30
      src/AddIns/Misc/SharpReport/SharpReportWizard/Generators/GeneratePullDataReport.cs
  38. 18
      src/AddIns/Misc/SharpReport/SharpReportWizard/Generators/GeneratePushDataReport.cs
  39. 4
      src/AddIns/Misc/SharpReport/SharpReportWizard/ReportGenerator.cs
  40. 5
      src/AddIns/Misc/SharpReport/SharpReportWizard/ReportLayouts/AbstractLayout.cs
  41. 6
      src/AddIns/Misc/SharpReport/SharpReportWizard/WizardPanels/PullModelPanel.cs
  42. 23
      src/AddIns/Misc/SharpReport/SharpReportWizard/WizardPanels/PushModelPanel.cs
  43. 14
      src/AddIns/Misc/SharpReport/SharpReportWizard/WizardPanels/ResultPanel.cs

52
src/AddIns/Misc/SharpReport/SharpReport/AutoReport.cs

@ -61,7 +61,7 @@ namespace SharpReport { @@ -61,7 +61,7 @@ namespace SharpReport {
/// <param name="schemaTable">SchemaDefinition Datatable</param>
/// <returns>Collection of BaseDataItems</returns>
public ReportItemCollection AutoColumnsFromTable (ReportModel model,DataTable schemaTable) {
public ReportItemCollection ReportItemsFromTable (ReportModel model,DataTable schemaTable) {
ReportItemCollection itemCol = new ReportItemCollection();
for (int i = 0;i < schemaTable.Rows.Count;i++){
@ -84,7 +84,7 @@ namespace SharpReport { @@ -84,7 +84,7 @@ namespace SharpReport {
/// <param name="dataSet">DataSet from *.xsd File</param>
/// <returns> Collection of BaseDataItems</returns>
public ReportItemCollection AutoColumnsFromSchema (ReportModel model,DataSet dataSet) {
public ReportItemCollection ReportItemsFromSchema (ReportModel model,DataSet dataSet) {
if (dataSet.Tables.Count > 1) {
MessageService.ShowError ("AutoBuildFromDataSet : at this time no more than one table is allowed " + dataSet.Tables.Count.ToString());
throw new ArgumentException ("Too much Tables in DataSet");
@ -126,25 +126,9 @@ namespace SharpReport { @@ -126,25 +126,9 @@ namespace SharpReport {
throw new ArgumentNullException ("AutoReport:ReportItemCollection");
}
}
#endregion
public ReportItemCollection AutoHeaderColumns(ReportItemCollection col) {
if (col != null) {
ReportItemCollection itemCol = new ReportItemCollection();
ReportDataItem oldItem = null;
for (int i = 0;i < col.Count ;i++ ){
ReportTextItem newItem = new ReportTextItem();
oldItem = (ReportDataItem)col[i];
newItem.VisualControl.Text = oldItem.ColumnName;
newItem.Text = oldItem.ColumnName;
newItem.Location = new Point (i * 30,5);
itemCol.Add(newItem);
}
return itemCol;
}else {
throw new ArgumentNullException ("AutoReport:ReportItemCollection");
}
}
#region HeaderColumns
/// <summary>
/// Build Headerline from a schemaDataTable
/// </summary>
@ -154,7 +138,7 @@ namespace SharpReport { @@ -154,7 +138,7 @@ namespace SharpReport {
/// <param name="setOnTop">Locate the Columns of Top or an Bottom of the Section</param>
/// <returns>a Collection of BaseTextItems</returns>
public ReportItemCollection AutoHeaderFromTable (ReportModel model,BaseSection section,DataTable schemaTable,bool setOnTop) {
public ReportItemCollection AutoHeaderFromTable (BaseSection section,DataTable schemaTable,bool setOnTop) {
ReportItemCollection itemCol = new ReportItemCollection();
for (int i = 0;i < schemaTable.Rows.Count;i++){
DataRow r = schemaTable.Rows[i];
@ -176,6 +160,32 @@ namespace SharpReport { @@ -176,6 +160,32 @@ namespace SharpReport {
}
public ReportItemCollection AutoHeaderFromReportItems(ReportItemCollection col,BaseSection section,bool setOnTop) {
if (col != null) {
ReportItemCollection itemCol = new ReportItemCollection();
ReportDataItem sourceItem = null;
for (int i = 0;i < col.Count ;i++ ){
BaseTextItem rItem = (BaseTextItem)iDesignableFactory.Create("ReportTextItem");
if (rItem != null) {
sourceItem = (ReportDataItem)col[i];
rItem.Text = sourceItem.ColumnName;
rItem.Text = sourceItem.ColumnName;
if (setOnTop) {
rItem.Location = new Point (i * 30,1);
} else {
int y = section.Size.Height - rItem.Size.Height - 5;
rItem.Location = new Point (i * 30,y);
}
itemCol.Add(rItem);
}
}
return itemCol;
}else {
throw new ArgumentNullException ("AutoReport:ReportItemCollection");
}
}
#endregion
}
}

3
src/AddIns/Misc/SharpReport/SharpReport/Designer/IDesignable.cs

@ -41,6 +41,7 @@ namespace SharpReport.Designer{ @@ -41,6 +41,7 @@ namespace SharpReport.Designer{
event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
event SelectedEventHandler Selected;
// event EventHandler <GroupChangedEventArgs> GroupChanged;
event EventHandler <EventArgs> Selected;
}
}

7
src/AddIns/Misc/SharpReport/SharpReport/Designer/NameService.cs

@ -35,10 +35,11 @@ namespace SharpReport { @@ -35,10 +35,11 @@ namespace SharpReport {
public string CreateName (ReportItemCollection collection,
string typeName) {
string name = Char.ToLower(typeName[0],CultureInfo.InvariantCulture) + typeName.Substring(1);
string name = Char.ToLower(typeName[0],
CultureInfo.InvariantCulture) + typeName.Substring(1);
int number = 1;
while (collection.Find(name + number.ToString()) != null) {
while (collection.Find(name + number.ToString(CultureInfo.InvariantCulture)) != null) {
++number;
}
@ -61,7 +62,7 @@ namespace SharpReport { @@ -61,7 +62,7 @@ namespace SharpReport {
public void ValidateName(ReportItemCollection collection,
string name) {
if (!IsValidName(collection,name)) {
throw new System.Exception("Invalid name " + name);
throw new SharpReportException("Invalid name " + name);
}
}
#endregion

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

@ -52,8 +52,8 @@ namespace SharpReport.Designer{ @@ -52,8 +52,8 @@ namespace SharpReport.Designer{
[EditorBrowsable(EditorBrowsableState.Always), Browsable(true)]
public event SelectedEventHandler ObjectSelected;
public event EventHandler <EventArgs> ObjectSelected;
public event EventHandler <SectionChangedEventArgs> SectionChanged;
public event ItemDragDropEventHandler DesignViewChanged;
@ -111,18 +111,18 @@ namespace SharpReport.Designer{ @@ -111,18 +111,18 @@ namespace SharpReport.Designer{
sectionCollection.Add(detail);
sectionCollection.Add(pageFooter);
sectionCollection.Add(footer);
header.Selected += new SelectedEventHandler(this.SectionSelected);
pageHeader.Selected += new SelectedEventHandler(this.SectionSelected);
detail.Selected += new SelectedEventHandler(this.SectionSelected);
footer.Selected += new SelectedEventHandler(this.SectionSelected);
pageFooter.Selected += new SelectedEventHandler(this.SectionSelected);
header.ItemSelected += new SelectedEventHandler(this.ItemSelected);
pageHeader.ItemSelected += new SelectedEventHandler(this.ItemSelected);
detail.ItemSelected += new SelectedEventHandler(this.ItemSelected);
footer.ItemSelected += new SelectedEventHandler(this.ItemSelected);
pageFooter.ItemSelected += new SelectedEventHandler(this.ItemSelected);
header.Selected += new EventHandler <EventArgs>(this.SectionSelected);
pageHeader.Selected += new EventHandler <EventArgs>(this.SectionSelected);
detail.Selected += new EventHandler <EventArgs>(this.SectionSelected);
footer.Selected += new EventHandler <EventArgs>(this.SectionSelected);
pageFooter.Selected += new EventHandler <EventArgs>(this.SectionSelected);
header.ItemSelected += new EventHandler <EventArgs>(this.ItemSelected);
pageHeader.ItemSelected += new EventHandler <EventArgs>(this.ItemSelected);
detail.ItemSelected += new EventHandler <EventArgs>(this.ItemSelected);
footer.ItemSelected += new EventHandler <EventArgs>(this.ItemSelected);
pageFooter.ItemSelected += new EventHandler <EventArgs>(this.ItemSelected);
//This events are from DragDropp
visualReportHeader.ReportItemsHandling += new ItemDragDropEventHandler (OnAddReportItem);

6
src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSection.cs

@ -34,9 +34,9 @@ namespace SharpReport{ @@ -34,9 +34,9 @@ namespace SharpReport{
const string contextMenuPath = "/SharpReport/ContextMenu/Section";
private ReportSectionControlBase visualControl;
public event SelectedEventHandler ItemSelected;
public event SelectedEventHandler Selected;
public event EventHandler <EventArgs> ItemSelected;
public event EventHandler <EventArgs> Selected;
#region Constructors
internal ReportSection() : base(){
@ -247,7 +247,7 @@ namespace SharpReport{ @@ -247,7 +247,7 @@ namespace SharpReport{
SharpReport.Designer.IDesignable iDesignable = item as SharpReport.Designer.IDesignable;
if (iDesignable != null) {
if (this.VisualControl != null) {
iDesignable.Selected += new SelectedEventHandler(this.ReportItemSelected);
iDesignable.Selected += new EventHandler <EventArgs>(this.ReportItemSelected);
this.VisualControl.Body.Controls.Add(iDesignable.VisualControl);
iDesignable.VisualControl.BringToFront();
iDesignable.VisualControl.Focus();

10
src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSectionControlbase.cs

@ -36,7 +36,8 @@ namespace SharpReport.Designer{ @@ -36,7 +36,8 @@ namespace SharpReport.Designer{
private int currentY;
public event SelectedEventHandler ItemSelected;
public event EventHandler <EventArgs> ItemSelected;
public event ItemDragDropEventHandler ItemDragDrop;
public event EventHandler <SectionChangedEventArgs> SectionChanged;
@ -66,13 +67,6 @@ namespace SharpReport.Designer{ @@ -66,13 +67,6 @@ namespace SharpReport.Designer{
private void BodyPanelPaint(object sender, PaintEventArgs e) {
Graphics g = e.Graphics;
g.Clear(this.Body.BackColor);
if (dragAllowed) {
// using (Pen p = new Pen (Color.Gray)) {
// p.Width = 5;
// g.DrawRectangle(p,2,2,this.Width - 4, this.Height -4);
// }
}
System.Windows.Forms.ControlPaint.DrawGrid (e.Graphics,
this.Body.ClientRectangle,
GlobalValues.GridSize,

2
src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/SectionChangedEventArgs.cs

@ -22,8 +22,6 @@ namespace SharpReport.Designer { @@ -22,8 +22,6 @@ namespace SharpReport.Designer {
/// created on - 20.12.2004 22:06:09
/// </remarks>
public delegate void SelectedEventHandler(object sender, EventArgs e);
public class SectionChangedEventArgs : System.EventArgs {
ReportSection section;

3
src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/PageNumber.cs

@ -159,7 +159,8 @@ namespace SharpReport.ReportItems.Functions { @@ -159,7 +159,8 @@ namespace SharpReport.ReportItems.Functions {
}
}
public event SelectedEventHandler Selected;
public event EventHandler <EventArgs> Selected;
#endregion
}
}

3
src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/Today.cs

@ -174,8 +174,9 @@ namespace SharpReport.ReportItems.Functions { @@ -174,8 +174,9 @@ namespace SharpReport.ReportItems.Functions {
return visualControl;
}
}
public event EventHandler <EventArgs> Selected;
public event SelectedEventHandler Selected;
#endregion
}

3
src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportCircleItem.cs

@ -133,7 +133,8 @@ namespace SharpReport.ReportItems{ @@ -133,7 +133,8 @@ namespace SharpReport.ReportItems{
}
}
public new event PropertyChangedEventHandler PropertyChanged;
public event SelectedEventHandler Selected;
public event EventHandler <EventArgs> Selected;
#endregion
}

3
src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportImageItem.cs

@ -106,7 +106,8 @@ namespace SharpReport.ReportItems { @@ -106,7 +106,8 @@ namespace SharpReport.ReportItems {
}
public new event PropertyChangedEventHandler PropertyChanged;
public event SelectedEventHandler Selected;
public event EventHandler <EventArgs> Selected;
#endregion
}

3
src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportLineItem.cs

@ -137,7 +137,8 @@ namespace SharpReport.ReportItems{ @@ -137,7 +137,8 @@ namespace SharpReport.ReportItems{
public new event PropertyChangedEventHandler PropertyChanged;
public event SelectedEventHandler Selected;
public event EventHandler <EventArgs> Selected;
#endregion
}
}

3
src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportRectangleItem.cs

@ -148,7 +148,8 @@ namespace SharpReport.ReportItems{ @@ -148,7 +148,8 @@ namespace SharpReport.ReportItems{
}
public new event PropertyChangedEventHandler PropertyChanged;
public event SelectedEventHandler Selected;
public event EventHandler <EventArgs> Selected;
#endregion
}
}

2
src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportDataItem.cs

@ -183,7 +183,7 @@ namespace SharpReport.ReportItems{ @@ -183,7 +183,7 @@ namespace SharpReport.ReportItems{
}
public new event PropertyChangedEventHandler PropertyChanged;
public event SelectedEventHandler Selected;
public event EventHandler <EventArgs> Selected;
#endregion
}
}

3
src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs

@ -168,7 +168,8 @@ namespace SharpReport.ReportItems { @@ -168,7 +168,8 @@ namespace SharpReport.ReportItems {
}
public new event PropertyChangedEventHandler PropertyChanged;
public event SelectedEventHandler Selected;
public event EventHandler <EventArgs> Selected;
#endregion
}
}

127
src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs

@ -37,7 +37,7 @@ namespace SharpReport{ @@ -37,7 +37,7 @@ namespace SharpReport{
/// <summary>
/// Description of SharpReportManager.
/// </summary>
public class SharpReportManager :SharpReportEngine {
public class SharpReportManager :SharpReportEngine,IDisposable {
private BaseDesignerControl baseDesignerControl;
private ReportModel reportModel;
@ -145,7 +145,9 @@ namespace SharpReport{ @@ -145,7 +145,9 @@ namespace SharpReport{
#region Standarts for all reports (Headlines etc)
/// <summary>
/// Create TextItem in PageHeader with Reportmodel.ReportSettings.ReportName
/// Insert a <see cref="ReportTextItem"></see> in the PageHeader with
/// the <see cref="ReportModel.ReportSettings.ReportName"></see> as
/// text
/// </summary>
/// <param name="model">ReportModel</param>
public void CreatePageHeader (ReportModel model) {
@ -181,34 +183,24 @@ namespace SharpReport{ @@ -181,34 +183,24 @@ namespace SharpReport{
pageNumber.ResumeLayout();
section.ResumeLayout();
}
public void AdjustNames (ReportModel model) {
NameService nameService = new NameService();
foreach (BaseSection section in model.SectionCollection) {
foreach (IItemRenderer item in section.Items) {
item.Name = nameService.CreateName(section.Items,item.Name);
}
}
}
#endregion
#region Create report from Query
#region HeaderColumns
/// <summary>
/// Builds ColumHeaders for report, we take the ColumnNames as Text Property
/// Builds ColumHeaders for Reports, we take the ColumnNames as Text Property
/// </summary>
/// <param name="model">A valid(filled) reportModel</param>
/// <param name="section">The Section to use for headerLines</param>
/// <param name="schemaTable">SchemaTable witch contains the Column Informations</param>
public void CreateColumnHeadersFromTable (ReportModel model,BaseSection section,DataTable schemaTable) {
public void HeaderColumnsFromTable (BaseSection section,DataTable schemaTable) {
if (section == null) {
throw new ArgumentException("SharpReportManager:CreateColumnHeadersFromTable <section>");
}
using (AutoReport auto = new AutoReport()){
try {
ReportItemCollection headerCol = auto.AutoHeaderFromTable (model,section,schemaTable,false);
ReportItemCollection headerCol = auto.AutoHeaderFromTable (section,schemaTable,false);
AddItemsToSection (section,headerCol);
} catch (Exception) {
throw;
@ -216,6 +208,31 @@ namespace SharpReport{ @@ -216,6 +208,31 @@ namespace SharpReport{
}
}
///<summary>
/// Create ColumHeaders for Reports
/// </summary>
/// <param name="section">A ReportSection whre to build the Hedarlines</param>
///<param name="collection">A <see cref="ReportitemCollection"></see>
/// containing the basic informations</param>
public void HeaderColumnsFromReportItems (BaseSection section,ReportItemCollection collection) {
using (AutoReport auto = new AutoReport()){
try {
ReportItemCollection colDetail = auto.AutoHeaderFromReportItems (collection,section,false);
section.SuspendLayout();
AddItemsToSection (section,colDetail);
section.ResumeLayout();
} catch(Exception) {
throw;
}
}
}
#endregion
#region Create report from Query
/// <summary>
/// Create Columns from SchemaTable
/// </summary>
@ -223,14 +240,14 @@ namespace SharpReport{ @@ -223,14 +240,14 @@ namespace SharpReport{
///<param name="schemaTable">DataTable witch contaisn SchemaDefinitions</param>
///
public void CreateColumnsFromTable (ReportModel model,DataTable schemaTable) {
public void DataColumnsFromTable (ReportModel model,DataTable schemaTable) {
if ((model == null)||(schemaTable.Rows.Count == 0) ) {
throw new ArgumentException ("Invalid Arguments in SharpReportmanager:CreateColumnsFromFile");
}
using (AutoReport auto = new AutoReport()){
try {
ReportItemCollection colDetail = auto.AutoColumnsFromTable (model,
ReportItemCollection colDetail = auto.ReportItemsFromTable (model,
schemaTable);
BaseSection section = model.DetailSection;
section.SuspendLayout();
@ -244,49 +261,8 @@ namespace SharpReport{ @@ -244,49 +261,8 @@ namespace SharpReport{
#endregion
#region Create Reports from .Xsd Files
/*
/// <summary>
/// create Header from an .Xsd File
/// </summary>
/// <param name="model">a valid ReportModel</param>
/// <param name="section">Section in witch the header should be created</param>
/// <param name="fileName">File/Path to .Xsd file</param>
public void a_CreateColumnHeadersFromXsd (ReportModel model,BaseSection section,string fileName){
Debug.Assert (fileName.Length > 0,"CreateColumnsHeadersFromScheman : No valid FileName");
try {
DataSet ds = new DataSet();
ds.ReadXml (fileName);
using (AutoReport auto = new AutoReport()){
try {
// ReportItemCollection colDetail = auto.AutoHeaderFromSchema (model,section,ds,false);
// AddItemsToSection (section,colDetail);
} catch (Exception) {
throw;
}
}
} catch (Exception) {
throw;
}
}
*/
///<summary>
/// Create the ReportHeader
/// </summary>
/// <param name="section">A ReportSection whre to build the Hedarlines</param>
///<param name="collection">A reportItemcollection containing the basic informations</param>
public void CreateHeaderColumns (BaseSection section,ReportItemCollection collection) {
using (AutoReport auto = new AutoReport()){
try {
ReportItemCollection colDetail = auto.AutoHeaderColumns (collection);
section.SuspendLayout();
AddItemsToSection (section,colDetail);
section.ResumeLayout();
} catch(Exception) {
throw;
}
}
}
///<summary>
/// Create the DataColumns
/// </summary>
@ -294,7 +270,7 @@ namespace SharpReport{ @@ -294,7 +270,7 @@ namespace SharpReport{
/// <see cref="ReportDataItem"></see>
/// DataItems</param>
///<param name="collection">A reportItemcollection containing the basic informations</param>
public void CreateDataColumns (BaseSection section,ReportItemCollection collection) {
public void DataColumnsFromReportItems (BaseSection section,ReportItemCollection collection) {
using (AutoReport auto = new AutoReport()){
try {
ReportItemCollection colDetail = auto.AutoDataColumns (collection);
@ -488,6 +464,35 @@ namespace SharpReport{ @@ -488,6 +464,35 @@ namespace SharpReport{
}
#endregion
#region IDisposable
public new void Dispose(){
this.Dispose(true);
GC.SuppressFinalize(this);
}
~SharpReportManager(){
Dispose(false);
}
protected new void Dispose(bool disposing){
if (disposing) {
// Free other state (managed objects).
if (this.baseDesignerControl != null) {
this.baseDesignerControl.Dispose();
}
if (this.reportModel != null) {
this.reportModel.Dispose();
}
}
// Release unmanaged resources.
// Set large fields to null.
// Call Dispose on your base class.
base.Dispose();
}
#endregion
}
}

1
src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/FieldsExplorer.cs

@ -553,7 +553,6 @@ namespace SharpReportAddin { @@ -553,7 +553,6 @@ namespace SharpReportAddin {
public FieldsExplorer() {
WorkbenchSingleton.Workbench.ActiveWorkbenchWindowChanged += OnWindowChange;
LabelEdit = true;

60
src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportView.cs

@ -32,7 +32,7 @@ namespace SharpReportAddin{ @@ -32,7 +32,7 @@ namespace SharpReportAddin{
/// <summary>
/// Description of the view content
/// </summary>
public class SharpReportView : AbstractViewContent,IPrintable
public class SharpReportView : AbstractViewContent,IPrintable,IDisposable
{
private SharpReportManager reportManager = null;
@ -57,6 +57,11 @@ namespace SharpReportAddin{ @@ -57,6 +57,11 @@ namespace SharpReportAddin{
BuildToolBarItems();
PropertyPad.Grid.SelectedObject = designerControl.ReportModel.ReportSettings;
PropertyPad.Grid.Refresh();
//Activate the FieldsExplorer - Pad
PadDescriptor pad = WorkbenchSingleton.Workbench.GetPad(typeof(FieldsExplorer));
if (pad != null) {
pad.CreatePad();
}
} catch (Exception e) {
MessageService.ShowError(e,e.Message);
throw e;
@ -83,7 +88,6 @@ namespace SharpReportAddin{ @@ -83,7 +88,6 @@ namespace SharpReportAddin{
}
}
#endregion
@ -189,7 +193,7 @@ namespace SharpReportAddin{ @@ -189,7 +193,7 @@ namespace SharpReportAddin{
ctrl.ReportControl.AutoScroll = true;
ctrl.Dock = DockStyle.Fill;
ctrl.ReportControl.ObjectSelected += new SelectedEventHandler (OnObjectSelected);
ctrl.ReportControl.ObjectSelected +=new EventHandler <EventArgs>(OnObjectSelected);
ctrl.ReportControl.DesignViewChanged += new ItemDragDropEventHandler (OnItemDragDrop);
ctrl.DesignerDirty += new System.ComponentModel.PropertyChangedEventHandler (OnPropertyChanged);
@ -495,12 +499,12 @@ namespace SharpReportAddin{ @@ -495,12 +499,12 @@ namespace SharpReportAddin{
/// <param name="fileName">A valid Filename</param>
public override void Load(string fileName){
try {
designerControl.ReportControl.ObjectSelected -= new SelectedEventHandler (OnObjectSelected);
designerControl.ReportControl.ObjectSelected -= new EventHandler <EventArgs>(OnObjectSelected);
reportManager.LoadFromFile (fileName);
base.FileName = fileName;
designerControl.ReportModel.ReportSettings.FileName = fileName;
designerControl.ReportControl.ObjectSelected += new SelectedEventHandler (OnObjectSelected);
designerControl.ReportControl.ObjectSelected += new EventHandler <EventArgs>(OnObjectSelected);
PropertyPad.Grid.SelectedObject = designerControl.ReportModel.ReportSettings;
PropertyPad.Grid.Refresh();
this.designerControl.ReportModel.ReportSettings.AvailableFieldsCollection = reportManager.AvailableFieldsCollection;
@ -511,20 +515,7 @@ namespace SharpReportAddin{ @@ -511,20 +515,7 @@ namespace SharpReportAddin{
}
}
/// <summary>
/// Cleans up all used resources
/// </summary>
public override void Dispose(){
try {
PropertyPad.Grid.SelectedObject = null;
RemoveSideBarItem();
this.designerControl.Dispose();
this.reportManager = null;
} catch (Exception e){
MessageService.ShowError(e.Message);
return;
}
}
#endregion
@ -546,7 +537,38 @@ namespace SharpReportAddin{ @@ -546,7 +537,38 @@ namespace SharpReportAddin{
#endregion
#region IDisposable
public override void Dispose(){
PropertyPad.Grid.SelectedObject = null;
RemoveSideBarItem();
this.Dispose(true);
GC.SuppressFinalize(this);
}
~SharpReportView(){
Dispose(false);
}
protected void Dispose(bool disposing){
if (disposing) {
// Free other state (managed objects).
if (this.reportManager != null) {
this.reportManager.Dispose();
}
if (this.designerControl != null) {
this.designerControl.Dispose();
}
this.tabControl.Dispose();
}
// Release unmanaged resources.
// Set large fields to null.
// Call Dispose on your base class.
base.Dispose();
}
#endregion
}
}

17
src/AddIns/Misc/SharpReport/SharpReportCore/Collections/Collections.cs

@ -77,7 +77,8 @@ namespace SharpReportCore{ @@ -77,7 +77,8 @@ namespace SharpReportCore{
public IItemRenderer Find (string itemName) {
for (int i = 0;i < this.Count ; i ++) {
IItemRenderer col = this[i];
if (String.Compare(col.Name,itemName)== 0){
if (String.Compare(col.Name.ToLower(CultureInfo.CurrentCulture),
itemName.ToLower(CultureInfo.CurrentCulture))== 0){
return col;
}
}
@ -129,7 +130,6 @@ namespace SharpReportCore{ @@ -129,7 +130,6 @@ namespace SharpReportCore{
return col;
}
}
return null;
}
@ -143,7 +143,6 @@ namespace SharpReportCore{ @@ -143,7 +143,6 @@ namespace SharpReportCore{
public ColumnCollection(){
culture = CultureInfo.CurrentCulture;
}
@ -165,12 +164,12 @@ namespace SharpReportCore{ @@ -165,12 +164,12 @@ namespace SharpReportCore{
public CultureInfo Culture
{
get { return culture; }
set
{
if (value == null)
value = CultureInfo.CurrentCulture;
culture = value;
}
// set
// {
// if (value == null)
// value = CultureInfo.CurrentCulture;
// culture = value;
// }
}
}

4
src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/Comparer/GroupSeperator.cs

@ -25,14 +25,12 @@ namespace SharpReportCore { @@ -25,14 +25,12 @@ namespace SharpReportCore {
public class GroupSeperator : SharpReportCore.GroupComparer,IHierarchyData {
private string typeName = "GroupSeperator";
int groupLevel = 0;
// GroupSeperator parent = null;
int groupLevel;
IHierarchicalArray childs ;
public GroupSeperator(ColumnCollection owner, int listIndex, object[] values,int groupLevel):
base(owner,listIndex,values) {
this.groupLevel = groupLevel;
// this.parent = parent;
}

83
src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataManager.cs

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
// 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
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------
@ -14,8 +14,6 @@ using System.Collections; @@ -14,8 +14,6 @@ using System.Collections;
using System.ComponentModel;
using System.Globalization;
//using SharpReportCore;
/// <summary>
/// This Class is used as a wrapper around Databinding
/// </summary>
@ -23,10 +21,11 @@ using System.Globalization; @@ -23,10 +21,11 @@ using System.Globalization;
/// created by - Forstmeier Peter
/// created on - 16.10.2005 14:49:43
/// </remarks>
namespace SharpReportCore {
namespace SharpReportCore {
public class DataManager : IDataContainer,IEnumerator,IDisposable {
public class DataManager : IDataContainer,IEnumerator,IDisposable {
/*
/// <summary>
/// Operand to use when filtering...
/// </summary>
@ -36,6 +35,8 @@ namespace SharpReportCore { @@ -36,6 +35,8 @@ namespace SharpReportCore {
Includes,
NotIncludes,
}
*/
int currentRow = -1;
ReportSettings reportSettings;
@ -45,10 +46,10 @@ namespace SharpReportCore { @@ -45,10 +46,10 @@ namespace SharpReportCore {
IDbConnection connection;
IDataViewStrategy dataViewStrategy;
private ListChangedEventArgs resetList = new ListChangedEventArgs(ListChangedType.Reset,-1,-1);
public event ListChangedEventHandler ListChanged;
// private ListChangedEventArgs resetList = new ListChangedEventArgs(ListChangedType.Reset,-1,-1);
public event EventHandler <ListChangedEventArgs> ListChanged;
public event EventHandler <GroupChangedEventArgs> GroupChanged;
/// <summary>
@ -70,7 +71,7 @@ namespace SharpReportCore { @@ -70,7 +71,7 @@ namespace SharpReportCore {
this.dataViewStrategy = new TableStrategy((DataTable)this.dataSource,
reportSettings);
this.dataViewStrategy.ListChanged += new ListChangedEventHandler (NotifyListChanged);
this.dataViewStrategy.ListChanged += new EventHandler <ListChangedEventArgs> (NotifyListChanged);
} catch (Exception) {
throw;
}
@ -83,11 +84,10 @@ namespace SharpReportCore { @@ -83,11 +84,10 @@ namespace SharpReportCore {
CheckAndSetSource(dataSource);
this.dataViewStrategy = new TableStrategy((DataTable)this.dataSource,
reportSettings);
this.dataViewStrategy.ListChanged += new ListChangedEventHandler (NotifyListChanged);
this.dataViewStrategy.ListChanged += new EventHandler <ListChangedEventArgs> (NotifyListChanged);
} catch (Exception) {
throw ;
}
}
public DataManager(DataSet dataSource, ReportSettings reportSettings)
@ -102,8 +102,8 @@ namespace SharpReportCore { @@ -102,8 +102,8 @@ namespace SharpReportCore {
CheckAndSetReportSettings(reportSettings);
CheckAndSetSource(dataSource);
this.dataViewStrategy = new TableStrategy((DataTable)this.dataSource,
reportSettings);
this.dataViewStrategy.ListChanged += new ListChangedEventHandler (NotifyListChanged);
reportSettings);
this.dataViewStrategy.ListChanged += new EventHandler <ListChangedEventArgs> (NotifyListChanged);
} catch (Exception ) {
throw ;
}
@ -115,8 +115,8 @@ namespace SharpReportCore { @@ -115,8 +115,8 @@ namespace SharpReportCore {
CheckAndSetSource(dataSource);
this.dataViewStrategy = new CollectionStrategy ((IList)this.dataSource,
this.dataMember,
reportSettings);
this.dataViewStrategy.ListChanged += new ListChangedEventHandler (NotifyListChanged);
reportSettings);
this.dataViewStrategy.ListChanged += new EventHandler <ListChangedEventArgs> (NotifyListChanged);
} catch (Exception) {
throw;
}
@ -124,11 +124,11 @@ namespace SharpReportCore { @@ -124,11 +124,11 @@ namespace SharpReportCore {
#endregion
void CheckAndSetReportSettings(ReportSettings settings) {
if (settings == null) {
throw new ArgumentNullException("DataManager:ReportSettings");
throw new ArgumentNullException("settings");
}
try {
if (settings.DataModel != GlobalEnums.enmPushPullModel.PushData) {
@ -150,38 +150,39 @@ namespace SharpReportCore { @@ -150,38 +150,39 @@ namespace SharpReportCore {
}
if (source is IList ||source is IListSource || source is IBindingList) {
//DataTable
this.dataSource = source;
if (source is DataTable) {
DataTable tbl = source as DataTable;
this.dataMember = tbl.TableName;
DataTable table = this.dataSource as DataTable;
if (table != null) {
this.dataMember = table.TableName;
return;
}
//DataSet
if (source is DataSet) {
DataSet ds = source as DataSet;
if (ds.Tables.Count > 0) {
DataSet dataSet = this.dataSource as DataSet;
if (dataSet != null) {
if (dataSet.Tables.Count > 0) {
DataTable tbl;
if (String.IsNullOrEmpty(this.dataMember)){
tbl = ds.Tables[0];
tbl = dataSet.Tables[0];
} else {
DataTableCollection tcol = ds.Tables;
DataTableCollection tcol = dataSet.Tables;
if (tcol.Contains(this.dataMember)) {
tbl = tcol[this.dataMember];
this.dataSource = tbl;
}
}
} else {
}else {
throw new ArgumentException("DataManager:No Tables in DataSet");
}
return;
}
//IList
if (source is IList) {
IList list = source as IList;
IList list = source as IList;
if (list != null) {
this.dataSource = list;
this.dataMember = source.ToString();
if (list.Count == 0) {
@ -189,7 +190,18 @@ namespace SharpReportCore { @@ -189,7 +190,18 @@ namespace SharpReportCore {
throw new ArgumentException("No empty IList allowed");
}
return;
}
// if (source is IList) {
// IList list = source as IList;
// this.dataSource = list;
// this.dataMember = source.ToString();
// if (list.Count == 0) {
// //System.Console.WriteLine("List mit {0} Rows",list.Count);
// throw new ArgumentException("No empty IList allowed");
// }
// return;
// }
} else {
throw new ArgumentException ("DataManager:Wrong DataSource");
}
@ -225,7 +237,6 @@ namespace SharpReportCore { @@ -225,7 +237,6 @@ namespace SharpReportCore {
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;
} catch (Exception) {
throw;
@ -237,7 +248,7 @@ namespace SharpReportCore { @@ -237,7 +248,7 @@ namespace SharpReportCore {
}
private void CheckForAndBuildParams (OleDbCommand cmd,ReportSettings reportSettings) {
private static void CheckForAndBuildParams (OleDbCommand cmd,ReportSettings reportSettings) {
if (reportSettings.SqlParametersCollection != null && reportSettings.SqlParametersCollection.Count > 0) {
SqlParameter rpPar;
OleDbParameter oleDBPar = null;
@ -267,7 +278,7 @@ namespace SharpReportCore { @@ -267,7 +278,7 @@ namespace SharpReportCore {
if (this.dataViewStrategy.AvailableFields.Count > 0) {
foreach (SortColumn col in this.reportSettings.SortColumnCollection) {
string colName = col.ColumnName;
AbstractColumn c = this.dataViewStrategy.AvailableFields.Find (colName);
AbstractColumn c = this.dataViewStrategy.AvailableFields.Find (colName);
if (c == null) {
string str = String.Format (CultureInfo.CurrentCulture,
"<{0}> is not a member of <{1}>",colName,this.reportSettings.ReportName);
@ -349,7 +360,7 @@ namespace SharpReportCore { @@ -349,7 +360,7 @@ namespace SharpReportCore {
return hierarchicalList;
}
}
*/
*/
#region SharpReportCore.IDataContainer interface implementation
@ -391,11 +402,9 @@ namespace SharpReportCore { @@ -391,11 +402,9 @@ namespace SharpReportCore {
this.dataViewStrategy.Bind();
this.dataViewStrategy.GroupChanged += new EventHandler <GroupChangedEventArgs>(NotifyGroupChange);
CheckReportColumns();
// this.NotifyListChanged (this,this.resetList);
return true;
}
//ToDo Remove this
public void Skip() {
this.dataViewStrategy.CurrentRow ++;
}
@ -406,7 +415,7 @@ namespace SharpReportCore { @@ -406,7 +415,7 @@ namespace SharpReportCore {
foreach (IItemRenderer item in collection) {
this.dataViewStrategy.Fill(item);
}
} catch (Exception) {
} catch (Exception) {
}
}

15
src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListHandling/SharpArrayList.cs

@ -19,9 +19,9 @@ namespace SharpReportCore @@ -19,9 +19,9 @@ namespace SharpReportCore
bool allowNew = true;
bool allowEdit = true;
bool allowRemove = true;
bool supportsSearching = false;
bool supportsSorting = false;
bool isSorted = false;
bool supportsSearching ;
bool supportsSorting ;
bool isSorted;
private ListChangedEventArgs resetEvent = new ListChangedEventArgs(ListChangedType.Reset, -1);
@ -160,18 +160,27 @@ namespace SharpReportCore @@ -160,18 +160,27 @@ namespace SharpReportCore
get {
return this.supportsSearching;
}
set {
this.supportsSearching = value;
}
}
public bool SupportsSorting {
get {
return this.supportsSorting;
}
set {
this.supportsSorting = value;
}
}
public bool IsSorted {
get {
return this.isSorted;
}
set {
this.isSorted = value;
}
}
public System.ComponentModel.PropertyDescriptor SortProperty {

17
src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/BaseListStrategy.cs

@ -12,6 +12,7 @@ using System; @@ -12,6 +12,7 @@ using System;
using System.Globalization;
using System.ComponentModel;
using System.Collections;
using System.Collections.Generic;
using SharpReportCore;
/// <summary>
@ -36,14 +37,14 @@ namespace SharpReportCore { @@ -36,14 +37,14 @@ namespace SharpReportCore {
private ListChangedEventArgs resetList = new ListChangedEventArgs(ListChangedType.Reset,-1,-1);
public event ListChangedEventHandler ListChanged;
public event EventHandler <ListChangedEventArgs> ListChanged;
public event EventHandler <GroupChangedEventArgs> GroupChanged;
#region Constructor
protected BaseListStrategy(ReportSettings reportSettings) {
this.reportSettings = reportSettings;
this.indexList = new SharpArrayList(typeof(BaseComparer),"IndexList");
this.indexList = new SharpArrayList(typeof(BaseComparer),"IndexList");
}
#endregion
@ -65,15 +66,14 @@ namespace SharpReportCore { @@ -65,15 +66,14 @@ namespace SharpReportCore {
#endregion
protected SharpArrayList IndexList {
public SharpArrayList IndexList {
get {
return indexList;
}
set {
indexList = value;
}
}
public ReportSettings ReportSettings {
get {
return reportSettings;
@ -173,6 +173,7 @@ namespace SharpReportCore { @@ -173,6 +173,7 @@ namespace SharpReportCore {
}
protected virtual void Group() {
if (this.indexList != null) {
this.BuildHierarchicalList (this.indexList);
this.isGrouped = true;
@ -180,6 +181,7 @@ namespace SharpReportCore { @@ -180,6 +181,7 @@ namespace SharpReportCore {
} else {
throw new SharpReportException ("BaseListStrategy:Group Sorry, no IndexList");
}
}
@ -296,9 +298,10 @@ namespace SharpReportCore { @@ -296,9 +298,10 @@ namespace SharpReportCore {
}
public virtual void Fill(IItemRenderer item) {
}
#endregion
}
}

18
src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/TableStrategy.cs

@ -212,19 +212,22 @@ namespace SharpReportCore { @@ -212,19 +212,22 @@ namespace SharpReportCore {
if (base.ReportSettings.GroupColumnsCollection != null) {
if (base.ReportSettings.GroupColumnsCollection.Count > 0) {
groupedArray = this.BuildGroupIndex (base.ReportSettings.GroupColumnsCollection);
System.Console.WriteLine("\t1");
} else {
groupedArray = BuildPlainIndex (base.ReportSettings.GroupColumnsCollection);
}
}
base.IndexList.Clear();
base.IndexList.Clear();
base.IndexList.AddRange (InsertGroupRows(groupedArray));
if (base.IndexList == null){
throw new NotSupportedException("Sortieren für die Liste nicht unterstützt.");
}
} catch (Exception) {
} catch (Exception e) {
System.Console.WriteLine("BuildGroup {0}",e.Message);
throw;
}
}
@ -236,13 +239,14 @@ namespace SharpReportCore { @@ -236,13 +239,14 @@ namespace SharpReportCore {
}
try {
this.BuildGroup();
base.Group();
this.BuildGroup();
base.Group();
if (this.IsGrouped == false) {
throw new SharpReportException("TableStratregy:Group Error in grouping");
}
} catch (Exception) {
} catch (Exception e) {
System.Console.WriteLine("Group {0}",e.Message);
base.IsGrouped = false;
base.IsSorted = false;
throw;

4
src/AddIns/Misc/SharpReport/SharpReportCore/Interfaces/IDataViewStrategy.cs

@ -78,8 +78,8 @@ namespace SharpReportCore{ @@ -78,8 +78,8 @@ namespace SharpReportCore{
bool IsGrouped {
get;
}
event ListChangedEventHandler ListChanged;
// event ListChangedEventHandler ListChanged;
event EventHandler <ListChangedEventArgs> ListChanged;
/// <summary>
/// Fired each tim the grouping will change, this means theGroupLevel changes up or down
/// </summary>

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

@ -166,10 +166,10 @@ namespace SharpReportCore { @@ -166,10 +166,10 @@ namespace SharpReportCore {
}
protected int RenderSection (BaseSection section,ReportPageEventArgs e) {
protected int RenderSection (BaseSection section,ReportPageEventArgs rpea) {
Point drawPoint = new Point(0,0);
if (section.Visible){
section.Render (e);
section.Render (rpea);
foreach (BaseReportItem rItem in section.Items) {
rItem.SuspendLayout();
@ -185,10 +185,10 @@ namespace SharpReportCore { @@ -185,10 +185,10 @@ namespace SharpReportCore {
rItem.FormatOutput -= new EventHandler<FormatOutputEventArgs> (FormatBaseReportItem);
rItem.FormatOutput += new EventHandler<FormatOutputEventArgs> (FormatBaseReportItem);
rItem.Render(e);
rItem.Render(rpea);
drawPoint.Y = section.SectionOffset + section.Size.Height;
e.LocationAfterDraw = new PointF (e.LocationAfterDraw.X,section.SectionOffset + section.Size.Height);
rpea.LocationAfterDraw = new PointF (rpea.LocationAfterDraw.X,section.SectionOffset + section.Size.Height);
rItem.ResumeLayout();
}
if ((section.CanGrow == false)&& (section.CanShrink == false)) {

3
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Formatter/DefaultFormatter.cs

@ -43,6 +43,9 @@ namespace SharpReportCore{ @@ -43,6 +43,9 @@ namespace SharpReportCore{
///<param name="item">A ReportDataItem</param>
///
public string FormatItem (BaseDataItem item) {
if (item == null) {
throw new ArgumentNullException("item");
}
string retValue = String.Empty;
switch (item.DataType) {

10
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseShape.cs

@ -38,25 +38,25 @@ namespace SharpReportCore { @@ -38,25 +38,25 @@ namespace SharpReportCore {
}
public virtual void DrawShape (Graphics g,BaseLine baseLine,RectangleF rectangle) {
public virtual void DrawShape (Graphics graphics,BaseLine baseLine,RectangleF rectangle) {
}
public virtual void DrawShape (Graphics g,Pen pen,RectangleF rectangle) {
public virtual void DrawShape (Graphics graphics,Pen pen,RectangleF rectangle) {
}
public virtual void FillShape (Graphics g, Brush brush,RectangleF rectangle) {
public virtual void FillShape (Graphics graphics, Brush brush,RectangleF rectangle) {
}
public virtual void FillShape (Graphics g,AbstractFillPattern fillPattern,RectangleF rectangle) {
public virtual void FillShape (Graphics graphics,AbstractFillPattern fillPattern,RectangleF rectangle) {
}
public virtual GraphicsPath CreatePath (RectangleF rectangle) {
public virtual GraphicsPath CreatePath (RectangleF rectangleF) {
return null;
}
}

8
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/Border.cs

@ -43,20 +43,20 @@ namespace SharpReportCore { @@ -43,20 +43,20 @@ namespace SharpReportCore {
this.baseLine = baseLine;
}
public void DrawBorder (Graphics g, RectangleF rectangle) {
public void DrawBorder (Graphics graphics, RectangleF rectangle) {
using (Pen p = new Pen(baseLine.Color,baseLine.Thickness)) {
p.DashStyle = baseLine.DashStyle;
g.DrawRectangle (p,rectangle.Left,
graphics.DrawRectangle (p,rectangle.Left,
rectangle.Top,
rectangle.Width,
rectangle.Height);
}
}
public void DrawBorder (Graphics g, Rectangle rectangle ) {
public void DrawBorder (Graphics graphics, Rectangle rectangle ) {
using (Pen p = new Pen(baseLine.Color,baseLine.Thickness)) {
p.DashStyle = baseLine.DashStyle;
g.DrawRectangle (p,rectangle);
graphics.DrawRectangle (p,rectangle);
}
}
}

5
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs

@ -105,7 +105,6 @@ namespace SharpReportCore { @@ -105,7 +105,6 @@ namespace SharpReportCore {
section.Size.Height);
DebugRectangle (e,detailRect);
float offset = 0F;
// no loop if there is no data
if (! dataManager.HasMoreData ) {
e.PrintPageEventArgs.HasMorePages = false;
@ -120,8 +119,8 @@ namespace SharpReportCore { @@ -120,8 +119,8 @@ namespace SharpReportCore {
if (dataManager.HasMoreData) {
dataManager.FetchData (base.CurrentSection.Items);
offset = base.RenderSection (section,e);
// offset = base.RenderSection (section,e);
base.RenderSection (section,e);
section.SectionOffset = section.SectionOffset + section.Size.Height + 2 * base.Gap;
base.FitSectionToItems (base.CurrentSection,e);

4
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/TextDrawer.cs

@ -38,8 +38,8 @@ namespace SharpReportCore { @@ -38,8 +38,8 @@ namespace SharpReportCore {
}
public void DrawString(Graphics g,string text,Font font,Brush brush,RectangleF rectangle,StringFormat stringFormat) {
g.DrawString(text,
public void DrawString(Graphics graphics,string text,Font font,Brush brush,RectangleF rectangle,StringFormat stringFormat) {
graphics.DrawString(text,
font,
brush,
rectangle,

21
src/AddIns/Misc/SharpReport/SharpReportCore/ReportModel.cs

@ -126,9 +126,26 @@ namespace SharpReportCore { @@ -126,9 +126,26 @@ namespace SharpReportCore {
#region IDispoable
public void Dispose(){
if (this.reportSettings != null) {
this.reportSettings.Dispose();
this.Dispose(true);
GC.SuppressFinalize(this);
}
~ReportModel()
{
Dispose(false);
}
protected virtual void Dispose(bool disposing){
if (disposing) {
// Free other state (managed objects).
if (this.reportSettings != null) {
this.reportSettings.Dispose();
this.reportSettings = null;
}
}
// Free your own state (unmanaged objects).
// Set large fields to null.
}
#endregion
}

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

@ -650,32 +650,32 @@ namespace SharpReportCore{ @@ -650,32 +650,32 @@ namespace SharpReportCore{
}
}
}
/*
[Browsable(true), Category("Output Settings")]
public System.Drawing.Printing.Margins DefaultMargins {
get {
return defaultMargins;
}
set {
if (defaultMargins != value) {
defaultMargins = value;
PageSettings.Margins = defaultMargins;
this.FirePropertyChanged();
}
}
}
*/
#endregion
#region IDisposable
public void Dispose(){
if (this.defaultFont != null) {
this.defaultFont.Dispose();
}
this.Dispose(true);
GC.SuppressFinalize(this);
}
~ReportSettings()
{
Dispose(false);
}
protected virtual void Dispose(bool disposing){
if (disposing) {
// Free other state (managed objects).
if (this.defaultFont != null) {
this.defaultFont.Dispose();
}
}
// Release unmanaged resources.
// Set large fields to null.
// Call Dispose on your base class.
}
#endregion
}

40
src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs

@ -57,7 +57,7 @@ namespace SharpReportCore { @@ -57,7 +57,7 @@ namespace SharpReportCore {
private bool CheckReportParameters (ReportModel model,ReportParameters reportParameters) {
if (model.ReportSettings.ReportType != GlobalEnums.enmReportType.FormSheet) {
if (this.connectionObject == null) {
if (model.ReportSettings.ConnectionString != "") {
this.connectionObject = new ConnectionObject (model.ReportSettings.ConnectionString,"","");
}
@ -91,7 +91,7 @@ namespace SharpReportCore { @@ -91,7 +91,7 @@ namespace SharpReportCore {
}
void SetSqlParameters (ReportModel model,AbstractParametersCollection sqlParams) {
if ((sqlParams == null)||(sqlParams.Count == 0)) {
return;
@ -100,6 +100,8 @@ namespace SharpReportCore { @@ -100,6 +100,8 @@ namespace SharpReportCore {
model.ReportSettings.SqlParametersCollection.AddRange(sqlParams);
}
private static void SetCustomSorting (ReportModel model,ColumnCollection sortParams) {
if ((sortParams == null)||(sortParams.Count == 0)) {
return;
@ -130,10 +132,7 @@ namespace SharpReportCore { @@ -130,10 +132,7 @@ namespace SharpReportCore {
}
private DataManager SetupDataContainer (ReportSettings settings) {
System.Console.WriteLine("SetupContainer");
System.Console.WriteLine("after check");
if (settings.ReportType == GlobalEnums.enmReportType.DataReport) {
if (settings.CommandText != null) {
try {
@ -143,7 +142,6 @@ namespace SharpReportCore { @@ -143,7 +142,6 @@ namespace SharpReportCore {
DataManager container = new DataManager(this.connectionObject,
settings);
System.Console.WriteLine("\t No of Records to print {0}",container.Count);
if (container.DataBind() == true) {
return container;
} else {
@ -239,7 +237,7 @@ namespace SharpReportCore { @@ -239,7 +237,7 @@ namespace SharpReportCore {
AbstractRenderer abstr = null;
DataManager dataManager = new DataManager (dataTable,model.ReportSettings);
System.Console.WriteLine("\tDataManager ok = {0}",(dataManager != null));
if (dataManager != null) {
dataManager.DataBind();
if (dataManager.DataSource != null) {
@ -541,14 +539,32 @@ namespace SharpReportCore { @@ -541,14 +539,32 @@ namespace SharpReportCore {
}
#endregion
#region IDisposable
public void Dispose(){
if (this.connectionObject == null) {
this.connectionObject.Dispose();
}
if (this.previewControl != null) {
this.previewControl.Dispose();
this.Dispose(true);
GC.SuppressFinalize(this);
}
~SharpReportEngine(){
Dispose(false);
}
protected virtual void Dispose(bool disposing){
if (disposing) {
// Free other state (managed objects).
if (this.connectionObject != null) {
this.connectionObject.Dispose();
}
if (this.previewControl != null) {
this.previewControl.Dispose();
}
}
// Release unmanaged resources.
// Set large fields to null.
// Call Dispose on your base class.
}
#endregion
}

23
src/AddIns/Misc/SharpReport/SharpReportWizard/GeneratorCommands.cs

@ -62,9 +62,10 @@ namespace ReportGenerator{ @@ -62,9 +62,10 @@ namespace ReportGenerator{
try {
gen.FillReportModel (reportModel);
DoCreate(reportModel);
} catch (Exception e) {
MessageService.ShowError (e,e.Message);
return;
} catch (Exception) {
// MessageService.ShowError (e,e.Message);
// return;
throw;
}
} else {
throw new SharpReportException("Chancel");
@ -107,8 +108,8 @@ namespace ReportGenerator{ @@ -107,8 +108,8 @@ namespace ReportGenerator{
} else {
throw new NullReferenceException ("GeneratePullDataReport");
}
} catch (Exception e) {
throw e;
} catch (Exception) {
throw;
}
}
@ -125,22 +126,22 @@ namespace ReportGenerator{ @@ -125,22 +126,22 @@ namespace ReportGenerator{
} else {
throw new NullReferenceException ("GeneratePullDataReport");
}
} catch (Exception e) {
throw e;
} catch (Exception) {
throw;
}
}
void GenerateFormSheet (ReportModel model) {
private static void GenerateFormSheet (ReportModel model) {
if (model.ReportSettings.DataModel != GlobalEnums.enmPushPullModel.FormSheet) {
throw new ArgumentException ("Wrong DataModel in GenerateFormSheet");
throw new ArgumentNullException ("model");
}
try {
model.ReportSettings.ReportType = GlobalEnums.enmReportType.FormSheet;
} catch (Exception e) {
throw e;
} catch (Exception) {
throw;
}
}
}

55
src/AddIns/Misc/SharpReport/SharpReportWizard/Generators/AbstractReportGenerator.cs

@ -12,7 +12,7 @@ using System; @@ -12,7 +12,7 @@ using System;
using System.Drawing;
using System.Data;
using System.Data.OleDb;
using System.Windows.Forms;
using System.Globalization;
using ICSharpCode.Core;
@ -53,15 +53,33 @@ namespace ReportGenerator { @@ -53,15 +53,33 @@ namespace ReportGenerator {
#region ReportGenerator.IReportGenerator interface implementation
public virtual void GenerateReport() {
throw new NotImplementedException("must be overriden");
if (this.reportModel == null) {
throw new NullReferenceException("ReportModel");
}
BuildStandartSections();
manager.CreatePageHeader (reportModel);
manager.CreatePageNumber(reportModel);
}
#endregion
//TODO Change these function to using SharpQuery
protected DataTable GenerateFieldsTable(ReportModel reportModel) {
/*
protected ColumnCollection AvailableColumnsFromTable (DataTable table) {
if (table == null) {
throw new ArgumentNullException("table");
}
ColumnCollection collection = new ColumnCollection();
AbstractColumn abstr;
foreach (DataRow row in table.Rows) {
abstr = new AbstractColumn();
abstr.ColumnName = Convert.ToString(row["ColumnName"],CultureInfo.InvariantCulture);
collection.Add (abstr);
}
return collection;
}
*/
protected DataTable GenerateFieldsTable(ReportModel reportModel) {
if (reportModel == null) {
throw new ArgumentNullException("reportModel");
}
@ -71,7 +89,7 @@ namespace ReportGenerator { @@ -71,7 +89,7 @@ namespace ReportGenerator {
OleDbConnection connection = null;
OleDbCommand command = null;
try {
connection = new OleDbConnection(reportModel.ReportSettings.ConnectionString);
connection.Open();
@ -91,7 +109,7 @@ namespace ReportGenerator { @@ -91,7 +109,7 @@ namespace ReportGenerator {
SqlParameter rpPar;
for (int i = 0;i < rpc ;i++) {
rpPar = (SqlParameter)reportModel.ReportSettings.SqlParametersCollection[i];
System.Console.WriteLine("{0} {1} {2}",rpPar.ParameterName,rpPar.DataType,rpPar.DefaultValue);
// System.Console.WriteLine("{0} {1} {2}",rpPar.ParameterName,rpPar.DataType,rpPar.DefaultValue);
if (rpPar.DataType != System.Data.DbType.Binary) {
@ -99,7 +117,7 @@ namespace ReportGenerator { @@ -99,7 +117,7 @@ namespace ReportGenerator {
rpPar.DataType);
oleDBPar.Value = rpPar.DefaultValue;
} else {
System.Console.WriteLine("binary");
// System.Console.WriteLine("binary");
oleDBPar = new OleDbParameter(rpPar.ParameterName,
System.Data.DbType.Binary);
}
@ -108,8 +126,8 @@ namespace ReportGenerator { @@ -108,8 +126,8 @@ namespace ReportGenerator {
}
}
} catch (Exception e) {
throw e;
} catch (Exception) {
throw;
}
OleDbDataReader reader = null;
DataTable schemaTable = null;
@ -141,6 +159,19 @@ namespace ReportGenerator { @@ -141,6 +159,19 @@ namespace ReportGenerator {
}
}
protected void AdjustAll () {
AdjustNames(reportModel);
}
private static void AdjustNames (ReportModel model) {
NameService nameService = new NameService();
foreach (BaseSection section in model.SectionCollection) {
foreach (IItemRenderer item in section.Items) {
item.Name = nameService.CreateName(section.Items,item.Name);
}
}
}
#region Properties
public Properties Customizer {

30
src/AddIns/Misc/SharpReport/SharpReportWizard/Generators/GeneratePullDataReport.cs

@ -7,14 +7,11 @@ @@ -7,14 +7,11 @@
// the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------
using System;
using System.Data;
using System;
using System.Data;
using ICSharpCode.Core;
using SharpReportCore;
using ICSharpCode.Core;
using SharpReportCore;
/// <summary>
/// This class is used to AutoGenerate a (PullData) Report
/// (Reports, that grap the Data by themselve)
@ -23,7 +20,8 @@ @@ -23,7 +20,8 @@
/// created by - Forstmeier Peter
/// created on - 07.09.2005 13:23:14
/// </remarks>
using System.Windows.Forms;
namespace ReportGenerator {
public class GeneratePullDataReport : AbstractReportGenerator {
@ -57,22 +55,18 @@ namespace ReportGenerator { @@ -57,22 +55,18 @@ namespace ReportGenerator {
// just run
tableFields = base.GenerateFieldsTable (base.ReportModel);
}
BuildStandartSections();
base.Manager.CreatePageHeader (base.ReportModel);
base.Manager.CreateColumnHeadersFromTable(base.ReportModel,
base.ReportModel.PageHeader,
base.GenerateReport();
base.Manager.HeaderColumnsFromTable(base.ReportModel.PageHeader,
tableFields);
base.Manager.CreateColumnsFromTable (base.ReportModel,
base.Manager.DataColumnsFromTable (base.ReportModel,
tableFields);
base.Manager.CreatePageNumber(base.ReportModel);
using (TableLayout layout = new TableLayout(base.ReportModel)){
layout.BuildLayout();
}
base.Manager.AdjustNames(base.ReportModel);
base.AdjustAll();
} catch (Exception e) {
throw e;
}

18
src/AddIns/Misc/SharpReport/SharpReportWizard/Generators/GeneratePushDataReport.cs

@ -14,7 +14,7 @@ using System.Data; @@ -14,7 +14,7 @@ using System.Data;
using ICSharpCode.Core;
using SharpReportCore;
using System.Windows.Forms;
/// <summary>
/// This class is used to generate PushDataReports
/// (Reports, that are feed with an DataSet etc)
@ -41,17 +41,21 @@ namespace ReportGenerator { @@ -41,17 +41,21 @@ namespace ReportGenerator {
public override void GenerateReport() {
base.ReportModel.ReportSettings.ReportType = GlobalEnums.enmReportType.DataReport;
BuildStandartSections();
base.Manager.CreatePageHeader (base.ReportModel);
ReportItemCollection col = (ReportItemCollection)base.Customizer.Get ("ReportItemCollection");
// MessageBox.Show (col.Count.ToString());
base.GenerateReport();
base.Manager.HeaderColumnsFromReportItems (base.ReportModel.PageHeader,col);
base.Manager.DataColumnsFromReportItems (base.ReportModel.DetailSection,col);
base.Manager.CreateHeaderColumns (base.ReportModel.PageHeader,col);
base.Manager.CreateDataColumns (base.ReportModel.DetailSection,col);
base.Manager.CreatePageNumber(base.ReportModel);
using (TableLayout layout = new TableLayout(base.ReportModel)){
layout.BuildLayout();
}
base.Manager.AdjustNames(base.ReportModel);
base.AdjustAll();
}
}
}

4
src/AddIns/Misc/SharpReport/SharpReportWizard/ReportGenerator.cs

@ -59,7 +59,9 @@ namespace ReportGenerator { @@ -59,7 +59,9 @@ namespace ReportGenerator {
}
public ReportModel FillReportModel (ReportModel model) {
if (model == null) {
throw new ArgumentNullException("model");
}
model.ReportSettings.ReportName = this.reportName;
model.ReportSettings.FileName = this.path + this.fileName;

5
src/AddIns/Misc/SharpReport/SharpReportWizard/ReportLayouts/AbstractLayout.cs

@ -32,10 +32,13 @@ namespace ReportGenerator { @@ -32,10 +32,13 @@ namespace ReportGenerator {
this.reportModel = reportModel;
}
protected void FormatSingleEntry (IItemRenderer item,
protected void FormatSingleEntry (IItemRenderer item,
int itemWidth,
Point location,
Font font) {
if (item == null) {
throw new ArgumentNullException("item");
}
item.Size = new Size (itemWidth,item.Size.Height + GlobalValues.EnlargeControl);
item.Location = new Point (location.X,location.Y);
item.Font = font;

6
src/AddIns/Misc/SharpReport/SharpReportWizard/WizardPanels/PullModelPanel.cs

@ -207,7 +207,7 @@ namespace ReportGenerator @@ -207,7 +207,7 @@ namespace ReportGenerator
this.txtSqlString.Enabled = true;
if (this.firstDrag) {
this.txtSqlString.Text = "";
this.txtSqlString.Text = String.Empty;
}
} else {
@ -228,7 +228,7 @@ namespace ReportGenerator @@ -228,7 +228,7 @@ namespace ReportGenerator
///<param name="SharpQueryNodeColumn">a ColumnNode</param>
/// <returns>a valid ColumnName</returns>
///
private string MakeProperColumnName(SharpQueryNodeColumn node) {
private static string MakeProperColumnName(SharpQueryNodeColumn node) {
string colName;
if (node != null) {
if (node.SchemaClass.NormalizedName.IndexOf("-") > -1 ){
@ -244,7 +244,7 @@ namespace ReportGenerator @@ -244,7 +244,7 @@ namespace ReportGenerator
}
// check witch type of node we dragg
private enmNodeType CheckCurrentNode (ISharpQueryNode node) {
private static enmNodeType CheckCurrentNode (ISharpQueryNode node) {
enmNodeType enm;
if (node == null) {
enm = enmNodeType.nodeError;

23
src/AddIns/Misc/SharpReport/SharpReportWizard/WizardPanels/PushModelPanel.cs

@ -8,10 +8,11 @@ @@ -8,10 +8,11 @@
*/
using System;
using System.Data;
using System.Globalization;
using System.ComponentModel;
using System.Collections;
using System.Data;
using System.Windows.Forms;
using ICSharpCode.Core;
@ -71,16 +72,16 @@ namespace ReportGenerator @@ -71,16 +72,16 @@ namespace ReportGenerator
#region ListBox
void FillListBox (string fileName) {
DataSet ds = new DataSet();
ds.Locale = CultureInfo.CurrentCulture;
ds.ReadXml (fileName);
AutoReport auto = new AutoReport ();
ReportModel model = generator.FillReportModel (new ReportModel());
colDetail = auto.AutoColumnsFromSchema(model,ds);
if (colDetail == null) {
throw new NullReferenceException("PushModelpanel:ColDetail");
} else {
using (AutoReport auto = new AutoReport()){
ReportModel model = generator.FillReportModel (new ReportModel());
colDetail = auto.ReportItemsFromSchema(model,ds);
foreach (ReportDataItem item in colDetail) {
this.checkedListBox.Items.Add (item.MappingName,CheckState.Checked);
if (colDetail != null) {
foreach (ReportDataItem item in colDetail) {
this.checkedListBox.Items.Add (item.MappingName,CheckState.Checked);
}
}
}
base.EnableNext = true;
@ -112,7 +113,7 @@ namespace ReportGenerator @@ -112,7 +113,7 @@ namespace ReportGenerator
itemCol.Add(item);
}
}
//
customizer.Set ("ReportItemCollection",itemCol);
}
return true;

14
src/AddIns/Misc/SharpReport/SharpReportWizard/WizardPanels/ResultPanel.cs

@ -8,12 +8,14 @@ @@ -8,12 +8,14 @@
*/
using System;
using System.Globalization;
using System.Data;
using System.Data.OleDb;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.Xml;
using System.Data;
using System.Data.OleDb;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
@ -59,12 +61,12 @@ namespace ReportGenerator{ @@ -59,12 +61,12 @@ namespace ReportGenerator{
#region Fill data
private void FillGrid() {
System.Console.WriteLine("FillGrid");
this.grdQuery.DataSource = null;
this.txtSqlString.Text = null;
ReportModel model = generator.FillReportModel(new ReportModel());
resultDataSet = new DataSet();
resultDataSet.Locale = CultureInfo.CurrentCulture;
this.txtSqlString.Text = model.ReportSettings.CommandText;
if (model.ReportSettings.CommandType == CommandType.StoredProcedure){
@ -110,8 +112,8 @@ namespace ReportGenerator{ @@ -110,8 +112,8 @@ namespace ReportGenerator{
try {
// Stored Proc without Parameters
resultDataSet = (DataSet) proc.Execute(0,proc.GetSchemaParameters());
} catch (Exception e) {
throw e;
} catch (Exception) {
throw;
}
}
@ -142,7 +144,7 @@ namespace ReportGenerator{ @@ -142,7 +144,7 @@ namespace ReportGenerator{
}
DataSet BuildFromSqlString(ReportSettings settings) {
private static DataSet BuildFromSqlString(ReportSettings settings) {
OLEDBConnectionWrapper con = null;
DataSet ds = null;
if (settings.CommandText.IndexOf("?") > 0) {

Loading…
Cancel
Save