From 3ef0ce8562a567ac921a354c357dc7843566b22e Mon Sep 17 00:00:00 2001 From: Fast Reports Date: Wed, 20 May 2020 11:09:33 +0300 Subject: [PATCH 1/2] * sync 5/20/2020 --- Demos/Reports/Barcode.frx | 12 +- FastReport.Base/BandBase.cs | 4 +- FastReport.Base/Barcode/Barcode2DBase.cs | 13 +- FastReport.Base/Barcode/BarcodeQR.cs | 382 ++--- FastReport.Base/Barcode/QRCode/QRData.cs | 753 +++++++++- FastReport.Base/Base.cs | 4 + FastReport.Base/Code/AssemblyDescriptor.cs | 271 ++-- FastReport.Base/Code/CodeHelper.cs | 4 + FastReport.Base/Code/CsCodeHelper.cs | 5 + FastReport.Base/Code/VbCodeHelper.cs | 8 +- FastReport.Base/ComponentBase.cs | 28 + FastReport.Base/Engine/ReportEngine.Bands.cs | 37 +- FastReport.Base/Matrix/MatrixCells.cs | 5 + FastReport.Base/Matrix/MatrixData.cs | 5 + FastReport.Base/Matrix/MatrixHelper.cs | 28 +- FastReport.Base/Matrix/MatrixObject.cs | 18 +- FastReport.Base/Preview/PreparedPages.cs | 20 + FastReport.Base/Preview/SourcePages.cs | 6 +- FastReport.Base/Report.cs | 2 + FastReport.Base/ReportComponentBase.cs | 14 +- FastReport.Base/ReportPage.cs | 13 - FastReport.Base/Table/TableBase.cs | 133 +- FastReport.Base/Table/TableResult.cs | 1261 ++++++++--------- FastReport.Base/TextObject.cs | 17 +- FastReport.Base/Utils/CompileHelper.cs | 9 +- FastReport.Base/Utils/Config.cs | 48 +- FastReport.Base/Utils/Converter.cs | 13 +- FastReport.Base/Utils/Exceptions.cs | 20 + FastReport.Base/Utils/TextRenderer.cs | 78 +- .../Code/AssemblyDescriptor.Core.cs | 4 + .../DotNetClasses/CSharpCodeProvider.cs | 84 -- .../DotNetClasses/CodeDomProvider.cs | 71 - .../DotNetClasses/CodeGenerator.cs | 17 - .../DotNetClasses/Color.Core.cs | 577 -------- .../DotNetClasses/Color.Full.cs | 30 - .../DotNetClasses/ColorConverter.cs | 480 ------- .../DotNetClasses/ColorTranslator.cs | 180 --- .../DotNetClasses/CompilerError.cs | 17 - .../DotNetClasses/CompilerParameters.cs | 17 - .../DotNetClasses/CompilerResults.cs | 16 - .../DotNetClasses/SystemColors.cs | 47 - .../DotNetClasses/TempFileCollection.cs | 21 - .../DotNetClasses/UITypeEditor.cs | 10 - .../DotNetClasses/VBCodeProvider.cs | 84 -- .../WindowsFormsReplacement.BindingSource.cs | 150 -- ...ndowsFormsReplacement.ListBindingHelper.cs | 180 --- .../DotNetClasses/WindowsFormsReplacement.cs | 979 ------------- .../FastReport.OpenSource.csproj | 9 +- .../TypeConverters/FontConverter.cs | 386 ----- FastReport/Resources/en.xml | 54 +- FastReport/Resources/icon16.ico | Bin 204862 -> 16446 bytes 51 files changed, 2084 insertions(+), 4540 deletions(-) delete mode 100644 FastReport.OpenSource/DotNetClasses/CSharpCodeProvider.cs delete mode 100644 FastReport.OpenSource/DotNetClasses/CodeDomProvider.cs delete mode 100644 FastReport.OpenSource/DotNetClasses/CodeGenerator.cs delete mode 100644 FastReport.OpenSource/DotNetClasses/Color.Core.cs delete mode 100644 FastReport.OpenSource/DotNetClasses/Color.Full.cs delete mode 100644 FastReport.OpenSource/DotNetClasses/ColorConverter.cs delete mode 100644 FastReport.OpenSource/DotNetClasses/ColorTranslator.cs delete mode 100644 FastReport.OpenSource/DotNetClasses/CompilerError.cs delete mode 100644 FastReport.OpenSource/DotNetClasses/CompilerParameters.cs delete mode 100644 FastReport.OpenSource/DotNetClasses/CompilerResults.cs delete mode 100644 FastReport.OpenSource/DotNetClasses/SystemColors.cs delete mode 100644 FastReport.OpenSource/DotNetClasses/TempFileCollection.cs delete mode 100644 FastReport.OpenSource/DotNetClasses/UITypeEditor.cs delete mode 100644 FastReport.OpenSource/DotNetClasses/VBCodeProvider.cs delete mode 100644 FastReport.OpenSource/DotNetClasses/WindowsFormsReplacement.BindingSource.cs delete mode 100644 FastReport.OpenSource/DotNetClasses/WindowsFormsReplacement.ListBindingHelper.cs delete mode 100644 FastReport.OpenSource/DotNetClasses/WindowsFormsReplacement.cs delete mode 100644 FastReport.OpenSource/TypeConverters/FontConverter.cs diff --git a/Demos/Reports/Barcode.frx b/Demos/Reports/Barcode.frx index 8ada9a1d..caac0143 100644 --- a/Demos/Reports/Barcode.frx +++ b/Demos/Reports/Barcode.frx @@ -1,12 +1,12 @@  - + - + - + @@ -57,11 +57,13 @@ - + + + - + diff --git a/FastReport.Base/BandBase.cs b/FastReport.Base/BandBase.cs index 01fa69ce..497f7c34 100644 --- a/FastReport.Base/BandBase.cs +++ b/FastReport.Base/BandBase.cs @@ -815,8 +815,6 @@ public override float CalcHeight() return Height; } - /// - public void AddLastToFooter(BreakableComponent breakTo) { float maxTop = (AllObjects[0] as ComponentBase).Top; @@ -879,7 +877,7 @@ public void AddLastToFooter(BreakableComponent breakTo) Height -= maxBottom - minTop; } - + /// public override bool Break(BreakableComponent breakTo) { // first we find the break line. It's a minimum Top coordinate of the object that cannot break. diff --git a/FastReport.Base/Barcode/Barcode2DBase.cs b/FastReport.Base/Barcode/Barcode2DBase.cs index 8f65fd6a..66b98543 100644 --- a/FastReport.Base/Barcode/Barcode2DBase.cs +++ b/FastReport.Base/Barcode/Barcode2DBase.cs @@ -22,7 +22,16 @@ private void DrawBarcode(IGraphicsRenderer g, float width, float height) Draw2DBarcode(g, kx, ky); - // draw the text. + //If swiss qr, draw the swiss cross + if (text.StartsWith("SPC")) + { + float top = showText ? height - 21 : height; + g.FillRectangle(Brushes.White, width / 2 - width / 100f * 7, top / 2 - top / 100 * 7, width / 100f * 14, top / 100 * 14); + g.FillRectangle(Brushes.Black, width / 2 - width / 100f * 6, top / 2 - top / 100 * 6, width / 100f * 12, top / 100 * 12); + g.FillRectangle(Brushes.White, width / 2 - width / 100f * 4, top / 2 - top / 100 * 1.5f, width / 100f * 8, top / 100 * 3); + g.FillRectangle(Brushes.White, width / 2 - width / 100f * 1.5f, top / 2 - top / 100 * 4, width / 100f * 3, top / 100 * 8); + } + // draw the text. if (showText) { string data = StripControlCodes(text); @@ -33,7 +42,7 @@ private void DrawBarcode(IGraphicsRenderer g, float width, float height) { g.DrawString(data, drawFont, Brushes.Black, new RectangleF(0, height - 18 * ky, width, 18 * ky)); } - } + } } internal virtual void Draw2DBarcode(IGraphicsRenderer g, float kx, float ky) diff --git a/FastReport.Base/Barcode/BarcodeQR.cs b/FastReport.Base/Barcode/BarcodeQR.cs index 95bf3241..001af759 100644 --- a/FastReport.Base/Barcode/BarcodeQR.cs +++ b/FastReport.Base/Barcode/BarcodeQR.cs @@ -10,222 +10,228 @@ namespace FastReport.Barcode { - /// - /// Specifies the QR code error correction level. - /// - public enum QRCodeErrorCorrection - { /// - /// L = ~7% correction. + /// Specifies the QR code error correction level. /// - L, - - /// - /// M = ~15% correction. - /// - M, - - /// - /// Q = ~25% correction. - /// - Q, - - /// - /// H = ~30% correction. - /// - H - } - - /// - /// Specifies the QR Code encoding. - /// - public enum QRCodeEncoding - { - /// - /// UTF-8 encoding. - /// - UTF8, - /// - /// ISO 8859-1 encoding. - /// - ISO8859_1, - /// - /// Shift_JIS encoding. - /// - Shift_JIS, - /// - /// Windows-1251 encoding. - /// - Windows_1251, - /// - /// cp866 encoding. - /// - cp866 - } - - /// - /// Generates the 2D QR code barcode. - /// - public class BarcodeQR : Barcode2DBase - { - #region Fields - private QRCodeErrorCorrection errorCorrection; - private QRCodeEncoding encoding; - private bool quietZone; - private ByteMatrix matrix; - private const int PixelSize = 4; - #endregion - - #region Properties - /// - /// Gets or sets the error correction. - /// - [DefaultValue(QRCodeErrorCorrection.L)] - public QRCodeErrorCorrection ErrorCorrection + public enum QRCodeErrorCorrection { - get { return errorCorrection; } - set { errorCorrection = value; } + /// + /// L = ~7% correction. + /// + L, + + /// + /// M = ~15% correction. + /// + M, + + /// + /// Q = ~25% correction. + /// + Q, + + /// + /// H = ~30% correction. + /// + H } - + /// - /// Gets or sets the encoding used for text conversion. + /// Specifies the QR Code encoding. /// - [DefaultValue(QRCodeEncoding.UTF8)] - public QRCodeEncoding Encoding + public enum QRCodeEncoding { - get { return encoding; } - set { encoding = value; } + /// + /// UTF-8 encoding. + /// + UTF8, + /// + /// ISO 8859-1 encoding. + /// + ISO8859_1, + /// + /// Shift_JIS encoding. + /// + Shift_JIS, + /// + /// Windows-1251 encoding. + /// + Windows_1251, + /// + /// cp866 encoding. + /// + cp866 } /// - /// Gets or sets the value indicating that quiet zone must be shown. + /// Generates the 2D QR code barcode. /// - [DefaultValue(true)] - public bool QuietZone + public class BarcodeQR : Barcode2DBase { - get { return quietZone; } - set { quietZone = value; } - } - #endregion + #region Fields + private QRCodeErrorCorrection errorCorrection; + private QRCodeEncoding encoding; + private bool quietZone; + private ByteMatrix matrix; + private const int PixelSize = 4; + #endregion + + #region Properties + /// + /// Gets or sets the error correction. + /// + [DefaultValue(QRCodeErrorCorrection.L)] + public QRCodeErrorCorrection ErrorCorrection + { + get { return errorCorrection; } + set { errorCorrection = value; } + } - #region Private Methods - private ErrorCorrectionLevel GetErrorCorrectionLevel() - { - switch (errorCorrection) - { - case QRCodeErrorCorrection.L: - return ErrorCorrectionLevel.L; - - case QRCodeErrorCorrection.M: - return ErrorCorrectionLevel.M; - - case QRCodeErrorCorrection.Q: - return ErrorCorrectionLevel.Q; - - case QRCodeErrorCorrection.H: - return ErrorCorrectionLevel.H; - } - - return ErrorCorrectionLevel.L; - } + /// + /// Gets or sets the encoding used for text conversion. + /// + [DefaultValue(QRCodeEncoding.UTF8)] + public QRCodeEncoding Encoding + { + get { return encoding; } + set { encoding = value; } + } - private string GetEncoding() - { - switch (encoding) - { - case QRCodeEncoding.UTF8: - return "UTF-8"; + /// + /// Gets or sets the value indicating that quiet zone must be shown. + /// + [DefaultValue(true)] + public bool QuietZone + { + get { return quietZone; } + set { quietZone = value; } + } + #endregion - case QRCodeEncoding.ISO8859_1: - return "ISO-8859-1"; + #region Private Methods + private ErrorCorrectionLevel GetErrorCorrectionLevel() + { + switch (errorCorrection) + { + case QRCodeErrorCorrection.L: + return ErrorCorrectionLevel.L; - case QRCodeEncoding.Shift_JIS: - return "Shift_JIS"; + case QRCodeErrorCorrection.M: + return ErrorCorrectionLevel.M; - case QRCodeEncoding.Windows_1251: - return "Windows-1251"; + case QRCodeErrorCorrection.Q: + return ErrorCorrectionLevel.Q; - case QRCodeEncoding.cp866: - return "cp866"; - } + case QRCodeErrorCorrection.H: + return ErrorCorrectionLevel.H; + } - return ""; - } - #endregion + return ErrorCorrectionLevel.L; + } - #region Public Methods - /// - public override void Assign(BarcodeBase source) - { - base.Assign(source); - BarcodeQR src = source as BarcodeQR; + private string GetEncoding() + { + switch (encoding) + { + case QRCodeEncoding.UTF8: + return "UTF-8"; - ErrorCorrection = src.ErrorCorrection; - Encoding = src.Encoding; - QuietZone = src.QuietZone; - } + case QRCodeEncoding.ISO8859_1: + return "ISO-8859-1"; - internal override void Serialize(FastReport.Utils.FRWriter writer, string prefix, BarcodeBase diff) - { - base.Serialize(writer, prefix, diff); - BarcodeQR c = diff as BarcodeQR; - - if (c == null || ErrorCorrection != c.ErrorCorrection) - writer.WriteValue(prefix + "ErrorCorrection", ErrorCorrection); - if (c == null || Encoding != c.Encoding) - writer.WriteValue(prefix + "Encoding", Encoding); - if (c == null || QuietZone != c.QuietZone) - writer.WriteBool(prefix + "QuietZone", QuietZone); - } + case QRCodeEncoding.Shift_JIS: + return "Shift_JIS"; - internal override void Initialize(string text, bool showText, int angle, float zoom) - { - base.Initialize(text, showText, angle, zoom); - matrix = QRCodeWriter.encode(base.text, 0, 0, GetErrorCorrectionLevel(), GetEncoding(), QuietZone); - } - - internal override SizeF CalcBounds() - { - int textAdd = showText ? 18 : 0; - return new SizeF(matrix.Width * PixelSize, matrix.Height * PixelSize + textAdd); - } + case QRCodeEncoding.Windows_1251: + return "Windows-1251"; - internal override void Draw2DBarcode(IGraphicsRenderer g, float kx, float ky) - { - Brush light = Brushes.White; - Brush dark = new SolidBrush(Color); - GraphicsPath path = new GraphicsPath(); + case QRCodeEncoding.cp866: + return "cp866"; + } - for (int y = 0; y < matrix.Height; y++) - { - for (int x = 0; x < matrix.Width; x++) + return ""; + } + #endregion + + #region Public Methods + /// + public override void Assign(BarcodeBase source) { - if (matrix.get_Renamed(x, y) == 0) - { - g.PathAddRectangle(path, new RectangleF( - x * PixelSize * kx, - y * PixelSize * ky, - PixelSize * kx, - PixelSize * ky - )); - } + base.Assign(source); + BarcodeQR src = source as BarcodeQR; + + ErrorCorrection = src.ErrorCorrection; + Encoding = src.Encoding; + QuietZone = src.QuietZone; } - } - if (path.PointCount > 0) - g.FillPath(dark, path); - dark.Dispose(); - path.Dispose(); - } - #endregion + internal override void Serialize(FastReport.Utils.FRWriter writer, string prefix, BarcodeBase diff) + { + base.Serialize(writer, prefix, diff); + BarcodeQR c = diff as BarcodeQR; + + if (c == null || ErrorCorrection != c.ErrorCorrection) + writer.WriteValue(prefix + "ErrorCorrection", ErrorCorrection); + if (c == null || Encoding != c.Encoding) + writer.WriteValue(prefix + "Encoding", Encoding); + if (c == null || QuietZone != c.QuietZone) + writer.WriteBool(prefix + "QuietZone", QuietZone); + } - /// - /// Initializes a new instance of the class with default settings. - /// - public BarcodeQR() - { - Encoding = QRCodeEncoding.UTF8; - QuietZone = true; + internal override void Initialize(string text, bool showText, int angle, float zoom) + { + base.Initialize(text, showText, angle, zoom); + matrix = QRCodeWriter.encode(base.text, 0, 0, GetErrorCorrectionLevel(), GetEncoding(), QuietZone); + } + + internal override SizeF CalcBounds() + { + int textAdd = showText ? 18 : 0; + return new SizeF(matrix.Width * PixelSize, matrix.Height * PixelSize + textAdd); + } + + internal override void Draw2DBarcode(IGraphicsRenderer g, float kx, float ky) + { + Brush light = Brushes.White; + Brush dark = new SolidBrush(Color); + GraphicsPath path = new GraphicsPath(); + + for (int y = 0; y < matrix.Height; y++) + { + for (int x = 0; x < matrix.Width; x++) + { + if (matrix.get_Renamed(x, y) == 0) + { + g.PathAddRectangle(path, new RectangleF( + x * PixelSize * kx, + y * PixelSize * ky, + PixelSize * kx, + PixelSize * ky + )); + } + } + } + if (path.PointCount > 0) + { + g.FillPath(dark, path); + if(text.StartsWith("SPC")) + { + ErrorCorrection = QRCodeErrorCorrection.M; + } + } + + dark.Dispose(); + path.Dispose(); + } + #endregion + + /// + /// Initializes a new instance of the class with default settings. + /// + public BarcodeQR() + { + Encoding = QRCodeEncoding.UTF8; + QuietZone = true; + } } - } } diff --git a/FastReport.Base/Barcode/QRCode/QRData.cs b/FastReport.Base/Barcode/QRCode/QRData.cs index 5bfef96d..4d147f46 100644 --- a/FastReport.Base/Barcode/QRCode/QRData.cs +++ b/FastReport.Base/Barcode/QRCode/QRData.cs @@ -1,4 +1,5 @@ -using System; +using FastReport.Utils; +using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; @@ -46,6 +47,8 @@ public static QRData Parse(string data) return new QRURI(data); else if (Regex.IsMatch(data, @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$")) return new QREmailAddress(data); + else if (data.StartsWith("SPC")) + return new QRSwiss(data); else return new QRText(data); } @@ -85,7 +88,7 @@ public override string Pack() StringBuilder data = new StringBuilder("BEGIN:VCARD\nVERSION:2.1\n"); if ((firstName != null && firstName != "") || - (lastName != null && lastName != "")) + (lastName != null && lastName != "")) { data.Append("FN:" + firstName + " " + lastName + "\n"); data.Append("N:" + lastName + ";" + firstName + "\n"); @@ -100,9 +103,9 @@ public override string Pack() data.Append(Append("EMAIL;HOME;INTERNET:", email_home_internet)); data.Append(Append("EMAIL;WORK;INTERNET:", email_work_internet)); - if ((street != null && street != "") || + if ((street != null && street != "") || (zipCode != null && zipCode != "") || - (city != null && city != "") || + (city != null && city != "") || (country != null && country != "")) { data.Append("ADR:;;" + street + ";" + city + ";;" + zipCode + ";" + country + "\n"); @@ -117,7 +120,7 @@ private string Append(string name, string data) { if (data != null && data != "") return name + data + "\n"; - + return ""; } @@ -136,7 +139,7 @@ public override void Unpack(string data) break; case "N": string[] n = s[1].Split(new string[] { ";" }, StringSplitOptions.None); - lastName = n[0]; + lastName = n[0]; firstName = n[1]; break; case "TITLE": @@ -375,4 +378,742 @@ public override void Unpack(string data) hidden = s[4] == "true;" ? true : false; } } + + + class QRSwiss : QRData + { + private string br = "\r\n"; + private string alternativeProcedure1, alternativeProcedure2; + private Iban iban; + private decimal? amount; + private Contact creditor, ultimateCreditor, debitor; + private Currency currency; + private Reference reference; + private AdditionalInformation additionalInformation; + private MyRes res; + + public Iban _Iban { get { return iban; } set { iban = value; } } + public Contact Creditor { get { return creditor; } set { creditor = value; } } + public Contact Debitor { get { return debitor; } set { debitor = value; } } + public Decimal? Amount { get { return amount; } } + public Currency _Currency { get { return currency; } set { currency = value; } } + public Reference _Reference { get { return reference; } set { reference = value; } } + public AdditionalInformation _AdditionalInformation { get { return additionalInformation; } set { additionalInformation = value; } } + public string AlternativeProcedure1 { get { return alternativeProcedure1; } set { alternativeProcedure1 = value; } } + public string AlternativeProcedure2 { get { return alternativeProcedure2; } set { alternativeProcedure2 = value; } } + + //public QRSwiss() : base() { } + public QRSwiss(string data) : base(data) + { + res = new MyRes("Messages,Swiss"); + } + + public QRSwiss(QRSwitchParametres parametres) + { + res = new MyRes("Messages,Swiss"); + if (parametres.Iban == null) + throw new SwissQrCodeException(res.Get("SwissNullIban")); + if (parametres.Creditor == null) + throw new SwissQrCodeException(res.Get("SwissNullCreditor")); + if (parametres.Reference == null) + throw new SwissQrCodeException(res.Get("SwissNullReference")); + if (parametres.Currency == null) + throw new SwissQrCodeException(res.Get("SwissNullCurrency")); + + this.iban = parametres.Iban; + this.creditor = parametres.Creditor; + this.additionalInformation = parametres.AdditionalInformation != null ? parametres.AdditionalInformation : new AdditionalInformation(null, null); + + if (parametres.Amount != null && parametres.Amount.ToString().Length > 12) + throw new SwissQrCodeException(res.Get("SwissAmountLength")); + this.amount = parametres.Amount; + + this.currency = parametres.Currency.Value; + this.debitor = parametres.Debitor; + + if (iban.IsQrIban && parametres.Reference.RefType != Reference.ReferenceType.QRR) + throw new SwissQrCodeException(res.Get("SwissQRIban")); + if (!iban.IsQrIban && parametres.Reference.RefType == Reference.ReferenceType.QRR) + throw new SwissQrCodeException(res.Get("SwissNonQRIban")); + this.reference = parametres.Reference; + + if (parametres.AlternativeProcedure1 != null && parametres.AlternativeProcedure1.Length > 100) + throw new SwissQrCodeException(res.Get("SwissAltProcedureLength")); + this.alternativeProcedure1 = parametres.AlternativeProcedure1; + if (parametres.AlternativeProcedure2 != null && parametres.AlternativeProcedure2.Length > 100) + throw new SwissQrCodeException(res.Get("SwissAltProcedureLength")); + this.alternativeProcedure2 = parametres.AlternativeProcedure2; + } + + public enum Currency + { + CHF = 756, + EUR = 978 + } + + public override void Unpack(string data) + { + string[] datasWithR = data.Split('\n'); + string datass = ""; + foreach (string s in datasWithR) + { + datass += s; + } + string[] datas = datass.Split('\r'); + + List vs = new List(); + + int counter = 3; + + string infoString = ""; + + this.iban = new Iban(datas[counter]); + counter++; + infoString = ""; + + for (int i = counter; i < counter + 7; i++) + { + infoString += datas[i] + '\r'; + } + counter += 7; + this.creditor = new Contact(infoString); + + + if (datas[counter] != String.Empty) + { + infoString = String.Empty; + for (int i = counter; i < counter + 7; i++) + { + infoString += datas[i] + '\r'; + } + this.ultimateCreditor = new Contact(infoString); + } + counter += 7; + this.amount = datas[counter] == String.Empty ? amount = null : Decimal.Parse(datas[counter].Replace('.', ',')); + counter++; + + switch (datas[counter]) + { + case "EUR": + this.currency = Currency.EUR; + break; + case "CHF": + this.currency = Currency.CHF; + break; + } + counter++; + + if (datas[counter] != String.Empty) + { + infoString = String.Empty; + for (int i = counter; i < counter + 7; i++) + { + infoString += datas[i] + '\r'; + } + this.debitor = new Contact(infoString); + } + counter += 7; + + infoString = String.Empty; + for (int i = counter; i < counter + 2; i++) + { + infoString += datas[i] + '\r'; + } + this.reference = new Reference(infoString); + if (reference.RefType == Reference.ReferenceType.QRR) + iban.TypeIban = Iban.IbanType.QrIban; + else + iban.TypeIban = Iban.IbanType.Iban; + if(!String.IsNullOrEmpty(reference.ReferenceText)) + { + if (reference.ChecksumMod10(reference.ReferenceText)) + reference._ReferenceTextType = Reference.ReferenceTextType.QrReference; + else if (Regex.IsMatch(reference.ReferenceText, @"^[0-9]+$")) + reference._ReferenceTextType = Reference.ReferenceTextType.CreditorReferenceIso11649; + } + + + + counter += 2; + + infoString = String.Empty; + for (int i = counter; i < counter + 3; i++) + { + infoString += datas[i] + '\r'; + } + this.additionalInformation = new AdditionalInformation(infoString); + counter += 3; + + if (datas.Length - 1 >= counter) + { + alternativeProcedure1 = datas[counter]; + } + counter++; + + if (datas.Length - 1 >= counter) + { + alternativeProcedure2 = datas[counter]; + } + } + + public override string Pack() + { + string SwissQrCodePayload = "SPC" + br; //QRType + SwissQrCodePayload += "0200" + br; //Version + SwissQrCodePayload += "1" + br; //Coding + + //CdtrInf "logical" element + SwissQrCodePayload += iban.ToString() + br; //IBAN + + + //Cdtr "logical" element + SwissQrCodePayload += creditor.ToString(); + + //UltmtCdtr "logical" element + //Since version 2.0 ultimate creditor was marked as "for future use" and has to be delivered empty in any case! + //SwissQrCodePayload += string.Concat(Enumerable.Repeat(br, 7).ToArray()); + for (int i = 0; i < 7; i++) + { + SwissQrCodePayload += br; + } + + + //CcyAmtDate "logical" element + //Amoutn has to use . as decimal seperator in any case. See https://www.paymentstandards.ch/dam/downloads/ig-qr-bill-en.pdf page 27. + //SwissQrCodePayload += (amount != null ? amount.ToString().Replace(",", ".") : string.Empty) + br; //Amt + if (amount != null) + { + string strAmount = amount.ToString(); + if (!strAmount.Contains(".")) + strAmount = amount.ToString().Replace(",", "."); + else + strAmount += ".00"; + SwissQrCodePayload += strAmount; + } + else + SwissQrCodePayload += string.Empty; + SwissQrCodePayload += br; + + SwissQrCodePayload += currency + br; //Ccy + + //UltmtDbtr "logical" element + if (debitor != null) + SwissQrCodePayload += debitor.ToString(); + else + for (int i = 0; i < 7; i++) + { + SwissQrCodePayload += br; + } + + + //RmtInf "logical" element + SwissQrCodePayload += reference.RefType.ToString() + br; //Tp + SwissQrCodePayload += (!string.IsNullOrEmpty(reference.ReferenceText) ? reference.ReferenceText : string.Empty) + br; //Ref + + + //AddInf "logical" element + SwissQrCodePayload += (!string.IsNullOrEmpty(additionalInformation.UnstructureMessage) ? additionalInformation.UnstructureMessage : string.Empty) + br; //Ustrd + SwissQrCodePayload += additionalInformation.Trailer + br; //Trailer + SwissQrCodePayload += (!string.IsNullOrEmpty(additionalInformation.BillInformation) ? additionalInformation.BillInformation : string.Empty) + br; //StrdBkgInf + + //AltPmtInf "logical" element + if (!string.IsNullOrEmpty(alternativeProcedure1)) + SwissQrCodePayload += alternativeProcedure1.Replace("\n", "") + br; //AltPmt + if (!string.IsNullOrEmpty(alternativeProcedure2)) + SwissQrCodePayload += alternativeProcedure2.Replace("\n", "") + br; //AltPmt + + //S-QR specification 2.0, chapter 4.2.3 + if (SwissQrCodePayload.EndsWith(br)) + SwissQrCodePayload = SwissQrCodePayload.Remove(SwissQrCodePayload.Length - br.Length); + + return SwissQrCodePayload; + } + + public class QRSwitchParametres + { + #region private fields + private Iban iban; + private Currency? currency; + private Contact creditor; + private Reference reference; + private AdditionalInformation additionalInformation; + private Contact debitor; + private decimal? amount; + private string alternativeProcedure1; + private string alternativeProcedure2; + #endregion + + #region public properties + /// + /// IBAN object + /// + public Iban Iban { get { return iban; } set { iban = value; } } + + /// + /// (either EUR or CHF) + /// + public Currency? Currency { get { return currency; } set { currency = value; } } + + /// + /// Creditor (payee) information + /// + public Contact Creditor { get { return creditor; } set { creditor = value; } } + + /// + /// Reference information + /// + public Reference Reference { get { return reference; } set { reference = value; } } + + /// + /// Can be null + /// + public AdditionalInformation AdditionalInformation { get { return additionalInformation; } set { additionalInformation = value; } } + + /// + /// Debitor (payer) information + /// + public Contact Debitor { get { return debitor; } set { debitor = value; } } + + /// + /// Amount + /// + public decimal? Amount { get { return amount; } set { amount = value; } } + + /// + /// Optional command for alternative processing mode - line 1 + /// + public string AlternativeProcedure1 { get { return alternativeProcedure1; } set { alternativeProcedure1 = value; } } + + /// + /// Optional command for alternative processing mode - line 2 + /// + public string AlternativeProcedure2 { get { return alternativeProcedure2; } set { alternativeProcedure2 = value; } } + #endregion + } + + public class AdditionalInformation + { + private string unstructuredMessage, billInformation, trailer; + + /// + /// Creates an additional information object. Both parameters are optional and must be shorter than 141 chars in combination. + /// + /// Unstructured text message + /// Bill information + public AdditionalInformation(string unstructuredMessage, string billInformation) + { + MyRes res = new MyRes("Messages,Swiss"); + if (((unstructuredMessage != null ? unstructuredMessage.Length : 0) + (billInformation != null ? billInformation.Length : 0)) > 140) + throw new SwissQrCodeException(res.Get("SwissUnstructBillLength")); + this.unstructuredMessage = unstructuredMessage; + this.billInformation = billInformation; + this.trailer = "EPD"; + } + + public AdditionalInformation(string addInfo) + { + string[] data = addInfo.Split('\r'); + this.trailer = data[1].Trim(); + this.unstructuredMessage = data[0].Trim(); + this.billInformation = data[2].Trim(); + + } + + public string UnstructureMessage + { + get { return !string.IsNullOrEmpty(unstructuredMessage) ? unstructuredMessage.Replace("\n", "") : null; } + set { this.unstructuredMessage = value; } + } + + public string BillInformation + { + get { return !string.IsNullOrEmpty(billInformation) ? billInformation.Replace("\n", "") : null; } + set { this.billInformation = value; } + } + + public string Trailer + { + get { return trailer; } + } + } + + public class Reference + { + private ReferenceType referenceType; + private string reference; + private ReferenceTextType? referenceTextType; + + + public ReferenceType RefType + { + get { return referenceType; } + set { referenceType = value; } + } + + public string ReferenceText + { + get { return !string.IsNullOrEmpty(reference) ? reference.Replace("\n", "") : null; } + set { reference = value; } + } + + public ReferenceTextType? _ReferenceTextType + { + get { return referenceTextType; } + set { referenceTextType = value; } + } + + /// + /// Creates a reference object which must be passed to the SwissQrCode instance + /// + /// Type of the reference (QRR, SCOR or NON) + /// Reference text + /// Type of the reference text (QR-reference or Creditor Reference) + public Reference(ReferenceType referenceType, string reference, ReferenceTextType? referenceTextType) + { + MyRes res = new MyRes("Messages,Swiss"); + + this.referenceType = referenceType; + this.referenceTextType = referenceTextType; + + if (referenceType == ReferenceType.NON && reference != null) + throw new SwissQrCodeException(res.Get("SwissRefTypeNon")); + if (referenceType != ReferenceType.NON && reference != null && referenceTextType == null) + throw new SwissQrCodeException(res.Get("SwissRefTextTypeNon")); + if (referenceTextType == ReferenceTextType.QrReference && reference != null && (reference.Length > 27)) + throw new SwissQrCodeException(res.Get("SwissRefQRLength")); + if (referenceTextType == ReferenceTextType.QrReference && reference != null && !Regex.IsMatch(reference, @"^[0-9]+$")) + throw new SwissQrCodeException(res.Get("SwissRefQRNotOnlyDigits")); + if (referenceTextType == ReferenceTextType.QrReference && reference != null && !ChecksumMod10(reference)) + throw new SwissQrCodeException(res.Get("SwissRefQRCheckSum")); + if (referenceTextType == ReferenceTextType.CreditorReferenceIso11649 && reference != null && (reference.Length > 25)) + throw new SwissQrCodeException(res.Get("SwissRefISOLength")); + + this.reference = reference; + } + + + public Reference(string reference) + { + string[] data = reference.Split('\r'); + + switch (data[0].Trim()) + { + case "QRR": + this.referenceType = ReferenceType.QRR; + break; + case "SCOR": + this.referenceType = ReferenceType.SCOR; + break; + case "NON": + this.referenceType = ReferenceType.NON; + break; + } + + this.reference = data[1].Trim(); + } + + /// + /// Reference type. When using a QR-IBAN you have to use either "QRR" or "SCOR" + /// + public enum ReferenceType + { + QRR, + SCOR, + NON + } + public enum ReferenceTextType + { + QrReference, + CreditorReferenceIso11649 + } + + public bool ChecksumMod10(string digits) + { + if (string.IsNullOrEmpty(digits) || digits.Length < 2) + return false; + int[] mods = new int[] { 0, 9, 4, 6, 8, 2, 7, 1, 3, 5 }; + + int remainder = 0; + for (int i = 0; i < digits.Length - 1; i++) + { + int num = Convert.ToInt32(digits[i]) - 48; + remainder = mods[(num + remainder) % 10]; + } + int checksum = (10 - remainder) % 10; + return checksum == Convert.ToInt32(digits[digits.Length - 1]) - 48; + } + } + + public class Contact + { + private List twoLetterCodes; + private string br = "\r\n"; + private string name, streetOrAddressline1, houseNumberOrAddressline2, zipCode, city, country; + private AddressType adrType; + + public string Name { get { return name; } set { name = value; } } + public string StreetOrAddressline { get { return streetOrAddressline1; } set { streetOrAddressline1 = value; } } + public string HouseNumberOrAddressline { get { return houseNumberOrAddressline2; } set { houseNumberOrAddressline2 = value; } } + public string ZipCode { get { return zipCode; } set { zipCode = value; } } + public string City { get { return city; } set { city = value; } } + public string Country { get { return country; } set { country = value; } } + + /// + /// Contact type. Can be used for payee, ultimate payee, etc. with address in structured mode (S). + /// + /// Last name or company (optional first name) + /// Zip-/Postcode + /// City name + /// Two-letter country code as defined in ISO 3166-1 + /// Streetname without house number + /// House number + public Contact(string name, string zipCode, string city, string country, string street, string houseNumber) : this(name, zipCode, city, country, street, houseNumber, AddressType.StructuredAddress) + { + } + + /// + /// Contact type. Can be used for payee, ultimate payee, etc. with address in combined mode (K). + /// + /// Last name or company (optional first name) + /// Two-letter country code as defined in ISO 3166-1 + /// Adress line 1 + /// Adress line 2 + public Contact(string name, string country, string addressLine1, string addressLine2) : this(name, null, null, country, addressLine1, addressLine2, AddressType.CombinedAddress) + { + } + + private Contact(string name, string zipCode, string city, string country, string streetOrAddressline1, string houseNumberOrAddressline2, AddressType addressType) + { + twoLetterCodes = ValidTwoLetterCodes(); + MyRes res = new MyRes("Messages,Swiss"); + MyRes resForms = new MyRes("Forms,BarcodeEditor,Swiss"); + //Pattern extracted from https://qr-validation.iso-payments.ch as explained in https://github.com/codebude/QRCoder/issues/97 + string charsetPattern = @"^([a-zA-Z0-9\.,;:'\ \+\-/\(\)?\*\[\]\{\}\\`´~ ]|[!""#%&<>÷=@_$£]|[àáâäçèéêëìíîïñòóôöùúûüýßÀÁÂÄÇÈÉÊËÌÍÎÏÒÓÔÖÙÚÛÜÑ])*$"; + + this.adrType = addressType; + + if (string.IsNullOrEmpty(name)) + throw new SwissQrCodeContactException(String.Format(res.Get("SwissEmptyProperty"), resForms.Get("Name"))); + if (name.Length > 70) + throw new SwissQrCodeContactException(String.Format(res.Get("SwissLengthMore"), resForms.Get("Name"), 71)); + if (!Regex.IsMatch(name, charsetPattern)) + throw new SwissQrCodeContactException(String.Format(res.Get("SwissPatternError"), resForms.Get("Name")) + charsetPattern); + this.name = name; + + if (AddressType.StructuredAddress == this.adrType) + { + if (!string.IsNullOrEmpty(streetOrAddressline1) && (streetOrAddressline1.Length > 70)) + throw new SwissQrCodeContactException(String.Format(res.Get("SwissLengthMore"), resForms.Get("Street"), 71)); + if (!string.IsNullOrEmpty(streetOrAddressline1) && !Regex.IsMatch(streetOrAddressline1, charsetPattern)) + throw new SwissQrCodeContactException(String.Format(res.Get("SwissPatternError"), resForms.Get("Street")) + charsetPattern); + this.streetOrAddressline1 = streetOrAddressline1; + + if (!string.IsNullOrEmpty(houseNumberOrAddressline2) && houseNumberOrAddressline2.Length > 16) + throw new SwissQrCodeContactException(String.Format(res.Get("SwissLengthMore"), resForms.Get("HouseNumber"), 71)); + this.houseNumberOrAddressline2 = houseNumberOrAddressline2; + } + else + { + if (!string.IsNullOrEmpty(streetOrAddressline1) && (streetOrAddressline1.Length > 70)) + throw new SwissQrCodeContactException(String.Format(res.Get("SwissLengthMore"), "Address line 1", 71)); + if (!string.IsNullOrEmpty(streetOrAddressline1) && !Regex.IsMatch(streetOrAddressline1, charsetPattern)) + throw new SwissQrCodeContactException(String.Format(res.Get("SwissPatternError"), "Address line 1") + charsetPattern); + this.streetOrAddressline1 = streetOrAddressline1; + + if (string.IsNullOrEmpty(houseNumberOrAddressline2)) + throw new SwissQrCodeContactException(res.Get("SwissAddressLine2Error")); + if (!string.IsNullOrEmpty(houseNumberOrAddressline2) && (houseNumberOrAddressline2.Length > 70)) + throw new SwissQrCodeContactException(String.Format(res.Get("SwissLengthMore"), "Address line 2", 71)); + if (!string.IsNullOrEmpty(houseNumberOrAddressline2) && !Regex.IsMatch(houseNumberOrAddressline2, charsetPattern)) + throw new SwissQrCodeContactException(String.Format(res.Get("SwissPatternError"), "Address line 2") + charsetPattern); + this.houseNumberOrAddressline2 = houseNumberOrAddressline2; + } + + if (AddressType.StructuredAddress == this.adrType) + { + if (string.IsNullOrEmpty(zipCode)) + throw new SwissQrCodeContactException(String.Format(res.Get("SwissEmptyProperty"), resForms.Get("ZipCode"))); + if (zipCode.Length > 16) + throw new SwissQrCodeContactException(String.Format(res.Get("SwissLengthMore"), resForms.Get("ZipCode"), 17)); + if (!Regex.IsMatch(zipCode, charsetPattern)) + throw new SwissQrCodeContactException(String.Format(res.Get("SwissPatternError"), resForms.Get("ZipCode")) + charsetPattern); + this.zipCode = zipCode; + + if (string.IsNullOrEmpty(city)) + throw new SwissQrCodeContactException(String.Format(res.Get("SwissEmptyProperty"), resForms.Get("City"))); + if (city.Length > 35) + throw new SwissQrCodeContactException(String.Format(res.Get("SwissLengthMore"), resForms.Get("City"), 36)); + if (!Regex.IsMatch(city, charsetPattern)) + throw new SwissQrCodeContactException(String.Format(res.Get("SwissPatternError"), resForms.Get("City")) + charsetPattern); + this.city = city; + } + else + { + this.zipCode = this.city = string.Empty; + } + + if (!IsValidTwoLetterCode(country)) + throw new SwissQrCodeContactException(res.Get("SwissCountryTwoLetters")); + + this.country = country; + } + + private bool IsValidTwoLetterCode(string code) + { + return twoLetterCodes.Contains(code); + } + + private List ValidTwoLetterCodes() + { + string[] codes = new string[] { "AF", "AL", "DZ", "AS", "AD", "AO", "AI", "AQ", "AG", "AR", "AM", "AW", "AU", "AT", "AZ", "BS", "BH", "BD", "BB", "BY", "BE", "BZ", "BJ", "BM", "BT", "BO", "BQ", "BA", "BW", "BV", "BR", "IO", "BN", "BG", "BF", "BI", "CV", "KH", "CM", "CA", "KY", "CF", "TD", "CL", "CN", "CX", "CC", "CO", "KM", "CG", "CD", "CK", "CR", "CI", "HR", "CU", "CW", "CY", "CZ", "DK", "DJ", "DM", "DO", "EC", "EG", "SV", "GQ", "ER", "EE", "SZ", "ET", "FK", "FO", "FJ", "FI", "FR", "GF", "PF", "TF", "GA", "GM", "GE", "DE", "GH", "GI", "GR", "GL", "GD", "GP", "GU", "GT", "GG", "GN", "GW", "GY", "HT", "HM", "VA", "HN", "HK", "HU", "IS", "IN", "ID", "IR", "IQ", "IE", "IM", "IL", "IT", "JM", "JP", "JE", "JO", "KZ", "KE", "KI", "KP", "KR", "KW", "KG", "LA", "LV", "LB", "LS", "LR", "LY", "LI", "LT", "LU", "MO", "MG", "MW", "MY", "MV", "ML", "MT", "MH", "MQ", "MR", "MU", "YT", "MX", "FM", "MD", "MC", "MN", "ME", "MS", "MA", "MZ", "MM", "NA", "NR", "NP", "NL", "NC", "NZ", "NI", "NE", "NG", "NU", "NF", "MP", "MK", "NO", "OM", "PK", "PW", "PS", "PA", "PG", "PY", "PE", "PH", "PN", "PL", "PT", "PR", "QA", "RE", "RO", "RU", "RW", "BL", "SH", "KN", "LC", "MF", "PM", "VC", "WS", "SM", "ST", "SA", "SN", "RS", "SC", "SL", "SG", "SX", "SK", "SI", "SB", "SO", "ZA", "GS", "SS", "ES", "LK", "SD", "SR", "SJ", "SE", "CH", "SY", "TW", "TJ", "TZ", "TH", "TL", "TG", "TK", "TO", "TT", "TN", "TR", "TM", "TC", "TV", "UG", "UA", "AE", "GB", "US", "UM", "UY", "UZ", "VU", "VE", "VN", "VG", "VI", "WF", "EH", "YE", "ZM", "ZW", "AX" }; + List codesList = new List(); + + foreach(string str in codes) + { + codesList.Add(str); + } + return codesList; + } + + public Contact(string contact) + { + string[] data = contact.Split('\r'); + if (data[0].Trim() == "S") + this.adrType = AddressType.StructuredAddress; + else + this.adrType = AddressType.CombinedAddress; + name = data[1].Trim(); + streetOrAddressline1 = data[2].Trim(); + houseNumberOrAddressline2 = data[3].Trim(); + zipCode = data[4].Trim(); + city = data[5].Trim(); + country = data[6].Trim(); + } + + public override string ToString() + { + string contactData = ""; //AdrTp + if (AddressType.StructuredAddress == adrType) + contactData += "S"; + else + contactData += "K"; + contactData += br; + contactData += name.Replace("\n", "") + br; //Name + contactData += (!string.IsNullOrEmpty(streetOrAddressline1) ? streetOrAddressline1.Replace("\n", "") : string.Empty) + br; //StrtNmOrAdrLine1 + contactData += (!string.IsNullOrEmpty(houseNumberOrAddressline2) ? houseNumberOrAddressline2.Replace("\n", "") : string.Empty) + br; //BldgNbOrAdrLine2 + contactData += zipCode.Replace("\n", "") + br; //PstCd + contactData += city.Replace("\n", "") + br; //TwnNm + contactData += country + br; //Ctry + return contactData; + } + + public enum AddressType + { + StructuredAddress, + CombinedAddress + } + + public class SwissQrCodeContactException : SwissQrCodeException + { + public SwissQrCodeContactException() + { + } + + public SwissQrCodeContactException(string message) + : base(message) + { + } + + public SwissQrCodeContactException(string message, SwissQrCodeException inner) + : base(message, inner) + { + } + } + } + + public class Iban + { + private string iban; + private IbanType? ibanType; + + public IbanType? TypeIban { get { return ibanType; } set { ibanType = value; } } + public string _Iban { get { return iban; } set { iban = value; } } + + /// + /// IBAN object with type information + /// + /// IBAN + /// Type of IBAN (normal or QR-IBAN) + public Iban(string iban, IbanType ibanType) + { + MyRes res = new MyRes("Messages,Swiss"); + if (ibanType == IbanType.Iban && !IsValidIban(iban)) + throw new SwissQrCodeException(res.Get("SwissIbanNotValid")); + if (ibanType == IbanType.QrIban && !IsValidQRIban(iban)) + throw new SwissQrCodeException(res.Get("SwissQRIbanNotValid")); + if (!iban.StartsWith("CH") && !iban.StartsWith("LI")) + throw new SwissQrCodeException("SwissQRStartNotValid"); + this.iban = iban; + this.ibanType = ibanType; + } + + public bool IsQrIban + { + get { return ibanType == IbanType.QrIban; } + } + + public Iban(string iban) + { + this.iban = iban; + } + + public override string ToString() + { + return iban.Replace("-", "").Replace("\n", "").Replace(" ", ""); + } + + public enum IbanType + { + Iban, + QrIban + } + + private bool IsValidIban(string iban) + { + //Clean IBAN + string ibanCleared = iban.ToUpper().Replace(" ", "").Replace("-", ""); + + //Check for general structure + bool structurallyValid = Regex.IsMatch(ibanCleared, @"^[a-zA-Z]{2}[0-9]{2}([a-zA-Z0-9]?){16,30}$"); + + //Check IBAN checksum + char[] charSum = (ibanCleared.Substring(4) + ibanCleared.Substring(0, 4)).ToCharArray(); + string sum = ""; + + foreach (char c in charSum) + { + sum += (char.IsLetter(c) ? (c - 55).ToString() : c.ToString()); + } + decimal sumDec; + if (!decimal.TryParse(sum, out sumDec)) + return false; + bool checksumValid = (sumDec % 97) == 1; + + return structurallyValid && checksumValid; + } + + private bool IsValidQRIban(string iban) + { + bool foundQrIid = false; + try + { + string ibanCleared = iban.ToUpper().Replace(" ", "").Replace("-", ""); + int possibleQrIid = Convert.ToInt32(ibanCleared.Substring(4, 5)); + foundQrIid = possibleQrIid >= 30000 && possibleQrIid <= 31999; + } + catch { } + return IsValidIban(iban) && foundQrIid; + } + } + } } diff --git a/FastReport.Base/Base.cs b/FastReport.Base/Base.cs index 3d724922..7605b616 100644 --- a/FastReport.Base/Base.cs +++ b/FastReport.Base/Base.cs @@ -5,7 +5,11 @@ using System.Drawing; using System.ComponentModel; using FastReport.Utils; +#if NETSTANDARD || NETCOREAPP +using FastReport.Code.CodeDom.Compiler; +#else using System.CodeDom.Compiler; +#endif using System.Drawing.Design; namespace FastReport diff --git a/FastReport.Base/Code/AssemblyDescriptor.cs b/FastReport.Base/Code/AssemblyDescriptor.cs index 5930982b..b12a9c6a 100644 --- a/FastReport.Base/Code/AssemblyDescriptor.cs +++ b/FastReport.Base/Code/AssemblyDescriptor.cs @@ -1,5 +1,9 @@ using System; +#if NETSTANDARD || NETCOREAPP +using FastReport.Code.CodeDom.Compiler; +#else using System.CodeDom.Compiler; +#endif using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; @@ -8,6 +12,7 @@ using System.Reflection; using System.Security.Cryptography; using System.Text; +using System.Text.RegularExpressions; #if DOTNET_4 using System.Collections.Concurrent; #endif @@ -36,6 +41,8 @@ internal partial class AssemblyDescriptor private string shaKey = "FastReportCode"; private static object compileLocker; + private const int RECOMPILE_COUNT = 1; + public Assembly Assembly { get { return assembly; } @@ -178,15 +185,21 @@ private void AddFastReportAssemblies(StringCollection assemblies) private void AddReferencedAssemblies(StringCollection assemblies, string defaultPath) { + string location; foreach (string s in Report.ReferencedAssemblies) { //TODO thid core directive only for .net standard mode replace with checking the standard #if NETSTANDARD2_0 || NETSTANDARD2_1 if (s == "System.Windows.Forms.dll") + { + location = GetFullAssemblyReference("FastReport.Compat", defaultPath); + if (location != "" && !ContansAssembly(assemblies, location)) + assemblies.Add(location); continue; + } #endif - string location = GetFullAssemblyReference(s, defaultPath); + location = GetFullAssemblyReference(s, defaultPath); if (location != "" && !ContansAssembly(assemblies, location)) assemblies.Add(location); } @@ -366,7 +379,6 @@ public void Compile() } } -#if MONO private void InternalCompile() { // set the current folder @@ -384,19 +396,34 @@ private void InternalCompile() } // Commented by Samuray //Directory.SetCurrentDirectory(currentFolder); - + // configure compiler options CompilerParameters cp = new CompilerParameters(); AddFastReportAssemblies(cp.ReferencedAssemblies); +#if NETSTANDARD || NETCOREAPP + cp.ReferencedAssemblies.Add("System.Drawing.Primitives"); +#endif AddReferencedAssemblies(cp.ReferencedAssemblies, currentFolder); ReviewReferencedAssemblies(cp.ReferencedAssemblies); - cp.TreatWarningsAsErrors = true; cp.GenerateInMemory = true; // sometimes the system temp folder is not accessible... if (Config.TempFolder != null) cp.TempFiles = new TempFileCollection(Config.TempFolder, false); - // find assembly in cache + string errors = string.Empty; + CompilerResults cr; + bool exception = !InternalCompile(cp, out cr); + for (int i = 0; exception && i < RECOMPILE_COUNT ; i++) + { + exception = !HandleCompileErrors(cp, cr, out errors); + } + + if (exception) + throw new CompilerException(errors); + } + + private string GetAssemblyHash(CompilerParameters cp) + { StringBuilder assemblyHashSB = new StringBuilder(); foreach (string a in cp.ReferencedAssemblies) assemblyHashSB.Append(a); @@ -406,186 +433,120 @@ private void InternalCompile() { hash = hMACSHA1.ComputeHash(Encoding.Unicode.GetBytes(assemblyHashSB.ToString())); } - string assemblyHash = Convert.ToBase64String(hash); + + return Convert.ToBase64String(hash); + } + + /// + /// Returns true, if compilation is successful + /// + private bool InternalCompile(CompilerParameters cp, out CompilerResults cr) + { + + // find assembly in cache + string assemblyHash = GetAssemblyHash(cp); Assembly cachedAssembly = null; if (FAssemblyCache.TryGetValue(assemblyHash, out cachedAssembly)) { assembly = cachedAssembly; InitInstance(assembly.CreateInstance("FastReport.ReportScript")); - return; + cr = null; + return true; } - // compile report script + // compile report scripts using (CodeDomProvider provider = Report.CodeHelper.GetCodeProvider()) { - CompilerResults cr = provider.CompileAssemblyFromSource(cp, scriptText.ToString()); + ScriptSecurityEventArgs ssea = new ScriptSecurityEventArgs(Report, scriptText.ToString(), Report.ReferencedAssemblies); + Config.OnScriptCompile(ssea); + + cr = provider.CompileAssemblyFromSource(cp, scriptText.ToString()); assembly = null; instance = null; - int needException = cr.Errors.Count; // shows need to throw exception or errors can be handled without exception - if (cr.Errors.Count > 0) - { - string errors = ""; - foreach (CompilerError ce in cr.Errors) - { - int line = GetScriptLine(ce.Line); - if( ce.ErrorText.StartsWith("Warning as Error:")) - { - needException--; - } - // error is inside own items - if (line == -1) - { - string errObjName = GetErrorObjectName(ce.Line); - - // handle division by zero errors - if (ce.ErrorNumber == "CS0020") - { - TextObjectBase text = Report.FindObject(errObjName) as TextObjectBase; - text.CanGrow = true; - text.FillColor = Color.Red; - text.Text = "DIVISION BY ZERO!"; - if (cr.Errors.Count == 1) // there are only division by zero errors, exception does't needed - needException--; - } - else - { - errors += String.Format("({0}): " + Res.Get("Messages,Error") + " {1}: {2}", new object[] { errObjName, ce.ErrorNumber, ce.ErrorText }) + "\r\n"; - ErrorMsg(errObjName, ce); - } - } - else - { - errors += String.Format("({0},{1}): " + Res.Get("Messages,Error") + " {2}: {3}", new object[] { line, ce.Column, ce.ErrorNumber, ce.ErrorText }) + "\r\n"; - ErrorMsg(ce, line); - - } - } - if (needException != 0) // throw exception if errors were not handled - throw new CompilerException(errors); - } - else - { + + if (cr.Errors.Count != 0) // Compile errors + return false; + #if DOTNET_4 - FAssemblyCache.TryAdd(assemblyHash, cr.CompiledAssembly); + FAssemblyCache.TryAdd(assemblyHash, cr.CompiledAssembly); #else - FAssemblyCache.Add(assemblyHash, cr.CompiledAssembly); + FAssemblyCache.Add(assemblyHash, cr.CompiledAssembly); #endif - assembly = cr.CompiledAssembly; - InitInstance(assembly.CreateInstance("FastReport.ReportScript")); - } + assembly = cr.CompiledAssembly; + InitInstance(assembly.CreateInstance("FastReport.ReportScript")); + return true; } } -#else - private void InternalCompile() + + /// + /// Handle compile errors + /// + /// Returns <"true"> if all errors were handled + private bool HandleCompileErrors(CompilerParameters cp, CompilerResults cr, out string errors) { - // set the current folder - string currentFolder = Config.ApplicationFolder; - if (Config.WebMode) + errors = string.Empty; + List assemblyList = new List(4); + + foreach (CompilerError ce in cr.Errors) { - try - { - if (Directory.Exists(currentFolder + @"Bin\")) - currentFolder += @"Bin\"; - } - catch + if (ce.ErrorNumber == "CS0012") // missing reference on assembly { + // try to add reference + const string pattern = @"'(\S{1,}),"; + Regex regex = new Regex(pattern); + string assemblyName = regex.Match(ce.ErrorText).Groups[1].Value; // Groups[1] include string without ' and , symbols + if (!assemblyList.Contains(assemblyName)) + assemblyList.Add(assemblyName); + continue; } - } - // Commented by Samuray - //Directory.SetCurrentDirectory(currentFolder); - // configure compiler options - CompilerParameters cp = new CompilerParameters(); - AddFastReportAssemblies(cp.ReferencedAssemblies); -#if NETSTANDARD || NETCOREAPP - cp.ReferencedAssemblies.Add("System.Drawing.Primitives"); -#endif - AddReferencedAssemblies(cp.ReferencedAssemblies, currentFolder); - ReviewReferencedAssemblies(cp.ReferencedAssemblies); - cp.GenerateInMemory = true; - // sometimes the system temp folder is not accessible... - if (Config.TempFolder != null) - cp.TempFiles = new TempFileCollection(Config.TempFolder, false); + int line = GetScriptLine(ce.Line); + // error is inside own items + if (line == -1) + { + string errObjName = GetErrorObjectName(ce.Line); - // find assembly in cache - StringBuilder assemblyHashSB = new StringBuilder(); - foreach (string a in cp.ReferencedAssemblies) - assemblyHashSB.Append(a); - assemblyHashSB.Append(scriptText.ToString()); - byte[] hash = null; - using (HMACSHA1 hMACSHA1 = new HMACSHA1(Encoding.ASCII.GetBytes(shaKey))) - { - hash = hMACSHA1.ComputeHash(Encoding.Unicode.GetBytes(assemblyHashSB.ToString())); - } - string assemblyHash = Convert.ToBase64String(hash); - Assembly cachedAssembly = null; - if (FAssemblyCache.TryGetValue(assemblyHash, out cachedAssembly)) - { - assembly = cachedAssembly; - InitInstance(assembly.CreateInstance("FastReport.ReportScript")); - return; - } - - // compile report scripts - using (CodeDomProvider provider = Report.CodeHelper.GetCodeProvider()) - { - ScriptSecurityEventArgs ssea = new ScriptSecurityEventArgs(Report, scriptText.ToString(), Report.ReferencedAssemblies); - Config.OnScriptCompile(ssea); - - CompilerResults cr = provider.CompileAssemblyFromSource(cp, scriptText.ToString()); - assembly = null; - instance = null; - bool needException = true; // shows need to throw exception or errors can be handled without exception - if (cr.Errors.Count > 0) - { - string errors = ""; - foreach (CompilerError ce in cr.Errors) + // handle division by zero errors + if (ce.ErrorNumber == "CS0020") + { + TextObjectBase text = Report.FindObject(errObjName) as TextObjectBase; + text.CanGrow = true; + text.FillColor = Color.Red; + text.Text = "DIVISION BY ZERO!"; + if (cr.Errors.Count == 1) // there are only division by zero errors, exception does't needed + return true; + } + else { - int line = GetScriptLine(ce.Line); - // error is inside own items - if (line == -1) - { - string errObjName = GetErrorObjectName(ce.Line); - - // handle division by zero errors - if (ce.ErrorNumber == "CS0020") - { - TextObjectBase text = Report.FindObject(errObjName) as TextObjectBase; - text.CanGrow = true; - text.FillColor = Color.Red; - text.Text = "DIVISION BY ZERO!"; - if (cr.Errors.Count == 1) // there are only division by zero errors, exception does't needed - needException = false; - } - else - { - errors += String.Format("({0}): " + Res.Get("Messages,Error") + " {1}: {2}", new object[] { errObjName, ce.ErrorNumber, ce.ErrorText }) + "\r\n"; - ErrorMsg(errObjName, ce); - } - } - else - { - errors += String.Format("({0},{1}): " + Res.Get("Messages,Error") + " {2}: {3}", new object[] { line, ce.Column, ce.ErrorNumber, ce.ErrorText }) + "\r\n"; - ErrorMsg(ce, line); - - } + errors += String.Format("({0}): " + Res.Get("Messages,Error") + " {1}: {2}", new object[] { errObjName, ce.ErrorNumber, ce.ErrorText }) + "\r\n"; + ErrorMsg(errObjName, ce); } - if (needException) // throw exception if errors were not handled - throw new CompilerException(errors); } else { -#if DOTNET_4 - FAssemblyCache.TryAdd(assemblyHash, cr.CompiledAssembly); -#else - FAssemblyCache.Add(assemblyHash, cr.CompiledAssembly); -#endif - assembly = cr.CompiledAssembly; - InitInstance(assembly.CreateInstance("FastReport.ReportScript")); + errors += String.Format("({0},{1}): " + Res.Get("Messages,Error") + " {2}: {3}", new object[] { line, ce.Column, ce.ErrorNumber, ce.ErrorText }) + "\r\n"; + ErrorMsg(ce, line); } } + + if(assemblyList.Count > 0) // need recompile + return ReCompile(cp, cr, assemblyList); + + return false; + } + + /// + /// Returns true, if recompilation is successful + /// + private bool ReCompile(CompilerParameters cp, CompilerResults cr, List assemblyList) + { + // try to load missing assemblies + foreach (string assemblyName in assemblyList) + { + cp.ReferencedAssemblies.Add(assemblyName); + } + return InternalCompile(cp, out cr); } -#endif public void InitInstance(object instance) { diff --git a/FastReport.Base/Code/CodeHelper.cs b/FastReport.Base/Code/CodeHelper.cs index 3e1a8d35..d7900070 100644 --- a/FastReport.Base/Code/CodeHelper.cs +++ b/FastReport.Base/Code/CodeHelper.cs @@ -3,7 +3,11 @@ using System.Collections.Generic; using System.ComponentModel; using System.Reflection; +#if NETSTANDARD || NETCOREAPP +using FastReport.Code.CodeDom.Compiler; +#else using System.CodeDom.Compiler; +#endif using FastReport.Data; using FastReport.Engine; using FastReport.Utils; diff --git a/FastReport.Base/Code/CsCodeHelper.cs b/FastReport.Base/Code/CsCodeHelper.cs index 47d241c8..5391c1d3 100644 --- a/FastReport.Base/Code/CsCodeHelper.cs +++ b/FastReport.Base/Code/CsCodeHelper.cs @@ -3,8 +3,13 @@ using System.Collections.Generic; using System.ComponentModel; using System.Reflection; +#if NETSTANDARD || NETCOREAPP +using FastReport.Code.CodeDom.Compiler; +using FastReport.Code.CSharp; +#else using System.CodeDom.Compiler; using Microsoft.CSharp; +#endif using FastReport.Utils; using FastReport.Data; diff --git a/FastReport.Base/Code/VbCodeHelper.cs b/FastReport.Base/Code/VbCodeHelper.cs index 70735abb..2abea81e 100644 --- a/FastReport.Base/Code/VbCodeHelper.cs +++ b/FastReport.Base/Code/VbCodeHelper.cs @@ -3,7 +3,13 @@ using System.Collections.Generic; using System.ComponentModel; using System.Reflection; +#if NETSTANDARD || NETCOREAPP +using FastReport.Code.CodeDom.Compiler; +using FastReport.Code.VisualBasic; +#else +using System.CodeDom.Compiler; using Microsoft.VisualBasic; +#endif using FastReport.Utils; using FastReport.Data; @@ -299,7 +305,7 @@ public override string GetMethodSignatureAndBody(MethodInfo info) return result; } - public override System.CodeDom.Compiler.CodeDomProvider GetCodeProvider() + public override CodeDomProvider GetCodeProvider() { return new VBCodeProvider(); } diff --git a/FastReport.Base/ComponentBase.cs b/FastReport.Base/ComponentBase.cs index 1e04fa4c..8773f946 100644 --- a/FastReport.Base/ComponentBase.cs +++ b/FastReport.Base/ComponentBase.cs @@ -1,5 +1,6 @@ using FastReport.Utils; using System; +using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Drawing.Design; @@ -490,5 +491,32 @@ public override void Serialize(FRWriter writer) } #endregion Public Methods + + #region Report Engine + + /// + public override string[] GetExpressions() + { + List expressions = new List(); + + string[] baseExpressions = base.GetExpressions(); + if (baseExpressions != null) + { + expressions.AddRange(baseExpressions); + } + + if (!String.IsNullOrEmpty(VisibleExpression)) + { + expressions.Add(VisibleExpression); + } + if (!String.IsNullOrEmpty(PrintableExpression)) + { + expressions.Add(PrintableExpression); + } + + return expressions.ToArray(); + } + + #endregion Report Engine } } \ No newline at end of file diff --git a/FastReport.Base/Engine/ReportEngine.Bands.cs b/FastReport.Base/Engine/ReportEngine.Bands.cs index e859216b..8eaef07f 100644 --- a/FastReport.Base/Engine/ReportEngine.Bands.cs +++ b/FastReport.Base/Engine/ReportEngine.Bands.cs @@ -199,21 +199,6 @@ private void ProcessTotals(BandBase band) Report.Dictionary.Totals.ProcessBand(band); } - private bool CalcVisibleOrExportableExpression(bool currentValue, string expression) - { - string[] expressions = Code.CodeUtils.GetExpressions(expression, "[", "]"); - foreach (string str in expressions) - { - object calculatedExpression = Report.Calc(str); - if (calculatedExpression is bool) - { - return (bool)calculatedExpression; - } - } - - return currentValue; - } - #endregion Private Methods #region Internal Methods @@ -223,13 +208,31 @@ internal bool CanPrint(ReportComponentBase obj) // Apply visible expression if needed. if (!String.IsNullOrEmpty(obj.VisibleExpression)) { - obj.Visible = CalcVisibleOrExportableExpression(obj.Visible, obj.VisibleExpression); + object expression = Report.Calc(obj.VisibleExpression); + if (expression is bool) + { + obj.Visible = (bool)expression; + } } // Apply exportable expression if needed. if (!String.IsNullOrEmpty(obj.ExportableExpression)) { - obj.Exportable = CalcVisibleOrExportableExpression(obj.Exportable, obj.ExportableExpression); + object expression = Report.Calc(obj.ExportableExpression); + if (expression is bool) + { + obj.Exportable = (bool)expression; + } + } + + // Apply printable expression if needed. + if (!String.IsNullOrEmpty(obj.PrintableExpression)) + { + object expression = Report.Calc(obj.PrintableExpression); + if (expression is bool) + { + obj.Printable = (bool)expression; + } } if (!obj.Visible || !obj.FlagPreviewVisible) diff --git a/FastReport.Base/Matrix/MatrixCells.cs b/FastReport.Base/Matrix/MatrixCells.cs index f74ae30d..c88957b9 100644 --- a/FastReport.Base/Matrix/MatrixCells.cs +++ b/FastReport.Base/Matrix/MatrixCells.cs @@ -31,6 +31,11 @@ internal string Name set { name = value; } } + internal bool IsEmpty + { + get { return rows == null; } + } + /// /// Adds the specified descriptors to the end of this collection. /// diff --git a/FastReport.Base/Matrix/MatrixData.cs b/FastReport.Base/Matrix/MatrixData.cs index 8944e573..e1fe52dc 100644 --- a/FastReport.Base/Matrix/MatrixData.cs +++ b/FastReport.Base/Matrix/MatrixData.cs @@ -60,6 +60,11 @@ public MatrixCells Cells { get { return cells; } } + + internal bool IsEmpty + { + get { return Cells.IsEmpty; } + } #endregion #region Public Methods diff --git a/FastReport.Base/Matrix/MatrixHelper.cs b/FastReport.Base/Matrix/MatrixHelper.cs index 4ee7b9f8..9cf9f6c8 100644 --- a/FastReport.Base/Matrix/MatrixHelper.cs +++ b/FastReport.Base/Matrix/MatrixHelper.cs @@ -1137,6 +1137,15 @@ public void AddDataRow() Matrix.Data.AddValue(columnValues, rowValues, cellValues, Matrix.DataSource.CurrentRowNo); } + public void AddEmptyDataRow() + { + object[] columnValues = new object[Matrix.Data.Columns.Count]; + object[] rowValues = new object[Matrix.Data.Rows.Count]; + object[] cellValues = new object[Matrix.Data.Cells.Count]; + + Matrix.Data.AddValue(columnValues, rowValues, cellValues, 0); + } + public void AddDataRows() { if (Matrix.DataSource != null) @@ -1152,13 +1161,20 @@ public void AddDataRows() public void FinishPrint() { - UpdateDescriptors(); - ResultTable.FixedColumns = HeaderWidth; - ResultTable.FixedRows = HeaderHeight; + if (!Matrix.Data.IsEmpty || Matrix.PrintIfEmpty) + { + if (Matrix.Data.IsEmpty) + AddEmptyDataRow(); - InitResultTable(false); - PrintHeaders(); - PrintData(); + UpdateDescriptors(); + ResultTable.FixedColumns = HeaderWidth; + ResultTable.FixedRows = HeaderHeight; + + InitResultTable(false); + PrintHeaders(); + PrintData(); + + } // clear temporary descriptors if (noColumns) diff --git a/FastReport.Base/Matrix/MatrixObject.cs b/FastReport.Base/Matrix/MatrixObject.cs index 66dac36a..4d7e61da 100644 --- a/FastReport.Base/Matrix/MatrixObject.cs +++ b/FastReport.Base/Matrix/MatrixObject.cs @@ -114,6 +114,7 @@ public partial class MatrixObject : TableBase private int rowIndex; private MatrixEvenStylePriority matrixEvenStylePriority; private bool splitRows; + private bool printIfEmpty; #endregion #region Properties @@ -323,6 +324,17 @@ public bool SplitRows set { splitRows = value; } } + /// + /// Gets or sets a value indicating that empty matrix should be printed. + /// + [Category("Behavior")] + [DefaultValue(true)] + public bool PrintIfEmpty + { + get { return printIfEmpty; } + set { printIfEmpty = value; } + } + /// /// Gets or sets a script method name that will be used to handle the /// event. @@ -636,6 +648,7 @@ public override void Assign(Base source) Style = src.Style; MatrixEvenStylePriority = src.MatrixEvenStylePriority; SplitRows = src.SplitRows; + PrintIfEmpty = src.PrintIfEmpty; } /// @@ -670,7 +683,9 @@ public override void Serialize(FRWriter writer) if (MatrixEvenStylePriority != c.MatrixEvenStylePriority) writer.WriteValue("MatrixEvenStylePriority", MatrixEvenStylePriority); if (SplitRows != c.SplitRows) - writer.WriteValue("SplitRows", SplitRows); + writer.WriteBool("SplitRows", SplitRows); + if (PrintIfEmpty != c.PrintIfEmpty) + writer.WriteBool("PrintIfEmpty", PrintIfEmpty); if (ManualBuildEvent != c.ManualBuildEvent) writer.WriteStr("ManualBuildEvent", ManualBuildEvent); if (ModifyResultEvent != c.ModifyResultEvent) @@ -872,6 +887,7 @@ public MatrixObject() style = ""; filter = ""; splitRows = false; + printIfEmpty = true; } } } \ No newline at end of file diff --git a/FastReport.Base/Preview/PreparedPages.cs b/FastReport.Base/Preview/PreparedPages.cs index 7d37233b..4e47e2f2 100644 --- a/FastReport.Base/Preview/PreparedPages.cs +++ b/FastReport.Base/Preview/PreparedPages.cs @@ -348,6 +348,26 @@ public void RemovePage(int index) { preparedPages[index].Dispose(); preparedPages.RemoveAt(index); + pageCache.Clear(); + } + + + /// + /// Creates a copy of a page with specified index and inserts it after original one. + /// + /// The zero-based index of original page. + public void CopyPage(int index) + { + // insert a new empty page at specified index + PreparedPage newPage = new PreparedPage(null, this); + if (index == preparedPages.Count - 1) + preparedPages.Add(newPage); + else + preparedPages.Insert(index + 1, newPage); + + // and copy source page into it + ModifyPage(index + 1, GetPage(index)); + pageCache.Clear(); } internal void InterleaveWithBackPage(int backPageIndex) diff --git a/FastReport.Base/Preview/SourcePages.cs b/FastReport.Base/Preview/SourcePages.cs index 6d60ddc3..569cd8e5 100644 --- a/FastReport.Base/Preview/SourcePages.cs +++ b/FastReport.Base/Preview/SourcePages.cs @@ -34,11 +34,7 @@ private Base CloneObjects(Base source, Base parent) string baseName = ""; string objName; #if MONO - if (source is RichObject -#if !FRCORE - && (source as RichObject).ConvertRichText == true -#endif - ) + if (source is RichObject && (source as RichObject).ConvertRichText == true) { RichObject rich = source as RichObject; float h; diff --git a/FastReport.Base/Report.cs b/FastReport.Base/Report.cs index fe2d1394..3002b03e 100644 --- a/FastReport.Base/Report.cs +++ b/FastReport.Base/Report.cs @@ -1280,6 +1280,8 @@ public object Calc(string expression, Variant value) { if (!IsRunning) return null; + if (String.IsNullOrEmpty(expression) || String.IsNullOrEmpty(expression.Trim())) + return null; string expr = expression; if (expr.StartsWith("[") && expr.EndsWith("]")) diff --git a/FastReport.Base/ReportComponentBase.cs b/FastReport.Base/ReportComponentBase.cs index 1e0f8f89..e8752188 100644 --- a/FastReport.Base/ReportComponentBase.cs +++ b/FastReport.Base/ReportComponentBase.cs @@ -134,7 +134,6 @@ public abstract partial class ReportComponentBase : ComponentBase private string mouseDownEvent; private string mouseEnterEvent; private string mouseLeaveEvent; - private bool backlight; #endregion #region Properties @@ -158,16 +157,6 @@ public abstract partial class ReportComponentBase : ComponentBase /// public event EventHandler Click; - /// - /// This property specifies whether the object will be highlighted on the form. - /// - [Browsable(false)] - public bool Backlight - { - get { return backlight; } - set { backlight = value; } - } - /// /// Gets or sets a value that determines if the object can be exported. /// @@ -985,6 +974,8 @@ public override string[] GetExpressions() expressions.Add(Hyperlink.Expression); if (!String.IsNullOrEmpty(Bookmark)) expressions.Add(Bookmark); + if (!String.IsNullOrEmpty(ExportableExpression)) + expressions.Add(ExportableExpression); return expressions.ToArray(); } @@ -1057,7 +1048,6 @@ public ReportComponentBase() mouseDownEvent = ""; mouseEnterEvent = ""; mouseLeaveEvent = ""; - backlight = false; SetFlags(Flags.CanGroup, true); if (BaseName.EndsWith("Object")) BaseName = ClassName.Substring(0, ClassName.Length - 6); diff --git a/FastReport.Base/ReportPage.cs b/FastReport.Base/ReportPage.cs index c83b1cbb..3bd8736c 100644 --- a/FastReport.Base/ReportPage.cs +++ b/FastReport.Base/ReportPage.cs @@ -975,19 +975,6 @@ public override void Draw(FRPaintEventArgs e) } else { - // Apply printable expression if needed. - if (!String.IsNullOrEmpty(obj.PrintableExpression)) - { - string[] expressions = Code.CodeUtils.GetExpressions(obj.PrintableExpression, "[", "]"); - foreach (string str in expressions) - { - object expression = Report.Calc(str); - if (expression is bool) - { - obj.Printable = (bool)expression; - } - } - } if (!obj.Printable) continue; else if (obj.Parent is BandBase && !(obj.Parent as BandBase).Printable) diff --git a/FastReport.Base/Table/TableBase.cs b/FastReport.Base/Table/TableBase.cs index 8416a903..ac76b0f5 100644 --- a/FastReport.Base/Table/TableBase.cs +++ b/FastReport.Base/Table/TableBase.cs @@ -973,53 +973,52 @@ public override float CalcHeight() return height; } - private bool BreakRow(int rowIndex, float height) + private bool CanBreakRow(int rowIndex, float rowHeight) { - float freeSpace = Height - height; - //if (freeSpace - Rows[rowIndex].Height < 0) - //{ - // Сreating a new row with all the properties of the previous one - TableRow newRow = new TableRow(); - newRow.Parent = this; - newRow.SetReport(Report); - newRow.AssignAll(Rows[rowIndex]); - for (int j = 0; j < newRow.ChildObjects.Count; j++) + if (!Rows[rowIndex].CanBreak) + return false; + + // check each cell in the row + for (int i = 0; i < ColumnCount; i++) + { + TableCell breakable = this[i, rowIndex]; + // use clone object because Break method will modify the Text property + using (TableCell clone = new TableCell()) { - newRow[j].Border = (Rows[rowIndex].ChildObjects[j] as TableCell).Border; - (newRow[j] as TableCell).TextRenderType = (Rows[rowIndex].ChildObjects[j] as TableCell).TextRenderType; - (newRow[j] as TableCell).ParagraphFormat = (Rows[rowIndex].ChildObjects[j] as TableCell).ParagraphFormat; + clone.AssignAll(breakable); + clone.Height = rowHeight; + clone.SetReport(Report); + if (!clone.Break(null)) + return false; } + } - int cellIndex = 0; + return true; + } - // Breaking a row that doesn't fit on the page - Rows[rowIndex].Height = freeSpace; - foreach (TableCell cell in Rows[rowIndex].ChildObjects) - { - cell.Break(newRow.ChildObjects[cellIndex] as TableCell); - cellIndex++; - } - newRow.Height -= freeSpace; - Rows[rowIndex].Height = freeSpace - 1; + private void BreakRow(TableBase breakTo, int rowIndex, float rowHeight, float newRowHeight) + { + // set rows height + TableRow rowTo = breakTo.Rows[rowIndex]; + Rows[rowIndex].Height = rowHeight; + rowTo.Height = newRowHeight; - // Restoring the correct index order - List copyRows = new List(); - for (int j = rowIndex + 1; j < Rows.Count - 1; j++) - { - copyRows.Add(Rows[j]); - this.RemoveChild(Rows[j]); - } - foreach (TableRow row in copyRows) - { - row.Parent = this; - } - for (int j = 0; j < Rows.Count; j++) + // break each cell in the row + for (int i = 0; i < ColumnCount; i++) + { + TableCell cell = this[i, rowIndex]; + TableCell cellTo = breakTo[i, rowIndex]; + cell.Height = rowHeight; + cell.Break(cellTo); + + // fix height if row is not autosized + if (!rowTo.AutoSize) { - Rows[j].SetIndex(j); + float h = cellTo.CalcHeight(); + if (h > rowTo.Height) + rowTo.Height = h; } - return true; - // } - //return false; + } } /// @@ -1027,68 +1026,68 @@ public override bool Break(BreakableComponent breakTo) { if (Rows.Count == 0) return true; - if (Rows[0].CanBreak && breakTo == null) - return true; if (Height < Rows[0].Height && !Rows[0].CanBreak) return false; TableBase tableTo = breakTo as TableBase; if (tableTo == null) return true; - float height = 0; - for (int i = 0; i < Rows.Count; i++) - { - if (Rows[i].Bottom > Height) - if (Rows[i].CanBreak) - { - BreakRow(i, height); - tableTo.Clear(); - tableTo.AssignAll(this); - - break; - } - height += Rows[i].Height; - } - - // get the span list - List spans = GetSpanList(); - // find the break row index int breakRowIndex = 0; + int breakRowIndexAdd = 0; + bool rowBroken = false; float rowsHeight = 0; - while (breakRowIndex < Rows.Count && rowsHeight + Rows[breakRowIndex].Height < Height) + + while (breakRowIndex < Rows.Count) { rowsHeight += Rows[breakRowIndex].Height; + if (rowsHeight > Height) + { + float breakRowHeight = Rows[breakRowIndex].Height - (rowsHeight - Height); + if (CanBreakRow(breakRowIndex, breakRowHeight)) + { + BreakRow(tableTo, breakRowIndex, breakRowHeight, rowsHeight - Height); + breakRowIndexAdd = 1; + rowBroken = true; + } + break; + } + breakRowIndex++; } + // get the span list + List spans = GetSpanList(); + // break the spans foreach (Rectangle span in spans) { - if (span.Top < breakRowIndex && span.Bottom > breakRowIndex) + if (span.Top < breakRowIndex + breakRowIndexAdd && span.Bottom > breakRowIndex) { TableCell cell = this[span.Left, span.Top]; TableCell cellTo = tableTo[span.Left, span.Top]; // update cell spans - cell.RowSpan = breakRowIndex - span.Top; + cell.RowSpan = breakRowIndex + breakRowIndexAdd - span.Top; cellTo.RowSpan = span.Bottom - breakRowIndex; // break the cell - if (!cell.Break(cellTo)) + if (!rowBroken && !cell.Break(cellTo)) cell.Text = ""; + + // set the top span cell to the correct place tableTo[span.Left, span.Top] = new TableCell(); tableTo[span.Left, breakRowIndex] = cellTo; } } - // delete last rows until all rows fit - while (breakRowIndex < Rows.Count) + // remove unused rows from source (this table) + while (breakRowIndex + breakRowIndexAdd < Rows.Count) { - Rows.RemoveAt(Rows.Count - 1); + this.Rows.RemoveAt(Rows.Count - 1); } - // delete first rows of the breakTo + // remove unused rows from copy (tableTo) for (int i = 0; i < breakRowIndex; i++) { tableTo.Rows.RemoveAt(0); diff --git a/FastReport.Base/Table/TableResult.cs b/FastReport.Base/Table/TableResult.cs index 0f5cf332..3c6718ff 100644 --- a/FastReport.Base/Table/TableResult.cs +++ b/FastReport.Base/Table/TableResult.cs @@ -8,718 +8,713 @@ namespace FastReport.Table { - /// - /// Represents a result table. - /// - /// - /// Do not use this class directly. It is used by the and - /// objects to render a result. - /// - public class TableResult : TableBase - { - private bool skip; - private List rowsToSerialize; - private List columnsToSerialize; - private bool isFirstRow; - /// - /// Occurs after calculation of table bounds. + /// Represents a result table. /// /// - /// You may use this event to change automatically calculated rows/column sizes. It may be useful - /// if you need to fit dynamically printed table on a page. + /// Do not use this class directly. It is used by the and + /// objects to render a result. /// - public event EventHandler AfterCalcBounds; - - internal bool Skip + public class TableResult : TableBase { - get { return skip; } - set { skip = value; } - } - - internal List RowsToSerialize - { - get { return rowsToSerialize; } - } - - internal List ColumnsToSerialize - { - get { return columnsToSerialize; } - } - - private float GetRowsHeight(int startRow, int count) - { - float height = 0; - - // include row header - if (startRow != 0 && (RepeatHeaders || RepeatColumnHeaders)) - { - for (int i = 0; i < FixedRows; i++) + private bool skip; + private List rowsToSerialize; + private List columnsToSerialize; + private bool isFirstRow; + + /// + /// Occurs after calculation of table bounds. + /// + /// + /// You may use this event to change automatically calculated rows/column sizes. It may be useful + /// if you need to fit dynamically printed table on a page. + /// + public event EventHandler AfterCalcBounds; + + internal bool Skip { - height += Rows[i].Height; + get { return skip; } + set { skip = value; } } - } - - for (int i = 0; i < count; i++) - { - height += Rows[startRow + i].Height; - } - - return height; - } - private float GetColumnsWidth(int startColumn, int count) - { - float width = 0; + internal List RowsToSerialize + { + get { return rowsToSerialize; } + } - // include column header - if (startColumn != 0 && (RepeatHeaders || RepeatRowHeaders)) - { - for (int i = 0; i < FixedColumns; i++) + internal List ColumnsToSerialize { - width += Columns[i].Width; + get { return columnsToSerialize; } } - } - for (int i = 0; i < count; i++) - { - if (i == count - 1) - width += Math.Max(Columns[startColumn + i].Width, Columns[startColumn + i].MinimumBreakWidth); - else - width += Columns[startColumn + i].Width; - } + private float GetRowsHeight(int startRow, int count) + { + float height = 0; - return width; - } + // include row header + if (startRow != 0 && (RepeatHeaders || RepeatColumnHeaders)) + { + for (int i = 0; i < FixedRows; i++) + { + height += Rows[i].Height; + } + } - private int GetRowsFit(int startRow, float freeSpace) - { - int rowsFit = 0; - int rowsToKeep = 0; - int rowsKept = 0; - int saveRowsFit = 0; - bool keeping = false; - - while (startRow + rowsFit < Rows.Count && - (rowsFit == 0 || !Rows[startRow + rowsFit].PageBreak) && - (!this.CanBreak | GetRowsHeight(startRow, rowsFit + 1) <= freeSpace + 0.1f)) - { - if (keeping) - { - rowsKept++; - if (rowsKept >= rowsToKeep) - keeping = false; + for (int i = 0; i < count; i++) + { + height += Rows[startRow + i].Height; + } + + return height; } - else if (Rows[startRow + rowsFit].KeepRows > 1) + + private float GetColumnsWidth(int startColumn, int count) { - rowsToKeep = Rows[startRow + rowsFit].KeepRows; - rowsKept = 1; - saveRowsFit = rowsFit; - keeping = true; - } - rowsFit++; - } + float width = 0; - if (keeping) - rowsFit = saveRowsFit; - // case if the row header does not fit on a page (at the start of table) - if (startRow == 0 && rowsFit < FixedRows) - rowsFit = 0; + // include column header + if (startColumn != 0 && (RepeatHeaders || RepeatRowHeaders)) + { + for (int i = 0; i < FixedColumns; i++) + { + width += Columns[i].Width; + } + } - return rowsFit; - } + for (int i = 0; i < count; i++) + { + if (i == count - 1) + width += Math.Max(Columns[startColumn + i].Width, Columns[startColumn + i].MinimumBreakWidth); + else + width += Columns[startColumn + i].Width; + } - private int GetColumnsFit(int startColumn, float freeSpace) - { - int columnsFit = 0; - int columnsToKeep = 0; - int columnsKept = 0; - int saveColumnsFit = 0; - bool keeping = false; - - while (startColumn + columnsFit < Columns.Count && - (columnsFit == 0 || !Columns[startColumn + columnsFit].PageBreak) && - GetColumnsWidth(startColumn, columnsFit + 1) <= freeSpace + 0.1f) - { - if (keeping) - { - columnsKept++; - if (columnsKept >= columnsToKeep) - keeping = false; + return width; } - else if (Columns[startColumn + columnsFit].KeepColumns > 1) + + private int GetRowsFit(int startRow, float freeSpace) { - columnsToKeep = Columns[startColumn + columnsFit].KeepColumns; - columnsKept = 1; - saveColumnsFit = columnsFit; - keeping = true; - } - columnsFit++; - } + int rowsFit = 0; + int rowsToKeep = 0; + int rowsKept = 0; + int saveRowsFit = 0; + bool keeping = false; + + while (startRow + rowsFit < Rows.Count && + (rowsFit == 0 || !Rows[startRow + rowsFit].PageBreak) && + (!this.CanBreak | GetRowsHeight(startRow, rowsFit + 1) <= freeSpace + 0.1f)) + { + if (keeping) + { + rowsKept++; + if (rowsKept >= rowsToKeep) + keeping = false; + } + else if (Rows[startRow + rowsFit].KeepRows > 1) + { + rowsToKeep = Rows[startRow + rowsFit].KeepRows; + rowsKept = 1; + saveRowsFit = rowsFit; + keeping = true; + } + rowsFit++; + } - if (keeping) - columnsFit = saveColumnsFit; - return columnsFit; - } + if (keeping) + rowsFit = saveRowsFit; + // case if the row header does not fit on a page (at the start of table) + if (startRow == 0 && rowsFit < FixedRows) + rowsFit = 0; - internal void GeneratePages(object sender, EventArgs e) - { - isFirstRow = false; - if (Skip) - { - Skip = false; - return; - } - - - // check if band contains several tables - if (sender is BandBase) - { - BandBase senderBand = sender as BandBase; - isFirstRow = senderBand.IsFirstRow; - SortedList tables = new SortedList(); - foreach (Base obj in senderBand.Objects) + return rowsFit; + } + + private int GetColumnsFit(int startColumn, float freeSpace) { - TableBase table = obj as TableBase; - if (table != null && table.ResultTable != null) - try - { - tables.Add(table.Left, table); - } - catch (ArgumentException) - { - throw new ArgumentException(Res.Get("Messages,MatrixLayoutError")); - } + int columnsFit = 0; + int columnsToKeep = 0; + int columnsKept = 0; + int saveColumnsFit = 0; + bool keeping = false; + + while (startColumn + columnsFit < Columns.Count && + (columnsFit == 0 || !Columns[startColumn + columnsFit].PageBreak) && + GetColumnsWidth(startColumn, columnsFit + 1) <= freeSpace + 0.1f) + { + if (keeping) + { + columnsKept++; + if (columnsKept >= columnsToKeep) + keeping = false; + } + else if (Columns[startColumn + columnsFit].KeepColumns > 1) + { + columnsToKeep = Columns[startColumn + columnsFit].KeepColumns; + columnsKept = 1; + saveColumnsFit = columnsFit; + keeping = true; + } + columnsFit++; + } + + if (keeping) + columnsFit = saveColumnsFit; + return columnsFit; } - // render tables side-by-side - if (tables.Count > 1) + internal void GeneratePages(object sender, EventArgs e) { - ReportEngine engine = Report.Engine; - TableLayoutInfo info = new TableLayoutInfo(); - info.startPage = engine.CurPage; - info.tableSize = new Size(1, 1); - info.startX = tables.Values[0].Left; - - int firstTableHeight = 0; - int startPage = info.startPage; - float firstTableCurY = 0; - float saveCurY = engine.CurY; - - for (int i = 0; i < tables.Count; i++) - { - TableBase table = tables.Values[i]; - - // do not allow table to render itself in the band.AfterPrint event - table.ResultTable.Skip = true; - // render using the down-then-across mode - table.Layout = TableLayout.DownThenAcross; - - engine.CurPage = info.startPage + (info.tableSize.Width - 1) * info.tableSize.Height; - engine.CurY = saveCurY; - float addLeft = 0; - if (i > 0) - addLeft = table.Left - tables.Values[i - 1].Right; - table.ResultTable.Left = info.startX + addLeft; - + isFirstRow = false; + if (Skip) + { + Skip = false; + return; + } + + + // check if band contains several tables + if (sender is BandBase) + { + BandBase senderBand = sender as BandBase; + isFirstRow = senderBand.IsFirstRow; + SortedList tables = new SortedList(); + foreach (Base obj in senderBand.Objects) + { + TableBase table = obj as TableBase; + if (table != null && table.ResultTable != null) + try + { + tables.Add(table.Left, table); + } + catch (ArgumentException) + { + throw new ArgumentException(Res.Get("Messages,MatrixLayoutError")); + } + } + + // render tables side-by-side + if (tables.Count > 1) + { + ReportEngine engine = Report.Engine; + TableLayoutInfo info = new TableLayoutInfo(); + info.startPage = engine.CurPage; + info.tableSize = new Size(1, 1); + info.startX = tables.Values[0].Left; + + int startPage = info.startPage; + float saveCurY = engine.CurY; + int maxPage = 0; + float maxCurY = 0; + + for (int i = 0; i < tables.Count; i++) + { + TableBase table = tables.Values[i]; + + // do not allow table to render itself in the band.AfterPrint event + table.ResultTable.Skip = true; + // render using the down-then-across mode + table.Layout = TableLayout.DownThenAcross; + + engine.CurPage = info.startPage + (info.tableSize.Width - 1) * info.tableSize.Height; + engine.CurY = saveCurY; + float addLeft = 0; + if (i > 0) + addLeft = table.Left - tables.Values[i - 1].Right; + table.ResultTable.Left = info.startX + addLeft; + + // calculate cells' bounds + table.ResultTable.CalcBounds(); + // generate pages + Report.PreparedPages.AddPageAction = AddPageAction.WriteOver; + info = table.ResultTable.GeneratePagesDownThenAcross(); + + if (engine.CurPage > maxPage) + { + maxPage = engine.CurPage; + maxCurY = engine.CurY; + } + else if (engine.CurPage == maxPage && engine.CurY > maxCurY) + { + maxCurY = engine.CurY; + } + } + + engine.CurPage = maxPage; + engine.CurY = maxCurY; + + Skip = false; + return; + } + } + // calculate cells' bounds - table.ResultTable.CalcBounds(); - // generate pages - Report.PreparedPages.AddPageAction = AddPageAction.WriteOver; - info = table.ResultTable.GeneratePagesDownThenAcross(); - - if (i == 0) + CalcBounds(); + + if (Report.Engine.UnlimitedHeight || Report.Engine.UnlimitedWidth) { - firstTableHeight = info.tableSize.Height; - firstTableCurY = engine.CurY; - } - } - - engine.CurPage = startPage + firstTableHeight - 1; - engine.CurY = firstTableCurY; - - Skip = false; - return; + if (!Report.Engine.UnlimitedWidth) + GeneratePagesWrapped(); + else if (!Report.Engine.UnlimitedHeight) + GeneratePagesDownThenAcross(); + else + GeneratePagesAcrossThenDown(); + } + else if (Layout == TableLayout.AcrossThenDown) + GeneratePagesAcrossThenDown(); + else if (Layout == TableLayout.DownThenAcross) + GeneratePagesDownThenAcross(); + else + GeneratePagesWrapped(); } - } - - // calculate cells' bounds - CalcBounds(); - - if (Report.Engine.UnlimitedHeight || Report.Engine.UnlimitedWidth) - { - if (!Report.Engine.UnlimitedWidth) - GeneratePagesWrapped(); - else if (!Report.Engine.UnlimitedHeight) - GeneratePagesDownThenAcross(); - else - GeneratePagesAcrossThenDown(); - } - else if (Layout == TableLayout.AcrossThenDown) - GeneratePagesAcrossThenDown(); - else if (Layout == TableLayout.DownThenAcross) - GeneratePagesDownThenAcross(); - else - GeneratePagesWrapped(); - } - internal void CalcBounds() - { - // allow row/column manipulation from a script - LockCorrectSpans = false; + internal void CalcBounds() + { + // allow row/column manipulation from a script + LockCorrectSpans = false; - // fire AfterData event - OnAfterData(); - - // calculate cells' bounds - Height = CalcHeight(); + // fire AfterData event + OnAfterData(); - // fire AfterCalcBounds event - OnAfterCalcBounds(); - } + // calculate cells' bounds + Height = CalcHeight(); - private void OnAfterCalcBounds() - { - if (AfterCalcBounds != null) - AfterCalcBounds(this, EventArgs.Empty); - } + // fire AfterCalcBounds event + OnAfterCalcBounds(); + } - private void GeneratePagesAcrossThenDown() - { - ReportEngine engine = Report.Engine; - PreparedPages preparedPages = Report.PreparedPages; - preparedPages.CanUploadToCache = false; - preparedPages.AddPageAction = AddPageAction.WriteOver; - - List spans = GetSpanList(); - int startRow = 0; - bool addNewPage = false; - float freeSpace = engine.FreeSpace; - Top = 0; - - while (startRow < Rows.Count) - { - if (addNewPage) + private void OnAfterCalcBounds() { - engine.StartNewPage(); - freeSpace = engine.FreeSpace; + if (AfterCalcBounds != null) + AfterCalcBounds(this, EventArgs.Empty); } - int startColumn = 0; - int rowsFit = GetRowsFit(startRow, freeSpace); - if(startRow == 0 && engine.IsKeeping && rowsFit < RowCount && isFirstRow && engine.KeepCurY > 0) + private void GeneratePagesAcrossThenDown() + { + ReportEngine engine = Report.Engine; + PreparedPages preparedPages = Report.PreparedPages; + preparedPages.CanUploadToCache = false; + preparedPages.AddPageAction = AddPageAction.WriteOver; + + List spans = GetSpanList(); + int startRow = 0; + bool addNewPage = false; + float freeSpace = engine.FreeSpace; + Top = 0; + + while (startRow < Rows.Count) + { + if (addNewPage) + { + engine.StartNewPage(); + freeSpace = engine.FreeSpace; + } + + int startColumn = 0; + int rowsFit = GetRowsFit(startRow, freeSpace); + if (startRow == 0 && engine.IsKeeping && rowsFit < RowCount && isFirstRow && engine.KeepCurY > 0) { engine.EndColumn(); freeSpace = engine.FreeSpace; rowsFit = GetRowsFit(startRow, freeSpace); } - // avoid the infinite loop if there is not enough space for one row - if (startRow >= 0 && rowsFit == 0) - rowsFit = 1; + // avoid the infinite loop if there is not enough space for one row + if (startRow > 0 && rowsFit == 0) + rowsFit = 1; - int saveCurPage = engine.CurPage; - float saveLeft = Left; - float saveCurY = engine.CurY; - float curY = engine.CurY; + int saveCurPage = engine.CurPage; + float saveLeft = Left; + float saveCurY = engine.CurY; + float curY = engine.CurY; - if (rowsFit != 0) + if (rowsFit != 0) + { + while (startColumn < Columns.Count) + { + int columnsFit = GetColumnsFit(startColumn, engine.PageWidth - Left); + // avoid the infinite loop if there is not enough space for one column + if (startColumn > 0 && columnsFit == 0) + columnsFit = 1; + + engine.CurY = saveCurY; + curY = GeneratePage(startColumn, startRow, columnsFit, rowsFit, + new RectangleF(0, 0, engine.PageWidth, CanBreak ? freeSpace : Height), spans) + saveCurY; + + Left = 0; + startColumn += columnsFit; + if (startColumn < Columns.Count) + { + // if we have something to print, start a new page + engine.StartNewPage(); + } + else if (engine.CurPage > saveCurPage) + { + // finish the last printed page in case it is not the start page + engine.EndPage(false); + } + + if (Report.Aborted) + break; + } + } + + startRow += rowsFit; + Left = saveLeft; + engine.CurPage = saveCurPage; + engine.CurY = curY; + preparedPages.AddPageAction = AddPageAction.Add; + addNewPage = true; + + if (Report.Aborted) + break; + } + } + + private TableLayoutInfo GeneratePagesDownThenAcross() { - while (startColumn < Columns.Count) - { - int columnsFit = GetColumnsFit(startColumn, engine.PageWidth - Left); - // avoid the infinite loop if there is not enough space for one column - if (startColumn > 0 && columnsFit == 0) - columnsFit = 1; - - engine.CurY = saveCurY; - curY = (float)Math.Round(GeneratePage(startColumn, startRow, columnsFit, rowsFit, - new RectangleF(0, 0, engine.PageWidth, CanBreak ? freeSpace : Height), spans), 2); - if (engine.CurY > saveCurY) - curY += saveCurY; - else if (engine.CurY != curY) - curY += engine.CurY; - - Left = 0; - startColumn += columnsFit; - if (startColumn < Columns.Count) - { - // if we have something to print, start a new page - engine.StartNewPage(); - } - else if (engine.CurPage > saveCurPage) + ReportEngine engine = Report.Engine; + PreparedPages preparedPages = Report.PreparedPages; + preparedPages.CanUploadToCache = false; + + TableLayoutInfo info = new TableLayoutInfo(); + info.startPage = engine.CurPage; + List spans = GetSpanList(); + int startColumn = 0; + bool addNewPage = false; + float saveCurY = engine.CurY; + float lastCurY = 0; + int lastPage = 0; + Top = 0; + + while (startColumn < Columns.Count) { - // finish the last printed page in case it is not the start page - engine.EndPage(false); - } + if (addNewPage) + engine.StartNewPage(); - if (Report.Aborted) - break; - } - } + int startRow = 0; + int columnsFit = GetColumnsFit(startColumn, engine.PageWidth - Left); + // avoid the infinite loop if there is not enough space for one column + if (startColumn > 0 && columnsFit == 0) + columnsFit = 1; + + engine.CurY = saveCurY; + info.tableSize.Width++; + info.tableSize.Height = 0; - startRow += rowsFit; - Left = saveLeft; - if (engine.CurY >= (float)Math.Round(curY,2)) + if (columnsFit > 0) { - engine.CurY = curY; - //engine.CurPage = saveCurPage; + while (startRow < Rows.Count) + { + int rowsFit = GetRowsFit(startRow, engine.FreeSpace); + if (startRow == 0 && engine.IsKeeping && rowsFit < RowCount && isFirstRow && engine.KeepCurY > 0) + { + engine.EndColumn(); + + rowsFit = GetRowsFit(startRow, engine.FreeSpace); + } + // avoid the infinite loop if there is not enough space for one row + if (startRow > 0 && rowsFit == 0) + rowsFit = 1; + + engine.CurY += GeneratePage(startColumn, startRow, columnsFit, rowsFit, + new RectangleF(0, 0, engine.PageWidth, engine.FreeSpace), spans); + info.tableSize.Height++; + + startRow += rowsFit; + if (startRow < Rows.Count) + { + // if we have something to print, start a new page + engine.StartNewPage(); + } + else if (startColumn > 0) + { + // finish the last printed page in case it is not a start page + engine.EndPage(false); + } + + if (Report.Aborted) + break; + } } - else - engine.CurY += curY; - preparedPages.AddPageAction = AddPageAction.Add; - addNewPage = true; - if (Report.Aborted) - break; - } - } + info.startX = Left + GetColumnsWidth(startColumn, columnsFit); + startColumn += columnsFit; + Left = 0; + preparedPages.AddPageAction = AddPageAction.Add; + addNewPage = true; - private TableLayoutInfo GeneratePagesDownThenAcross() - { - ReportEngine engine = Report.Engine; - PreparedPages preparedPages = Report.PreparedPages; - preparedPages.CanUploadToCache = false; - - TableLayoutInfo info = new TableLayoutInfo(); - info.startPage = engine.CurPage; - List spans = GetSpanList(); - int startColumn = 0; - bool addNewPage = false; - float saveCurY = engine.CurY; - float lastCurY = 0; - int lastPage = 0; - Top = 0; - - while (startColumn < Columns.Count) - { - if (addNewPage) - engine.StartNewPage(); - - int startRow = 0; - int columnsFit = GetColumnsFit(startColumn, engine.PageWidth - Left); - // avoid the infinite loop if there is not enough space for one column - if (startColumn > 0 && columnsFit == 0) - columnsFit = 1; - - engine.CurY = saveCurY; - info.tableSize.Width++; - info.tableSize.Height = 0; - - if (columnsFit > 0) - { - while (startRow < Rows.Count) - { - int rowsFit = GetRowsFit(startRow, engine.FreeSpace); - if(startRow == 0 && engine.IsKeeping && rowsFit < RowCount && isFirstRow && engine.KeepCurY > 0) + if (lastPage == 0) { - engine.EndColumn(); - - rowsFit = GetRowsFit(startRow, engine.FreeSpace); + lastPage = engine.CurPage; + lastCurY = engine.CurY; } - // avoid the infinite loop if there is not enough space for one row - if (startRow > 0 && rowsFit == 0) - rowsFit = 1; - - engine.CurY += GeneratePage(startColumn, startRow, columnsFit, rowsFit, - new RectangleF(0, 0, engine.PageWidth, engine.FreeSpace), spans); - info.tableSize.Height++; - - startRow += rowsFit; - if (startRow < Rows.Count) - { - // if we have something to print, start a new page - engine.StartNewPage(); - } - else if (startColumn > 0) - { - // finish the last printed page in case it is not a start page - engine.EndPage(false); + + if (Report.Aborted) + break; } - if (Report.Aborted) - break; - } + engine.CurPage = lastPage; + engine.CurY = lastCurY; + return info; } - info.startX = Left + GetColumnsWidth(startColumn, columnsFit); - startColumn += columnsFit; - Left = 0; - preparedPages.AddPageAction = AddPageAction.Add; - addNewPage = true; - - if (lastPage == 0) + private void GeneratePagesWrapped() { - lastPage = engine.CurPage; - lastCurY = engine.CurY; - } + ReportEngine engine = Report.Engine; + PreparedPages preparedPages = Report.PreparedPages; + preparedPages.CanUploadToCache = false; - if (Report.Aborted) - break; - } - - engine.CurPage = lastPage; - engine.CurY = lastCurY; - return info; - } + List spans = GetSpanList(); + int startColumn = 0; + Top = 0; - private void GeneratePagesWrapped() - { - ReportEngine engine = Report.Engine; - PreparedPages preparedPages = Report.PreparedPages; - preparedPages.CanUploadToCache = false; - - List spans = GetSpanList(); - int startColumn = 0; - Top = 0; - - while (startColumn < Columns.Count) - { - int startRow = 0; - int columnsFit = GetColumnsFit(startColumn, engine.PageWidth - Left); - // avoid the infinite loop if there is not enough space for one column - if (startColumn > 0 && columnsFit == 0) - columnsFit = 1; - - while (startRow < Rows.Count) - { - int rowsFit = GetRowsFit(startRow, engine.FreeSpace); - if(startRow == 0 && engine.IsKeeping && rowsFit < RowCount && isFirstRow && engine.KeepCurY > 0) + while (startColumn < Columns.Count) + { + int startRow = 0; + int columnsFit = GetColumnsFit(startColumn, engine.PageWidth - Left); + // avoid the infinite loop if there is not enough space for one column + if (startColumn > 0 && columnsFit == 0) + columnsFit = 1; + + while (startRow < Rows.Count) { - engine.EndColumn(); - - rowsFit = GetRowsFit(startRow, engine.FreeSpace); + int rowsFit = GetRowsFit(startRow, engine.FreeSpace); + if (startRow == 0 && engine.IsKeeping && rowsFit < RowCount && isFirstRow && engine.KeepCurY > 0) + { + engine.EndColumn(); + + rowsFit = GetRowsFit(startRow, engine.FreeSpace); + } + if (rowsFit == 0) + { + engine.StartNewPage(); + rowsFit = GetRowsFit(startRow, engine.FreeSpace); + } + + engine.CurY += GeneratePage(startColumn, startRow, columnsFit, rowsFit, + new RectangleF(0, 0, engine.PageWidth, engine.FreeSpace), spans); + + startRow += rowsFit; + + if (Report.Aborted) + break; } - if (rowsFit == 0) - { - engine.StartNewPage(); - rowsFit = GetRowsFit(startRow, engine.FreeSpace); - } - - engine.CurY += GeneratePage(startColumn, startRow, columnsFit, rowsFit, - new RectangleF(0, 0, engine.PageWidth, engine.FreeSpace), spans); - - startRow += rowsFit; - - if (Report.Aborted) - break; - } - - startColumn += columnsFit; - if (startColumn < Columns.Count) - engine.CurY += WrappedGap; - if (Report.Aborted) - break; - } - } - - private void AdjustSpannedCellWidth(TableCellData cell) - { - if (!AdjustSpannedCellsWidth) - return; - - // check that spanned cell has enough width - float columnsWidth = 0; - for (int i = 0; i < cell.ColSpan; i++) - { - columnsWidth += Columns[cell.Address.X + i].Width; - } - // if cell is bigger than sum of column width, increase the last column width - float cellWidth = cell.CalcWidth(); - if (columnsWidth < cellWidth) - Columns[cell.Address.X + cell.ColSpan - 1].Width += cellWidth - columnsWidth; - } + startColumn += columnsFit; + if (startColumn < Columns.Count) + engine.CurY += WrappedGap; - private float GeneratePage(int startColumn, int startRow, int columnsFit, int rowsFit, - RectangleF bounds, List spans) - { - // break spans - foreach (Rectangle span in spans) - { - TableCellData spannedCell = GetCellData(span.Left, span.Top); - TableCellData newSpannedCell = null; - if (span.Left < startColumn && span.Right > startColumn) - { - if ((RepeatHeaders || RepeatRowHeaders) && span.Left < FixedColumns) - { - spannedCell.ColSpan = Math.Min(span.Right, startColumn + columnsFit) - startColumn + FixedColumns; - } - else - { - newSpannedCell = GetCellData(startColumn, span.Top); - newSpannedCell.RunTimeAssign(spannedCell.Cell, true); - newSpannedCell.ColSpan = Math.Min(span.Right, startColumn + columnsFit) - startColumn; - newSpannedCell.RowSpan = spannedCell.RowSpan; - AdjustSpannedCellWidth(newSpannedCell); - } - } - if (span.Left < startColumn + columnsFit && span.Right > startColumn + columnsFit) - { - spannedCell.ColSpan = startColumn + columnsFit - span.Left; - AdjustSpannedCellWidth(spannedCell); - } - if (span.Top < startRow && span.Bottom > startRow) - { - if ((RepeatHeaders || RepeatColumnHeaders) && span.Top < FixedRows) - spannedCell.RowSpan = Math.Min(span.Bottom, startRow + rowsFit) - startRow + FixedRows; + if (Report.Aborted) + break; + } } - if (span.Top < startRow + rowsFit && span.Bottom > startRow + rowsFit) + + private void AdjustSpannedCellWidth(TableCellData cell) { - spannedCell.RowSpan = startRow + rowsFit - span.Top; - - newSpannedCell = GetCellData(span.Left, startRow + rowsFit); - newSpannedCell.RunTimeAssign(spannedCell.Cell, true); - newSpannedCell.ColSpan = spannedCell.ColSpan; - newSpannedCell.RowSpan = span.Bottom - (startRow + rowsFit); - - // break the cell text - TableCell cell = spannedCell.Cell; - using (TextObject tempObject = new TextObject()) - { - if (!cell.Break(tempObject)) - cell.Text = ""; - if (cell.CanBreak) - newSpannedCell.Text = tempObject.Text; - } - - // fix the row height - float textHeight = newSpannedCell.Cell.CalcHeight(); - float rowsHeight = 0; - for (int i = 0; i < newSpannedCell.RowSpan; i++) - { - rowsHeight += Rows[i + startRow + rowsFit].Height; - } - - if (rowsHeight < textHeight) - { - // fix the last row's height - Rows[startRow + rowsFit + newSpannedCell.RowSpan - 1].Height += textHeight - rowsHeight; - } + if (!AdjustSpannedCellsWidth) + return; + + // check that spanned cell has enough width + float columnsWidth = 0; + for (int i = 0; i < cell.ColSpan; i++) + { + columnsWidth += Columns[cell.Address.X + i].Width; + } + // if cell is bigger than sum of column width, increase the last column width + float cellWidth = cell.CalcWidth(); + if (columnsWidth < cellWidth) + Columns[cell.Address.X + cell.ColSpan - 1].Width += cellWidth - columnsWidth; } - } - // set visible columns - ColumnsToSerialize.Clear(); - if (RepeatHeaders || RepeatRowHeaders) - { - for (int i = 0; i < FixedColumns; i++) + private float GeneratePage(int startColumn, int startRow, int columnsFit, int rowsFit, + RectangleF bounds, List spans) { - if (Columns[i].Visible) - ColumnsToSerialize.Add(Columns[i]); + // break spans + foreach (Rectangle span in spans) + { + TableCellData spannedCell = GetCellData(span.Left, span.Top); + TableCellData newSpannedCell = null; + if (span.Left < startColumn && span.Right > startColumn) + { + if ((RepeatHeaders || RepeatRowHeaders) && span.Left < FixedColumns) + { + spannedCell.ColSpan = Math.Min(span.Right, startColumn + columnsFit) - startColumn + FixedColumns; + } + else + { + newSpannedCell = GetCellData(startColumn, span.Top); + newSpannedCell.RunTimeAssign(spannedCell.Cell, true); + newSpannedCell.ColSpan = Math.Min(span.Right, startColumn + columnsFit) - startColumn; + newSpannedCell.RowSpan = spannedCell.RowSpan; + AdjustSpannedCellWidth(newSpannedCell); + } + } + if (span.Left < startColumn + columnsFit && span.Right > startColumn + columnsFit) + { + spannedCell.ColSpan = startColumn + columnsFit - span.Left; + AdjustSpannedCellWidth(spannedCell); + } + if (span.Top < startRow && span.Bottom > startRow) + { + if ((RepeatHeaders || RepeatColumnHeaders) && span.Top < FixedRows) + spannedCell.RowSpan = Math.Min(span.Bottom, startRow + rowsFit) - startRow + FixedRows; + } + if (span.Top < startRow + rowsFit && span.Bottom > startRow + rowsFit) + { + spannedCell.RowSpan = startRow + rowsFit - span.Top; + + newSpannedCell = GetCellData(span.Left, startRow + rowsFit); + newSpannedCell.RunTimeAssign(spannedCell.Cell, true); + newSpannedCell.ColSpan = spannedCell.ColSpan; + newSpannedCell.RowSpan = span.Bottom - (startRow + rowsFit); + + // break the cell text + TableCell cell = spannedCell.Cell; + using (TextObject tempObject = new TextObject()) + { + if (!cell.Break(tempObject)) + cell.Text = ""; + if (cell.CanBreak) + newSpannedCell.Text = tempObject.Text; + } + + // fix the row height + float textHeight = newSpannedCell.Cell.CalcHeight(); + float rowsHeight = 0; + for (int i = 0; i < newSpannedCell.RowSpan; i++) + { + rowsHeight += Rows[i + startRow + rowsFit].Height; + } + + if (rowsHeight < textHeight) + { + // fix the last row's height + Rows[startRow + rowsFit + newSpannedCell.RowSpan - 1].Height += textHeight - rowsHeight; + } + } + } + + // set visible columns + ColumnsToSerialize.Clear(); + if (RepeatHeaders || RepeatRowHeaders) + { + for (int i = 0; i < FixedColumns; i++) + { + if (Columns[i].Visible) + ColumnsToSerialize.Add(Columns[i]); + } + if (startColumn < FixedColumns) + { + columnsFit -= FixedColumns - startColumn; + startColumn = FixedColumns; + } + } + + // calc visible columns and last X coordinate of table for unlimited page width + float tableEndX = Columns[0].Width; + for (int i = startColumn; i < startColumn + columnsFit; i++) + { + if (Columns[i].Visible) + { + ColumnsToSerialize.Add(Columns[i]); + tableEndX += Columns[i].Width; + } + } + + // set visible rows + RowsToSerialize.Clear(); + if (RepeatHeaders || RepeatColumnHeaders) + { + for (int i = 0; i < FixedRows; i++) + { + if (Rows[i].Visible) + RowsToSerialize.Add(Rows[i]); + } + if (startRow < FixedRows) + { + rowsFit -= FixedRows - startRow; + startRow = FixedRows; + } + } + + // calc visible rows and last Y coordinate of table for unlimited page height + float tableEndY = Rows[0].Top; + for (int i = startRow; i < startRow + rowsFit; i++) + { + if (Rows[i].Visible) + { + RowsToSerialize.Add(Rows[i]); + tableEndY += Rows[i].Height; + } + } + // include row header + if (startRow != 0 && (RepeatHeaders || RepeatColumnHeaders)) + { + for (int i = 0; i < FixedRows; i++) + { + tableEndY += Rows[i].Height; + } + } + + + // generate unlimited page + if (Report.Engine.UnlimitedHeight || Report.Engine.UnlimitedWidth) + { + ReportPage page = Report.PreparedPages.GetPage(Report.Engine.CurPage); + if (Report.Engine.UnlimitedHeight) + { + bounds.Height = tableEndY; + } + if (Report.Engine.UnlimitedWidth) + { + bounds.Width = tableEndX; + } + Report.PreparedPages.ModifyPage(Report.Engine.CurPage, page); + } + + DataBand band = new DataBand(); + band.Bounds = bounds; + band.Objects.Add(this); + Report.Engine.AddToPreparedPages(band); + + return GetRowsHeight(startRow, rowsFit); } - if (startColumn < FixedColumns) + + /// + protected override void Dispose(bool disposing) { - columnsFit -= FixedColumns - startColumn; - startColumn = FixedColumns; + LockCorrectSpans = true; + base.Dispose(disposing); } - } - - // calc visible columns and last X coordinate of table for unlimited page width - float tableEndX = Columns[0].Width; - for (int i = startColumn; i < startColumn + columnsFit; i++) - { - if (Columns[i].Visible) - { - ColumnsToSerialize.Add(Columns[i]); - tableEndX += Columns[i].Width; - } - } - - // set visible rows - RowsToSerialize.Clear(); - if (RepeatHeaders || RepeatColumnHeaders) - { - for (int i = 0; i < FixedRows; i++) + + /// + public override void GetChildObjects(ObjectCollection list) { - if (Rows[i].Visible) - RowsToSerialize.Add(Rows[i]); + foreach (TableColumn column in ColumnsToSerialize) + { + list.Add(column); + } + foreach (TableRow row in RowsToSerialize) + { + list.Add(row); + } } - if (startRow < FixedRows) + + /// + /// Creates a new instance of the class. + /// + public TableResult() { - rowsFit -= FixedRows - startRow; - startRow = FixedRows; + LockCorrectSpans = true; + rowsToSerialize = new List(); + columnsToSerialize = new List(); } - } - - // calc visible rows and last Y coordinate of table for unlimited page height - float tableEndY = Rows[0].Top; - for (int i = startRow; i < startRow + rowsFit; i++) - { - if (Rows[i].Visible) - { - RowsToSerialize.Add(Rows[i]); - tableEndY += Rows[i].Height; - } - } - // include row header - if (startRow != 0 && (RepeatHeaders || RepeatColumnHeaders)) - { - for (int i = 0; i < FixedRows; i++) - { - tableEndY += Rows[i].Height; - } - } - - - // generate unlimited page - if (Report.Engine.UnlimitedHeight || Report.Engine.UnlimitedWidth) - { - ReportPage page = Report.PreparedPages.GetPage(Report.Engine.CurPage); - if (Report.Engine.UnlimitedHeight) - { - bounds.Height = tableEndY; - } - if (Report.Engine.UnlimitedWidth) - { - bounds.Width = tableEndX; - } - Report.PreparedPages.ModifyPage(Report.Engine.CurPage, page); - } - - DataBand band = new DataBand(); - band.Bounds = bounds; - band.Objects.Add(this); - Report.Engine.AddToPreparedPages(band); - - return GetRowsHeight(startRow, rowsFit); - } - /// - protected override void Dispose(bool disposing) - { - LockCorrectSpans = true; - base.Dispose(disposing); - } - - /// - public override void GetChildObjects(ObjectCollection list) - { - foreach (TableColumn column in ColumnsToSerialize) - { - list.Add(column); - } - foreach (TableRow row in RowsToSerialize) - { - list.Add(row); - } - } - /// - /// Creates a new instance of the class. - /// - public TableResult() - { - LockCorrectSpans = true; - rowsToSerialize = new List(); - columnsToSerialize = new List(); - } - - - private class TableLayoutInfo - { - public int startPage; - public Size tableSize; - public float startX; + private class TableLayoutInfo + { + public int startPage; + public Size tableSize; + public float startX; + } } - } } diff --git a/FastReport.Base/TextObject.cs b/FastReport.Base/TextObject.cs index 53eb6284..687cd6b5 100644 --- a/FastReport.Base/TextObject.cs +++ b/FastReport.Base/TextObject.cs @@ -185,12 +185,15 @@ public override bool Equals(object obj) public override int GetHashCode() { - int hashCode = -1051315095; - hashCode = hashCode * -1521134295 + firstLineIndent.GetHashCode(); - hashCode = hashCode * -1521134295 + lineSpacing.GetHashCode(); - hashCode = hashCode * -1521134295 + lineSpacingType.GetHashCode(); - hashCode = hashCode * -1521134295 + skipFirstLineIndent.GetHashCode(); - return hashCode; + unchecked + { + int hashCode = -1051315095; + hashCode = hashCode * -1521134295 + firstLineIndent.GetHashCode(); + hashCode = hashCode * -1521134295 + lineSpacing.GetHashCode(); + hashCode = hashCode * -1521134295 + lineSpacingType.GetHashCode(); + hashCode = hashCode * -1521134295 + skipFirstLineIndent.GetHashCode(); + return hashCode; + } } } @@ -870,6 +873,8 @@ private string BreakText() Font font = report.GraphicCache.GetFont(Font.Name, Font.Size * 96f / DrawUtils.ScreenDpi, Font.Style); StringFormat format = GetStringFormat(report.GraphicCache, StringFormatFlags.LineLimit); RectangleF textRect = new RectangleF(0, 0, Width - Padding.Horizontal, Height - Padding.Vertical); + if (textRect.Height < 0) + return null; int charactersFitted; int linesFilled; diff --git a/FastReport.Base/Utils/CompileHelper.cs b/FastReport.Base/Utils/CompileHelper.cs index 19539919..88258456 100644 --- a/FastReport.Base/Utils/CompileHelper.cs +++ b/FastReport.Base/Utils/CompileHelper.cs @@ -1,6 +1,11 @@ -using Microsoft.CSharp; -using System; +using System; +#if NETSTANDARD || NETCOREAPP +using FastReport.Code.CodeDom.Compiler; +using FastReport.Code.CSharp; +#else using System.CodeDom.Compiler; +using Microsoft.CSharp; +#endif using System.Collections.Generic; using System.IO; using System.Reflection; diff --git a/FastReport.Base/Utils/Config.cs b/FastReport.Base/Utils/Config.cs index e2f129c8..2aeaf486 100644 --- a/FastReport.Base/Utils/Config.cs +++ b/FastReport.Base/Utils/Config.cs @@ -1,5 +1,6 @@ using System; using System.Drawing; +using System.Drawing.Text; using System.Globalization; using System.IO; using System.Reflection; @@ -14,8 +15,12 @@ public static partial class Config { #if COMMUNITY const string CONFIG_NAME = "FastReport.Community.config"; +#else +#if MONO + const string CONFIG_NAME = "FastReport.Mono.config"; #else const string CONFIG_NAME = "FastReport.config"; +#endif #endif #region Private Fields @@ -25,6 +30,7 @@ public static partial class Config private static string FFolder = null; private static string FFontListFolder = null; private static string FLogs = ""; + private static bool FIsRunningOnMono; private static ReportSettings FReportSettings = new ReportSettings(); private static bool FRightToLeft = false; private static string FTempFolder = null; @@ -34,9 +40,16 @@ public static partial class Config private static bool disableHotkeys = false; private static bool disableBacklight = false; -#endregion Private Fields + #endregion Private Fields #region Public Properties + /// + /// Gets a value indicating that the Mono runtime is used. + /// + public static bool IsRunningOnMono + { + get { return FIsRunningOnMono; } + } /// /// Gets or sets the optimization of strings. Is experimental feature. @@ -126,15 +139,6 @@ public static bool DisableHotkeys set { disableHotkeys = value; } } - /// - /// Gets or sets a value that indicates whether the object that the selected item will sit on should be backlighted. - /// - public static bool DisableBacklight - { - get { return disableBacklight; } - set { disableBacklight = value; } - } - /// /// Gets the root item of config xml. /// @@ -176,6 +180,13 @@ public static string Version /// public static event EventHandler ScriptCompile; + /// + /// Gets a PrivateFontCollection instance. + /// + public static PrivateFontCollection PrivateFontCollection + { + get { return FastReport.TypeConverters.FontConverter.PrivateFontCollection; } + } #endregion Public Properties #region Internal Methods @@ -194,6 +205,8 @@ internal static string GetTempFolder() internal static void Init() { + FIsRunningOnMono = Type.GetType("Mono.Runtime") != null; + #if !(NETSTANDARD2_0 || NETSTANDARD2_1) string processName = System.Diagnostics.Process.GetCurrentProcess().ProcessName; WebMode = String.Compare(processName, "iisexpress") == 0 || @@ -381,15 +394,6 @@ private static void LoadPlugins() } } - //private static void ProcessAssemblies() - //{ - // foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies()) - // { - // ProcessAssembly(a); - // } - //} - - private static void ProcessAssembly(Assembly a) { foreach (Type t in a.GetTypes()) @@ -438,7 +442,6 @@ private static void SaveUIOptions() { XmlItem xi = Root.FindItem("UIOptions"); xi.SetProp("DisableHotkeys", Converter.ToString(DisableHotkeys)); - xi.SetProp("DisableBacklight", Converter.ToString(DisableBacklight)); } private static void RestoreUIOptions() @@ -451,11 +454,6 @@ private static void RestoreUIOptions() { disableHotkeys = disableHotkeysStringValue.ToLower() != "false"; } - string disableBacklightStringValue = xi.GetProp("DisableBacklight"); - if (!String.IsNullOrEmpty(disableBacklightStringValue)) - { - disableBacklight = disableBacklightStringValue.ToLower() != "false"; - } } diff --git a/FastReport.Base/Utils/Converter.cs b/FastReport.Base/Utils/Converter.cs index 41596c58..a027825f 100644 --- a/FastReport.Base/Utils/Converter.cs +++ b/FastReport.Base/Utils/Converter.cs @@ -5,6 +5,7 @@ using System.Globalization; using System.IO; using System.Collections.Specialized; +using System.Text; namespace FastReport.Utils { @@ -73,7 +74,7 @@ public static string ToString(object value) return type.FullName; return type.AssemblyQualifiedName; } -#if NETSTANDARD2_0 || NETSTANDARD2_1 +#if true// | NETSTANDARD2_0 || NETSTANDARD2_1 if (value is Font) { return FastReport.TypeConverters.FontConverter.Instance.ConvertToInvariantString(value); @@ -126,7 +127,7 @@ public static object FromString(Type type, string value) value = value.Replace("\r\n", "\r"); return value.Split(new char[] { '\r' }); } -#if NETSTANDARD2_0 || NETSTANDARD2_1 +#if true //NETSTANDARD2_0 || NETSTANDARD2_1 if (type == typeof(Font)) { return FastReport.TypeConverters.FontConverter.Instance.ConvertFromInvariantString(value); @@ -505,7 +506,7 @@ public static NameValueCollection StringToNameValueCollection(string text) /// True if successful public static bool FromHtmlEntities(string text, ref int position, out string result) { - FastString fastString = new FastString(2); + StringBuilder fastString = new StringBuilder(2); if (FromHtmlEntities(text, ref position, fastString)) { result = fastString.ToString(); @@ -525,7 +526,7 @@ public static bool FromHtmlEntities(string text, ref int position, out string re /// Position for processing /// Append result of processing to FastString /// True if successful - public static bool FromHtmlEntities(string text, ref int position, FastString result) + public static bool FromHtmlEntities(string text, ref int position, StringBuilder result) { if (text[position] != '&') return false; int end = text.IndexOf(';', position); @@ -534,8 +535,8 @@ public static bool FromHtmlEntities(string text, ref int position, FastString re { if (text[position + 2] == 'x') { - //hex - FastString fastString = new FastString(end - position); + //hex + StringBuilder fastString = new StringBuilder(end - position); for (int i = position + 3; i < end; i++) { if (!Uri.IsHexDigit(text[i])) diff --git a/FastReport.Base/Utils/Exceptions.cs b/FastReport.Base/Utils/Exceptions.cs index 5816c82c..2aece702 100644 --- a/FastReport.Base/Utils/Exceptions.cs +++ b/FastReport.Base/Utils/Exceptions.cs @@ -24,6 +24,26 @@ internal AncestorException(string name) } } + /// + /// The exception that is thrown when the user tried to rename an object that is introduced in the ancestor report. + /// + public class SwissQrCodeException : Exception + { + internal SwissQrCodeException() + { + } + + internal SwissQrCodeException(string message) + : base(message) + { + } + + internal SwissQrCodeException(string message, Exception inner) + : base(message, inner) + { + } + } + /// /// The exception that is thrown when loading bad formed xml report file. /// diff --git a/FastReport.Base/Utils/TextRenderer.cs b/FastReport.Base/Utils/TextRenderer.cs index 64951a78..30a64d84 100644 --- a/FastReport.Base/Utils/TextRenderer.cs +++ b/FastReport.Base/Utils/TextRenderer.cs @@ -639,7 +639,7 @@ public StyleDescriptor WrapHtmlLines(StyleDescriptor style) //RunImage img = null; //end img string text = this.text; - FastString currentWord = new FastString(100); + StringBuilder currentWord = new StringBuilder(100); float width = 0; bool skipSpace = true; int originalCharIndex = this.originalCharIndex; @@ -671,7 +671,11 @@ public StyleDescriptor WrapHtmlLines(StyleDescriptor style) lines.Add(line); } } - currentWord.Clear(); +#if DOTNET_4 + currentWord.Clear(); // .NET 2.0 doesn't have Clear() +#else + currentWord.Length = 0; +#endif lastChar = ' '; } else @@ -780,7 +784,11 @@ public StyleDescriptor WrapHtmlLines(StyleDescriptor style) // finish the word word.Runs.Add(new Run(currentWord.ToString(), style, word)); } - currentWord.Clear(); +#if DOTNET_4 + currentWord.Clear(); // .NET 2.0 doesn't have Clear() +#else + currentWord.Length = 0; +#endif //end word.Runs.Add(new RunImage(src, alt, style, word)); skipSpace = false; @@ -961,7 +969,11 @@ public StyleDescriptor WrapHtmlLines(StyleDescriptor style) word.Runs.Add(new Run(currentWord.ToString(), style, word)); } - currentWord.Clear(); +#if DOTNET_4 + currentWord.Clear(); // .NET 2.0 doesn't have Clear() +#else + currentWord.Length = 0; +#endif style = newStyle; i--; @@ -1051,7 +1063,11 @@ public StyleDescriptor WrapHtmlLines(StyleDescriptor style) { word = new Word("", line); line.Words.Add(word); - currentWord.Clear(); +#if DOTNET_4 + currentWord.Clear(); // .NET 2.0 doesn't have Clear() +#else + currentWord.Length = 0; +#endif originalCharIndex = this.originalCharIndex + i + 1; skipSpace = true; } @@ -1086,7 +1102,7 @@ public void Draw() line.Draw(); } } - #endregion +#endregion public Paragraph(string text, AdvancedTextRenderer renderer, int originalCharIndex) { @@ -1105,7 +1121,7 @@ public Paragraph(string text, AdvancedTextRenderer renderer, int originalCharInd /// public class Line { - #region Fields +#region Fields private List words; private string text; private bool hasTabs; @@ -1115,9 +1131,9 @@ public class Line private int originalCharIndex; private List underlines; private List strikeouts; - #endregion +#endregion - #region Properties +#region Properties public List Words { get { return words; } @@ -1184,9 +1200,9 @@ public List Strikeouts { get { return strikeouts; } } - #endregion +#endregion - #region Private Methods +#region Private Methods private void PrepareUnderlines(List list, FontStyle style) { list.Clear(); @@ -1235,9 +1251,9 @@ private void PrepareUnderlines(List list, FontStyle style) list.Add(new RectangleF(Left, Top, lineWidth, 1)); } } - #endregion +#endregion - #region Public Methods +#region Public Methods public void AlignWords(HorzAlign align) { width = 0; @@ -1361,7 +1377,7 @@ public float CalcHeight() height = Renderer.LineHeight; return height; } - #endregion +#endregion public Line(string text, Paragraph paragraph, int originalCharIndex) { @@ -1436,15 +1452,15 @@ internal float CalcUnderBaseLine() /// public class Word { - #region Fields +#region Fields private List runs; protected string text; private float left; private float width; internal Line line; - #endregion +#endregion - #region Properties +#region Properties public string Text { get { return text; } @@ -1503,9 +1519,9 @@ public float SpaceWidth return Runs[Runs.Count - 1].SpaceWidth; } } - #endregion +#endregion - #region Public Methods +#region Public Methods public void AdjustRuns() { float left = Left; @@ -1621,7 +1637,7 @@ internal float CalcUnderBaseLine() return 0; } } - #endregion +#endregion public Word(string text, Line line) { @@ -1651,15 +1667,15 @@ public enum BaseLine /// public class StyleDescriptor { - #region Fields +#region Fields private FontStyle fontStyle; private Color color; private BaseLine baseLine; private string font; private float size; - #endregion +#endregion - #region Properties +#region Properties public FontStyle FontStyle { get { return fontStyle; } @@ -1688,9 +1704,9 @@ public BaseLine BaseLine get { return baseLine; } set { baseLine = value; } } - #endregion +#endregion - #region Public Methods +#region Public Methods public override string ToString() { string result = ""; @@ -2492,7 +2508,7 @@ public void Set(byte[] arr) stream = arr; } - #region IDisposable Support +#region IDisposable Support private bool disposedValue = false; // To detect redundant calls /// @@ -2534,9 +2550,9 @@ public void Dispose() // TODO: uncomment the following line if the finalizer is overridden above. // GC.SuppressFinalize(this); } - #endregion +#endregion - #endregion Public Methods +#endregion Public Methods } /// @@ -2583,7 +2599,7 @@ internal LoadEventArgs(InlineImageCache c, string src) #endregion Internal Constructors } - #region IDisposable Support +#region IDisposable Support private bool disposedValue = false; // To detect redundant calls /// @@ -2628,8 +2644,8 @@ public void Dispose() // TODO: uncomment the following line if the finalizer is overridden above. // GC.SuppressFinalize(this); } - #endregion +#endregion - #endregion Public Classes +#endregion Public Classes } } \ No newline at end of file diff --git a/FastReport.OpenSource/Code/AssemblyDescriptor.Core.cs b/FastReport.OpenSource/Code/AssemblyDescriptor.Core.cs index bfad12f1..fc56aa9b 100644 --- a/FastReport.OpenSource/Code/AssemblyDescriptor.Core.cs +++ b/FastReport.OpenSource/Code/AssemblyDescriptor.Core.cs @@ -1,5 +1,9 @@ using System.Collections.Specialized; +#if !NETFRAMEWORK +using FastReport.Code.CodeDom.Compiler; +#else using System.CodeDom.Compiler; +#endif namespace FastReport.Code { diff --git a/FastReport.OpenSource/DotNetClasses/CSharpCodeProvider.cs b/FastReport.OpenSource/DotNetClasses/CSharpCodeProvider.cs deleted file mode 100644 index f30549ef..00000000 --- a/FastReport.OpenSource/DotNetClasses/CSharpCodeProvider.cs +++ /dev/null @@ -1,84 +0,0 @@ -#if NETSTANDARD2_0 || NETSTANDARD2_1 || NETCOREAPP -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; - -using System; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using System.Collections.Immutable; -using System.IO; -using System.Reflection; -using System.Text; - - -namespace Microsoft.CSharp -{ - internal class CSharpCodeProvider : CodeDomProvider - { - - - public override CompilerResults CompileAssemblyFromSource(CompilerParameters cp, string code) - { - CodeAnalysis.SyntaxTree codeTree = Microsoft.CodeAnalysis.CSharp.CSharpSyntaxTree.ParseText(code); - CSharpCompilationOptions options = new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary, - optimizationLevel: OptimizationLevel.Release, - generalDiagnosticOption: ReportDiagnostic.Default, - reportSuppressedDiagnostics: true); - - List references = new List(); - - - foreach (string reference in cp.ReferencedAssemblies) - references.Add(GetReference(reference)); - - AddExtraAssemblies(cp.ReferencedAssemblies, references); - - - Compilation compilation = CSharpCompilation.Create( - "_" + Guid.NewGuid().ToString("D"), new SyntaxTree[] { codeTree }, - references: references, options: options - ); - - - - using (MemoryStream ms = new MemoryStream()) - { - CodeAnalysis.Emit.EmitResult results = compilation.Emit(ms); - if (results.Success) - { - return new CompilerResults() - { - CompiledAssembly = Assembly.Load(ms.ToArray()) - }; - } - else - { - CompilerResults result = new CompilerResults(); - foreach (Diagnostic d in results.Diagnostics) - { - if (d.Severity == DiagnosticSeverity.Error) - { - result.Errors.Add(new CompilerError() - { - ErrorText = d.GetMessage(), - ErrorNumber = d.Id, - Line = d.Location.GetLineSpan().StartLinePosition.Line, - Column = d.Location.GetLineSpan().StartLinePosition.Character, - - }); - } - } - return result; - } - } - - } - - public override void Dispose() - { - - } - - } -} -#endif \ No newline at end of file diff --git a/FastReport.OpenSource/DotNetClasses/CodeDomProvider.cs b/FastReport.OpenSource/DotNetClasses/CodeDomProvider.cs deleted file mode 100644 index ab7b4864..00000000 --- a/FastReport.OpenSource/DotNetClasses/CodeDomProvider.cs +++ /dev/null @@ -1,71 +0,0 @@ -#if NETSTANDARD2_0 || NETSTANDARD2_1 || NETCOREAPP -using Microsoft.CodeAnalysis; -using System; -using System.Collections.Generic; -using System.Reflection; - -namespace System.CodeDom.Compiler -{ - internal abstract class CodeDomProvider : IDisposable - { - static Dictionary cache = new Dictionary(); - - public abstract void Dispose(); - public abstract CompilerResults CompileAssemblyFromSource(CompilerParameters cp, string v); - - protected void AddExtraAssemblies(Collections.Specialized.StringCollection referencedAssemblies, List references) - { - - string[] assemblies = new[] { - "netstandard", - "System.Runtime", - "System.ComponentModel.Primitives", - "System.Drawing.Common" - }; - - foreach(string assembly in assemblies) - { - if (!referencedAssemblies.Contains(assembly)) - references.Add(GetReference(assembly)); - } - } - - - internal MetadataReference GetReference(string refDll) - { - string reference = refDll; - try - { - if (cache.ContainsKey(refDll)) - return MetadataReference.CreateFromFile(cache[refDll]); - MetadataReference result; - foreach (AssemblyName name in Assembly.GetExecutingAssembly().GetReferencedAssemblies()) - { - if (name.Name == reference - || reference.ToLower().EndsWith(".dll") - && name.Name == reference.Substring(0, reference.Length - 4)) - { - result = MetadataReference.CreateFromFile( - Assembly.Load(name).Location); - cache[refDll] = reference; - return result; - } - } - - result = MetadataReference.CreateFromFile(reference); - cache[refDll] = reference; - return result; - } - catch - { - string ass = reference; - if (reference.ToLower().EndsWith(".dll")) - ass = reference.Substring(0, reference.Length - 4); - cache[refDll] = Assembly.Load(new AssemblyName(ass)).Location; - return MetadataReference.CreateFromFile(cache[refDll]); - } - - } - } -} -#endif \ No newline at end of file diff --git a/FastReport.OpenSource/DotNetClasses/CodeGenerator.cs b/FastReport.OpenSource/DotNetClasses/CodeGenerator.cs deleted file mode 100644 index cd8d9fe2..00000000 --- a/FastReport.OpenSource/DotNetClasses/CodeGenerator.cs +++ /dev/null @@ -1,17 +0,0 @@ -#if NETSTANDARD2_0 || NETSTANDARD2_1 || NETCOREAPP -using System; -using System.Collections.Generic; -using System.Text; - -namespace System.CodeDom.Compiler -{ - internal class CodeGenerator - { - internal static bool IsValidLanguageIndependentIdentifier(string value) - { - //TODO o_0 what???? - return true; - } - } -} -#endif \ No newline at end of file diff --git a/FastReport.OpenSource/DotNetClasses/Color.Core.cs b/FastReport.OpenSource/DotNetClasses/Color.Core.cs deleted file mode 100644 index 5b54a878..00000000 --- a/FastReport.OpenSource/DotNetClasses/Color.Core.cs +++ /dev/null @@ -1,577 +0,0 @@ -#if NETSTANDARD2_0 || NETSTANDARD2_1 -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Text; - -namespace System.Drawing -{ - #if NETSTANDARD2_0 - public enum KnownColor - { - ActiveBorder = 1, - ActiveCaption = 2, - ActiveCaptionText = 3, - AppWorkspace = 4, - Control = 5, - ControlDark = 6, - ControlDarkDark = 7, - ControlLight = 8, - ControlLightLight = 9, - ControlText = 10, - Desktop = 11, - GrayText = 12, - Highlight = 13, - HighlightText = 14, - HotTrack = 15, - InactiveBorder = 16, - InactiveCaption = 17, - InactiveCaptionText = 18, - Info = 19, - InfoText = 20, - Menu = 21, - MenuText = 22, - ScrollBar = 23, - Window = 24, - WindowFrame = 25, - WindowText = 26, - Transparent = 27, - AliceBlue = 28, - AntiqueWhite = 29, - Aqua = 30, - Aquamarine = 31, - Azure = 32, - Beige = 33, - Bisque = 34, - Black = 35, - BlanchedAlmond = 36, - Blue = 37, - BlueViolet = 38, - Brown = 39, - BurlyWood = 40, - CadetBlue = 41, - Chartreuse = 42, - Chocolate = 43, - Coral = 44, - CornflowerBlue = 45, - Cornsilk = 46, - Crimson = 47, - Cyan = 48, - DarkBlue = 49, - DarkCyan = 50, - DarkGoldenrod = 51, - DarkGray = 52, - DarkGreen = 53, - DarkKhaki = 54, - DarkMagenta = 55, - DarkOliveGreen = 56, - DarkOrange = 57, - DarkOrchid = 58, - DarkRed = 59, - DarkSalmon = 60, - DarkSeaGreen = 61, - DarkSlateBlue = 62, - DarkSlateGray = 63, - DarkTurquoise = 64, - DarkViolet = 65, - DeepPink = 66, - DeepSkyBlue = 67, - DimGray = 68, - DodgerBlue = 69, - Firebrick = 70, - FloralWhite = 71, - ForestGreen = 72, - Fuchsia = 73, - Gainsboro = 74, - GhostWhite = 75, - Gold = 76, - Goldenrod = 77, - Gray = 78, - Green = 79, - GreenYellow = 80, - Honeydew = 81, - HotPink = 82, - IndianRed = 83, - Indigo = 84, - Ivory = 85, - Khaki = 86, - Lavender = 87, - LavenderBlush = 88, - LawnGreen = 89, - LemonChiffon = 90, - LightBlue = 91, - LightCoral = 92, - LightCyan = 93, - LightGoldenrodYellow = 94, - LightGray = 95, - LightGreen = 96, - LightPink = 97, - LightSalmon = 98, - LightSeaGreen = 99, - LightSkyBlue = 100, - LightSlateGray = 101, - LightSteelBlue = 102, - LightYellow = 103, - Lime = 104, - LimeGreen = 105, - Linen = 106, - Magenta = 107, - Maroon = 108, - MediumAquamarine = 109, - MediumBlue = 110, - MediumOrchid = 111, - MediumPurple = 112, - MediumSeaGreen = 113, - MediumSlateBlue = 114, - MediumSpringGreen = 115, - MediumTurquoise = 116, - MediumVioletRed = 117, - MidnightBlue = 118, - MintCream = 119, - MistyRose = 120, - Moccasin = 121, - NavajoWhite = 122, - Navy = 123, - OldLace = 124, - Olive = 125, - OliveDrab = 126, - Orange = 127, - OrangeRed = 128, - Orchid = 129, - PaleGoldenrod = 130, - PaleGreen = 131, - PaleTurquoise = 132, - PaleVioletRed = 133, - PapayaWhip = 134, - PeachPuff = 135, - Peru = 136, - Pink = 137, - Plum = 138, - PowderBlue = 139, - Purple = 140, - Red = 141, - RosyBrown = 142, - RoyalBlue = 143, - SaddleBrown = 144, - Salmon = 145, - SandyBrown = 146, - SeaGreen = 147, - SeaShell = 148, - Sienna = 149, - Silver = 150, - SkyBlue = 151, - SlateBlue = 152, - SlateGray = 153, - Snow = 154, - SpringGreen = 155, - SteelBlue = 156, - Tan = 157, - Teal = 158, - Thistle = 159, - Tomato = 160, - Turquoise = 161, - Violet = 162, - Wheat = 163, - White = 164, - WhiteSmoke = 165, - Yellow = 166, - YellowGreen = 167, - ButtonFace = 168, - ButtonHighlight = 169, - ButtonShadow = 170, - GradientActiveCaption = 171, - GradientInactiveCaption = 172, - MenuBar = 173, - MenuHighlight = 174 - } -#endif - public class ColorExt - { - private static readonly ConcurrentDictionary ColorToKnownColor = new ConcurrentDictionary(); - private static readonly ConcurrentDictionary KnownColorToColor = new ConcurrentDictionary(); - - static ColorExt() - { - ColorToKnownColor[-4934476] = KnownColor.ActiveBorder; - KnownColorToColor[KnownColor.ActiveBorder] = Color.FromArgb(-4934476); - ColorToKnownColor[-6703919] = KnownColor.ActiveCaption; - KnownColorToColor[KnownColor.ActiveCaption] = Color.FromArgb(-6703919); - ColorToKnownColor[-16777216] = KnownColor.ActiveCaptionText; - KnownColorToColor[KnownColor.ActiveCaptionText] = Color.FromArgb(-16777216); - ColorToKnownColor[-5526613] = KnownColor.AppWorkspace; - KnownColorToColor[KnownColor.AppWorkspace] = Color.FromArgb(-5526613); - ColorToKnownColor[-986896] = KnownColor.Control; - KnownColorToColor[KnownColor.Control] = Color.FromArgb(-986896); - ColorToKnownColor[-6250336] = KnownColor.ControlDark; - KnownColorToColor[KnownColor.ControlDark] = Color.FromArgb(-6250336); - ColorToKnownColor[-9868951] = KnownColor.ControlDarkDark; - KnownColorToColor[KnownColor.ControlDarkDark] = Color.FromArgb(-9868951); - ColorToKnownColor[-1842205] = KnownColor.ControlLight; - KnownColorToColor[KnownColor.ControlLight] = Color.FromArgb(-1842205); - ColorToKnownColor[-1] = KnownColor.ControlLightLight; - KnownColorToColor[KnownColor.ControlLightLight] = Color.FromArgb(-1); - ColorToKnownColor[-16777216] = KnownColor.ControlText; - KnownColorToColor[KnownColor.ControlText] = Color.FromArgb(-16777216); - ColorToKnownColor[-16777216] = KnownColor.Desktop; - KnownColorToColor[KnownColor.Desktop] = Color.FromArgb(-16777216); - ColorToKnownColor[-9605779] = KnownColor.GrayText; - KnownColorToColor[KnownColor.GrayText] = Color.FromArgb(-9605779); - ColorToKnownColor[-16746281] = KnownColor.Highlight; - KnownColorToColor[KnownColor.Highlight] = Color.FromArgb(-16746281); - ColorToKnownColor[-1] = KnownColor.HighlightText; - KnownColorToColor[KnownColor.HighlightText] = Color.FromArgb(-1); - ColorToKnownColor[-16750900] = KnownColor.HotTrack; - KnownColorToColor[KnownColor.HotTrack] = Color.FromArgb(-16750900); - ColorToKnownColor[-722948] = KnownColor.InactiveBorder; - KnownColorToColor[KnownColor.InactiveBorder] = Color.FromArgb(-722948); - ColorToKnownColor[-4207141] = KnownColor.InactiveCaption; - KnownColorToColor[KnownColor.InactiveCaption] = Color.FromArgb(-4207141); - ColorToKnownColor[-16777216] = KnownColor.InactiveCaptionText; - KnownColorToColor[KnownColor.InactiveCaptionText] = Color.FromArgb(-16777216); - ColorToKnownColor[-31] = KnownColor.Info; - KnownColorToColor[KnownColor.Info] = Color.FromArgb(-31); - ColorToKnownColor[-16777216] = KnownColor.InfoText; - KnownColorToColor[KnownColor.InfoText] = Color.FromArgb(-16777216); - ColorToKnownColor[-986896] = KnownColor.Menu; - KnownColorToColor[KnownColor.Menu] = Color.FromArgb(-986896); - ColorToKnownColor[-16777216] = KnownColor.MenuText; - KnownColorToColor[KnownColor.MenuText] = Color.FromArgb(-16777216); - ColorToKnownColor[-3618616] = KnownColor.ScrollBar; - KnownColorToColor[KnownColor.ScrollBar] = Color.FromArgb(-3618616); - ColorToKnownColor[-1] = KnownColor.Window; - KnownColorToColor[KnownColor.Window] = Color.FromArgb(-1); - ColorToKnownColor[-10197916] = KnownColor.WindowFrame; - KnownColorToColor[KnownColor.WindowFrame] = Color.FromArgb(-10197916); - ColorToKnownColor[-16777216] = KnownColor.WindowText; - KnownColorToColor[KnownColor.WindowText] = Color.FromArgb(-16777216); - ColorToKnownColor[16777215] = KnownColor.Transparent; - KnownColorToColor[KnownColor.Transparent] = Color.FromArgb(16777215); - ColorToKnownColor[-984833] = KnownColor.AliceBlue; - KnownColorToColor[KnownColor.AliceBlue] = Color.FromArgb(-984833); - ColorToKnownColor[-332841] = KnownColor.AntiqueWhite; - KnownColorToColor[KnownColor.AntiqueWhite] = Color.FromArgb(-332841); - ColorToKnownColor[-16711681] = KnownColor.Aqua; - KnownColorToColor[KnownColor.Aqua] = Color.FromArgb(-16711681); - ColorToKnownColor[-8388652] = KnownColor.Aquamarine; - KnownColorToColor[KnownColor.Aquamarine] = Color.FromArgb(-8388652); - ColorToKnownColor[-983041] = KnownColor.Azure; - KnownColorToColor[KnownColor.Azure] = Color.FromArgb(-983041); - ColorToKnownColor[-657956] = KnownColor.Beige; - KnownColorToColor[KnownColor.Beige] = Color.FromArgb(-657956); - ColorToKnownColor[-6972] = KnownColor.Bisque; - KnownColorToColor[KnownColor.Bisque] = Color.FromArgb(-6972); - ColorToKnownColor[-16777216] = KnownColor.Black; - KnownColorToColor[KnownColor.Black] = Color.FromArgb(-16777216); - ColorToKnownColor[-5171] = KnownColor.BlanchedAlmond; - KnownColorToColor[KnownColor.BlanchedAlmond] = Color.FromArgb(-5171); - ColorToKnownColor[-16776961] = KnownColor.Blue; - KnownColorToColor[KnownColor.Blue] = Color.FromArgb(-16776961); - ColorToKnownColor[-7722014] = KnownColor.BlueViolet; - KnownColorToColor[KnownColor.BlueViolet] = Color.FromArgb(-7722014); - ColorToKnownColor[-5952982] = KnownColor.Brown; - KnownColorToColor[KnownColor.Brown] = Color.FromArgb(-5952982); - ColorToKnownColor[-2180985] = KnownColor.BurlyWood; - KnownColorToColor[KnownColor.BurlyWood] = Color.FromArgb(-2180985); - ColorToKnownColor[-10510688] = KnownColor.CadetBlue; - KnownColorToColor[KnownColor.CadetBlue] = Color.FromArgb(-10510688); - ColorToKnownColor[-8388864] = KnownColor.Chartreuse; - KnownColorToColor[KnownColor.Chartreuse] = Color.FromArgb(-8388864); - ColorToKnownColor[-2987746] = KnownColor.Chocolate; - KnownColorToColor[KnownColor.Chocolate] = Color.FromArgb(-2987746); - ColorToKnownColor[-32944] = KnownColor.Coral; - KnownColorToColor[KnownColor.Coral] = Color.FromArgb(-32944); - ColorToKnownColor[-10185235] = KnownColor.CornflowerBlue; - KnownColorToColor[KnownColor.CornflowerBlue] = Color.FromArgb(-10185235); - ColorToKnownColor[-1828] = KnownColor.Cornsilk; - KnownColorToColor[KnownColor.Cornsilk] = Color.FromArgb(-1828); - ColorToKnownColor[-2354116] = KnownColor.Crimson; - KnownColorToColor[KnownColor.Crimson] = Color.FromArgb(-2354116); - ColorToKnownColor[-16711681] = KnownColor.Cyan; - KnownColorToColor[KnownColor.Cyan] = Color.FromArgb(-16711681); - ColorToKnownColor[-16777077] = KnownColor.DarkBlue; - KnownColorToColor[KnownColor.DarkBlue] = Color.FromArgb(-16777077); - ColorToKnownColor[-16741493] = KnownColor.DarkCyan; - KnownColorToColor[KnownColor.DarkCyan] = Color.FromArgb(-16741493); - ColorToKnownColor[-4684277] = KnownColor.DarkGoldenrod; - KnownColorToColor[KnownColor.DarkGoldenrod] = Color.FromArgb(-4684277); - ColorToKnownColor[-5658199] = KnownColor.DarkGray; - KnownColorToColor[KnownColor.DarkGray] = Color.FromArgb(-5658199); - ColorToKnownColor[-16751616] = KnownColor.DarkGreen; - KnownColorToColor[KnownColor.DarkGreen] = Color.FromArgb(-16751616); - ColorToKnownColor[-4343957] = KnownColor.DarkKhaki; - KnownColorToColor[KnownColor.DarkKhaki] = Color.FromArgb(-4343957); - ColorToKnownColor[-7667573] = KnownColor.DarkMagenta; - KnownColorToColor[KnownColor.DarkMagenta] = Color.FromArgb(-7667573); - ColorToKnownColor[-11179217] = KnownColor.DarkOliveGreen; - KnownColorToColor[KnownColor.DarkOliveGreen] = Color.FromArgb(-11179217); - ColorToKnownColor[-29696] = KnownColor.DarkOrange; - KnownColorToColor[KnownColor.DarkOrange] = Color.FromArgb(-29696); - ColorToKnownColor[-6737204] = KnownColor.DarkOrchid; - KnownColorToColor[KnownColor.DarkOrchid] = Color.FromArgb(-6737204); - ColorToKnownColor[-7667712] = KnownColor.DarkRed; - KnownColorToColor[KnownColor.DarkRed] = Color.FromArgb(-7667712); - ColorToKnownColor[-1468806] = KnownColor.DarkSalmon; - KnownColorToColor[KnownColor.DarkSalmon] = Color.FromArgb(-1468806); - ColorToKnownColor[-7357301] = KnownColor.DarkSeaGreen; - KnownColorToColor[KnownColor.DarkSeaGreen] = Color.FromArgb(-7357301); - ColorToKnownColor[-12042869] = KnownColor.DarkSlateBlue; - KnownColorToColor[KnownColor.DarkSlateBlue] = Color.FromArgb(-12042869); - ColorToKnownColor[-13676721] = KnownColor.DarkSlateGray; - KnownColorToColor[KnownColor.DarkSlateGray] = Color.FromArgb(-13676721); - ColorToKnownColor[-16724271] = KnownColor.DarkTurquoise; - KnownColorToColor[KnownColor.DarkTurquoise] = Color.FromArgb(-16724271); - ColorToKnownColor[-7077677] = KnownColor.DarkViolet; - KnownColorToColor[KnownColor.DarkViolet] = Color.FromArgb(-7077677); - ColorToKnownColor[-60269] = KnownColor.DeepPink; - KnownColorToColor[KnownColor.DeepPink] = Color.FromArgb(-60269); - ColorToKnownColor[-16728065] = KnownColor.DeepSkyBlue; - KnownColorToColor[KnownColor.DeepSkyBlue] = Color.FromArgb(-16728065); - ColorToKnownColor[-9868951] = KnownColor.DimGray; - KnownColorToColor[KnownColor.DimGray] = Color.FromArgb(-9868951); - ColorToKnownColor[-14774017] = KnownColor.DodgerBlue; - KnownColorToColor[KnownColor.DodgerBlue] = Color.FromArgb(-14774017); - ColorToKnownColor[-5103070] = KnownColor.Firebrick; - KnownColorToColor[KnownColor.Firebrick] = Color.FromArgb(-5103070); - ColorToKnownColor[-1296] = KnownColor.FloralWhite; - KnownColorToColor[KnownColor.FloralWhite] = Color.FromArgb(-1296); - ColorToKnownColor[-14513374] = KnownColor.ForestGreen; - KnownColorToColor[KnownColor.ForestGreen] = Color.FromArgb(-14513374); - ColorToKnownColor[-65281] = KnownColor.Fuchsia; - KnownColorToColor[KnownColor.Fuchsia] = Color.FromArgb(-65281); - ColorToKnownColor[-2302756] = KnownColor.Gainsboro; - KnownColorToColor[KnownColor.Gainsboro] = Color.FromArgb(-2302756); - ColorToKnownColor[-460545] = KnownColor.GhostWhite; - KnownColorToColor[KnownColor.GhostWhite] = Color.FromArgb(-460545); - ColorToKnownColor[-10496] = KnownColor.Gold; - KnownColorToColor[KnownColor.Gold] = Color.FromArgb(-10496); - ColorToKnownColor[-2448096] = KnownColor.Goldenrod; - KnownColorToColor[KnownColor.Goldenrod] = Color.FromArgb(-2448096); - ColorToKnownColor[-8355712] = KnownColor.Gray; - KnownColorToColor[KnownColor.Gray] = Color.FromArgb(-8355712); - ColorToKnownColor[-16744448] = KnownColor.Green; - KnownColorToColor[KnownColor.Green] = Color.FromArgb(-16744448); - ColorToKnownColor[-5374161] = KnownColor.GreenYellow; - KnownColorToColor[KnownColor.GreenYellow] = Color.FromArgb(-5374161); - ColorToKnownColor[-983056] = KnownColor.Honeydew; - KnownColorToColor[KnownColor.Honeydew] = Color.FromArgb(-983056); - ColorToKnownColor[-38476] = KnownColor.HotPink; - KnownColorToColor[KnownColor.HotPink] = Color.FromArgb(-38476); - ColorToKnownColor[-3318692] = KnownColor.IndianRed; - KnownColorToColor[KnownColor.IndianRed] = Color.FromArgb(-3318692); - ColorToKnownColor[-11861886] = KnownColor.Indigo; - KnownColorToColor[KnownColor.Indigo] = Color.FromArgb(-11861886); - ColorToKnownColor[-16] = KnownColor.Ivory; - KnownColorToColor[KnownColor.Ivory] = Color.FromArgb(-16); - ColorToKnownColor[-989556] = KnownColor.Khaki; - KnownColorToColor[KnownColor.Khaki] = Color.FromArgb(-989556); - ColorToKnownColor[-1644806] = KnownColor.Lavender; - KnownColorToColor[KnownColor.Lavender] = Color.FromArgb(-1644806); - ColorToKnownColor[-3851] = KnownColor.LavenderBlush; - KnownColorToColor[KnownColor.LavenderBlush] = Color.FromArgb(-3851); - ColorToKnownColor[-8586240] = KnownColor.LawnGreen; - KnownColorToColor[KnownColor.LawnGreen] = Color.FromArgb(-8586240); - ColorToKnownColor[-1331] = KnownColor.LemonChiffon; - KnownColorToColor[KnownColor.LemonChiffon] = Color.FromArgb(-1331); - ColorToKnownColor[-5383962] = KnownColor.LightBlue; - KnownColorToColor[KnownColor.LightBlue] = Color.FromArgb(-5383962); - ColorToKnownColor[-1015680] = KnownColor.LightCoral; - KnownColorToColor[KnownColor.LightCoral] = Color.FromArgb(-1015680); - ColorToKnownColor[-2031617] = KnownColor.LightCyan; - KnownColorToColor[KnownColor.LightCyan] = Color.FromArgb(-2031617); - ColorToKnownColor[-329006] = KnownColor.LightGoldenrodYellow; - KnownColorToColor[KnownColor.LightGoldenrodYellow] = Color.FromArgb(-329006); - ColorToKnownColor[-2894893] = KnownColor.LightGray; - KnownColorToColor[KnownColor.LightGray] = Color.FromArgb(-2894893); - ColorToKnownColor[-7278960] = KnownColor.LightGreen; - KnownColorToColor[KnownColor.LightGreen] = Color.FromArgb(-7278960); - ColorToKnownColor[-18751] = KnownColor.LightPink; - KnownColorToColor[KnownColor.LightPink] = Color.FromArgb(-18751); - ColorToKnownColor[-24454] = KnownColor.LightSalmon; - KnownColorToColor[KnownColor.LightSalmon] = Color.FromArgb(-24454); - ColorToKnownColor[-14634326] = KnownColor.LightSeaGreen; - KnownColorToColor[KnownColor.LightSeaGreen] = Color.FromArgb(-14634326); - ColorToKnownColor[-7876870] = KnownColor.LightSkyBlue; - KnownColorToColor[KnownColor.LightSkyBlue] = Color.FromArgb(-7876870); - ColorToKnownColor[-8943463] = KnownColor.LightSlateGray; - KnownColorToColor[KnownColor.LightSlateGray] = Color.FromArgb(-8943463); - ColorToKnownColor[-5192482] = KnownColor.LightSteelBlue; - KnownColorToColor[KnownColor.LightSteelBlue] = Color.FromArgb(-5192482); - ColorToKnownColor[-32] = KnownColor.LightYellow; - KnownColorToColor[KnownColor.LightYellow] = Color.FromArgb(-32); - ColorToKnownColor[-16711936] = KnownColor.Lime; - KnownColorToColor[KnownColor.Lime] = Color.FromArgb(-16711936); - ColorToKnownColor[-13447886] = KnownColor.LimeGreen; - KnownColorToColor[KnownColor.LimeGreen] = Color.FromArgb(-13447886); - ColorToKnownColor[-331546] = KnownColor.Linen; - KnownColorToColor[KnownColor.Linen] = Color.FromArgb(-331546); - ColorToKnownColor[-65281] = KnownColor.Magenta; - KnownColorToColor[KnownColor.Magenta] = Color.FromArgb(-65281); - ColorToKnownColor[-8388608] = KnownColor.Maroon; - KnownColorToColor[KnownColor.Maroon] = Color.FromArgb(-8388608); - ColorToKnownColor[-10039894] = KnownColor.MediumAquamarine; - KnownColorToColor[KnownColor.MediumAquamarine] = Color.FromArgb(-10039894); - ColorToKnownColor[-16777011] = KnownColor.MediumBlue; - KnownColorToColor[KnownColor.MediumBlue] = Color.FromArgb(-16777011); - ColorToKnownColor[-4565549] = KnownColor.MediumOrchid; - KnownColorToColor[KnownColor.MediumOrchid] = Color.FromArgb(-4565549); - ColorToKnownColor[-7114533] = KnownColor.MediumPurple; - KnownColorToColor[KnownColor.MediumPurple] = Color.FromArgb(-7114533); - ColorToKnownColor[-12799119] = KnownColor.MediumSeaGreen; - KnownColorToColor[KnownColor.MediumSeaGreen] = Color.FromArgb(-12799119); - ColorToKnownColor[-8689426] = KnownColor.MediumSlateBlue; - KnownColorToColor[KnownColor.MediumSlateBlue] = Color.FromArgb(-8689426); - ColorToKnownColor[-16713062] = KnownColor.MediumSpringGreen; - KnownColorToColor[KnownColor.MediumSpringGreen] = Color.FromArgb(-16713062); - ColorToKnownColor[-12004916] = KnownColor.MediumTurquoise; - KnownColorToColor[KnownColor.MediumTurquoise] = Color.FromArgb(-12004916); - ColorToKnownColor[-3730043] = KnownColor.MediumVioletRed; - KnownColorToColor[KnownColor.MediumVioletRed] = Color.FromArgb(-3730043); - ColorToKnownColor[-15132304] = KnownColor.MidnightBlue; - KnownColorToColor[KnownColor.MidnightBlue] = Color.FromArgb(-15132304); - ColorToKnownColor[-655366] = KnownColor.MintCream; - KnownColorToColor[KnownColor.MintCream] = Color.FromArgb(-655366); - ColorToKnownColor[-6943] = KnownColor.MistyRose; - KnownColorToColor[KnownColor.MistyRose] = Color.FromArgb(-6943); - ColorToKnownColor[-6987] = KnownColor.Moccasin; - KnownColorToColor[KnownColor.Moccasin] = Color.FromArgb(-6987); - ColorToKnownColor[-8531] = KnownColor.NavajoWhite; - KnownColorToColor[KnownColor.NavajoWhite] = Color.FromArgb(-8531); - ColorToKnownColor[-16777088] = KnownColor.Navy; - KnownColorToColor[KnownColor.Navy] = Color.FromArgb(-16777088); - ColorToKnownColor[-133658] = KnownColor.OldLace; - KnownColorToColor[KnownColor.OldLace] = Color.FromArgb(-133658); - ColorToKnownColor[-8355840] = KnownColor.Olive; - KnownColorToColor[KnownColor.Olive] = Color.FromArgb(-8355840); - ColorToKnownColor[-9728477] = KnownColor.OliveDrab; - KnownColorToColor[KnownColor.OliveDrab] = Color.FromArgb(-9728477); - ColorToKnownColor[-23296] = KnownColor.Orange; - KnownColorToColor[KnownColor.Orange] = Color.FromArgb(-23296); - ColorToKnownColor[-47872] = KnownColor.OrangeRed; - KnownColorToColor[KnownColor.OrangeRed] = Color.FromArgb(-47872); - ColorToKnownColor[-2461482] = KnownColor.Orchid; - KnownColorToColor[KnownColor.Orchid] = Color.FromArgb(-2461482); - ColorToKnownColor[-1120086] = KnownColor.PaleGoldenrod; - KnownColorToColor[KnownColor.PaleGoldenrod] = Color.FromArgb(-1120086); - ColorToKnownColor[-6751336] = KnownColor.PaleGreen; - KnownColorToColor[KnownColor.PaleGreen] = Color.FromArgb(-6751336); - ColorToKnownColor[-5247250] = KnownColor.PaleTurquoise; - KnownColorToColor[KnownColor.PaleTurquoise] = Color.FromArgb(-5247250); - ColorToKnownColor[-2396013] = KnownColor.PaleVioletRed; - KnownColorToColor[KnownColor.PaleVioletRed] = Color.FromArgb(-2396013); - ColorToKnownColor[-4139] = KnownColor.PapayaWhip; - KnownColorToColor[KnownColor.PapayaWhip] = Color.FromArgb(-4139); - ColorToKnownColor[-9543] = KnownColor.PeachPuff; - KnownColorToColor[KnownColor.PeachPuff] = Color.FromArgb(-9543); - ColorToKnownColor[-3308225] = KnownColor.Peru; - KnownColorToColor[KnownColor.Peru] = Color.FromArgb(-3308225); - ColorToKnownColor[-16181] = KnownColor.Pink; - KnownColorToColor[KnownColor.Pink] = Color.FromArgb(-16181); - ColorToKnownColor[-2252579] = KnownColor.Plum; - KnownColorToColor[KnownColor.Plum] = Color.FromArgb(-2252579); - ColorToKnownColor[-5185306] = KnownColor.PowderBlue; - KnownColorToColor[KnownColor.PowderBlue] = Color.FromArgb(-5185306); - ColorToKnownColor[-8388480] = KnownColor.Purple; - KnownColorToColor[KnownColor.Purple] = Color.FromArgb(-8388480); - ColorToKnownColor[-65536] = KnownColor.Red; - KnownColorToColor[KnownColor.Red] = Color.FromArgb(-65536); - ColorToKnownColor[-4419697] = KnownColor.RosyBrown; - KnownColorToColor[KnownColor.RosyBrown] = Color.FromArgb(-4419697); - ColorToKnownColor[-12490271] = KnownColor.RoyalBlue; - KnownColorToColor[KnownColor.RoyalBlue] = Color.FromArgb(-12490271); - ColorToKnownColor[-7650029] = KnownColor.SaddleBrown; - KnownColorToColor[KnownColor.SaddleBrown] = Color.FromArgb(-7650029); - ColorToKnownColor[-360334] = KnownColor.Salmon; - KnownColorToColor[KnownColor.Salmon] = Color.FromArgb(-360334); - ColorToKnownColor[-744352] = KnownColor.SandyBrown; - KnownColorToColor[KnownColor.SandyBrown] = Color.FromArgb(-744352); - ColorToKnownColor[-13726889] = KnownColor.SeaGreen; - KnownColorToColor[KnownColor.SeaGreen] = Color.FromArgb(-13726889); - ColorToKnownColor[-2578] = KnownColor.SeaShell; - KnownColorToColor[KnownColor.SeaShell] = Color.FromArgb(-2578); - ColorToKnownColor[-6270419] = KnownColor.Sienna; - KnownColorToColor[KnownColor.Sienna] = Color.FromArgb(-6270419); - ColorToKnownColor[-4144960] = KnownColor.Silver; - KnownColorToColor[KnownColor.Silver] = Color.FromArgb(-4144960); - ColorToKnownColor[-7876885] = KnownColor.SkyBlue; - KnownColorToColor[KnownColor.SkyBlue] = Color.FromArgb(-7876885); - ColorToKnownColor[-9807155] = KnownColor.SlateBlue; - KnownColorToColor[KnownColor.SlateBlue] = Color.FromArgb(-9807155); - ColorToKnownColor[-9404272] = KnownColor.SlateGray; - KnownColorToColor[KnownColor.SlateGray] = Color.FromArgb(-9404272); - ColorToKnownColor[-1286] = KnownColor.Snow; - KnownColorToColor[KnownColor.Snow] = Color.FromArgb(-1286); - ColorToKnownColor[-16711809] = KnownColor.SpringGreen; - KnownColorToColor[KnownColor.SpringGreen] = Color.FromArgb(-16711809); - ColorToKnownColor[-12156236] = KnownColor.SteelBlue; - KnownColorToColor[KnownColor.SteelBlue] = Color.FromArgb(-12156236); - ColorToKnownColor[-2968436] = KnownColor.Tan; - KnownColorToColor[KnownColor.Tan] = Color.FromArgb(-2968436); - ColorToKnownColor[-16744320] = KnownColor.Teal; - KnownColorToColor[KnownColor.Teal] = Color.FromArgb(-16744320); - ColorToKnownColor[-2572328] = KnownColor.Thistle; - KnownColorToColor[KnownColor.Thistle] = Color.FromArgb(-2572328); - ColorToKnownColor[-40121] = KnownColor.Tomato; - KnownColorToColor[KnownColor.Tomato] = Color.FromArgb(-40121); - ColorToKnownColor[-12525360] = KnownColor.Turquoise; - KnownColorToColor[KnownColor.Turquoise] = Color.FromArgb(-12525360); - ColorToKnownColor[-1146130] = KnownColor.Violet; - KnownColorToColor[KnownColor.Violet] = Color.FromArgb(-1146130); - ColorToKnownColor[-663885] = KnownColor.Wheat; - KnownColorToColor[KnownColor.Wheat] = Color.FromArgb(-663885); - ColorToKnownColor[-1] = KnownColor.White; - KnownColorToColor[KnownColor.White] = Color.FromArgb(-1); - ColorToKnownColor[-657931] = KnownColor.WhiteSmoke; - KnownColorToColor[KnownColor.WhiteSmoke] = Color.FromArgb(-657931); - ColorToKnownColor[-256] = KnownColor.Yellow; - KnownColorToColor[KnownColor.Yellow] = Color.FromArgb(-256); - ColorToKnownColor[-6632142] = KnownColor.YellowGreen; - KnownColorToColor[KnownColor.YellowGreen] = Color.FromArgb(-6632142); - ColorToKnownColor[-986896] = KnownColor.ButtonFace; - KnownColorToColor[KnownColor.ButtonFace] = Color.FromArgb(-986896); - ColorToKnownColor[-1] = KnownColor.ButtonHighlight; - KnownColorToColor[KnownColor.ButtonHighlight] = Color.FromArgb(-1); - ColorToKnownColor[-6250336] = KnownColor.ButtonShadow; - KnownColorToColor[KnownColor.ButtonShadow] = Color.FromArgb(-6250336); - ColorToKnownColor[-4599318] = KnownColor.GradientActiveCaption; - KnownColorToColor[KnownColor.GradientActiveCaption] = Color.FromArgb(-4599318); - ColorToKnownColor[-2628366] = KnownColor.GradientInactiveCaption; - KnownColorToColor[KnownColor.GradientInactiveCaption] = Color.FromArgb(-2628366); - ColorToKnownColor[-986896] = KnownColor.MenuBar; - KnownColorToColor[KnownColor.MenuBar] = Color.FromArgb(-986896); - ColorToKnownColor[-16746281] = KnownColor.MenuHighlight; - KnownColorToColor[KnownColor.MenuHighlight] = Color.FromArgb(-16746281); - } - - public static bool IsKnownColor(Color color) - { - return ColorToKnownColor.ContainsKey(color.ToArgb()); - } - - public static KnownColor ToKnownColor(Color color) - { - if (ColorToKnownColor.TryGetValue(color.ToArgb(), out KnownColor result)) - return result; - return KnownColor.Transparent; - } - - public static Color FromKnownColor(KnownColor knownColor) - { - if (KnownColorToColor.TryGetValue(knownColor, out Color result)) - return result; - return Color.Transparent; - } - - public static bool IsSystemColor(Color c) - { - if (IsKnownColor(c)) - { - KnownColor knownColor = ToKnownColor(c); - return ((((KnownColor)knownColor) <= KnownColor.WindowText) || (((KnownColor)knownColor) > KnownColor.YellowGreen)); - } - return false; - } - } -} -#endif - - diff --git a/FastReport.OpenSource/DotNetClasses/Color.Full.cs b/FastReport.OpenSource/DotNetClasses/Color.Full.cs deleted file mode 100644 index f6cb89c9..00000000 --- a/FastReport.OpenSource/DotNetClasses/Color.Full.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -#if !(NETSTANDARD2_0 || NETSTANDARD2_1) -namespace System.Drawing -{ - internal class ColorExt - { - public static bool IsKnownColor(Color color) - { - return color.IsKnownColor; - } - - public static KnownColor ToKnownColor(Color c) - { - return c.ToKnownColor(); - } - - public static Color FromKnownColor(KnownColor knownColor) - { - return Color.FromKnownColor(knownColor); - } - - public static bool IsSystemColor(Color c) - { - return c.IsSystemColor; - } - } -} -#endif \ No newline at end of file diff --git a/FastReport.OpenSource/DotNetClasses/ColorConverter.cs b/FastReport.OpenSource/DotNetClasses/ColorConverter.cs deleted file mode 100644 index 75c2c779..00000000 --- a/FastReport.OpenSource/DotNetClasses/ColorConverter.cs +++ /dev/null @@ -1,480 +0,0 @@ -#if NETSTANDARD2_0 || NETSTANDARD2_1 -using System; -using System.Collections; -using System.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design.Serialization; -using System.Diagnostics.CodeAnalysis; -using System.Globalization; -using System.Reflection; -using System.Text; - -namespace System.Drawing -{ - public class ColorConverter : TypeConverter - { - private static string ColorConstantsLock = "colorConstants"; - private static Hashtable colorConstants; - private static string SystemColorConstantsLock = "systemColorConstants"; - private static Hashtable systemColorConstants; - private static string ValuesLock = "values"; - private static StandardValuesCollection values; - - /// - /// - /// [To be supplied.] - /// - public ColorConverter() - { - } - - /// - /// - /// Hashtable of color / value pairs (color name is key) - /// for standard colors. - /// - private static Hashtable Colors - { - get - { - if (colorConstants == null) - { - lock (ColorConstantsLock) - { - if (colorConstants == null) - { - Hashtable tempHash = new Hashtable(StringComparer.OrdinalIgnoreCase); - FillConstants(tempHash, typeof(Color)); - colorConstants = tempHash; - } - } - } - - return colorConstants; - } - } - - /// - /// - /// Hashtable of color / value pairs (color name is key) - /// for system colors. - /// - private static Hashtable SystemColors - { - get - { - if (systemColorConstants == null) - { - lock (SystemColorConstantsLock) - { - if (systemColorConstants == null) - { - Hashtable tempHash = new Hashtable(StringComparer.OrdinalIgnoreCase); - FillConstants(tempHash, typeof(System.Drawing.SystemColors)); - systemColorConstants = tempHash; - } - } - } - - return systemColorConstants; - } - } - - /// - /// - /// Determines if this converter can convert an object in the given source - /// type to the native type of the converter. - /// - public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) - { - if (sourceType == typeof(string)) - { - return true; - } - return base.CanConvertFrom(context, sourceType); - } - - /// - /// - /// Gets a value indicating whether this converter can - /// convert an object to the given destination type using the context. - /// - public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) - { - if (destinationType == typeof(InstanceDescriptor)) - { - return true; - } - return base.CanConvertTo(context, destinationType); - } - - internal static object GetNamedColor(string name) - { - object color = null; - // First, check to see if this is a standard name. - // - color = Colors[name]; - if (color != null) - { - return color; - } - // Ok, how about a system color? - // - color = SystemColors[name]; - return color; - } - - /// - /// - /// Converts the given object to the converter's native type. - /// - [SuppressMessage("Microsoft.Performance", "CA1808:AvoidCallsThatBoxValueTypes")] - public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) - { - string strValue = value as string; - if (strValue != null) - { - object obj = null; - string text = strValue.Trim(); - - if (text.Length == 0) - { - obj = Color.Empty; - } - else - { - // First, check to see if this is a standard name. - // - obj = GetNamedColor(text); - - if (obj == null) - { - if (culture == null) - { - culture = CultureInfo.CurrentCulture; - } - - char sep = culture.TextInfo.ListSeparator[0]; - bool tryMappingToKnownColor = true; - - TypeConverter intConverter = TypeDescriptor.GetConverter(typeof(int)); - - // If the value is a 6 digit hex number only, then - // we want to treat the Alpha as 255, not 0 - // - if (text.IndexOf(sep) == -1) - { - - // text can be '' (empty quoted string) - if (text.Length >= 2 && (text[0] == '\'' || text[0] == '"') && text[0] == text[text.Length - 1]) - { - // In quotes means a named value - string colorName = text.Substring(1, text.Length - 2); - obj = Color.FromName(colorName); - tryMappingToKnownColor = false; - } - else if ((text.Length == 7 && text[0] == '#') || - (text.Length == 8 && (text.StartsWith("0x") || text.StartsWith("0X"))) || - (text.Length == 8 && (text.StartsWith("&h") || text.StartsWith("&H")))) - { - // Note: ConvertFromString will raise exception if value cannot be converted. - obj = Color.FromArgb(unchecked((int)(0xFF000000 | (uint)(int)intConverter.ConvertFromString(context, culture, text)))); - } - } - - // Nope. Parse the RGBA from the text. - // - if (obj == null) - { - string[] tokens = text.Split(new char[] { sep }); - int[] values = new int[tokens.Length]; - for (int i = 0; i < values.Length; i++) - { - values[i] = unchecked((int)intConverter.ConvertFromString(context, culture, tokens[i])); - } - - // We should now have a number of parsed integer values. - // We support 1, 3, or 4 arguments: - // - // 1 -- full ARGB encoded - // 3 -- RGB - // 4 -- ARGB - // - switch (values.Length) - { - case 1: - obj = Color.FromArgb(values[0]); - break; - - case 3: - obj = Color.FromArgb(values[0], values[1], values[2]); - break; - - case 4: - obj = Color.FromArgb(values[0], values[1], values[2], values[3]); - break; - } - tryMappingToKnownColor = true; - } - - if ((obj != null) && tryMappingToKnownColor) - { - - // Now check to see if this color matches one of our known colors. - // If it does, then substitute it. We can only do this for "Colors" - // because system colors morph with user settings. - // - int targetARGB = ((Color)obj).ToArgb(); - - foreach (Color c in Colors.Values) - { - if (c.ToArgb() == targetARGB) - { - obj = c; - break; - } - } - } - } - - if (obj == null) - { - //throw new ArgumentException(SR.GetString(SR.InvalidColor, text)); - } - } - return obj; - } - return base.ConvertFrom(context, culture, value); - } - - /// - /// - /// Converts the given object to another type. The most common types to convert - /// are to and from a string object. The default implementation will make a call - /// to ToString on the object if the object is valid and if the destination - /// type is string. If this cannot convert to the desitnation type, this will - /// throw a NotSupportedException. - /// - public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) - { - if (destinationType == null) - { - throw new ArgumentNullException("destinationType"); - } - - if (value is Color) - { - if (destinationType == typeof(string)) - { - Color c = (Color)value; - - if (c == Color.Empty) - { - return string.Empty; - } - else - { - // If this is a known color, then Color can provide its own - // name. Otherwise, we fabricate an ARGB value for it. - // - if (ColorExt.IsKnownColor( c)) - { - return c.Name; - } - else if (c.IsNamedColor) - { - return "'" + c.Name + "'"; - } - else - { - if (culture == null) - { - culture = CultureInfo.CurrentCulture; - } - string sep = culture.TextInfo.ListSeparator + " "; - TypeConverter intConverter = TypeDescriptor.GetConverter(typeof(int)); - string[] args; - int nArg = 0; - - if (c.A < 255) - { - args = new string[4]; - args[nArg++] = intConverter.ConvertToString(context, culture, (object)c.A); - } - else - { - args = new string[3]; - } - - // Note: ConvertToString will raise exception if value cannot be converted. - args[nArg++] = intConverter.ConvertToString(context, culture, (object)c.R); - args[nArg++] = intConverter.ConvertToString(context, culture, (object)c.G); - args[nArg++] = intConverter.ConvertToString(context, culture, (object)c.B); - - // Now slam all of these together with the fantastic Join - // method. - // - return string.Join(sep, args); - } - } - } - if (destinationType == typeof(InstanceDescriptor)) - { - MemberInfo member = null; - object[] args = null; - - Color c = (Color)value; - - if (c.IsEmpty) - { - member = typeof(Color).GetField("Empty"); - } - else if (ColorExt.IsSystemColor(c)) - { - member = typeof(SystemColors).GetProperty(c.Name); - } - else if (ColorExt.IsKnownColor(c)) - { - member = typeof(Color).GetProperty(c.Name); - } - else if (c.A != 255) - { - member = typeof(Color).GetMethod("FromArgb", new Type[] { typeof(int), typeof(int), typeof(int), typeof(int) }); - args = new object[] { c.A, c.R, c.G, c.B }; - } - else if (c.IsNamedColor) - { - member = typeof(Color).GetMethod("FromName", new Type[] { typeof(string) }); - args = new object[] { c.Name }; - } - else - { - member = typeof(Color).GetMethod("FromArgb", new Type[] { typeof(int), typeof(int), typeof(int) }); - args = new object[] { c.R, c.G, c.B }; - } - - //Debug.Assert(member != null, "Could not convert color to member. Did someone change method name / signature and not update Colorconverter?"); - if (member != null) - { - return new InstanceDescriptor(member, args); - } - else - { - return null; - } - } - } - - return base.ConvertTo(context, culture, value, destinationType); - } - - /// - /// - /// Fills the given hashtable with field name / value pairs. It walks all public static - /// properties of enumType that have a property type of Color. - /// - private static void FillConstants(Hashtable hash, Type enumType) - { - MethodAttributes attrs = MethodAttributes.Public | MethodAttributes.Static; - PropertyInfo[] props = enumType.GetProperties(); - - for (int i = 0; i < props.Length; i++) - { - PropertyInfo prop = props[i]; - if (prop.PropertyType == typeof(Color)) - { - MethodInfo method = prop.GetGetMethod(); - if (method != null && (method.Attributes & attrs) == attrs) - { - object[] tempIndex = null; - hash[prop.Name] = prop.GetValue(null, tempIndex); - } - } - } - } - - /// - /// - /// Retrieves a collection containing a set of standard values - /// for the data type this validator is designed for. This - /// will return null if the data type does not support a - /// standard set of values. - /// - public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) - { - if (values == null) - { - lock (ValuesLock) - { - if (values == null) - { - - // We must take the value from each hashtable and combine them. - // - ArrayList arrayValues = new ArrayList(); - arrayValues.AddRange(Colors.Values); - arrayValues.AddRange(SystemColors.Values); - - // Now, we have a couple of colors that have the same names but - // are identical values. Look for these and remove them. Too - // bad this is n^2. - // - int count = arrayValues.Count; - for (int i = 0; i < count - 1; i++) - { - for (int j = i + 1; j < count; j++) - { - if (arrayValues[i].Equals(arrayValues[j])) - { - // Remove this item! - // - arrayValues.RemoveAt(j); - count--; - j--; - } - } - } - - // Sort the array. - // - arrayValues.Sort(0, arrayValues.Count, new ColorComparer()); - values = new StandardValuesCollection(arrayValues.ToArray()); - } - } - } - - return values; - } - - /// - /// - /// Determines if this object supports a standard set of values - /// that can be picked from a list. - /// - public override bool GetStandardValuesSupported(ITypeDescriptorContext context) - { - return true; - } - - /// - /// - /// IComparer for color values. This takes color values but compares their - /// names. - /// - private class ColorComparer : IComparer - { - - public int Compare(object left, object right) - { - Color cLeft = (Color)left; - Color cRight = (Color)right; - return string.Compare(cLeft.Name, cRight.Name, false, CultureInfo.InvariantCulture); - } - } - } - //internal Color ConvertFromInvariantString(string value) - //{ - // return (Color)TypeDescriptor.GetConverter(typeof(Color)).ConvertFromInvariantString(value); - //} -} -#endif \ No newline at end of file diff --git a/FastReport.OpenSource/DotNetClasses/ColorTranslator.cs b/FastReport.OpenSource/DotNetClasses/ColorTranslator.cs deleted file mode 100644 index 83a1bd39..00000000 --- a/FastReport.OpenSource/DotNetClasses/ColorTranslator.cs +++ /dev/null @@ -1,180 +0,0 @@ -#if NETSTANDARD2_0 || NETSTANDARD2_1 -using System; -using System.Collections; -using System.Collections.Generic; -using System.ComponentModel; -using System.Globalization; -using System.Text; - -namespace System.Drawing -{ - //internal class ColorTranslator - //{ - - // private static Hashtable htmlSysColorTable; - - - // public static string ToHtml(Color c) - // { - // string colorString = String.Empty; - - // if (c.IsEmpty) - // return colorString; - // bool flag = true; - // if (ColorExt.IsKnownColor(c)) - // { - // flag = false; - // switch (ColorExt.ToKnownColor(c)) - // { - // case KnownColor.ActiveBorder: colorString = "activeborder"; break; - // case KnownColor.GradientActiveCaption: - // case KnownColor.ActiveCaption: colorString = "activecaption"; break; - // case KnownColor.AppWorkspace: colorString = "appworkspace"; break; - // case KnownColor.Desktop: colorString = "background"; break; - // case KnownColor.Control: colorString = "buttonface"; break; - // case KnownColor.ControlLight: colorString = "buttonface"; break; - // case KnownColor.ControlDark: colorString = "buttonshadow"; break; - // case KnownColor.ControlText: colorString = "buttontext"; break; - // case KnownColor.ActiveCaptionText: colorString = "captiontext"; break; - // case KnownColor.GrayText: colorString = "graytext"; break; - // case KnownColor.HotTrack: - // case KnownColor.Highlight: colorString = "highlight"; break; - // case KnownColor.MenuHighlight: - // case KnownColor.HighlightText: colorString = "highlighttext"; break; - // case KnownColor.InactiveBorder: colorString = "inactiveborder"; break; - // case KnownColor.GradientInactiveCaption: - // case KnownColor.InactiveCaption: colorString = "inactivecaption"; break; - // case KnownColor.InactiveCaptionText: colorString = "inactivecaptiontext"; break; - // case KnownColor.Info: colorString = "infobackground"; break; - // case KnownColor.InfoText: colorString = "infotext"; break; - // case KnownColor.MenuBar: - // case KnownColor.Menu: colorString = "menu"; break; - // case KnownColor.MenuText: colorString = "menutext"; break; - // case KnownColor.ScrollBar: colorString = "scrollbar"; break; - // case KnownColor.ControlDarkDark: colorString = "threeddarkshadow"; break; - // case KnownColor.ControlLightLight: colorString = "buttonhighlight"; break; - // case KnownColor.Window: colorString = "window"; break; - // case KnownColor.WindowFrame: colorString = "windowframe"; break; - // case KnownColor.WindowText: colorString = "windowtext"; break; - // default: flag = true; break; - // } - // } - // if (flag) - // { - // if (c.IsNamedColor) - // { - // if (c == Color.LightGray) - // { - // // special case due to mismatch between Html and enum spelling - // colorString = "LightGrey"; - // } - // else - // { - // colorString = c.Name; - // } - // } - // else - // { - // colorString = "#" + c.R.ToString("X2", null) + - // c.G.ToString("X2", null) + - // c.B.ToString("X2", null); - // } - // } - // return colorString; - // } - - // public static Color FromHtml(string htmlColor) - // { - // Color c = Color.Empty; - - // // empty color - // if ((htmlColor == null) || (htmlColor.Length == 0)) - // return c; - - // // #RRGGBB or #RGB - // if ((htmlColor[0] == '#') && - // ((htmlColor.Length == 7) || (htmlColor.Length == 4))) - // { - - // if (htmlColor.Length == 7) - // { - // c = Color.FromArgb(Convert.ToInt32(htmlColor.Substring(1, 2), 16), - // Convert.ToInt32(htmlColor.Substring(3, 2), 16), - // Convert.ToInt32(htmlColor.Substring(5, 2), 16)); - // } - // else - // { - // string r = Char.ToString(htmlColor[1]); - // string g = Char.ToString(htmlColor[2]); - // string b = Char.ToString(htmlColor[3]); - - // c = Color.FromArgb(Convert.ToInt32(r + r, 16), - // Convert.ToInt32(g + g, 16), - // Convert.ToInt32(b + b, 16)); - // } - // } - - // // special case. Html requires LightGrey, but .NET uses LightGray - // if (c.IsEmpty && String.Equals(htmlColor, "LightGrey", StringComparison.OrdinalIgnoreCase)) - // { - // c = Color.LightGray; - // } - - // // System color - // if (c.IsEmpty) - // { - // if (htmlSysColorTable == null) - // { - // InitializeHtmlSysColorTable(); - // } - - // object o = htmlSysColorTable[htmlColor.ToLower(CultureInfo.InvariantCulture)]; - // if (o != null) - // { - // c = (Color)o; - // } - // } - - // // resort to type converter which will handle named colors - // if (c.IsEmpty) - // { - // c = (Color)TypeDescriptor.GetConverter(typeof(Color)).ConvertFromString(htmlColor); - // } - - // return c; - // } - - // private static void InitializeHtmlSysColorTable() - // { - // htmlSysColorTable = new Hashtable(26); - // htmlSysColorTable["activeborder"] = ColorExt.FromKnownColor(KnownColor.ActiveBorder); - // htmlSysColorTable["activecaption"] = ColorExt.FromKnownColor(KnownColor.ActiveCaption); - // htmlSysColorTable["appworkspace"] = ColorExt.FromKnownColor(KnownColor.AppWorkspace); - // htmlSysColorTable["background"] = ColorExt.FromKnownColor(KnownColor.Desktop); - // htmlSysColorTable["buttonface"] = ColorExt.FromKnownColor(KnownColor.Control); - // htmlSysColorTable["buttonhighlight"] = ColorExt.FromKnownColor(KnownColor.ControlLightLight); - // htmlSysColorTable["buttonshadow"] = ColorExt.FromKnownColor(KnownColor.ControlDark); - // htmlSysColorTable["buttontext"] = ColorExt.FromKnownColor(KnownColor.ControlText); - // htmlSysColorTable["captiontext"] = ColorExt.FromKnownColor(KnownColor.ActiveCaptionText); - // htmlSysColorTable["graytext"] = ColorExt.FromKnownColor(KnownColor.GrayText); - // htmlSysColorTable["highlight"] = ColorExt.FromKnownColor(KnownColor.Highlight); - // htmlSysColorTable["highlighttext"] = ColorExt.FromKnownColor(KnownColor.HighlightText); - // htmlSysColorTable["inactiveborder"] = ColorExt.FromKnownColor(KnownColor.InactiveBorder); - // htmlSysColorTable["inactivecaption"] = ColorExt.FromKnownColor(KnownColor.InactiveCaption); - // htmlSysColorTable["inactivecaptiontext"] = ColorExt.FromKnownColor(KnownColor.InactiveCaptionText); - // htmlSysColorTable["infobackground"] = ColorExt.FromKnownColor(KnownColor.Info); - // htmlSysColorTable["infotext"] = ColorExt.FromKnownColor(KnownColor.InfoText); - // htmlSysColorTable["menu"] = ColorExt.FromKnownColor(KnownColor.Menu); - // htmlSysColorTable["menutext"] = ColorExt.FromKnownColor(KnownColor.MenuText); - // htmlSysColorTable["scrollbar"] = ColorExt.FromKnownColor(KnownColor.ScrollBar); - // htmlSysColorTable["threeddarkshadow"] = ColorExt.FromKnownColor(KnownColor.ControlDarkDark); - // htmlSysColorTable["threedface"] = ColorExt.FromKnownColor(KnownColor.Control); - // htmlSysColorTable["threedhighlight"] = ColorExt.FromKnownColor(KnownColor.ControlLight); - // htmlSysColorTable["threedlightshadow"] = ColorExt.FromKnownColor(KnownColor.ControlLightLight); - // htmlSysColorTable["window"] = ColorExt.FromKnownColor(KnownColor.Window); - // htmlSysColorTable["windowframe"] = ColorExt.FromKnownColor(KnownColor.WindowFrame); - // htmlSysColorTable["windowtext"] = ColorExt.FromKnownColor(KnownColor.WindowText); - // } - //} -} -#endif \ No newline at end of file diff --git a/FastReport.OpenSource/DotNetClasses/CompilerError.cs b/FastReport.OpenSource/DotNetClasses/CompilerError.cs deleted file mode 100644 index 5a7a01ec..00000000 --- a/FastReport.OpenSource/DotNetClasses/CompilerError.cs +++ /dev/null @@ -1,17 +0,0 @@ -#if NETSTANDARD2_0 || NETSTANDARD2_1 -using System; -using System.Collections.Generic; -using System.Text; - -namespace System.CodeDom.Compiler -{ - internal class CompilerError - { - public int Line { get; internal set; } - public object Column { get; internal set; } - public object ErrorText { get; internal set; } - public object ErrorNumber { get; internal set; } - } -} - -#endif \ No newline at end of file diff --git a/FastReport.OpenSource/DotNetClasses/CompilerParameters.cs b/FastReport.OpenSource/DotNetClasses/CompilerParameters.cs deleted file mode 100644 index adae6d3e..00000000 --- a/FastReport.OpenSource/DotNetClasses/CompilerParameters.cs +++ /dev/null @@ -1,17 +0,0 @@ -#if NETSTANDARD2_0 || NETSTANDARD2_1 -using System; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.Text; - -namespace System.CodeDom.Compiler -{ - internal class CompilerParameters - { - public bool GenerateInMemory { get; internal set; } - public StringCollection ReferencedAssemblies { get; internal set; } = new StringCollection(); - public TempFileCollection TempFiles { get; internal set; } = new TempFileCollection("", false); - } -} - -#endif \ No newline at end of file diff --git a/FastReport.OpenSource/DotNetClasses/CompilerResults.cs b/FastReport.OpenSource/DotNetClasses/CompilerResults.cs deleted file mode 100644 index ba0a365e..00000000 --- a/FastReport.OpenSource/DotNetClasses/CompilerResults.cs +++ /dev/null @@ -1,16 +0,0 @@ -#if NETSTANDARD2_0 || NETSTANDARD2_1 || NETCOREAPP -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Text; - -namespace System.CodeDom.Compiler -{ - internal class CompilerResults - { - public List Errors { get; internal set; } = new List(); - public Assembly CompiledAssembly { get; internal set; } = null; - } -} - -#endif \ No newline at end of file diff --git a/FastReport.OpenSource/DotNetClasses/SystemColors.cs b/FastReport.OpenSource/DotNetClasses/SystemColors.cs deleted file mode 100644 index 4e22c9b0..00000000 --- a/FastReport.OpenSource/DotNetClasses/SystemColors.cs +++ /dev/null @@ -1,47 +0,0 @@ -#if NETSTANDARD2_0 || NETSTANDARD2_1 -using System; -using System.Collections.Generic; -using System.Text; - -namespace System.Drawing -{ - internal static class SystemColors - { - - public static Color ActiveBorder => ColorExt.FromKnownColor(KnownColor.ActiveBorder); - public static Color ActiveCaption => ColorExt.FromKnownColor(KnownColor.ActiveCaption); - public static Color ActiveCaptionText => ColorExt.FromKnownColor(KnownColor.ActiveCaptionText); - public static Color AppWorkspace => ColorExt.FromKnownColor(KnownColor.AppWorkspace); - public static Color ButtonFace => ColorExt.FromKnownColor(KnownColor.ButtonFace); - public static Color ButtonHighlight => ColorExt.FromKnownColor(KnownColor.ButtonHighlight); - public static Color ButtonShadow => ColorExt.FromKnownColor(KnownColor.ButtonShadow); - public static Color Control => ColorExt.FromKnownColor(KnownColor.Control); - public static Color ControlDark => ColorExt.FromKnownColor(KnownColor.ControlDark); - public static Color ControlDarkDark => ColorExt.FromKnownColor(KnownColor.ControlDarkDark); - public static Color ControlLight => ColorExt.FromKnownColor(KnownColor.ControlLight); - public static Color ControlLightLight => ColorExt.FromKnownColor(KnownColor.ControlLightLight); - public static Color ControlText => ColorExt.FromKnownColor(KnownColor.ControlText); - public static Color Desktop => ColorExt.FromKnownColor(KnownColor.Desktop); - public static Color GradientActiveCaption => ColorExt.FromKnownColor(KnownColor.GradientActiveCaption); - public static Color GradientInactiveCaption => ColorExt.FromKnownColor(KnownColor.GradientInactiveCaption); - public static Color GrayText => ColorExt.FromKnownColor(KnownColor.GrayText); - public static Color Highlight => ColorExt.FromKnownColor(KnownColor.Highlight); - public static Color HighlightText => ColorExt.FromKnownColor(KnownColor.HighlightText); - public static Color HotTrack => ColorExt.FromKnownColor(KnownColor.HotTrack); - public static Color InactiveBorder => ColorExt.FromKnownColor(KnownColor.InactiveBorder); - public static Color InactiveCaption => ColorExt.FromKnownColor(KnownColor.InactiveCaption); - public static Color InactiveCaptionText => ColorExt.FromKnownColor(KnownColor.InactiveCaptionText); - public static Color Info => ColorExt.FromKnownColor(KnownColor.Info); - public static Color InfoText => ColorExt.FromKnownColor(KnownColor.InfoText); - public static Color Menu => ColorExt.FromKnownColor(KnownColor.Menu); - public static Color MenuBar => ColorExt.FromKnownColor(KnownColor.MenuBar); - public static Color MenuHighlight => ColorExt.FromKnownColor(KnownColor.MenuHighlight); - public static Color MenuText => ColorExt.FromKnownColor(KnownColor.MenuText); - public static Color ScrollBar => ColorExt.FromKnownColor(KnownColor.ScrollBar); - public static Color Window => ColorExt.FromKnownColor(KnownColor.Window); - public static Color WindowFrame => ColorExt.FromKnownColor(KnownColor.WindowFrame); - public static Color WindowText => ColorExt.FromKnownColor(KnownColor.WindowText); - } -} - -#endif \ No newline at end of file diff --git a/FastReport.OpenSource/DotNetClasses/TempFileCollection.cs b/FastReport.OpenSource/DotNetClasses/TempFileCollection.cs deleted file mode 100644 index fff11dba..00000000 --- a/FastReport.OpenSource/DotNetClasses/TempFileCollection.cs +++ /dev/null @@ -1,21 +0,0 @@ -#if NETSTANDARD2_0 || NETSTANDARD2_1 -using System; -using System.Collections.Generic; -using System.Text; - -namespace System.CodeDom.Compiler -{ - internal class TempFileCollection - { - public string tempFolder; - public bool v; - - public TempFileCollection(string tempFolder, bool v) - { - this.tempFolder = tempFolder; - this.v = v; - } - } -} - -#endif \ No newline at end of file diff --git a/FastReport.OpenSource/DotNetClasses/UITypeEditor.cs b/FastReport.OpenSource/DotNetClasses/UITypeEditor.cs deleted file mode 100644 index 717125ae..00000000 --- a/FastReport.OpenSource/DotNetClasses/UITypeEditor.cs +++ /dev/null @@ -1,10 +0,0 @@ -#if NETSTANDARD2_1 || NETSTANDARD2_0 - -namespace System.Drawing.Design -{ - class UITypeEditor - { - - } -} -#endif \ No newline at end of file diff --git a/FastReport.OpenSource/DotNetClasses/VBCodeProvider.cs b/FastReport.OpenSource/DotNetClasses/VBCodeProvider.cs deleted file mode 100644 index 06538ee9..00000000 --- a/FastReport.OpenSource/DotNetClasses/VBCodeProvider.cs +++ /dev/null @@ -1,84 +0,0 @@ -#if NETSTANDARD2_0 || NETSTANDARD2_1 || NETCOREAPP -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.VisualBasic; -using System; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using System.Text; - -namespace Microsoft.VisualBasic -{ - internal class VBCodeProvider : CodeDomProvider - { - - - public override CompilerResults CompileAssemblyFromSource(CompilerParameters cp, string code) - { - CodeAnalysis.SyntaxTree codeTree = Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxTree.ParseText(code); - VisualBasicCompilationOptions options = new VisualBasicCompilationOptions( - OutputKind.DynamicallyLinkedLibrary, - true, - optimizationLevel: OptimizationLevel.Release, - generalDiagnosticOption: ReportDiagnostic.Default); - - List references = new List(); - - - foreach (string reference in cp.ReferencedAssemblies) - references.Add(GetReference(reference)); - - AddExtraAssemblies(cp.ReferencedAssemblies, references); - - - - - Compilation compilation = VisualBasicCompilation.Create( - "_" + Guid.NewGuid().ToString("D"), new SyntaxTree[] { codeTree }, - references: references, options: options.WithEmbedVbCoreRuntime(true) - ); - - - - using (MemoryStream ms = new MemoryStream()) - { - CodeAnalysis.Emit.EmitResult results = compilation.Emit(ms); - if (results.Success) - { - return new CompilerResults() - { - CompiledAssembly = Assembly.Load(ms.ToArray()) - }; - } - else - { - CompilerResults result = new CompilerResults(); - foreach (Diagnostic d in results.Diagnostics) - { - if (d.Severity == DiagnosticSeverity.Error) - { - result.Errors.Add(new CompilerError() - { - ErrorText = d.GetMessage(), - ErrorNumber = d.Id, - Line = d.Location.GetLineSpan().StartLinePosition.Line, - Column = d.Location.GetLineSpan().StartLinePosition.Character - }); - } - } - return result; - } - } - - } - - public override void Dispose() - { - - } - - - } -} -#endif \ No newline at end of file diff --git a/FastReport.OpenSource/DotNetClasses/WindowsFormsReplacement.BindingSource.cs b/FastReport.OpenSource/DotNetClasses/WindowsFormsReplacement.BindingSource.cs deleted file mode 100644 index 5890b8d2..00000000 --- a/FastReport.OpenSource/DotNetClasses/WindowsFormsReplacement.BindingSource.cs +++ /dev/null @@ -1,150 +0,0 @@ -#if NETSTANDARD2_0 || NETSTANDARD2_1 -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// Copyright (c) 2007 Novell, Inc. -// - -// Modified by: Alexander Tzyganenko - -using System; -using System.ComponentModel; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using System.Text; - -namespace System.Windows.Forms -{ - internal class BindingSource : Component - { - IList list; - object datasource; - - public object DataSource - { - get { return datasource; } - set - { - if (datasource != value) - { - datasource = value; - ResetList(); - } - } - } - - IList GetListFromEnumerable(IEnumerable enumerable) - { - IList l = null; - - IEnumerator e = enumerable.GetEnumerator(); - - if (enumerable is string) - { - /* special case this.. seems to be the only one .net special cases? */ - l = new BindingList(); - } - else - { - /* try to figure out the type based on - * the first element, if there is - * one */ - object first = null; - if (e.MoveNext()) - { - first = e.Current; - } - - if (first == null) - { - return null; - } - else - { - Type t = typeof(BindingList<>).MakeGenericType(new Type[] { first.GetType() }); - l = (IList)Activator.CreateInstance(t); - } - } - - e.Reset(); - while (e.MoveNext()) - { - l.Add(e.Current); - } - - return l; - } - - void ResetList() - { - IList l; - object source = ListBindingHelper.GetList(datasource, null); - - // - // If original source is null, then create a new object list - // Otherwise, try to infer the list item type - // - - if (datasource == null) - { - l = new BindingList(); - } - else if (source == null) - { - //Infer type based on datasource and datamember, - // where datasource is an empty IEnumerable - // and need to find out the datamember type - - Type property_type = ListBindingHelper.GetListItemProperties(datasource)[""].PropertyType; - Type t = typeof(BindingList<>).MakeGenericType(new Type[] { property_type }); - l = (IList)Activator.CreateInstance(t); - } - else if (source is IList) - { - l = (IList)source; - } - else if (source is IEnumerable) - { - IList new_list = GetListFromEnumerable((IEnumerable)source); - l = new_list == null ? list : new_list; - } - else if (source is Type) - { - Type t = typeof(BindingList<>).MakeGenericType(new Type[] { (Type)source }); - l = (IList)Activator.CreateInstance(t); - } - else - { - Type t = typeof(BindingList<>).MakeGenericType(new Type[] { source.GetType() }); - l = (IList)Activator.CreateInstance(t); - l.Add(source); - } - - list = l; - } - - public virtual PropertyDescriptorCollection GetItemProperties(PropertyDescriptor[] listAccessors) - { - return ListBindingHelper.GetListItemProperties(list, listAccessors); - } - } -} - -#endif \ No newline at end of file diff --git a/FastReport.OpenSource/DotNetClasses/WindowsFormsReplacement.ListBindingHelper.cs b/FastReport.OpenSource/DotNetClasses/WindowsFormsReplacement.ListBindingHelper.cs deleted file mode 100644 index 06b4b724..00000000 --- a/FastReport.OpenSource/DotNetClasses/WindowsFormsReplacement.ListBindingHelper.cs +++ /dev/null @@ -1,180 +0,0 @@ -#if NETSTANDARD2_0 || NETSTANDARD2_1 -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// Copyright (c) 2007 Novell, Inc. -// -// Author: -// Carlos Alberto Cortez -// Ivan Zlatev -// - -// Modified by: Alexander Tzyganenko - -using System; -using System.Collections; -using System.ComponentModel; -using System.Reflection; -using System.Collections.Generic; - -namespace System.Windows.Forms -{ - - internal static class ListBindingHelper - { - public static object GetList(object list) - { - if (list is IListSource) - return ((IListSource)list).GetList(); - return list; - } - - public static object GetList(object dataSource, string dataMember) - { - dataSource = GetList(dataSource); - if (dataSource == null || dataMember == null || dataMember.Length == 0) - return dataSource; - - PropertyDescriptor property = GetListItemProperties(dataSource).Find(dataMember, true); - if (property == null) - throw new ArgumentException("dataMember"); - - object item = null; - - if (dataSource is IEnumerable) - { - if (dataSource is IList) - { - IList list = (IList)dataSource; - item = list.Count > 0 ? list[0] : null; - } - else - { - IEnumerator e = ((IEnumerable)dataSource).GetEnumerator(); - if (e != null && e.MoveNext()) - item = e.Current; - } - } - else - { - item = dataSource; - } - - if (item != null) - return property.GetValue(item); - return null; - } - - public static Type GetListItemType(object list) - { - return GetListItemType(list, String.Empty); - } - - public static Type GetListItemType(object dataSource, string dataMember) - { - if (dataSource == null) - return null; - - if (dataMember != null && dataMember.Length > 0) - { - PropertyDescriptor property = GetProperty(dataSource, dataMember); - if (property == null) - return typeof(object); - - return property.PropertyType; - } - - if (dataSource is Array) - return dataSource.GetType().GetElementType(); - - // IEnumerable seems to have higher precedence over IList - if (dataSource is IEnumerable) - { - IEnumerator enumerator = ((IEnumerable)dataSource).GetEnumerator(); - if (enumerator.MoveNext() && enumerator.Current != null) - return enumerator.Current.GetType(); - - if (dataSource is IList || dataSource.GetType() == typeof(IList<>)) - { - PropertyInfo property = GetPropertyByReflection(dataSource.GetType(), "Item"); - if (property != null) // `Item' could be interface-explicit, and thus private - return property.PropertyType; - } - - // fallback to object - return typeof(object); - } - - return dataSource.GetType(); - } - - public static PropertyDescriptorCollection GetListItemProperties(object list) - { - return GetListItemProperties(list, null); - } - - public static PropertyDescriptorCollection GetListItemProperties(object list, PropertyDescriptor[] listAccessors) - { - list = GetList(list); - - if (list == null) - return new PropertyDescriptorCollection(null); - - if (list is ITypedList) - return ((ITypedList)list).GetItemProperties(listAccessors); - - if (listAccessors == null || listAccessors.Length == 0) - { - Type item_type = GetListItemType(list); - return TypeDescriptor.GetProperties(item_type, - new Attribute[] { new BrowsableAttribute(true) }); - } - - // Take into account only the first property - Type property_type = listAccessors[0].PropertyType; - if (typeof(IList).IsAssignableFrom(property_type) || typeof(IList<>).IsAssignableFrom(property_type)) - { - - PropertyInfo property = GetPropertyByReflection(property_type, "Item"); - return TypeDescriptor.GetProperties(property.PropertyType); - } - - return new PropertyDescriptorCollection(new PropertyDescriptor[0]); - } - - static PropertyDescriptor GetProperty(object obj, string property_name) - { - return TypeDescriptor.GetProperties(obj, - new Attribute[] { new BrowsableAttribute(true) })[property_name]; - } - - // - // Need to use reflection as we need to bypass the TypeDescriptor.GetProperties () limitations - // - static PropertyInfo GetPropertyByReflection(Type type, string property_name) - { - foreach (PropertyInfo prop in type.GetProperties(BindingFlags.Public | BindingFlags.Instance)) - if (prop.Name == property_name) - return prop; - - return null; - } - } -} -#endif \ No newline at end of file diff --git a/FastReport.OpenSource/DotNetClasses/WindowsFormsReplacement.cs b/FastReport.OpenSource/DotNetClasses/WindowsFormsReplacement.cs deleted file mode 100644 index da547b06..00000000 --- a/FastReport.OpenSource/DotNetClasses/WindowsFormsReplacement.cs +++ /dev/null @@ -1,979 +0,0 @@ -#if NETSTANDARD2_0 || NETSTANDARD2_1 -using System; -using System.Collections.Generic; -using System.Text; -using System.ComponentModel; -using FastReport.Utils; -using System.Globalization; -using System.Drawing; - - -#pragma warning disable 1591 // disable missing xml comments warning -#pragma warning disable FR0000 // Field must be texted in lowerCamelCase. - -namespace System.Windows.Forms -{ - #region Enums - [Flags] - public enum Keys - { - Modifiers = -65536, - None = 0, - LButton = 1, - RButton = 2, - Cancel = 3, - MButton = 4, - XButton1 = 5, - XButton2 = 6, - Back = 8, - Tab = 9, - LineFeed = 10, - Clear = 12, - Return = 13, - Enter = 13, - ShiftKey = 16, - ControlKey = 17, - Menu = 18, - Pause = 19, - Capital = 20, - CapsLock = 20, - KanaMode = 21, - HanguelMode = 21, - HangulMode = 21, - JunjaMode = 23, - FinalMode = 24, - HanjaMode = 25, - KanjiMode = 25, - Escape = 27, - IMEConvert = 28, - IMENonconvert = 29, - IMEAccept = 30, - IMEAceept = 30, - IMEModeChange = 31, - Space = 32, - Prior = 33, - PageUp = 33, - Next = 34, - PageDown = 34, - End = 35, - Home = 36, - Left = 37, - Up = 38, - Right = 39, - Down = 40, - Select = 41, - Print = 42, - Execute = 43, - Snapshot = 44, - PrintScreen = 44, - Insert = 45, - Delete = 46, - Help = 47, - D0 = 48, - D1 = 49, - D2 = 50, - D3 = 51, - D4 = 52, - D5 = 53, - D6 = 54, - D7 = 55, - D8 = 56, - D9 = 57, - A = 65, - B = 66, - C = 67, - D = 68, - E = 69, - F = 70, - G = 71, - H = 72, - I = 73, - J = 74, - K = 75, - L = 76, - M = 77, - N = 78, - O = 79, - P = 80, - Q = 81, - R = 82, - S = 83, - T = 84, - U = 85, - V = 86, - W = 87, - X = 88, - Y = 89, - Z = 90, - LWin = 91, - RWin = 92, - Apps = 93, - Sleep = 95, - NumPad0 = 96, - NumPad1 = 97, - NumPad2 = 98, - NumPad3 = 99, - NumPad4 = 100, - NumPad5 = 101, - NumPad6 = 102, - NumPad7 = 103, - NumPad8 = 104, - NumPad9 = 105, - Multiply = 106, - Add = 107, - Separator = 108, - Subtract = 109, - Decimal = 110, - Divide = 111, - F1 = 112, - F2 = 113, - F3 = 114, - F4 = 115, - F5 = 116, - F6 = 117, - F7 = 118, - F8 = 119, - F9 = 120, - F10 = 121, - F11 = 122, - F12 = 123, - F13 = 124, - F14 = 125, - F15 = 126, - F16 = 127, - F17 = 128, - F18 = 129, - F19 = 130, - F20 = 131, - F21 = 132, - F22 = 133, - F23 = 134, - F24 = 135, - NumLock = 144, - Scroll = 145, - LShiftKey = 160, - RShiftKey = 161, - LControlKey = 162, - RControlKey = 163, - LMenu = 164, - RMenu = 165, - BrowserBack = 166, - BrowserForward = 167, - BrowserRefresh = 168, - BrowserStop = 169, - BrowserSearch = 170, - BrowserFavorites = 171, - BrowserHome = 172, - VolumeMute = 173, - VolumeDown = 174, - VolumeUp = 175, - MediaNextTrack = 176, - MediaPreviousTrack = 177, - MediaStop = 178, - MediaPlayPause = 179, - LaunchMail = 180, - SelectMedia = 181, - LaunchApplication1 = 182, - LaunchApplication2 = 183, - OemSemicolon = 186, - Oem1 = 186, - Oemplus = 187, - Oemcomma = 188, - OemMinus = 189, - OemPeriod = 190, - OemQuestion = 191, - Oem2 = 191, - Oemtilde = 192, - Oem3 = 192, - OemOpenBrackets = 219, - Oem4 = 219, - OemPipe = 220, - Oem5 = 220, - OemCloseBrackets = 221, - Oem6 = 221, - OemQuotes = 222, - Oem7 = 222, - Oem8 = 223, - OemBackslash = 226, - Oem102 = 226, - ProcessKey = 229, - Packet = 231, - Attn = 246, - Crsel = 247, - Exsel = 248, - EraseEof = 249, - Play = 250, - Zoom = 251, - NoName = 252, - Pa1 = 253, - OemClear = 254, - KeyCode = 65535, - Shift = 65536, - Control = 131072, - Alt = 262144 - } - - [Flags] - public enum MouseButtons - { - None = 0, - Left = 1048576, - Right = 2097152, - Middle = 4194304, - XButton1 = 8388608, - XButton2 = 16777216 - } - - [Flags] - public enum AnchorStyles - { - None = 0, - Top = 1, - Bottom = 2, - Left = 4, - Right = 8 - } - - public enum DockStyle - { - None, - Top, - Bottom, - Left, - Right, - Fill - } - - public enum PictureBoxSizeMode - { - Normal, - StretchImage, - AutoSize, - CenterImage, - Zoom - } - - public enum RightToLeft - { - No, - Yes, - Inherit - } - - public enum TextImageRelation - { - Overlay, - ImageBeforeText, - TextBeforeImage, - ImageAboveText, - TextAboveImage - }; - - public enum DialogResult - { - None, - OK, - Cancel, - Abort, - Retry, - Ignore, - Yes, - No - } - - public enum Appearance - { - Normal, - Button - } - - public enum CheckState - { - Unchecked, - Checked, - Indeterminate - } - - public enum DrawMode - { - Normal, - OwnerDrawFixed, - OwnerDrawVariable - } - - public enum SelectionMode - { - None, - One, - MultiSimple, - MultiExtended - } - - public enum ComboBoxStyle - { - Simple, - DropDown, - DropDownList - } - - public enum LeftRightAlignment - { - Left, - Right - } - - public enum Day - { - Monday, - Tuesday, - Wednesday, - Thursday, - Friday, - Saturday, - Sunday, - Default - } - - public enum CharacterCasing - { - Normal, - Upper, - Lower - } - - public enum ScrollBars - { - None, - Horizontal, - Vertical, - Both - } - - public enum HorizontalAlignment - { - Left, - Right, - Center - } - - public enum DateTimePickerFormat - { - Long, - Short, - Time, - Custom - } - - public enum FormBorderStyle - { - None, - FixedSingle, - Fixed3D, - FixedDialog, - Sizable, - FixedToolWindow, - SizableToolWindow - } - - public enum FormStartPosition - { - Manual, - CenterScreen, - WindowsDefaultLocation, - WindowsDefaultBounds, - CenterParent - } - - public enum CloseReason - { - None, - WindowsShutDown, - MdiFormClosing, - UserClosing, - TaskManagerClosing, - FormOwnerClosing, - ApplicationExitCall - } - - public enum BorderStyle - { - Fixed3D, - FixedSingle, - None - } - - public enum ControlStyles - { - ContainerControl = 0x00000001, - UserPaint = 0x00000002, - Opaque = 0x00000004, - ResizeRedraw = 0x00000010, - FixedWidth = 0x00000020, - FixedHeight = 0x00000040, - StandardClick = 0x00000100, - Selectable = 0x00000200, - UserMouse = 0x00000400, - SupportsTransparentBackColor = 0x00000800, - StandardDoubleClick = 0x00001000, - AllPaintingInWmPaint = 0x00002000, - CacheText = 0x00004000, - EnableNotifyMessage = 0x00008000, - DoubleBuffer = 0x00010000, - OptimizedDoubleBuffer = 0x00020000, - UseTextForAccessibility = 0x00040000, - } - - [TypeConverter(typeof(PaddingConverter))] - public struct Padding - { - private int FLeft; - private int FTop; - private int FRight; - private int FBottom; - - public int Left { get => FLeft; set => FLeft = value; } - public int Top { get => FTop; set => FTop = value; } - public int Right { get => FRight; set => FRight = value; } - public int Bottom { get => FBottom; set => FBottom = value; } - - public static readonly Padding Empty = new Padding(0, 0, 0, 0); - - public Padding(int left, int top, int right, int bottom) - { - FLeft = left; - FTop = top; - FRight = right; - FBottom = bottom; - } - - public int Horizontal - { - get { return Left + Right; } - } - - public int Vertical - { - get { return Top + Bottom; } - } - - public static bool operator ==(Padding p1, Padding p2) - { - return p1.Left == p2.Left && p1.Top == p2.Top && p1.Right == p2.Right && p1.Bottom == p2.Bottom; - } - - public static bool operator !=(Padding p1, Padding p2) - { - return !(p1 == p2); - } - - public override int GetHashCode() - { - int hash = 17; - hash = hash * 31 + Left; - hash = hash * 31 + Top; - hash = hash * 31 + Right; - hash = hash * 31 + Bottom; - return hash; - } - - public override bool Equals(object obj) - { - return base.Equals(obj); - } - } - - internal class PaddingConverter : TypeConverter - { - public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) - { - if (sourceType == typeof(string)) - return true; - return base.CanConvertFrom(context, sourceType); - } - - public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) - { - if (destinationType == typeof(string)) - return true; - return base.CanConvertTo(context, destinationType); - } - - public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) - { - if (value is string) - { - string[] values = (value as string).Split(new char[] { ',' }); - int[] val = new int[values.Length]; - if (values.Length != 4) - throw new Exception("Padding: need 4 values to parse from string"); - for (int i = 0; i < values.Length; i++) - { - val[i] = (int)Converter.FromString(typeof(int), values[i]); - } - return new Padding(val[0], val[1], val[2], val[3]); - } - return base.ConvertFrom(context, culture, value); - } - - public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) - { - if (destinationType == typeof(string)) - { - if (value == null) - return ""; - Padding p = (Padding)value; - StringBuilder builder = new StringBuilder(); - builder.Append(Converter.ToString(p.Left)).Append(","); - builder.Append(Converter.ToString(p.Top)).Append(","); - builder.Append(Converter.ToString(p.Right)).Append(","); - builder.Append(Converter.ToString(p.Bottom)); - return builder.ToString(); - } - return base.ConvertTo(context, culture, value, destinationType); - } - } - #endregion - - - public class KeyEventArgs : EventArgs - { - public Keys KeyCode; - } - - public class KeyPressEventArgs : EventArgs - { - } - - public class MouseEventArgs : EventArgs - { - public int X, Y; - public MouseButtons Button; - public int Clicks; - public int Delta; - public MouseEventArgs(MouseButtons b, int a, int x, int y, int i) { } - } - - public class PaintEventArgs : EventArgs - { - public Graphics Graphics; - } - - public class InvalidateEventArgs : EventArgs - { - public Rectangle Rect; - public InvalidateEventArgs(Rectangle r) { } - } - - public class DateRangeEventArgs : EventArgs - { - } - - public class MeasureItemEventArgs : EventArgs - { - } - - public class DrawItemEventArgs : EventArgs - { - } - - public class ItemCheckEventArgs : EventArgs - { - } - - public class FormClosingEventArgs : CancelEventArgs - { - private CloseReason FCloseReason; - - public FormClosingEventArgs(CloseReason closeReason, bool cancel) - : base(cancel) - { - FCloseReason = closeReason; - } - - public CloseReason CloseReason - { - get { return FCloseReason; } - } - } - - public class FormClosedEventArgs : EventArgs - { - private CloseReason FCloseReason; - - public FormClosedEventArgs(CloseReason closeReason) - { - FCloseReason = closeReason; - } - - public CloseReason CloseReason - { - get { return FCloseReason; } - } - } - - public delegate void FormClosingEventHandler(object sender, FormClosingEventArgs e); - public delegate void FormClosedEventHandler(object sender, FormClosedEventArgs e); - public delegate void KeyEventHandler(object sender, KeyEventArgs e); - public delegate void KeyPressEventHandler(object sender, KeyPressEventArgs e); - public delegate void MouseEventHandler(object sender, MouseEventArgs e); - public delegate void PaintEventHandler(object sender, PaintEventArgs e); - public delegate void MeasureItemEventHandler(object sender, MeasureItemEventArgs e); - public delegate void DrawItemEventHandler(object sender, DrawItemEventArgs e); - public delegate void ItemCheckEventHandler(object sender, ItemCheckEventArgs e); - public delegate void DateRangeEventHandler(object sender, DateRangeEventArgs e); - - public class Cursor - { - } - - public static class Cursors - { - public static Cursor AppStarting = new Cursor(); - public static Cursor PanSW = new Cursor(); - public static Cursor PanSouth = new Cursor(); - public static Cursor PanSE = new Cursor(); - public static Cursor PanNW = new Cursor(); - public static Cursor PanNorth = new Cursor(); - public static Cursor PanNE = new Cursor(); - public static Cursor PanEast = new Cursor(); - public static Cursor NoMoveVert = new Cursor(); - public static Cursor NoMoveHoriz = new Cursor(); - public static Cursor NoMove2D = new Cursor(); - public static Cursor VSplit = new Cursor(); - public static Cursor HSplit = new Cursor(); - public static Cursor Help = new Cursor(); - public static Cursor WaitCursor = new Cursor(); - public static Cursor UpArrow = new Cursor(); - public static Cursor SizeWE = new Cursor(); - public static Cursor SizeNWSE = new Cursor(); - public static Cursor SizeNS = new Cursor(); - public static Cursor SizeNESW = new Cursor(); - public static Cursor SizeAll = new Cursor(); - public static Cursor No = new Cursor(); - public static Cursor IBeam = new Cursor(); - public static Cursor Default = new Cursor(); - public static Cursor Cross = new Cursor(); - public static Cursor Arrow = new Cursor(); - public static Cursor PanWest = new Cursor(); - public static Cursor Hand = new Cursor(); - } - - public class Control : Component - { - public Control Parent; // - public List Controls = new List(); - - public Cursor Cursor; - public bool Enabled = true; // - public Font Font; // - public RightToLeft RightToLeft; - public int TabIndex; - public bool TabStop; - public string Text = ""; // - public DockStyle Dock; - public AnchorStyles Anchor; - public bool Visible = true; // - public int Left; // - public int Top; // - public int Width; // - public int Height; // - public static Keys ModifierKeys; - public Control ActiveControl; - public Rectangle ClientRectangle; - public Point Location; - public Size Size; - - public IntPtr Handle = IntPtr.Zero; - - public event EventHandler Click; // - public event EventHandler DoubleClick; - public event EventHandler Enter; - public event EventHandler Leave; - public event KeyEventHandler KeyDown; - public event KeyPressEventHandler KeyPress; - public event KeyEventHandler KeyUp; - public event MouseEventHandler MouseDown; - public event MouseEventHandler MouseMove; - public event MouseEventHandler MouseUp; - public event EventHandler MouseEnter; - public event EventHandler MouseLeave; - public event EventHandler Resize; - public event EventHandler TextChanged; // - public event PaintEventHandler Paint; - public event EventHandler LostFocus; - - public void BringToFront() { } - public void Focus() { } - public void Hide() { } - public void Show() { } - public virtual void Refresh() { } - public void Update() { } - public virtual void Invalidate(bool b) { } - public void Invalidate(Rectangle r) { } - public void Invalidate() { } - public void SetStyle(ControlStyles style, bool fl) { } - public Form FindForm() { return null; } - - protected virtual System.Drawing.Size DefaultSize { get; set; } - public virtual Image BackgroundImage { get; set; } - public virtual Color BackColor { get; set; } - public virtual Color ForeColor { get; set; } - - - protected virtual void OnPaint(PaintEventArgs e) { } - protected virtual void OnPaintBackground(PaintEventArgs pevent) { } - protected virtual void OnSystemColorsChanged(EventArgs e) { } - protected virtual void OnLocationChanged(EventArgs e) { } - protected virtual void OnRightToLeftChanged(EventArgs e) { } - protected virtual void OnResize(EventArgs e) { } - protected virtual void OnGotFocus(EventArgs e) { } - protected virtual void OnLostFocus(EventArgs e) { } - protected virtual void OnCursorChanged(EventArgs e) { } - protected virtual void OnMouseDown(MouseEventArgs e) { } - protected virtual void OnMouseUp(MouseEventArgs e) { } - protected virtual void OnMouseMove(MouseEventArgs e) { } - protected virtual void OnDoubleClick(EventArgs e) { } - protected virtual void OnInvalidated(InvalidateEventArgs e) { } - protected virtual void OnBackColorChanged(EventArgs eventArgs) { } - } - - public class ToolTip : Control - { - public bool Active; - public int AutoPopDelay; - public int InitialDelay; - public int ReshowDelay; - public bool ShowAlways; - - internal void SetToolTip(Control c, string newToolTipText) { } - internal string GetToolTip(Control c) { return ""; } - } - - public class ButtonBase : Control - { - public bool AutoSize; - public Image Image; - public ContentAlignment ImageAlign; - public ContentAlignment TextAlign = ContentAlignment.MiddleCenter; // - public TextImageRelation TextImageRelation; - } - - public class Button : ButtonBase - { - public DialogResult DialogResult = DialogResult.None; // - } - - public class CheckBox : ButtonBase - { - public Appearance Appearance; - public ContentAlignment CheckAlign; - public bool Checked = false; // - public CheckState CheckState; - public bool ThreeState; - public object Tag; - - public event EventHandler CheckedChanged; - } - - public class ListControl : Control - { - public class ObjectCollection : List { } - - public event EventHandler SelectedIndexChanged; // - public event MeasureItemEventHandler MeasureItem; - public event DrawItemEventHandler DrawItem; - - public bool Sorted; - public DrawMode DrawMode; - public int ItemHeight; - public ObjectCollection Items = new ObjectCollection(); // - public int SelectedIndex; // - public object SelectedItem; - } - - public class ListBox : ListControl - { - public class SelectedIndexCollection : List { } - public class SelectedObjectCollection : List { } - - public bool IntegralHeight; - public int ColumnWidth; - public bool MultiColumn; - public SelectionMode SelectionMode; - public bool UseTabStops; - public SelectedIndexCollection SelectedIndices = new SelectedIndexCollection(); - public SelectedObjectCollection SelectedItems = new SelectedObjectCollection(); - } - - public class ComboBox : ListControl - { - public ComboBoxStyle DropDownStyle; - public int DropDownWidth; - public int DropDownHeight; - public int MaxDropDownItems; - public object Tag; - } - - public class CheckedListBox : ListBox - { - public class CheckedIndexCollection : List { } - public class CheckedItemCollection : List { } - - public event ItemCheckEventHandler ItemCheck; - - public bool CheckOnClick; - public CheckedIndexCollection CheckedIndices = new CheckedIndexCollection(); // - public CheckedItemCollection CheckedItems = new CheckedItemCollection(); // - - public void SetItemChecked(int index, bool check) - { - if (check) - { - if (!CheckedIndices.Contains(index)) CheckedIndices.Add(index); - } - else - { - CheckedIndices.Remove(index); - } - } - } - - public class DateTimePicker : Control - { - public event EventHandler ValueChanged; - - public bool Checked; - public string CustomFormat; - public LeftRightAlignment DropDownAlign; - public DateTimePickerFormat Format; - public DateTime MaxDate; - public DateTime MinDate; - public bool ShowCheckBox; - public bool ShowUpDown; - public DateTime Value = DateTime.Now; // - } - - public class Label : Control - { - public bool AutoSize; - public ContentAlignment TextAlign = ContentAlignment.TopLeft; // - } - - public class SelectionRange - { - } - - public class MonthCalendar : Control - { - public event DateRangeEventHandler DateChanged; - - public Size CalendarDimensions; - public Day FirstDayOfWeek; - public DateTime MaxDate; - public int MaxSelectionCount; - public DateTime MinDate; - public bool ShowToday; - public bool ShowTodayCircle; - public bool ShowWeekNumbers; - public DateTime TodayDate; - public DateTime[] AnnuallyBoldedDates; - public DateTime[] BoldedDates; - public DateTime[] MonthlyBoldedDates; - public DateTime SelectionEnd; - public SelectionRange SelectionRange; - public DateTime SelectionStart = DateTime.Now; // - } - - public class RadioButton : ButtonBase - { - public event EventHandler CheckedChanged; - - public ContentAlignment CheckAlign; - public bool Checked = false; // - } - - public class TextBox : Control - { - public bool AcceptsReturn; - public bool AcceptsTab; - public CharacterCasing CharacterCasing; - public int MaxLength; - public bool Multiline = false; // - public bool ReadOnly; - public ScrollBars ScrollBars; - public HorizontalAlignment TextAlign = HorizontalAlignment.Left; // - public bool UseSystemPasswordChar; - public bool WordWrap; - public BorderStyle BorderStyle; - - internal void SelectAll() { } - } - - public class Form : Control - { - public event EventHandler Load; - public event FormClosedEventHandler FormClosed; - public event FormClosingEventHandler FormClosing; - public event EventHandler Shown; - - public Button AcceptButton; - public Button CancelButton; - public FormBorderStyle FormBorderStyle; - public Size ClientSize; - public FormStartPosition StartPosition; - public bool ShowIcon; - public bool ShowInTaskbar; - public bool MinimizeBox; - public bool MaximizeBox; - public DialogResult DialogResult; - - public DialogResult ShowDialog() - { - return DialogResult.OK; - } - } - - public class Timer : Component - { - public event EventHandler Tick; - public int Interval; - public bool Enabled; - - public void Start() { if (Tick != null) Tick(this, EventArgs.Empty); } - public void Stop() { } - } - - public class MessageBox - { - public static DialogResult Show(string text) - { - return DialogResult.None; - } - } - - - internal sealed class Application - { - public static void DoEvents() - { - - } - } - - internal class SystemInformation - { - public static bool HighContrast; - } - - internal class ControlPaint - { - public static void DrawFocusRectangle(Graphics g, Rectangle r) { } - } - -} - - - -#pragma warning restore FR0000 // Field must be texted in lowerCamelCase. -#pragma warning restore 1591 -#endif \ No newline at end of file diff --git a/FastReport.OpenSource/FastReport.OpenSource.csproj b/FastReport.OpenSource/FastReport.OpenSource.csproj index 1fa95e73..08a4e226 100644 --- a/FastReport.OpenSource/FastReport.OpenSource.csproj +++ b/FastReport.OpenSource/FastReport.OpenSource.csproj @@ -45,10 +45,10 @@ Various report objects will allow your report to look exactly how you want it to - + + + + @@ -58,7 +58,6 @@ Various report objects will allow your report to look exactly how you want it to - diff --git a/FastReport.OpenSource/TypeConverters/FontConverter.cs b/FastReport.OpenSource/TypeConverters/FontConverter.cs deleted file mode 100644 index a5f7ca41..00000000 --- a/FastReport.OpenSource/TypeConverters/FontConverter.cs +++ /dev/null @@ -1,386 +0,0 @@ -// -// System.Drawing.FontConverter.cs -// -// Authors: -// Dennis Hayes (dennish@Raytek.com) -// Gonzalo Paniagua Javier (gonzalo@ximian.com) -// Ravindra (rkumar@novell.com) -// -// Copyright (C) 2002,2003 Ximian, Inc. http://www.ximian.com -// -// Copyright (C) 2004-2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -#if NETSTANDARD2_0 || NETSTANDARD2_1 -using System; -using System.Text; -using System.Collections; -using System.ComponentModel; -using System.Globalization; -using System.Drawing.Text; -using System.ComponentModel.Design.Serialization; -using System.Reflection; -using System.Drawing; - -namespace FastReport.TypeConverters -{ - public class FontConverter : TypeConverter - { - public static FontConverter Instance { get; } = new FontConverter(); - public FontConverter () - { - } - ~FontConverter () - { - // required to match API definition - } - public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType) - { - if (sourceType == typeof (string)) - return true; - - return base.CanConvertFrom (context, sourceType); - } - - public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType) - { - if (destinationType == typeof (String)) - return true; - - if (destinationType == typeof (InstanceDescriptor)) - return true; - - return base.CanConvertTo (context, destinationType); - } - - public override object ConvertTo (ITypeDescriptorContext context, - CultureInfo culture, - object value, - Type destinationType) - { - if ((destinationType == typeof (string)) && (value is Font)) { - Font font = (Font) value; - StringBuilder sb = new StringBuilder (); - sb.Append (font.Name).Append (culture.TextInfo.ListSeparator[0] + " "); - sb.Append (font.Size); - - switch (font.Unit) { - // MS throws ArgumentException, if unit is set - // to GraphicsUnit.Display - // Don't know what to append for GraphicsUnit.Display - case GraphicsUnit.Display: - sb.Append ("display"); break; - - case GraphicsUnit.Document: - sb.Append ("doc"); break; - - case GraphicsUnit.Point: - sb.Append ("pt"); break; - - case GraphicsUnit.Inch: - sb.Append ("in"); break; - - case GraphicsUnit.Millimeter: - sb.Append ("mm"); break; - - case GraphicsUnit.Pixel: - sb.Append ("px"); break; - - case GraphicsUnit.World: - sb.Append ("world"); break; - } - - if (font.Style != FontStyle.Regular) - sb.Append (culture.TextInfo.ListSeparator[0] + " style=").Append (font.Style); - - return sb.ToString (); - } - - if ((destinationType == typeof (InstanceDescriptor)) && (value is Font)) { - Font font = (Font) value; - ConstructorInfo met = typeof(Font).GetTypeInfo ().GetConstructor (new Type[] {typeof(string), typeof(float), typeof(FontStyle), typeof(GraphicsUnit)}); - object[] args = new object[4]; - args [0] = font.Name; - args [1] = font.Size; - args [2] = font.Style; - args [3] = font.Unit; - return new InstanceDescriptor (met, args); - } - - return base.ConvertTo (context, culture, value, destinationType); - } - - public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value) - { - FontStyle f_style; - float f_size; - GraphicsUnit f_unit; - string font; - string units; - string[] fields; - - if (! (value is string)) { - return base.ConvertFrom (context, culture, value); - } - - font = (string)value; - font = font.Trim (); - - if (font.Length == 0) { - return null; - } - - if (culture == null) { - culture = CultureInfo.CurrentCulture; - } - - // Format is FontFamily, size[[, style=1,2,3]] - // This is a bit tricky since the comma can be used for styles and fields - fields = font.Split(new char[] {culture.TextInfo.ListSeparator[0]}); - if (fields.Length < 1) { - throw new ArgumentException("Failed to parse font format"); - } - - font = fields[0]; - f_size = 8f; - units = "px"; - f_unit = GraphicsUnit.Pixel; - if (fields.Length > 1) { // We have a size - for (int i = 0; i < fields[1].Length; i++) { - if (Char.IsLetter(fields[1][i])) { - f_size = (float)TypeDescriptor.GetConverter(typeof(float)).ConvertFromString(context, culture, fields[1].Substring(0, i)); - units = fields[1].Substring(i); - break; - } - } - if (units == "display") { - f_unit = GraphicsUnit.Display; - } else if (units == "doc") { - f_unit = GraphicsUnit.Document; - } else if (units == "pt") { - f_unit = GraphicsUnit.Point; - } else if (units == "in") { - f_unit = GraphicsUnit.Inch; - } else if (units == "mm") { - f_unit = GraphicsUnit.Millimeter; - } else if (units == "px") { - f_unit = GraphicsUnit.Pixel; - } else if (units == "world") { - f_unit = GraphicsUnit.World; - } - } - - f_style = FontStyle.Regular; - if (fields.Length > 2) { // We have style - string compare; - - for (int i = 2; i < fields.Length; i++) { - compare = fields[i]; - - if (compare.IndexOf("Regular") != -1) { - f_style |= FontStyle.Regular; - } - if (compare.IndexOf("Bold") != -1) { - f_style |= FontStyle.Bold; - } - if (compare.IndexOf("Italic") != -1) { - f_style |= FontStyle.Italic; - } - if (compare.IndexOf("Strikeout") != -1) { - f_style |= FontStyle.Strikeout; - } - if (compare.IndexOf("Underline") != -1) { - f_style |= FontStyle.Underline; - } - } - } - - return new Font (font, f_size, f_style, f_unit); - } - - public override object CreateInstance (ITypeDescriptorContext context, IDictionary propertyValues) - { - Object value; - byte charSet = 1; - float size = 8; - String name = null; - bool vertical = false; - FontStyle style = FontStyle.Regular; - FontFamily fontFamily = null; - GraphicsUnit unit = GraphicsUnit.Point; - - if ((value = propertyValues ["GdiCharSet"]) != null) - charSet = (byte) value; - - if ((value = propertyValues ["Size"]) != null) - size = (float) value; - - if ((value = propertyValues ["Unit"]) != null) - unit = (GraphicsUnit) value; - - if ((value = propertyValues ["Name"]) != null) - name = (String) value; - - if ((value = propertyValues ["GdiVerticalFont"]) != null) - vertical = (bool) value; - - if ((value = propertyValues ["Bold"]) != null) { - bool bold = (bool) value; - if (bold == true) - style |= FontStyle.Bold; - } - - if ((value = propertyValues ["Italic"]) != null) { - bool italic = (bool) value; - if (italic == true) - style |= FontStyle.Italic; - } - - if ((value = propertyValues ["Strikeout"]) != null) { - bool strike = (bool) value; - if (strike == true) - style |= FontStyle.Strikeout; - } - - if ((value = propertyValues ["Underline"]) != null) { - bool underline = (bool) value; - if (underline == true) - style |= FontStyle.Underline; - } - - /* ?? Should default font be culture dependent ?? */ - if (name == null) - fontFamily = new FontFamily ("Tahoma"); - else { - name = name.ToLower (); - FontCollection collection = new InstalledFontCollection (); - FontFamily [] installedFontList = collection.Families; - foreach (FontFamily font in installedFontList) { - if (name == font.Name.ToLower ()) { - fontFamily = font; - break; - } - } - - // font family not found in installed fonts - if (fontFamily == null) { - collection = new PrivateFontCollection (); - FontFamily [] privateFontList = collection.Families; - foreach (FontFamily font in privateFontList) { - if (name == font.Name.ToLower ()) { - fontFamily = font; - break; - } - } - } - - // font family not found in private fonts also - if (fontFamily == null) - fontFamily = FontFamily.GenericSansSerif; - } - - return new Font (fontFamily, size, style, unit, charSet, vertical); - } - - public override bool GetCreateInstanceSupported (ITypeDescriptorContext context) - { - return true; - } - - public override PropertyDescriptorCollection GetProperties - (ITypeDescriptorContext context, - object value, Attribute [] attributes) - { - if (value is Font) - return TypeDescriptor.GetProperties (value, attributes); - - return base.GetProperties (context, value, attributes); - } - - public override bool GetPropertiesSupported (ITypeDescriptorContext context) - { - return true; - } - - public sealed class FontNameConverter : TypeConverter - , IDisposable - { - FontFamily [] fonts; - - public FontNameConverter () - { - fonts = FontFamily.Families; - } - void IDisposable.Dispose () - { - } - public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType) - { - if (sourceType == typeof (string)) - return true; - - return base.CanConvertFrom (context, sourceType); - } - - public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value) - { - if (value is string) - return value; - return base.ConvertFrom (context, culture, value); - } - - public override StandardValuesCollection GetStandardValues (ITypeDescriptorContext context) - { - string [] values = new string [fonts.Length]; - for (int i = fonts.Length; i > 0;){ - i--; - values [i] = fonts [i].Name; - } - - return new TypeConverter.StandardValuesCollection (values); - } - - public override bool GetStandardValuesExclusive (ITypeDescriptorContext context) - { - // We allow other values other than those in the font list. - return false; - } - - public override bool GetStandardValuesSupported (ITypeDescriptorContext context) - { - // Yes, we support picking an element from the list. - return true; - } - } - - public class FontUnitConverter : EnumConverter - { - public FontUnitConverter () : base (typeof (GraphicsUnit)) {} - - public override StandardValuesCollection GetStandardValues (ITypeDescriptorContext context) - { - return base.GetStandardValues (context); - } - - } - } -} -#endif \ No newline at end of file diff --git a/FastReport/Resources/en.xml b/FastReport/Resources/en.xml index dd3931f0..76a13d36 100644 --- a/FastReport/Resources/en.xml +++ b/FastReport/Resources/en.xml @@ -19,8 +19,8 @@ - - + + @@ -65,7 +65,31 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -290,7 +314,7 @@ - + @@ -352,6 +376,7 @@ + @@ -1481,6 +1506,7 @@ + @@ -1703,6 +1729,7 @@ + @@ -1819,7 +1846,6 @@ - @@ -1887,6 +1913,24 @@ + + + + + + + + + + + + + + + + + + diff --git a/FastReport/Resources/icon16.ico b/FastReport/Resources/icon16.ico index 1c7ffeb808a311dc59e3049eb04a2561106a2844..8204972e81b2bcd3cb49d0b0a44e26c76d35a166 100644 GIT binary patch literal 16446 zcmeG@2Ut``x3d(*0v38_5fnreVu{_2C3YoIqoM?iu|y?_Lzp!YPMd)c5z!&dn-kjF zk?A^wd`t+jvr}Fx==~Ua&&{pu+L4gYjOh#X!1pD(guLrch!ef0uhKip`?MjnTXNPw z3GABwfZ%xd?j6uSl}BmmJ3x3-P*UYNekVLCUze09pKl9EhmPI%!O?{K>~-vqANWm4 zNh!rq%5Sl@xLA3;CHNYcSj)k-%^qlJ5d!HMFUsG$dGjXp>-#Yb7%&KW^^`#J`4sl7 zu&|i5Av>>wiH#hb-4tL-+gY>EQe5wGA3b^uni;eNhgNOCK)(ej6j9}U?+UvCX0|)& zw-I0=-U)sI=gOaPwojZm2^Qwo(9Wd;SXx+vT&{rBtAE0VpRRzlgYsLeR=Z&G^hEY8 z;ugv%A>jm=nOcIglPidAZ9pmu2AkG#(87Edh@GRr#xV>WT*9D3mnaDQJ_X*qQS!y{ z^Y7a_yMnc)4fy*@Vco`4APtIzRcqp5wtphnwFv{qcHz*}Fc_qZFO<`PC;WS-HZI`k z-~_Gg9ifA(3v_7Tj~=H#8R8KS4R!R)!GvbfjAd>yuNW%*B{51 z|GK!`rto{!eN$iei;I;u3~iKar$`v%c^opcUb60m_N~6~3H#x8IdoSBv#n?s%x0tLEFUO6xy)F7TDvyD~55dcqZ&^RwN8m+q zvC?m>TDgYVD;sMuvsvi7Y^=o4v`I6V;OV6je{q?=jNYFGmiD_CzbJRai@02S%naUT4%X%n1CI0Es9;^6S%0}PHFIS6ra(eUE=0|;DrfyyM5jf;>D7k331 zQaNm;u{s`=eNavKISs}}=3r!KPUEQefVwFndLaEi5O(gl2QAHm!I|oX5I^b$>ddI| z#~A+F@{jnrEkHR40d1A3i51AC^B`o`9h!sesDdALQB3_$*WNMZ@vV>sP57?~{|`Y6 zYQP`Ha;&_(s`g(a{8R@_O)Q{g3o|fm`5tg?5YiC*=X?utHS$M0HE6^kCjZJmHQ`77 z!+GF0dp4|E`2#FlDuw0Cl(1sCjK zFt-8E@#Epivr-6_-(h-&x`q(C`!0kjvSH=gG?ojZO{}bYc#Y%FbJNN;Kpp?6Yux_C z9=s3QP5wiDc?k6_JKlrk4$5CBi+9i_qP}z6hf3ZVUK z+;R(zqjrI1tDP0WUQYAjP#S;8nJ+e{F`uzjD9!H_R6e&5jY`~jUmbp-{mZ!d1}028 z3txV9p61Ld;HzZtnR=G_`^nRjVDq+XkdyNoQB;c?pQ*#&+R>TWKWC?Q5EZF_w6s*X zc;Oegbm`X$aQX5DxbSNV+`5&4T~;_s1oeyx56Uh${=k6wY>wfWbDP84R`#vwGfSq6 zn3JMT3c=FCmc}X8G|zQ_jEtMCXN*;NY^e$_zsK=ou8Hvv)+>ZI4$qN)v~?JdRR@?S zBWIcPjiTg-Vc$HQIL}I3-7AdttMkt>rQL=0oD;PA1E#^DQodu6Hva- z$5K$9hzL-qt)+YwK^ooY1D=*R7y^@d0anV0ZZAI)n*WVLy zlhx{NTkmFhCdM|SJ&(b&XUf{bzmW${dzj)TjgfY;+!SLp%nL9+!dR*MNBbe;#vhF7 ze}f<3(&x0J+|6mujWi4EI~dzyd~HMHdwh1`(i8S6pC`N@RW0&~{-P$RiyudPoc40L zv${aV+>poWI1ac5vxu+S2qv1 ze&y%q!;c#`fv@kk6zKW_LfJY4zxJOKK;zuYtWW-3P5g1%qho1JkmlV;UuB&U(vG!N$A)N_UUg6C-K z(O)6$xsTsyEO+)I{o(raSLo+`@p<;&^EoPO(UoaOJA-wgenSq@wbk0mo#Xtg^cT=r ztFW-7ycU~y`XQqo>qF}1Dn3IS>G9do@>qwD9j8r`wl4JBi`&4H$JucB*duWJFbet% zh=rbg_e1agv2-7Ta_wIo?Klqj9DTtKxiU9b>LB(1GQel9>TI!S3%!s zJDZ=lUj*f;^s5zXc9r#pU*o$N=V0u-@u#ch>k69AUF5Sa^rQTr)B5_lAJgf2gR-WE z@}G4Bm21JAPu`*&IKNlZo--b}O=A}-eriiU)=#k}7aObGC-Urh2|TB+{sm1ngn;+* z=yKhkbPLQ&x>aEFwltZsppYy=$z!;ON0;~%= zwsL|lox4NP+t=VTC5f#E;QB15RaJ}QgKOv`M%AoCb&)^PuL+>8iR~PqQ>U&pE_y@P z&&%kq#$It=aE_q=#x?Jkud1%Eu|X;O`M1)KYt0Bse{^)6kg z{uBxHr$+fJVCUy(oNYU%*jUN9GRY1^Tq{?|Z1&JVPqn$#ZZLO)y&DB=RRHD_ojP`fg$t!jbf1hp%KTVO_7i=8F^x-BuTN#))u;VLn}ae9 z4h~^`mzLuGP#j~`P+F=Sf6OCm^1pokVvBS5R;F@~oH`#|7x~+ZTf?J=cWJEkjP1ok zyMne|75Gd^gwG}%WA+l~WKI5;@2#l3cb5rE#ZO)6=keR(<-b7#gDuQfqrX%IxYrML znafltQ|)%Cgkt8s`J%JQyorF6I|-zT97_ z(|Jxiwsn<1#?RY!WI!{MZPZuprm_1@noFsHvgf$h0DUW~sZiOYjrX6I441Ez)!L}S zXi9rs=vVIlu!i{f!%PhKvy13HxDv>ISV{p~b)bCbdPW|k)A}0jhvWVUJ43p;JXz-& z{P6cRt)HO3#Twm*)Tagq?|@@RQv5GGik%w*L$FfN27_U!swo0sX%LKSlzsY1d?5gtV$U7t&vw`XTb* z>{M~@7_aeG*J3=4V~794QeTIVeyrbOyoEZhE-tIPPEf_u z|FwH`d(i(M|DXg`dW;yT-`JutB|(4ip#GoYZY=~oZQ9J-H*Pd-ygY`D9zYdy!`ih@ z4vtZgkstNy?eF)U=h$(>hYVdT3+m+VK7Gp6R7jL_{zJ{j`h_>td#Tzf4o?d8k7xBg9{{-%omPrT`T25{6b<~_40b$6E!Z7UM@%%ts1e|fjrc^N`A5*q!U~6TX)IE!5fu}?w9vd5sZI(g;6T_PN z$bv~gwD!gEB;)u>5%C#CMU~Qwcv)C!kvWrQ>5+tVk$mxcF*1qD4w2N(abhwt-awZB zp-l8jTVlFo8IieeP7}>(M-+*orW}Xi|v9 zgwXC;muBi+8(%uAPuIaW25L1tx>4j-G;Pt`Em!-vlL+bOB=_qSLZ(l6Iz`v#^_9kw zr=do&>wVggIOz~F6_yZ}8L*JtE_zI2dz^kNN}YN4hN$rMC{gU?cbl}DA8z_W6x>2J3#)^hA@6Lk^nva&-ONIq)BjWYi{vxf$qZ=gYW)w7@ zp}oXVVbFZIyf<02cE$XIM|(@$L?ZH$&kjpj-h6S0Ovmm_lb^Hv#G>2~A5r@10NYL^ zNT)y15nXjj8AF@Pm$I`;r{zk|haTOdcdg<|V#s z)qqU?-nh43rcQ2tvGa?L*Ixf|+*c>)V6!Dlj;uZ3GPiY3+CcBFR-gKWzRkHecUq&= z5JywT)cup2d}-`qx}k}Y^nk+&+5D2gq-(FA+`FKgwtI6EMZ*rJ9_zi@%Wb+lpDfa%+H8{;nNjkacFe{u{{W~odLIA) literal 204862 zcmeI5zl$7a5{B1z|HEP?&ao}i$5=A-=oJlBfBpah}!CblqXMz<< z90`mfgDgi%>^mGeu$?$LyoZyE?mn@1!+5&7rhDr9@mAHlUPDiP-PKi3Ju{l!ndv<` zdaeBT>g%N_OW*wCpXo@k;cx^L!}l&dc=$3L4>pvDz+S_b?2w2TTMa~DiQ5bJ2}Fgh zq#&?R?B%~&Izpb`GEazy!X^O zB$gkOzyUHJd`L`!?8+^HgH1m8K)0w^cr*eBJ8V2K8b|iykbu!)CfMB z?&L4`DLjg-$Rz=f^3#8ps^JywRDSx8r;@*l{K`-N{n-Xqaru~4vB>W?7*3YsiGX+c zpMLR^C)}(RiGX+c`Q!)5CTFz-ke~iLa}K6l$`3P&-xTuvs~3H~e{(eGowE)netPx zI|NbPlT!Y=JdN4VBvNpg1fsUjQT5(u}oWyFxbyi~Wgaq#`iy9)p% zS4slsDV9h1MJxzG#Wc(%1Zb;j;9Htk;p)6IrsPUho%t9~7eoH?3tJ-x*uxdmFqdFS zP75o4E!y~-7KFnC%U?!@DY;VBR5Q#-4Ef7XE|_?0Ri&7Qxm2t1rgSmy~Y~y$WQ<4 z-fN8FAsk*82!1x@krs0a7Abxx9|Eu#Wc(%G}@FO zZ6d4c!IWI7YE^fwcc%QU3AfI#n1;F38px{r#^>7zhp*~4-p-hkD^=l)0Kr~k4LC4I zRic=NxikvY&UuaEAsoKbQO=u~k}Fjqj0wSBV+{xx5o%CO!(18;%_tti;lml?6o4tY zQq@>=2=*Fl7z+^X?22iaO9KHK#X~rJAU(`eV@j@6H3}nwy~Y|wp+i2eVjAXBf0zM2 z%o6)Ej20y@C0DAlG<(3Y0pu_LY8=pbl0y{JFqeAHC4l?^u20@{;+T>vRW+rtlic`x zd-&m$e`lc6n~G_eOVbt_MTXmJEP(Pa5d%|lrK%-O+4nKJH~jEmmuR*RbS{Hp8s^em zBemk?VRN{>#sVn+av3lsSE^E4i}7xJqx|J?1re8a2q>muF74F6xoOuXMuxM`zS}V2 z#$E!Lk}Fk-9R>JBWvzSPgNH9gL=1`q6w@%5r9sD<+9_C#U~{?DA(uPCwsE{TI{Bu|*M{Ed*PO$h=Tu9qY>5=PY4jfB6R zxu}N{)MW!)6?MD^in@BZ7P?rsGRUAq}W2?8E^Cbg7!}XHre|7UW3Cjy-BHqA3T{gf~ zaTc2ia>GtQBpfveXt-XII0*aDnPHnip3lzcvH`Br|7}s5Zi}dc1py7$OA`4v)gW_n zk#?k@E*s#g2tTu;t$P=NhY122u9qZ|Z|y+x{37!hL0vY$RS|n~KRdK9Vh<1mG+Zx9 zWZpr5ZSi)RtxyAJBI0j`R)#bGhn zf`G{1ZxGOMy(AHJ`IKvmSu>|dKpcV7pe`HW>KtcrQVg~r5b4vzfQIWO&G}#A1F!#f za{HP1-9kTvoXQk@E$OlWuAZMi_Co+_DzUOllMiLCa7jX*1 z?X?%+_tP=>&P1v(s{iF4B({bhjAR#nFQO0jhhKyYVr%$8d}kt6DEfe4ue}DbHT+;C zyYPDvU#GCUhmhfiAAiNSeOe*DGm$C`?7!1%M@O;?zn8%Nmw$t%kFNL;d}kt6NdM99 z5s~b|?}h%;e|$^ZRT$fUj~B>lH*02|5{T`;$5(-;Gh(D2f!O|g{1Ld_teJUAfd2FO z|I~^+5&BR6^VmM^l>XEIsTFx5^q>Ccv3=Sp{ipv^EAm9>KmE^R`?OQ~PyeS@wFG*>j&f?jdwa|9iT<geh|Tm zJT-_u*xf_OAhw1d%;VnhPUmDmu-90_gNHBYx&x07w<1Xaa~hQQ3>e)*IDD=<{CE=m zMztya!gJdS1bgi@Y z%ujAVt0f*n9*>`PoXXSr(c6ByX$zZ3Fu@QcS8CW`cfDa3vU7$x+RCK3RGomwkNS${ zbhg)iI=PFhkE)ND2^9k36g&p)LUzs|LRKclrRoI45jYKYw%2|-k#qGCGvOS8r(gUe zj=*WqE@bBnBImhbFnQDhXd7rAt zJVwwiWakVb_MMUOW-S7-!Or&DPd9C$MAiWE%oFTvul;o5Xco?zyKNH?NoEV$h3uR`9MJYyxxJTw$S`NHv%U7y ziDTM3aqdtE_`OQMIP@w(yO5nTh+UUADAI6+fC!DjLZGv~_S4NxO__eqr3~-hnUi68 z+%9D23`%P`J>PU)t|{vJQvAwf+bwmr*M7Rw(@%67&tLqU;XC1Lwffu-TeS<>Kf__2 z@+cCR66kNQ{fyHt7$Jef2-s~LlHsssc@zok5Ex>w{iHix@FocyM!>G(s0@eo%cDqO zo4_c0tDN`V-TT|UaGM0y5~$+g@FaWx%=B6;+&>9{;p(!0IRf7Q(wU2U&>VcmK?ocl zUvnXn(;`8p%rX=Lf4TElr*`3&tzhR84uQSz`oK30vqGE^vl5*Era#`R(wTD=hk$p} zFzd&eFDuar@WqZ6_aL1)SD^^B5FmL@sQI!Ooj`I|TePnO=PDF|76K&C2{m69qZ3H( zYK!)D;9P|w&_aOZIicpuVsrw@U2W064xFn{1X>7?JSWtAS&U8~xvMSO*MV~tia-ki zlIMh)FN@I$BzLt%`#Ny0LJ?>oK=PdBjkQoCW-$tZ Date: Wed, 20 May 2020 11:14:49 +0300 Subject: [PATCH 2/2] added UsedPackages.version --- UsedPackages.version | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 UsedPackages.version diff --git a/UsedPackages.version b/UsedPackages.version new file mode 100644 index 00000000..e4edb246 --- /dev/null +++ b/UsedPackages.version @@ -0,0 +1,11 @@ + + + + + + 2020.3.2 + + 2020.3.1 + + + \ No newline at end of file