using FastReport.Web.Application.Localizations;

using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;

namespace FastReport.Web.Blazor.Components.Internal.ExportSettings
{
    public partial class OpenCalcExportSettings : ExportSettingsBase
    {
        OdfExportSettingsLocalization localization;

        protected override void OnInitialized()
        {
            base.OnInitialized();
            ExportParameters["Wysiwyg"] = "true";
        }

        protected override void LocalizeForm()
        {
            var res = WebReport.Res;
            localization = new OdfExportSettingsLocalization(res);
        }

        void OnWysiwygClick(MouseEventArgs e)
        {
            ChangeBoolValue("Wysiwyg");
        }

        void OnPageBreaksClick(MouseEventArgs e)
        {
            ChangeBoolValue("PageBreaks");
        }

        void OnComplianceChange(ChangeEventArgs e)
        {
            if ((e.Value as string) == "None")
            {
                ExportParameters["OdfCompliance"] = "None";
            }
            else if ((e.Value as string) == "Odf1_2")
            {
                ExportParameters["OdfCompliance"] = "Odf1_2";
            }
        }
    }
}
