using System; using System.Collections.Generic; using System.Text; using System.ComponentModel; namespace FastReport.Design { /// /// Represents a set of designer's restrictions. /// public class DesignerRestrictions { #region Fields private bool dontLoadReport; private bool dontSaveReport; private bool dontCreateReport; private bool dontPreviewReport; private bool dontShowRecentFiles; private bool dontEditCode; private bool dontEditData; private bool dontCreateData; private bool dontSortDataSources; private bool dontChangeReportOptions; private bool dontInsertObject; private bool dontInsertBand; private bool dontDeletePage; private bool dontCreatePage; private bool dontCopyPage; private bool dontChangePageOptions; // if you add something new, don't forget to add it in the Assign method too! #endregion #region Properties /// /// Gets or sets a value that enables or disables the "Open" action. /// [DefaultValue(false)] public bool DontLoadReport { get { return dontLoadReport; } set { dontLoadReport = value; } } /// /// Gets or sets a value that enables or disables the "Save/Save as" actions. /// [DefaultValue(false)] public bool DontSaveReport { get { return dontSaveReport; } set { dontSaveReport = value; } } /// /// Gets or sets a value that enables or disables the "New..." action. /// [DefaultValue(false)] public bool DontCreateReport { get { return dontCreateReport; } set { dontCreateReport = value; } } /// /// Gets or sets a value that enables or disables the "Preview" action. /// [DefaultValue(false)] public bool DontPreviewReport { get { return dontPreviewReport; } set { dontPreviewReport = value; } } /// /// Gets or sets a value that enables or disables the recent files list. /// [DefaultValue(false)] public bool DontShowRecentFiles { get { return dontShowRecentFiles; } set { dontShowRecentFiles = value; } } /// /// Gets or sets a value that enables or disables the "Code" tab. /// [DefaultValue(false)] public bool DontEditCode { get { return dontEditCode; } set { dontEditCode = value; } } /// /// Gets or sets a value that enables or disables the "Data" menu. /// [DefaultValue(false)] public bool DontEditData { get { return dontEditData; } set { dontEditData = value; } } /// /// Gets or sets a value that enables or disables the "Data|Add New Data Source..." menu. /// [DefaultValue(false)] public bool DontCreateData { get { return dontCreateData; } set { dontCreateData = value; } } /// /// Gets or sets a value that enables or disables the "Data|Sort Data Sources" menu. /// [DefaultValue(false)] public bool DontSortDataSources { get { return dontSortDataSources; } set { dontSortDataSources = value; } } /// /// Gets or sets a value that enables or disables the "Report|Options..." menu. /// [DefaultValue(false)] public bool DontChangeReportOptions { get { return dontChangeReportOptions; } set { dontChangeReportOptions = value; } } /// /// Gets or sets a value that enables or disables insertion of objects. /// [DefaultValue(false)] public bool DontInsertObject { get { return dontInsertObject; } set { dontInsertObject = value; } } /// /// Gets or sets a value that enables or disables the insertion of bands. /// [DefaultValue(false)] public bool DontInsertBand { get { return dontInsertBand; } set { dontInsertBand = value; } } /// /// Gets or sets a value that enables or disables the "Delete Page" action. /// [DefaultValue(false)] public bool DontDeletePage { get { return dontDeletePage; } set { dontDeletePage = value; } } /// /// Gets or sets a value that enables or disables the creation of report/dialog pages. /// [DefaultValue(false)] public bool DontCreatePage { get { return dontCreatePage; } set { dontCreatePage = value; } } /// /// Gets or set a value that enables or disbles the "Copy Page" action. /// [DefaultValue(false)] public bool DontCopyPage { get { return dontCopyPage; } set { dontCopyPage = value; } } /// /// Gets or sets a value that enables or disables the "Page Setup" action. /// [DefaultValue(false)] public bool DontChangePageOptions { get { return dontChangePageOptions; } set { dontChangePageOptions = value; } } #endregion /// /// Copies the contents of another, similar object. /// /// Source object to copy the contents from. public void Assign(DesignerRestrictions source) { DontLoadReport = source.DontLoadReport; DontSaveReport = source.DontSaveReport; DontCreateReport = source.DontCreateReport; DontPreviewReport = source.DontPreviewReport; DontShowRecentFiles = source.DontShowRecentFiles; DontEditCode = source.DontEditCode; DontEditData = source.DontEditData; DontCreateData = source.DontCreateData; DontSortDataSources = source.DontSortDataSources; DontChangeReportOptions = source.DontChangeReportOptions; DontInsertObject = source.DontInsertObject; DontInsertBand = source.DontInsertBand; DontDeletePage = source.DontDeletePage; DontCreatePage = source.DontCreatePage; DontCopyPage = source.DontCopyPage; DontChangePageOptions = source.DontChangePageOptions; } /// /// Creates exact copy of this object. /// /// The copy of this object. public DesignerRestrictions Clone() { DesignerRestrictions restrictions = new DesignerRestrictions(); restrictions.Assign(this); return restrictions; } } }