using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; using FastReport.Forms; namespace FastReport.Utils { /// /// Contains methods to call common editors. /// /// /// Use this class if you are writing a new component for FastReport. /// public static class Editors { /// /// Invokes the expression editor. /// /// A reference to the report. /// The expression to edit. /// The new expression. public static string EditExpression(Report report, string expression) { using (ExpressionEditorForm form = new ExpressionEditorForm(report)) { form.ExpressionText = expression; if (form.ShowDialog() == DialogResult.OK) return form.ExpressionText; } return expression; } /// /// Invokes the border editor. /// /// The Border to edit. /// The new border. public static Border EditBorder(Border border) { using (BorderEditorForm editor = new BorderEditorForm()) { editor.Border = border.Clone(); if (editor.ShowDialog() == DialogResult.OK) return editor.Border; } return border; } /// /// Invokes the data band columns editor. /// /// The data band columns to edit. /// public static BandColumns EditBandColumns(BandColumns columns) { using (DataBandColumnEditorForm editor = new DataBandColumnEditorForm(columns)) { //editor.Border = border.Clone(); if (editor.ShowDialog() == DialogResult.OK) return editor.Columns; } return columns; } /// /// Invokes the fill editor. /// /// The fill to edit. /// The new fill. public static FillBase EditFill(FillBase fill) { using (FillEditorForm editor = new FillEditorForm()) { editor.Fill = fill.Clone(); if (editor.ShowDialog() == DialogResult.OK) return editor.Fill; } return fill; } /// /// Invokes the outline editor. /// /// The outline to edit. /// The new outline. public static TextOutline EditOutline(TextOutline outline) { using (OutlineEditorForm editor = new OutlineEditorForm()) { editor.Outline = outline.Clone(); if (editor.ShowDialog() == DialogResult.OK) return editor.Outline; } return outline; } /// /// Invokes the text editor. /// /// A reference to the report. May by null /// The text to edit. /// /// The new text. public static string EditText(Report report, string text, bool hideDataBar = true) { #if MONO using (TextEditorForm editor = new TextEditorForm(null, hideDataBar)) #else using (TextEditorForm editor = new TextEditorForm(null)) #endif { editor.ExpressionText = text; editor.HideDataBar = hideDataBar; if (editor.ShowDialog() == DialogResult.OK) return editor.ExpressionText; } return text; } } }