Browse Source

Modify references, change designer to work with landscape reports

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/reports@5867 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Peter Forstmeier 15 years ago
parent
commit
44983298ec
  1. 31
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/Designer/RootDesigner/ReportItemsContainer.cs
  2. 80
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/Designer/RootDesigner/ReportRootDesigner.cs
  3. 42
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/DesignerBinding/InternalReportLoader.cs
  4. 47
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportDesignerView.cs
  5. 5
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/Generators/AbstractReportGenerator.cs
  6. 162
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/ReportStructure.cs
  7. 73
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/WizardPanels/BaseSettingsPanel.cs
  8. 2
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/ICSharpCode.Reports.Core.csproj
  9. 2
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Globals/GlobalValues.cs
  10. 218
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/ReportSettings.cs

31
src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/Designer/RootDesigner/ReportItemsContainer.cs

@ -20,8 +20,7 @@ namespace ICSharpCode.Reports.Addin
/// </summary> /// </summary>
public class RootReportModel:RootDesignedComponent public class RootReportModel:RootDesignedComponent
{ {
Margins pageMargin;
Rectangle page;
bool showDebugFrame; bool showDebugFrame;
[System.ComponentModel.EditorBrowsableAttribute()] [System.ComponentModel.EditorBrowsableAttribute()]
@ -50,34 +49,32 @@ namespace ICSharpCode.Reports.Addin
private void PrintMargin( Graphics e) private void PrintMargin( Graphics e)
{ {
string s = String.Format(System.Globalization.CultureInfo.CurrentCulture,"[Bounds : {0}]",this.pageMargin); string s = String.Format(System.Globalization.CultureInfo.CurrentCulture,
"[Size : {0}] [Landscape : {1}] [Bounds : {2}]",
this.Page,this.Landscape,this.PageMargin);
using (Font f = GlobalsDesigner.DesignerFont){ using (Font f = GlobalsDesigner.DesignerFont){
SizeF size = e.MeasureString(s,f); SizeF size = e.MeasureString(s,f);
e.DrawString(s,f, e.DrawString(s,f,
new SolidBrush(Color.LightGray), new SolidBrush(Color.LightGray),
new Rectangle(this.pageMargin.Left + 100, new Rectangle(this.PageMargin.Left + 100,
this.pageMargin.Top - (int)f.GetHeight() - 3, this.PageMargin.Top - (int)f.GetHeight() - 3,
(int)size.Width, (int)size.Width,
(int)size.Height)); (int)size.Height));
Rectangle rect = new Rectangle(this.pageMargin.Left - 2,this.pageMargin.Top - 2, Rectangle rect = new Rectangle(this.PageMargin.Left - 2,this.PageMargin.Top - 2,
this.page.Width - this.pageMargin.Left - this.pageMargin.Right + 2, this.Page.Width - this.PageMargin.Left - this.PageMargin.Right + 2,
this.Size.Height - this.pageMargin.Top - this.pageMargin.Bottom + 2); this.Size.Height - this.PageMargin.Top - this.PageMargin.Bottom + 2);
e.DrawRectangle(new Pen(Color.LightGray,1),rect); e.DrawRectangle(new Pen(Color.LightGray,1),rect);
} }
} }
public Margins PageMargin { public Margins PageMargin {get;set;}
get { return pageMargin; }
set { pageMargin = value; }
}
public Rectangle Page {
get { return page; }
set { page = value; }
}
public Rectangle Page {get;set;}
public bool Landscape {get;set;}
} }

80
src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/Designer/RootDesigner/ReportRootDesigner.cs

@ -14,6 +14,7 @@ using System.ComponentModel;
using System.ComponentModel.Design; using System.ComponentModel.Design;
using System.Drawing; using System.Drawing;
using System.Drawing.Design; using System.Drawing.Design;
using System.Drawing.Printing;
using System.Windows.Forms; using System.Windows.Forms;
using System.Windows.Forms.Design; using System.Windows.Forms.Design;
@ -42,6 +43,46 @@ namespace ICSharpCode.Reports.Addin
} }
private void ShowMessage(Exception e)
{
base.DisplayError(e);
IUIService s = (IUIService)host.GetService(typeof(IUIService));
if (s != null) {
s.ShowError(e);
}
}
// private new void DisplayError(Exception ex)
// {
// MessageBox.Show(ex.Message + "\n" + ex.StackTrace, "Fehler im Designer", MessageBoxButtons.OK, MessageBoxIcon.Error);
// }
private void InitializeGUI()
{
reportSettings = host.Container.Components[1] as ReportSettings;
InitializeRootReportModel();
}
private void InitializeRootReportModel ()
{
this.rootReportModel = host.Container.Components[0] as RootReportModel;
this.rootReportModel.PageMargin = CalculateMargins();
this.rootReportModel.Page = new Rectangle(new Point(0,0),this.reportSettings.PageSize);
this.rootReportModel.Landscape = this.reportSettings.Landscape;
this.rootReportModel.Invalidate();
}
private Margins CalculateMargins ()
{
return new Margins(this.reportSettings.LeftMargin,reportSettings.RightMargin,
reportSettings.TopMargin,reportSettings.BottomMargin);
}
#region overrides
public override void Initialize(IComponent component) public override void Initialize(IComponent component)
{ {
base.Initialize(component); base.Initialize(component);
@ -125,37 +166,7 @@ namespace ICSharpCode.Reports.Addin
"AutoScaleDimensions","DataBindings"}; "AutoScaleDimensions","DataBindings"};
DesignerHelper.Remove(properties,s); DesignerHelper.Remove(properties,s);
base.PostFilterProperties(properties); base.PostFilterProperties(properties);
} }
private void ShowMessage(Exception e)
{
base.DisplayError(e);
IUIService s = (IUIService)host.GetService(typeof(IUIService));
if (s != null) {
s.ShowError(e);
}
}
// private new void DisplayError(Exception ex)
// {
// MessageBox.Show(ex.Message + "\n" + ex.StackTrace, "Fehler im Designer", MessageBoxButtons.OK, MessageBoxIcon.Error);
// }
private void InitializeGUI()
{
this.rootReportModel = host.Container.Components[0] as RootReportModel;
reportSettings = host.Container.Components[1] as ReportSettings;
this.rootReportModel.PageMargin = new System.Drawing.Printing.Margins(this.reportSettings.LeftMargin,reportSettings.RightMargin,
reportSettings.TopMargin,reportSettings.BottomMargin);
this.rootReportModel.Page = new Rectangle(0,0,
this.reportSettings.PageSize.Width,
this.reportSettings.PageSize.Height);
this.rootReportModel.Invalidate();
}
public override bool CanParent(ControlDesigner controlDesigner) public override bool CanParent(ControlDesigner controlDesigner)
{ {
@ -168,13 +179,18 @@ namespace ICSharpCode.Reports.Addin
return base.CanBeParentedTo(parentDesigner); return base.CanBeParentedTo(parentDesigner);
} }
#endregion
#region Events
private void OnSectionSizeChanged (object sender, EventArgs e) private void OnSectionSizeChanged (object sender, EventArgs e)
{ {
this.RecalculateSections(); this.RecalculateSections();
} }
private void RecalculateSections() private void RecalculateSections()
{ {
int locY = 50; int locY = 50;
@ -190,7 +206,7 @@ namespace ICSharpCode.Reports.Addin
this.Control.Invalidate(); this.Control.Invalidate();
} }
#region Events
private void OnLoadComplete(object sender, EventArgs e) private void OnLoadComplete(object sender, EventArgs e)
{ {

42
src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/DesignerBinding/InternalReportLoader.cs

@ -7,13 +7,13 @@
* Sie können diese Vorlage unter Extras > Optionen > Codeerstellung > Standardheader ändern. * Sie können diese Vorlage unter Extras > Optionen > Codeerstellung > Standardheader ändern.
*/ */
using System; using System;
using System.Collections;
using System.ComponentModel; using System.ComponentModel;
using System.ComponentModel.Design.Serialization; using System.ComponentModel.Design.Serialization;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.Reports.Core; using ICSharpCode.Reports.Core;
using ICSharpCode.Reports.Core.Interfaces;
using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop;
namespace ICSharpCode.Reports.Addin namespace ICSharpCode.Reports.Addin
@ -26,7 +26,6 @@ namespace ICSharpCode.Reports.Addin
private IDesignerLoaderHost host; private IDesignerLoaderHost host;
private Stream stream; private Stream stream;
private IDesignerGenerator generator; private IDesignerGenerator generator;
private ReportModel reportModel;
public InternalReportLoader(IDesignerLoaderHost host,IDesignerGenerator generator, Stream stream) public InternalReportLoader(IDesignerLoaderHost host,IDesignerGenerator generator, Stream stream)
{ {
@ -44,46 +43,43 @@ namespace ICSharpCode.Reports.Addin
public void LoadOrCreateReport() public void LoadOrCreateReport()
{ {
//string baseClassName = String.Empty;
Application.UseWaitCursor = true; Application.UseWaitCursor = true;
Application.DoEvents(); Application.DoEvents();
try { try {
IComponent cc = this.host.CreateComponent(typeof(ICSharpCode.Reports.Addin.RootReportModel),"RootReportModel"); IComponent cc = this.host.CreateComponent(typeof(ICSharpCode.Reports.Addin.RootReportModel),"RootReportModel");
ICSharpCode.Reports.Addin.RootReportModel rootControl = cc as ICSharpCode.Reports.Addin.RootReportModel; ICSharpCode.Reports.Addin.RootReportModel rootControl = cc as ICSharpCode.Reports.Addin.RootReportModel;
UpdateStatusbar();
string message;
if (this.generator.ViewContent.PrimaryFile.IsDirty) {
message = String.Format("Create Report + {0} ...",Path.GetFileName(this.generator.ViewContent.PrimaryFile.FileName));
} else {
message = String.Format("Load Report + {0} ...",Path.GetFileName(this.generator.ViewContent.PrimaryFile.FileName));
}
StatusBarService.SetMessage(message);
this.CreateNamedSurface(); this.CreateNamedSurface();
UnitConverter pageWidth = new UnitConverter(iTextSharp.text.PageSize.A4.Width, XGraphicsUnit.Point); rootControl.Size = this.ReportModel.ReportSettings.PageSize;
UnitConverter pageHeight = new UnitConverter(iTextSharp.text.PageSize.A4.Height + (this.reportModel.SectionCollection.Count +1) * GlobalsDesigner.GabBetweenSection
, XGraphicsUnit.Point);
rootControl.Size = new System.Drawing.Size((int)pageWidth.Pixel,(int)pageHeight.Pixel);
} catch (Exception e) { } catch (Exception e) {
System.Console.WriteLine(e.Message); MessageService.ShowException(e,"LoadOrCreateReport");
} finally { } finally {
StatusBarService.SetMessage(String.Empty);
Application.UseWaitCursor = false; Application.UseWaitCursor = false;
} }
} }
private void UpdateStatusbar ()
{
string message;
if (this.generator.ViewContent.PrimaryFile.IsDirty) {
message = String.Format("Create Report <{0}> ...",Path.GetFileName(this.generator.ViewContent.PrimaryFile.FileName));
} else {
message = String.Format("Load Report <{0}> ...",Path.GetFileName(this.generator.ViewContent.PrimaryFile.FileName));
}
StatusBarService.SetMessage(message);
}
private void CreateNamedSurface () private void CreateNamedSurface ()
{ {
ReportDefinitionDeserializer rl = new ReportDefinitionDeserializer(this.host,stream); ReportDefinitionDeserializer rl = new ReportDefinitionDeserializer(this.host,stream);
this.reportModel = rl.LoadObjectFromFileDefinition(); this.ReportModel = rl.LoadObjectFromFileDefinition();
} }
public ReportModel ReportModel { public ReportModel ReportModel {get; private set;}
get { return reportModel; }
}
} }
} }

47
src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportDesignerView.cs

@ -36,10 +36,9 @@ namespace ICSharpCode.Reports.Addin
private bool hasUnmergedChanges; private bool hasUnmergedChanges;
private bool unloading; private bool unloading;
string reportFileContent; private string reportFileContent;
private Panel panel = new Panel();
private Panel panel;
private ReportDesignerLoader loader; private ReportDesignerLoader loader;
private IDesignerGenerator generator; private IDesignerGenerator generator;
@ -50,7 +49,7 @@ namespace ICSharpCode.Reports.Addin
private XmlView xmlView; private XmlView xmlView;
private ReportPreview preview; private ReportPreview preview;
private ReportViewerSecondaryView reportViewer; private ReportViewerSecondaryView reportViewer;
// private Encoding defaultEncoding = Encoding.UTF8;
#region Constructor #region Constructor
@ -69,8 +68,6 @@ namespace ICSharpCode.Reports.Addin
this.generator = generator; this.generator = generator;
this.generator.Attach(this); this.generator.Attach(this);
base.TabPageText = ResourceService.GetString("SharpReport.Design"); base.TabPageText = ResourceService.GetString("SharpReport.Design");
this.panel.Dock = DockStyle.Fill;
this.panel.BackColor = System.Drawing.Color.LightBlue;
ReportingSideTabProvider.AddViewContent(this); ReportingSideTabProvider.AddViewContent(this);
} }
@ -190,30 +187,15 @@ namespace ICSharpCode.Reports.Addin
this.unloading = false; this.unloading = false;
if (e.HasSucceeded) { if (e.HasSucceeded) {
Control c = null;
c = this.designSurface.View as Control; CreatePanel();
c.Parent = this.panel; SetupDesignSurface();
c.Dock = DockStyle.Fill;
this.IsFormsDesignerVisible = true; this.IsFormsDesignerVisible = true;
// to set ReportFileContent initially, we need to manually call MergeFormChanges.
// updates to ReportFileContent will be done using the normal Save support in OpenedFile
// (that just doesn't work initially because the file isn't dirty)
generator.MergeFormChanges(null); generator.MergeFormChanges(null);
StartReportExplorer (); StartReportExplorer ();
// Display the designer on the view content
// bool savedIsDirty = this.DesignerCodeFile.IsDirty;
// Control designView = (Control)this.designSurface.View;
// designView.BackColor = Color.White;
// designView.RightToLeft = RightToLeft.No;
// Make sure auto-scaling is based on the correct font.
// This is required on Vista, I don't know why it works correctly in XP
// designView.Font = Control.DefaultFont;
// this.UserContent = designView;
LoggingService.Debug("FormsDesigner loaded, setting ActiveDesignSurface to " + this.designSurface.ToString()); LoggingService.Debug("FormsDesigner loaded, setting ActiveDesignSurface to " + this.designSurface.ToString());
designSurfaceManager.ActiveDesignSurface = this.designSurface; designSurfaceManager.ActiveDesignSurface = this.designSurface;
// this.DesignerCodeFile.IsDirty = savedIsDirty;
this.UpdatePropertyPad(); this.UpdatePropertyPad();
} else { } else {
// This method can not only be called during initialization, // This method can not only be called during initialization,
@ -230,7 +212,22 @@ namespace ICSharpCode.Reports.Addin
} }
} }
private void CreatePanel ()
{
this.panel = new Panel();
this.panel.Dock = DockStyle.Fill;
this.panel.BackColor = System.Drawing.Color.LightBlue;
}
private void SetupDesignSurface()
{
Control c = null;
c = this.designSurface.View as Control;
c.Parent = this.panel;
c.Dock = DockStyle.Fill;
}
private void DesingerUnloading(object sender, EventArgs e) private void DesingerUnloading(object sender, EventArgs e)
{ {
LoggingService.Debug("Forms designer: DesignerLoader unloading..."); LoggingService.Debug("Forms designer: DesignerLoader unloading...");

5
src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/Generators/AbstractReportGenerator.cs

@ -57,17 +57,20 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
private void AdjustSectionToDefault () { private void AdjustSectionToDefault () {
ReportSettings settings = reportModel.ReportSettings; ReportSettings settings = reportModel.ReportSettings;
foreach (ICSharpCode.Reports.Core.BaseSection s in reportModel.SectionCollection) { foreach (ICSharpCode.Reports.Core.BaseSection s in reportModel.SectionCollection) {
s.Size = new Size(settings.PageSize.Width - settings.LeftMargin - settings.RightMargin, s.Size = new Size(settings.PageSize.Width - settings.LeftMargin - settings.RightMargin,
GlobalValues.DefaultSectionHeight); GlobalValues.DefaultSectionHeight);
Console.WriteLine("AdjustSectionToDefaul Size : {0}",s.Size);
} }
} }
protected void WriteToXml () protected void WriteToXml ()
{ {
Console.WriteLine(" WriteToXml ()");
ReportDesignerWriter rpd = new ReportDesignerWriter(); ReportDesignerWriter rpd = new ReportDesignerWriter();
StringWriterWithEncoding writer = new StringWriterWithEncoding(System.Text.Encoding.UTF8); StringWriterWithEncoding writer = new StringWriterWithEncoding(System.Text.Encoding.UTF8);
XmlTextWriter xml =XmlHelper.CreatePropperWriter(writer); XmlTextWriter xml =XmlHelper.CreatePropperWriter(writer);

162
src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/ReportStructure.cs

@ -23,23 +23,18 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
{ {
public class ReportStructure : IDisposable public class ReportStructure : IDisposable
{ {
//BaseSettingsPanel
private string reportName; // private GlobalEnums.ReportType reportType;
private string fileName; // private GraphicsUnit graphicsUnit;
private string path;
private GlobalEnums.ReportType reportType;
private GraphicsUnit graphicsUnit;
//Database //Database
private GlobalEnums.PushPullModel dataModel; // private GlobalEnums.PushPullModel dataModel;
private string connectionString; // private string connectionString;
private string sqlString; // private string sqlString;
//
private CommandType commandType; // private CommandType commandType;
private SharpQueryProcedure sharpQueryProcedure; // private SharpQueryProcedure sharpQueryProcedure;
private ReportItemCollection reportItemCollection; private ReportItemCollection reportItemCollection;
private AvailableFieldsCollection availableFieldsCollection; private AvailableFieldsCollection availableFieldsCollection;
@ -54,117 +49,59 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
{ {
ReportModel model = ReportModel.Create(); ReportModel model = ReportModel.Create();
model.ReportSettings.ReportName = this.reportName; model.ReportSettings.ReportName = this.ReportName;
model.ReportSettings.FileName = this.path + this.fileName; model.ReportSettings.FileName = this.Path + this.FileName;
model.ReportSettings.GraphicsUnit = this.graphicsUnit; model.ReportSettings.GraphicsUnit = this.GraphicsUnit;
model.ReportSettings.ReportType = this.reportType; model.ReportSettings.ReportType = this.ReportType;
model.ReportSettings.ConnectionString = this.connectionString; model.ReportSettings.ConnectionString = this.ConnectionString;
model.ReportSettings.CommandText = this.sqlString; model.ReportSettings.CommandText = this.SqlString;
model.ReportSettings.CommandType = this.commandType; model.ReportSettings.CommandType = this.CommandType;
model.ReportSettings.DataModel = this.dataModel; model.ReportSettings.DataModel = this.DataModel;
model.ReportSettings.Landscape = this.Landscape;
if (Landscape) {
model.ReportSettings.PageSize = new Size(GlobalValues.DefaultPageSize.Height,GlobalValues.DefaultPageSize.Width);
} else {
model.ReportSettings.PageSize = GlobalValues.DefaultPageSize;
}
return model; return model;
} }
#region BaseSettingsPanel property's #region BaseSettingsPanel property's
public GraphicsUnit GraphicsUnit { public GraphicsUnit GraphicsUnit {get;set;}
get {
return graphicsUnit; public string ReportName {get;set;}
}
set {
graphicsUnit = value;
}
}
public string ReportName {
get {
return reportName;
}
set {
reportName = value;
}
}
public ICSharpCode.Reports.Core.GlobalEnums.ReportType ReportType {
get {
return reportType;
}
set {
reportType = value;
}
}
public string FileName {
get {
return fileName;
}
set {
fileName = value;
}
}
public string Path {
get { public ICSharpCode.Reports.Core.GlobalEnums.ReportType ReportType {get;set;}
return path;
}
set {
path = value;
}
}
#endregion public string FileName {get;set;}
#region DatabasePanel
public string ConnectionString { public string Path {get;set;}
get {
return connectionString;
}
set {
connectionString = value;
}
}
/* public bool Landscape {get;set;}
public string CatalogName {
get {
return catalogName;
}
set {
catalogName = value;
}
}
*/
public string SqlString { #endregion
get {
return sqlString;
}
set {
sqlString = value;
}
}
#region DatabasePanel
public CommandType CommandType public string ConnectionString {get;set;}
{
get {
return commandType;
}
set {
commandType = value;
}
}
public ICSharpCode.Reports.Core.GlobalEnums.PushPullModel DataModel { public string SqlString {get;set;}
get {
return dataModel;
}
set {
dataModel = value;
}
}
public CommandType CommandType {get;set;}
public ICSharpCode.Reports.Core.GlobalEnums.PushPullModel DataModel {get;set;}
public ParameterCollection SqlQueryParameters { public ParameterCollection SqlQueryParameters {
get { get {
@ -178,14 +115,7 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
/// <summary> /// <summary>
/// This Property is only usefull for ResultPanel /// This Property is only usefull for ResultPanel
/// </summary> /// </summary>
public SharpQueryProcedure SharpQueryProcedure { public SharpQueryProcedure SharpQueryProcedure {get;set;}
get {
return sharpQueryProcedure;
}
set {
sharpQueryProcedure = value;
}
}
#endregion #endregion
@ -238,8 +168,8 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
} }
if (this.sharpQueryProcedure != null) { if (this.SharpQueryProcedure != null) {
this.sharpQueryProcedure = null; this.SharpQueryProcedure = null;
} }
} }

73
src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/WizardPanels/BaseSettingsPanel.cs

@ -6,13 +6,15 @@
// </file> // </file>
using System; using System;
using System.ComponentModel.Design;
using System.Drawing; using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms; using System.Windows.Forms;
using ICSharpCode.Core; using ICSharpCode.Core;
using ICSharpCode.Reports.Core; using ICSharpCode.Reports.Core;
using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui; using ICSharpCode.SharpDevelop.Gui;
using Org.BouncyCastle.Crypto.Engines;
namespace ICSharpCode.Reports.Addin.ReportWizard{ namespace ICSharpCode.Reports.Addin.ReportWizard{
/// <summary> /// <summary>
@ -37,13 +39,19 @@ namespace ICSharpCode.Reports.Addin.ReportWizard{
private System.Windows.Forms.RadioButton radioFormSheet; private System.Windows.Forms.RadioButton radioFormSheet;
private System.Windows.Forms.ErrorProvider errorProvider; private System.Windows.Forms.ErrorProvider errorProvider;
private GroupBox groupPageLayout;
private RadioButton radioStandardLayout;
private RadioButton radioLandscape;
ReportStructure generator; ReportStructure generator;
Properties customizer; Properties customizer;
bool initDone; bool initDone;
public BaseSettingsPanel(){ public BaseSettingsPanel(){
InitializeComponent(); InitializeComponent();
AddPageLayout();
errorProvider = new ErrorProvider(); errorProvider = new ErrorProvider();
errorProvider.ContainerControl = this; errorProvider.ContainerControl = this;
this.txtFileName.KeyUp += new KeyEventHandler(OnKeyUp); this.txtFileName.KeyUp += new KeyEventHandler(OnKeyUp);
@ -53,6 +61,34 @@ namespace ICSharpCode.Reports.Addin.ReportWizard{
} }
private void AddPageLayout ()
{
groupPageLayout = new GroupBox();
groupPageLayout.Location = new Point (16,110);
groupPageLayout.Size = new System.Drawing.Size(360, 48);
groupPageLayout.Text = "Page Layout";
radioStandardLayout = new RadioButton();
radioStandardLayout.Text = "Standard";
radioStandardLayout.Location = new Point(24,15);
radioStandardLayout.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
radioStandardLayout.CheckedChanged += SetSuccessor;
groupPageLayout.Controls.Add(radioStandardLayout);
radioLandscape = new RadioButton();
radioLandscape.Text = "Landscape";
radioLandscape.Location = new Point (150,15);
radioLandscape.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
radioLandscape.CheckedChanged += SetSuccessor;
groupPageLayout.Controls.Add(radioLandscape);
this.groupBox1.Controls.Add(groupPageLayout);
}
private void OnKeyUp (object sender,KeyEventArgs e) { private void OnKeyUp (object sender,KeyEventArgs e) {
if (this.txtFileName.Text.Length == 0) { if (this.txtFileName.Text.Length == 0) {
this.errorProvider.SetError(this.txtFileName,"aaaaa"); this.errorProvider.SetError(this.txtFileName,"aaaaa");
@ -108,6 +144,8 @@ namespace ICSharpCode.Reports.Addin.ReportWizard{
cboGraphicsUnit.SelectedIndex = cboGraphicsUnit.FindString(GraphicsUnit.Millimeter.ToString()); cboGraphicsUnit.SelectedIndex = cboGraphicsUnit.FindString(GraphicsUnit.Millimeter.ToString());
this.radioPullModell.Checked = true; this.radioPullModell.Checked = true;
this.radioStandardLayout.Checked = true;
initDone = true; initDone = true;
} }
@ -149,6 +187,8 @@ namespace ICSharpCode.Reports.Addin.ReportWizard{
base.EnableNext = false; base.EnableNext = false;
base.IsLastPanel = true; base.IsLastPanel = true;
} }
generator.Landscape = this.radioLandscape.Checked;
} }
@ -168,7 +208,14 @@ namespace ICSharpCode.Reports.Addin.ReportWizard{
// generator.DataModel = GlobalEnums.PushPullModel.FormSheet; // generator.DataModel = GlobalEnums.PushPullModel.FormSheet;
base.EnableNext = false; base.EnableNext = false;
base.IsLastPanel = true; base.IsLastPanel = true;
} else if(this.radioStandardLayout.Checked == true) {
generator.Landscape = false;
} else if(this.radioLandscape.Checked == true) {
generator.Landscape = true;
} }
base.EnableFinish = true; base.EnableFinish = true;
} }
} }
@ -233,7 +280,7 @@ namespace ICSharpCode.Reports.Addin.ReportWizard{
// //
// label4 // label4
// //
this.label4.Location = new System.Drawing.Point(8, 160); this.label4.Location = new System.Drawing.Point(16, 168);
this.label4.Name = "label4"; this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(80, 24); this.label4.Size = new System.Drawing.Size(80, 24);
this.label4.TabIndex = 15; this.label4.TabIndex = 15;
@ -287,23 +334,13 @@ namespace ICSharpCode.Reports.Addin.ReportWizard{
// //
// cboGraphicsUnit // cboGraphicsUnit
// //
this.cboGraphicsUnit.Location = new System.Drawing.Point(112, 160); this.cboGraphicsUnit.Location = new System.Drawing.Point(116, 168);
this.cboGraphicsUnit.Name = "cboGraphicsUnit"; this.cboGraphicsUnit.Name = "cboGraphicsUnit";
this.cboGraphicsUnit.Size = new System.Drawing.Size(248, 21); this.cboGraphicsUnit.Size = new System.Drawing.Size(248, 25);
this.cboGraphicsUnit.TabIndex = 17; this.cboGraphicsUnit.TabIndex = 17;
this.cboGraphicsUnit.TextChanged += new System.EventHandler(this.ChangedEvent); this.cboGraphicsUnit.TextChanged += new System.EventHandler(this.ChangedEvent);
this.cboGraphicsUnit.DropDownStyle = ComboBoxStyle.DropDownList; this.cboGraphicsUnit.DropDownStyle = ComboBoxStyle.DropDownList;
//
// cboReportType
//
/*
this.cboReportType.Location = new System.Drawing.Point(112, 120);
this.cboReportType.Name = "cboReportType";
this.cboReportType.Size = new System.Drawing.Size(248, 21);
this.cboReportType.TabIndex = 16;
this.cboReportType.Visible = false;
this.cboReportType.SelectedIndexChanged += new System.EventHandler(this.ChangedEvent);
*/
// //
// txtReportName // txtReportName
// //
@ -319,14 +356,14 @@ namespace ICSharpCode.Reports.Addin.ReportWizard{
this.groupBox1.Controls.Add(this.groupBox2); this.groupBox1.Controls.Add(this.groupBox2);
this.groupBox1.Controls.Add(this.button1); this.groupBox1.Controls.Add(this.button1);
this.groupBox1.Controls.Add(this.cboGraphicsUnit); this.groupBox1.Controls.Add(this.cboGraphicsUnit);
// this.groupBox1.Controls.Add(this.cboReportType);
this.groupBox1.Controls.Add(this.label4); this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.txtPath); this.groupBox1.Controls.Add(this.txtPath);
this.groupBox1.Controls.Add(this.label2); this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Location = new System.Drawing.Point(8, 160); this.groupBox1.Location = new System.Drawing.Point(8, 160);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(392, 192); this.groupBox1.Size = new System.Drawing.Size(392, 210);
this.groupBox1.TabIndex = 10; this.groupBox1.TabIndex = 10;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
// //

2
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/ICSharpCode.Reports.Core.csproj

@ -63,8 +63,8 @@
</Reference> </Reference>
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.ServiceProcess" /> <Reference Include="System.ServiceProcess" />
<Reference Include="System.Xml" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Design" /> <Reference Include="System.Design" />
<Reference Include="System.Xml.Linq"> <Reference Include="System.Xml.Linq">

2
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Globals/GlobalValues.cs

@ -26,7 +26,7 @@ using System.Text;
namespace ICSharpCode.Reports.Core { namespace ICSharpCode.Reports.Core {
public sealed class GlobalValues public sealed class GlobalValues
{ {
// private static string reportString = "Report";
private static string reportExtension = ".srd"; private static string reportExtension = ".srd";
private static string xsdExtension = "xsd"; private static string xsdExtension = "xsd";
private static string reportFileName = "Report1"; private static string reportFileName = "Report1";

218
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/ReportSettings.cs

@ -38,7 +38,6 @@ namespace ICSharpCode.Reports.Core{
} }
[Designer(typeof(ReportSettingsDesigner))] [Designer(typeof(ReportSettingsDesigner))]
public class ReportSettings :Component,IDisposable public class ReportSettings :Component,IDisposable
{ {
@ -47,33 +46,12 @@ namespace ICSharpCode.Reports.Core{
private string reportName; private string reportName;
private string fileName; private string fileName;
private bool useStandardPrinter;
private bool landSacpe;
private GraphicsUnit graphicsUnit;
private Padding padding;
private string connectionString;
private string commandText;
private string noDataMessage = "No Data for this Report";
private System.Data.CommandType commandType = System.Data.CommandType.Text;
private Font defaultFont;
private GlobalEnums.ReportType reportType;
private GlobalEnums.PushPullModel dataModel;
private ParameterCollection parameterCollection; private ParameterCollection parameterCollection;
private AvailableFieldsCollection availableFields; private AvailableFieldsCollection availableFields;
private ColumnCollection groupingsCollection; private ColumnCollection groupingsCollection;
private SortColumnCollection sortingCollection; private SortColumnCollection sortingCollection;
private int bottomMargin;
private int topMargin;
private int leftMargin;
private int rightMargin;
private Size pageSize;
#region Constructor #region Constructor
@ -102,27 +80,28 @@ namespace ICSharpCode.Reports.Core{
this.fileName = BuildFilename(fileName); this.fileName = BuildFilename(fileName);
} }
BaseValues(); BaseValues();
this.pageSize = pageSize; this.PageSize = pageSize;
} }
void BaseValues() void BaseValues()
{ {
this.useStandardPrinter = true; this.UseStandardPrinter = true;
this.graphicsUnit = GraphicsUnit.Pixel; this.GraphicsUnit = GraphicsUnit.Pixel;
this.padding = new Padding(5); this.Padding = new Padding(5);
this.defaultFont = GlobalValues.DefaultFont; this.DefaultFont = GlobalValues.DefaultFont;
this.reportType = GlobalEnums.ReportType.FormSheet; this.ReportType = GlobalEnums.ReportType.FormSheet;
this.dataModel = GlobalEnums.PushPullModel.FormSheet; this.DataModel = GlobalEnums.PushPullModel.FormSheet;
this.pageSize = GlobalValues.DefaultPageSize; this.CommandType = System.Data.CommandType.Text;
this.topMargin = GlobalValues.DefaultPageMargin.Left; this.TopMargin = GlobalValues.DefaultPageMargin.Left;
this.bottomMargin = GlobalValues.DefaultPageMargin.Bottom; this.BottomMargin = GlobalValues.DefaultPageMargin.Bottom;
this.leftMargin = GlobalValues.DefaultPageMargin.Left; this.LeftMargin = GlobalValues.DefaultPageMargin.Left;
this.rightMargin = GlobalValues.DefaultPageMargin.Right; this.RightMargin = GlobalValues.DefaultPageMargin.Right;
this.availableFields = new AvailableFieldsCollection(); this.availableFields = new AvailableFieldsCollection();
this.groupingsCollection = new ColumnCollection(); this.groupingsCollection = new ColumnCollection();
this.sortingCollection = new SortColumnCollection(); this.sortingCollection = new SortColumnCollection();
this.parameterCollection = new ParameterCollection(); this.parameterCollection = new ParameterCollection();
this.NoDataMessage = "No Data for this Report";
} }
#endregion #endregion
@ -180,64 +159,38 @@ namespace ICSharpCode.Reports.Core{
[Browsable(true), Category("Base Settings")] [Browsable(true), Category("Base Settings")]
public GlobalEnums.ReportType ReportType { public GlobalEnums.ReportType ReportType {get;set;}
get {
return reportType;
}
set {
if (reportType != value) {
reportType = value;
}
}
}
#endregion #endregion
#region Page Settings #region Page Settings
[Category("Page Settings")] [Category("Page Settings")]
public int BottomMargin { public int BottomMargin {get;set;}
get { return bottomMargin; }
set { bottomMargin = value; }
}
[Category("Page Settings")] [Category("Page Settings")]
public int TopMargin { public int TopMargin {get;set;}
get { return topMargin; }
set { topMargin = value; }
}
[Category("Page Settings")] [Category("Page Settings")]
public int LeftMargin { public int LeftMargin {get;set;}
get { return leftMargin; }
set { leftMargin = value; }
}
[Category("Page Settings")] [Category("Page Settings")]
public int RightMargin { public int RightMargin {get;set;}
get { return rightMargin; }
set { rightMargin = value; }
}
[Category("Page Settings")] [Category("Page Settings")]
public Size PageSize { public Size PageSize {get;set;}
get { return pageSize; }
set { pageSize = value; }
}
[Category("Page Settings")] [Category("Page Settings")]
public bool Landscape { public bool Landscape {get;set;}
get { return this.landSacpe; }
set { this.landSacpe = value;}
}
#endregion #endregion
@ -246,32 +199,11 @@ namespace ICSharpCode.Reports.Core{
[Category("Designer Settings")] [Category("Designer Settings")]
[DefaultValueAttribute (System.Drawing.GraphicsUnit.Millimeter)] [DefaultValueAttribute (System.Drawing.GraphicsUnit.Millimeter)]
public System.Drawing.GraphicsUnit GraphicsUnit public System.Drawing.GraphicsUnit GraphicsUnit{get;set;}
{
get {
return graphicsUnit;
}
set {
if (graphicsUnit != value) {
graphicsUnit = value;
}
}
}
[Category("Designer Settings")] [Category("Designer Settings")]
public Padding Padding public Padding Padding{get;set;}
{
get {
return padding;
}
set {
if (this.padding != value) {
this.padding = value;
}
}
}
#endregion #endregion
@ -317,76 +249,31 @@ namespace ICSharpCode.Reports.Core{
[DefaultValueAttribute ("")] [DefaultValueAttribute ("")]
[EditorAttribute (typeof(DefaultTextEditor), [EditorAttribute (typeof(DefaultTextEditor),
typeof(System.Drawing.Design.UITypeEditor) )] typeof(System.Drawing.Design.UITypeEditor) )]
public string ConnectionString { public string ConnectionString {get;set;}
get {
if (this.connectionString == null) {
this.connectionString = String.Empty;
}
return connectionString;
}
set {
if (connectionString != value) {
connectionString = value;
}
}
}
[Category("Data")] [Category("Data")]
[DefaultValueAttribute ("")] [DefaultValueAttribute ("")]
[EditorAttribute ( typeof(DefaultTextEditor), [EditorAttribute ( typeof(DefaultTextEditor),
typeof(System.Drawing.Design.UITypeEditor) )] typeof(System.Drawing.Design.UITypeEditor) )]
public string CommandText { public string CommandText {get;set;}
get {
if (this.commandText == null) {
this.commandText = String.Empty;
}
return commandText;
}
set {
if (commandText != value) {
commandText = value;
}
}
}
[Category("Data")] [Category("Data")]
public System.Data.CommandType CommandType { public System.Data.CommandType CommandType {get;set;}
get {
return commandType;
}
set {
if (commandType != value) {
commandType = value;
}
}
}
[Category("Data")] [Category("Data")]
public GlobalEnums.PushPullModel DataModel { public GlobalEnums.PushPullModel DataModel {get;set;}
get {
return dataModel;
}
set {
if (dataModel != value) {
dataModel = value;
}
}
}
[Category("Data")] [Category("Data")]
[EditorAttribute ( typeof(DefaultTextEditor), [EditorAttribute ( typeof(DefaultTextEditor),
typeof(System.Drawing.Design.UITypeEditor) )] typeof(System.Drawing.Design.UITypeEditor) )]
public string NoDataMessage { public string NoDataMessage {get;set;}
get {
return noDataMessage;
}
set {
noDataMessage = value;
}
}
#endregion #endregion
@ -394,31 +281,14 @@ namespace ICSharpCode.Reports.Core{
#region OutPut Settings #region OutPut Settings
[Category("Output Settings")] [Category("Output Settings")]
public Font DefaultFont { public Font DefaultFont {get;set;}
get {
return defaultFont;
}
set {
if (defaultFont != value) {
defaultFont = value;
}
}
}
[Category("Output Settings")] [Category("Output Settings")]
[DefaultValueAttribute (true)] [DefaultValueAttribute (true)]
public bool UseStandardPrinter public bool UseStandardPrinter{get;set;}
{
get {
return useStandardPrinter;
}
set {
if (useStandardPrinter != value) {
useStandardPrinter = value;
}
}
}
#endregion #endregion
@ -436,10 +306,10 @@ namespace ICSharpCode.Reports.Core{
if (disposing) if (disposing)
{ {
// free managed resources // free managed resources
if (this.defaultFont != null) if (this.DefaultFont != null)
{ {
this.defaultFont.Dispose(); this.DefaultFont.Dispose();
this.defaultFont = null; this.DefaultFont = null;
} }
} }
} }

Loading…
Cancel
Save