using FastReport.Forms;
using FastReport.Import;
using System.IO;
namespace FastReport.Design
{
///
/// Base class for all import plugins.
///
public class ImportPlugin : IDesignerPlugin
{
#region Fields
private string filter;
private Designer designer;
private Report report;
private ImportBase import;
#endregion // Fields
#region Properties
///
/// Gets or sets the name of plugin.
///
public string Name
{
get { return import.Name; }
}
///
/// Gets or sets the filter string used in the "Open File" dialog.
///
public string Filter
{
get { return filter; }
protected set { filter = value; }
}
///
/// Gets or sets reference to the designer.
///
public Designer Designer
{
get { return designer; }
protected set { designer = value; }
}
///
/// Gets or sets reference to the report.
///
public Report Report
{
get { return report; }
protected set { report = value; }
}
///
public string PluginName
{
get { return import.Name; }
}
///
/// Gets or sets reference to the import.
///
protected ImportBase Import
{
get { return import; }
set { import = value; }
}
#endregion // Properties
#region Constructors
///
/// Initializes a new instance of the class with default settings.
///
public ImportPlugin()
{
filter = GetFilter();
import = new ImportBase();
}
///
/// Initializes a new instance of the class with a specified designer.
///
/// The report designer.
public ImportPlugin(Designer designer) : this()
{
this.designer = designer;
}
#endregion // Constructors
#region IDesignerPlugin Members
///
public void SaveState()
{
}
///
public void RestoreState()
{
}
///
public void SelectionChanged()
{
}
///
public void UpdateContent()
{
}
///
public void Lock()
{
}
///
public void Unlock()
{
}
///
public virtual void Localize()
{
}
///
public DesignerOptionsPage GetOptionsPage()
{
return null;
}
///
public virtual void UpdateUIStyle()
{
}
///
public void UpdateDpiDependencies()
{
}
#endregion // IDesignerPlugin Members
#region Protected Methods
///
/// Returns a file filter for a open dialog.
///
/// String that contains a file filter, for example: "Bitmap image (*.bmp)|*.bmp"
protected virtual string GetFilter()
{
return "";
}
#endregion // Protected Methods
#region Public Methods
///
/// Loads the specified file into specified report.
///
/// Report object.
/// File name.
public virtual void LoadReport(Report report, string filename)
{
report.Clear();
}
///
/// Loads the specified file into specified report from stream.
///
/// Report object.
/// File stream.
public virtual void LoadReport(Report report, Stream file)
{
report.Clear();
}
#endregion // Public Methods
}
}