diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/Factories.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/Factories.cs
index 2ed99ddeaa..1e0879219e 100644
--- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/Factories.cs
+++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/Factories.cs
@@ -38,7 +38,8 @@ namespace SharpReport.Designer {
public class IDesignableFactory : SharpReportCore.GenericFactory {
- public IDesignableFactory() :base(Assembly.GetExecutingAssembly(),typeof(IDesignable)){
+ public IDesignableFactory() :base(Assembly.GetExecutingAssembly(),
+ typeof(IDesignable)){
}
public new BaseReportItem Create(string name) {
diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/IDesignerVisitor.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/IDesignerVisitor.cs
deleted file mode 100644
index 0e2a34c045..0000000000
--- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/IDesignerVisitor.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Created by SharpDevelop.
- * User: Forstmeier Helmut
- * Date: 10.08.2005
- * Time: 22:14
- *
- * To change this template use Tools | Options | Coding | Edit Standard Headers.
- */
-
-///
-/// Each DesignControl Visitor has to implement this Interface
-///
-using System;
-
-namespace SharpReport.Designer{
- public interface IDesignerVisitor {
- void Visit (SharpReport.Designer.BaseDesignerControl designer);
- }
-}
-
diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/IVisitor.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/IVisitor.cs
deleted file mode 100644
index 905432bb4b..0000000000
--- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/IVisitor.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Created by SharpDevelop.
- * User: Forstmeier Peter
- * Date: 10.08.2005
- * Time: 13:38
- *
- * To change this template use Tools | Options | Coding | Edit Standard Headers.
- */
-
- using System;
- using SharpReport.Designer;
-
- namespace SharpReport.Designer{
- ///
- /// Implemented in SharpReportDesigner
- ///
-
- public interface IVisitor{
- void Accept(IDesignerVisitor visitor);
- }
- }
diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/BaseDesignerControl.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/BaseDesignerControl.cs
index 5ae675a03d..81c7217899 100644
--- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/BaseDesignerControl.cs
+++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/BaseDesignerControl.cs
@@ -21,7 +21,7 @@ namespace SharpReport.Designer{
///
/// Description of BaseDesignerControl.
///
- public class BaseDesignerControl : System.Windows.Forms.UserControl,SharpReport.Designer.IVisitor
+ public class BaseDesignerControl : UserControl,SharpReportCore.IVisitor
{
private SharpReport.Designer.Report reportControl;
private Ruler.ctrlRuler ctrlRuler1;
@@ -118,9 +118,12 @@ namespace SharpReport.Designer{
#endregion
#region SharpReport.DelegatesInterfaces.IVisitor interface implementation
- public void Accept(IDesignerVisitor visitor) {
- visitor.Visit(this);
+
+ public void Accept(IModelVisitor visitor){
+ SharpReportCore.IModelVisitor v = visitor as SharpReportCore.IModelVisitor;
+ v.Visit(this);
}
+
#endregion
diff --git a/src/AddIns/Misc/SharpReport/SharpReport/SharpReport.csproj b/src/AddIns/Misc/SharpReport/SharpReport/SharpReport.csproj
index c551ab16bb..f15908ac5c 100644
--- a/src/AddIns/Misc/SharpReport/SharpReport/SharpReport.csproj
+++ b/src/AddIns/Misc/SharpReport/SharpReport/SharpReport.csproj
@@ -62,8 +62,6 @@
-
-
@@ -76,7 +74,6 @@
-
diff --git a/src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs b/src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs
index f40f837a32..60ec30a434 100644
--- a/src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs
+++ b/src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs
@@ -261,7 +261,7 @@ namespace SharpReport{
public void SaveToFile(string fileName){
try {
SharpReport.Visitors.SaveReportVisitor saveVisitor = new SharpReport.Visitors.SaveReportVisitor();
- this.baseDesignerControl.Accept (saveVisitor);
+ this.baseDesignerControl.Accept ((SharpReportCore.IModelVisitor)saveVisitor);
XmlDocument xmlDoc = saveVisitor.XmlDocument;
XmlTextWriter xw = new XmlTextWriter (fileName,System.Text.Encoding.UTF8);
xmlDoc.PreserveWhitespace = true;
diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Visitors/AbstractVisitor.cs b/src/AddIns/Misc/SharpReport/SharpReport/Visitors/AbstractVisitor.cs
deleted file mode 100644
index 1275f0893b..0000000000
--- a/src/AddIns/Misc/SharpReport/SharpReport/Visitors/AbstractVisitor.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version: 1.1.4322.2032
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-using System;
-using System.Xml;
-
-using SharpReport.Designer;
-
-using SharpReportCore;
-namespace SharpReport.Visitors
-{
-
-
- ///
- /// Abstract Class for Designer Visitor
- ///
- ///
- /// created by - Forstmeier Peter
- /// created on - 02.12.2004 16:53:00
- ///
- public class AbstractVisitor : object, SharpReport.Designer.IDesignerVisitor {
- private readonly string nodesQuery = "controls/control";
- private string fileName;
- private XmlFormReader xmlFormReader;
-
- public AbstractVisitor() {
- }
-
- public AbstractVisitor(string fileName){
- this.fileName = fileName;
- xmlFormReader = new XmlFormReader() ;
- }
-
-
-
- ///
- /// All classes how use this baseclass have to override this method
- ///
- ///
- /// Interface method from IDesignerVisitor
- ///
- ///
- public virtual void Visit(SharpReport.Designer.BaseDesignerControl designer) {
-
- }
-
-
-
- #region Properties
- protected string FileName {
- get {
- return fileName;
- }
- }
-
- protected XmlFormReader XmlFormReader {
- get {
- return xmlFormReader;
- }
- }
-
- protected string NodesQuery {
- get {
- return nodesQuery;
- }
- }
-
- #endregion
-
- }
-}
diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Visitors/LoadReportVisitor.cs b/src/AddIns/Misc/SharpReport/SharpReport/Visitors/LoadReportVisitor.cs
index 05d19a65e7..c947451fd7 100644
--- a/src/AddIns/Misc/SharpReport/SharpReport/Visitors/LoadReportVisitor.cs
+++ b/src/AddIns/Misc/SharpReport/SharpReport/Visitors/LoadReportVisitor.cs
@@ -28,9 +28,9 @@ using SharpReport.ReportItems;
namespace SharpReport.Visitors {
- public class LoadReportVisitor : SharpReport.Visitors.AbstractVisitor {
-
- SharpReport.Designer.BaseDesignerControl designer;
+
+ public class LoadReportVisitor : SharpReportCore.AbstractModelVisitor {
+ SharpReport.Designer.BaseDesignerControl baseDesigner;
IDesignableFactory designableFactory ;
public LoadReportVisitor(string fileName):base(fileName) {
@@ -41,16 +41,19 @@ namespace SharpReport.Visitors {
/// Loads ReportDefinition from File and set the values in the SharpReportDesigner
///
/// SharpReportDesigner
-
- public override void Visit(SharpReport.Designer.BaseDesignerControl designer){
+ public override void Visit(System.Windows.Forms.Control designer){
if (designer == null) {
throw new ArgumentNullException("designer");
}
+ this.baseDesigner = designer as SharpReport.Designer.BaseDesignerControl;
+
+ if (this.baseDesigner == null) {
+ throw new ArgumentException("designer");
+ }
XmlDocument xmlDoc;
try {
xmlDoc = XmlHelper.OpenSharpReport (base.FileName);
- this.designer = designer;
SetDesigner (xmlDoc);
AdjustSectionsWidth();
} catch (Exception ) {
@@ -60,41 +63,36 @@ namespace SharpReport.Visitors {
}
private void AdjustSectionsWidth() {
- foreach (ReportSection section in designer.SectionsCollection) {
- section.VisualControl.Width = designer.ReportModel.ReportSettings.PageSettings.Bounds.Width;
+ foreach (ReportSection section in baseDesigner.SectionsCollection) {
+ section.VisualControl.Width = baseDesigner.ReportModel.ReportSettings.PageSettings.Bounds.Width;
if (section.SectionMargin == 0) {
- section.SectionMargin = designer.ReportModel.ReportSettings.PageSettings.Bounds.Left;
+ section.SectionMargin = baseDesigner.ReportModel.ReportSettings.PageSettings.Bounds.Left;
}
}
}
-
private void SetDesigner (XmlDocument doc){
- this.designer.ReportModel.ReportSettings.SetSettings ((XmlElement)doc.DocumentElement.FirstChild);
+ this.baseDesigner.ReportModel.ReportSettings.SetSettings ((XmlElement)doc.DocumentElement.FirstChild);
SetSections (doc);
}
private void SetSections (XmlDocument doc) {
-
+
XmlNodeList sectionNodes = doc.DocumentElement.ChildNodes;
//Start with node(1)
- XmlNode node;
- BaseSection baseSection = null;
+
for (int i = 1;i < sectionNodes.Count ; i++ ) {
- node = sectionNodes[i];
+ XmlNode node = sectionNodes[i];
XmlElement sectionElem = node as XmlElement;
if (sectionElem != null) {
- baseSection = (BaseSection)designer.ReportModel.SectionCollection.Find(sectionElem.GetAttribute("name"));
- if (baseSection != null) {
- XmlHelper.SetSectionValues (base.XmlFormReader,sectionElem,baseSection);
- XmlNodeList ctrlList = sectionElem.SelectNodes (base.NodesQuery);
- SetReportItems(baseSection,null,ctrlList);
- } else {
- throw new MissingSectionException();
- }
+ BaseSection baseSection = (BaseSection)baseDesigner.ReportModel.SectionCollection.Find(sectionElem.GetAttribute("name"));
+
+ XmlNodeList ctrlList = base.MakeSection(sectionElem,baseSection);
+ SetReportItems(baseSection,null,ctrlList);
+
} else {
throw new MissingSectionException();
}
@@ -106,7 +104,6 @@ namespace SharpReport.Visitors {
IContainerItem parentContainer,XmlNodeList ctrlList) {
BaseReportItem baseReportItem;
- //BaseReportItem parentItem;
foreach (XmlNode ctrlNode in ctrlList) {
XmlElement ctrlElem = ctrlNode as XmlElement;
if (ctrlElem != null) {
@@ -114,28 +111,12 @@ namespace SharpReport.Visitors {
try {
itemRenderer = designableFactory.Create(ctrlElem.GetAttribute("type"));
- baseReportItem = (BaseReportItem)itemRenderer;
-
- baseReportItem.SuspendLayout();
- XmlHelper.SetReportItemValues (base.XmlFormReader,ctrlElem,baseReportItem);
-
- if (parentContainer == null) {
- baseReportItem.Parent = baseSection;
- baseSection.Items.Add (baseReportItem);
- } else {
- baseReportItem.Parent = parentContainer;
- parentContainer.Items.Add(baseReportItem);
-
- }
- baseReportItem.ResumeLayout();
+ baseReportItem = base.MakeItem(ctrlElem,parentContainer,baseSection,itemRenderer);
IContainerItem iContainer = baseReportItem as IContainerItem;
if (iContainer != null) {
XmlNodeList newList = ctrlNode.SelectNodes (base.NodesQuery);
if (newList.Count > 0) {
- System.Console.WriteLine("\tLoadReportVisitor recursive call for <{0}> with {1} elements",
- baseReportItem.Name,
- newList.Count);
SetReportItems (baseSection,iContainer,newList);
}
}
diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Visitors/SaveReportVisitor.cs b/src/AddIns/Misc/SharpReport/SharpReport/Visitors/SaveReportVisitor.cs
index fc964f4ee8..f1a2469d10 100644
--- a/src/AddIns/Misc/SharpReport/SharpReport/Visitors/SaveReportVisitor.cs
+++ b/src/AddIns/Misc/SharpReport/SharpReport/Visitors/SaveReportVisitor.cs
@@ -20,17 +20,22 @@ namespace SharpReport.Visitors{
/// Description of SaveReportVisitor.
///
- public class SaveReportVisitor : AbstractVisitor
+ public class SaveReportVisitor :SharpReportCore.AbstractModelVisitor
{
private XmlDocument xmlDoc;
+ private SharpReport.Designer.BaseDesignerControl baseDesigner;
- public SaveReportVisitor ():base() {
+ public SaveReportVisitor ():base(String.Empty) {
}
-
- public override void Visit (SharpReport.Designer.BaseDesignerControl designer) {
- xmlDoc = this.BuildReportDocument(designer);
+ public override void Visit (Control designer) {
+ this.baseDesigner = designer as SharpReport.Designer.BaseDesignerControl;
+
+ if (this.baseDesigner == null) {
+ throw new ArgumentException("designer");
+ }
+ xmlDoc = this.BuildReportDocument(baseDesigner);
}
private XmlDocument BuildReportDocument (SharpReport.Designer.BaseDesignerControl designer) {
diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseDataItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseDataItem.cs
index c38f2a0983..c05ff37e96 100644
--- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseDataItem.cs
+++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseDataItem.cs
@@ -68,6 +68,7 @@ namespace SharpReportCore {
string toPrint = CheckForNullValue();
base.Text = base.FireFormatOutput(toPrint,this.FormatString,"");
+// System.Console.WriteLine("\tBaseDataItem <{0}> / <{1}>",this.Name,this.Text);
base.Render (rpea);
}
diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs
index 8cfb6454f0..df56b1972a 100644
--- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs
+++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs
@@ -35,14 +35,15 @@ namespace SharpReportCore{
public RowItem(string tableName){
this.tableName = tableName;
- this.Items.Added += OnAdded;
+// this.Items.Added += OnAdded;
}
+ /*
void OnAdded (object sender, CollectionItemEventArgs e){
System.Console.WriteLine("");
System.Console.WriteLine("RowItem:OnAdded did we use this function???");
}
-
+ */
#region overrides
@@ -58,8 +59,8 @@ namespace SharpReportCore{
if (rpea == null) {
throw new ArgumentNullException("rpea");
}
- System.Console.WriteLine("");
- System.Console.WriteLine("--Start of {0}",this.ToString());
+// System.Console.WriteLine("");
+// System.Console.WriteLine("--Start of {0}",this.ToString());
base.Render(rpea);
RectangleF rect = PrepareRectangle (rpea);
@@ -83,8 +84,8 @@ namespace SharpReportCore{
childItem.Render (rpea);
childItem.Location = new Point(loc.X,loc.Y);
}
- System.Console.WriteLine("--End of RowItem");
- System.Console.WriteLine("");
+// System.Console.WriteLine("--End of RowItem");
+// System.Console.WriteLine("");
base.NotiyfyAfterPrint (rpea.LocationAfterDraw);
}
diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataManager.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataManager.cs
index ec1b56a655..44e112865d 100644
--- a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataManager.cs
+++ b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataManager.cs
@@ -35,8 +35,8 @@ namespace SharpReportCore {
GroupSeperator groupSeperator;
public event EventHandler ListChanged;
- public event EventHandler GroupChanged;
- public event EventHandler GroupChanging;
+// public event EventHandler GroupChanged;
+// public event EventHandler GroupChanging;
///
/// use this Constructor for PullDataReports
@@ -62,7 +62,7 @@ namespace SharpReportCore {
this.dataViewStrategy = new TableStrategy((DataTable)this.dataSource,
reportSettings);
this.dataViewStrategy.ListChanged += new EventHandler (NotifyListChanged);
- this.dataViewStrategy.GroupChanged += new EventHandler (OnGroupChange);
+// this.dataViewStrategy.GroupChanged += new EventHandler (OnGroupChange);
}
public DataManager(DataTable dataSource, ReportSettings reportSettings){
@@ -272,18 +272,18 @@ namespace SharpReportCore {
}
private void NotifyGroupChanging () {
- if (this.GroupChanging!= null) {
- this.GroupChanging (this,EventArgs.Empty);
- }
+// if (this.GroupChanging!= null) {
+// this.GroupChanging (this,EventArgs.Empty);
+// }
}
+
private void NotifyGroupChanged() {
if (this.IsGrouped) {
- if (this.GroupChanged != null) {
- this.GroupChanged (this,new GroupChangedEventArgs(this.groupSeperator));
- }
+// if (this.GroupChanged != null) {
+// this.GroupChanged (this,new GroupChangedEventArgs(this.groupSeperator));
+// }
}
-
}
private void OnGroupChange (object sender,GroupChangedEventArgs e) {
@@ -384,7 +384,6 @@ namespace SharpReportCore {
}
}
- // Nur zum testen
public DataNavigator GetNavigator {
get {
@@ -393,22 +392,6 @@ namespace SharpReportCore {
}
- /*
- public object Current {
- get {
- throw new NotImplementedException();
- }
- }
- */
-// public void Reset() {
-// this.dataViewStrategy.Reset();
-// }
-//
-// public bool MoveNext() {
-// return this.dataViewStrategy.MoveNext();
-// }
-
-
public bool IsGrouped {
get {
@@ -427,6 +410,7 @@ namespace SharpReportCore {
return this.dataViewStrategy.IsFiltered;
}
}
+
#region System.IDisposable interface implementation
public void Dispose() {
this.Dispose(true);
diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataNavigator.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataNavigator.cs
index e91fc37bc5..9040308862 100644
--- a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataNavigator.cs
+++ b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataNavigator.cs
@@ -17,12 +17,16 @@ namespace SharpReportCore
public class DataNavigator :IDataNavigator{
IDataViewStrategy store;
- public event EventHandler ListChanged;
+ GroupSeperator groupSeperator;
+ public event EventHandler ListChanged;
+// public event EventHandler GroupChanging;
+ public event EventHandler GroupChanged;
public DataNavigator(IDataViewStrategy store){
this.store = store;
this.store.ListChanged += new EventHandler (OnListChanged);
+ this.store.GroupChanged += new EventHandler (OnGroupChange);
}
private void OnListChanged (object sender,System.ComponentModel.ListChangedEventArgs e) {
@@ -31,10 +35,34 @@ namespace SharpReportCore
}
}
+// private void NotifyGroupChanging () {
+// if (this.GroupChanging!= null) {
+// this.GroupChanging (this,EventArgs.Empty);
+// }
+// }
+
+ private void NotifyGroupChanged() {
+ if (this.store.IsGrouped) {
+ if (this.GroupChanged != null) {
+ this.GroupChanged (this,new GroupChangedEventArgs(this.groupSeperator));
+ }
+ }
+ }
+
+ private void OnGroupChange (object sender,GroupChangedEventArgs e) {
+ this.groupSeperator = e.GroupSeperator;
+ this.NotifyGroupChanged();
+ }
+
+ #region IDataNavigator implementation
+
public void Fill (ReportItemCollection collection) {
+// this.NotifyGroupChanging();
+ this.NotifyGroupChanged();
foreach (IItemRenderer item in collection) {
this.store.Fill(item);
}
+// this.NotifyGroupChanged();
}
@@ -79,5 +107,7 @@ namespace SharpReportCore
return this.store.Current;
}
}
+
+ #endregion
}
}
diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/CollectionStrategy.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/CollectionStrategy.cs
index 856814305e..5a7a78bde7 100644
--- a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/CollectionStrategy.cs
+++ b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/CollectionStrategy.cs
@@ -212,13 +212,15 @@ namespace SharpReportCore {
public override void Bind() {
base.Bind();
- if ((base.ReportSettings.GroupColumnsCollection != null) && (base.ReportSettings.GroupColumnsCollection.Count > 0)) {
+// if ((base.ReportSettings.GroupColumnsCollection != null) && (base.ReportSettings.GroupColumnsCollection.Count > 0)) {
+ if (base.ReportSettings.GroupColumnsCollection.Count > 0) {
this.Group ();
Reset();
return;
}
if (base.ReportSettings.SortColumnCollection != null) {
+// if (base.ReportSettings.SortColumnCollection.Count > 0) {
this.Sort ();
}
Reset();
diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/TableStrategy.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/TableStrategy.cs
index 4f3b73b905..d835372ec2 100644
--- a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/TableStrategy.cs
+++ b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/TableStrategy.cs
@@ -92,8 +92,6 @@ namespace SharpReportCore {
#region Grouping
-
-
private void BuildGroup(){
try {
SharpIndexCollection groupedArray = new SharpIndexCollection();
@@ -168,15 +166,14 @@ namespace SharpReportCore {
public override void Bind() {
base.Bind();
- if ((base.ReportSettings.GroupColumnsCollection != null) && (base.ReportSettings.GroupColumnsCollection.Count > 0)) {
+ if (base.ReportSettings.GroupColumnsCollection.Count > 0) {
this.Group ();
Reset();
return;
}
- if (base.ReportSettings.SortColumnCollection != null) {
this.Sort ();
- }
+
Reset();
}
@@ -208,7 +205,7 @@ namespace SharpReportCore {
try {
base.Fill(item);
if (this.Current == null) {
- System.Console.WriteLine("ow is null");
+ System.Console.WriteLine("row is null");
}
if (this.row != null) {
BaseDataItem baseDataItem = item as BaseDataItem;
@@ -239,6 +236,7 @@ namespace SharpReportCore {
public override int Count {
get {
return this.IndexList.Count;
+// return this.view.Count;
}
}
diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractDataRenderer.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractDataRenderer.cs
index a777109540..173608ddcb 100644
--- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractDataRenderer.cs
+++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractDataRenderer.cs
@@ -39,7 +39,6 @@ namespace SharpReportCore{
protected override int RenderSection(BaseSection section, ReportPageEventArgs rpea){
-
bool hasContainer = false;
IContainerItem container = null;
foreach (BaseReportItem item in section.Items) {
@@ -54,7 +53,7 @@ namespace SharpReportCore{
} else {
return base.RenderSection(section, rpea);
}
-
+
}
private int DoContainerControl (BaseSection section,
@@ -64,7 +63,6 @@ namespace SharpReportCore{
if (container == null) {
return section.Size.Height;
}
-
this.DataNavigator.Fill(container.Items);
Point drawPoint = new Point(0,0);
if (section.Visible){
@@ -81,10 +79,8 @@ namespace SharpReportCore{
}
if ((section.CanGrow == false)&& (section.CanShrink == false)) {
- return section.Size.Height;
-
- }
-
+ return section.Size.Height;
+ }
return drawPoint.Y;
}
return drawPoint.Y;
diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs
index b38f6bf3c2..fbdfd83c11 100644
--- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs
+++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs
@@ -219,6 +219,7 @@ namespace SharpReportCore {
protected void DrawSingleItem (ReportPageEventArgs rpea,BaseReportItem item){
item.SuspendLayout();
+// System.Console.WriteLine("\tDrawSingleItem {0}",item.Name);
item.FormatOutput -= new EventHandler (FormatBaseReportItem);
item.FormatOutput += new EventHandler (FormatBaseReportItem);
item.Render(rpea);
@@ -227,10 +228,11 @@ namespace SharpReportCore {
// Called by FormatOutPutEvent of the BaseReportItem
void FormatBaseReportItem (object sender, FormatOutputEventArgs rpea) {
-// System.Console.WriteLine("FormatBaseReportItem");
BaseDataItem baseDataItem = sender as BaseDataItem;
+
if (baseDataItem != null) {
if (!String.IsNullOrEmpty(baseDataItem.FormatString)) {
+
rpea.FormatedValue = defaultFormatter.FormatItem (baseDataItem);
// System.Console.WriteLine("\tFormated Value = {0}",rpea.FormatedValue);
} else {
diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs
index c7bb557bbe..a39419ef1c 100644
--- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs
+++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs
@@ -47,8 +47,8 @@ namespace SharpReportCore {
public RenderDataReport(ReportModel model,DataManager dataManager):base (model,dataManager){
- base.DataManager.GroupChanged += new EventHandler(OnGroupChanged);
- base.DataManager.GroupChanging += new EventHandler (OnGroupChanging);
+// base.DataManager.GroupChanged += new EventHandler(OnGroupChanged);
+// base.DataManager.GroupChanging += new EventHandler (OnGroupChanging);
}
@@ -156,7 +156,7 @@ namespace SharpReportCore {
}
protected override void BeginPrintPage(object sender, ReportPageEventArgs rpea) {
- System.Console.WriteLine("!!! Beginprintpage");
+ System.Console.WriteLine("!!! BeginPrintpage");
if (rpea == null) {
throw new ArgumentNullException("rpea");
}
@@ -206,7 +206,6 @@ namespace SharpReportCore {
while (this.dataNavigator.MoveNext()) {
this.dataNavigator.Fill (base.CurrentSection.Items);
base.RenderSection (section,rpea);
-
section.SectionOffset = section.SectionOffset + section.Size.Height + 2 * base.Gap;
base.FitSectionToItems (base.CurrentSection,rpea);
diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/ReportModel.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/ReportModel.cs
index 57803b103c..576a7e09a8 100644
--- a/src/AddIns/Misc/SharpReport/SharpReportCore/ReportModel.cs
+++ b/src/AddIns/Misc/SharpReport/SharpReportCore/ReportModel.cs
@@ -32,10 +32,8 @@ namespace SharpReportCore {
using System;
using System.Drawing;
using SharpReportCore;
-
-
- public class ReportModel : object,SharpReportCore.IModel,IDisposable{
-
+
+ public class ReportModel : object,SharpReportCore.IVisitor,IDisposable{
ReportSettings reportSettings;
ReportSectionCollection sectionCollection;
diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs
index b8eb8ce1b0..88155fd8a9 100644
--- a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs
+++ b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs
@@ -505,7 +505,7 @@ namespace SharpReportCore {
try {
ReportModel model = new ReportModel();
- SharpReportCore.LoadModelVisitor modelVisitor = new SharpReportCore.LoadModelVisitor(model,fileName);
+ SharpReportCore.LoadModelVisitor modelVisitor = new SharpReportCore.LoadModelVisitor(model,fileName);
model.Accept (modelVisitor);
return model;
} catch (Exception) {
diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/AbstractModelVisitor.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/AbstractModelVisitor.cs
index 05dbb0733e..4573089fec 100644
--- a/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/AbstractModelVisitor.cs
+++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/AbstractModelVisitor.cs
@@ -8,7 +8,7 @@
//
//------------------------------------------------------------------------------
using System;
-
+using System.Xml;
///
/// Base Class for ModelVisitor
///
@@ -18,18 +18,79 @@ using System;
///
namespace SharpReportCore {
public class AbstractModelVisitor : object, SharpReportCore.IModelVisitor {
+ private readonly string nodesQuery = "controls/control";
+ private SharpReportCore.XmlFormReader xmlFormReader;
+ private string fileName;
+// private GenericFactory genericFactory;
///
/// Default constructor - initializes all fields to default values
///
- public AbstractModelVisitor() {
+
+
+ public AbstractModelVisitor(string fileName){
+ this.fileName = fileName;
+ xmlFormReader = new XmlFormReader() ;
+ }
+
+ protected XmlNodeList MakeSection (XmlElement sectionElem,BaseSection baseSection) {
+ if (baseSection == null) {
+ throw new MissingSectionException();
+ }
+ baseSection.SuspendLayout();
+ XmlHelper.SetSectionValues (xmlFormReader,sectionElem,baseSection);
+ baseSection.ResumeLayout();
+ return BuildControlList(sectionElem);
+ }
+
+
+ protected BaseReportItem MakeItem (XmlElement elem,IContainerItem parent,
+ BaseSection section,IItemRenderer itemRenderer) {
+
+ BaseReportItem item = (BaseReportItem)itemRenderer;
+ item.SuspendLayout();
+ XmlHelper.SetReportItemValues (xmlFormReader,elem,item);
+ if (parent == null) {
+ item.Parent = section;
+ section.Items.Add (item);
+ } else {
+ item.Parent = parent;
+ parent.Items.Add(item);
+ }
+ item.ResumeLayout();
+ return item;
}
+ protected XmlNodeList BuildControlList(XmlElement section) {
+ return section.SelectNodes (this.nodesQuery);
+ }
+
+ protected string NodesQuery {
+ get {
+ return nodesQuery;
+ }
+ }
+
+ protected XmlFormReader XmlFormReader {
+ get {
+ return xmlFormReader;
+ }
+ }
+ protected string FileName {
+ get {
+ return fileName;
+ }
+ }
+
+
#region SharpReport.DelegatesInterfaces.IModelVisitor interface implementation
public virtual void Visit(SharpReportCore.ReportModel reportModel) {
-
+ throw new NotImplementedException();
+ }
+ public virtual void Visit (System.Windows.Forms.Control designer){
+ throw new NotImplementedException();
}
#endregion
diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/IVisitor.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/IVisitor.cs
index bab00013b7..00c3a27919 100644
--- a/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/IVisitor.cs
+++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/IVisitor.cs
@@ -11,13 +11,24 @@ using System;
namespace SharpReportCore{
-
- public interface IModel{
- void Accept(IModelVisitor visitor);
- }
+
+ ///
+ /// Used by
+ ///
+
+ public interface IVisitor{
+ void Accept(SharpReportCore.IModelVisitor visitor);
+ }
public interface IModelVisitor{
+ ///
+ /// Use this function to Visit from ReportEngine
+ ///
void Visit (SharpReportCore.ReportModel reportModel);
+ ///
+ /// This function is used by the Designer
+ ///
+ void Visit (System.Windows.Forms.Control designer);
}
}
diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/LoadModelVisitor.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/LoadModelVisitor.cs
index 7aea187159..6f01209afb 100644
--- a/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/LoadModelVisitor.cs
+++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/LoadModelVisitor.cs
@@ -25,13 +25,11 @@ using SharpReportCore;
namespace SharpReportCore {
public class LoadModelVisitor : SharpReportCore.AbstractModelVisitor {
- private string fileName;
private ReportModel model;
- SharpReportCore.XmlFormReader xmlFormReader;
BaseItemFactory baseItemFactory;
- public LoadModelVisitor(ReportModel reportModel,string fileName){
- this.fileName = fileName;
+ public LoadModelVisitor(ReportModel reportModel,
+ string fileName):base(fileName){
this.model = reportModel;
baseItemFactory = new BaseItemFactory();
}
@@ -40,12 +38,11 @@ namespace SharpReportCore {
#region overrides
public override void Visit(ReportModel reportModel) {
if (reportModel == null) {
- throw new MissingModelException();
+ throw new ArgumentNullException("reportModel");
} else {
XmlDocument xmlDoc;
try {
- xmlDoc = XmlHelper.OpenSharpReport (fileName);
- xmlFormReader = new XmlFormReader();
+ xmlDoc = XmlHelper.OpenSharpReport (base.FileName);
reportModel.ReportSettings.SetSettings ((XmlElement)xmlDoc.DocumentElement.FirstChild);
SetSections (xmlDoc);
} catch (Exception ) {
@@ -60,48 +57,51 @@ namespace SharpReportCore {
void SetSections (XmlDocument doc) {
XmlNodeList sectionNodes = doc.DocumentElement.ChildNodes;
//Start with node(1)
- XmlNode node;
- BaseSection baseSection;
+
for (int i = 1;i < sectionNodes.Count ; i++ ) {
- node = sectionNodes[i];
+ XmlNode node = sectionNodes[i];
if (node is XmlElement) {
XmlElement sectionElem = (XmlElement)node;
- baseSection = (BaseSection)model.SectionCollection.Find(sectionElem.GetAttribute("name"));
- baseSection.SuspendLayout();
- if (baseSection != null) {
- XmlHelper.SetSectionValues (xmlFormReader,sectionElem,baseSection);
- XmlNodeList ctrlList = sectionElem.SelectNodes ("controls/control");
- if (ctrlList.Count > 0) {
- foreach (XmlNode ctrlNode in ctrlList) {
- if (ctrlNode is XmlElement) {
- XmlElement ctrlElem = (XmlElement)ctrlNode;
- BaseReportItem rpt = null;
- try {
- //Read the Element
- rpt = (BaseReportItem)baseItemFactory.Create(ctrlElem.GetAttribute("basetype"));
- if (rpt != null) {
-// rpt.SuspendLayout();
- rpt.Parent = baseSection;
- baseSection.Items.Add (rpt);
- XmlHelper.SetReportItemValues (xmlFormReader,ctrlElem,rpt);
- rpt.Visible = true;
- rpt.ResumeLayout();
- } else {
- String str = String.Format("< {0}>",ctrlElem.GetAttribute("basetype"));
- throw new UnkownItemException(str);
- }
- } catch (Exception ) {
- throw;
- }
- }
+
+ BaseSection baseSection = (BaseSection)model.SectionCollection.Find(sectionElem.GetAttribute("name"));
+
+ XmlNodeList ctrlList = base.MakeSection(sectionElem,baseSection);
+ SetReportItems(baseSection,null,ctrlList);
+
+ }else {
+ throw new System.Xml.XmlException ("Report : SetSection Wrong Node in Report");
+ }
+ }
+ }
+
+
+ void SetReportItems(BaseSection baseSection,
+ IContainerItem parentContainer,XmlNodeList ctrlList) {
+
+ BaseReportItem baseReportItem;
+
+ foreach (XmlNode ctrlNode in ctrlList) {
+ XmlElement ctrlElem = ctrlNode as XmlElement;
+ if (ctrlElem != null) {
+ IItemRenderer itemRenderer = null;
+ try {
+ itemRenderer = baseItemFactory.Create(ctrlElem.GetAttribute("basetype"));
+ baseReportItem = base.MakeItem (ctrlElem,parentContainer,baseSection,itemRenderer);
+
+ IContainerItem iContainer = baseReportItem as IContainerItem;
+
+ if (iContainer != null) {
+ XmlNodeList newList = ctrlNode.SelectNodes (base.NodesQuery);
+ if (newList.Count > 0) {
+ SetReportItems (baseSection,iContainer,newList);
}
}
- }else {
- throw new MissingSectionException();
+
+ }
+ catch (Exception ) {
+ throw new UnkownItemException();
}
- }else {
- throw new System.Xml.XmlException ("Report : SetSection Wrong Node in Report");
}
}
}