diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/ICSharpCode.Reporting.Addin.csproj b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/ICSharpCode.Reporting.Addin.csproj index a5181ece13..c1cdc982e4 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/ICSharpCode.Reporting.Addin.csproj +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/ICSharpCode.Reporting.Addin.csproj @@ -79,7 +79,6 @@ - diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignableItems/ReportSettings.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignableItems/ReportSettings.cs index 50861beb18..43a4f72fdf 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignableItems/ReportSettings.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignableItems/ReportSettings.cs @@ -42,10 +42,10 @@ namespace ICSharpCode.Reporting.Addin.DesignableItems // this.ConnectionString = String.Empty; // this.CommandText = String.Empty; // -// this.TopMargin = GlobalValues.DefaultPageMargin.Left; -// this.BottomMargin = GlobalValues.DefaultPageMargin.Bottom; -// this.LeftMargin = GlobalValues.DefaultPageMargin.Left; -// this.RightMargin = GlobalValues.DefaultPageMargin.Right; + this.TopMargin = GlobalValues.DefaultPageMargin.Left; + this.BottomMargin = GlobalValues.DefaultPageMargin.Bottom; + this.LeftMargin = GlobalValues.DefaultPageMargin.Left; + this.RightMargin = GlobalValues.DefaultPageMargin.Right; // // this.availableFields = new AvailableFieldsCollection(); // this.groupingsCollection = new GroupColumnCollection(); @@ -57,10 +57,9 @@ namespace ICSharpCode.Reporting.Addin.DesignableItems } - private string reportName; + string reportName; -// [Category("Base Settings")] -// [DefaultValueAttribute ("")] + [Category("Base Settings")] public string ReportName { get { @@ -76,8 +75,9 @@ namespace ICSharpCode.Reporting.Addin.DesignableItems } } - private string fileName; -// [Category("Base Settings")] + + string fileName; + [Category("Base Settings")] // [XmlIgnoreAttribute] public string FileName { @@ -93,25 +93,28 @@ namespace ICSharpCode.Reporting.Addin.DesignableItems } -// [Category("Page Settings")] + [Browsable(true), Category("Base Settings")] + public ReportType ReportType {get;set;} + + + [Category("Page Settings")] public int BottomMargin {get;set;} -// [Category("Page Settings")] + [Category("Page Settings")] public int TopMargin {get;set;} - -// [Category("Page Settings")] + [Category("Page Settings")] public int LeftMargin {get;set;} - -// [Category("Page Settings")] + [Category("Page Settings")] public int RightMargin {get;set;} - private Size pageSize; + Size pageSize; + [Category("Page Settings")] public Size PageSize { get { if (!Landscape) { @@ -123,19 +126,15 @@ namespace ICSharpCode.Reporting.Addin.DesignableItems set { pageSize = value; } } -// [Category("Page Settings")] -// public Size PageSize {get;set;} + -// [Category("Page Settings")] + [Category("Page Settings")] public bool Landscape {get;set;} -// [Category("Data")] + [Category("Data")] public PushPullModel DataModel {get;set;} -// [Browsable(true), Category("Base Settings")] - public ReportType ReportType {get;set;} - // [Category("Parameters")] // [EditorAttribute ( typeof(ParameterCollectionEditor), diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignerBinding/DesignerBinding.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignerBinding/DesignerBinding.cs index e7a716d31c..93df61f344 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignerBinding/DesignerBinding.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignerBinding/DesignerBinding.cs @@ -47,8 +47,17 @@ namespace ICSharpCode.Reporting.Addin.DesignerBinding { if (file.IsDirty) { var cmd = new ReportWizardCommand(file); cmd.Run(); - if (cmd.Canceled) { + if (!cmd.Canceled) { LoggingService.Info("reportWizard canceled"); + //return null; + var reportModel = cmd.ReportModel; + + var xml = CreateFormSheetFromModel.ToXml(reportModel); + var doc = new XmlDocument(); + doc.LoadXml(xml.ToString()); + var ar = XmlToArray(doc); + file.SetData(ar); + } else { return null; } } @@ -71,7 +80,7 @@ namespace ICSharpCode.Reporting.Addin.DesignerBinding { } - */ + */ } static byte[] XmlToArray(XmlDocument doc) diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignerBinding/DesignerGenerator.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignerBinding/DesignerGenerator.cs index ea4dcfa3d4..6cde4855fa 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignerBinding/DesignerGenerator.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignerBinding/DesignerGenerator.cs @@ -78,9 +78,10 @@ namespace ICSharpCode.Reporting.Addin.DesignerBinding // we look only for Sections foreach (var component in viewContent.Host.Container.Components) { - var b = component as BaseSection; - if (b != null) { - reportDesignerWriter.Save(component,xml); + var section = component as BaseSection; + if (section != null) { +// reportDesignerWriter.Save(component,xml); + reportDesignerWriter.Save(section,xml); } } //SectionCollection diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml index bf2a81e6da..3fd65a42db 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml @@ -2,27 +2,31 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" - xmlns:System="clr-namespace:System;assembly=mscorlib" -xmlns:aa="clr-namespace:ICSharpCode.Reporting.Globals;assembly=ICSharpCode.Reporting" - xmlns:ics="clr-namespace:ICSharpCode.Reporting.Globals;assembly=ICSharpCode.Reporting" + xmlns:System="clr-namespace:System;assembly=mscorlib" + xmlns:sdr="clr-namespace:ICSharpCode.Reporting.Globals;assembly=ICSharpCode.Reporting" + Title="Base Settings" Description="Basic Settings and Layout" - Background="LightGray"> + Background="LightGray" + CanFinish="true"> - - - - - - - - + + + + + + + + + + + - - + + @@ -30,10 +34,10 @@ xmlns:aa="clr-namespace:ICSharpCode.Reporting.Globals;assembly=ICSharpCode.Repor - - - - + + + + @@ -43,14 +47,17 @@ xmlns:aa="clr-namespace:ICSharpCode.Reporting.Globals;assembly=ICSharpCode.Repor - - - + + + - - + + + @@ -59,8 +66,8 @@ xmlns:aa="clr-namespace:ICSharpCode.Reporting.Globals;assembly=ICSharpCode.Repor - - + + \ No newline at end of file diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml.cs index 126262eb96..191c6cb858 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml.cs @@ -8,6 +8,7 @@ */ using System; using System.Windows; +using ICSharpCode.Reporting.Globals; using Xceed.Wpf.Toolkit; using ICSharpCode.Reporting.Addin.ReportWizard.ViewModels; @@ -23,6 +24,8 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog{ public BaseSettingsPage() { InitializeComponent(); + _DataModel.SelectedItem = PushPullModel.FormSheet; + _ReportType.SelectedItem = ReportType.FormSheet; this.context = new PageOneContext(); } @@ -38,21 +41,11 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog{ } - void WizardPage_Enter(object sender, RoutedEventArgs e) - { - - Console.Write("Create Context for PageOne"); - } - - void WizardPage_Leave(object sender, RoutedEventArgs e) - { -// NewMethod(); - } - void UpdateContext() { -// context.FormSheet = this._FormSheet.IsChecked == true; -// context.PushModel = this._PushModel.IsChecked == true; + + context.DataModel = (PushPullModel) _DataModel.SelectedItem; + context.ReportType = (ReportType) _ReportType.SelectedItem; context.ReportName = this._ReportName.Text; context.FileName = this._Filename.Text; context.Legal = _Legal.IsChecked == true; diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml index 8e3d9916e0..59ba6244b3 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml @@ -20,14 +20,15 @@ - + \ No newline at end of file diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml.cs index 736ae0ee53..cc0460698d 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml.cs @@ -19,16 +19,15 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog /// public partial class ReportWizard : Window { - ReportWizardContext context; - BaseSettingsPage baseSettingsPage; + readonly ReportWizardContext context; + readonly BaseSettingsPage baseSettingsPage; public ReportWizard(ReportWizardContext context) { InitializeComponent(); this.context = context; baseSettingsPage = new BaseSettingsPage(); - _wizard.Items.Insert(2,baseSettingsPage); - + _wizard.Items.Insert(1,baseSettingsPage); } @@ -44,17 +43,6 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog void _wizard_Finish(object sender, RoutedEventArgs e) { - var x = _wizard.Items; - - foreach (var element in this._wizard.Items) { - var isHasContext = element is IHasContext; - if (isHasContext) { - - var hasContext = (IHasContext) element; - Console.WriteLine(" {0} - {1}",hasContext.PageNumber,element.ToString()); - } - } - context.PageOneContext = baseSettingsPage.Context; } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportGenerator.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportGenerator.cs index 8f99a5e582..807be02f9b 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportGenerator.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportGenerator.cs @@ -7,7 +7,13 @@ * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; +using System.Drawing; +using ICSharpCode.Reporting.Factories; +using ICSharpCode.Reporting.Globals; using ICSharpCode.Reporting.Interfaces; + + +using ICSharpCode.Reporting.Items; using ICSharpCode.Reporting.Addin.ReportWizard.ViewModels; namespace ICSharpCode.Reporting.Addin.ReportWizard @@ -18,14 +24,53 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard public class ReportGenerator { ReportWizardContext context; + public ReportGenerator(ReportWizardContext context) { if (context == null) throw new ArgumentNullException("context"); this.context = context; + ReportModel = ReportModelFactory.Create(); + } + + + public void Generate() { + PageOneGenerate(); + CreateReportHeader(); + } + + void PageOneGenerate() + { + var pageOne = (PageOneContext)context.PageOneContext; + var reportSettings = ReportModel.ReportSettings; + reportSettings.DataModel = pageOne.DataModel; + reportSettings.FileName = pageOne.FileName; + if (pageOne.Legal) { + reportSettings.Landscape = false; + } else { + reportSettings.Landscape = true; + } + reportSettings.ReportName = pageOne.ReportName; + reportSettings.ReportType = pageOne.ReportType; + } + + + void CreateReportHeader() + { + var headerText = new BaseTextItem(); + headerText.Text = "Header"; + headerText.Size = GlobalValues.PreferedSize; + var printableWith = ReportModel.ReportSettings.PageSize.Width - ReportModel.ReportSettings.LeftMargin - ReportModel.ReportSettings.RightMargin; + var x = (int)(printableWith - headerText.Size.Width) / 2; + + headerText.Location = new Point(x,4); + ReportModel.ReportHeader.Items.Add(headerText); + Console.WriteLine(""); + Console.WriteLine("Createreportheader Size {0}",ReportModel.ReportHeader.Size); } + public IReportModel ReportModel {get;private set;} } } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportWizardCommand.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportWizardCommand.cs index ba524408af..387ca1acb5 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportWizardCommand.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportWizardCommand.cs @@ -38,11 +38,15 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard LoggingService.Info("ReportWizard - CreateReport"); var rg = new ReportGenerator(wizardViewModel); + rg.Generate(); + ReportModel = rg.ReportModel; } else { Canceled = true; } } public bool Canceled {get; private set;} + + public IReportModel ReportModel {get;private set;} } } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ViewModels/PageOneContext.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ViewModels/PageOneContext.cs index a012d040eb..c6fc2d92df 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ViewModels/PageOneContext.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ViewModels/PageOneContext.cs @@ -7,6 +7,7 @@ * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; +using ICSharpCode.Reporting.Globals; using Xceed.Wpf.Toolkit; namespace ICSharpCode.Reporting.Addin.ReportWizard.ViewModels @@ -16,8 +17,8 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.ViewModels /// public class PageOneContext:IWizardContext { - public bool FormSheet {get;set;} - public bool PushModel {get;set;} + public PushPullModel DataModel {get;set;} + public ReportType ReportType {get;set;} public string ReportName {get;set;} public string FileName {get;set;} public bool Legal {get;set;} diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/GlobalEnums.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/GlobalEnums.cs index 15be41d41e..e3c34f027e 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/GlobalEnums.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/GlobalEnums.cs @@ -20,69 +20,35 @@ using System; namespace ICSharpCode.Reporting.Globals { - /// - /// Description of GlobalEnums. - /// ///Technics to get the data - /// Push : report get's a ready filld dataset or something tah implements IList - /// Pull : report has to fill data by themself - /// FormSheet : FormSheet report, just labels and images are allowed - /// - /// + /// Push : report get's a ready filld dataset or something tah implements IList + /// Pull : report has to fill data by themself + /// FormSheet : FormSheet report, just labels and images are allowed + /// + public enum PushPullModel { - PushData, - PullData, - FormSheet + PushData, + PullData, + FormSheet } - + /// - /// FormSheet means a blank form with Labels, Lines and Checkboxes - /// DataReport handles all Reports with Data - /// + /// FormSheet means a blank form with Labels, Lines and Checkboxes + /// DataReport handles all Reports with Data + /// public enum ReportType { - FormSheet, - DataReport, + FormSheet, + DataReport, } -public enum ReportSection { - ReportHeader, - ReportPageHeader, - ReportDetail, - ReportPageFooter, - ReportFooter - } - - public sealed class GlobalEnums - { - private GlobalEnums() { - } - - - - ///Technics to get the data - /// Push : report get's a ready filld dataset or something tah implements IList - /// Pull : report has to fill data by themself - /// FormSheet : FormSheet report, just labels and images are allowed - /// - /// -// public enum PushPullModel { -// PushData, -// PullData, -// FormSheet -// } - - - /// - /// FormSheet means a blank form with Labels, Lines and Checkboxes - /// DataReport handles all Reports with Data - /// -// public enum ReportType { -// FormSheet, -// DataReport, -// } - - + public enum ReportSection { + ReportHeader, + ReportPageHeader, + ReportDetail, + ReportPageFooter, + ReportFooter } + } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseSection.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseSection.cs index a57b3614cd..2bfa2a8455 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseSection.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseSection.cs @@ -26,7 +26,7 @@ namespace ICSharpCode.Reporting.Items /// Description of BaseSection. /// - public class BaseSection:ReportContainer,IReportContainer + public class BaseSection:ReportContainer { diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseTextItem.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseTextItem.cs index 242c524eed..571d00b4a0 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseTextItem.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseTextItem.cs @@ -45,6 +45,7 @@ namespace ICSharpCode.Reporting.Items public BaseTextItem(){ Name = "BaseTextItem"; Font = GlobalValues.DefaultFont; + } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/PrintableItem.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/PrintableItem.cs index ec72ea1005..4be5b87cf5 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/PrintableItem.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/PrintableItem.cs @@ -18,6 +18,7 @@ using System; using System.Drawing; +using ICSharpCode.Reporting.Globals; using ICSharpCode.Reporting.Interfaces; using ICSharpCode.Reporting.Interfaces.Export;