/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * */ #pragma once #include #include #include #include "anyrefdg.hxx" #include "viewdata.hxx" class ScRandomNumberGeneratorDialog : public ScAnyRefDlgController { public: ScRandomNumberGeneratorDialog( SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent, ScViewData& rViewData ); virtual ~ScRandomNumberGeneratorDialog() override; virtual void SetReference( const ScRange& rRef, ScDocument& rDoc ) override; virtual void SetActive() override; virtual void Close() override; private: // Data ScViewData& mrViewData; const ScDocument& mrDoc; ScRange maInputRange; bool mbDialogLostFocus; // Widgets std::unique_ptr mxInputRangeText; std::unique_ptr mxInputRangeEdit; std::unique_ptr mxInputRangeButton; std::unique_ptr mxDistributionCombo; std::unique_ptr mxParameter1Text; std::unique_ptr mxParameter1Value; std::unique_ptr mxParameter2Text; std::unique_ptr mxParameter2Value; std::unique_ptr mxSeed; std::unique_ptr mxEnableSeed; std::unique_ptr mxDecimalPlaces; std::unique_ptr mxEnableRounding; std::unique_ptr mxButtonApply; std::unique_ptr mxButtonOk; std::unique_ptr mxButtonClose; void Init(); void GetRangeFromSelection(); template void GenerateNumbers(RNG& randomGenerator, TranslateId pDistributionStringId, const std::optional aDecimalPlaces); void SelectGeneratorAndGenerateNumbers(); DECL_LINK( OkClicked, weld::Button&, void ); DECL_LINK( CloseClicked, weld::Button&, void ); DECL_LINK( ApplyClicked, weld::Button&, void ); DECL_LINK( GetEditFocusHandler, formula::RefEdit&, void ); DECL_LINK( GetButtonFocusHandler, formula::RefButton&, void ); DECL_LINK( LoseEditFocusHandler, formula::RefEdit&, void ); DECL_LINK( LoseButtonFocusHandler, formula::RefButton&, void ); DECL_LINK( InputRangeModified, formula::RefEdit&, void ); DECL_LINK( Parameter1ValueModified, weld::SpinButton&, void ); DECL_LINK( Parameter2ValueModified, weld::SpinButton&, void ); DECL_LINK( DistributionChanged, weld::ComboBox&, void ); DECL_LINK( CheckChanged, weld::Toggleable&, void ); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */