Browse Source

Cleanup

pull/2/head
peterforstmeier 16 years ago
parent
commit
f259ef2f7f
  1. 30
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/ReportLayout/AbstractLayout.cs
  2. 22
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/ReportLayout/ListLayout.cs
  3. 20
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/ReportLayout/TableLayout.cs
  4. 14
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseClasses/Printing/Layouter.cs
  5. 2
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseClasses/Printing/PrintHelper.cs
  6. 2
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/BasePager.cs
  7. 16
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/BaseConverter.cs
  8. 46
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/GroupedRowConverter.cs
  9. 6
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/GroupedTableConverter.cs
  10. 7
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Globals/GlobalValues.cs

30
src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/ReportLayout/AbstractLayout.cs

@ -99,7 +99,7 @@ namespace ICSharpCode.Reports.Addin.ReportWizard @@ -99,7 +99,7 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
ICSharpCode.Reports.Core.BaseRowItem row = new ICSharpCode.Reports.Core.BaseRowItem();
AdjustContainer(parent,row);
int defY = parent.Location.Y + GlobalValues.ControlMargins.Top;
int defY = GlobalValues.ControlMargins.Top;
int ctrlWidth = CalculateControlWidth(row,colDetail);
int startX = parent.Location.X + GlobalValues.ControlMargins.Left;
@ -134,34 +134,18 @@ namespace ICSharpCode.Reports.Addin.ReportWizard @@ -134,34 +134,18 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
}
#endregion
/*
protected static ReportItemCollection AddItemsToSection (ICSharpCode.Reports.Core.BaseSection section,ReportItemCollection items)
{
int defY = section.Location.Y + GlobalValues.ControlMargins.Top;
int ctrlWidth = CalculateControlWidth(section,items);
int startX = section.Location.X + GlobalValues.ControlMargins.Left;
var vv = new ReportItemCollection();
foreach (var ir in items) {
Point np = new Point(startX,defY);
startX += ctrlWidth;
ir.Location = np;
// section.Items.Add(ir);
vv.Add(ir);
}
return vv;
}
*/
protected ReportItemCollection AddItemsToContainer (ReportItemCollection items)
{
int locationY = 10;
int locationX = this.ParentItem.Location.X + GlobalValues.ControlMargins.Left;
int locationX = GlobalValues.ControlMargins.Left;
var minCtrlWidth = CalculateControlWidth(ParentItem,items);
var col = new ReportItemCollection();
foreach (var ir in items) {
ir.Location = new Point(locationX,locationY);
ir.Location = new Point(locationX,GlobalValues.ControlMargins.Top);
col.Add(ir);
locationX += minCtrlWidth;
}
@ -184,13 +168,13 @@ namespace ICSharpCode.Reports.Addin.ReportWizard @@ -184,13 +168,13 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
dataItem.ColumnName = ReportModel.ReportSettings.GroupColumnsCollection[0].ColumnName;
dataItem.DataType = ReportModel.ReportSettings.GroupColumnsCollection[0].DataTypeName;
dataItem.Location = new Point (10,5);
dataItem.Location = new Point (GlobalValues.ControlMargins.Left,GlobalValues.ControlMargins.Top);
dataItem.Size = new Size (150,20);
dataItem.Text = ReportModel.ReportSettings.GroupColumnsCollection[0].ColumnName;
ICSharpCode.Reports.Core.BaseGroupedRow groupHeader = new ICSharpCode.Reports.Core.BaseGroupedRow();
groupHeader.Location = headerLocation;
groupHeader.Size = new Size (300,30);
groupHeader.Size = new Size (300,dataItem.Size.Height + GlobalValues.ControlMargins.Top + GlobalValues.ControlMargins.Bottom);
groupHeader.Items.Add(dataItem);
return groupHeader;
}

22
src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/ReportLayout/ListLayout.cs

