Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@6321 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61pull/1/head
36 changed files with 997 additions and 300 deletions
@ -0,0 +1,145 @@
@@ -0,0 +1,145 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 27.07.2010 |
||||
* Time: 16:02 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
|
||||
namespace ICSharpCode.Reports.Core |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ChildNavigator.
|
||||
/// </summary>
|
||||
public class ChildNavigator:IDataNavigator |
||||
{ |
||||
IndexList indexList; |
||||
IDataViewStrategy dataStore; |
||||
private System.Collections.Generic.List<BaseComparer>.Enumerator ce; |
||||
|
||||
public ChildNavigator(IDataViewStrategy dataStore,IndexList indexList) |
||||
{ |
||||
if (dataStore == null) { |
||||
|
||||
throw new ArgumentNullException("dataStore"); |
||||
} |
||||
this.dataStore = dataStore; |
||||
this.indexList = indexList; |
||||
ce = this.indexList.GetEnumerator(); |
||||
ce.MoveNext(); |
||||
} |
||||
|
||||
public bool HasMoreData { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool HasChildren { |
||||
get { |
||||
IndexList ind = BuildChildList(); |
||||
return ((ind != null) && (ind.Count > 0)); |
||||
// return false;
|
||||
} |
||||
} |
||||
|
||||
public int ChildListCount { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsSorted { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsGrouped { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public int CurrentRow { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public int Count { |
||||
get { |
||||
return this.indexList.Count; |
||||
} |
||||
} |
||||
|
||||
public object Current { |
||||
get { |
||||
TableStrategy t = this.dataStore as TableStrategy; |
||||
return t.myCurrent(ce.Current.ListIndex); |
||||
// return ci;
|
||||
} |
||||
} |
||||
|
||||
public AvailableFieldsCollection AvailableFields { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public void Fill(ReportItemCollection collection) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public bool MoveNext() |
||||
{ |
||||
return this.ce.MoveNext(); |
||||
} |
||||
|
||||
public void Reset() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public CurrentItemsCollection GetDataRow() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public IDataNavigator GetChildNavigator() |
||||
{ |
||||
var i = BuildChildList(); |
||||
if ((i == null) || (i.Count == 0)) { |
||||
return null; |
||||
} |
||||
return new ChildNavigator(this.dataStore,i); |
||||
} |
||||
|
||||
public void SwitchGroup() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public bool ChildMoveNext() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public void FillChild(ReportItemCollection collection) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
private IndexList BuildChildList() |
||||
{ |
||||
GroupComparer gc = this.indexList[this.indexList.CurrentPosition] as GroupComparer; |
||||
if (gc == null) { |
||||
return null; |
||||
} |
||||
return gc.IndexList; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,166 @@
@@ -0,0 +1,166 @@
|
||||
/* |
||||
* Erstellt mit SharpDevelop. |
||||
* Benutzer: Peter |
||||
* Datum: 02.01.2009 |
||||
* Zeit: 17:33 |
||||
* |
||||
* Sie können diese Vorlage unter Extras > Optionen > Codeerstellung > Standardheader ändern. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Drawing; |
||||
|
||||
using ICSharpCode.Reports.Core.BaseClasses.Printing; |
||||
using ICSharpCode.Reports.Core.Interfaces; |
||||
|
||||
namespace ICSharpCode.Reports.Core.Exporter |
||||
{ |
||||
/// <summary>
|
||||
/// Description of RowConverter.
|
||||
/// </summary>
|
||||
///
|
||||
|
||||
public class RowConverter:BaseConverter |
||||
{ |
||||
|
||||
private BaseReportItem parent; |
||||
|
||||
public RowConverter(IDataNavigator dataNavigator, |
||||
ExporterPage singlePage, |
||||
|
||||
ILayouter layouter):base(dataNavigator,singlePage,layouter) |
||||
{ |
||||
} |
||||
|
||||
public override ExporterCollection Convert(BaseReportItem parent, BaseReportItem item) |
||||
{ |
||||
if (parent == null) { |
||||
throw new ArgumentNullException("parent"); |
||||
} |
||||
if (item == null) { |
||||
throw new ArgumentNullException("item"); |
||||
} |
||||
ISimpleContainer simpleContainer = item as ISimpleContainer; |
||||
this.parent = parent; |
||||
|
||||
simpleContainer.Parent = parent; |
||||
|
||||
PrintHelper.AdjustParent(parent,simpleContainer.Items); |
||||
if (PrintHelper.IsTextOnlyRow(simpleContainer)) { |
||||
ExporterCollection myList = new ExporterCollection(); |
||||
|
||||
base.BaseConvert (myList,simpleContainer,parent.Location.X, |
||||
new Point(base.SectionBounds.DetailStart.X,base.SectionBounds.DetailStart.Y)); |
||||
|
||||
return myList; |
||||
} else { |
||||
return this.ConvertDataRow(simpleContainer); |
||||
} |
||||
} |
||||
|
||||
private ExporterCollection ConvertDataRow (ISimpleContainer simpleContainer) |
||||
{ |
||||
ExporterCollection mylist = new ExporterCollection(); |
||||
Point currentPosition = new Point(base.SectionBounds.DetailStart.X,base.SectionBounds.DetailStart.Y); |
||||
BaseSection section = parent as BaseSection; |
||||
|
||||
int defaultLeftPos = parent.Location.X; |
||||
|
||||
do { |
||||
|
||||
PrintHelper.AdjustSectionLocation (section); |
||||
section.Size = this.SectionBounds.DetailSectionRectangle.Size; |
||||
base.SaveSize(section.Items[0].Size); |
||||
Color color = ((BaseReportItem)simpleContainer).BackColor; |
||||
if (base.DataNavigator.HasChildren) |
||||
{ |
||||
TestDecorateElement(simpleContainer); |
||||
} |
||||
|
||||
base.FillRow(simpleContainer); |
||||
|
||||
PrepareContainerForConverting(simpleContainer); |
||||
|
||||
base.FireSectionRendering(section); |
||||
|
||||
currentPosition = base.BaseConvert(mylist,simpleContainer,defaultLeftPos,currentPosition); |
||||
|
||||
AfterConverting (mylist,section); |
||||
|
||||
// Grouping starts ------------------------
|
||||
|
||||
if (base.DataNavigator.HasChildren) { |
||||
|
||||
//((BaseReportItem)simpleContainer).BackColor = color;
|
||||
StandardPrinter.AdjustBackColor(simpleContainer,GlobalValues.DefaultBackColor); |
||||
base.DataNavigator.SwitchGroup(); |
||||
do { |
||||
((BaseReportItem)simpleContainer).BackColor = color; |
||||
|
||||
base.DataNavigator.FillChild(simpleContainer.Items); |
||||
PrepareContainerForConverting(simpleContainer); |
||||
|
||||
base.FireSectionRendering(section); |
||||
|
||||
currentPosition = base.BaseConvert(mylist,simpleContainer,defaultLeftPos,currentPosition); |
||||
|
||||
AfterConverting (mylist,section); |
||||
} |
||||
while ( base.DataNavigator.ChildMoveNext()); |
||||
} |
||||
|
||||
// end grouping -----------------
|
||||
|
||||
if (PrintHelper.IsPageFull(new Rectangle(new Point (simpleContainer.Location.X,currentPosition.Y), section.Size),base.SectionBounds)) { |
||||
base.FirePageFull(mylist); |
||||
section.SectionOffset = base.SinglePage.SectionBounds.PageHeaderRectangle.Location.Y; |
||||
currentPosition = new Point(base.SectionBounds.PageHeaderRectangle.X,base.SectionBounds.PageHeaderRectangle.Y); |
||||
mylist.Clear(); |
||||
} |
||||
|
||||
ShouldDrawBorder (section,mylist); |
||||
|
||||
} |
||||
while (base.DataNavigator.MoveNext()); |
||||
|
||||
SectionBounds.ReportFooterRectangle = new Rectangle(SectionBounds.ReportFooterRectangle.Left, |
||||
section.Location.Y + section.Size.Height, |
||||
SectionBounds.ReportFooterRectangle.Width, |
||||
SectionBounds.ReportFooterRectangle.Height); |
||||
return mylist; |
||||
} |
||||
|
||||
|
||||
void PrepareContainerForConverting(ISimpleContainer simpleContainer) |
||||
{ |
||||
base.LayoutRow(simpleContainer); |
||||
} |
||||
|
||||
|
||||
void AfterConverting (ExporterCollection mylist,BaseSection section) |
||||
{ |
||||
StandardPrinter.EvaluateRow(base.Evaluator,mylist); |
||||
section.Items[0].Size = base.RestoreSize; |
||||
section.SectionOffset += section.Size.Height + 3 * GlobalValues.GapBetweenContainer; |
||||
} |
||||
|
||||
|
||||
Color TestDecorateElement(ISimpleContainer simpleContainer) |
||||
{ |
||||
BaseReportItem i = simpleContainer as BaseReportItem; |
||||
var retval = i.BackColor; |
||||
i.BackColor = System.Drawing.Color.LightGray; |
||||
return retval; |
||||
} |
||||
|
||||
void ShouldDrawBorder (BaseSection section,ExporterCollection list) |
||||
{ |
||||
if (section.DrawBorder == true) { |
||||
BaseRectangleItem br = BasePager.CreateDebugItem (section); |
||||
BaseExportColumn bec = br.CreateExportColumn(); |
||||
bec.StyleDecorator.Location = section.Location; |
||||
list.Insert(0,bec); |
||||
} |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue