Browse Source

RightToLeft

pull/15/head^2
peterforstmeier 15 years ago
parent
commit
bdc54cbf11
  1. 37
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportItems/BaseTextItem.cs
  2. 3
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportItems/TypeProviders/TextItemTypeProvider.cs
  3. 11
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseClasses/Printing/TextDrawer.cs
  4. 5
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseItems/BaseGraphicItem.cs
  5. 12
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseItems/BaseTextItem.cs
  6. 2
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/BasePager.cs
  7. 2
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/BaseConverter.cs
  8. 19
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Converters/GroupedRowConverter.cs
  9. 2
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/DataPageBuilder.cs
  10. 24
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Decorators/GraphicStyleDecorator.cs
  11. 1
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Decorators/Linedecorator.cs
  12. 63
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Decorators/TextStyleDecorator.cs
  13. 5
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/ExportColumns/ExportText.cs

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

@ -59,6 +59,15 @@ namespace ICSharpCode.Reports.Addin
if (this.stringTrimming != StringTrimming.None) { if (this.stringTrimming != StringTrimming.None) {
designTrimmimg = stringTrimming; designTrimmimg = stringTrimming;
} }
// var o = StringFormatFlags.LineLimit;
// 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) {
Console.WriteLine("RightToLeft");
}
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,
@ -70,8 +79,8 @@ namespace ICSharpCode.Reports.Addin
[EditorAttribute(typeof(DefaultTextEditor), [EditorAttribute(typeof(DefaultTextEditor),
typeof(System.Drawing.Design.UITypeEditor) )] typeof(System.Drawing.Design.UITypeEditor) )]
public override string Text { public override string Text {
get { return base.Text; } get { return base.Text; }
set { base.Text = value; set { base.Text = value;
@ -116,9 +125,11 @@ namespace ICSharpCode.Reports.Addin
} }
} }
[Category("Appearance")] [Category("Appearance")]
[EditorAttribute(typeof(System.Drawing.Design.ContentAlignmentEditor), [EditorAttribute(typeof(System.Drawing.Design.ContentAlignmentEditor),
typeof(System.Drawing.Design.UITypeEditor) )] typeof(System.Drawing.Design.UITypeEditor) )]
public ContentAlignment ContentAlignment { public ContentAlignment ContentAlignment {
get { return contentAlignment; } get { return contentAlignment; }
set { set {
@ -127,9 +138,17 @@ namespace ICSharpCode.Reports.Addin
} }
} }
[Category("Appearance")]
public override System.Windows.Forms.RightToLeft RightToLeft {
get { return base.RightToLeft; }
set { base.RightToLeft = value; }
}
#endregion #endregion
[Browsable(true), [Browsable(true),
Category("Databinding"), Category("Databinding"),
Description("Datatype of the underlying Column")] Description("Datatype of the underlying Column")]
@ -144,8 +163,8 @@ namespace ICSharpCode.Reports.Addin
[Browsable(true), [Browsable(true),
Category("Expression"), Category("Expression"),
Description("Enter a valid Expression")] Description("Enter a valid Expression")]
[EditorAttribute(typeof(DefaultTextEditor), [EditorAttribute(typeof(DefaultTextEditor),
typeof(System.Drawing.Design.UITypeEditor) )] typeof(System.Drawing.Design.UITypeEditor) )]
public string Expression {get;set;} public string Expression {get;set;}
#endregion #endregion
@ -153,9 +172,9 @@ namespace ICSharpCode.Reports.Addin
#region CanGrow/CanShrink #region CanGrow/CanShrink
public bool CanGrow {get;set;} public bool CanGrow {get;set;}
public bool CanShrink {get;set;} public bool CanShrink {get;set;}
#endregion #endregion
} }

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

@ -73,6 +73,9 @@ 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());
} }
} }

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

@ -49,14 +49,17 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing
if (decorator == null) { if (decorator == null) {
throw new ArgumentNullException("decorator"); throw new ArgumentNullException("decorator");
} }
StringFormat stringFormat = BuildStringFormat(decorator.StringTrimming,decorator.ContentAlignment); StringFormat stringFormat = BuildStringFormat(decorator.StringTrimming,decorator.ContentAlignment);
string formattedString = text; if (decorator.RightToLeft ==System.Windows.Forms.RightToLeft.Yes) {
stringFormat.FormatFlags = stringFormat.FormatFlags | StringFormatFlags.DirectionRightToLeft;
if (! String.IsNullOrEmpty(decorator.FormatString)) {
formattedString = StandardFormatter.FormatOutput(text,decorator.FormatString,decorator.DataType,"yyy");
} }
var formattedString = text;
if (! String.IsNullOrEmpty(decorator.FormatString)) {
formattedString = StandardFormatter.FormatOutput(text,decorator.FormatString,decorator.DataType,String.Empty);
}
graphics.TextRenderingHint = TextRenderingHint.AntiAlias; graphics.TextRenderingHint = TextRenderingHint.AntiAlias;

5
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/BaseItems/BaseGraphicItem.cs

@ -27,8 +27,9 @@ namespace ICSharpCode.Reports.Core {
} }
protected IGraphicStyleDecorator CreateItemStyle (BaseShape shape) { protected IGraphicStyleDecorator CreateItemStyle (BaseShape shape)
GraphicStyleDecorator style = new GraphicStyleDecorator(shape); {
IGraphicStyleDecorator style = new GraphicStyleDecorator(shape);
style.Size = this.Size; style.Size = this.Size;
style.Location = this.Location; style.Location = this.Location;

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

@ -66,6 +66,7 @@ namespace ICSharpCode.Reports.Core
style.ContentAlignment = this.contentAlignment; style.ContentAlignment = this.contentAlignment;
style.FormatString = this.formatString; style.FormatString = this.formatString;
style.DataType = this.dataType; style.DataType = this.dataType;
style.RightToLeft = this.RightToLeft;
return style; return style;
} }
@ -120,9 +121,6 @@ namespace ICSharpCode.Reports.Core
rectangle, rectangle,
this.stringTrimming,this.contentAlignment); this.stringTrimming,this.contentAlignment);
//TextDrawer.DrawString(rpea.PrintPageEventArgs.Graphics,toPrint,CreateItemStyle());
rpea.LocationAfterDraw = new Point (this.Location.X + this.Size.Width, rpea.LocationAfterDraw = new Point (this.Location.X + this.Size.Width,
this.Location.Y + this.Size.Height); this.Location.Y + this.Size.Height);
@ -152,11 +150,6 @@ namespace ICSharpCode.Reports.Core
} }
///<summary>
/// Formatstring like in MSDN
/// </summary>
public virtual string FormatString { public virtual string FormatString {
get { get {
@ -194,6 +187,9 @@ namespace ICSharpCode.Reports.Core
} }
} }
public System.Windows.Forms.RightToLeft RightToLeft {get;set;}
#region IExpression #region IExpression
public string Expression {get;set;} public string Expression {get;set;}

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

@ -101,10 +101,8 @@ namespace ICSharpCode.Reports.Core.Exporter
gapCalculator.CalculateGapList(section); gapCalculator.CalculateGapList(section);
int i = 0; int i = 0;
foreach (BaseReportItem item in section.Items) foreach (BaseReportItem item in section.Items)
{ {
ISimpleContainer simpleContainer = item as ISimpleContainer; ISimpleContainer simpleContainer = item as ISimpleContainer;
Offset = new Point(Offset.X,Offset.Y + gapCalculator.GapBetweenItems[i] ); Offset = new Point(Offset.X,Offset.Y + gapCalculator.GapBetweenItems[i] );

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

@ -60,12 +60,10 @@ namespace ICSharpCode.Reports.Core.Exporter
protected void FirePageFull (ExporterCollection items) protected void FirePageFull (ExporterCollection items)
{ {
var newPage = new NewPageEventArgs (items,SinglePage.SectionBounds); var newPage = new NewPageEventArgs (items,SinglePage.SectionBounds);
// EventHelper.Raise<NewPageEventArgs>(PageFull,this,new NewPageEventArgs(items,SinglePage.SectionBounds));
EventHelper.Raise<NewPageEventArgs>(PageFull,this,newPage); EventHelper.Raise<NewPageEventArgs>(PageFull,this,newPage);
SinglePage.SectionBounds = newPage.SectionBounds; SinglePage.SectionBounds = newPage.SectionBounds;
} }
#endregion #endregion

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

@ -57,10 +57,7 @@ namespace ICSharpCode.Reports.Core.Exporter
private ExporterCollection ConvertDataRow (ISimpleContainer simpleContainer) private ExporterCollection ConvertDataRow (ISimpleContainer simpleContainer)
{ {
ExporterCollection exporterCollection = new ExporterCollection(); ExporterCollection exporterCollection = new ExporterCollection();
// base.CurrentPosition = base.SectionBounds.DetailArea.Location;
base.CurrentPosition = base.SectionBounds.Offset; base.CurrentPosition = base.SectionBounds.Offset;
// Console.WriteLine("Convertdatarow start {0}",base.CurrentPosition);
BaseSection section = parent as BaseSection; BaseSection section = parent as BaseSection;
DefaultLeftPosition = parent.Location.X; DefaultLeftPosition = parent.Location.X;
@ -157,22 +154,6 @@ namespace ICSharpCode.Reports.Core.Exporter
protected override Point ForcePageBreak(ExporterCollection exporterCollection, BaseSection section) protected override Point ForcePageBreak(ExporterCollection exporterCollection, BaseSection section)
{ {
base.ForcePageBreak(exporterCollection,section); base.ForcePageBreak(exporterCollection,section);
return CalculateStartPosition(section);
}
private Point CalculateStartPosition(BaseSection section)
{
// var r = base.ReportModel;
// base.SectionBounds.CalculatePageBounds(r);
// var rr = new Point(base.SectionBounds.DetailArea.X,base.SectionBounds.PageHeaderRectangle.Bottom + 1);
// var p = base.SectionBounds.DetailArea.Location;
// var pp = SectionBounds.Offset;
// Console.WriteLine ("PageBreak {0} - detailareaa {1}",rr,p);
// Console.WriteLine("-----------------");
// Console.WriteLine("");
//// return base.SectionBounds.DetailArea.Location;
// return pp;
return SectionBounds.Offset; return SectionBounds.Offset;
} }

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

@ -75,7 +75,6 @@ namespace ICSharpCode.Reports.Core.Exporter
base.ReportModel.ReportHeader.Size = Size.Empty; base.ReportModel.ReportHeader.Size = Size.Empty;
} }
base.SectionBounds.CalculatePageBounds(base.ReportModel); base.SectionBounds.CalculatePageBounds(base.ReportModel);
var p = base.SectionBounds.Offset;
} }
@ -84,7 +83,6 @@ namespace ICSharpCode.Reports.Core.Exporter
if (SectionBounds.Offset.Y < base.ReportModel.PageHeader.SectionOffset) { if (SectionBounds.Offset.Y < base.ReportModel.PageHeader.SectionOffset) {
SectionBounds.Offset = new Point(SectionBounds.Offset.X,base.ReportModel.PageHeader.SectionOffset); SectionBounds.Offset = new Point(SectionBounds.Offset.X,base.ReportModel.PageHeader.SectionOffset);
} }
base.SectionBounds.CalculatePageBounds(base.ReportModel); base.SectionBounds.CalculatePageBounds(base.ReportModel);
ConvertSectionInternal (base.ReportModel.PageHeader); ConvertSectionInternal (base.ReportModel.PageHeader);
} }

24
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Decorators/GraphicStyleDecorator.cs

@ -18,32 +18,22 @@ namespace ICSharpCode.Reports.Core.Exporter
public class GraphicStyleDecorator:BaseStyleDecorator,IGraphicStyleDecorator public class GraphicStyleDecorator:BaseStyleDecorator,IGraphicStyleDecorator
{ {
private BaseShape shape;
private int thickness = 1;
private DashStyle dashStyle = DashStyle.Solid;
public GraphicStyleDecorator(BaseShape shape):base() public GraphicStyleDecorator(BaseShape shape):base()
{ {
if (shape == null) { if (shape == null) {
throw new ArgumentNullException("shape"); throw new ArgumentNullException("shape");
} }
this.shape = shape; this.Shape = shape;
Thickness = 1;
DashStyle = DashStyle.Solid;
} }
public BaseShape Shape {get;set;}
public BaseShape Shape { public int Thickness {get;set;}
get { return shape; }
set { shape = value; }
}
public int Thickness {
get { return thickness; }
set { thickness = value; }
}
public DashStyle DashStyle { public DashStyle DashStyle {get;set;}
get { return dashStyle; }
set { dashStyle = value; }
}
} }
} }

1
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Decorators/Linedecorator.cs

@ -10,7 +10,6 @@ namespace ICSharpCode.Reports.Core.Exporter
{ {
public LineDecorator(BaseShape shape) : base(shape) public LineDecorator(BaseShape shape) : base(shape)
{ {
} }
public Point From { get; set; } public Point From { get; set; }

63
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/Decorators/TextStyleDecorator.cs

@ -11,65 +11,24 @@ namespace ICSharpCode.Reports.Core.Exporter
/// </summary> /// </summary>
public class TextStyleDecorator:BaseStyleDecorator public class TextStyleDecorator:BaseStyleDecorator
{ {
private Font font;
private StringFormat stringFormat;
private StringTrimming stringTrimming;
private ContentAlignment contentAlignment;
private string dataType;
private string formatString;
public TextStyleDecorator():base() public TextStyleDecorator():base()
{ {
} }
public Font Font {get;set;}
public Font Font { public StringFormat StringFormat {get;set;}
get {
return font;
}
set {
font = value;
}
}
public StringTrimming StringTrimming {get;set;}
public ContentAlignment ContentAlignment {get;set;}
public StringFormat StringFormat { public string DataType {get;set;}
get {
return stringFormat; public string FormatString {get;set;}
}
set {
stringFormat = value;
}
}
public StringTrimming StringTrimming {
get {
return stringTrimming;
}
set {
stringTrimming = value;
}
}
public ContentAlignment ContentAlignment {
get {
return contentAlignment;
}
set {
contentAlignment = value;
}
}
public string DataType {
get { return dataType; }
set { dataType = value; }
}
public string FormatString {
get { return formatString; }
set { formatString = value; }
}
public System.Windows.Forms.RightToLeft RightToLeft {get;set;}
} }
} }

5
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/ExportColumns/ExportText.cs

@ -45,6 +45,11 @@ namespace ICSharpCode.Reports.Core.Exporter {
CalculatePdfFormat pdfFormat = new CalculatePdfFormat(this.StyleDecorator,font); CalculatePdfFormat pdfFormat = new CalculatePdfFormat(this.StyleDecorator,font);
ColumnText columnText = new ColumnText(contentByte); ColumnText columnText = new ColumnText(contentByte);
if (StyleDecorator.RightToLeft.ToString() == "Yes") {
columnText.RunDirection = PdfWriter.RUN_DIRECTION_RTL;
}
iTextSharp.text.Rectangle r = base.ConvertToPdfRectangle(); iTextSharp.text.Rectangle r = base.ConvertToPdfRectangle();
columnText.SetSimpleColumn(r.Left, r.Top , r.Left + r.Width,r.Top - r.Height,pdfFormat.Leading,pdfFormat.Alignment); columnText.SetSimpleColumn(r.Left, r.Top , r.Left + r.Width,r.Top - r.Height,pdfFormat.Leading,pdfFormat.Alignment);

Loading…
Cancel
Save