Browse Source

Start working on Export to (xyz) and better preview

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1790 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Peter Forstmeier 20 years ago
parent
commit
64ac8f0956
  1. 4
      src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs
  2. 3
      src/AddIns/Misc/SharpReport/SharpReportCore/Globals/GlobalEnums.cs
  3. 67
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs
  4. 3
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseShape.cs
  5. 10
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs
  6. 6
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderFormSheetReport.cs
  7. 46
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/SectionBounds.cs
  8. 4
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/StandardFormatter.cs
  9. 3
      src/AddIns/Misc/SharpReport/SharpReportCore/ReportModel.cs
  10. 3
      src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/AbstractModelVisitor.cs
  11. 8
      src/AddIns/Misc/SharpReport/SharpReportCore/Xml/XmlHelper.cs

4
src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs

@ -48,7 +48,7 @@ namespace SharpReportCore{ @@ -48,7 +48,7 @@ namespace SharpReportCore{
#region overrides
protected RectangleF PrepareRectangle (ReportPageEventArgs e) {
protected RectangleF PrepareRectangle () {
SizeF measureSize = new SizeF ((SizeF)this.Size);
RectangleF rect = base.DrawingRectangle (measureSize);
return rect;
@ -62,7 +62,7 @@ namespace SharpReportCore{ @@ -62,7 +62,7 @@ namespace SharpReportCore{
}
base.Render(rpea);
RectangleF rect = PrepareRectangle (rpea);
RectangleF rect = PrepareRectangle ();
shape.FillShape(rpea.PrintPageEventArgs.Graphics,
new SolidFillPattern(this.BackColor),

3
src/AddIns/Misc/SharpReport/SharpReportCore/Globals/GlobalEnums.cs

@ -99,6 +99,9 @@ namespace SharpReportCore { @@ -99,6 +99,9 @@ namespace SharpReportCore {
/// type to its internal representation.
public static object StringToEnum( Type type, string value ) {
if (type == null) {
throw new ArgumentNullException("type");
}
foreach ( FieldInfo fi in type.GetFields() ){
if ( fi.Name == value ){
return fi.GetValue( null );

67
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs

@ -36,7 +36,7 @@ namespace SharpReportCore { @@ -36,7 +36,7 @@ namespace SharpReportCore {
public event EventHandler<SectionRenderEventArgs> Rendering;
public event EventHandler<SectionRenderEventArgs> SectionRendered;
private Page page;
private SectionBounds sectionBounds;
protected AbstractRenderer(ReportModel model){
if (model == null) {
@ -180,7 +180,7 @@ namespace SharpReportCore { @@ -180,7 +180,7 @@ namespace SharpReportCore {
e.Graphics.DrawString(this.reportSettings.NoDataMessage,
this.ReportSettings.DefaultFont,
new SolidBrush(Color.Black),
page.DetailArea);
sectionBounds.DetailArea);
}
@ -196,23 +196,24 @@ namespace SharpReportCore { @@ -196,23 +196,24 @@ namespace SharpReportCore {
}
rpea.Graphics.DrawRectangle (Pens.Black,rectangle);
}
public void DebugFooterRectangle (ReportPageEventArgs rpea) {
Rectangle r = new Rectangle( this.page.ReportFooterRectangle.Left,
/*
public void old_DebugFooterRectangle (ReportPageEventArgs rpea) {
Rectangle r = new Rectangle( this.pageBounderys.ReportFooterRectangle.Left,
rpea.LocationAfterDraw.Y,
this.page.ReportFooterRectangle.Width,
this.page.ReportFooterRectangle.Height);
this.pageBounderys.ReportFooterRectangle.Width,
this.pageBounderys.ReportFooterRectangle.Height);
Rectangle s = new Rectangle (this.page.ReportFooterRectangle.Left,
Rectangle s = new Rectangle (this.pageBounderys.ReportFooterRectangle.Left,
rpea.LocationAfterDraw.Y,
this.page.ReportFooterRectangle.Width,
this.page.PageFooterRectangle.Top - rpea.LocationAfterDraw.Y -1);
this.pageBounderys.ReportFooterRectangle.Width,
this.pageBounderys.PageFooterRectangle.Top - rpea.LocationAfterDraw.Y -1);
AbstractRenderer.DebugRectangle(rpea.PrintPageEventArgs,r);
AbstractRenderer.DebugRectangle(rpea.PrintPageEventArgs,s);
}
*/
#endregion
protected Rectangle MeasureReportHeader (PrintPageEventArgs ppea) {
@ -228,7 +229,7 @@ namespace SharpReportCore { @@ -228,7 +229,7 @@ namespace SharpReportCore {
if (this.CurrentSection.Items.Count > 0) {
this.CurrentSection.SectionOffset = reportSettings.DefaultMargins.Top;
FitSectionToItems (this.CurrentSection,ppea);
AbstractRenderer.FitSectionToItems (this.CurrentSection,ppea);
rect = new Rectangle(reportSettings.DefaultMargins.Left,
reportSettings.DefaultMargins.Top,
@ -264,7 +265,7 @@ namespace SharpReportCore { @@ -264,7 +265,7 @@ namespace SharpReportCore {
this.CurrentSection.SectionOffset = reportSettings.DefaultMargins.Top;
}
FitSectionToItems (this.CurrentSection,rpea);
AbstractRenderer.FitSectionToItems (this.CurrentSection,rpea);
return new Rectangle (startAfter.Left,
startAfter.Bottom + Gap,
rpea.MarginBounds.Width,
@ -276,7 +277,7 @@ namespace SharpReportCore { @@ -276,7 +277,7 @@ namespace SharpReportCore {
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);
AbstractRenderer.FitSectionToItems (this.CurrentSection,e);
return new Rectangle(reportSettings.DefaultMargins.Left,
this.CurrentSection.SectionOffset,
e.MarginBounds.Width,
@ -289,7 +290,7 @@ namespace SharpReportCore { @@ -289,7 +290,7 @@ namespace SharpReportCore {
private Rectangle MeasureReportFooter (PrintPageEventArgs ppea) {
sectionInUse = Convert.ToInt16(GlobalEnums.enmSection.ReportFooter,
CultureInfo.InvariantCulture);
FitSectionToItems (this.CurrentSection,ppea);
AbstractRenderer.FitSectionToItems (this.CurrentSection,ppea);
return new Rectangle (reportSettings.DefaultMargins.Left,
this.CurrentSection.SectionOffset,
ppea.MarginBounds.Width,
@ -297,16 +298,16 @@ namespace SharpReportCore { @@ -297,16 +298,16 @@ namespace SharpReportCore {
}
protected bool IsRoomForFooter(Point loc) {
Rectangle r = new Rectangle( this.page.ReportFooterRectangle.Left,
Rectangle r = new Rectangle( this.sectionBounds.ReportFooterRectangle.Left,
loc.Y,
this.page.ReportFooterRectangle.Width,
this.page.ReportFooterRectangle.Height);
this.sectionBounds.ReportFooterRectangle.Width,
this.sectionBounds.ReportFooterRectangle.Height);
Rectangle s = new Rectangle (this.page.ReportFooterRectangle.Left,
Rectangle s = new Rectangle (this.sectionBounds.ReportFooterRectangle.Left,
loc.Y,
this.page.ReportFooterRectangle.Width,
this.page.PageFooterRectangle.Top - loc.Y -1);
this.sectionBounds.ReportFooterRectangle.Width,
this.sectionBounds.PageFooterRectangle.Top - loc.Y -1);
return s.Contains(r);
}
@ -349,7 +350,7 @@ namespace SharpReportCore { @@ -349,7 +350,7 @@ namespace SharpReportCore {
}
#region privates
protected void FitSectionToItems (BaseSection section,PrintPageEventArgs rpea){
protected static void FitSectionToItems (BaseSection section,PrintPageEventArgs rpea){
if (section == null) {
throw new ArgumentNullException("section");
}
@ -440,7 +441,7 @@ namespace SharpReportCore { @@ -440,7 +441,7 @@ namespace SharpReportCore {
#region PrintDocument Events
private void ReportPageStart (object sender, PrintPageEventArgs e) {
if (this.page == null) {
if (this.sectionBounds == null) {
throw new ArgumentException("page");
}
@ -448,26 +449,26 @@ namespace SharpReportCore { @@ -448,26 +449,26 @@ namespace SharpReportCore {
if (this.reportDocument.PageNumber == 1) {
r1 = this.MeasureReportHeader(e);
page.ReportHeaderRectangle = r1;
sectionBounds.ReportHeaderRectangle = r1;
} else {
r1 = new Rectangle (reportSettings.DefaultMargins.Left,
reportSettings.DefaultMargins.Top,
e.MarginBounds.Width,
0);
}
page.ReportHeaderRectangle = r1;
page.PageHeaderRectangle = this.MeasurePageHeader(r1,e);
page.PageFooterRectangle = this.MeasurePageFooter (e);
page.ReportFooterRectangle = this.MeasureReportFooter(e);
sectionBounds.ReportHeaderRectangle = r1;
sectionBounds.PageHeaderRectangle = this.MeasurePageHeader(r1,e);
sectionBounds.PageFooterRectangle = this.MeasurePageFooter (e);
sectionBounds.ReportFooterRectangle = this.MeasureReportFooter(e);
}
protected virtual void ReportQueryPage (object sender,QueryPageSettingsEventArgs qpea) {
qpea.PageSettings.Margins = reportSettings.DefaultMargins;
if (this.reportDocument.PageNumber == 1) {
page = new Page (true);
sectionBounds = new SectionBounds (true);
} else {
page = new Page (false);
sectionBounds = new SectionBounds (false);
}
}
@ -536,12 +537,12 @@ namespace SharpReportCore { @@ -536,12 +537,12 @@ namespace SharpReportCore {
}
}
protected Page Page {
protected SectionBounds SectionBounds {
get {
return page;
return sectionBounds;
}
set {
page = value;
sectionBounds = value;
}
}

3
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseShape.cs

@ -63,6 +63,9 @@ namespace SharpReportCore { @@ -63,6 +63,9 @@ namespace SharpReportCore {
if (graphics == null) {
throw new ArgumentNullException("graphics");
}
if (line == null) {
throw new ArgumentNullException("line");
}
using (Pen pen = line.CreatePen()){
if (pen != null){
this.new_DrawShape(graphics, pen, rectangle);

10
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs

@ -75,7 +75,7 @@ namespace SharpReportCore { @@ -75,7 +75,7 @@ namespace SharpReportCore {
}
private void DoPageHeader (ReportPageEventArgs rpea){
this.CurrentSection.SectionOffset = base.Page.PageHeaderRectangle.Location.Y;
this.CurrentSection.SectionOffset = base.SectionBounds.PageHeaderRectangle.Location.Y;
base.RenderSection (rpea);
base.DoItems(rpea);
}
@ -83,7 +83,7 @@ namespace SharpReportCore { @@ -83,7 +83,7 @@ namespace SharpReportCore {
private void DoPageEnd (ReportPageEventArgs rpea){
this.CurrentSection.SectionOffset = base.Page.PageFooterRectangle.Location.Y;
this.CurrentSection.SectionOffset = base.SectionBounds.PageFooterRectangle.Location.Y;
base.RenderSection (rpea);
base.DoItems(rpea);
}
@ -162,7 +162,7 @@ namespace SharpReportCore { @@ -162,7 +162,7 @@ namespace SharpReportCore {
PrintNoDataMessage(rpea.PrintPageEventArgs);
}
base.CurrentSection.SectionOffset = (int)base.Page.DetailStart.Y + AbstractRenderer.Gap;
base.CurrentSection.SectionOffset = (int)base.SectionBounds.DetailStart.Y + AbstractRenderer.Gap;
}
@ -192,14 +192,14 @@ namespace SharpReportCore { @@ -192,14 +192,14 @@ namespace SharpReportCore {
}
base.FitSectionToItems (base.CurrentSection,rpea.PrintPageEventArgs);
AbstractRenderer.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.Page.DetailArea.Contains(sectionRect)) {
if (!base.SectionBounds.DetailArea.Contains(sectionRect)) {
AbstractRenderer.PageBreak(rpea);
System.Console.WriteLine("DataRenderer:RemoveEvents reason <PageBreak>");
this.RemoveSectionEvents();

6
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderFormSheetReport.cs

@ -59,7 +59,7 @@ namespace SharpReportCore { @@ -59,7 +59,7 @@ namespace SharpReportCore {
protected override void PrintPageHeader (object sender, ReportPageEventArgs rpea) {
base.PrintPageHeader (sender,rpea);
this.CurrentSection.SectionOffset = base.Page.PageHeaderRectangle.Location.Y;
this.CurrentSection.SectionOffset = base.SectionBounds.PageHeaderRectangle.Location.Y;
base.RenderSection (rpea);
}
@ -74,7 +74,7 @@ namespace SharpReportCore { @@ -74,7 +74,7 @@ namespace SharpReportCore {
protected override void PrintDetail(object sender, ReportPageEventArgs rpea){
base.PrintDetail(sender, rpea);
this.CurrentSection.SectionOffset = base.Page.PageHeaderRectangle.Bottom;
this.CurrentSection.SectionOffset = base.SectionBounds.PageHeaderRectangle.Bottom;
base.RenderSection(rpea);
base.RemoveSectionEvents();
base.ReportDocument.DetailsDone = true;
@ -100,7 +100,7 @@ namespace SharpReportCore { @@ -100,7 +100,7 @@ namespace SharpReportCore {
protected override void PrintPageEnd(object sender, ReportPageEventArgs rpea) {
base.PrintPageEnd(this,rpea);
this.CurrentSection.SectionOffset = base.Page.PageFooterRectangle.Location.Y;
this.CurrentSection.SectionOffset = base.SectionBounds.PageFooterRectangle.Location.Y;
base.RenderSection (rpea);
}
#endregion

46
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Page.cs → src/AddIns/Misc/SharpReport/SharpReportCore/Printing/SectionBounds.cs

@ -14,7 +14,7 @@ namespace SharpReportCore{ @@ -14,7 +14,7 @@ namespace SharpReportCore{
/// <summary>
/// Description of Page.
/// </summary>
public class Page{
public class SectionBounds{
Rectangle reportHeaderRectangle;
Rectangle pageHeaderRectangle;
Rectangle detailRectangle;
@ -23,7 +23,7 @@ namespace SharpReportCore{ @@ -23,7 +23,7 @@ namespace SharpReportCore{
bool firstpage;
public Page(bool firstPage){
public SectionBounds(bool firstPage){
this.firstpage = firstPage;
}
@ -86,43 +86,8 @@ namespace SharpReportCore{ @@ -86,43 +86,8 @@ namespace SharpReportCore{
return new Point(this.pageFooterRectangle.Left,this.pageFooterRectangle.Top);
}
}
/*
/// <summary>
/// Calculates the rectangle wich can be used by Detail
/// </summary>
/// <returns></returns>
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;
}
*/
/// <summary>
/// This rectangle starts directly after PageHeader and ends bevore PageFooter
/// </summary>
@ -133,7 +98,12 @@ namespace SharpReportCore{ @@ -133,7 +98,12 @@ namespace SharpReportCore{
this.pageHeaderRectangle.Width,
(this.pageFooterRectangle.Top -1) - (this.pageHeaderRectangle.Bottom + 1));
}
}
public bool Firstpage {
get {
return firstpage;
}
}
}

4
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/StandardFormatter.cs

@ -32,6 +32,10 @@ namespace SharpReportCore { @@ -32,6 +32,10 @@ namespace SharpReportCore {
return retValue;
}
if (String.IsNullOrEmpty(valueToFormat)) {
return nullValue;
}
switch (typeCode) {
case TypeCode.Int16:
case TypeCode.Int32:

3
src/AddIns/Misc/SharpReport/SharpReportCore/ReportModel.cs

@ -55,6 +55,9 @@ namespace SharpReportCore { @@ -55,6 +55,9 @@ namespace SharpReportCore {
#region SharpReport.DelegatesInterfaces.IModel interface implementation
public void Accept(IModelVisitor visitor) {
if (visitor == null) {
throw new ArgumentNullException("visitor");
}
visitor.Visit (this);
}
#endregion

3
src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/AbstractModelVisitor.cs

@ -47,6 +47,9 @@ namespace SharpReportCore { @@ -47,6 +47,9 @@ namespace SharpReportCore {
protected BaseReportItem MakeItem (XmlElement elem,IContainerItem parent,
BaseSection section,IItemRenderer itemRenderer) {
if (section == null) {
throw new ArgumentNullException("section");
}
BaseReportItem item = (BaseReportItem)itemRenderer;
item.SuspendLayout();
XmlHelper.SetReportItemValues (xmlFormReader,elem,item);

8
src/AddIns/Misc/SharpReport/SharpReportCore/Xml/XmlHelper.cs

@ -100,6 +100,10 @@ namespace SharpReportCore { @@ -100,6 +100,10 @@ namespace SharpReportCore {
public static void SetSectionValues (XmlFormReader reader,
XmlElement element,
BaseReportObject section) {
if (element == null) {
throw new ArgumentNullException("element");
}
XmlNodeList nodeList = element.ChildNodes;
foreach (XmlNode node in nodeList) {
@ -124,6 +128,10 @@ namespace SharpReportCore { @@ -124,6 +128,10 @@ namespace SharpReportCore {
XmlElement ctrlElem,
BaseReportItem item) {
if (item == null) {
throw new ArgumentNullException("item");
}
item.SuspendLayout();
try {
XmlNodeList nodeList = ctrlElem.ChildNodes;

Loading…
Cancel
Save