using System.Windows.Forms;
using FastReport.Export;
using FastReport.Export.Xml;
using FastReport.Utils;

namespace FastReport.Forms
{
    /// <summary>
    /// Form for <see cref="XMLExport"/>.
    /// For internal use only.
    /// </summary>
    public partial class XMLExportForm : BaseExportForm
    {
        /// <inheritdoc/>
        public override void Init(ExportBase export)
        {
            base.Init(export);
            XMLExport xmlExport = Export as XMLExport;
            cbWysiwyg.Checked = xmlExport.Wysiwyg;
            cbPageBreaks.Checked = xmlExport.PageBreaks;
            cbDataOnly.Checked = xmlExport.DataOnly;
            cbSplitPages.Checked = xmlExport.SplitPages;
        }

        /// <inheritdoc/>
        protected override void Done()
        {
            base.Done();
            XMLExport xmlExport = Export as XMLExport;
            xmlExport.Wysiwyg = cbWysiwyg.Checked;
            xmlExport.PageBreaks = cbPageBreaks.Checked;
            xmlExport.DataOnly = cbDataOnly.Checked;
            xmlExport.SplitPages = cbSplitPages.Checked;
        }

        /// <inheritdoc/>
        public override void Localize()
        {
            base.Localize();
            MyRes res = new MyRes("Export,Xml");
            Text = res.Get("");
            res = new MyRes("Export,Misc");
            gbOptions.Text = res.Get("Options");
            cbWysiwyg.Text = res.Get("Wysiwyg");
            cbPageBreaks.Text = res.Get("PageBreaks");
            cbDataOnly.Text = Res.Get("Export,Csv,DataOnly");
            cbSplitPages.Text = Res.Get("Export,Misc,SplitPages");
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="XMLExportForm"/> class.
        /// </summary>
        public XMLExportForm()
        {
            InitializeComponent();
        }
    }
}

