DesignerRestrictions.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.ComponentModel;
  5. namespace FastReport.Design
  6. {
  7. /// <summary>
  8. /// Represents a set of designer's restrictions.
  9. /// </summary>
  10. public class DesignerRestrictions
  11. {
  12. #region Fields
  13. private bool dontLoadReport;
  14. private bool dontSaveReport;
  15. private bool dontCreateReport;
  16. private bool dontPreviewReport;
  17. private bool dontShowRecentFiles;
  18. private bool dontEditCode;
  19. private bool dontEditData;
  20. private bool dontCreateData;
  21. private bool dontSortDataSources;
  22. private bool dontChangeReportOptions;
  23. private bool dontInsertObject;
  24. private bool dontInsertBand;
  25. private bool dontDeletePage;
  26. private bool dontCreatePage;
  27. private bool dontCopyPage;
  28. private bool dontChangePageOptions;
  29. // if you add something new, don't forget to add it in the Assign method too!
  30. #endregion
  31. #region Properties
  32. /// <summary>
  33. /// Gets or sets a value that enables or disables the "Open" action.
  34. /// </summary>
  35. [DefaultValue(false)]
  36. public bool DontLoadReport
  37. {
  38. get { return dontLoadReport; }
  39. set { dontLoadReport = value; }
  40. }
  41. /// <summary>
  42. /// Gets or sets a value that enables or disables the "Save/Save as" actions.
  43. /// </summary>
  44. [DefaultValue(false)]
  45. public bool DontSaveReport
  46. {
  47. get { return dontSaveReport; }
  48. set { dontSaveReport = value; }
  49. }
  50. /// <summary>
  51. /// Gets or sets a value that enables or disables the "New..." action.
  52. /// </summary>
  53. [DefaultValue(false)]
  54. public bool DontCreateReport
  55. {
  56. get { return dontCreateReport; }
  57. set { dontCreateReport = value; }
  58. }
  59. /// <summary>
  60. /// Gets or sets a value that enables or disables the "Preview" action.
  61. /// </summary>
  62. [DefaultValue(false)]
  63. public bool DontPreviewReport
  64. {
  65. get { return dontPreviewReport; }
  66. set { dontPreviewReport = value; }
  67. }
  68. /// <summary>
  69. /// Gets or sets a value that enables or disables the recent files list.
  70. /// </summary>
  71. [DefaultValue(false)]
  72. public bool DontShowRecentFiles
  73. {
  74. get { return dontShowRecentFiles; }
  75. set { dontShowRecentFiles = value; }
  76. }
  77. /// <summary>
  78. /// Gets or sets a value that enables or disables the "Code" tab.
  79. /// </summary>
  80. [DefaultValue(false)]
  81. public bool DontEditCode
  82. {
  83. get { return dontEditCode; }
  84. set { dontEditCode = value; }
  85. }
  86. /// <summary>
  87. /// Gets or sets a value that enables or disables the "Data" menu.
  88. /// </summary>
  89. [DefaultValue(false)]
  90. public bool DontEditData
  91. {
  92. get { return dontEditData; }
  93. set { dontEditData = value; }
  94. }
  95. /// <summary>
  96. /// Gets or sets a value that enables or disables the "Data|Add New Data Source..." menu.
  97. /// </summary>
  98. [DefaultValue(false)]
  99. public bool DontCreateData
  100. {
  101. get { return dontCreateData; }
  102. set { dontCreateData = value; }
  103. }
  104. /// <summary>
  105. /// Gets or sets a value that enables or disables the "Data|Sort Data Sources" menu.
  106. /// </summary>
  107. [DefaultValue(false)]
  108. public bool DontSortDataSources
  109. {
  110. get { return dontSortDataSources; }
  111. set { dontSortDataSources = value; }
  112. }
  113. /// <summary>
  114. /// Gets or sets a value that enables or disables the "Report|Options..." menu.
  115. /// </summary>
  116. [DefaultValue(false)]
  117. public bool DontChangeReportOptions
  118. {
  119. get { return dontChangeReportOptions; }
  120. set { dontChangeReportOptions = value; }
  121. }
  122. /// <summary>
  123. /// Gets or sets a value that enables or disables insertion of objects.
  124. /// </summary>
  125. [DefaultValue(false)]
  126. public bool DontInsertObject
  127. {
  128. get { return dontInsertObject; }
  129. set { dontInsertObject = value; }
  130. }
  131. /// <summary>
  132. /// Gets or sets a value that enables or disables the insertion of bands.
  133. /// </summary>
  134. [DefaultValue(false)]
  135. public bool DontInsertBand
  136. {
  137. get { return dontInsertBand; }
  138. set { dontInsertBand = value; }
  139. }
  140. /// <summary>
  141. /// Gets or sets a value that enables or disables the "Delete Page" action.
  142. /// </summary>
  143. [DefaultValue(false)]
  144. public bool DontDeletePage
  145. {
  146. get { return dontDeletePage; }
  147. set { dontDeletePage = value; }
  148. }
  149. /// <summary>
  150. /// Gets or sets a value that enables or disables the creation of report/dialog pages.
  151. /// </summary>
  152. [DefaultValue(false)]
  153. public bool DontCreatePage
  154. {
  155. get { return dontCreatePage; }
  156. set { dontCreatePage = value; }
  157. }
  158. /// <summary>
  159. /// Gets or set a value that enables or disbles the "Copy Page" action.
  160. /// </summary>
  161. [DefaultValue(false)]
  162. public bool DontCopyPage
  163. {
  164. get { return dontCopyPage; }
  165. set { dontCopyPage = value; }
  166. }
  167. /// <summary>
  168. /// Gets or sets a value that enables or disables the "Page Setup" action.
  169. /// </summary>
  170. [DefaultValue(false)]
  171. public bool DontChangePageOptions
  172. {
  173. get { return dontChangePageOptions; }
  174. set { dontChangePageOptions = value; }
  175. }
  176. #endregion
  177. /// <summary>
  178. /// Copies the contents of another, similar object.
  179. /// </summary>
  180. /// <param name="source">Source object to copy the contents from.</param>
  181. public void Assign(DesignerRestrictions source)
  182. {
  183. DontLoadReport = source.DontLoadReport;
  184. DontSaveReport = source.DontSaveReport;
  185. DontCreateReport = source.DontCreateReport;
  186. DontPreviewReport = source.DontPreviewReport;
  187. DontShowRecentFiles = source.DontShowRecentFiles;
  188. DontEditCode = source.DontEditCode;
  189. DontEditData = source.DontEditData;
  190. DontCreateData = source.DontCreateData;
  191. DontSortDataSources = source.DontSortDataSources;
  192. DontChangeReportOptions = source.DontChangeReportOptions;
  193. DontInsertObject = source.DontInsertObject;
  194. DontInsertBand = source.DontInsertBand;
  195. DontDeletePage = source.DontDeletePage;
  196. DontCreatePage = source.DontCreatePage;
  197. DontCopyPage = source.DontCopyPage;
  198. DontChangePageOptions = source.DontChangePageOptions;
  199. }
  200. /// <summary>
  201. /// Creates exact copy of this object.
  202. /// </summary>
  203. /// <returns>The copy of this object.</returns>
  204. public DesignerRestrictions Clone()
  205. {
  206. DesignerRestrictions restrictions = new DesignerRestrictions();
  207. restrictions.Assign(this);
  208. return restrictions;
  209. }
  210. }
  211. }