ExportPlugin.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. using FastReport.Forms;
  2. namespace FastReport.Design
  3. {
  4. /// <summary>
  5. /// Base class for all export plugins.
  6. /// </summary>
  7. public class ExportPlugin : IDesignerPlugin
  8. {
  9. #region Fields
  10. private string name;
  11. private string filter;
  12. private Designer designer;
  13. private Report report;
  14. #endregion // Fields
  15. #region Properties
  16. /// <summary>
  17. /// Gets or sets the name of plugin.
  18. /// </summary>
  19. public string Name
  20. {
  21. get { return name; }
  22. protected set { name = value; }
  23. }
  24. /// <summary>
  25. /// Gets or sets the filter string used in the "Save File" dialog.
  26. /// </summary>
  27. public string Filter
  28. {
  29. get { return filter; }
  30. protected set { filter = value; }
  31. }
  32. /// <summary>
  33. /// Gets or sets reference to the designer.
  34. /// </summary>
  35. public Designer Designer
  36. {
  37. get { return designer; }
  38. protected set { designer = value; }
  39. }
  40. /// <summary>
  41. /// Gets or sets reference to the report.
  42. /// </summary>
  43. public Report Report
  44. {
  45. get { return report; }
  46. protected set { report = value; }
  47. }
  48. #endregion // Properties
  49. #region Constructors
  50. /// <summary>
  51. /// Initializes a new instance of the <see cref="ExportPlugin"/> class with default settings.
  52. /// </summary>
  53. public ExportPlugin()
  54. {
  55. filter = GetFilter();
  56. }
  57. /// <summary>
  58. /// Initializes a new instance of the <see cref="ExportPlugin"/> class with a specified designer.
  59. /// </summary>
  60. /// <param name="designer">The report designer.</param>
  61. public ExportPlugin(Designer designer) : this()
  62. {
  63. this.designer = designer;
  64. }
  65. #endregion // Constructors
  66. #region IDesignerPlugin Members
  67. /// <inheritdoc/>
  68. public string PluginName
  69. {
  70. get { return name; }
  71. }
  72. /// <inheritdoc/>
  73. public void SaveState()
  74. {
  75. }
  76. /// <inheritdoc/>
  77. public void RestoreState()
  78. {
  79. }
  80. /// <inheritdoc/>
  81. public void SelectionChanged()
  82. {
  83. }
  84. /// <inheritdoc/>
  85. public void UpdateContent()
  86. {
  87. }
  88. /// <inheritdoc/>
  89. public void Lock()
  90. {
  91. }
  92. /// <inheritdoc/>
  93. public void Unlock()
  94. {
  95. }
  96. /// <inheritdoc/>
  97. public void Localize()
  98. {
  99. }
  100. /// <inheritdoc/>
  101. public DesignerOptionsPage GetOptionsPage()
  102. {
  103. return null;
  104. }
  105. /// <inheritdoc/>
  106. public void UpdateUIStyle()
  107. {
  108. }
  109. ///<inheritdoc/>
  110. public void UpdateDpiDependencies()
  111. {
  112. }
  113. #endregion // IDesignerPlugin Members
  114. #region Protected Methods
  115. /// <summary>
  116. /// Returns a file filter for a save dialog.
  117. /// </summary>
  118. /// <returns>String that contains a file filter, for example: "Bitmap image (*.bmp)|*.bmp"</returns>
  119. protected virtual string GetFilter()
  120. {
  121. return "";
  122. }
  123. #endregion // Protected Methods
  124. #region Public Methods
  125. /// <summary>
  126. /// Saves the specified report into specified file.
  127. /// </summary>
  128. /// <param name="report">Report object.</param>
  129. /// <param name="filename">File name.</param>
  130. public virtual void SaveReport(Report report, string filename)
  131. {
  132. }
  133. #endregion // Public Methods
  134. }
  135. }