From f212108c77e55d8ebabfcdf43653dc8d60a83f8d Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sat, 24 Jun 2006 19:50:05 +0000 Subject: [PATCH 01/22] Remove WPF templates from Corsavy. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1517 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../file/CSharp/CSharp.WPFFlowDocument.xft | 36 ---- data/templates/file/CSharp/CSharp.WPFPage.xft | 66 ------- .../file/CSharp/CSharp.WPFPageFunction.xft | 91 --------- .../CSharp/CSharp.WPFResourceDictionary.xft | 34 ---- .../file/CSharp/CSharp.WPFUserControl.xft | 64 ------- .../file/CSharp/CSharp.WPFWindow.xft | 67 ------- .../project/CSharp/WPFApplication.xpt | 175 ------------------ .../CSharp/WPFNavigationApplication.xpt | 174 ----------------- 8 files changed, 707 deletions(-) delete mode 100644 data/templates/file/CSharp/CSharp.WPFFlowDocument.xft delete mode 100644 data/templates/file/CSharp/CSharp.WPFPage.xft delete mode 100644 data/templates/file/CSharp/CSharp.WPFPageFunction.xft delete mode 100644 data/templates/file/CSharp/CSharp.WPFResourceDictionary.xft delete mode 100644 data/templates/file/CSharp/CSharp.WPFUserControl.xft delete mode 100644 data/templates/file/CSharp/CSharp.WPFWindow.xft delete mode 100644 data/templates/project/CSharp/WPFApplication.xpt delete mode 100644 data/templates/project/CSharp/WPFNavigationApplication.xpt diff --git a/data/templates/file/CSharp/CSharp.WPFFlowDocument.xft b/data/templates/file/CSharp/CSharp.WPFFlowDocument.xft deleted file mode 100644 index 10a99da554..0000000000 --- a/data/templates/file/CSharp/CSharp.WPFFlowDocument.xft +++ /dev/null @@ -1,36 +0,0 @@ - - - - diff --git a/data/templates/file/CSharp/CSharp.WPFPage.xft b/data/templates/file/CSharp/CSharp.WPFPage.xft deleted file mode 100644 index 53be9f3f94..0000000000 --- a/data/templates/file/CSharp/CSharp.WPFPage.xft +++ /dev/null @@ -1,66 +0,0 @@ - - - - diff --git a/data/templates/file/CSharp/CSharp.WPFPageFunction.xft b/data/templates/file/CSharp/CSharp.WPFPageFunction.xft deleted file mode 100644 index 1915a22613..0000000000 --- a/data/templates/file/CSharp/CSharp.WPFPageFunction.xft +++ /dev/null @@ -1,91 +0,0 @@ - - - - diff --git a/data/templates/file/CSharp/CSharp.WPFResourceDictionary.xft b/data/templates/file/CSharp/CSharp.WPFResourceDictionary.xft deleted file mode 100644 index 0e98f46dc7..0000000000 --- a/data/templates/file/CSharp/CSharp.WPFResourceDictionary.xft +++ /dev/null @@ -1,34 +0,0 @@ - - - - diff --git a/data/templates/file/CSharp/CSharp.WPFUserControl.xft b/data/templates/file/CSharp/CSharp.WPFUserControl.xft deleted file mode 100644 index 033288131b..0000000000 --- a/data/templates/file/CSharp/CSharp.WPFUserControl.xft +++ /dev/null @@ -1,64 +0,0 @@ - - - - diff --git a/data/templates/file/CSharp/CSharp.WPFWindow.xft b/data/templates/file/CSharp/CSharp.WPFWindow.xft deleted file mode 100644 index 1befbef230..0000000000 --- a/data/templates/file/CSharp/CSharp.WPFWindow.xft +++ /dev/null @@ -1,67 +0,0 @@ - - - - diff --git a/data/templates/project/CSharp/WPFApplication.xpt b/data/templates/project/CSharp/WPFApplication.xpt deleted file mode 100644 index 4f0d7b1287..0000000000 --- a/data/templates/project/CSharp/WPFApplication.xpt +++ /dev/null @@ -1,175 +0,0 @@ - - diff --git a/data/templates/project/CSharp/WPFNavigationApplication.xpt b/data/templates/project/CSharp/WPFNavigationApplication.xpt deleted file mode 100644 index ab23631e9d..0000000000 --- a/data/templates/project/CSharp/WPFNavigationApplication.xpt +++ /dev/null @@ -1,174 +0,0 @@ - - From bd739ec8085b03cab418d20bfcd7bbc7f5586310 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sun, 25 Jun 2006 13:55:35 +0000 Subject: [PATCH 02/22] Fixed SD2-745 and SD2-871 (patch by John Simons) git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1518 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../BookmarkManager/BookmarkManager.cs | 17 +++++++++++------ .../Base/Project/Src/Gui/Pads/FileScout.cs | 15 ++++++--------- .../ProjectBrowser/TreeNodes/ProjectNode.cs | 5 ++--- .../TreeNodes/SolutionItemNode.cs | 4 +++- .../ProjectBrowser/TreeNodes/SolutionNode.cs | 4 +--- .../Project/Src/Services/File/FileService.cs | 18 ++++++++++++------ 6 files changed, 35 insertions(+), 28 deletions(-) diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/BookmarkManager/BookmarkManager.cs b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/BookmarkManager/BookmarkManager.cs index 14bf93cd82..9fa3b40209 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/BookmarkManager/BookmarkManager.cs +++ b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/BookmarkManager/BookmarkManager.cs @@ -64,20 +64,25 @@ namespace ICSharpCode.TextEditor.Document /// public void ToggleMarkAt(int lineNr) { + Bookmark newMark; + if (factory != null) + newMark = factory.CreateBookmark(document, lineNr); + else + newMark = new Bookmark(document, lineNr); + + Type newMarkType = newMark.GetType(); + for (int i = 0; i < bookmark.Count; ++i) { Bookmark mark = bookmark[i]; - if (mark.LineNumber == lineNr && mark.CanToggle) { + + if (mark.LineNumber == lineNr && mark.CanToggle && mark.GetType() == newMarkType) { bookmark.RemoveAt(i); OnRemoved(new BookmarkEventArgs(mark)); OnChanged(EventArgs.Empty); return; } } - Bookmark newMark; - if (factory != null) - newMark = factory.CreateBookmark(document, lineNr); - else - newMark = new Bookmark(document, lineNr); + bookmark.Add(newMark); OnAdded(new BookmarkEventArgs(newMark)); OnChanged(EventArgs.Empty); diff --git a/src/Main/Base/Project/Src/Gui/Pads/FileScout.cs b/src/Main/Base/Project/Src/Gui/Pads/FileScout.cs index ebb74c8989..1bb63d83eb 100644 --- a/src/Main/Base/Project/Src/Gui/Pads/FileScout.cs +++ b/src/Main/Base/Project/Src/Gui/Pads/FileScout.cs @@ -365,21 +365,18 @@ namespace ICSharpCode.SharpDevelop.Gui { base.OnAfterLabelEdit(e); - if(e.Label == null) { + if (e.Label == null || !FileService.CheckFileName(e.Label)) { e.CancelEdit = true; return; } - string filename = ((FileListItem)Items[e.Item]).FullName; - string newname = Path.GetDirectoryName(filename) + Path.DirectorySeparatorChar + e.Label; + string oldFileName = ((FileListItem)Items[e.Item]).FullName; + string newFileName = Path.Combine(Path.GetDirectoryName(oldFileName), e.Label); - try { - File.Move(filename, newname); - ((FileListItem)Items[e.Item]).FullName = newname; - } catch(Exception ex) { + if (FileService.RenameFile(oldFileName, newFileName, false)) { + ((FileListItem)Items[e.Item]).FullName = newFileName; + } else { e.CancelEdit = true; - - MessageService.ShowError(ex, "Rename failed"); } } diff --git a/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/ProjectNode.cs b/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/ProjectNode.cs index 88eed038fb..ad3f4b2b55 100644 --- a/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/ProjectNode.cs +++ b/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/ProjectNode.cs @@ -147,13 +147,12 @@ namespace ICSharpCode.SharpDevelop.Project // } // } string newFileName = Path.Combine(project.Directory, newName + Path.GetExtension(project.FileName)); - if (File.Exists(newFileName)) { - MessageService.ShowError("The file " + newFileName + " already exists."); + + if (!FileService.RenameFile(project.FileName, newFileName, false)) { return; } if (project.AssemblyName == project.Name) project.AssemblyName = newName; - FileService.RenameFile(project.FileName, newFileName, false); if (File.Exists(project.FileName + ".user")) FileService.RenameFile(project.FileName + ".user", newFileName + ".user", false); foreach (IProject p in ProjectService.OpenSolution.Projects) { diff --git a/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/SolutionItemNode.cs b/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/SolutionItemNode.cs index 21d4cbf95f..f192c15351 100644 --- a/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/SolutionItemNode.cs +++ b/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/SolutionItemNode.cs @@ -128,7 +128,9 @@ namespace ICSharpCode.SharpDevelop.Project } string newFileName = Path.Combine(Path.GetDirectoryName(this.FileName), newName); - FileService.RenameFile(this.FileName, newFileName, false); + if (!FileService.RenameFile(this.FileName, newFileName, false)) { + return; + } solution.Save(); } public override object AcceptVisitor(ProjectBrowserTreeNodeVisitor visitor, object data) diff --git a/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/SolutionNode.cs b/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/SolutionNode.cs index c240b21ec1..d605bb6f97 100644 --- a/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/SolutionNode.cs +++ b/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/SolutionNode.cs @@ -60,11 +60,9 @@ namespace ICSharpCode.SharpDevelop.Project if (!FileService.CheckFileName(newName)) return; string newFileName = Path.Combine(solution.Directory, newName + ".sln"); - if (File.Exists(newFileName)) { - MessageService.ShowErrorFormatted("${res:Global.FileAlreadyExists}", newFileName); + if (!FileService.RenameFile(solution.FileName, newFileName, false)) { return; } - FileService.RenameFile(solution.FileName, newFileName, false); solution.FileName = newFileName; solution.Name = newName; } finally { diff --git a/src/Main/Base/Project/Src/Services/File/FileService.cs b/src/Main/Base/Project/Src/Services/File/FileService.cs index d18e3a3902..6624b43ccf 100644 --- a/src/Main/Base/Project/Src/Services/File/FileService.cs +++ b/src/Main/Base/Project/Src/Services/File/FileService.cs @@ -192,14 +192,20 @@ namespace ICSharpCode.Core return false; if (!eargs.OperationAlreadyDone) { try { - if (isDirectory) { - if (Directory.Exists(oldName)) { - Directory.Move(oldName, newName); + if (isDirectory && Directory.Exists(oldName)) { + + if (Directory.Exists(newName)) { + MessageService.ShowMessage(StringParser.Parse("${res:Gui.ProjectBrowser.FileInUseError}")); + return false; } - } else { - if (File.Exists(oldName)) { - File.Move(oldName, newName); + Directory.Move(oldName, newName); + + } else if (File.Exists(oldName)) { + if (File.Exists(newName)) { + MessageService.ShowMessage(StringParser.Parse("${res:Gui.ProjectBrowser.FileInUseError}")); + return false; } + File.Move(oldName, newName); } } catch (Exception e) { if (isDirectory) { From 8de7aa21a4719275434990b9d6d3c36513cae9cc Mon Sep 17 00:00:00 2001 From: Peter Forstmeier Date: Sun, 25 Jun 2006 18:13:27 +0000 Subject: [PATCH 03/22] fixed git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1519 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Printing/Text/DefaultFormatter.cs | 200 ++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100644 src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/DefaultFormatter.cs diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/DefaultFormatter.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/DefaultFormatter.cs new file mode 100644 index 0000000000..e979b225dd --- /dev/null +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/DefaultFormatter.cs @@ -0,0 +1,200 @@ +// +// SharpDevelop ReportEditor +// +// Copyright (C) 2005 Peter Forstmeier +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Peter Forstmeier (Peter.Forstmeier@t-online.de) +using System; +using System.Globalization; +//using System.Windows.Forms; + +/// +/// This Class handles the formatting of Output Values depending on there +/// Type and DbValue +/// +/// +/// created by - Forstmeier Peter +/// created on - 30.03.2005 09:14:20 +/// +namespace SharpReportCore{ + public class DefaultFormatter : object { + + + public DefaultFormatter() { + } + public string FormatItem (string stringToFormat,string formatString, string dataType){ + string retValue = String.Empty; + switch (dataType) { + + case "System.DateTime" : + retValue = DateValues(stringToFormat,formatString); + break; + + case "System.Int16": + retValue = IntegerValues ("16",stringToFormat,formatString); + break; + + case "System.Int32" : + retValue = IntegerValues ("32",stringToFormat,formatString); + break; + case "System.Decimal": + retValue = DecimalValues (stringToFormat,formatString); + break; + + case "System.Boolean": + retValue = BoolValue (stringToFormat,formatString); + break; + default: + retValue = stringToFormat; + break; + } + return retValue; + } + + ///Looks witch formatting Class to use, call the approbiate formatter + /// and update the DbValue with the formatted String value + /// + ///A ReportDataItem + + public string FormatItem (BaseDataItem item) { + + if (item == null) { + throw new ArgumentNullException("item"); + } + return this.FormatItem(item.DbValue,item.FormatString,item.DataType); + + } + + public string BoolValue (string toFormat, string format){ + string str = String.Empty; + if (DefaultFormatter.CheckFormat(format) == true) { + + if (DefaultFormatter.CheckValue (toFormat)) { + try { + bool b = bool.Parse (toFormat); + str = b.ToString (CultureInfo.CurrentCulture); + + } catch (System.FormatException) { +// string s = String.Format("\tBool Value < {0} > {1}",toFormat,e.Message); +// System.Console.WriteLine("\t\t{0}",s); + } + } + } else { + str = toFormat; + } + return str; + } + + public string IntegerValues(string valueType,string toFormat, string format) { + string str = String.Empty; + if (DefaultFormatter.CheckFormat(format) == true) { + if (DefaultFormatter.CheckValue (toFormat)) { + try { + int number; + switch (valueType) { + case "16": + number = Int16.Parse (toFormat, + System.Globalization.NumberStyles.Any, + CultureInfo.CurrentCulture.NumberFormat); + break; + case "32" : + number = Int32.Parse (toFormat, + System.Globalization.NumberStyles.Any, + CultureInfo.CurrentCulture.NumberFormat); + break; + default: + throw new ArgumentException("DefaultFormater:IntegerValues Unknown intType "); + + } + str = number.ToString (format,CultureInfo.CurrentCulture); + + } catch (System.FormatException) { +// string s = String.Format("\tDecimalValue < {0} > {1}",toFormat,e.Message); +// System.Console.WriteLine("\t{0}",s); + } + return str; + } else { + str = (0.0M).ToString(CultureInfo.CurrentCulture); + } + + } else { + str = toFormat; + } + return str; + } + + public string DecimalValues(string toFormat, string format) { + string str = String.Empty; + if (DefaultFormatter.CheckFormat(format) == true) { + + if (DefaultFormatter.CheckValue (toFormat)) { + try { + decimal dec = Decimal.Parse(toFormat, + System.Globalization.NumberStyles.Any, + CultureInfo.CurrentCulture.NumberFormat); + str = dec.ToString (format,CultureInfo.CurrentCulture); + + } catch (System.FormatException) { +// string s = String.Format("\tDecimalValue < {0} > {1}",toFormat,e.Message); +// System.Console.WriteLine("\t{0}",s); + } + return str; + } else { + str = (0.0M).ToString(CultureInfo.CurrentCulture); + } + + } else { + str = toFormat; + } + return str; + } + + public string DateValues(string toFormat, string format) { + + if (DefaultFormatter.CheckFormat(format) == true) { + try { + DateTime date = DateTime.Parse (toFormat, + CultureInfo.CurrentCulture); + string str = date.ToString(format, + DateTimeFormatInfo.CurrentInfo); + + return str.Trim(); + } catch (System.FormatException) { +// string s = String.Format("< {0} > {1}",toFormat,e.Message); +// System.Console.WriteLine("\t\tDateValue {0}",s); + } + } else { + return toFormat.Trim(); + } + return toFormat.Trim(); + } + + private static bool CheckFormat (string format) { + if (String.IsNullOrEmpty(format)) { + return false; + } + return true; + } + + private static bool CheckValue (string toFormat) { + if (String.IsNullOrEmpty(toFormat)) { + return false; + } + return true; + } + } +} From 4db9d290f851f537809a1598483336b40d8487c8 Mon Sep 17 00:00:00 2001 From: Peter Forstmeier Date: Mon, 26 Jun 2006 07:55:40 +0000 Subject: [PATCH 04/22] Cleanup unused Files git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1520 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Printing/AbstractRenderer.cs | 6 +- .../Printing/Formatter/AbstractFormatter.cs | 55 --------------- .../StandartFormatter.cs} | 69 +++++++++---------- .../SharpReportCore/SharpReportCore.csproj | 1 + 4 files changed, 37 insertions(+), 94 deletions(-) delete mode 100644 src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Formatter/AbstractFormatter.cs rename src/AddIns/Misc/SharpReport/SharpReportCore/Printing/{Formatter/DefaultFormatter.cs => Text/StandartFormatter.cs} (74%) diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs index 886a31c686..6531e6e8c8 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs @@ -37,7 +37,7 @@ namespace SharpReportCore { private Point detailStart; private Point detailEnds; - private DefaultFormatter defaultFormatter; + private StandartFormatter standartFormatter; private bool cancel; public event EventHandler SectionRendering; @@ -50,7 +50,7 @@ namespace SharpReportCore { this.reportSettings = model.ReportSettings; this.sections = model.SectionCollection; Init(); - defaultFormatter = new DefaultFormatter(); + standartFormatter = new StandartFormatter(); } public virtual void SetupRenderer () { @@ -308,7 +308,7 @@ namespace SharpReportCore { if (baseDataItem != null) { if (!String.IsNullOrEmpty(baseDataItem.FormatString)) { - rpea.FormatedValue = defaultFormatter.FormatItem (baseDataItem); + rpea.FormatedValue = standartFormatter.FormatItem (baseDataItem); } else { rpea.FormatedValue = rpea.ValueToFormat; } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Formatter/AbstractFormatter.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Formatter/AbstractFormatter.cs deleted file mode 100644 index f0faa0858e..0000000000 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Formatter/AbstractFormatter.cs +++ /dev/null @@ -1,55 +0,0 @@ - -// -// SharpDevelop ReportEditor -// -// Copyright (C) 2005 Peter Forstmeier -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// Peter Forstmeier (Peter.Forstmeier@t-online.de) - -using System; - - /// - /// Base Class for all Formatters - /// - /// - /// created by - Forstmeier Peter - /// created on - 27.03.2005 18:09:29 - /// -namespace SharpReportCore { - public class AbstractFormatter : object { - - /// - /// Default constructor - initializes all fields to default values - /// - public AbstractFormatter() { - } - - protected bool CheckFormat (string format) { - if (String.IsNullOrEmpty(format)) { - return false; - } - return true; - } - - protected bool CheckValue (string toFormat) { - if (String.IsNullOrEmpty(toFormat)) { - return false; - } - return true; - } - } -} diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Formatter/DefaultFormatter.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/StandartFormatter.cs similarity index 74% rename from src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Formatter/DefaultFormatter.cs rename to src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/StandartFormatter.cs index d1763096ce..ed0d9da8c1 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Formatter/DefaultFormatter.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/StandartFormatter.cs @@ -1,40 +1,23 @@ -// -// SharpDevelop ReportEditor -// -// Copyright (C) 2005 Peter Forstmeier -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// Peter Forstmeier (Peter.Forstmeier@t-online.de) +/* + * Created by SharpDevelop. + * User: Forstmeier Peter + * Date: 26.06.2006 + * Time: 09:42 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ + using System; using System.Globalization; -//using System.Windows.Forms; - /// /// This Class handles the formatting of Output Values depending on there /// Type and DbValue /// -/// -/// created by - Forstmeier Peter -/// created on - 30.03.2005 09:14:20 -/// -namespace SharpReportCore{ - public class DefaultFormatter : AbstractFormatter { +namespace SharpReportCore { + public class StandartFormatter : object { - public DefaultFormatter() { + public StandartFormatter() { } ///Looks witch formatting Class to use, call the approbiate formatter @@ -78,9 +61,9 @@ namespace SharpReportCore{ public string BoolValue (string toFormat, string format){ string str = String.Empty; - if (base.CheckFormat(format) == true) { + if (StandartFormatter.CheckFormat(format) == true) { - if (base.CheckValue (toFormat)) { + if (StandartFormatter.CheckValue (toFormat)) { try { bool b = bool.Parse (toFormat); str = b.ToString (CultureInfo.CurrentCulture); @@ -98,8 +81,8 @@ namespace SharpReportCore{ public string IntegerValues(string valueType,string toFormat, string format) { string str = String.Empty; - if (base.CheckFormat(format) == true) { - if (base.CheckValue (toFormat)) { + if (StandartFormatter.CheckFormat(format) == true) { + if (StandartFormatter.CheckValue (toFormat)) { try { int number; switch (valueType) { @@ -136,9 +119,9 @@ namespace SharpReportCore{ public string DecimalValues(string toFormat, string format) { string str = String.Empty; - if (base.CheckFormat(format) == true) { + if (StandartFormatter.CheckFormat(format) == true) { - if (base.CheckValue (toFormat)) { + if (StandartFormatter.CheckValue (toFormat)) { try { decimal dec = Decimal.Parse(toFormat, System.Globalization.NumberStyles.Any, @@ -162,7 +145,7 @@ namespace SharpReportCore{ public string DateValues(string toFormat, string format) { - if (base.CheckFormat(format) == true) { + if (StandartFormatter.CheckFormat(format) == true) { try { DateTime date = DateTime.Parse (toFormat.Trim(), CultureInfo.CurrentCulture.DateTimeFormat); @@ -179,5 +162,19 @@ namespace SharpReportCore{ } return toFormat.Trim(); } + + private static bool CheckFormat (string format) { + if (String.IsNullOrEmpty(format)) { + return false; + } + return true; + } + + private static bool CheckValue (string toFormat) { + if (String.IsNullOrEmpty(toFormat)) { + return false; + } + return true; + } } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj index 8623c3adb3..f876df77b2 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj @@ -132,6 +132,7 @@ + From 63e20cbdbe2d8d43f7889447906516ad5a4064a7 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Tue, 27 Jun 2006 14:26:48 +0000 Subject: [PATCH 05/22] Fixed SD2-886: Converted VS2003 solution does not show correct configurations git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1522 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Project/Src/Parser/CSharp/cs.ATG | 2 +- .../Project/Src/Project/Solution/Solution.cs | 56 ++++++++++++++++++- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG b/src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG index 2fccc15821..4fe3666c04 100644 --- a/src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG +++ b/src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG @@ -1886,7 +1886,7 @@ EmbeddedStatement (statement as IfElseStatement).ElseIfSections.AddRange((elseStatement as IfElseStatement).ElseIfSections); (statement as IfElseStatement).FalseStatement = (elseStatement as IfElseStatement).FalseStatement; } .) - | "switch" (. List switchSections = new List(); SwitchSection switchSection; .) + | "switch" (. List switchSections = new List(); .) "(" Expr ")" "{" SwitchSections "}" (. statement = new SwitchStatement(expr, switchSections); .) diff --git a/src/Main/Base/Project/Src/Project/Solution/Solution.cs b/src/Main/Base/Project/Src/Project/Solution/Solution.cs index a34d983a5c..c5543f45f2 100644 --- a/src/Main/Base/Project/Src/Project/Solution/Solution.cs +++ b/src/Main/Base/Project/Src/Project/Solution/Solution.cs @@ -496,12 +496,21 @@ namespace ICSharpCode.SharpDevelop.Project public ProjectSection GetSolutionConfigurationsSection() { - foreach (ProjectSection sec in Sections) { + foreach (ProjectSection sec in this.Sections) { if (sec.Name == "SolutionConfigurationPlatforms") return sec; } ProjectSection newSec = new ProjectSection("SolutionConfigurationPlatforms", "preSolution"); - Sections.Insert(0, newSec); + this.Sections.Insert(0, newSec); + foreach (ProjectSection sec in this.Sections) { + if (sec.Name == "SolutionConfiguration") { + this.Sections.Remove(sec); + foreach (SolutionItem item in sec.Items) { + newSec.Items.Add(new SolutionItem(item.Name + "|Any CPU", item.Location + "|Any CPU")); + } + break; + } + } return newSec; } @@ -513,6 +522,49 @@ namespace ICSharpCode.SharpDevelop.Project } ProjectSection newSec = new ProjectSection("ProjectConfigurationPlatforms", "postSolution"); Sections.Add(newSec); + foreach (ProjectSection sec in this.Sections) { + if (sec.Name == "ProjectConfiguration") { + this.Sections.Remove(sec); + foreach (SolutionItem item in sec.Items) { + string name = item.Name; + string location = item.Location; + if (!name.Contains("|")) { + int pos = name.LastIndexOf('.'); + if (pos > 0) { + string firstpart = name.Substring(0, pos); + string lastpart = name.Substring(pos); + if (lastpart == ".0") { + pos = firstpart.LastIndexOf('.'); + if (pos > 0) { + lastpart = name.Substring(pos); + firstpart = name.Substring(0, pos); + } + } + name = firstpart + "|Any CPU" + lastpart; + } + + pos = location.LastIndexOf('|'); + if (pos < 0) { + location += "|Any CPU"; + } else { + string platform = location.Substring(pos+1); + bool found = false; + foreach (IProject p in this.Projects) { + if (p.GetPlatformNames().Contains(platform)) { + found = true; + break; + } + } + if (!found) { + location = location.Substring(0, pos) + "|Any CPU"; + } + } + } + newSec.Items.Add(new SolutionItem(name, location)); + } + break; + } + } return newSec; } From b69e3277b20f4c32537f223639a4a05d4ce5c4a0 Mon Sep 17 00:00:00 2001 From: Peter Forstmeier Date: Tue, 27 Jun 2006 21:45:00 +0000 Subject: [PATCH 06/22] Fixed http://community.sharpdevelop.net/forums/thread/9098.aspx and broken build as well git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1523 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../BaseClasses/DataTypeHelper.cs | 81 ++++++++ .../SharpReportCore/BaseItems/BaseDataItem.cs | 14 +- .../SharpReportCore/BaseItems/BaseFunction.cs | 3 +- .../BaseItems/BaseReportItem.cs | 18 +- .../SharpReportCore/BaseItems/BaseTextItem.cs | 20 +- .../BaseItems/Functions/BasePageNumber.cs | 21 +- .../BaseItems/Functions/BaseToday.cs | 53 +++-- .../Printing/AbstractDataRenderer.cs | 2 +- .../Printing/AbstractRenderer.cs | 18 +- .../Printing/RenderDataReport.cs | 2 +- .../Printing/Text/StandartFormatter.cs | 190 ++++++++---------- .../SharpReportCore/SharpReportCore.csproj | 3 +- 12 files changed, 245 insertions(+), 180 deletions(-) create mode 100644 src/AddIns/Misc/SharpReport/SharpReportCore/BaseClasses/DataTypeHelper.cs diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseClasses/DataTypeHelper.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseClasses/DataTypeHelper.cs new file mode 100644 index 0000000000..01e4ffc5e6 --- /dev/null +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseClasses/DataTypeHelper.cs @@ -0,0 +1,81 @@ +/* + * Created by SharpDevelop. + * User: Forstmeier Helmut + * Date: 27.06.2006 + * Time: 09:12 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ + +using System; + +namespace SharpReportCore +{ + /// + /// Description of DataType. + /// + internal class DataTypeHelper{ + + //TODO why not use + // TypeCode tc = Type.GetTypeCode( Type.GetType("System.String")); + + internal static TypeCode TypeCodeFromString (string type) { + TypeCode tc; + + if (type == null) { + type = "System.String"; + } + + if (type.StartsWith("System.")){ + type = type.Substring(7); + } + + switch (type){ + case "DateTime": + tc = TypeCode.DateTime; + break; + + case "Boolean": + tc = TypeCode.Boolean; + break; + + + case "String": + case "Char": + tc = TypeCode.String; + break; + + case "Decimal": + tc = TypeCode.Decimal; + break; + case "Integer": + case "Int16": + case "Int32": + tc = TypeCode.Int32; + break; + case "Float": + case "Single": + case "Double": + tc = TypeCode.Double; + break; + + default: + tc = TypeCode.Object; + break; + } + return tc; + } + + static internal bool IsNumber(TypeCode tc){ + + switch (tc){ + case TypeCode.Int32: + case TypeCode.Double: + case TypeCode.Decimal: + return true; + default: // user error + return false; + } + } + } +} diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseDataItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseDataItem.cs index c05ff37e96..647d0832d9 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseDataItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseDataItem.cs @@ -33,13 +33,16 @@ namespace SharpReportCore { private string dataType; private string nullValue; + #region Constructor public BaseDataItem():base() { + this.dataType = "System.String"; } public BaseDataItem(string columnName):base(){ this.columnName = columnName; + this.dataType = "System.String"; } #endregion @@ -63,12 +66,17 @@ namespace SharpReportCore { public override void Render(SharpReportCore.ReportPageEventArgs rpea) { - // this.DbValue is formatted in the BeforePrintEvent catched in AbstractRenderer +// TypeCode tc = Type.GetTypeCode( Type.GetType(this.dataType)); + + // TODO this.DbValue should beformatted in the BeforePrintEvent string toPrint = CheckForNullValue(); - base.Text = base.FireFormatOutput(toPrint,this.FormatString,""); -// System.Console.WriteLine("\tBaseDataItem <{0}> / <{1}>",this.Name,this.Text); + + base.Text = base.FormatOutput(toPrint, + this.FormatString, + DataTypeHelper.TypeCodeFromString (this.dataType), + this.nullValue); base.Render (rpea); } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseFunction.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseFunction.cs index 8ce9328e4e..6cb1046b1e 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseFunction.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseFunction.cs @@ -26,6 +26,7 @@ namespace SharpReportCore { public BaseFunction():base() { this.localisedName = "SharpReport.Toolbar.Functions"; } + public BaseFunction(string friendlyName) { this.localisedName = friendlyName; @@ -38,7 +39,7 @@ namespace SharpReportCore { #region properties - + [Browsable(false)] public string LocalisedName { get { return localisedName; diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseReportItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseReportItem.cs index fd9992fc38..a5315721cf 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseReportItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseReportItem.cs @@ -31,7 +31,7 @@ namespace SharpReportCore { public event EventHandler ItemPrinting; public event EventHandler ItemPrinted; - public event EventHandler FormatOutput; +// public event EventHandler FormatOutput; public event EventHandler Disposed; public BaseReportItem() :base(){ @@ -46,14 +46,14 @@ namespace SharpReportCore { /// the formatString /// Value to return when there is null in toFormat /// - protected string FireFormatOutput(string toFormat,string format, string nullValue) { - if (FormatOutput != null) { - FormatOutputEventArgs ea = new FormatOutputEventArgs (toFormat, - format, - nullValue); - FormatOutput (this,ea); - return ea.FormatedValue; - } + protected string old_FireFormatOutput(string toFormat,string format, string nullValue) { +// if (FormatOutput != null) { +// FormatOutputEventArgs ea = new FormatOutputEventArgs (toFormat, +// format, +// nullValue); +// FormatOutput (this,ea); +// return ea.FormatedValue; +// } return toFormat; } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs index bfaf0c8399..bfe18ba428 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs @@ -28,20 +28,30 @@ namespace SharpReportCore { private string formatString = String.Empty; private StringFormat stringFormat; private StringTrimming stringTrimming; - private TextDrawer textDrawer = new TextDrawer(); + private TextDrawer textDrawer; + private StandardFormatter standartFormatter; private ContentAlignment contentAlignment; private RectangleShape shape = new RectangleShape(); #region Constructor public BaseTextItem():base() { - this.stringFormat = StringFormat.GenericTypographic; - this.contentAlignment = ContentAlignment.MiddleLeft; - this.stringTrimming = StringTrimming.EllipsisCharacter; + this.stringFormat = StringFormat.GenericTypographic; + this.contentAlignment = ContentAlignment.MiddleLeft; + this.stringTrimming = StringTrimming.EllipsisCharacter; + this.textDrawer = new TextDrawer(); + this.standartFormatter = new StandardFormatter(); } #endregion + protected string FormatOutput(string valueToFormat,string formatString, + TypeCode typeCode, string nullValue ){ + + return standartFormatter.FormatItem(valueToFormat,formatString, + typeCode,nullValue); + } + public override void Render(ReportPageEventArgs rpea) { @@ -164,7 +174,7 @@ namespace SharpReportCore { } [Category("Appearance")] - public System.Drawing.ContentAlignment ContentAlignment { + public virtual System.Drawing.ContentAlignment ContentAlignment { get { return this.contentAlignment; } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BasePageNumber.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BasePageNumber.cs index 3970b77d41..2deb38a81a 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BasePageNumber.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BasePageNumber.cs @@ -33,10 +33,11 @@ namespace SharpReportCore { public override void Render(ReportPageEventArgs rpea) { base.Render(rpea); - string formattedString = base.FireFormatOutput(rpea.PageNumber.ToString(CultureInfo.InvariantCulture), - base.FormatString,""); + string formattedString = base.FormatOutput(rpea.PageNumber.ToString(CultureInfo.InvariantCulture), + this.FormatString, + TypeCode.Int32, + "xxxx"); - RectangleF rect = base.PrepareRectangle (rpea,formattedString); //Printout the textpart base.PrintTheStuff (rpea,this.Text,rect); @@ -44,13 +45,13 @@ namespace SharpReportCore { StringFormat fmt = StringFormat; fmt.Alignment = StringAlignment.Far; - fmt.LineAlignment = StringAlignment.Near; - rpea.PrintPageEventArgs.Graphics.DrawString(rpea.PageNumber.ToString(CultureInfo.InvariantCulture), - this.Font, - Brushes.Black, - rect, - fmt); - + fmt.LineAlignment = StringAlignment.Center; + + rpea.PrintPageEventArgs.Graphics.DrawString(formattedString, + this.Font, + Brushes.Black, + rect, + fmt); base.NotiyfyAfterPrint (rpea.LocationAfterDraw); } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BaseToday.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BaseToday.cs index 8401c81d3f..9ffd5284eb 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BaseToday.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BaseToday.cs @@ -9,6 +9,7 @@ //------------------------------------------------------------------------------ using System; using System.Drawing; +using System.ComponentModel; using System.Globalization; /// /// BaseClass for Today's Date @@ -28,9 +29,17 @@ namespace SharpReportCore { public override void Render(ReportPageEventArgs rpea) { base.Render(rpea); - - string formattedString = FormatAsDate(System.DateTime.Now.ToString(),base.FormatString); + string f; + if (String.IsNullOrEmpty(this.FormatString)) { + f = "d"; + } else { + f = this.FormatString; + } + string formattedString = base.FormatOutput(System.DateTime.Now.ToString(CultureInfo.CurrentCulture), + f, + TypeCode.DateTime, + ""); RectangleF rect = base.PrepareRectangle (rpea,formattedString); //Printout the textPart @@ -39,42 +48,30 @@ namespace SharpReportCore { //here we print the functionpart allway's with Stringalignment.Far StringFormat fmt = StringFormat; fmt.Alignment = StringAlignment.Far; - fmt.LineAlignment = StringAlignment.Near; - + fmt.LineAlignment = StringAlignment.Center; rpea.PrintPageEventArgs.Graphics.DrawString(formattedString, - this.Font, - Brushes.Black, - rect, - fmt); + this.Font, + Brushes.Black, + rect, + fmt); - // goon + // goon base.NotiyfyAfterPrint (rpea.LocationAfterDraw); } public override string ToString() { return "BaseToday"; } - - - #region privates - private string FormatAsDate (string toFormat,string formatWith) { - if (toFormat.Length == 0) { - return String.Empty; - } - if (formatWith.Length == 0) { - return toFormat; + + [Browsable(false)] + public override ContentAlignment ContentAlignment { + get { + return base.ContentAlignment; } - try { - DateTime date = DateTime.Parse (toFormat.Trim(), - CultureInfo.CurrentCulture.DateTimeFormat); - string str = date.ToString(formatWith, - DateTimeFormatInfo.CurrentInfo); - return str; - } catch (Exception) { - throw; + set { + base.ContentAlignment = value; } - } - #endregion + } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractDataRenderer.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractDataRenderer.cs index d1875d244f..12e01a693b 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractDataRenderer.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractDataRenderer.cs @@ -72,7 +72,7 @@ namespace SharpReportCore{ item.Parent = section; } item.SectionOffset = section.SectionOffset; - base.DrawSingleItem (rpea,item); + item.Render(rpea); drawPoint.Y = section.SectionOffset + section.Size.Height; rpea.LocationAfterDraw = new PointF (rpea.LocationAfterDraw.X,section.SectionOffset + section.Size.Height); diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs index 6531e6e8c8..0c84356c1d 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs @@ -37,7 +37,7 @@ namespace SharpReportCore { private Point detailStart; private Point detailEnds; - private StandartFormatter standartFormatter; + private StandardFormatter standartFormatter; private bool cancel; public event EventHandler SectionRendering; @@ -50,7 +50,7 @@ namespace SharpReportCore { this.reportSettings = model.ReportSettings; this.sections = model.SectionCollection; Init(); - standartFormatter = new StandartFormatter(); + standartFormatter = new StandardFormatter(); } public virtual void SetupRenderer () { @@ -276,8 +276,7 @@ namespace SharpReportCore { item.Parent = this.CurrentSection; } item.SectionOffset = this.CurrentSection.SectionOffset; - this.DrawSingleItem (rpea,item); - + item.Render(rpea); drawPoint.Y = this.CurrentSection.SectionOffset + this.CurrentSection.Size.Height; rpea.LocationAfterDraw = new PointF (rpea.LocationAfterDraw.X,this.CurrentSection.SectionOffset + this.CurrentSection.Size.Height); @@ -292,16 +291,9 @@ namespace SharpReportCore { return drawPoint.Y; } - - protected void DrawSingleItem (ReportPageEventArgs rpea,BaseReportItem item){ - item.SuspendLayout(); - item.FormatOutput -= new EventHandler (FormatBaseReportItem); - item.FormatOutput += new EventHandler (FormatBaseReportItem); - item.Render(rpea); - item.ResumeLayout(); - } // Called by FormatOutPutEvent of the BaseReportItem + /* void FormatBaseReportItem (object sender, FormatOutputEventArgs rpea) { BaseDataItem baseDataItem = sender as BaseDataItem; @@ -314,7 +306,7 @@ namespace SharpReportCore { } } } - + */ #region privates protected void FitSectionToItems (BaseSection section,ReportPageEventArgs rpea){ diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs index df7802fd5b..417b8208db 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs @@ -131,7 +131,7 @@ namespace SharpReportCore { } protected override void PrintReportFooter(object sender, ReportPageEventArgs rpea){ - System.Console.WriteLine("DataRenderer:PrintReportFooter"); +// System.Console.WriteLine("DataRenderer:PrintReportFooter"); base.PrintReportFooter(sender, rpea); DoReportFooter (new PointF(0,base.CurrentSection.SectionOffset + base.CurrentSection.Size.Height), rpea); diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/StandartFormatter.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/StandartFormatter.cs index ed0d9da8c1..3bf3be953a 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/StandartFormatter.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/StandartFormatter.cs @@ -14,162 +14,138 @@ using System.Globalization; /// Type and DbValue /// namespace SharpReportCore { - public class StandartFormatter : object { + + public class StandardFormatter : object { - public StandartFormatter() { + public StandardFormatter() { } - ///Looks witch formatting Class to use, call the approbiate formatter - /// and update the DbValue with the formatted String value - /// - ///A ReportDataItem - /// - public string FormatItem (BaseDataItem item) { + public string FormatItem (string valueToFormat,string formatString, + TypeCode typeCode,string nullValue) { + string retValue = String.Empty; - if (item == null) { - throw new ArgumentNullException("item"); + if (String.IsNullOrEmpty(formatString)) { + retValue = valueToFormat; + return retValue; } - string retValue = String.Empty; - switch (item.DataType) { - - case "System.DateTime" : - retValue = DateValues(item.DbValue,item.FormatString); + switch (typeCode) { + case TypeCode.Int16: + case TypeCode.Int32: + retValue = IntegerValues (valueToFormat,formatString); break; - - case "System.Int16": - retValue = IntegerValues ("16",item.DbValue,item.FormatString); + case TypeCode.DateTime: + retValue = DateValues(valueToFormat,formatString); break; - - case "System.Int32" : - retValue = IntegerValues ("32",item.DbValue,item.FormatString); + case TypeCode.Boolean: + retValue = BoolValue (valueToFormat,formatString); break; - case "System.Decimal": - retValue = DecimalValues (item.DbValue,item.FormatString); + case TypeCode.Decimal: + retValue = DecimalValues (valueToFormat,formatString); break; - - case "System.Boolean": - retValue = BoolValue (item.DbValue,item.FormatString); + + case TypeCode.Double: + case TypeCode.Single: + break; + + case TypeCode.String: + case TypeCode.Char: + retValue = valueToFormat; break; default: - retValue = item.DbValue; + retValue = valueToFormat; break; } + return retValue; } + + + ///Looks witch formatting Class to use, call the approbiate formatter + /// and update the DbValue with the formatted String value + /// + ///A ReportDataItem + /// + public string FormatItem (BaseDataItem item) { + + if (item == null) { + throw new ArgumentNullException("item"); + } + return FormatItem(item.DbValue,item.FormatString, + Type.GetTypeCode( Type.GetType(item.DataType)), + item.NullValue); + + } - public string BoolValue (string toFormat, string format){ + private string BoolValue (string toFormat, string format){ string str = String.Empty; - if (StandartFormatter.CheckFormat(format) == true) { - - if (StandartFormatter.CheckValue (toFormat)) { - try { - bool b = bool.Parse (toFormat); - str = b.ToString (CultureInfo.CurrentCulture); - - } catch (System.FormatException) { + try { + bool b = bool.Parse (toFormat); + str = b.ToString (CultureInfo.CurrentCulture); + } catch (System.FormatException) { // string s = String.Format("\tBool Value < {0} > {1}",toFormat,e.Message); // System.Console.WriteLine("\t\t{0}",s); - } - } - } else { - str = toFormat; } return str; } - public string IntegerValues(string valueType,string toFormat, string format) { + private string IntegerValues(string toFormat, string format) { string str = String.Empty; - if (StandartFormatter.CheckFormat(format) == true) { - if (StandartFormatter.CheckValue (toFormat)) { - try { - int number; - switch (valueType) { - case "16": - number = Int16.Parse (toFormat, - System.Globalization.NumberStyles.Any, - CultureInfo.CurrentCulture.NumberFormat); - break; - case "32" : - number = Int32.Parse (toFormat, - System.Globalization.NumberStyles.Any, - CultureInfo.CurrentCulture.NumberFormat); - break; - default: - throw new ArgumentException("DefaultFormater:IntegerValues Unknown intType "); - - } - str = number.ToString (format,CultureInfo.CurrentCulture); - - } catch (System.FormatException) { + if (StandardFormatter.CheckValue (toFormat)) { + try { + int number = Int32.Parse (toFormat, + System.Globalization.NumberStyles.Any, + CultureInfo.CurrentCulture.NumberFormat); + + str = number.ToString (format,CultureInfo.CurrentCulture); + } catch (System.FormatException) { // string s = String.Format("\tDecimalValue < {0} > {1}",toFormat,e.Message); // System.Console.WriteLine("\t{0}",s); - } - return str; - } else { - str = (0.0M).ToString(CultureInfo.CurrentCulture); } - + return str; } else { - str = toFormat; + str = (0.0M).ToString(CultureInfo.CurrentCulture); } return str; } - public string DecimalValues(string toFormat, string format) { + private string DecimalValues(string toFormat, string format) { string str = String.Empty; - if (StandartFormatter.CheckFormat(format) == true) { - - if (StandartFormatter.CheckValue (toFormat)) { - try { - decimal dec = Decimal.Parse(toFormat, - System.Globalization.NumberStyles.Any, - CultureInfo.CurrentCulture.NumberFormat); - str = dec.ToString (format,CultureInfo.CurrentCulture); - - } catch (System.FormatException) { + if (StandardFormatter.CheckValue (toFormat)) { + try { + decimal dec = Decimal.Parse(toFormat, + System.Globalization.NumberStyles.Any, + CultureInfo.CurrentCulture.NumberFormat); + str = dec.ToString (format,CultureInfo.CurrentCulture); + + } catch (System.FormatException) { // string s = String.Format("\tDecimalValue < {0} > {1}",toFormat,e.Message); // System.Console.WriteLine("\t{0}",s); - } - return str; - } else { - str = (0.0M).ToString(CultureInfo.CurrentCulture); } - + return str; } else { - str = toFormat; + str = (0.0M).ToString(CultureInfo.CurrentCulture); } return str; } - public string DateValues(string toFormat, string format) { - - if (StandartFormatter.CheckFormat(format) == true) { - try { - DateTime date = DateTime.Parse (toFormat.Trim(), - CultureInfo.CurrentCulture.DateTimeFormat); - string str = date.ToString(format, - DateTimeFormatInfo.CurrentInfo); - - return str.Trim(); - } catch (System.FormatException) { + private string DateValues(string toFormat, string format) { + try { + DateTime date = DateTime.Parse (toFormat.Trim(), + CultureInfo.CurrentCulture.DateTimeFormat); + string str = date.ToString(format, + DateTimeFormatInfo.CurrentInfo); + + return str.Trim(); + } catch (System.FormatException) { // string s = String.Format("< {0} > {1}",toFormat,e.Message); // System.Console.WriteLine("\t\tDateValue {0}",s); - } - } else { - return toFormat.Trim(); } + return toFormat.Trim(); } - private static bool CheckFormat (string format) { - if (String.IsNullOrEmpty(format)) { - return false; - } - return true; - } - private static bool CheckValue (string toFormat) { if (String.IsNullOrEmpty(toFormat)) { return false; diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj index f876df77b2..9954468a4a 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj @@ -82,8 +82,6 @@ - - @@ -133,6 +131,7 @@ + From a9efb4c6e4b5eb4c73bad64944d68039a480cf56 Mon Sep 17 00:00:00 2001 From: Peter Forstmeier Date: Tue, 27 Jun 2006 21:51:00 +0000 Subject: [PATCH 07/22] Fixed http://community.sharpdevelop.net/forums/thread/9224.aspx git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1524 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Printing/Text/DefaultFormatter.cs | 200 ------------------ ...ndartFormatter.cs => StandardFormatter.cs} | 0 2 files changed, 200 deletions(-) delete mode 100644 src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/DefaultFormatter.cs rename src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/{StandartFormatter.cs => StandardFormatter.cs} (100%) diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/DefaultFormatter.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/DefaultFormatter.cs deleted file mode 100644 index e979b225dd..0000000000 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/DefaultFormatter.cs +++ /dev/null @@ -1,200 +0,0 @@ -// -// SharpDevelop ReportEditor -// -// Copyright (C) 2005 Peter Forstmeier -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// Peter Forstmeier (Peter.Forstmeier@t-online.de) -using System; -using System.Globalization; -//using System.Windows.Forms; - -/// -/// This Class handles the formatting of Output Values depending on there -/// Type and DbValue -/// -/// -/// created by - Forstmeier Peter -/// created on - 30.03.2005 09:14:20 -/// -namespace SharpReportCore{ - public class DefaultFormatter : object { - - - public DefaultFormatter() { - } - public string FormatItem (string stringToFormat,string formatString, string dataType){ - string retValue = String.Empty; - switch (dataType) { - - case "System.DateTime" : - retValue = DateValues(stringToFormat,formatString); - break; - - case "System.Int16": - retValue = IntegerValues ("16",stringToFormat,formatString); - break; - - case "System.Int32" : - retValue = IntegerValues ("32",stringToFormat,formatString); - break; - case "System.Decimal": - retValue = DecimalValues (stringToFormat,formatString); - break; - - case "System.Boolean": - retValue = BoolValue (stringToFormat,formatString); - break; - default: - retValue = stringToFormat; - break; - } - return retValue; - } - - ///Looks witch formatting Class to use, call the approbiate formatter - /// and update the DbValue with the formatted String value - /// - ///A ReportDataItem - - public string FormatItem (BaseDataItem item) { - - if (item == null) { - throw new ArgumentNullException("item"); - } - return this.FormatItem(item.DbValue,item.FormatString,item.DataType); - - } - - public string BoolValue (string toFormat, string format){ - string str = String.Empty; - if (DefaultFormatter.CheckFormat(format) == true) { - - if (DefaultFormatter.CheckValue (toFormat)) { - try { - bool b = bool.Parse (toFormat); - str = b.ToString (CultureInfo.CurrentCulture); - - } catch (System.FormatException) { -// string s = String.Format("\tBool Value < {0} > {1}",toFormat,e.Message); -// System.Console.WriteLine("\t\t{0}",s); - } - } - } else { - str = toFormat; - } - return str; - } - - public string IntegerValues(string valueType,string toFormat, string format) { - string str = String.Empty; - if (DefaultFormatter.CheckFormat(format) == true) { - if (DefaultFormatter.CheckValue (toFormat)) { - try { - int number; - switch (valueType) { - case "16": - number = Int16.Parse (toFormat, - System.Globalization.NumberStyles.Any, - CultureInfo.CurrentCulture.NumberFormat); - break; - case "32" : - number = Int32.Parse (toFormat, - System.Globalization.NumberStyles.Any, - CultureInfo.CurrentCulture.NumberFormat); - break; - default: - throw new ArgumentException("DefaultFormater:IntegerValues Unknown intType "); - - } - str = number.ToString (format,CultureInfo.CurrentCulture); - - } catch (System.FormatException) { -// string s = String.Format("\tDecimalValue < {0} > {1}",toFormat,e.Message); -// System.Console.WriteLine("\t{0}",s); - } - return str; - } else { - str = (0.0M).ToString(CultureInfo.CurrentCulture); - } - - } else { - str = toFormat; - } - return str; - } - - public string DecimalValues(string toFormat, string format) { - string str = String.Empty; - if (DefaultFormatter.CheckFormat(format) == true) { - - if (DefaultFormatter.CheckValue (toFormat)) { - try { - decimal dec = Decimal.Parse(toFormat, - System.Globalization.NumberStyles.Any, - CultureInfo.CurrentCulture.NumberFormat); - str = dec.ToString (format,CultureInfo.CurrentCulture); - - } catch (System.FormatException) { -// string s = String.Format("\tDecimalValue < {0} > {1}",toFormat,e.Message); -// System.Console.WriteLine("\t{0}",s); - } - return str; - } else { - str = (0.0M).ToString(CultureInfo.CurrentCulture); - } - - } else { - str = toFormat; - } - return str; - } - - public string DateValues(string toFormat, string format) { - - if (DefaultFormatter.CheckFormat(format) == true) { - try { - DateTime date = DateTime.Parse (toFormat, - CultureInfo.CurrentCulture); - string str = date.ToString(format, - DateTimeFormatInfo.CurrentInfo); - - return str.Trim(); - } catch (System.FormatException) { -// string s = String.Format("< {0} > {1}",toFormat,e.Message); -// System.Console.WriteLine("\t\tDateValue {0}",s); - } - } else { - return toFormat.Trim(); - } - return toFormat.Trim(); - } - - private static bool CheckFormat (string format) { - if (String.IsNullOrEmpty(format)) { - return false; - } - return true; - } - - private static bool CheckValue (string toFormat) { - if (String.IsNullOrEmpty(toFormat)) { - return false; - } - return true; - } - } -} diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/StandartFormatter.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/StandardFormatter.cs similarity index 100% rename from src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/StandartFormatter.cs rename to src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/StandardFormatter.cs From b7f45fb928646fb73248c8350a0e76532787799d Mon Sep 17 00:00:00 2001 From: Peter Forstmeier Date: Wed, 28 Jun 2006 06:32:01 +0000 Subject: [PATCH 08/22] Hopefully fixed broken build the second time git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1525 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Misc/SharpReport/SharpReportCore/SharpReportCore.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj index 9954468a4a..818717a06b 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj @@ -130,7 +130,7 @@ - + From b42112e2a6b37a66c4257c7759246d4b8f724a8f Mon Sep 17 00:00:00 2001 From: Peter Forstmeier Date: Wed, 28 Jun 2006 07:05:28 +0000 Subject: [PATCH 09/22] Cleanup git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1527 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../BaseItems/BaseReportItem.cs | 21 ------ .../Printing/AbstractRenderer.cs | 17 ----- .../Printing/FormatOutputEventArgs.cs | 65 ------------------- .../Printing/Text/StandardFormatter.cs | 2 + .../SharpReportCore/SharpReportCore.csproj | 1 - 5 files changed, 2 insertions(+), 104 deletions(-) delete mode 100644 src/AddIns/Misc/SharpReport/SharpReportCore/Printing/FormatOutputEventArgs.cs diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseReportItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseReportItem.cs index a5315721cf..1cb2f28926 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseReportItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseReportItem.cs @@ -31,33 +31,12 @@ namespace SharpReportCore { public event EventHandler ItemPrinting; public event EventHandler ItemPrinted; -// public event EventHandler FormatOutput; public event EventHandler Disposed; public BaseReportItem() :base(){ } - #region Event's handling - /// - /// Format a string according to his datatype - /// - /// The String to Format - /// the formatString - /// Value to return when there is null in toFormat - /// - protected string old_FireFormatOutput(string toFormat,string format, string nullValue) { -// if (FormatOutput != null) { -// FormatOutputEventArgs ea = new FormatOutputEventArgs (toFormat, -// format, -// nullValue); -// FormatOutput (this,ea); -// return ea.FormatedValue; -// } - return toFormat; - } - - #endregion #region EventHandling diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs index 0c84356c1d..cd35796d84 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs @@ -291,23 +291,6 @@ namespace SharpReportCore { return drawPoint.Y; } - - // Called by FormatOutPutEvent of the BaseReportItem - /* - void FormatBaseReportItem (object sender, FormatOutputEventArgs rpea) { - BaseDataItem baseDataItem = sender as BaseDataItem; - - if (baseDataItem != null) { - if (!String.IsNullOrEmpty(baseDataItem.FormatString)) { - - rpea.FormatedValue = standartFormatter.FormatItem (baseDataItem); - } else { - rpea.FormatedValue = rpea.ValueToFormat; - } - } - } - */ - #region privates protected void FitSectionToItems (BaseSection section,ReportPageEventArgs rpea){ if (section == null) { diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/FormatOutputEventArgs.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/FormatOutputEventArgs.cs deleted file mode 100644 index 90099a7e1e..0000000000 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/FormatOutputEventArgs.cs +++ /dev/null @@ -1,65 +0,0 @@ - -// -/// -/// created by - Forstmeier Peter -/// Peter Forstmeier (Peter.Forstmeier@t-online.de) -/// created on - 12.06.2005 18:17:46 -/// - -using System; - /// - /// This Delegate is used to format the output from TextBased Items - /// -namespace SharpReportCore { - - public class FormatOutputEventArgs : System.EventArgs { - - /// - /// Default constructor - initializes all fields to default values - /// - private string format; - private string valueToFormat; - private string nullValue; - private string formatedValue; - - public FormatOutputEventArgs() { - } - - public FormatOutputEventArgs(string valueToFormat,string format, string nullValue ) - { - this.format = format; - this.nullValue = nullValue; - this.valueToFormat = valueToFormat; - } - - #region Property's - public string Format { - get { - return format; - } - } - public string NullValue { - get { - return nullValue; - } - } - public string ValueToFormat { - get { - return valueToFormat; - } - } - - public string FormatedValue { - get { - return formatedValue; - } - set { - formatedValue = value; - } - } - - - #endregion - - } -} diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/StandardFormatter.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/StandardFormatter.cs index 3bf3be953a..05880e8aa6 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/StandardFormatter.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/StandardFormatter.cs @@ -21,6 +21,8 @@ namespace SharpReportCore { public StandardFormatter() { } + //TODO why not TypeCode tc = Type.GetTypeCode( Type.GetType(this.dataType)); + public string FormatItem (string valueToFormat,string formatString, TypeCode typeCode,string nullValue) { string retValue = String.Empty; diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj index 818717a06b..eafc947feb 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj @@ -91,7 +91,6 @@ - From c24bc0e724ec56e178e6807242ce08bfb04163b2 Mon Sep 17 00:00:00 2001 From: Peter Forstmeier Date: Wed, 28 Jun 2006 07:24:22 +0000 Subject: [PATCH 10/22] Update SharpReportCore.csproj git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1529 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Misc/SharpReport/SharpReportCore/SharpReportCore.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj index eafc947feb..37c89d2618 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj @@ -148,7 +148,6 @@ - From 79831637b7c770225b4a8669aa069607bf4b8a4f Mon Sep 17 00:00:00 2001 From: Peter Forstmeier Date: Fri, 30 Jun 2006 06:44:12 +0000 Subject: [PATCH 11/22] Modified samples git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1531 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../ReportSamples/MainForm.Designer.cs | 34 ++++-- samples/SharpReport/ReportSamples/MainForm.cs | 64 ++++++++--- .../MultipageUnboundPullModel.cs | 104 ++++++++++++++++++ .../ReportSamples/ReportSamples.csproj | 2 + .../ReportSamples/SimpleUnboundPullModel.cs | 98 +++++++++++++++++ .../Unbound/MultiPageUnboundPullModel.srd | 1 + .../SharpReport/Unbound/UnboundPullModel.srd | 1 + .../Printing/AbstractRenderer.cs | 11 +- .../Printing/RenderDataReport.cs | 2 +- .../Printing/RenderFormSheetReport.cs | 46 +++++--- .../Printing/ReportDocument.cs | 1 + 11 files changed, 322 insertions(+), 42 deletions(-) create mode 100644 samples/SharpReport/ReportSamples/MultipageUnboundPullModel.cs create mode 100644 samples/SharpReport/ReportSamples/SimpleUnboundPullModel.cs create mode 100644 samples/SharpReport/Unbound/MultiPageUnboundPullModel.srd create mode 100644 samples/SharpReport/Unbound/UnboundPullModel.srd diff --git a/samples/SharpReport/ReportSamples/MainForm.Designer.cs b/samples/SharpReport/ReportSamples/MainForm.Designer.cs index eabccca6a4..dea7a1d080 100644 --- a/samples/SharpReport/ReportSamples/MainForm.Designer.cs +++ b/samples/SharpReport/ReportSamples/MainForm.Designer.cs @@ -46,9 +46,11 @@ namespace ReportSamples this.missingConnectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.pushModelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.emlpoyeesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.errorProvider1 = new System.Windows.Forms.ErrorProvider(this.components); this.unboundToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.unboundToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.unboundPullModelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.errorProvider1 = new System.Windows.Forms.ErrorProvider(this.components); + this.multipageUnboundPullModelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.errorProvider1)).BeginInit(); this.SuspendLayout(); @@ -127,14 +129,12 @@ namespace ReportSamples this.emlpoyeesToolStripMenuItem.Text = "Employees-Push"; this.emlpoyeesToolStripMenuItem.Click += new System.EventHandler(this.EmployeesPushClick); // - // errorProvider1 - // - this.errorProvider1.ContainerControl = this; - // // unboundToolStripMenuItem // this.unboundToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.unboundToolStripMenuItem1}); + this.unboundToolStripMenuItem1, + this.unboundPullModelToolStripMenuItem, + this.multipageUnboundPullModelToolStripMenuItem}); this.unboundToolStripMenuItem.Name = "unboundToolStripMenuItem"; this.unboundToolStripMenuItem.Size = new System.Drawing.Size(62, 20); this.unboundToolStripMenuItem.Text = "Unbound"; @@ -142,10 +142,28 @@ namespace ReportSamples // unboundToolStripMenuItem1 // this.unboundToolStripMenuItem1.Name = "unboundToolStripMenuItem1"; - this.unboundToolStripMenuItem1.Size = new System.Drawing.Size(152, 22); + this.unboundToolStripMenuItem1.Size = new System.Drawing.Size(218, 22); this.unboundToolStripMenuItem1.Text = "Unbound"; this.unboundToolStripMenuItem1.Click += new System.EventHandler(this.UnboundToolStripMenuItem1Click); // + // unboundPullModelToolStripMenuItem + // + this.unboundPullModelToolStripMenuItem.Name = "unboundPullModelToolStripMenuItem"; + this.unboundPullModelToolStripMenuItem.Size = new System.Drawing.Size(218, 22); + this.unboundPullModelToolStripMenuItem.Text = "UnboundPullModel"; + this.unboundPullModelToolStripMenuItem.Click += new System.EventHandler(this.UnboundPullModelToolStripMenuItemClick); + // + // errorProvider1 + // + this.errorProvider1.ContainerControl = this; + // + // multipageUnboundPullModelToolStripMenuItem + // + this.multipageUnboundPullModelToolStripMenuItem.Name = "multipageUnboundPullModelToolStripMenuItem"; + this.multipageUnboundPullModelToolStripMenuItem.Size = new System.Drawing.Size(218, 22); + this.multipageUnboundPullModelToolStripMenuItem.Text = "MultipageUnboundPullModel"; + this.multipageUnboundPullModelToolStripMenuItem.Click += new System.EventHandler(this.MultipageUnboundPullModelToolStripMenuItemClick); + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -161,6 +179,8 @@ namespace ReportSamples this.ResumeLayout(false); this.PerformLayout(); } + private System.Windows.Forms.ToolStripMenuItem multipageUnboundPullModelToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem unboundPullModelToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem unboundToolStripMenuItem1; private System.Windows.Forms.ToolStripMenuItem unboundToolStripMenuItem; private System.Windows.Forms.ErrorProvider errorProvider1; diff --git a/samples/SharpReport/ReportSamples/MainForm.cs b/samples/SharpReport/ReportSamples/MainForm.cs index 2e5ccd6bf4..a2708827ac 100644 --- a/samples/SharpReport/ReportSamples/MainForm.cs +++ b/samples/SharpReport/ReportSamples/MainForm.cs @@ -85,6 +85,7 @@ namespace ReportSamples } } + #region unbound private void OpenUnbound() { try{ OpenFileDialog dg = new OpenFileDialog(); @@ -92,8 +93,8 @@ namespace ReportSamples dg.Title = "Select a report file: "; if (dg.ShowDialog() == DialogResult.OK){ SharpReportCore.SharpReportEngine mn = new SharpReportCore.SharpReportEngine(); - mn.SectionRendering += new EventHandler(OnTestPrinting); - mn.SectionRendered += new EventHandler(OnTestPrinted); + mn.SectionRendering += new EventHandler(UnboundPrinting); + mn.SectionRendered += new EventHandler(UnboundPrinted); mn.PreviewStandartReport(dg.FileName.ToString()); } @@ -103,18 +104,19 @@ namespace ReportSamples } } - private void OnTestPrinting (object sender,SectionRenderEventArgs e) { - System.Console.WriteLine(""); - System.Console.WriteLine("--------------"); - System.Console.WriteLine("MainForm:OnTestPrinting on PageNr <{0}>",e.PageNumber); - System.Console.WriteLine("\t SectionInUse <{0}>",e.CurrentSection); - System.Console.WriteLine("\t <{0}> Items",e.Section.Items.Count); - - + private void UnboundPrinting (object sender,SectionRenderEventArgs e) { +// System.Console.WriteLine(""); +// System.Console.WriteLine("--------------"); +// System.Console.WriteLine("MainForm:OnTestPrinting <{0}> for PageNr <{1}>",e.CurrentSection,e.PageNumber); +// System.Console.WriteLine("\t <{0}> Items",e.Section.Items.Count); +// +// switch (e.CurrentSection) { case GlobalEnums.enmSection.ReportHeader: - System.Console.WriteLine("I found the ReportHeader"); + System.Console.WriteLine("\tI found the ReportHeader"); break; + + case GlobalEnums.enmSection.ReportPageHeader: BaseTextItem t = (BaseTextItem)e.Section.Items.Find("reportTextItem1"); @@ -131,13 +133,23 @@ namespace ReportSamples bb.DbValue = "Hello World"; } - System.Console.WriteLine("I found the Pageheader"); + System.Console.WriteLine("\tI found the Pageheader"); break; + case GlobalEnums.enmSection.ReportDetail: - System.Console.WriteLine("I found the ReportDetail"); + System.Console.WriteLine("\tI found the ReportDetail"); + BaseDataItem bdi = (BaseDataItem)e.Section.Items.Find("reportDbTextItem1"); + if (bdi != null) { + bdi.BackColor = Color.LightGray; + bdi.Location = new Point(200,5); + bdi.DbValue = "Unbound Field in DetailSection"; + } + + break; + case GlobalEnums.enmSection.ReportPageFooter: - System.Console.WriteLine("I found the PageFooter"); + System.Console.WriteLine("\tI found the PageFooter"); BaseReportItem b = (BaseReportItem)e.Section.Items.Find("pageNumber1"); if (b != null) { b.BackColor = Color.AliceBlue; @@ -146,21 +158,26 @@ namespace ReportSamples MessageBox.Show (s); } break; + case GlobalEnums.enmSection.ReportFooter: - System.Console.WriteLine("I found the ReportFooter"); + System.Console.WriteLine("\tI found the ReportFooter"); break; + default: - break; } System.Console.WriteLine(""); } - private void OnTestPrinted (object sender,SectionRenderEventArgs e) { - System.Console.WriteLine("MainForm:OnTestPrinted for <{0}>",e.CurrentSection); + private void UnboundPrinted (object sender,SectionRenderEventArgs e) { +// System.Console.WriteLine("MainForm:Rendering done for <{0}>",e.CurrentSection); System.Console.WriteLine("----------"); } + #endregion + + + ///Preferd Method to initialise the /// hav a look to /// @@ -275,5 +292,16 @@ namespace ReportSamples { this.OpenUnbound(); } + + void UnboundPullModelToolStripMenuItemClick(object sender, System.EventArgs e){ + SimpleUnboundPullModel sm = new SimpleUnboundPullModel(); + sm.Run(); + } + + void MultipageUnboundPullModelToolStripMenuItemClick(object sender, System.EventArgs e) + { + MultiPageUnboundPullModel mp = new MultiPageUnboundPullModel(); + mp.Run(); + } } } diff --git a/samples/SharpReport/ReportSamples/MultipageUnboundPullModel.cs b/samples/SharpReport/ReportSamples/MultipageUnboundPullModel.cs new file mode 100644 index 0000000000..55b34f25f7 --- /dev/null +++ b/samples/SharpReport/ReportSamples/MultipageUnboundPullModel.cs @@ -0,0 +1,104 @@ +/* + * Created by SharpDevelop. + * User: Forstmeier Helmut + * Date: 29.06.2006 + * Time: 13:02 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ + +using System; +using System.Windows.Forms; + +using SharpReportCore; + +namespace ReportSamples{ + /// + /// Description of MultipageUnboundPullModel. + /// + public class MultiPageUnboundPullModel{ + int rowNr; + int rowsPerPage; + int pageNr; + public MultiPageUnboundPullModel(){ + } + + public void Run() { + try{ + OpenFileDialog dg = new OpenFileDialog(); + dg.Filter = "SharpReport files|*.srd"; + dg.Title = "Select a report file: "; + if (dg.ShowDialog() == DialogResult.OK){ + SharpReportCore.SharpReportEngine mn = new SharpReportCore.SharpReportEngine(); + mn.SectionRendering += new EventHandler(MultipagePrinting); + mn.SectionRendered += new EventHandler(MultipagePrinted); + mn.PreviewStandartReport(dg.FileName.ToString()); + + } + } + catch(Exception er){ + MessageBox.Show(er.ToString(),"MainForm"); + } + } + private void MultipagePrinting (object sender,SectionRenderEventArgs e) { + System.Console.WriteLine("UnboundPullPrinting"); + CheckItems(e.Section.Items); + switch (e.CurrentSection) { + case GlobalEnums.enmSection.ReportHeader: + System.Console.WriteLine("\tI found the ReportHeader"); + break; + + case GlobalEnums.enmSection.ReportPageHeader: + + System.Console.WriteLine("\tI found the Pageheader"); + this.rowsPerPage = 0; + break; + + case GlobalEnums.enmSection.ReportDetail: + System.Console.WriteLine("\tI found the ReportDetail"); + this.rowNr ++; + this.rowsPerPage ++; + RowItem ri = e.Section.Items[0] as RowItem; + if (ri != null) { + if (this.rowNr %2 == 0) { + ri.DrawBorder = true; + } else { + ri.DrawBorder = false; + } + } + break; + + case GlobalEnums.enmSection.ReportPageFooter: + System.Console.WriteLine("\tI found the PageFooter"); + BaseDataItem bdi = e.Section.Items.Find("ItemsPerPage") as BaseDataItem; + if (bdi != null) { + bdi.DbValue = this.rowsPerPage.ToString(); + } + break; + + case GlobalEnums.enmSection.ReportFooter: + System.Console.WriteLine("\tI found the ReportFooter"); + break; + + default: + break; + } + } + + private void MultipagePrinted (object sender,SectionRenderEventArgs e) { +//// System.Console.WriteLine("MainForm:Rendering done for <{0}>",e.CurrentSection); +// System.Console.WriteLine("----------"); + } + + private void CheckItems (ReportItemCollection items) { + System.Console.WriteLine("\t<{0}> Items",items.Count ); + foreach (BaseReportItem i in items) { + IContainerItem container = i as IContainerItem; + if (container != null) { + System.Console.WriteLine("\t\tContainer found"); + CheckItems (container.Items); + } + } + } + } +} diff --git a/samples/SharpReport/ReportSamples/ReportSamples.csproj b/samples/SharpReport/ReportSamples/ReportSamples.csproj index a9f9b69473..632a532cfd 100644 --- a/samples/SharpReport/ReportSamples/ReportSamples.csproj +++ b/samples/SharpReport/ReportSamples/ReportSamples.csproj @@ -48,6 +48,8 @@ MainForm.cs + + diff --git a/samples/SharpReport/ReportSamples/SimpleUnboundPullModel.cs b/samples/SharpReport/ReportSamples/SimpleUnboundPullModel.cs new file mode 100644 index 0000000000..f69cd6d955 --- /dev/null +++ b/samples/SharpReport/ReportSamples/SimpleUnboundPullModel.cs @@ -0,0 +1,98 @@ +/* + * Created by SharpDevelop. + * User: Forstmeier Helmut + * Date: 29.06.2006 + * Time: 09:21 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ + +using System; +using System.Drawing; +using System.Windows.Forms; + +using SharpReportCore; +namespace ReportSamples +{ + /// + /// Description of SimpleUnboundPullModel. + /// + public class SimpleUnboundPullModel{ + int rowNr; + + public SimpleUnboundPullModel(){ + + } + public void Run() { + try{ + OpenFileDialog dg = new OpenFileDialog(); + dg.Filter = "SharpReport files|*.srd"; + dg.Title = "Select a report file: "; + if (dg.ShowDialog() == DialogResult.OK){ + SharpReportCore.SharpReportEngine mn = new SharpReportCore.SharpReportEngine(); + mn.SectionRendering += new EventHandler(SimplePullPrinting); + mn.SectionRendered += new EventHandler(SimplePullPrinted); + mn.PreviewStandartReport(dg.FileName.ToString()); + + } + } + catch(Exception er){ + MessageBox.Show(er.ToString(),"MainForm"); + } + } + private void SimplePullPrinting (object sender,SectionRenderEventArgs e) { + System.Console.WriteLine("UnboundPullPrinting"); + CheckItems(e.Section.Items); + switch (e.CurrentSection) { + case GlobalEnums.enmSection.ReportHeader: + System.Console.WriteLine("\tI found the ReportHeader"); + break; + + case GlobalEnums.enmSection.ReportPageHeader: + + System.Console.WriteLine("\tI found the Pageheader"); + break; + + case GlobalEnums.enmSection.ReportDetail: + System.Console.WriteLine("\tI found the ReportDetail"); + this.rowNr ++; + RowItem ri = e.Section.Items[0] as RowItem; + if (ri != null) { + if (this.rowNr %2 == 0) { + ri.DrawBorder = true; + } else { + ri.DrawBorder = false; + } + } + break; + + case GlobalEnums.enmSection.ReportPageFooter: + System.Console.WriteLine("\tI found the PageFooter"); + break; + + case GlobalEnums.enmSection.ReportFooter: + System.Console.WriteLine("\tI found the ReportFooter"); + break; + + default: + break; + } + } + + private void SimplePullPrinted (object sender,SectionRenderEventArgs e) { +//// System.Console.WriteLine("MainForm:Rendering done for <{0}>",e.CurrentSection); +// System.Console.WriteLine("----------"); + } + + private void CheckItems (ReportItemCollection items) { + System.Console.WriteLine("\t<{0}> Items",items.Count ); + foreach (BaseReportItem i in items) { + IContainerItem container = i as IContainerItem; + if (container != null) { + System.Console.WriteLine("\t\tContainer found"); + CheckItems (container.Items); + } + } + } + } +} diff --git a/samples/SharpReport/Unbound/MultiPageUnboundPullModel.srd b/samples/SharpReport/Unbound/MultiPageUnboundPullModel.srd new file mode 100644 index 0000000000..c5acebb85c --- /dev/null +++ b/samples/SharpReport/Unbound/MultiPageUnboundPullModel.srd @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/samples/SharpReport/Unbound/UnboundPullModel.srd b/samples/SharpReport/Unbound/UnboundPullModel.srd new file mode 100644 index 0000000000..f02e44474a --- /dev/null +++ b/samples/SharpReport/Unbound/UnboundPullModel.srd @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs index cd35796d84..f8a4aaf102 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs @@ -65,7 +65,7 @@ namespace SharpReportCore { reportDocument.QueryPageSettings += new QueryPageSettingsEventHandler (ReportQueryPage); reportDocument.BeginPrint += new PrintEventHandler(ReportBegin); reportDocument.EndPrint += new PrintEventHandler(ReportEnd); - +reportDocument.PrintPage += new PrintPageEventHandler(testPageStart); // homemade events reportDocument.PrintPageBodyStart += new EventHandler (BodyStart); @@ -234,6 +234,7 @@ namespace SharpReportCore { if (rpea == null) { throw new ArgumentNullException("rpea"); } + System.Console.WriteLine("MeasurePageHeader"); sectionInUse = Convert.ToInt16(GlobalEnums.enmSection.ReportPageHeader, CultureInfo.InvariantCulture); @@ -248,13 +249,15 @@ namespace SharpReportCore { this.CurrentSection.SectionOffset + this.CurrentSection.Size.Height + Gap); } - protected PointF MeasurePageEnd (ReportPageEventArgs e) { + protected PointF MeasurePageFooter (ReportPageEventArgs e) { + System.Console.WriteLine("MeasurePageFooter"); sectionInUse = Convert.ToInt16(GlobalEnums.enmSection.ReportPageFooter, CultureInfo.InvariantCulture); this.CurrentSection.SectionOffset = reportSettings.PageSettings.Bounds.Height - reportSettings.DefaultMargins.Top - reportSettings.DefaultMargins.Bottom; FitSectionToItems (this.CurrentSection,e); this.DetailEnds = new Point (0,this.CurrentSection.SectionOffset); return new PointF(0,this.CurrentSection.SectionOffset); +// return this.DetailEnds; } @@ -382,7 +385,9 @@ namespace SharpReportCore { #region virtuals - + protected virtual void testPageStart (object sender, PrintPageEventArgs e) { + System.Console.WriteLine("PAGESTART"); + } protected virtual void ReportQueryPage (object sender,QueryPageSettingsEventArgs qpea) { qpea.PageSettings.Margins = reportSettings.DefaultMargins; } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs index 417b8208db..9fd21af7b1 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs @@ -93,7 +93,7 @@ namespace SharpReportCore { private void DoPageEnd (ReportPageEventArgs rpea){ // System.Console.WriteLine("DataRenderer:DoPageEnd"); - base.MeasurePageEnd (rpea); + base.MeasurePageFooter (rpea); base.RenderSection (rpea); base.DoItems(rpea); } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderFormSheetReport.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderFormSheetReport.cs index e0b8a20ea3..7cbf6a915f 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderFormSheetReport.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderFormSheetReport.cs @@ -49,6 +49,7 @@ namespace SharpReportCore { #region Draw the different report Sections private PointF DoReportHeader (ReportPageEventArgs rpea){ + System.Console.WriteLine("\t ReportHeader"); PointF endAt = base.MeasureReportHeader (rpea); base.RenderSection (rpea); @@ -61,21 +62,24 @@ namespace SharpReportCore { } private PointF DoPageHeader (PointF startAt,ReportPageEventArgs rpea){ - +System.Console.WriteLine("\t PageHeader"); PointF endAt = base.MeasurePageHeader (startAt,rpea); base.RenderSection (rpea); return endAt; } private void DoPageEnd (ReportPageEventArgs rpea){ + base.PrintPageEnd(this,rpea); - base.MeasurePageEnd (rpea); + base.MeasurePageFooter (rpea); base.RenderSection (rpea); - } + + //TODO how should we handle ReportFooter, print it on an seperate page ???? private void DoReportFooter (PointF startAt,ReportPageEventArgs rpea){ + System.Console.WriteLine("\t ReportFooter"); base.MeasureReportFooter(rpea); base.RenderSection (rpea); this.RemoveSectionEvents(); @@ -83,19 +87,44 @@ namespace SharpReportCore { #endregion - #region test + #region print all the sections protected override void PrintReportHeader (object sender, ReportPageEventArgs e) { + System.Console.WriteLine("PRINT REPORTHEADER"); base.PrintReportHeader (sender,e); this.currentPoint = DoReportHeader (e); } protected override void PrintPageHeader (object sender, ReportPageEventArgs e) { + System.Console.WriteLine("PRINT PAGEHEDER"); base.PrintPageHeader (sender,e); this.currentPoint = DoPageHeader (this.currentPoint,e); base.DetailStart = new Point ((int)currentPoint.X,(int)currentPoint.Y); } + protected override void PrintDetail(object sender, ReportPageEventArgs rpea){ + base.PrintDetail(sender, rpea); + System.Console.WriteLine("PRINT DETAIL"); + base.RenderSection(rpea); + base.RemoveSectionEvents(); + } + + protected override void PrintReportFooter(object sender, ReportPageEventArgs rpea){ + System.Console.WriteLine("PRINT REPORTFOOTER"); + base.PrintReportFooter(sender, rpea); + base.RenderSection(rpea); + base.RemoveSectionEvents(); + } + + /// + /// Print the PageFooter + /// + /// + /// + protected override void PrintPageEnd(object sender, ReportPageEventArgs rpea) { + System.Console.WriteLine("PRINTPAGEEND"); + this.DoPageEnd (rpea); + } #endregion @@ -115,15 +144,6 @@ namespace SharpReportCore { base.RenderSection (rpea); } - /// - /// Print the PageFooter - /// - /// - /// - protected override void PrintPageEnd(object sender, ReportPageEventArgs rpea) { - this.DoPageEnd (rpea); - } - protected override void OnBodyEnd (object sender,ReportPageEventArgs rpea) { diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/ReportDocument.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/ReportDocument.cs index 6bc24ed2a1..70886a6524 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/ReportDocument.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/ReportDocument.cs @@ -64,6 +64,7 @@ namespace SharpReportCore { // this.OnEndPrint (new PrintEventArgs()); } } + protected override void OnEndPrint(PrintEventArgs e){ base.OnEndPrint(e); From b89a25d1ab968eaf8757fa414971b074134f2cfe Mon Sep 17 00:00:00 2001 From: Peter Forstmeier Date: Fri, 7 Jul 2006 21:11:24 +0000 Subject: [PATCH 12/22] Better handling of Section Events, now all sections can be used git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1552 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../SharpReportCore/BaseItems/BaseTextItem.cs | 2 +- .../BaseItems/Graphics/BaseImageItem.cs | 6 +- .../SharpReportCore/BaseSettings.cs | 1 - .../Events/ReportPageEventArgs.cs | 6 +- .../Printing/AbstractDataRenderer.cs | 3 +- .../Printing/AbstractRenderer.cs | 268 ++++++++++-------- .../SharpReportCore/Printing/Page.cs | 140 +++++++++ .../Printing/RenderDataReport.cs | 95 ++++--- .../Printing/RenderFormSheetReport.cs | 69 ++--- .../Printing/ReportDocument.cs | 165 ++++++++--- .../SharpReportCore/ReportSettings.cs | 3 +- .../SharpReportCore/SharpReportCore.csproj | 1 + .../SharpReportCore/SharpReportEngine.cs | 10 +- 13 files changed, 522 insertions(+), 247 deletions(-) create mode 100644 src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Page.cs diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs index bfe18ba428..b08c0c93b2 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs @@ -129,7 +129,7 @@ namespace SharpReportCore { this.stringTrimming,this.contentAlignment); - rpea.LocationAfterDraw = new PointF (this.Location.X + this.Size.Width, + rpea.LocationAfterDraw = new Point (this.Location.X + this.Size.Width, this.Location.Y + this.Size.Height); } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseImageItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseImageItem.cs index c26753c0ca..9a12aa2234 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseImageItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseImageItem.cs @@ -62,15 +62,15 @@ namespace SharpReportCore { if (this.image != null) { if (this.scaleImageToSize) { g.DrawImageUnscaled(image,0,0); - rpea.LocationAfterDraw = new PointF (this.Location.X + this.image.Width, + rpea.LocationAfterDraw = new Point (this.Location.X + this.image.Width, this.Location.Y + this.image.Height); } else { SizeF measureSize = base.MeasureReportItem (rpea,this); RectangleF rect = base.DrawingRectangle (rpea,measureSize); g.DrawImage(image, rect); - rpea.LocationAfterDraw = new PointF (this.Location.X + rect.Width, - this.Location.Y + rect.Height); + rpea.LocationAfterDraw = new Point (this.Location.X + (int)rect.Width, + this.Location.Y + (int)rect.Height); } } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseSettings.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseSettings.cs index 8aeb98dc2e..84afeb6396 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseSettings.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseSettings.cs @@ -110,7 +110,6 @@ namespace SharpReportCore { protected void NotifyPropertyChanged(string info) { if (this.initDone) { if (PropertyChanged != null) { - System.Console.WriteLine("BaseSettings : PropertyChanged {0}",info); PropertyChanged (this,new PropertyChangedEventArgs (info)); } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Events/ReportPageEventArgs.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Events/ReportPageEventArgs.cs index eaf4abca17..048a5194a1 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Events/ReportPageEventArgs.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Events/ReportPageEventArgs.cs @@ -31,12 +31,12 @@ namespace SharpReportCore { int pageNumber; bool forceNewPage; - PointF locationAfterDraw; + Point locationAfterDraw; public ReportPageEventArgs(PrintPageEventArgs e, int pageNumber, bool forceNewPage, - PointF locationAfterDraw){ + Point locationAfterDraw){ this.printEventArgs = e; this.pageNumber = pageNumber; @@ -67,7 +67,7 @@ namespace SharpReportCore { } - public PointF LocationAfterDraw { + public Point LocationAfterDraw { get { return locationAfterDraw; } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractDataRenderer.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractDataRenderer.cs index 12e01a693b..e7bd94a933 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractDataRenderer.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractDataRenderer.cs @@ -37,6 +37,7 @@ namespace SharpReportCore{ } #endregion + protected int DoItems (ReportPageEventArgs rpea) { IContainerItem container = null; bool hasContainer = false; @@ -74,7 +75,7 @@ namespace SharpReportCore{ item.SectionOffset = section.SectionOffset; item.Render(rpea); drawPoint.Y = section.SectionOffset + section.Size.Height; - rpea.LocationAfterDraw = new PointF (rpea.LocationAfterDraw.X,section.SectionOffset + section.Size.Height); + rpea.LocationAfterDraw = new Point (rpea.LocationAfterDraw.X,section.SectionOffset + section.Size.Height); } if ((section.CanGrow == false)&& (section.CanShrink == false)) { diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs index f8a4aaf102..310b6ce08e 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs @@ -33,16 +33,16 @@ namespace SharpReportCore { private ReportSettings reportSettings; private int sectionInUse; - - private Point detailStart; - private Point detailEnds; + private StandardFormatter standartFormatter; private bool cancel; - public event EventHandler SectionRendering; + public event EventHandler Rendering; public event EventHandler SectionRendered; + public Page page; + protected AbstractRenderer(ReportModel model){ if (model == null) { throw new MissingModelException(); @@ -64,12 +64,13 @@ namespace SharpReportCore { // Events from ReportDocument reportDocument.QueryPageSettings += new QueryPageSettingsEventHandler (ReportQueryPage); reportDocument.BeginPrint += new PrintEventHandler(ReportBegin); + reportDocument.PrintPage += new PrintPageEventHandler(ReportPageStart); reportDocument.EndPrint += new PrintEventHandler(ReportEnd); -reportDocument.PrintPage += new PrintPageEventHandler(testPageStart); + // homemade events - reportDocument.PrintPageBodyStart += new EventHandler (BodyStart); + reportDocument.BodyStart += new EventHandler (BodyStart); - reportDocument.PrintPageBodyEnd += new EventHandler (OnBodyEnd); + reportDocument.BodyEnd += new EventHandler (BodyEnd); // reportDocument.RenderReportHeader += new EventHandler (PrintReportHeader); @@ -93,11 +94,12 @@ reportDocument.PrintPage += new PrintPageEventHandler(testPageStart); private void OnSectionPrinting (object sender,SectionEventArgs e) { - if (this.SectionRendering != null) { + if (this.Rendering != null) { SectionRenderEventArgs ea = new SectionRenderEventArgs (e.Section, this.reportDocument.PageNumber,0, (GlobalEnums.enmSection)this.sectionInUse); - this.SectionRendering(this,ea); + BaseSection s = (BaseSection)sender; + this.Rendering(this,ea); } } @@ -107,12 +109,15 @@ reportDocument.PrintPage += new PrintPageEventHandler(testPageStart); SectionRenderEventArgs ea = new SectionRenderEventArgs (e.Section, this.reportDocument.PageNumber,0, (GlobalEnums.enmSection)this.sectionInUse); + this.SectionRendered(this,ea); } } #endregion + #region SharpReport Events + protected virtual void PrintReportHeader (object sender, ReportPageEventArgs e) { SectionInUse = Convert.ToInt16(GlobalEnums.enmSection.ReportHeader, CultureInfo.InvariantCulture); @@ -124,14 +129,28 @@ reportDocument.PrintPage += new PrintPageEventHandler(testPageStart); CultureInfo.InvariantCulture); this.AddSectionEvents(); } + protected virtual void BodyStart (object sender,ReportPageEventArgs rpea) { +// System.Console.WriteLine("\tAbstract - PrintBodyStart"); + this.SectionInUse = Convert.ToInt16(GlobalEnums.enmSection.ReportDetail, + CultureInfo.InvariantCulture); + + } + protected virtual void PrintDetail (object sender,ReportPageEventArgs rpea) { SectionInUse = Convert.ToInt16(GlobalEnums.enmSection.ReportDetail, CultureInfo.InvariantCulture); - this.AddSectionEvents(); +// this.AddSectionEvents(); // System.Console.WriteLine("\tAbstract - PrintDetail"); } + + protected virtual void BodyEnd (object sender,ReportPageEventArgs rpea) { +// System.Console.WriteLine("\tAbstarct - PrintBodyEnd"); + this.SectionInUse = Convert.ToInt16(GlobalEnums.enmSection.ReportFooter, + CultureInfo.InvariantCulture); + } + protected virtual void PrintPageEnd (object sender,ReportPageEventArgs rpea) { SectionInUse = Convert.ToInt16(GlobalEnums.enmSection.ReportPageFooter, CultureInfo.InvariantCulture); @@ -146,6 +165,8 @@ reportDocument.PrintPage += new PrintPageEventHandler(testPageStart); this.AddSectionEvents(); } + #endregion + protected static void PageBreak(ReportPageEventArgs pea) { if (pea == null) { throw new ArgumentNullException("pea"); @@ -154,120 +175,120 @@ reportDocument.PrintPage += new PrintPageEventHandler(testPageStart); pea.ForceNewPage = true; } - protected bool CheckPageBreakAfter () { - if (this.CurrentSection.PageBreakAfter) { - return true; - } - return false; - } - protected int CalculateDrawAreaHeight(ReportPageEventArgs rpea){ - if (rpea == null) { - throw new ArgumentNullException("rpea"); - } - int to = rpea.PrintPageEventArgs.MarginBounds.Height ; - - if (rpea.PageNumber ==1) { - to -= sections[Convert.ToInt16(GlobalEnums.enmSection.ReportHeader,CultureInfo.InvariantCulture)].Size.Height; - } - - to -= sections[Convert.ToInt16(GlobalEnums.enmSection.ReportPageHeader,CultureInfo.InvariantCulture)].Size.Height; - - to -= sections[Convert.ToInt16(GlobalEnums.enmSection.ReportPageFooter,CultureInfo.InvariantCulture)].Size.Height; - return to; - } - + #region Debugg Code /// /// Use this function to draw controlling rectangles + /// For debugging only /// - protected static void DebugRectangle (ReportPageEventArgs rpea,Rectangle rectangle) { + public static void DebugRectangle (PrintPageEventArgs rpea,Rectangle rectangle) { if (rpea == null) { throw new ArgumentNullException("rpea"); } - rpea.PrintPageEventArgs.Graphics.DrawRectangle (Pens.Black,rectangle); + rpea.Graphics.DrawRectangle (Pens.Black,rectangle); } - /// - /// Calculates the rectangle wich can be used by Detail - /// - /// - protected Rectangle DetailRectangle (ReportPageEventArgs rpea) { - if (rpea == null) { - throw new ArgumentNullException("rpea"); - } - sectionInUse = Convert.ToInt16(GlobalEnums.enmSection.ReportDetail, - CultureInfo.InvariantCulture); + public void DebugFooterRectangle (ReportPageEventArgs rpea) { + Rectangle r = new Rectangle( this.page.ReportFooterRectangle.Left, + rpea.LocationAfterDraw.Y, + this.page.ReportFooterRectangle.Width, + this.page.ReportFooterRectangle.Height); - Rectangle rect = new Rectangle (rpea.PrintPageEventArgs.MarginBounds.Left, - this.detailStart.Y , - rpea.PrintPageEventArgs.MarginBounds.Width, - detailEnds.Y - detailStart.Y - (3 * gap)); - return rect; + Rectangle s = new Rectangle (this.page.ReportFooterRectangle.Left, + rpea.LocationAfterDraw.Y, + + this.page.ReportFooterRectangle.Width, + this.page.PageFooterRectangle.Top - rpea.LocationAfterDraw.Y -1); + + AbstractRenderer.DebugRectangle(rpea.PrintPageEventArgs,r); + AbstractRenderer.DebugRectangle(rpea.PrintPageEventArgs,s); } - protected PointF MeasureReportHeader (ReportPageEventArgs rpea) { - if (rpea == null) { + #endregion + + protected Rectangle MeasureReportHeader (PrintPageEventArgs ppea) { + if (ppea == null) { throw new ArgumentNullException("rpea"); } - PointF endAt = new PointF(); - if (rpea.PageNumber == 1) { + + Rectangle rect = new Rectangle(); + if (this.reportDocument.PageNumber == 1) { + sectionInUse = Convert.ToInt16(GlobalEnums.enmSection.ReportHeader, CultureInfo.InvariantCulture); + if (this.CurrentSection.Items.Count > 0) { this.CurrentSection.SectionOffset = reportSettings.DefaultMargins.Top; - FitSectionToItems (this.CurrentSection,rpea); - endAt = new PointF (0, - reportSettings.DefaultMargins.Top + this.CurrentSection.Size.Height + Gap); + FitSectionToItems (this.CurrentSection,ppea); + + rect = new Rectangle(reportSettings.DefaultMargins.Left, + reportSettings.DefaultMargins.Top, + ppea.MarginBounds.Width, + this.CurrentSection.Size.Height + Gap); } else { - endAt = new PointF(0,reportSettings.DefaultMargins.Top); + + rect = new Rectangle (reportSettings.DefaultMargins.Left, + reportSettings.DefaultMargins.Top, + ppea.MarginBounds.Width, + 0); } } - return endAt; + return rect; } ///
/// Section start at this PointF /// ReportPageEventArgs - protected PointF MeasurePageHeader (PointF startat,ReportPageEventArgs rpea) { + private Rectangle MeasurePageHeader (Rectangle startAfter,PrintPageEventArgs rpea) { if (rpea == null) { throw new ArgumentNullException("rpea"); } - System.Console.WriteLine("MeasurePageHeader"); + sectionInUse = Convert.ToInt16(GlobalEnums.enmSection.ReportPageHeader, CultureInfo.InvariantCulture); - if (rpea.PageNumber == 1) { - this.CurrentSection.SectionOffset = (int)startat.Y + Gap; + if (this.reportDocument.PageNumber == 1){ + this.CurrentSection.SectionOffset = (int)startAfter.Top + Gap; } else { this.CurrentSection.SectionOffset = reportSettings.DefaultMargins.Top; } FitSectionToItems (this.CurrentSection,rpea); - return new PointF (0, - this.CurrentSection.SectionOffset + this.CurrentSection.Size.Height + Gap); + return new Rectangle (startAfter.Left, + startAfter.Bottom + Gap, + rpea.MarginBounds.Width, + this.CurrentSection.Size.Height + Gap); } - protected PointF MeasurePageFooter (ReportPageEventArgs e) { - System.Console.WriteLine("MeasurePageFooter"); + + private Rectangle MeasurePageFooter (PrintPageEventArgs e) { sectionInUse = Convert.ToInt16(GlobalEnums.enmSection.ReportPageFooter, CultureInfo.InvariantCulture); this.CurrentSection.SectionOffset = reportSettings.PageSettings.Bounds.Height - reportSettings.DefaultMargins.Top - reportSettings.DefaultMargins.Bottom; FitSectionToItems (this.CurrentSection,e); - this.DetailEnds = new Point (0,this.CurrentSection.SectionOffset); - return new PointF(0,this.CurrentSection.SectionOffset); -// return this.DetailEnds; + return new Rectangle(reportSettings.DefaultMargins.Left, + this.CurrentSection.SectionOffset, + e.MarginBounds.Width, + this.CurrentSection.Size.Height); + + } - protected PointF MeasureReportFooter (ReportPageEventArgs e) { + private Rectangle MeasureReportFooter (PrintPageEventArgs ppea) { sectionInUse = Convert.ToInt16(GlobalEnums.enmSection.ReportFooter, CultureInfo.InvariantCulture); - FitSectionToItems (this.CurrentSection,e); - return new PointF(0,this.CurrentSection.SectionOffset + this.CurrentSection.Size.Height); + FitSectionToItems (this.CurrentSection,ppea); + return new Rectangle (reportSettings.DefaultMargins.Left, + this.CurrentSection.SectionOffset, + ppea.MarginBounds.Width, + this.CurrentSection.Size.Height); } + + protected virtual int RenderSection (ReportPageEventArgs rpea) { Point drawPoint = new Point(0,0); @@ -281,7 +302,8 @@ reportDocument.PrintPage += new PrintPageEventHandler(testPageStart); item.SectionOffset = this.CurrentSection.SectionOffset; item.Render(rpea); drawPoint.Y = this.CurrentSection.SectionOffset + this.CurrentSection.Size.Height; - rpea.LocationAfterDraw = new PointF (rpea.LocationAfterDraw.X,this.CurrentSection.SectionOffset + this.CurrentSection.Size.Height); + rpea.LocationAfterDraw = new Point (rpea.LocationAfterDraw.X, + this.CurrentSection.SectionOffset + this.CurrentSection.Size.Height); } @@ -295,16 +317,16 @@ reportDocument.PrintPage += new PrintPageEventHandler(testPageStart); } #region privates - protected void FitSectionToItems (BaseSection section,ReportPageEventArgs rpea){ + protected void FitSectionToItems (BaseSection section,PrintPageEventArgs rpea){ if (section == null) { throw new ArgumentNullException("section"); } if (rpea == null) { throw new ArgumentNullException("rpea"); } - Rectangle orgRect = new Rectangle (rpea.PrintPageEventArgs.MarginBounds.Left, + Rectangle orgRect = new Rectangle (rpea.MarginBounds.Left, section.SectionOffset, - rpea.PrintPageEventArgs.MarginBounds.Width, + rpea.MarginBounds.Width, section.Size.Height); if ((section.CanGrow == true)||(section.CanShrink == true)) { @@ -315,7 +337,7 @@ reportDocument.PrintPage += new PrintPageEventHandler(testPageStart); } } - private static void AdjustItems (BaseSection section,ReportPageEventArgs e){ + private static void AdjustItems (BaseSection section,PrintPageEventArgs e){ int toFit = section.Size.Height; foreach (BaseReportItem rItem in section.Items) { @@ -328,7 +350,7 @@ reportDocument.PrintPage += new PrintPageEventHandler(testPageStart); } } - private static void AdjustSection (BaseSection section,ReportPageEventArgs e){ + private static void AdjustSection (BaseSection section,PrintPageEventArgs e){ foreach (BaseReportItem rItem in section.Items) { if (!AbstractRenderer.CheckItemInSection (section,rItem,e)){ @@ -343,7 +365,7 @@ reportDocument.PrintPage += new PrintPageEventHandler(testPageStart); } - private static bool CheckItemInSection (BaseSection section,BaseReportItem item ,ReportPageEventArgs e) { + private static bool CheckItemInSection (BaseSection section,BaseReportItem item ,PrintPageEventArgs e) { Rectangle secRect = new Rectangle (0,0,section.Size.Width,section.Size.Height); SizeF size = AbstractRenderer.MeasureReportItem(item,e); Rectangle itemRect = new Rectangle (item.Location.X, @@ -357,7 +379,7 @@ reportDocument.PrintPage += new PrintPageEventHandler(testPageStart); } private static SizeF MeasureReportItem(IItemRenderer item, - ReportPageEventArgs e) { + PrintPageEventArgs e) { SizeF sizeF = new SizeF (); BaseTextItem myItem = item as BaseTextItem; if (myItem != null) { @@ -370,26 +392,64 @@ reportDocument.PrintPage += new PrintPageEventHandler(testPageStart); BaseDataItem it = item as BaseDataItem; str = it.DbValue; } - - sizeF = e.PrintPageEventArgs.Graphics.MeasureString(str, - myItem.Font, - myItem.Size.Width, - myItem.StringFormat); + + sizeF = e.Graphics.MeasureString(str, + myItem.Font, + myItem.Size.Width, + myItem.StringFormat); } else { sizeF = new SizeF (item.Size.Width,item.Size.Height); } - + return sizeF; } #endregion - #region virtuals - protected virtual void testPageStart (object sender, PrintPageEventArgs e) { - System.Console.WriteLine("PAGESTART"); + #region PrintDocument Events + private void ReportPageStart (object sender, PrintPageEventArgs e) { + if (this.page == null) { + throw new ArgumentException("page"); + } + + Rectangle r1; + + if (this.reportDocument.PageNumber == 1) { + r1 = this.MeasureReportHeader(e); + page.ReportHeaderRectangle = r1; + } else { + r1 = new Rectangle (reportSettings.DefaultMargins.Left, + reportSettings.DefaultMargins.Top, + e.MarginBounds.Width, + 0); + } + page.ReportHeaderRectangle = r1; +// System.Console.WriteLine("ReportHeader {0}",page.ReportHeaderRectangle); + page.PageHeaderRectangle = this.MeasurePageHeader(r1,e); +// System.Console.WriteLine("PageHeader {0}",page.PageHeaderRectangle); + page.PageFooterRectangle = this.MeasurePageFooter (e); + +// System.Console.WriteLine("DrawArea {0}",page.DetailArea); + +// System.Console.WriteLine("PageFooter {0}",page.PageFooterRectangle); + page.ReportFooterRectangle = this.MeasureReportFooter(e); +// System.Console.WriteLine("ReportFooter {0}",page.ReportFooterRectangle); +// System.Console.WriteLine("DetailStarts {0}",page.DetailStart); +// System.Console.WriteLine(""); +// AbstractRenderer.DebugRectangle (e,page.PageHeaderRectangle); +// AbstractRenderer.DebugRectangle (e,page.DetailArea); +// AbstractRenderer.DebugRectangle (e,page.PageFooterRectangle); } + protected virtual void ReportQueryPage (object sender,QueryPageSettingsEventArgs qpea) { qpea.PageSettings.Margins = reportSettings.DefaultMargins; + + if (this.reportDocument.PageNumber == 1) { + page = new Page (true); + } else { + page = new Page (false); + } + } @@ -398,20 +458,7 @@ reportDocument.PrintPage += new PrintPageEventHandler(testPageStart); } - protected virtual void BodyStart (object sender,ReportPageEventArgs rpea) { -// System.Console.WriteLine("\tAbstract - PrintBodyStart"); - this.SectionInUse = Convert.ToInt16(GlobalEnums.enmSection.ReportDetail, - CultureInfo.InvariantCulture); - - } - - - protected virtual void OnBodyEnd (object sender,ReportPageEventArgs rpea) { -// System.Console.WriteLine("\tAbstarct - PrintBodyEnd"); - this.SectionInUse = Convert.ToInt16(GlobalEnums.enmSection.ReportFooter, - CultureInfo.InvariantCulture); - } protected virtual void ReportEnd (object sender,PrintEventArgs e) { // System.Console.WriteLine("\tAbstract - ReportEnd"); @@ -419,6 +466,7 @@ reportDocument.PrintPage += new PrintPageEventHandler(testPageStart); #endregion + #region property's public ReportDocument ReportDocument { @@ -468,23 +516,17 @@ reportDocument.PrintPage += new PrintPageEventHandler(testPageStart); } } - protected Point DetailEnds { + protected Page Page { get { - return detailEnds; + return page; } set { - detailEnds = value; + page = value; } } - protected Point DetailStart { - get { - return detailStart; - } - set { - detailStart = value; - } - } + + #endregion #region IDispoable diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Page.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Page.cs new file mode 100644 index 0000000000..b42d998101 --- /dev/null +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Page.cs @@ -0,0 +1,140 @@ +/* + * Created by SharpDevelop. + * User: Forstmeier Helmut + * Date: 30.06.2006 + * Time: 17:12 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ + +using System; +using System.Drawing; + +namespace SharpReportCore{ + /// + /// Description of Page. + /// + public class Page{ + Rectangle reportHeaderRectangle; + Rectangle pageHeaderRectangle; + Rectangle detailRectangle; + Rectangle pageFooterRectangle; + Rectangle reportFooterRectangle; + + bool firstpage; + + public Page(bool firstPage){ + this.firstpage = firstPage; + } + + + public Rectangle ReportHeaderRectangle { + get { + return reportHeaderRectangle; + } + set { + reportHeaderRectangle = value; + } + } + + public Rectangle PageHeaderRectangle { + get { + return pageHeaderRectangle; + } + set { + pageHeaderRectangle = value; + } + } + + public Rectangle DetailRectangle { + get { + return detailRectangle; + } + set { + detailRectangle = value; + } + } + + + public Rectangle PageFooterRectangle { + get { + return pageFooterRectangle; + } + set { + pageFooterRectangle = value; + } + } + + public Rectangle ReportFooterRectangle { + get { + return reportFooterRectangle; + } + set { + reportFooterRectangle = value; + } + } + + public Point DetailStart{ + get { + return new Point(this.pageHeaderRectangle.Left, + this.pageHeaderRectangle.Bottom); + } + } + + public Point DetailEnds{ + get { + return new Point(this.pageFooterRectangle.Left,this.pageFooterRectangle.Top); + } + } + /* + /// + /// Calculates the rectangle wich can be used by Detail + /// + /// + + protected Rectangle old_DetailRectangle (ReportPageEventArgs rpea) { + if (rpea == null) { + throw new ArgumentNullException("rpea"); + } + + sectionInUse = Convert.ToInt16(GlobalEnums.enmSection.ReportDetail, + CultureInfo.InvariantCulture); + Rectangle rect = new Rectangle (rpea.PrintPageEventArgs.MarginBounds.Left, + this.page.DetailStart.Y , + rpea.PrintPageEventArgs.MarginBounds.Width, + page.DetailEnds.Y - this.page.DetailStart.Y - (3 * gap)); + System.Console.WriteLine("Page DetRec {0} base DetRec {1}",page.DetailArea,rect); + return rect; + } + */ + /* + protected int CalculateDrawAreaHeight(ReportPageEventArgs rpea){ + if (rpea == null) { + throw new ArgumentNullException("rpea"); + } + int to = rpea.PrintPageEventArgs.MarginBounds.Height ; + if (this.reportDocument.PageNumber == 1){ + to -= sections[Convert.ToInt16(GlobalEnums.enmSection.ReportHeader,CultureInfo.InvariantCulture)].Size.Height; + } + + to -= sections[Convert.ToInt16(GlobalEnums.enmSection.ReportPageHeader,CultureInfo.InvariantCulture)].Size.Height; + + to -= sections[Convert.ToInt16(GlobalEnums.enmSection.ReportPageFooter,CultureInfo.InvariantCulture)].Size.Height; + return to; + } + */ + /// + /// This rectangle starts directly after PageHeader and ends bevore PageFooter + /// + public Rectangle DetailArea { + get { + return new Rectangle (this.DetailStart.X, + this.DetailStart.Y, + this.pageHeaderRectangle.Width, + (this.pageFooterRectangle.Top -1) - (this.pageHeaderRectangle.Bottom + 1)); + } + + } + + } +} diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs index 9fd21af7b1..a728548099 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs @@ -74,52 +74,60 @@ namespace SharpReportCore { #region Draw the different report Sections - private PointF DoReportHeader (ReportPageEventArgs rpea){ - PointF endAt = base.MeasureReportHeader (rpea); + private void DoReportHeader (ReportPageEventArgs rpea){ base.RenderSection (rpea); base.DoItems(rpea); - - return endAt; } - - private PointF DoPageHeader (PointF startAt,ReportPageEventArgs rpea){ - PointF endAt = base.MeasurePageHeader (startAt,rpea); + private void DoPageHeader (ReportPageEventArgs rpea){ + this.CurrentSection.SectionOffset = base.Page.PageHeaderRectangle.Location.Y; base.RenderSection (rpea); base.DoItems(rpea); - return endAt; } + private void DoPageEnd (ReportPageEventArgs rpea){ -// System.Console.WriteLine("DataRenderer:DoPageEnd"); - base.MeasurePageFooter (rpea); +// System.Console.WriteLine("DoPageEnd"); + this.CurrentSection.SectionOffset = base.Page.PageFooterRectangle.Location.Y; base.RenderSection (rpea); base.DoItems(rpea); } //TODO how should we handle ReportFooter, print it on an seperate page ???? private void DoReportFooter (PointF startAt,ReportPageEventArgs rpea){ -// System.Console.WriteLine("DoReportFooter"); - base.MeasureReportFooter(rpea); + this.CurrentSection.SectionOffset = (int)rpea.LocationAfterDraw.Y; base.RenderSection (rpea); base.DoItems(rpea); } + private bool IsRoomForFooter(Point loc) { + Rectangle r = new Rectangle( base.Page.ReportFooterRectangle.Left, + loc.Y, + base.Page.ReportFooterRectangle.Width, + base.Page.ReportFooterRectangle.Height); + + Rectangle s = new Rectangle (base.Page.ReportFooterRectangle.Left, + loc.Y, + + base.Page.ReportFooterRectangle.Width, + base.Page.PageFooterRectangle.Top - loc.Y -1); + return s.Contains(r); + } + #endregion #region test protected override void PrintReportHeader (object sender, ReportPageEventArgs e) { base.PrintReportHeader (sender,e); - this.currentPoint = DoReportHeader (e); + DoReportHeader (e); base.RemoveSectionEvents(); } protected override void PrintPageHeader (object sender, ReportPageEventArgs e) { base.PrintPageHeader (sender,e); - this.currentPoint = DoPageHeader (this.currentPoint,e); - base.DetailStart = new Point ((int)currentPoint.X,(int)currentPoint.Y +1); + DoPageHeader(e); base.RemoveSectionEvents(); } @@ -128,12 +136,15 @@ namespace SharpReportCore { base.PrintPageEnd(sender,rpea); this.DoPageEnd (rpea); base.RemoveSectionEvents(); + } protected override void PrintReportFooter(object sender, ReportPageEventArgs rpea){ -// System.Console.WriteLine("DataRenderer:PrintReportFooter"); +// DebugFooterRectangle(rpea); + this.CurrentSection.SectionOffset = (int)rpea.LocationAfterDraw.Y; base.PrintReportFooter(sender, rpea); - DoReportFooter (new PointF(0,base.CurrentSection.SectionOffset + base.CurrentSection.Size.Height), + DoReportFooter (new PointF(0, + base.CurrentSection.SectionOffset + base.CurrentSection.Size.Height), rpea); base.RemoveSectionEvents(); } @@ -167,22 +178,23 @@ namespace SharpReportCore { protected override void BodyStart(object sender, ReportPageEventArgs rpea) { -// System.Console.WriteLine("DataRenderer:PrintBodyStart"); + System.Console.WriteLine(""); + System.Console.WriteLine("BodyStart"); base.BodyStart (sender,rpea); this.currentPoint = new PointF (base.CurrentSection.Location.X, - this.DetailStart.Y); + base.page.DetailStart.Y); - base.CurrentSection.SectionOffset = (int)this.DetailStart.Y + AbstractRenderer.Gap; + base.CurrentSection.SectionOffset = (int)this.page.DetailStart.Y + AbstractRenderer.Gap; + System.Console.WriteLine("\tAdd SectionEvents"); + base.AddSectionEvents(); } protected override void PrintDetail(object sender, ReportPageEventArgs rpea){ Rectangle sectionRect; bool firstOnPage = true; -// System.Console.WriteLine("RenderDataReport:PrintDetail"); + base.PrintDetail(sender, rpea); - -// base.DebugRectangle(rpea,base.DetailRectangle(rpea)); // no loop if there is no data if (! this.dataNavigator.HasMoreData ) { rpea.PrintPageEventArgs.HasMorePages = false; @@ -190,14 +202,12 @@ namespace SharpReportCore { } // first element - if (rpea.PageNumber == 1) { + if (this.ReportDocument.PageNumber ==1) { this.dataNavigator.MoveNext(); } do { - this.dataNavigator.Fill (base.CurrentSection.Items); - base.RenderSection (rpea); if (!firstOnPage) { @@ -206,15 +216,17 @@ namespace SharpReportCore { } - base.FitSectionToItems (base.CurrentSection,rpea); + base.FitSectionToItems (base.CurrentSection,rpea.PrintPageEventArgs); sectionRect = new Rectangle (rpea.PrintPageEventArgs.MarginBounds.Left, base.CurrentSection.SectionOffset, rpea.PrintPageEventArgs.MarginBounds.Width, base.CurrentSection.Size.Height); - if (!base.DetailRectangle(rpea).Contains(sectionRect)) { + if (!base.Page.DetailArea.Contains(sectionRect)) { AbstractRenderer.PageBreak(rpea); + System.Console.WriteLine("DataRenderer:RemoveEvents reason "); + this.RemoveSectionEvents(); return; } @@ -224,20 +236,33 @@ namespace SharpReportCore { if (this.dataNavigator.CurrentRow < this.dataNavigator.Count -1) { if (base.CurrentSection.PageBreakAfter) { - AbstractRenderer.PageBreak(rpea);; + AbstractRenderer.PageBreak(rpea); + System.Console.WriteLine("DataRenderer:RemoveEvents reason "); + this.RemoveSectionEvents(); + return; } } } while (this.dataNavigator.MoveNext()); - this.RemoveSectionEvents(); + + this.ReportDocument.DetailsDone = true; + + // test for reportfooter + if (!IsRoomForFooter (rpea.LocationAfterDraw)) { + AbstractRenderer.PageBreak(rpea); + } + } - protected override void OnBodyEnd(object sender, ReportPageEventArgs rpea) { -// System.Console.WriteLine("PrintBodyEnd ????"); - base.OnBodyEnd (sender,rpea); -// DoReportFooter (new PointF(0,base.CurrentSection.SectionOffset + base.CurrentSection.Size.Height), -// rpea); + protected override void BodyEnd(object sender, ReportPageEventArgs rpea) { + System.Console.WriteLine(""); + System.Console.WriteLine("BodyEnd "); + + base.BodyEnd (sender,rpea); + System.Console.WriteLine("\tRemoveEvents reason "); + base.RemoveSectionEvents(); + rpea.PrintPageEventArgs.HasMorePages = false; } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderFormSheetReport.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderFormSheetReport.cs index 7cbf6a915f..75925ae667 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderFormSheetReport.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderFormSheetReport.cs @@ -20,14 +20,8 @@ // Peter Forstmeier (Peter.Forstmeier@t-online.de) using System; -using System.Data; using System.Drawing; -using System.Globalization; using System.Drawing.Printing; -using System.Windows.Forms; -using System.Xml; - -using SharpReportCore; /// /// Runs the Report @@ -48,30 +42,19 @@ namespace SharpReportCore { #region Draw the different report Sections - private PointF DoReportHeader (ReportPageEventArgs rpea){ - System.Console.WriteLine("\t ReportHeader"); - PointF endAt = base.MeasureReportHeader (rpea); + private void DoReportHeader (ReportPageEventArgs rpea){ base.RenderSection (rpea); - - if (base.CheckPageBreakAfter()) { - AbstractRenderer.PageBreak(rpea); - base.CurrentSection.PageBreakAfter = false; - return new PointF(); - } - return endAt; } - private PointF DoPageHeader (PointF startAt,ReportPageEventArgs rpea){ -System.Console.WriteLine("\t PageHeader"); - PointF endAt = base.MeasurePageHeader (startAt,rpea); + private void DoPageHeader (PointF startAt,ReportPageEventArgs rpea){ + this.CurrentSection.SectionOffset = base.Page.PageHeaderRectangle.Location.Y; base.RenderSection (rpea); - return endAt; } private void DoPageEnd (ReportPageEventArgs rpea){ base.PrintPageEnd(this,rpea); - base.MeasurePageFooter (rpea); + this.CurrentSection.SectionOffset = base.Page.PageFooterRectangle.Location.Y; base.RenderSection (rpea); } @@ -79,8 +62,7 @@ System.Console.WriteLine("\t PageHeader"); //TODO how should we handle ReportFooter, print it on an seperate page ???? private void DoReportFooter (PointF startAt,ReportPageEventArgs rpea){ - System.Console.WriteLine("\t ReportFooter"); - base.MeasureReportFooter(rpea); + this.CurrentSection.SectionOffset = base.Page.ReportFooterRectangle.Location.Y; base.RenderSection (rpea); this.RemoveSectionEvents(); } @@ -90,27 +72,35 @@ System.Console.WriteLine("\t PageHeader"); #region print all the sections protected override void PrintReportHeader (object sender, ReportPageEventArgs e) { - System.Console.WriteLine("PRINT REPORTHEADER"); base.PrintReportHeader (sender,e); - this.currentPoint = DoReportHeader (e); + DoReportHeader (e); } protected override void PrintPageHeader (object sender, ReportPageEventArgs e) { - System.Console.WriteLine("PRINT PAGEHEDER"); base.PrintPageHeader (sender,e); - this.currentPoint = DoPageHeader (this.currentPoint,e); - base.DetailStart = new Point ((int)currentPoint.X,(int)currentPoint.Y); + DoPageHeader (this.currentPoint,e); + } + /// + /// Detail Section + /// + /// + /// + protected override void BodyStart (object sender,ReportPageEventArgs rpea) { +// System.Console.WriteLine("BodyStart"); + base.BodyStart (sender,rpea); + this.currentPoint = new PointF (base.CurrentSection.Location.X, + base.page.DetailStart.Y); + } protected override void PrintDetail(object sender, ReportPageEventArgs rpea){ base.PrintDetail(sender, rpea); - System.Console.WriteLine("PRINT DETAIL"); + this.CurrentSection.SectionOffset = base.Page.PageHeaderRectangle.Bottom; base.RenderSection(rpea); base.RemoveSectionEvents(); } protected override void PrintReportFooter(object sender, ReportPageEventArgs rpea){ - System.Console.WriteLine("PRINT REPORTFOOTER"); base.PrintReportFooter(sender, rpea); base.RenderSection(rpea); base.RemoveSectionEvents(); @@ -122,7 +112,6 @@ System.Console.WriteLine("\t PageHeader"); /// /// protected override void PrintPageEnd(object sender, ReportPageEventArgs rpea) { - System.Console.WriteLine("PRINTPAGEEND"); this.DoPageEnd (rpea); } #endregion @@ -131,24 +120,12 @@ System.Console.WriteLine("\t PageHeader"); #region event's - /// - /// Detail Section - /// - /// - /// - protected override void BodyStart (object sender,ReportPageEventArgs rpea) { - base.BodyStart (sender,rpea); - base.CurrentSection.SectionOffset = (int)this.currentPoint.Y + AbstractRenderer.Gap; - - FitSectionToItems (base.CurrentSection,rpea); - base.RenderSection (rpea); - - } - protected override void OnBodyEnd (object sender,ReportPageEventArgs rpea) { + + protected override void BodyEnd (object sender,ReportPageEventArgs rpea) { - base.OnBodyEnd (sender,rpea); + base.BodyEnd (sender,rpea); this.DoReportFooter (new PointF(0,base.CurrentSection.SectionOffset + base.CurrentSection.Size.Height), rpea); } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/ReportDocument.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/ReportDocument.cs index 70886a6524..94ba4e7b77 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/ReportDocument.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/ReportDocument.cs @@ -18,10 +18,16 @@ using SharpReportCore; namespace SharpReportCore { public class ReportDocument : PrintDocument { + /// + /// Fired just before the DetailSection ist printed + /// + /// + public event EventHandler BodyStart; - public event EventHandler PrintPageBodyStart; - - public event EventHandler PrintPageBodyEnd; + /// + /// Fired if all Details 8data) are printed + /// + public event EventHandler BodyEnd; @@ -30,14 +36,16 @@ namespace SharpReportCore { public event EventHandler RenderDetails; public event EventHandler RenderPageEnd; public event EventHandler RenderReportEnd; + int pageNumber; + bool detailsDone; public ReportDocument():base() { } - #region overriede's + #region Overrides protected override void OnQueryPageSettings(QueryPageSettingsEventArgs e){ base.OnQueryPageSettings(e); @@ -49,66 +57,146 @@ namespace SharpReportCore { } protected override void OnPrintPage(PrintPageEventArgs e){ - base.OnPrintPage(e); pageNumber ++; - + base.OnPrintPage(e); + + ReportPageEventArgs pea = new ReportPageEventArgs (e,pageNumber, - false,new PointF (0,0)); - GeneratePage (pea); + false,Point.Empty); + + + // ReportHeader only on first page + if (this.pageNumber == 1) { + if (this.RenderReportHeader != null) { + this.RenderReportHeader(this,pea); + } + } + + // allway draw PageHeader + if (this.RenderPageHeader != null) { + this.RenderPageHeader (this,pea); + } + + // Details - if (pea.PrintPageEventArgs.HasMorePages == false) { - if (this.RenderReportEnd != null) { - this.RenderReportEnd(this,pea); + if (BodyStart != null) { + BodyStart (this,pea); + } +// + if (this.RenderDetails != null) { + this.RenderDetails(this,pea); + } + + + if (pea.ForceNewPage) { + if (RenderPageEnd != null) { + RenderPageEnd (this,pea); + return; } -// this.OnEndPrint (new PrintEventArgs()); + pea.ForceNewPage = false; + return; } - } + + if (BodyEnd != null) { + BodyEnd (this,pea); + } + + // ReportFooter + if (this.detailsDone) { + this.RenderReportEnd(this,pea); + + if (pea.ForceNewPage) { + e.HasMorePages = true; + pea.ForceNewPage = false; - - protected override void OnEndPrint(PrintEventArgs e){ - base.OnEndPrint(e); + } + } + + + //PageFooter + if (RenderPageEnd != null) { + RenderPageEnd (this,pea); + e.HasMorePages = false; + return; + } } - #endregion - private void GeneratePage (SharpReportCore.ReportPageEventArgs page) { + /* + protected override void OnPrintPage(PrintPageEventArgs e){ + pageNumber ++; + base.OnPrintPage(e); + + + ReportPageEventArgs pea = new ReportPageEventArgs (e,pageNumber, + false,Point.Empty); + + // ReportHeader only on first page if (this.pageNumber == 1) { if (this.RenderReportHeader != null) { - this.RenderReportHeader(this,page); + this.RenderReportHeader(this,pea); } } + // allway draw PageHeader + if (this.RenderPageHeader != null) { - this.RenderPageHeader (this,page); + this.RenderPageHeader (this,pea); } + // Details - // print PageFooter before DetailSection - //so it's much easyer to calculate size of DetailSection - if (RenderPageEnd != null) { - RenderPageEnd (this,page); + if (!this.detailsDone) { + if (BodyStart != null) { + BodyStart (this,pea); + } + + if (this.RenderDetails != null) { + this.RenderDetails(this,pea); + } } - - if (PrintPageBodyStart != null) { - PrintPageBodyStart (this,page); + if (pea.ForceNewPage) { + if (RenderPageEnd != null) { + RenderPageEnd (this,pea); + return; + } + pea.ForceNewPage = false; + return; } - if (this.RenderDetails != null) { - this.RenderDetails(this,page); - } + // ReportFooter + + if (this.detailsDone) { + if (BodyEnd != null) { + BodyEnd (this,pea); + this.RenderReportEnd(this,pea); + + if (pea.ForceNewPage) { + e.HasMorePages = true; + pea.ForceNewPage = false; - if (page.PrintPageEventArgs.HasMorePages == false) { - if (PrintPageBodyEnd != null) { - PrintPageBodyEnd (this,page); + } } } + //PageFooter + if (RenderPageEnd != null) { + RenderPageEnd (this,pea); + e.HasMorePages = false; + return; + } } - - + */ + + protected override void OnEndPrint(PrintEventArgs e){ + base.OnEndPrint(e); + } + + #endregion + #region Property's @@ -118,6 +206,13 @@ namespace SharpReportCore { } } + public bool DetailsDone { + set { + detailsDone = value; + } + } + + #endregion } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/ReportSettings.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/ReportSettings.cs index c68019cbb1..69608e2b09 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/ReportSettings.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/ReportSettings.cs @@ -495,7 +495,6 @@ namespace SharpReportCore{ return reportType; } set { - System.Console.WriteLine("ReportType set to {0}",value); if (reportType != value) { reportType = value; this.NotifyPropertyChanged("ReportType"); @@ -626,7 +625,7 @@ namespace SharpReportCore{ set { if (dataModel != value) { dataModel = value; - System.Console.WriteLine("DataModel type = {0}",this.dataModel.ToString()); + if (this.dataModel != GlobalEnums.enmPushPullModel.FormSheet) { this.reportType = GlobalEnums.enmReportType.DataReport; } else { diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj index 37c89d2618..76f47c9623 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj @@ -131,6 +131,7 @@ + diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs index 0d37a3e22c..b73c8b4a2c 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs @@ -134,7 +134,6 @@ namespace SharpReportCore { } private void InitDataContainer (ReportSettings settings) { - System.Console.WriteLine("Engine:InitDataContainer ReportType <{0}>",settings.ReportType); if (settings.ReportType == GlobalEnums.enmReportType.DataReport) { if (settings.CommandText != null) { try { @@ -217,7 +216,7 @@ namespace SharpReportCore { default: throw new SharpReportException ("SharpReportmanager:SetupRenderer -> Unknown Reporttype"); } - abstr.SectionRendering += new EventHandler(OnSectionPrinting); + abstr.Rendering += new EventHandler(OnSectionPrinting); abstr.SectionRendered +=new EventHandler(OnSectionPrinted); return abstr; } catch (Exception) { @@ -228,8 +227,9 @@ namespace SharpReportCore { private void OnSectionPrinting (object sender,SectionRenderEventArgs e) { if (this.SectionRendering != null) { + System.Console.WriteLine(""); this.SectionRendering(this,e); - } + } } private void OnSectionPrinted (object sender,SectionRenderEventArgs e) { @@ -344,10 +344,6 @@ namespace SharpReportCore { model = ModelFromFile (fileName); if (CheckReportParameters (model,reportParameters)) { renderer = SetupStandartRenderer (model); - // -// renderer.SectionRendering += new EventHandler(OnTestPrinting); -// System.Console.WriteLine("Event should be set"); - if (renderer != null) { PreviewControl.ShowPreview(renderer,1.5,false); } From 2f15a993d377b8c4fcfa0dcc96b6fbb89a6a75f9 Mon Sep 17 00:00:00 2001 From: Peter Forstmeier Date: Fri, 7 Jul 2006 21:14:48 +0000 Subject: [PATCH 13/22] Update samples git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1553 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../MultipageUnboundPullModel.cs | 35 +++++++++++++------ .../ReportSamples/SimpleUnboundPullModel.cs | 4 +-- .../Unbound/MultiPageUnboundPullModel.srd | 2 +- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/samples/SharpReport/ReportSamples/MultipageUnboundPullModel.cs b/samples/SharpReport/ReportSamples/MultipageUnboundPullModel.cs index 55b34f25f7..8b579ad04a 100644 --- a/samples/SharpReport/ReportSamples/MultipageUnboundPullModel.cs +++ b/samples/SharpReport/ReportSamples/MultipageUnboundPullModel.cs @@ -8,6 +8,7 @@ */ using System; + using System.Windows.Forms; using SharpReportCore; @@ -19,7 +20,9 @@ namespace ReportSamples{ public class MultiPageUnboundPullModel{ int rowNr; int rowsPerPage; - int pageNr; + System.DateTime startTime; + System.DateTime endTime; + public MultiPageUnboundPullModel(){ } @@ -32,8 +35,9 @@ namespace ReportSamples{ SharpReportCore.SharpReportEngine mn = new SharpReportCore.SharpReportEngine(); mn.SectionRendering += new EventHandler(MultipagePrinting); mn.SectionRendered += new EventHandler(MultipagePrinted); - mn.PreviewStandartReport(dg.FileName.ToString()); + this.startTime = System.DateTime.Now; + mn.PreviewStandartReport(dg.FileName.ToString()); } } catch(Exception er){ @@ -45,19 +49,21 @@ namespace ReportSamples{ CheckItems(e.Section.Items); switch (e.CurrentSection) { case GlobalEnums.enmSection.ReportHeader: - System.Console.WriteLine("\tI found the ReportHeader"); + System.Console.WriteLine("\tReportHeader"); break; case GlobalEnums.enmSection.ReportPageHeader: - System.Console.WriteLine("\tI found the Pageheader"); + System.Console.WriteLine("\tPageheader"); + System.Console.WriteLine(""); this.rowsPerPage = 0; break; case GlobalEnums.enmSection.ReportDetail: - System.Console.WriteLine("\tI found the ReportDetail"); + this.rowNr ++; this.rowsPerPage ++; + System.Console.WriteLine("\tReportDetail"); RowItem ri = e.Section.Items[0] as RowItem; if (ri != null) { if (this.rowNr %2 == 0) { @@ -69,7 +75,7 @@ namespace ReportSamples{ break; case GlobalEnums.enmSection.ReportPageFooter: - System.Console.WriteLine("\tI found the PageFooter"); + System.Console.WriteLine("\tPageFooter"); BaseDataItem bdi = e.Section.Items.Find("ItemsPerPage") as BaseDataItem; if (bdi != null) { bdi.DbValue = this.rowsPerPage.ToString(); @@ -77,7 +83,15 @@ namespace ReportSamples{ break; case GlobalEnums.enmSection.ReportFooter: - System.Console.WriteLine("\tI found the ReportFooter"); + System.Console.WriteLine("\tReportFooter"); + this.endTime = System.DateTime.Now; + + BaseDataItem b = e.Section.Items.Find("reportDbTextItem1")as BaseDataItem; + if (b != null) { + b.FormatString = "t"; + b.DbValue = (this.endTime - this.startTime).ToString(); + } + break; default: @@ -86,16 +100,15 @@ namespace ReportSamples{ } private void MultipagePrinted (object sender,SectionRenderEventArgs e) { -//// System.Console.WriteLine("MainForm:Rendering done for <{0}>",e.CurrentSection); -// System.Console.WriteLine("----------"); +// System.Console.WriteLine("---Rendering done <{0}>-----",e.CurrentSection); } private void CheckItems (ReportItemCollection items) { - System.Console.WriteLine("\t<{0}> Items",items.Count ); +// System.Console.WriteLine("\t<{0}> Items",items.Count ); foreach (BaseReportItem i in items) { IContainerItem container = i as IContainerItem; if (container != null) { - System.Console.WriteLine("\t\tContainer found"); +// System.Console.WriteLine("\t\tContainer found"); CheckItems (container.Items); } } diff --git a/samples/SharpReport/ReportSamples/SimpleUnboundPullModel.cs b/samples/SharpReport/ReportSamples/SimpleUnboundPullModel.cs index f69cd6d955..085082899f 100644 --- a/samples/SharpReport/ReportSamples/SimpleUnboundPullModel.cs +++ b/samples/SharpReport/ReportSamples/SimpleUnboundPullModel.cs @@ -85,11 +85,11 @@ namespace ReportSamples } private void CheckItems (ReportItemCollection items) { - System.Console.WriteLine("\t<{0}> Items",items.Count ); +// System.Console.WriteLine("\t<{0}> Items",items.Count ); foreach (BaseReportItem i in items) { IContainerItem container = i as IContainerItem; if (container != null) { - System.Console.WriteLine("\t\tContainer found"); +// System.Console.WriteLine("\t\tContainer found"); CheckItems (container.Items); } } diff --git a/samples/SharpReport/Unbound/MultiPageUnboundPullModel.srd b/samples/SharpReport/Unbound/MultiPageUnboundPullModel.srd index c5acebb85c..ec59972661 100644 --- a/samples/SharpReport/Unbound/MultiPageUnboundPullModel.srd +++ b/samples/SharpReport/Unbound/MultiPageUnboundPullModel.srd @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file From e173a376f3e682a1f2a0f0aa941ae9d7cd8439bc Mon Sep 17 00:00:00 2001 From: Peter Forstmeier Date: Sun, 9 Jul 2006 13:13:03 +0000 Subject: [PATCH 14/22] Changing the Location ReportItems by moving the right or left border of FocusRectangle git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1555 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../ReportItems/Functions/MiscFunctions/PageNumber.cs | 1 + .../ReportItems/Functions/MiscFunctions/Today.cs | 1 + .../ReportItems/GraphicBased/ReportCircleItem.cs | 1 + .../ReportItems/GraphicBased/ReportImageItem.cs | 1 + .../ReportItems/GraphicBased/ReportLineItem.cs | 1 + .../ReportItems/GraphicBased/ReportRectangleItem.cs | 1 + .../SharpReport/ReportItems/TextBased/ItemsHelper.cs | 7 ++++--- .../ReportItems/TextBased/ReportDataItem.cs | 1 + .../ReportItems/TextBased/ReportRowItem.cs | 1 + .../ReportItems/TextBased/ReportTextItem.cs | 11 ++++++----- 10 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/PageNumber.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/PageNumber.cs index d4ae82201f..ff08245be7 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/PageNumber.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/PageNumber.cs @@ -38,6 +38,7 @@ namespace SharpReport.ReportItems.Functions { this.visualControl.Click += new EventHandler(OnControlSelect); this.visualControl.VisualControlChanged += new EventHandler (OnControlChanged); + this.visualControl.LocationChanged += new EventHandler (OnControlChanged); this.visualControl.BackColorChanged += new EventHandler (OnControlChanged); this.visualControl.FontChanged += new EventHandler (OnControlChanged); this.visualControl.ForeColorChanged += new EventHandler (OnControlChanged); diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/Today.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/Today.cs index 8b6f7dbdff..ec75be62a4 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/Today.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/Today.cs @@ -44,6 +44,7 @@ namespace SharpReport.ReportItems.Functions { this.visualControl.Click += new EventHandler(OnControlSelect); this.visualControl.VisualControlChanged += new EventHandler (OnControlChanged); + this.visualControl.LocationChanged += new EventHandler (OnControlChanged); this.visualControl.BackColorChanged += new EventHandler (OnControlChanged); this.visualControl.FontChanged += new EventHandler (OnControlChanged); this.visualControl.ForeColorChanged += new EventHandler (OnControlChanged); diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportCircleItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportCircleItem.cs index 05d6449390..317cfb73aa 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportCircleItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportCircleItem.cs @@ -38,6 +38,7 @@ namespace SharpReport.ReportItems{ this.visualControl.Click += new EventHandler(OnControlSelect); this.visualControl.VisualControlChanged += new EventHandler (OnControlChanged); + this.visualControl.LocationChanged += new EventHandler (OnControlChanged); this.visualControl.BackColorChanged += new EventHandler (OnControlChanged); this.visualControl.FontChanged += new EventHandler (OnControlChanged); this.visualControl.ForeColorChanged += new EventHandler (OnControlChanged); diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportImageItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportImageItem.cs index 6498a581b6..326d073fd3 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportImageItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportImageItem.cs @@ -37,6 +37,7 @@ namespace SharpReport.ReportItems { this.visualControl.Click += new EventHandler(OnControlSelect); this.visualControl.VisualControlChanged += new EventHandler (OnControlChanged); this.visualControl.BackColorChanged += new EventHandler (OnControlChanged); + this.visualControl.LocationChanged += new EventHandler (OnControlChanged); this.visualControl.FontChanged += new EventHandler (OnControlChanged); this.visualControl.ForeColorChanged += new EventHandler (OnControlChanged); base.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler (BasePropertyChange); diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportLineItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportLineItem.cs index 2862d989b3..6eabada0f3 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportLineItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportLineItem.cs @@ -37,6 +37,7 @@ namespace SharpReport.ReportItems{ this.visualControl.Click += new EventHandler(OnControlSelect); this.visualControl.VisualControlChanged += new EventHandler (OnControlChanged); + this.visualControl.LocationChanged += new EventHandler (OnControlChanged); this.visualControl.BackColorChanged += new EventHandler (OnControlChanged); this.visualControl.FontChanged += new EventHandler (OnControlChanged); this.visualControl.ForeColorChanged += new EventHandler (OnControlChanged); diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportRectangleItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportRectangleItem.cs index 0a60a0cd03..117db681c3 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportRectangleItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportRectangleItem.cs @@ -39,6 +39,7 @@ namespace SharpReport.ReportItems{ this.visualControl.Click += new EventHandler(OnControlSelect); this.visualControl.VisualControlChanged += new EventHandler (OnControlChanged); + this.visualControl.LocationChanged += new EventHandler (OnControlChanged); this.visualControl.BackColorChanged += new EventHandler (OnControlChanged); this.visualControl.FontChanged += new EventHandler (OnControlChanged); this.visualControl.ForeColorChanged += new EventHandler (OnControlChanged); diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ItemsHelper.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ItemsHelper.cs index 85e3bc396f..78d0bafb09 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ItemsHelper.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ItemsHelper.cs @@ -25,14 +25,13 @@ namespace SharpReport { internal static void UpdateBaseFromTextControl (ReportObjectControlBase control, BaseReportItem item) { - + item.Size = control.Size; - item.Location = control.Location; + item.Location = new System.Drawing.Point (control.Location.X,control.Location.Y); item.Name = control.Name; item.BackColor = control.BackColor; item.ForeColor = control.ForeColor; item.Font = control.Font; - } internal static void UpdateBaseFromGraphicControl (AbstractGraphicControl control, @@ -63,5 +62,7 @@ namespace SharpReport { control.DashStyle = item.DashStyle; control.Thickness = item.Thickness; } + + } } diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportDataItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportDataItem.cs index 8ea05ec9e0..75672677bf 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportDataItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportDataItem.cs @@ -48,6 +48,7 @@ namespace SharpReport.ReportItems{ this.visualControl.Click += new EventHandler(OnControlSelect); this.visualControl.VisualControlChanged += new EventHandler (OnControlChanged); + this.visualControl.LocationChanged += new EventHandler (OnControlChanged); this.visualControl.BackColorChanged += new EventHandler (OnControlChanged); this.visualControl.FontChanged += new EventHandler (OnControlChanged); this.visualControl.ForeColorChanged += new EventHandler (OnControlChanged); diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportRowItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportRowItem.cs index 965837f8b9..bc5ceaf69e 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportRowItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportRowItem.cs @@ -42,6 +42,7 @@ namespace SharpReport.ReportItems this.visualControl.Click += new EventHandler(OnControlSelect); this.visualControl.VisualControlChanged += new EventHandler (OnControlChanged); + this.visualControl.LocationChanged += new EventHandler (OnControlChanged); this.visualControl.FontChanged += new EventHandler (OnControlChanged); this.visualControl.ForeColorChanged += new EventHandler (OnControlChanged); this.visualControl.BackColorChanged += new EventHandler (OnAppereanceChanged); diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs index 4105b46f74..ec88b153cb 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs @@ -38,7 +38,10 @@ namespace SharpReport.ReportItems { ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); + this.visualControl.LocationChanged += new EventHandler (OnControlChanged); + this.visualControl.Click += new EventHandler(OnControlSelect); + this.visualControl.LocationChanged += new EventHandler (OnControlChanged); this.visualControl.VisualControlChanged += new EventHandler (OnControlChanged); this.visualControl.BackColorChanged += new EventHandler (OnControlChanged); this.visualControl.FontChanged += new EventHandler (OnControlChanged); @@ -49,11 +52,10 @@ namespace SharpReport.ReportItems { base.PropertyChanged += new PropertyChangedEventHandler (BasePropertyChange); } - + #endregion - #region events //Tracker @@ -67,7 +69,6 @@ namespace SharpReport.ReportItems { this.visualControl.ContentAlignment = base.ContentAlignment; this.visualControl.StringTrimming = base.StringTrimming; this.visualControl.DrawBorder = base.DrawBorder; - this.HandlePropertyChanged(e.PropertyName); } @@ -76,7 +77,7 @@ namespace SharpReport.ReportItems { base.SuspendLayout(); ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); base.ResumeLayout(); - this.HandlePropertyChanged("OnControlSelected"); + this.HandlePropertyChanged("OnControlChanged"); } @@ -113,7 +114,7 @@ namespace SharpReport.ReportItems { this.HandlePropertyChanged("Location"); } } - + public override Font Font { get { return base.Font; From b9c439ccd5ab8899c8b3145d13ec324133206090 Mon Sep 17 00:00:00 2001 From: Christoph Wille Date: Tue, 11 Jul 2006 06:15:49 +0000 Subject: [PATCH 15/22] Setup script for RTW git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1559 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- setup/SetupScript.nsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/SetupScript.nsi b/setup/SetupScript.nsi index cdb196e0ad..97c305fad4 100644 --- a/setup/SetupScript.nsi +++ b/setup/SetupScript.nsi @@ -1,7 +1,7 @@ !verbose 3 !define PRODUCT_NAME "SharpDevelop2" -!define PRODUCT_VERSION "RC2" +!define PRODUCT_VERSION "2.0" !define PRODUCT_PUBLISHER "ic#code" !define PRODUCT_WEB_SITE "http://www.icsharpcode.net/opensource/sd/" !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\SharpDevelop.exe" From 1eda97b187731b7faf3f939abeb76d39c49e776f Mon Sep 17 00:00:00 2001 From: Peter Forstmeier Date: Tue, 11 Jul 2006 07:41:13 +0000 Subject: [PATCH 16/22] Update Examples with 'UnboundPushModel' Report git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1560 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../ReportSamples/MainForm.Designer.cs | 22 ++- samples/SharpReport/ReportSamples/MainForm.cs | 6 + .../MultipageUnboundPullModel.cs | 2 + .../ReportSamples/ReportSamples.csproj | 1 + .../ReportSamples/UnboundPushModel.cs | 129 ++++++++++++++++++ .../Unbound/PushModel/EmployesData.xsd | Bin 0 -> 19908 bytes .../Unbound/PushModel/UnboundEmployees.srd | 1 + 7 files changed, 155 insertions(+), 6 deletions(-) create mode 100644 samples/SharpReport/ReportSamples/UnboundPushModel.cs create mode 100644 samples/SharpReport/Unbound/PushModel/EmployesData.xsd create mode 100644 samples/SharpReport/Unbound/PushModel/UnboundEmployees.srd diff --git a/samples/SharpReport/ReportSamples/MainForm.Designer.cs b/samples/SharpReport/ReportSamples/MainForm.Designer.cs index dea7a1d080..2b2f773aa0 100644 --- a/samples/SharpReport/ReportSamples/MainForm.Designer.cs +++ b/samples/SharpReport/ReportSamples/MainForm.Designer.cs @@ -49,8 +49,9 @@ namespace ReportSamples this.unboundToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.unboundToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.unboundPullModelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.errorProvider1 = new System.Windows.Forms.ErrorProvider(this.components); this.multipageUnboundPullModelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.unboundPuskModelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.errorProvider1 = new System.Windows.Forms.ErrorProvider(this.components); this.menuStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.errorProvider1)).BeginInit(); this.SuspendLayout(); @@ -134,7 +135,8 @@ namespace ReportSamples this.unboundToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.unboundToolStripMenuItem1, this.unboundPullModelToolStripMenuItem, - this.multipageUnboundPullModelToolStripMenuItem}); + this.multipageUnboundPullModelToolStripMenuItem, + this.unboundPuskModelToolStripMenuItem}); this.unboundToolStripMenuItem.Name = "unboundToolStripMenuItem"; this.unboundToolStripMenuItem.Size = new System.Drawing.Size(62, 20); this.unboundToolStripMenuItem.Text = "Unbound"; @@ -153,10 +155,6 @@ namespace ReportSamples this.unboundPullModelToolStripMenuItem.Text = "UnboundPullModel"; this.unboundPullModelToolStripMenuItem.Click += new System.EventHandler(this.UnboundPullModelToolStripMenuItemClick); // - // errorProvider1 - // - this.errorProvider1.ContainerControl = this; - // // multipageUnboundPullModelToolStripMenuItem // this.multipageUnboundPullModelToolStripMenuItem.Name = "multipageUnboundPullModelToolStripMenuItem"; @@ -164,6 +162,17 @@ namespace ReportSamples this.multipageUnboundPullModelToolStripMenuItem.Text = "MultipageUnboundPullModel"; this.multipageUnboundPullModelToolStripMenuItem.Click += new System.EventHandler(this.MultipageUnboundPullModelToolStripMenuItemClick); // + // unboundPuskModelToolStripMenuItem + // + this.unboundPuskModelToolStripMenuItem.Name = "unboundPuskModelToolStripMenuItem"; + this.unboundPuskModelToolStripMenuItem.Size = new System.Drawing.Size(218, 22); + this.unboundPuskModelToolStripMenuItem.Text = "UnboundPushModel"; + this.unboundPuskModelToolStripMenuItem.Click += new System.EventHandler(this.UnboundPuskModelToolStripMenuItemClick); + // + // errorProvider1 + // + this.errorProvider1.ContainerControl = this; + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -179,6 +188,7 @@ namespace ReportSamples this.ResumeLayout(false); this.PerformLayout(); } + private System.Windows.Forms.ToolStripMenuItem unboundPuskModelToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem multipageUnboundPullModelToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem unboundPullModelToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem unboundToolStripMenuItem1; diff --git a/samples/SharpReport/ReportSamples/MainForm.cs b/samples/SharpReport/ReportSamples/MainForm.cs index a2708827ac..01dff8bb5a 100644 --- a/samples/SharpReport/ReportSamples/MainForm.cs +++ b/samples/SharpReport/ReportSamples/MainForm.cs @@ -303,5 +303,11 @@ namespace ReportSamples MultiPageUnboundPullModel mp = new MultiPageUnboundPullModel(); mp.Run(); } + + void UnboundPuskModelToolStripMenuItemClick(object sender, System.EventArgs e) + { + UnboundPushModel u = new UnboundPushModel(); + u.Run(); + } } } diff --git a/samples/SharpReport/ReportSamples/MultipageUnboundPullModel.cs b/samples/SharpReport/ReportSamples/MultipageUnboundPullModel.cs index 8b579ad04a..4aaff798e0 100644 --- a/samples/SharpReport/ReportSamples/MultipageUnboundPullModel.cs +++ b/samples/SharpReport/ReportSamples/MultipageUnboundPullModel.cs @@ -44,6 +44,8 @@ namespace ReportSamples{ MessageBox.Show(er.ToString(),"MainForm"); } } + + private void MultipagePrinting (object sender,SectionRenderEventArgs e) { System.Console.WriteLine("UnboundPullPrinting"); CheckItems(e.Section.Items); diff --git a/samples/SharpReport/ReportSamples/ReportSamples.csproj b/samples/SharpReport/ReportSamples/ReportSamples.csproj index 632a532cfd..f3eb5a777c 100644 --- a/samples/SharpReport/ReportSamples/ReportSamples.csproj +++ b/samples/SharpReport/ReportSamples/ReportSamples.csproj @@ -50,6 +50,7 @@ +
diff --git a/samples/SharpReport/ReportSamples/UnboundPushModel.cs b/samples/SharpReport/ReportSamples/UnboundPushModel.cs new file mode 100644 index 0000000000..ce78f8b00c --- /dev/null +++ b/samples/SharpReport/ReportSamples/UnboundPushModel.cs @@ -0,0 +1,129 @@ +/* + * Created by SharpDevelop. + * User: Forstmeier Helmut + * Date: 10.07.2006 + * Time: 13:15 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ + +using System; +using System.Data; +using System.Windows.Forms; + +using SharpReportCore; + +namespace ReportSamples +{ + /// + /// Description of UnboundPushModel. + /// + public class UnboundPushModel + { + int rowNr; + + public UnboundPushModel() + { + } + + public void Run() { + string reportFileName; + try + { + OpenFileDialog dg = new OpenFileDialog(); + dg.Filter = "SharpReport files|*.srd"; + dg.Title = "Select a report file: "; + if (dg.ShowDialog() == DialogResult.OK){ + SharpReportCore.SharpReportEngine engine = new SharpReportCore.SharpReportEngine(); + reportFileName = dg.FileName.ToString(); + DataTable table = SelectData(); + + if (table != null) { + engine.SectionRendering += new EventHandler(PushPrinting); + engine.SectionRendered += new EventHandler(PushPrinted); + engine.PreviewPushDataReport(reportFileName,table); +// engine.PrintPushDataReport(reportFileName,table); + } + } + } + catch (Exception){ + } + } + + + + private DataTable SelectData() + { + OpenFileDialog dg = new OpenFileDialog(); + dg.Filter = "SharpReport files|*.xsd"; + dg.Title = "Select a '.xsdfile: "; + if (dg.ShowDialog() == DialogResult.OK){ + DataSet ds = new DataSet(); + ds.ReadXml(dg.FileName); + return ds.Tables[0]; + } + return null; + } + + private void PushPrinting (object sender,SectionRenderEventArgs e) { + System.Console.WriteLine("UnboundPushModel"); + CheckItems(e.Section.Items); + switch (e.CurrentSection) { + case GlobalEnums.enmSection.ReportHeader: + System.Console.WriteLine("\tReportHeader"); + break; + + case GlobalEnums.enmSection.ReportPageHeader: + + System.Console.WriteLine("\tPageheader"); + System.Console.WriteLine(""); + break; + + case GlobalEnums.enmSection.ReportDetail: + + this.rowNr ++; + System.Console.WriteLine("\tReportDetail"); + RowItem ri = e.Section.Items[0] as RowItem; + if (ri != null) { + if (this.rowNr %2 == 0) { + ri.DrawBorder = true; + } else { + ri.DrawBorder = false; + } + } + break; + + case GlobalEnums.enmSection.ReportPageFooter: + System.Console.WriteLine("\tPageFooter"); + break; + + case GlobalEnums.enmSection.ReportFooter: + System.Console.WriteLine("\tReportFooter"); + BaseDataItem b = e.Section.Items.Find("ReportDbTextItem")as BaseDataItem; + if (b != null) { + b.DbValue = this.rowNr.ToString(); + } + + break; + + default: + break; + } + } + + private void PushPrinted (object sender,SectionRenderEventArgs e) { +// System.Console.WriteLine("---Rendering done <{0}>-----",e.CurrentSection); + } + + private void CheckItems (ReportItemCollection items) { + foreach (BaseReportItem i in items) { +// System.Console.WriteLine("\tItem {0}",i.Name); + IContainerItem container = i as IContainerItem; + if (container != null) { +// System.Console.WriteLine("\t\tContainer found"); + CheckItems (container.Items); + } + } + } + } +} diff --git a/samples/SharpReport/Unbound/PushModel/EmployesData.xsd b/samples/SharpReport/Unbound/PushModel/EmployesData.xsd new file mode 100644 index 0000000000000000000000000000000000000000..25171a12e69c781b50f7c49b19c2d3c5efa2305e GIT binary patch literal 19908 zcmeI4?N1v?62|BAN%ucke7eiZ&!DhMY~ulz8C%CmHr(R zM|$>E?;6E%(JlT_%v9Ey(fjWzcT$|H7NyEhUWFEUexx2Qi*vR9QlIPanbmcnm@UqV zi{emEo5h?y^ZNC#VypNdxuP7y?S55%-GThHf2B4~hh*;;FC^QsTDedkef|3)8D8lA zOwW-G$te@tno0D~(_6IAQ_Ghc>8bkTZjv_Awq6yRYPqas>Rw8oE49Oz%H=;uvIF%( zzm)9i`-NKA(C;`uCjWUT^}X0DZlu><>HU$~VcfmY!@frPo9+&RmTaD`G@8#U#W%fl zOFc{)`JUwa9Qv*!Q(t}jH;no;$Q4I3sjm&`hjE^1j6HoerHfImb=2;q%4}*Z%ypcz zVQpUybj5R9>&L2d8QOfAXmFBDA2j~H>UP48h zOI^>@VndpyH(L#EomT2pHj~Z(*7{vm!)iTLOGm2xP0vn())_JOg|s%(mjew{_sslw ziE)zq`?9w3X7;T{c=1g2I6p;t+>;(J2i6FhJco6-FqQiIP3-VGAmW8IiZ$K@Yk3|z zZ5E4DW83S&wm~4{K4ZF3>^1%d4M9fd!*MIvam!G!j5%d)ei!=h{h;1E;?izlp}yA8 z^I?ajDYDAfnnBjf^U>b?6xrX7Z0S%M#Dn-#gJq=1^G>#+WLwmY+a5<8!^)}KBDs& z!!sLISu1}xJ`3k1MzP-Ckk|AKU7Beb-=;-9Wb2Lxd9-rO1J8nM@a(?Iz_{}R3ys;$ zSK<&dOyr8-(h`}j>UV3(r*?AWrF+CpRIDs)mc88c{o;vuNPWN>!qz!Wi{H$ zuJ<*2j62q=F1c2WM)T-wHK4%@{c0*hJtt(?({)ZBPQ1>B-`v~h@A{q}l%Vgbme-2m z=-ql-9rUvpdYjMet(o*T+U{CWj@8@Zh&dr#Lwz(tw$!qyouK7eJ=>7h{#yJ+_0FYz zo;3BFu?)AgrntdkSmv=8tj6+ml#cJ#!pwTK)-FB`+Dl_N)^1fq($*}jgc)cC8LG=5 ziRJmt2X7a@OCpnc_zl`0_BGqZ--0fdik~!Ic$7Jy=SAs?(NxvJ+J?O?^xM+9v07E{ z87IgH-n0icNzQ*>y8bNGIvs5&2uqAf2)};aV zw#c!c%NlM}hE~~YIMiK3*+6!UzUmiR;yK9L)ptYsBQ}J?8`372j2)8CwmD~IP>NkN z`a97Z>K*9ndjQl18E3SXtz1Vfu+PLkRYSk*sr63D*P*2o>0(BAjRa2^iI0p(;j6TT zJl+|h`gw|0E@YT&`*QNE1|bmW^Z*7c~#?Ck#0XpJ7xjr!NypjJl!9#=_LGR)tTk( zhnapz^lb%BW4@mjeOuCsSxP?oE(m=cv+JO5Q@YPV-_)WS!9uVW!$$DyNWVd;b*+_M zecPOXR~PzytXX1C_k&#;O2Y=T!hh!8u-ZIZY7FBQyI**<|51D37`vb;iaVZG;kDx= z`xRgb7-<;(POUk*e$g9zWIGLD^1Kb>gkjikb=fy10WC46)8sj*0f(T4U-bJT$b4Gr z>)*m^+BSA@shv4!4|YOA(@{V41R9yn&x1tx?#LOvL=ftFP>(V&kufK81LHQ-22xvF zXcHYD207!{ybY6#(NT(7q@8b)-7wPSh#2Wwj=h+UJ8Hp^*mVs@S23CEBVuhs-fWbV zIyOH$8W9mhH)z35ETDtfLh6-)Ek|J-W#)u^zXnNIqrHL_=*@Iy485%=AX}~%j zrNsUwMJwPkI7p=8i06@zu?iBx2hP}E)GIq^#!fKOv7~T*PFcpW+gKshg>w!b1eif< zQ9F@O>}iUx7JnIDdn-BYM=#D`!}wH%)`n+k7V_aEqt;;ESp=D$iGvYFMBy4U3jhuoY+f)?SxmgL1aG40WpM-2GtjL(^?oVWc^sPEoJ zF6ysqF7OJNGyc`V{auaTA_A*d&!63u3CcOq z8NGGg%}m(;N%u3Vb8Nm3^-leG-tM*>>5pPj_vdn16s_J!Pv{Rc%8#7zmzYWPPtAH9 zx}$pIERWVAGd>lgE)BSJIWTJT4jfl6FZL9S`dU^*-qRThHpQ;6D)#rc0(zOJm=`~# zxWPQ#&axXSLvC*Q$ys(;eJ&4jZuu%B(*oqm*v*35T*6WO-wKFNRQ5tE3iP+ghjzelr15-P z8T-K!V!Uc}$A@90vF|j0zpXb!V8%Lj)`A{$If3k+c_Flb3_cegZNlbwRq@TW`os^S zbh__`cJWY&IIpCC_ULGn=ich>pf`)7b6Ln@FT-SO-%c2Uy?5E4@slsPEJW_T?yd~` zUbcrd4f`_pkLdWjBw{)8XwB?X4R_Dl`Hqa8q{!O^O5?|ztlfszH8_FIlPL#ZBj82M7nUQcN&MyvO#ThIQ|XC(c#;=YTAb4nJNU}29tZrH z@)=seBLm}IPsBGVgT-+Y1)WLH;5@umj?PTuXcvyMyop7Nc^SnY#SrdcTC@n~_Bdrzv*Typ%F!Wfo>foA+0Nx~cb9nO;dXiE18Y3~DLCT`-|KlC zzG%r`Z)#7%PA0SC1M=W+f*jb}M_oCcjLs*q1J(p4Jl0uccp4e<8RY(FkYPD#rkRA`_y_C~8Bf@*zhSZOz>LNiWn?yP8pUN= zWRHc2i{Iw;m%Z?EPwu^^EExTFo~9mrF5222;=}plwr29rOT7`wu}^m$(2hA__2lAh zN18)-)VUpP(`d^^j85@F;7Dxv$Nu#PyXgG2L>)i*eqK3t&OXaxW)7;ZSI%F4SRRPX zGJZF#W=Q*3S)fnyy)6s$L8D@2
\ No newline at end of file From d19a7abfa8c0a38ad4cc69f1017be8426e610f10 Mon Sep 17 00:00:00 2001 From: Peter Forstmeier Date: Tue, 11 Jul 2006 07:42:02 +0000 Subject: [PATCH 17/22] PushModel in unbound mode is now working as well git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1561 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../SharpReport/Designer/NameService.cs | 5 +- .../SharpReport/Designer/Report.cs | 3 +- .../ReportSectionControlbase.cs | 3 +- .../Designer/SideTab/BuildSideTab.cs | 11 ++ .../Designer/VisualControls/ControlHelper.cs | 13 ++ .../Designer/VisualControls/RectTracker.cs | 1 + .../VisualControls/ReportRowControl.cs | 10 +- .../VisualControls/ReportTableControl.cs | 118 +++++++++++++ .../GraphicBased/ReportCircleItem.cs | 2 +- .../GraphicBased/ReportLineItem.cs | 2 +- .../GraphicBased/ReportRectangleItem.cs | 2 +- .../ReportItems/TextBased/ReportDataItem.cs | 2 +- .../ReportItems/TextBased/ReportRowItem.cs | 15 +- .../ReportItems/TextBased/ReportTableItem.cs | 158 ++++++++++++++++++ .../ReportItems/TextBased/ReportTextItem.cs | 2 +- .../SharpReport/SharpReport.csproj | 2 + .../BaseItems/Functions/BasePageNumber.cs | 1 + .../SharpReportCore/BaseItems/TableItem.cs | 25 ++- .../SharpReportCore/Globals/GlobalEnums.cs | 3 +- .../SharpReportCore/Globals/GlobalValues.cs | 8 + .../SharpReportCore/SharpReportEngine.cs | 2 + .../Generators/AbstractReportGenerator.cs | 8 +- 22 files changed, 366 insertions(+), 30 deletions(-) create mode 100644 src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportTableControl.cs create mode 100644 src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTableItem.cs diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/NameService.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/NameService.cs index 71d6abafb3..db0c7721b4 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/NameService.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/NameService.cs @@ -34,6 +34,10 @@ namespace SharpReport { public string CreateName (ReportItemCollection collection, string typeName) { + + if (String.IsNullOrEmpty(typeName)) { + throw new ArgumentNullException("typeName"); + } string name = Char.ToLower(typeName[0], CultureInfo.InvariantCulture) + typeName.Substring(1); @@ -42,7 +46,6 @@ namespace SharpReport { while (collection.Find(name + number.ToString(CultureInfo.InvariantCulture)) != null) { ++number; } - return name + number.ToString(); } diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/Report.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/Report.cs index bd5b563f04..ca639ea0a5 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/Report.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/Report.cs @@ -188,7 +188,8 @@ namespace SharpReport.Designer{ baseReportItem.Name = nameService.CreateName(itemCollection, baseReportItem.Name); - +System.Console.WriteLine("Report:CustomizeItem Name {0}",baseReportItem.Name); + if (baseReportItem.Parent == this.selectedSection) { baseReportItem.Location = new Point(iddea.ItemAtPoint.X,iddea.ItemAtPoint.Y); } else { diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSectionControlbase.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSectionControlbase.cs index 9279a5ea91..7b87ca33b6 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSectionControlbase.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSectionControlbase.cs @@ -339,8 +339,9 @@ namespace SharpReport.Designer{ private bool CheckDraggedControl (DragEventArgs dea) { string str = this.DragObjectToString (dea); + System.Console.WriteLine("ReportSectionControlBase"); + System.Console.WriteLine("valid {0}",this.designableFactory.Contains(str)); return this.designableFactory.Contains(str); - } private bool CheckDragElement (System.Windows.Forms.DragEventArgs dea) { diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/SideTab/BuildSideTab.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SideTab/BuildSideTab.cs index e7978d0bae..f40fbbb287 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/SideTab/BuildSideTab.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SideTab/BuildSideTab.cs @@ -96,6 +96,8 @@ namespace SharpReport // GlobalValues.RectangleBitmap()); tab.Items.Add (t); + + // bitmap = ResourceService.GetIcon("Icons.16.16.SharpReport.Line").ToBitmap(); t = sideTab.SideTabItemFactory.CreateSideTabItem( ResourceService.GetString("SharpReport.Toolbar.Line"), GlobalEnums.ReportItemType.ReportLineItem.ToString(), @@ -105,6 +107,15 @@ namespace SharpReport GlobalEnums.ReportItemType.ReportCircleItem.ToString(), GlobalValues.CircleBitmap()); tab.Items.Add (t); + + //Test + /* + t = sideTab.SideTabItemFactory.CreateSideTabItem( "Table", + GlobalEnums.ReportItemType.ReportTableItem.ToString(), + ResourceService.GetBitmap("Icons.16x16.SharpQuery.Table")); + tab.Items.Add (t); + */ + // } private void AddFunctionElements (AxSideTab tab) { diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ControlHelper.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ControlHelper.cs index efd5740c4e..bade07e18e 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ControlHelper.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ControlHelper.cs @@ -77,6 +77,19 @@ namespace SharpReport.Designer } + + + public static void DrawHeadLine (Control ctrl, PaintEventArgs pea) { + + StringFormat fmt = SharpReportCore.GlobalValues.StandartStringFormat(); + fmt.LineAlignment = StringAlignment.Near; + pea.Graphics.DrawString(ctrl.Name, + ctrl.Font, + new SolidBrush(ctrl.ForeColor), + new Rectangle(7,0,pea.ClipRectangle.Width,(int)ctrl.Font.GetHeight(pea.Graphics) + 2), + fmt); + } + /// /// Set the Controls to selected = false, so the Focusrectangle is /// not draw diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/RectTracker.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/RectTracker.cs index 9a9b3d5de4..d0b1b2c5c9 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/RectTracker.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/RectTracker.cs @@ -281,6 +281,7 @@ namespace SharpReport.Designer // convert cursor position to client co-ordinates // do hittest and normalize hit int nHandle = (int)HitTestHandles(MousePoint); + System.Console.WriteLine("RectTracker SetCursor {0}",nHandle); if (nHandle < 0) return false; diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRowControl.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRowControl.cs index 9eeafb7cbd..41feb0858f 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRowControl.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRowControl.cs @@ -50,14 +50,8 @@ namespace SharpReport.Designer{ new BaseLine (this.ForeColor,System.Drawing.Drawing2D.DashStyle.Solid,1), base.FocusRectangle); } + ControlHelper.DrawHeadLine(this,pea); - StringFormat fmt = GlobalValues.StandartStringFormat(); - fmt.LineAlignment = StringAlignment.Near; - pea.Graphics.DrawString(this.Name, - this.Font, - new SolidBrush(this.ForeColor), - new Rectangle(7,0,pea.ClipRectangle.Width,(int)this.Font.GetHeight(pea.Graphics) + 2), - fmt); } public override string ToString() { @@ -84,7 +78,7 @@ namespace SharpReport.Designer{ // ReportRectangleControl // this.BackColor = System.Drawing.Color.White; - this.Name = "RowItem"; + this.Name = "Row"; this.Size = new System.Drawing.Size(72, 40); } #endregion diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportTableControl.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportTableControl.cs new file mode 100644 index 0000000000..a85d1c8978 --- /dev/null +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportTableControl.cs @@ -0,0 +1,118 @@ +/* + * Created by SharpDevelop. + * User: Forstmeier Helmut + * Date: 09.07.2006 + * Time: 15:39 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ + +using System; +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; + +using SharpReportCore; + +namespace SharpReport.Designer +{ + /// + /// Description of ReportTableControl. + /// + public class ReportTableControl:ContainerControl + { + private RectangleShape shape = new RectangleShape(); + private bool drawBorder; + public ReportTableControl() + { + // + // The InitializeComponent() call is required for Windows Forms designer support. + // + InitializeComponent(); + this.SetStyle(ControlStyles.DoubleBuffer | + ControlStyles.UserPaint | + ControlStyles.AllPaintingInWmPaint | + ControlStyles.ResizeRedraw, + true); + this.UpdateStyles(); + int h,w; + h = GlobalValues.PreferedSize.Height * 3 + 30; + w = (GlobalValues.PreferedSize.Width * 2) + 10; + +// this.Size = new Size(w,h); + } + + #region overrides + protected override void OnPaint(PaintEventArgs pea){ + + + base.OnPaint(pea); + base.DrawEdges (pea, + new Rectangle(0,5, + this.ClientSize.Width - 1,this.ClientSize.Height - 6) ); + + ControlHelper.DrawHeadLine(this,pea); + } + + + + public override string ToString() { + + return this.GetType().Name; + } + + + + #endregion + + public bool DrawBorder { + set { + drawBorder = value; + this.Invalidate(); + } + } + #region FormsDesigner + + /// + /// Designer variable used to keep track of non-visual components. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Disposes resources used by the control. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing) { + if (components != null) { + components.Dispose(); + } + } + base.Dispose(disposing); + } + + /// + /// This method is required for Windows Forms designer support. + /// Do not change the method contents inside the source code editor. The Forms designer might + /// not be able to load this method if it was changed manually. + /// + private void InitializeComponent() + { + + this.SuspendLayout(); + + // + // ReportTableControl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + + this.Name = "Table"; + this.Size = new System.Drawing.Size(200,40); + this.ResumeLayout(false); + } + + #endregion + } +} diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportCircleItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportCircleItem.cs index 317cfb73aa..df9c8a319f 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportCircleItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportCircleItem.cs @@ -34,7 +34,7 @@ namespace SharpReport.ReportItems{ public ReportCircleItem() : base(){ visualControl = new ReportCircleControl(); - ItemsHelper.UpdateBaseFromGraphicControl (this.visualControl,this); +// ItemsHelper.UpdateBaseFromGraphicControl (this.visualControl,this); this.visualControl.Click += new EventHandler(OnControlSelect); this.visualControl.VisualControlChanged += new EventHandler (OnControlChanged); diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportLineItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportLineItem.cs index 6eabada0f3..4777eae801 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportLineItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportLineItem.cs @@ -33,7 +33,7 @@ namespace SharpReport.ReportItems{ /// public ReportLineItem():base() { visualControl = new ReportLineControl(); - ItemsHelper.UpdateBaseFromGraphicControl (this.visualControl,this); +// ItemsHelper.UpdateBaseFromGraphicControl (this.visualControl,this); this.visualControl.Click += new EventHandler(OnControlSelect); this.visualControl.VisualControlChanged += new EventHandler (OnControlChanged); diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportRectangleItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportRectangleItem.cs index 117db681c3..0ff3e2870a 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportRectangleItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportRectangleItem.cs @@ -35,7 +35,7 @@ namespace SharpReport.ReportItems{ public ReportRectangleItem():base() { visualControl = new ReportRectangleControl(); - ItemsHelper.UpdateBaseFromGraphicControl (this.visualControl,this); +// ItemsHelper.UpdateBaseFromGraphicControl (this.visualControl,this); this.visualControl.Click += new EventHandler(OnControlSelect); this.visualControl.VisualControlChanged += new EventHandler (OnControlChanged); diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportDataItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportDataItem.cs index 75672677bf..735de782ef 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportDataItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportDataItem.cs @@ -44,7 +44,7 @@ namespace SharpReport.ReportItems{ visualControl.ContentAlignment = base.ContentAlignment; visualControl.StringTrimming = base.StringTrimming; - ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); +// ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); this.visualControl.Click += new EventHandler(OnControlSelect); this.visualControl.VisualControlChanged += new EventHandler (OnControlChanged); diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportRowItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportRowItem.cs index bc5ceaf69e..e591f8d4f0 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportRowItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportRowItem.cs @@ -38,7 +38,7 @@ namespace SharpReport.ReportItems private void Setup(){ visualControl = new ReportRowControl(); - ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); +// ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); this.visualControl.Click += new EventHandler(OnControlSelect); this.visualControl.VisualControlChanged += new EventHandler (OnControlChanged); @@ -62,19 +62,20 @@ namespace SharpReport.ReportItems if (Selected != null) Selected(sender,e); } - + /* private void OnChildControlChanged (object sender, EventArgs e) { ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); this.HandlePropertyChanged("OnChildControlChanged"); } - + */ + private void ChildPropertyChange (object sender, PropertyChangedEventArgs e){ if (! base.Suspend) { ItemsHelper.UpdateControlFromTextBase (this.visualControl,this); this.HandlePropertyChanged(e.PropertyName); } } - + #endregion private void UpdateChilds () { @@ -89,6 +90,7 @@ namespace SharpReport.ReportItems #region EventHandling for this Class + private void OnAdd (object sender, CollectionItemEventArgs e){ IDesignable des = e.Item as IDesignable; if (des != null) { @@ -156,8 +158,9 @@ namespace SharpReport.ReportItems PropertyChanged (this,new PropertyChangedEventArgs(info)); } } - } + + #endregion #region IDesignable @@ -220,6 +223,8 @@ namespace SharpReport.ReportItems return this.GetType().Name; } + + #endregion /* diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTableItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTableItem.cs new file mode 100644 index 0000000000..521a0166a9 --- /dev/null +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTableItem.cs @@ -0,0 +1,158 @@ +/* + * Created by SharpDevelop. + * User: Forstmeier Helmut + * Date: 09.07.2006 + * Time: 15:51 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ + +using System; +using System.ComponentModel; + +using SharpReport.Designer; +using SharpReportCore; + +namespace SharpReport.ReportItems{ + /// + /// Description of ReportTableItem. + /// + public class ReportTableItem:TableItem ,IDesignable{ + private ReportTableControl visualControl; + + + #region Constructor + public ReportTableItem():this (GlobalValues.UnboundName){ + + } + + public ReportTableItem (string tableName):base(tableName) { + Setup(); + } + + private void Setup (){ + visualControl = new ReportTableControl(); +// ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); +// + this.visualControl.Click += new EventHandler(OnControlSelect); + this.visualControl.VisualControlChanged += new EventHandler (OnControlChanged); + this.visualControl.LocationChanged += new EventHandler (OnControlChanged); + + +// //Event from Tracker + this.visualControl.PropertyChanged += new PropertyChangedEventHandler (ControlPropertyChange); +// + base.PropertyChanged += new PropertyChangedEventHandler (BasePropertyChange); +// + base.Items.Added += OnAdd; + base.Items.Removed += OnRemove; + System.Console.WriteLine("ReporttableItem ctrlName {0}",this.visualControl.Name); + } + #endregion + + #region List Handling + private void ChildSelected(object sender, EventArgs e){ + if (Selected != null) + Selected(sender,e); + } + + private void ChildPropertyChange (object sender, PropertyChangedEventArgs e){ + if (! base.Suspend) { + ItemsHelper.UpdateControlFromTextBase (this.visualControl,this); + this.HandlePropertyChanged(e.PropertyName); + } + } + + private void OnAdd (object sender, CollectionItemEventArgs e){ + IDesignable des = e.Item as IDesignable; + if (des != null) { + this.visualControl.Controls.Add (des.VisualControl); + des.Selected += ChildSelected; + des.PropertyChanged += ChildPropertyChange; + } + } + + private void OnRemove (object sender, CollectionItemEventArgs e){ + + IDesignable des = e.Item as IDesignable; + if (des != null) { + this.visualControl.Controls.Remove(des.VisualControl); + des.Selected -= ChildSelected; + this.HandlePropertyChanged("OnChildControlRemoved"); + } + } + + #endregion + public override string ToString() { + return this.GetType().Name; + } + #region Events from Control + //Tracker + + private void ControlPropertyChange (object sender, PropertyChangedEventArgs e){ + ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); + this.HandlePropertyChanged(e.PropertyName); + } + + private void BasePropertyChange (object sender, PropertyChangedEventArgs e){ + ItemsHelper.UpdateControlFromTextBase (this.visualControl,this); + this.visualControl.DrawBorder = base.DrawBorder; + this.HandlePropertyChanged(e.PropertyName); + } + + + private void OnControlChanged (object sender, EventArgs e) { + this.SuspendLayout(); + ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); + + this.ResumeLayout(); + this.HandlePropertyChanged("OnControlChanged"); + + } + + private void OnAppereanceChanged (object sender, EventArgs e) { + this.SuspendLayout(); + ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); + this.ResumeLayout(); +// UpdateChilds(); + + this.HandlePropertyChanged("OnControlChanged"); + } + + private void OnControlSelect(object sender, EventArgs e){ + if (Selected != null) + System.Console.WriteLine("fire selected"); + Selected(this,e); + } + + /// + /// A Property in ReportItem has changed, inform the Designer + /// to set the View's 'IsDirtyFlag' to true + /// + + protected void HandlePropertyChanged(string info) { + if ( !base.Suspend) { + if (PropertyChanged != null) { + PropertyChanged (this,new PropertyChangedEventArgs(info)); + } + } + } + + + #endregion + + #region IDesignable + + [System.Xml.Serialization.XmlIgnoreAttribute] + [Browsable(false)] + public ReportObjectControlBase VisualControl { + get { + return visualControl; + } + } + + public new event PropertyChangedEventHandler PropertyChanged; + public event EventHandler Selected; + #endregion + } +} diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs index ec88b153cb..735786bb96 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs @@ -36,7 +36,7 @@ namespace SharpReport.ReportItems { visualControl.ContentAlignment = base.ContentAlignment; visualControl.StringTrimming = base.StringTrimming; - ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); +// ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); this.visualControl.LocationChanged += new EventHandler (OnControlChanged); diff --git a/src/AddIns/Misc/SharpReport/SharpReport/SharpReport.csproj b/src/AddIns/Misc/SharpReport/SharpReport/SharpReport.csproj index f15908ac5c..8f32f2cf6d 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/SharpReport.csproj +++ b/src/AddIns/Misc/SharpReport/SharpReport/SharpReport.csproj @@ -87,6 +87,8 @@ + +
diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BasePageNumber.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BasePageNumber.cs index 2deb38a81a..6a2037dfc9 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BasePageNumber.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Functions/BasePageNumber.cs @@ -27,6 +27,7 @@ namespace SharpReportCore { static string fnName = "SharpReport.Toolbar.Functions.PageNumber"; public BasePageNumber():base(fnName) { +// System.Console.WriteLine("!! PageNr created with name {0}",this.Name); } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/TableItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/TableItem.cs index 728b91fe2d..a1a22d294d 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/TableItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/TableItem.cs @@ -11,17 +11,28 @@ using System; using System.ComponentModel; using System.Windows.Forms; -namespace SharpReportCore.BaseItems { +namespace SharpReportCore { /// /// Description of TableItem. /// public class TableItem :BaseReportItem,IContainerItem{ private Padding padding; -// private string tableName; + private string tableName; + private ReportItemCollection items; - public TableItem(){ + public TableItem():this (GlobalValues.UnboundName){ + } + + public TableItem(string tableName){ + this.tableName = tableName; + } + + #region overrides + public override string ToString(){ + return this.GetType().Name; } + #endregion /* @@ -35,7 +46,10 @@ namespace SharpReportCore.BaseItems { // } } */ + + #region Interface implementation of 'IContainerItem' + public System.Windows.Forms.Padding Padding { get { return this.padding; @@ -48,7 +62,10 @@ namespace SharpReportCore.BaseItems { public ReportItemCollection Items { get { - throw new NotImplementedException(); + if (this.items == null) { + this.items = new ReportItemCollection(); + } + return this.items; } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Globals/GlobalEnums.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Globals/GlobalEnums.cs index 31289577e5..fbd9f390bd 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Globals/GlobalEnums.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Globals/GlobalEnums.cs @@ -48,7 +48,8 @@ namespace SharpReportCore { ReportLineItem, ReportCircleItem, PageNumber, - TodaysDate + TodaysDate, + ReportTableItem } /// /// FormSheet means a blank form with Labels, Lines and Checkboxes diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Globals/GlobalValues.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Globals/GlobalValues.cs index 744a7fe316..61ab5eb45a 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Globals/GlobalValues.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Globals/GlobalValues.cs @@ -33,6 +33,7 @@ namespace SharpReportCore { private static string xsdExtension = "xsd"; private static string sharpReportStandartFileName = "SharpReport1"; private const string unbound = "unbound"; + private const string tableName = "Table"; private const int enlargeControl = 5; #region some usefull functions and methodes @@ -169,6 +170,13 @@ namespace SharpReportCore { public static string UnboundName { get {return unbound;} } + + public static string TableName { + get { + return tableName; + } + } + #endregion #region Message's diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs index b73c8b4a2c..2df8fd6934 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs @@ -260,6 +260,8 @@ namespace SharpReportCore { if (this.dataManager.DataSource != null) { abstr = new RendererFactory().Create (model,dataManager); } + abstr.Rendering += new EventHandler(OnSectionPrinting); + abstr.SectionRendered +=new EventHandler(OnSectionPrinted); return abstr; } diff --git a/src/AddIns/Misc/SharpReport/SharpReportWizard/Generators/AbstractReportGenerator.cs b/src/AddIns/Misc/SharpReport/SharpReportWizard/Generators/AbstractReportGenerator.cs index dbbc31d49a..10705f7518 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportWizard/Generators/AbstractReportGenerator.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportWizard/Generators/AbstractReportGenerator.cs @@ -101,6 +101,7 @@ namespace ReportGenerator { } else { section.Items.Add (this.parentItem); IContainerItem containerItem = this.parentItem as IContainerItem; + this.parentItem.Parent = section; if ( containerItem != null) { this.AddItemsToParent (containerItem,this.ReportItemCollection); @@ -171,16 +172,15 @@ namespace ReportGenerator { protected void AdjustAllNames () { foreach (BaseSection sec in this.reportModel.SectionCollection) { - AdjustNames(sec.Items); + BuildProperNames(sec.Items); } } - private void AdjustNames (ReportItemCollection items) { - + private void BuildProperNames (ReportItemCollection items) { foreach (IItemRenderer item in items) { IContainerItem it = item as IContainerItem; if (it != null) { - AdjustNames (it.Items); + BuildProperNames (it.Items); } item.Name = nameService.CreateName(items,item.Name); } From 88688e3a01b3e81275f99b69e16c15f86679adf7 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Tue, 11 Jul 2006 13:50:13 +0000 Subject: [PATCH 18/22] Fixed forum-9719: cannot include binary files in project templates. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1563 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Project/Src/Gui/Dialogs/NewFileDialog.cs | 17 ++++++++++++++--- .../Templates/File/FileDescriptionTemplate.cs | 16 +++++++++++++++- .../Src/Internal/Templates/File/ScriptRunner.cs | 2 ++ .../Templates/Project/ProjectDescriptor.cs | 14 +++++++++----- .../Gui/SearchAndReplacePanel.cs | 2 ++ 5 files changed, 42 insertions(+), 9 deletions(-) diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/NewFileDialog.cs b/src/Main/Base/Project/Src/Gui/Dialogs/NewFileDialog.cs index da2a856952..c1220f313e 100644 --- a/src/Main/Base/Project/Src/Gui/Dialogs/NewFileDialog.cs +++ b/src/Main/Base/Project/Src/Gui/Dialogs/NewFileDialog.cs @@ -373,7 +373,7 @@ namespace ICSharpCode.SharpDevelop.Gui return true; } - public void SaveFile(FileDescriptionTemplate newfile, string content) + public void SaveFile(FileDescriptionTemplate newfile, string content, byte[] binaryContent) { string parsedFileName = StringParser.Parse(newfile.Name); // Parse twice so that tags used in included standard header are parsed @@ -382,9 +382,16 @@ namespace ICSharpCode.SharpDevelop.Gui parsedFileName = parsedFileName.Substring(1); if (newfile.IsDependentFile && Path.IsPathRooted(parsedFileName)) { Directory.CreateDirectory(Path.GetDirectoryName(parsedFileName)); - File.WriteAllText(parsedFileName, parsedContent, ParserService.DefaultFileEncoding); + if (binaryContent != null) + File.WriteAllBytes(parsedFileName, binaryContent); + else + File.WriteAllText(parsedFileName, parsedContent, ParserService.DefaultFileEncoding); ParserService.ParseFile(parsedFileName, parsedContent); } else { + if (binaryContent != null) { + LoggingService.Warn("binary file was skipped"); + return; + } IWorkbenchWindow window = FileService.NewFile(Path.GetFileName(parsedFileName), StringParser.Parse(newfile.Language), parsedContent); if (window == null) { return; @@ -486,7 +493,11 @@ namespace ICSharpCode.SharpDevelop.Gui ScriptRunner scriptRunner = new ScriptRunner(); foreach (FileDescriptionTemplate newfile in item.Template.FileDescriptionTemplates) { - SaveFile(newfile, scriptRunner.CompileScript(item.Template, newfile)); + if (newfile.ContentData != null) { + SaveFile(newfile, null, newfile.ContentData); + } else { + SaveFile(newfile, scriptRunner.CompileScript(item.Template, newfile), null); + } } DialogResult = DialogResult.OK; } diff --git a/src/Main/Base/Project/Src/Internal/Templates/File/FileDescriptionTemplate.cs b/src/Main/Base/Project/Src/Internal/Templates/File/FileDescriptionTemplate.cs index 6145f2c11d..7c55f2311d 100644 --- a/src/Main/Base/Project/Src/Internal/Templates/File/FileDescriptionTemplate.cs +++ b/src/Main/Base/Project/Src/Internal/Templates/File/FileDescriptionTemplate.cs @@ -19,7 +19,11 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates { string name; string language; + + // Either content or contentData is set, the other is null string content; + byte[] contentData; + string buildAction; string copyToOutputDirectory; string dependentUpon; @@ -42,7 +46,11 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates if (xml.HasAttribute("src")) { string fileName = Path.Combine(hintPath, StringParser.Parse(xml.GetAttribute("src"))); try { - content = File.ReadAllText(fileName); + if (xml.HasAttribute("binary") && bool.Parse(xml.GetAttribute("binary"))) { + contentData = File.ReadAllBytes(fileName); + } else { + content = File.ReadAllText(fileName); + } } catch (Exception e) { content = "Error reading content from " + fileName + ":\n" + e.ToString(); LoggingService.Warn(content); @@ -95,6 +103,12 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates } } + public byte[] ContentData { + get { + return contentData; + } + } + public string BuildAction { get { return buildAction ?? ""; diff --git a/src/Main/Base/Project/Src/Internal/Templates/File/ScriptRunner.cs b/src/Main/Base/Project/Src/Internal/Templates/File/ScriptRunner.cs index 382b960b81..b76df9ddae 100644 --- a/src/Main/Base/Project/Src/Internal/Templates/File/ScriptRunner.cs +++ b/src/Main/Base/Project/Src/Internal/Templates/File/ScriptRunner.cs @@ -33,6 +33,8 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates public string CompileScript(FileTemplate item, FileDescriptionTemplate file) { + if (file.Content == null) + throw new ArgumentException("file must have textual content"); Match m = scriptRegex.Match(file.Content); m = m.NextMatch(); if (m.Success) { diff --git a/src/Main/Base/Project/Src/Internal/Templates/Project/ProjectDescriptor.cs b/src/Main/Base/Project/Src/Internal/Templates/Project/ProjectDescriptor.cs index 28cfea7103..78d57cddc4 100644 --- a/src/Main/Base/Project/Src/Internal/Templates/Project/ProjectDescriptor.cs +++ b/src/Main/Base/Project/Src/Internal/Templates/Project/ProjectDescriptor.cs @@ -202,11 +202,15 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates if (!Directory.Exists(Path.GetDirectoryName(fileName))) { Directory.CreateDirectory(Path.GetDirectoryName(fileName)); } - Properties properties = ((Properties)PropertyService.Get("ICSharpCode.TextEditor.Document.Document.DefaultDocumentAggregatorProperties", new Properties())); - - StreamWriter sr = new StreamWriter(File.Create(fileName), Encoding.GetEncoding(properties.Get("Encoding", 1252))); - sr.Write(StringParser.Parse(StringParser.Parse(file.Content, new string[,] { {"ProjectName", projectCreateInformation.ProjectName}, {"FileName", fileName}}))); - sr.Close(); + if (file.ContentData != null) { + // Binary content + File.WriteAllBytes(fileName, file.ContentData); + } else { + // Textual content + StreamWriter sr = new StreamWriter(File.Create(fileName), ParserService.DefaultFileEncoding); + sr.Write(StringParser.Parse(StringParser.Parse(file.Content, new string[,] { {"ProjectName", projectCreateInformation.ProjectName}, {"FileName", fileName}}))); + sr.Close(); + } } catch (Exception ex) { StringParser.Properties["fileName"] = fileName; MessageService.ShowError(ex, "${res:ICSharpCode.SharpDevelop.Internal.Templates.ProjectDescriptor.FileCouldntBeWrittenError}"); diff --git a/src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Gui/SearchAndReplacePanel.cs b/src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Gui/SearchAndReplacePanel.cs index 45afaa9560..05e8643283 100644 --- a/src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Gui/SearchAndReplacePanel.cs +++ b/src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Gui/SearchAndReplacePanel.cs @@ -42,11 +42,13 @@ namespace SearchAndReplace SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("Resources.FindPanel.xfrm")); Get