@ -35,6 +35,7 @@ namespace ICSharpCode.Reports.Addin.ReportWizard @@ -35,6 +35,7 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
base.CreatePageHeader();
ICSharpCode.Reports.Core.BaseRowItem row = CreateRowWithTextColumns(base.ReportModel.PageHeader,
this.reportItems);
AdjustContainer(ParentItem,row);
base.ReportModel.PageHeader.Items.Add(row);
}
@ -48,28 +49,19 @@ namespace ICSharpCode.Reports.Addin.ReportWizard @@ -48,28 +49,19 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
if (base.ReportModel.ReportSettings.GroupColumnsCollection.Count > 0)
{
var groupheader = base.CreateGroupHeader(new Point (5,10));
var groupheader = base.CreateGroupHeader(new Point (GlobalValues.ControlMargins.Left,GlobalValues.ControlMargins.Top));
base.ReportModel.DetailSection.Items.Add(groupheader);
ParentItem.Location = new Point(ParentItem.Location.X,50);
ParentItem.Size = new Size(ParentItem.Size.Width,40);
section.Size = new Size(section.Size.Width,100);
}
if (base.ParentItem != null) {
var items = base.AddItemsToContainer(this.reportItems);
ParentItem.Items.AddRange(items);
ParentItem.Size = new Size(ParentItem.Size.Width,40);
section.Items.Add(ParentItem as BaseReportItem);
}
else
{
//var items1 = AddItemsToSection (base.ReportModel.DetailSection,this.reportItems);
//AddItemsToSection (base.ReportModel.DetailSection,this.reportItems);
//section.Items.AddRange(items1);
section.Size = new Size(section.Size.Width,90);
}
var items = base.AddItemsToContainer(this.reportItems);
ParentItem.Items.AddRange(items);
ParentItem.Size = new Size(ParentItem.Size.Width,items[0].Size.Height + GlobalValues.ControlMargins.Top + GlobalValues.ControlMargins.Bottom);
section.Items.Add(ParentItem as BaseReportItem);
}
#endregion

20
src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/ReportLayout/TableLayout.cs

@ -57,15 +57,17 @@ namespace ICSharpCode.Reports.Addin.ReportWizard @@ -57,15 +57,17 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
insertLocation = new Point(margin.Left,insertLocation.Y + groupHeader.Size.Height + margin.Bottom + margin.Top);
}
//Insert details allways
ICSharpCode.Reports.Core.BaseRowItem detailRow = new ICSharpCode.Reports.Core.BaseRowItem();
AdjustContainer (ParentItem,detailRow);
detailRow.Location = insertLocation;
detailRow.Size = new Size(detailRow.Size.Width,30);
int defX = AbstractLayout.CalculateControlWidth(detailRow,reportItems);
int startX = detailRow.Location.X + margin.Left;
int startX = margin.Left;
foreach (ICSharpCode.Reports.Core.BaseReportItem ir in this.reportItems)
{
@ -76,26 +78,22 @@ namespace ICSharpCode.Reports.Addin.ReportWizard @@ -76,26 +78,22 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
detailRow.Items.Add(ir);
}
insertLocation = new Point(margin.Left,insertLocation.Y + detailRow.Size.Height + margin.Bottom + margin.Top);
ParentItem.Items.Add (detailRow);
ParentItem.Size = CalculateContainerSize(ParentItem,margin);
ParentItem.Size = CalculateContainerSize(ParentItem);
section.Size = new Size (section.Size.Width,ParentItem.Size.Height + margin.Top + margin.Bottom);
}
private Size CalculateContainerSize(ISimpleContainer container,System.Drawing.Printing.Margins margin)
private Size CalculateContainerSize(ISimpleContainer container)
{
int h = margin.Top;
int h = GlobalValues.ControlMargins.Top;
foreach (ICSharpCode.Reports.Core.BaseReportItem item in container.Items)
{
h = h + item.Size.Height + margin.Bottom;
h = h + item.Size.Height + GlobalValues.ControlMargins.Bottom;
}
h = h + 3*margin.Bottom;
h = h + 3*GlobalValues.ControlMargins.Bottom;
return new Size (container.Size.Width,h);
}
}

14
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseClasses/Printing/Layouter.cs

@ -39,17 +39,12 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing @@ -39,17 +39,12 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing
System.Collections.Generic.IEnumerable<BaseReportItem> canGrowShrinkCollection = from bt in container.Items where bt.CanGrow == true select bt;
if (canGrowShrinkCollection.Count() > 0 ) {
int bottomPadding = container.Size.Height - (container.Items[0].Location.Y + container.Items[0].Size.Height);
Rectangle surroundingRec = FindSurroundingRectangle(graphics,canGrowShrinkCollection);
desiredContainerRectangle = new Rectangle(container.Location.X,
container.Location.Y,
container.Size.Width,
surroundingRec.Size.Height + bottomPadding );
surroundingRec.Size.Height + GlobalValues.ControlMargins.Top + GlobalValues.ControlMargins.Bottom);
}
return desiredContainerRectangle;
}
@ -63,6 +58,7 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing @@ -63,6 +58,7 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing
throw new ArgumentNullException("section");
}
Console.WriteLine("layouter for {0}",section.Name);
IEnumerable<BaseReportItem> canGrowShrinkCollection = from bt in section.Items where bt.CanGrow == true select bt;
@ -73,17 +69,13 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing @@ -73,17 +69,13 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing
if (canGrowShrinkCollection.Count() > 0) {
//Console.WriteLine ("xx layout section");
int bottomPadding = section.Size.Height - (section.Items[0].Size.Height + section.Items[0].Location.Y);
Rectangle surroundingRec = FindSurroundingRectangle(graphics,canGrowShrinkCollection);
if (surroundingRec.Height > desiredSectionRectangle .Height) {
desiredSectionRectangle = new Rectangle(section.Location.X,
section .Location.Y,
section .Size.Width,
surroundingRec.Size.Height + bottomPadding);
surroundingRec.Size.Height + GlobalValues.ControlMargins.Top + GlobalValues.ControlMargins.Bottom );
}
}
return desiredSectionRectangle;

2
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseClasses/Printing/PrintHelper.cs

@ -25,7 +25,7 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing @@ -25,7 +25,7 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing
{
Rectangle textRect = layouter.Layout(graphics,row);
if (textRect.Height > row.Size.Height) {
row.Size = new Size(row.Size.Width,textRect.Height);
row.Size = new Size(row.Size.Width,textRect.Height + 5);
}
}

2
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/BasePager.cs

@ -123,7 +123,7 @@ namespace ICSharpCode.Reports.Core.Exporter @@ -123,7 +123,7 @@ namespace ICSharpCode.Reports.Core.Exporter
Rectangle sectionRectangle = new Rectangle(0,0,section.Size.Width,section.Size.Height);
if (!sectionRectangle.Contains(desiredRectangle)) {
section.Size = new Size(section.Size.Width,desiredRectangle.Size.Height);
section.Size = new Size(section.Size.Width,desiredRectangle.Size.Height + GlobalValues.ControlMargins.Top + GlobalValues.ControlMargins.Bottom);
}
list = StandardPrinter.ConvertPlainCollection(section.Items,offset);

16
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/BaseConverter.cs

@ -112,12 +112,17 @@ namespace ICSharpCode.Reports.Core.Exporter @@ -112,12 +112,17 @@ namespace ICSharpCode.Reports.Core.Exporter
protected Point ConvertGroupChilds(ExporterCollection mylist, BaseSection section, ISimpleContainer simpleContainer, int defaultLeftPos, Point currentPosition)
{
Console.WriteLine("---start --ConvertStandardRow {0} - section {1}",simpleContainer.Size,section.Size);
PrepareContainerForConverting(section,simpleContainer);
Point curPos = BaseConverter.BaseConvert(mylist,simpleContainer,defaultLeftPos,currentPosition);
AfterConverting (mylist);
Console.WriteLine("---end --ConvertStandardRow detail {0} - section {1}",simpleContainer.Size,section.Size);
// Console.WriteLine();
// Console.WriteLine();
AfterConverting (section,mylist);
return curPos;
}
protected bool PageBreakAfterGroupChange(ISimpleContainer container)
{
var groupedRows = BaseConverter.FindGroups(container);
@ -179,7 +184,7 @@ namespace ICSharpCode.Reports.Core.Exporter @@ -179,7 +184,7 @@ namespace ICSharpCode.Reports.Core.Exporter
#endregion
protected void SaveSize(Size size)
protected void SaveSectionSize(Size size)
{
this.saveSize = size;
}
@ -206,11 +211,10 @@ namespace ICSharpCode.Reports.Core.Exporter @@ -206,11 +211,10 @@ namespace ICSharpCode.Reports.Core.Exporter
}
protected void AfterConverting (ExporterCollection convertedList)
protected void AfterConverting (BaseSection section,ExporterCollection convertedList)
{
StandardPrinter.EvaluateRow(Evaluator,convertedList);
// section.Items[0].Size = base.RestoreSize;
// section.SectionOffset += section.Size.Height + 3 * GlobalValues.GapBetweenContainer;
section.Items[0].Size = RestoreSize;
}
@ -219,7 +223,7 @@ namespace ICSharpCode.Reports.Core.Exporter @@ -219,7 +223,7 @@ namespace ICSharpCode.Reports.Core.Exporter
FillRow(simpleContainer);
PrepareContainerForConverting(section,simpleContainer);
Point curPos = BaseConverter.BaseConvert(mylist,simpleContainer,defaultLeftPos,currentPosition);
AfterConverting (mylist);
AfterConverting (section,mylist);
return curPos;
}

46
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/GroupedRowConverter.cs

