Browse Source

RightToLeft for DataItem

pull/15/head^2
peterforstmeier 15 years ago
parent
commit
cb2c06b6fa
  1. 3
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/Designer/DesignerHelper.cs
  2. 16
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportItems/BaseTextItem.cs
  3. 11
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportItems/ErrorItem.cs
  4. 3
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportItems/TypeProviders/TextItemTypeProvider.cs
  5. 12
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseClasses/Printing/TextDrawer.cs
  6. 10
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseItems/BaseTextItem.cs
  7. 14
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/FormPageBuilder.cs

3
src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/Designer/DesignerHelper.cs

@ -104,6 +104,9 @@ namespace ICSharpCode.Reports.Addin.Designer
prop = props.Find("DataType",true); prop = props.Find("DataType",true);
allProperties.Add(prop); allProperties.Add(prop);
prop = props.Find("RightToLeft",true);
allProperties.Add(prop);
} }
public static void AddGraphicProperties (List<PropertyDescriptor> allProperties, public static void AddGraphicProperties (List<PropertyDescriptor> allProperties,

16
src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportItems/BaseTextItem.cs

@ -47,7 +47,7 @@ namespace ICSharpCode.Reports.Addin
public override void Draw(Graphics graphics) public override void Draw(Graphics graphics)
{ {
StringTrimming designTrimmimg = StringTrimming.EllipsisCharacter;
if (graphics == null) { if (graphics == null) {
throw new ArgumentNullException("graphics"); throw new ArgumentNullException("graphics");
@ -56,23 +56,23 @@ namespace ICSharpCode.Reports.Addin
graphics.FillRectangle(b, base.DrawingRectangle); graphics.FillRectangle(b, base.DrawingRectangle);
} }
StringTrimming designTrimmimg = StringTrimming.EllipsisCharacter;
if (this.stringTrimming != StringTrimming.None) { if (this.stringTrimming != StringTrimming.None) {
designTrimmimg = stringTrimming; designTrimmimg = stringTrimming;
} }
// var o = StringFormatFlags.LineLimit; StringFormat stringFormat = TextDrawer.BuildStringFormat(designTrimmimg,contentAlignment);
// new StringFormat(StringFormatFlags.MeasureTrailingSpaces)
// http://msdn.microsoft.com/de-de/library/system.drawing.stringformatflags.aspx
http://www.tutorials.de/net-windows-forms/240717-c-mit-drawstring-senkrecht-drucken.html
if (this.RightToLeft == System.Windows.Forms.RightToLeft.Yes) { if (this.RightToLeft == System.Windows.Forms.RightToLeft.Yes) {
Console.WriteLine("RightToLeft"); stringFormat.FormatFlags = stringFormat.FormatFlags | StringFormatFlags.DirectionRightToLeft;
} }
TextDrawer.DrawString(graphics,this.Text,this.Font, TextDrawer.DrawString(graphics,this.Text,this.Font,
new SolidBrush(this.ForeColor), new SolidBrush(this.ForeColor),
this.ClientRectangle, this.ClientRectangle,
designTrimmimg, stringFormat);
this.contentAlignment);
base.DrawControl(graphics,base.DrawingRectangle); base.DrawControl(graphics,base.DrawingRectangle);
} }

11
src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportItems/ErrorItem.cs

@ -3,6 +3,7 @@
using System; using System;
using System.Drawing; using System.Drawing;
using ICSharpCode.Reports.Core.BaseClasses.Printing;
namespace ICSharpCode.Reports.Addin.Designer namespace ICSharpCode.Reports.Addin.Designer
{ {
@ -36,10 +37,12 @@ namespace ICSharpCode.Reports.Addin.Designer
string s = String.Format(System.Globalization.CultureInfo.CurrentCulture, string s = String.Format(System.Globalization.CultureInfo.CurrentCulture,
"Error : <{0}> is missing or obsolete",base.Text); "Error : <{0}> is missing or obsolete",base.Text);
ICSharpCode.Reports.Core.BaseClasses.Printing.TextDrawer.DrawString(graphics,s,this.Font,
new SolidBrush(Color.Red), StringFormat stringFormat = TextDrawer.BuildStringFormat(base.StringTrimming,base.ContentAlignment);
this.ClientRectangle, TextDrawer.DrawString(graphics,s,this.Font,
base.StringTrimming,base.ContentAlignment); new SolidBrush(Color.Red),
this.ClientRectangle,
stringFormat);
base.DrawControl(graphics,base.DrawingRectangle); base.DrawControl(graphics,base.DrawingRectangle);
} }
} }

3
src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportItems/TypeProviders/TextItemTypeProvider.cs

@ -73,9 +73,6 @@ namespace ICSharpCode.Reports.Addin.TypeProviders
prop = props.Find("Expression",true); prop = props.Find("Expression",true);
allProperties.Add(prop); allProperties.Add(prop);
prop = props.Find("RightToLeft",true);
allProperties.Add(prop);
return new PropertyDescriptorCollection(allProperties.ToArray()); return new PropertyDescriptorCollection(allProperties.ToArray());
} }
} }

12
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseClasses/Printing/TextDrawer.cs

