1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
13 #include <sal/config.h>
17 #include <address.hxx>
18 #include "anyrefdg.hxx"
19 #include "viewdata.hxx"
21 class ScRandomNumberGeneratorDialog
: public ScAnyRefDlgController
24 ScRandomNumberGeneratorDialog(
25 SfxBindings
* pB
, SfxChildWindow
* pCW
,
26 weld::Window
* pParent
, ScViewData
& rViewData
);
28 virtual ~ScRandomNumberGeneratorDialog() override
;
30 virtual void SetReference( const ScRange
& rRef
, ScDocument
& rDoc
) override
;
31 virtual void SetActive() override
;
32 virtual void Close() override
;
36 ScViewData
& mrViewData
;
37 const ScDocument
& mrDoc
;
41 bool mbDialogLostFocus
;
44 std::unique_ptr
<weld::Label
> mxInputRangeText
;
45 std::unique_ptr
<formula::RefEdit
> mxInputRangeEdit
;
46 std::unique_ptr
<formula::RefButton
> mxInputRangeButton
;
47 std::unique_ptr
<weld::ComboBox
> mxDistributionCombo
;
48 std::unique_ptr
<weld::Label
> mxParameter1Text
;
49 std::unique_ptr
<weld::SpinButton
> mxParameter1Value
;
50 std::unique_ptr
<weld::Label
> mxParameter2Text
;
51 std::unique_ptr
<weld::SpinButton
> mxParameter2Value
;
52 std::unique_ptr
<weld::SpinButton
> mxSeed
;
53 std::unique_ptr
<weld::CheckButton
> mxEnableSeed
;
54 std::unique_ptr
<weld::SpinButton
> mxDecimalPlaces
;
55 std::unique_ptr
<weld::CheckButton
> mxEnableRounding
;
56 std::unique_ptr
<weld::Button
> mxButtonApply
;
57 std::unique_ptr
<weld::Button
> mxButtonOk
;
58 std::unique_ptr
<weld::Button
> mxButtonClose
;
61 void GetRangeFromSelection();
65 void GenerateNumbers(RNG
& randomGenerator
, TranslateId pDistributionStringId
, const std::optional
<sal_Int8
> aDecimalPlaces
);
67 void SelectGeneratorAndGenerateNumbers();
69 DECL_LINK( OkClicked
, weld::Button
&, void );
70 DECL_LINK( CloseClicked
, weld::Button
&, void );
71 DECL_LINK( ApplyClicked
, weld::Button
&, void );
72 DECL_LINK( GetEditFocusHandler
, formula::RefEdit
&, void );
73 DECL_LINK( GetButtonFocusHandler
, formula::RefButton
&, void );
74 DECL_LINK( LoseEditFocusHandler
, formula::RefEdit
&, void );
75 DECL_LINK( LoseButtonFocusHandler
, formula::RefButton
&, void );
77 DECL_LINK( InputRangeModified
, formula::RefEdit
&, void );
78 DECL_LINK( Parameter1ValueModified
, weld::SpinButton
&, void );
79 DECL_LINK( Parameter2ValueModified
, weld::SpinButton
&, void );
80 DECL_LINK( DistributionChanged
, weld::ComboBox
&, void );
81 DECL_LINK( CheckChanged
, weld::Toggleable
&, void );
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */