Browse Source

Layouter

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/reports@6192 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Peter Forstmeier 15 years ago
parent
commit
9e36825e4e
  1. 1
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/ICSharpCode.Reports.Core.csproj
  2. 55
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseClasses/Printing/Layouter.cs
  3. 7
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseClasses/Printing/PrintHelper.cs
  4. 8
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseClasses/Printing/StandardPrinter.cs
  5. 11
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseItems/BaseSection.cs
  6. 13
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Printing/AbstractDataRenderer.cs
  7. 10
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Printing/AbstractRenderer.cs
  8. 13
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Printing/RenderDataReport.cs

1
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/ICSharpCode.Reports.Core.csproj

@ -352,7 +352,6 @@ @@ -352,7 +352,6 @@
<Folder Include="Project\Dialogs" />
<Folder Include="Project\Events" />
<Folder Include="Project\Exceptions" />
<Folder Include="Project\Converter" />
<Folder Include="Project\Exporter\Converters" />
<Folder Include="Project\Expressions\SimpleExpressionEvaluator" />
<Folder Include="Project\Expressions\ReportingLanguage" />

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

@ -32,28 +32,48 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing @@ -32,28 +32,48 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing
throw new ArgumentNullException("container");
}
if (container.Items == null)
{
return Rectangle.Empty;
}
BaseReportItem containerItem = container as BaseReportItem;
Rectangle desiredContainerRectangle = new Rectangle (containerItem.Location,containerItem.Size);
System.Collections.Generic.IEnumerable<BaseReportItem> canGrowShrinkCollection = from bt in container.Items where bt.CanGrow == true select bt;
if (canGrowShrinkCollection.Count() > 0 ) {
int extend = containerItem.Size.Height - canGrowShrinkCollection.First().Size.Height;
Rectangle surroundingRec = FindSurroundingRectangle(graphics,canGrowShrinkCollection);
if (surroundingRec.Height > desiredContainerRectangle.Height)
{
desiredContainerRectangle = new Rectangle(containerItem.Location.X,
containerItem .Location.Y,
containerItem .Size.Width,
surroundingRec.Size.Height + extend);
int bottomPadding = containerItem.Size.Height - (container.Items[0].Location.Y + container.Items[0].Size.Height);
if (bottomPadding < 0) {
Console.WriteLine(bottomPadding);
}
Rectangle surroundingRec = FindSurroundingRectangle(graphics,canGrowShrinkCollection);
/*
Console.WriteLine ("surrounding {0} - desired {1} - bottom {2}",
surroundingRec.Height + bottomPadding,
desiredContainerRectangle.Height -1,
bottomPadding);
Console.WriteLine ("extend");
*/
desiredContainerRectangle = new Rectangle(containerItem.Location.X,
containerItem .Location.Y,
containerItem .Size.Width,
surroundingRec.Size.Height + bottomPadding );
// Console.WriteLine ("extend to {0}",desiredContainerRectangle);
}
return desiredContainerRectangle;
}
public Rectangle Layout(Graphics graphics,BaseSection section)
{
if (graphics == null) {
@ -63,6 +83,7 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing @@ -63,6 +83,7 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing
throw new ArgumentNullException("section");
}
IEnumerable<BaseReportItem> canGrowShrinkCollection = from bt in section.Items where bt.CanGrow == true select bt;
Rectangle desiredSectionRectangle = new Rectangle(section.Location.X,
@ -71,14 +92,26 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing @@ -71,14 +92,26 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing
section.Size.Height);
if (canGrowShrinkCollection.Count() > 0) {
int extend = section.Size.Height - canGrowShrinkCollection.First().Size.Height;
//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);
/*
Console.WriteLine ("xx surrounding {0} - desired {1} - bottom {2}",
surroundingRec.Height + bottomPadding,
desiredSectionRectangle.Height -1,
bottomPadding);
*/
if (surroundingRec.Height > desiredSectionRectangle .Height) {
desiredSectionRectangle = new Rectangle(section.Location.X,
section .Location.Y,
section .Size.Width,
surroundingRec.Size.Height + extend);
surroundingRec.Size.Height + bottomPadding);
}
//Console.WriteLine ("xx extend to {0}",desiredSectionRectangle);
}
return desiredSectionRectangle;
}

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

@ -28,11 +28,10 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing @@ -28,11 +28,10 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing
public static void SetLayoutForRow (Graphics graphics, ILayouter layouter,ISimpleContainer row)
{
BaseReportItem item = row as BaseReportItem;
// BaseReportItem item = row as BaseReportItem;
Rectangle textRect = layouter.Layout(graphics,row);
if (textRect.Height > item.Size.Height) {
item.Size = new Size(item.Size.Width,textRect.Height);
if (textRect.Height > row.Size.Height) {
row.Size = new Size(row.Size.Width,textRect.Height);
}
}

8
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseClasses/Printing/StandardPrinter.cs

@ -147,14 +147,8 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing @@ -147,14 +147,8 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing
child.Parent = parent;
StandardPrinter.RenderLineItem (child,offset,evaluator,rpea);
}
retVal = new Rectangle(offset,size);
return retVal;
} else {
retVal = new Rectangle(offset.X,offset.Y,0,0);
return retVal;
}
return new Rectangle(offset,parent.Size);
}

11
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseItems/BaseSection.cs

@ -50,11 +50,12 @@ namespace ICSharpCode.Reports.Core @@ -50,11 +50,12 @@ namespace ICSharpCode.Reports.Core
this.NotifyPrinting();
base.Render(rpea);
if (this.DrawBorder == true) {
Border b = new Border(new BaseLine (this.FrameColor,System.Drawing.Drawing2D.DashStyle.Solid,1));
Rectangle r = new Rectangle (this.Location,this.Size);
b.DrawBorder(rpea.PrintPageEventArgs.Graphics,r);
}
// if (this.DrawBorder == true) {
// Border b = new Border(new BaseLine (this.FrameColor,System.Drawing.Drawing2D.DashStyle.Solid,1));
//// Rectangle r = new Rectangle (this.Location,this.Size);
//// b.DrawBorder(rpea.PrintPageEventArgs.Graphics,r);
// }
this.NotifyPrinted();
}

13
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Printing/AbstractDataRenderer.cs

@ -166,6 +166,7 @@ namespace ICSharpCode.Reports.Core @@ -166,6 +166,7 @@ namespace ICSharpCode.Reports.Core
{
Point currentPosition = new Point(section.Location.X + container.Location.X,offset.Y);
Console.WriteLine("start {0}",currentPosition);
if (section.Visible){
@ -187,6 +188,7 @@ namespace ICSharpCode.Reports.Core @@ -187,6 +188,7 @@ namespace ICSharpCode.Reports.Core
if (con != null) {
Rectangle r = StandardPrinter.RenderContainer(container,Evaluator,offset,rpea);
currentPosition = PrintHelper.ConvertRectangleToCurentPosition(r);
Console.WriteLine("layoutrec {0} - currpos {1} ",r,currentPosition);
}
else
@ -204,18 +206,15 @@ namespace ICSharpCode.Reports.Core @@ -204,18 +206,15 @@ namespace ICSharpCode.Reports.Core
currentPosition = PrintHelper.ConvertRectangleToCurentPosition (r);
item.Location = saveLocation;
currentPosition = new Point(item.Location.X,
section.SectionOffset + section.Size.Height);
rpea.LocationAfterDraw = new Point (rpea.LocationAfterDraw.X,section.SectionOffset + section.Size.Height);
Console.WriteLine ("locafter {0}",rpea.LocationAfterDraw);
}
if ((section.CanGrow == false)&& (section.CanShrink == false)) {
return new Point(section.Location.X,section.Size.Height);
}
section.Items[0].Size = containerSize;
Console.WriteLine("ret val {0}",currentPosition);
Console.WriteLine("--");
return currentPosition;
}

10
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Printing/AbstractRenderer.cs

@ -212,7 +212,9 @@ namespace ICSharpCode.Reports.Core @@ -212,7 +212,9 @@ namespace ICSharpCode.Reports.Core
Point currentPosition = Point.Empty;
if (this.CurrentSection.Visible){
this.CurrentSection.Render (rpea);
Evaluator.SinglePage = this.reportDocument.SinglePage;
if (this.CurrentSection.Items.Count > 0) {
@ -223,10 +225,17 @@ namespace ICSharpCode.Reports.Core @@ -223,10 +225,17 @@ namespace ICSharpCode.Reports.Core
this.CurrentSection.Location.Y,
this.CurrentSection.Size.Width,
this.CurrentSection.Size.Height);
if (desiredRectangle.Height >= sectionRectangle.Height) {
this.CurrentSection.Size = new Size(this.CurrentSection.Size.Width,desiredRectangle.Height + 10);
}
if (this.CurrentSection.DrawBorder) {
StandardPrinter.DrawBorder(rpea.PrintPageEventArgs.Graphics,this.CurrentSection.BaseStyleDecorator);
}
// PrintHelper.DebugRectangle(rpea.PrintPageEventArgs.Graphics,Pens.Blue,new Rectangle(CurrentSection.Location,CurrentSection.Size));
}
@ -235,6 +244,7 @@ namespace ICSharpCode.Reports.Core @@ -235,6 +244,7 @@ namespace ICSharpCode.Reports.Core
this.CurrentSection.SectionOffset),rpea);
currentPosition = PrintHelper.ConvertRectangleToCurentPosition(r);
if ((this.CurrentSection.CanGrow == false)&& (this.CurrentSection.CanShrink == false)) {
// return new Point(this.CurrentSection.Location.X,

13
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Printing/RenderDataReport.cs

@ -200,7 +200,7 @@ namespace ICSharpCode.Reports.Core { @@ -200,7 +200,7 @@ namespace ICSharpCode.Reports.Core {
return;
}
base.RenderItems(rpea);
Point currentPosition = base.RenderItems(rpea);
if (nav.CurrentRow < nav.Count -1) {
@ -212,22 +212,17 @@ namespace ICSharpCode.Reports.Core { @@ -212,22 +212,17 @@ namespace ICSharpCode.Reports.Core {
}
}
Rectangle r = new Rectangle (rpea.PrintPageEventArgs.MarginBounds.Left,
base.CurrentSection.SectionOffset,
rpea.PrintPageEventArgs.MarginBounds.Width,
base.CurrentSection.Size.Height);
// if (this.dataNavigator.CurrentRow % 2 == 0) {
// PrintHelper.DebugRectangle(rpea.PrintPageEventArgs.Graphics,r);
// }
base.CurrentSection.SectionOffset = r.Bottom;
rpea.LocationAfterDraw = new Point (rpea.LocationAfterDraw.X,
sectionRect.Bottom);
base.CurrentSection.SectionOffset = currentPosition.Y;
rpea.LocationAfterDraw = new Point (rpea.LocationAfterDraw.X,
r.Bottom);
currentPosition.Y);
}
while (nav.MoveNext());

Loading…
Cancel
Save