@ -22,21 +22,21 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing
{ {
} }
public static void DrawString(Graphics graphics,string text, public static void DrawString(Graphics graphics,string text,
Font font,Brush brush, Font font,Brush brush,
RectangleF rectangle, RectangleF rectangle,
StringTrimming stringTrimming, StringFormat format)
ContentAlignment alignment)
{ {
if (graphics == null) { if (graphics == null) {
throw new ArgumentNullException("graphics"); throw new ArgumentNullException("graphics");
} }
StringFormat stringFormat = BuildStringFormat(stringTrimming,alignment);
graphics.DrawString(text, graphics.DrawString(text,
font, font,
brush, brush,
rectangle, rectangle,
stringFormat); format);
} }

10
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseItems/BaseTextItem.cs

@ -114,12 +114,11 @@ namespace ICSharpCode.Reports.Core
throw new ArgumentNullException("rpea"); throw new ArgumentNullException("rpea");
} }
TextDrawer.DrawString(rpea.PrintPageEventArgs.Graphics, TextDrawer.DrawString(rpea.PrintPageEventArgs.Graphics,
toPrint,this.Font, toPrint,this.Font,
new SolidBrush(this.ForeColor), new SolidBrush(this.ForeColor),
rectangle, rectangle,
this.stringTrimming,this.contentAlignment); this.StringFormat);
rpea.LocationAfterDraw = new Point (this.Location.X + this.Size.Width, rpea.LocationAfterDraw = new Point (this.Location.X + this.Size.Width,
@ -183,13 +182,18 @@ namespace ICSharpCode.Reports.Core
public virtual StringFormat StringFormat { public virtual StringFormat StringFormat {
get { get {
return TextDrawer.BuildStringFormat (this.StringTrimming,this.ContentAlignment); var sf = TextDrawer.BuildStringFormat (this.StringTrimming,this.ContentAlignment);
if (this.RightToLeft == System.Windows.Forms.RightToLeft.Yes) {
sf.FormatFlags = sf.FormatFlags | StringFormatFlags.DirectionRightToLeft;
}
return sf;
} }
} }
public System.Windows.Forms.RightToLeft RightToLeft {get;set;} public System.Windows.Forms.RightToLeft RightToLeft {get;set;}
#region IExpression #region IExpression
public string Expression {get;set;} public string Expression {get;set;}

14
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/FormPageBuilder.cs

@ -44,8 +44,10 @@ namespace ICSharpCode.Reports.Core.Exporter
protected override void BuildReportHeader() protected override void BuildReportHeader()
{ {
if (base.Pages.Count == 0) { if (base.Pages.Count == 0)
this.ReportModel.ReportHeader.SectionOffset = base.SinglePage.SectionBounds.ReportHeaderRectangle.Top; {
// this.ReportModel.ReportHeader.SectionOffset = base.SinglePage.SectionBounds.ReportHeaderRectangle.Top;
SectionBounds.Offset = new Point(base.SectionBounds.MarginBounds.Left,base.SectionBounds.MarginBounds.Top);
ExporterCollection convertedList = base.ConvertSection (base.ReportModel.ReportHeader,0); ExporterCollection convertedList = base.ConvertSection (base.ReportModel.ReportHeader,0);
base.SinglePage.Items.AddRange(convertedList); base.SinglePage.Items.AddRange(convertedList);
} }
@ -53,7 +55,10 @@ namespace ICSharpCode.Reports.Core.Exporter
protected override void BuildPageHeader() protected override void BuildPageHeader()
{ {
this.ReportModel.PageHeader.SectionOffset = base.SinglePage.SectionBounds.PageHeaderRectangle.Top; // this.ReportModel.PageHeader.SectionOffset = base.SinglePage.SectionBounds.PageHeaderRectangle.Top;
if (SectionBounds.Offset.Y < base.ReportModel.PageHeader.SectionOffset) {
SectionBounds.Offset = new Point(SectionBounds.Offset.X,base.ReportModel.PageHeader.SectionOffset);
}
ExporterCollection convertedList = base.ConvertSection (base.ReportModel.PageHeader,0); ExporterCollection convertedList = base.ConvertSection (base.ReportModel.PageHeader,0);
base.SinglePage.Items.AddRange(convertedList); base.SinglePage.Items.AddRange(convertedList);
base.SectionBounds.CalculatePageBounds(base.ReportModel); base.SectionBounds.CalculatePageBounds(base.ReportModel);
@ -63,7 +68,8 @@ namespace ICSharpCode.Reports.Core.Exporter
protected override void BuildDetailInternal(BaseSection section) protected override void BuildDetailInternal(BaseSection section)
{ {
base.BuildDetailInternal(section); base.BuildDetailInternal(section);
section.SectionOffset = base.SinglePage.SectionBounds.DetailArea.Top; // section.SectionOffset = base.SinglePage.SectionBounds.DetailArea.Top;
SectionBounds.Offset = new Point(SectionBounds.Offset.X,base.ReportModel.DetailSection.Location.Y);
ExporterCollection convertedList = convertedList = base.ConvertSection (base.ReportModel.DetailSection,0); ExporterCollection convertedList = convertedList = base.ConvertSection (base.ReportModel.DetailSection,0);
base.SinglePage.Items.AddRange(convertedList); base.SinglePage.Items.AddRange(convertedList);
} }

Loading…
Cancel
Save