@ -59,39 +59,68 @@ namespace ICSharpCode.Reports.Core.Exporter @@ -59,39 +59,68 @@ namespace ICSharpCode.Reports.Core.Exporter
int defaultLeftPos = parent.Location.X;
Size groupSize = Size.Empty;
Size childSize = Size.Empty;
if (section.Items.IsGrouped)
{
groupSize = section.Items[0].Size;
childSize = section.Items[1].Size;
}
Rectangle pageBreakRect = Rectangle.Empty;
do {
base.SaveSectionSize(section.Size);
PrintHelper.AdjustSectionLocation (section);
section.Size = this.SectionBounds.DetailSectionRectangle.Size;
base.SaveSize(section.Items[0].Size);
// did we have GroupedItems at all
if (section.Items.IsGrouped) {
if (section.Items.IsGrouped)
{
// GetType child navigator
IDataNavigator childNavigator = base.DataNavigator.GetChildNavigator();
base.Evaluator.SinglePage.IDataNavigator = childNavigator;
// Convert Grouping Header
currentPosition = ConvertGroupHeader(exporterCollection,section,defaultLeftPos,currentPosition);
section.Size = base.RestoreSize;
section.Items[0].Size = groupSize;
section.Items[1].Size = childSize;
childNavigator.Reset();
childNavigator.MoveNext();
// Console.WriteLine("-------------------after group");
//
// Console.WriteLine ("section {0}",section.Size);
// Console.WriteLine ("group {0}",section.Items[0].Size);
// Console.WriteLine ("detail {0}",section.Items[1].Size);
// Console.WriteLine();
//Convert children
if (childNavigator != null) {
StandardPrinter.AdjustBackColor(simpleContainer,GlobalValues.DefaultBackColor);
do
{
Console.WriteLine("-----------------childs");
// Console.WriteLine ("section {0}",section.Size);
// Console.WriteLine ("group {0}",section.Items[0].Size);
// Console.WriteLine ("detail {0}",section.Items[1].Size);
// Console.WriteLine();
section.Size = base.RestoreSize;
section.Items[0].Size = groupSize;
section.Items[1].Size = childSize;
do {
childNavigator.Fill(simpleContainer.Items);
currentPosition = ConvertGroupChilds (exporterCollection,section,
simpleContainer,defaultLeftPos,currentPosition);
pageBreakRect = PrintHelper.CalculatePageBreakRectangle((BaseReportItem)section.Items[1],currentPosition);
section.Items[1].Size = base.RestoreSize;
if (PrintHelper.IsPageFull(pageBreakRect,base.SectionBounds )) {
currentPosition = ForcePageBreak (exporterCollection,section);
}
@ -113,6 +142,7 @@ namespace ICSharpCode.Reports.Core.Exporter @@ -113,6 +142,7 @@ namespace ICSharpCode.Reports.Core.Exporter
{
// No Grouping at all
currentPosition = ConvertStandardRow (exporterCollection,section,simpleContainer,defaultLeftPos,currentPosition);
section.Size = base.RestoreSize;
}
pageBreakRect = PrintHelper.CalculatePageBreakRectangle((BaseReportItem)section.Items[0],currentPosition);
@ -160,7 +190,7 @@ namespace ICSharpCode.Reports.Core.Exporter @@ -160,7 +190,7 @@ namespace ICSharpCode.Reports.Core.Exporter
StandardPrinter.EvaluateRow(base.Evaluator,list);
exportList.AddRange(list);
AfterConverting (list);
AfterConverting (section,list);
retVal = new Point (leftPos,offset.Y + groupCollection[0].Size.Height + 20 + (3 *GlobalValues.GapBetweenContainer));
} else {
retVal = ConvertStandardRow(exportList,section,groupedRows[0],leftPos,offset);

6
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/GroupedTableConverter.cs

@ -69,7 +69,7 @@ namespace ICSharpCode.Reports.Core.Exporter @@ -69,7 +69,7 @@ namespace ICSharpCode.Reports.Core.Exporter
simpleContainer.Location = new Point (simpleContainer.Location.X,simpleContainer.Location.Y);
simpleContainer.Parent = (BaseReportItem)this.table;
base.SaveSize( new Size (simpleContainer.Size.Width,simpleContainer.Size.Height));
base.SaveSectionSize( new Size (simpleContainer.Size.Width,simpleContainer.Size.Height));
if (PrintHelper.IsTextOnlyRow(simpleContainer) ) {
headerRow = simpleContainer;
@ -136,7 +136,7 @@ namespace ICSharpCode.Reports.Core.Exporter @@ -136,7 +136,7 @@ namespace ICSharpCode.Reports.Core.Exporter
{
// No Grouping at all
base.SaveSize(simpleContainer.Size);
base.SaveSectionSize(simpleContainer.Size);
simpleContainer = table.Items[1] as ISimpleContainer;
do {
@ -191,7 +191,7 @@ namespace ICSharpCode.Reports.Core.Exporter @@ -191,7 +191,7 @@ namespace ICSharpCode.Reports.Core.Exporter
StandardPrinter.EvaluateRow(base.Evaluator,list);
exportList.AddRange(list);
AfterConverting (list);
AfterConverting (section,list);
retVal = new Point (leftPos,offset.Y + groupCollection[0].Size.Height + 20 + (3 *GlobalValues.GapBetweenContainer));
} else {
retVal = ConvertStandardRow(exportList,section,groupedRow[0],leftPos,offset);

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

@ -95,12 +95,7 @@ namespace ICSharpCode.Reports.Core { @@ -95,12 +95,7 @@ namespace ICSharpCode.Reports.Core {
/// <summary>
/// The value on witch the Control is drawing bigger than the text inside
/// </summary>
/*
public static int EnlargeControl
{
get {return enlargeControl;}
}
*/
public static Margins ControlMargins
{

Loading…
Cancel
Save