123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528 |
- using System;
- using System.Drawing;
- using System.ComponentModel;
- using FastReport.Utils;
- using FastReport.Preview;
- using System.Drawing.Design;
- namespace FastReport
- {
- /// <summary>
- /// Specifies the set of buttons available in the preview.
- /// </summary>
- [Flags]
- [EditorAttribute("FastReport.TypeEditors.FlagsEditor, FastReport", typeof(UITypeEditor))]
- public enum PreviewButtons
- {
- /// <summary>
- /// No buttons visible.
- /// </summary>
- None = 0,
- /// <summary>
- /// The "Print" button is visible.
- /// </summary>
- Print = 1,
- /// <summary>
- /// The "Open" button is visible.
- /// </summary>
- Open = 2,
- /// <summary>
- /// The "Save" button is visible.
- /// </summary>
- Save = 4,
- /// <summary>
- /// The "Email" button is visible.
- /// </summary>
- Email = 8,
- /// <summary>
- /// The "Find" button is visible.
- /// </summary>
- Find = 16,
- /// <summary>
- /// The zoom buttons are visible.
- /// </summary>
- Zoom = 32,
- /// <summary>
- /// The "Outline" button is visible.
- /// </summary>
- Outline = 64,
- /// <summary>
- /// The "Page setup" button is visible.
- /// </summary>
- PageSetup = 128,
- /// <summary>
- /// The "Edit" button is visible.
- /// </summary>
- Edit = 256,
- /// <summary>
- /// The "Watermark" button is visible.
- /// </summary>
- Watermark = 512,
- /// <summary>
- /// The page navigator buttons are visible.
- /// </summary>
- Navigator = 1024,
- /// <summary>
- /// The "Close" button is visible.
- /// </summary>
- Close = 2048,
- /// <summary>
- /// The "Design" button is visible.
- /// </summary>
- Design = 4096,
- /// <summary>
- /// The "Copy Page" button is visible.
- /// </summary>
- CopyPage = 8192,
- /// <summary>
- /// The "Delete Page" button is visible.
- /// </summary>
- DeletePage = 16384,
- /// <summary>
- /// The "About" button is visible.
- /// </summary>
- About = 32768,
- /// <summary>
- /// All buttons are visible.
- /// </summary>
- // if you add something to this enum, don't forget to correct "All" member
- All = Print | Open | Save | Email | Find | Zoom | Outline | PageSetup | Edit |
- Watermark | Navigator | Close | CopyPage | DeletePage | About
- }
- /// <summary>
- /// Specifies the set of export buttons available in the preview.
- /// </summary>
- [Flags]
- [EditorAttribute("FastReport.TypeEditors.FlagsEditor, FastReport", typeof(UITypeEditor))]
- public enum PreviewExports
- {
- /// <summary>
- /// No exports visible.
- /// </summary>
- None = 0,
- /// <summary>
- /// The "Prepared" button is visible.
- /// </summary>
- Prepared = 1,
- /// <summary>
- /// The "PDFExport" button is visible.
- /// </summary>
- PDFExport = 2,
- /// <summary>
- /// The "RTFExport" button is visible.
- /// </summary>
- RTFExport = 4,
- /// <summary>
- /// The "HTMLExport" button is visible.
- /// </summary>
- HTMLExport = 8,
- /// <summary>
- /// The "MHTExport" button is visible.
- /// </summary>
- MHTExport = 16,
- /// <summary>
- /// The "XMLExport" export button is visible.
- /// </summary>
- XMLExport = 32,
- /// <summary>
- /// The "Excel2007Export" button is visible.
- /// </summary>
- Excel2007Export = 64,
- /// <summary>
- /// The "Excel2003Document" button is visible.
- /// </summary>
- Excel2003Document = 128,
- /// <summary>
- /// The "Word2007Export" button is visible.
- /// </summary>
- Word2007Export = 256,
- /// <summary>
- /// The "PowerPoint2007Export" button is visible.
- /// </summary>
- PowerPoint2007Export = 512,
- /// <summary>
- /// The "ODSExport" button is visible.
- /// </summary>
- ODSExport = 1024,
- /// <summary>
- /// The "ODTExport" button is visible.
- /// </summary>
- ODTExport = 2048,
- /// <summary>
- /// The "XPSExport" export button is visible.
- /// </summary>
- XPSExport = 4096,
- /// <summary>
- /// The "CSVExport" button is visible.
- /// </summary>
- CSVExport = 8192,
- /// <summary>
- /// The "DBFExport" button is visible.
- /// </summary>
- DBFExport = 16384,
- /// <summary>
- /// The "TextExport" button is visible.
- /// </summary>
- TextExport = 32768,
- /// <summary>
- /// The "ZplExport" button is visible.
- /// </summary>
- ZplExport = 65536,
- /// <summary>
- /// The "ImageExport" button is visible.
- /// </summary>
- ImageExport = 131072,
- /// <summary>
- /// The "XAMLExport" button is visible.
- /// </summary>
- XAMLExport = 262144,
- /// <summary>
- /// The "SVGExport" button is visible.
- /// </summary>
- SVGExport = 524288,
- /// <summary>
- /// The "PPMLExport" button is visible.
- /// </summary>
- PPMLExport = 1048576,
- /// <summary>
- /// The "PSExport" button is visible.
- /// </summary>
- PSExport = 2097152,
- /// <summary>
- /// The "JsonExport" button is visible.
- /// </summary>
- JsonExport = 4194304,
- /// <summary>
- /// The "LaTeXExport" button is visible.
- /// </summary>
- LaTeXExport = 8388608,
- /// <summary>
- /// The "HpglExport" button is visible.
- /// </summary>
- HpglExport = 16777216,
- /// <summary>
- /// The "DxfExport" button is visible.
- /// </summary>
- DxfExport = 33554432,
- /// <summary>
- /// The All export buttons is visible.
- /// </summary>
- All = Prepared | PDFExport | RTFExport | HTMLExport | MHTExport | XMLExport | Excel2007Export | Excel2003Document |
- Word2007Export | PowerPoint2007Export | ODSExport | ODTExport | XPSExport | CSVExport | DBFExport | TextExport |
- ZplExport | ImageExport | XAMLExport | SVGExport | PPMLExport | PSExport | JsonExport | LaTeXExport | DxfExport
- }
- /// <summary>
- /// Specifies the set of cloud exports available in the preview.
- /// </summary>
- [Flags]
- [EditorAttribute("FastReport.TypeEditors.FlagsEditor, FastReport", typeof(UITypeEditor))]
- public enum PreviewClouds
- {
- /// <summary>
- /// No items visible.
- /// </summary>
- None = 0,
- /// <summary>
- /// The "Box" button is visible.
- /// </summary>
- Box = 1,
- /// <summary>
- /// The "Dropbox" button is visible.
- /// </summary>
- Dropbox = 2,
- /// <summary>
- /// The "Ftp" button is visible.
- /// </summary>
- Ftp = 4,
- /// <summary>
- /// The "GoogleDrive" button is visible.
- /// </summary>
- GoogleDrive = 8,
- /// <summary>
- /// The "SkyDrive" button is visible.
- /// </summary>
- SkyDrive = 16,
- /// <summary>
- /// The "S3" button is visible.
- /// </summary>
- S3 = 32,
- /// <summary>
- /// The All export in clouds buttons is visible.
- /// </summary>
- All = Box | Dropbox | Ftp | GoogleDrive | SkyDrive | S3
- }
- /// <summary>
- /// Specifies the set of export by messenger buttons available in the preview.
- /// </summary>
- [Flags]
- [EditorAttribute("FastReport.TypeEditors.FlagsEditor, FastReport", typeof(UITypeEditor))]
- public enum PreviewMessengers
- {
- /// <summary>
- /// No exports by messengers visible.
- /// </summary>
- None = 0,
- /// <summary>
- /// The "Xmpp" button is visible.
- /// </summary>
- Xmpp = 1,
- /// <summary>
- /// The All export by messengers buttons is visible.
- /// </summary>
- All = Xmpp
- }
- /// <summary>
- /// Contains some settings of the preview window.
- /// </summary>
- [TypeConverter(typeof(FastReport.TypeConverters.FRExpandableObjectConverter))]
- public class PreviewSettings
- {
- #region Fields
- private PreviewButtons buttons;
- private int pagesInCache;
- private bool showInTaskbar;
- private bool topMost;
- private Icon icon;
- private string text;
- private bool fastScrolling;
- private bool allowPrintToFile;
- private string saveInitialDirectory;
- #endregion
- #region Properties
- /// <summary>
- /// Occurs when the standard preview window opened.
- /// </summary>
- /// <remarks>
- /// You may use this event to change the standard preview window, for example, add an own button to it.
- /// The <b>sender</b> parameter in this event is the <b>PreviewControl</b>.
- /// </remarks>
- public event EventHandler PreviewOpened;
- /// <summary>
- /// Gets or sets a set of buttons that will be visible in the preview's toolbar.
- /// </summary>
- /// <example>
- /// Here is an example how you can disable the "Print" and "EMail" buttons:
- /// <code>
- /// Config.PreviewSettings.Buttons = PreviewButtons.Open |
- /// PreviewButtons.Save |
- /// PreviewButtons.Find |
- /// PreviewButtons.Zoom |
- /// PreviewButtons.Outline |
- /// PreviewButtons.PageSetup |
- /// PreviewButtons.Edit |
- /// PreviewButtons.Watermark |
- /// PreviewButtons.Navigator |
- /// PreviewButtons.Close;
- /// </code>
- /// </example>
- [DefaultValue(PreviewButtons.All)]
- public PreviewButtons Buttons
- {
- get { return buttons; }
- set { buttons = value; }
- }
- #if !COMMUNITY
- /// <summary>
- /// Specifies the set of exports that will be available in the preview's "save" menu.
- /// </summary>
- [DefaultValue(PreviewExports.All)]
- public PreviewExports Exports
- {
- get => ExportsOptions.GetInstance().Exports;
- set => ExportsOptions.GetInstance().Exports = value;
- }
- /// <summary>
- /// Specifies the set of exports in clouds that will be available in the preview's "save" menu.
- /// </summary>
- [DefaultValue(PreviewClouds.All)]
- public PreviewClouds Clouds
- {
- get => ExportsOptions.GetInstance().Clouds;
- set => ExportsOptions.GetInstance().Clouds = value;
- }
- /// <summary>
- /// Specifies the set of exports by messengers that will be available in the preview's "save" menu.
- /// </summary>
- //[DefaultValue(PreviewMessengers.All)]
- [DefaultValue(PreviewMessengers.None)]
- [Browsable(false)]
- public PreviewMessengers Messengers
- {
- get => ExportsOptions.GetInstance().Messengers;
- set => ExportsOptions.GetInstance().Messengers = value;
- }
- #endif
- /// <summary>
- /// Gets or sets the number of prepared pages that can be stored in the memory cache during preview.
- /// </summary>
- /// <remarks>
- /// Decrease this value if your prepared report contains a lot of pictures. This will
- /// save the RAM memory.
- /// </remarks>
- [DefaultValue(50)]
- public int PagesInCache
- {
- get { return pagesInCache; }
- set { pagesInCache = value; }
- }
- /// <summary>
- /// Gets or sets a value indicating whether the preview window is displayed in the Windows taskbar.
- /// </summary>
- [DefaultValue(false)]
- public bool ShowInTaskbar
- {
- get { return showInTaskbar; }
- set { showInTaskbar = value; }
- }
- /// <summary>
- /// Gets or sets a value indicating whether the preview window should be displayed as a topmost form.
- /// </summary>
- [DefaultValue(false)]
- public bool TopMost
- {
- get { return topMost; }
- set { topMost = value; }
- }
- /// <summary>
- /// Gets or sets the icon for the preview window.
- /// </summary>
- public Icon Icon
- {
- get
- {
- if (icon == null)
- icon = ResourceLoader.GetIcon("icon16.ico");
- return icon;
- }
- set { icon = value; }
- }
- /// <summary>
- /// Gets or sets the text for the preview window.
- /// </summary>
- /// <remarks>
- /// If no text is set, the default text "Preview" will be used.
- /// </remarks>
- public string Text
- {
- get { return text; }
- set { text = value; }
- }
- /// <summary>
- /// Gets or sets a value indicating whether the fast scrolling method should be used.
- /// </summary>
- /// <remarks>
- /// If you enable this property, the gradient background will be disabled.
- /// </remarks>
- [DefaultValue(false)]
- public bool FastScrolling
- {
- get { return fastScrolling; }
- set { fastScrolling = value; }
- }
- /// <summary>
- /// Enables or disables the "Print to file" feature in the print dialog.
- /// </summary>
- [DefaultValue(true)]
- public bool AllowPrintToFile
- {
- get { return allowPrintToFile; }
- set { allowPrintToFile = value; }
- }
- /// <summary>
- /// Gets or sets the initial directory that is displayed by a save file dialog.
- /// </summary>
- public string SaveInitialDirectory
- {
- get { return saveInitialDirectory; }
- set { saveInitialDirectory = value; }
- }
- #endregion
- internal void OnPreviewOpened(PreviewControl sender)
- {
- if (PreviewOpened != null)
- PreviewOpened(sender, EventArgs.Empty);
- }
- /// <summary>
- /// Initializes a new instance of the <b>PreviewSettings</b> class with default settings.
- /// </summary>
- public PreviewSettings()
- {
- buttons = PreviewButtons.All;
- pagesInCache = 50;
- text = "";
- allowPrintToFile = true;
- }
- }
- }
|