LibreOffice Module sc (master)  1
RandomNumberGeneratorDialog.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  */
10 
11 #ifndef INCLUDED_SC_SOURCE_UI_INC_RANDOMNUMBERGENERATORDIALOG_HXX
12 #define INCLUDED_SC_SOURCE_UI_INC_RANDOMNUMBERGENERATORDIALOG_HXX
13 
14 #include <sal/config.h>
15 
16 #include <optional>
17 
18 #include <address.hxx>
19 #include "anyrefdg.hxx"
20 #include "viewdata.hxx"
21 
23 {
24 public:
26  SfxBindings* pB, SfxChildWindow* pCW,
27  weld::Window* pParent, ScViewData& rViewData );
28 
29  virtual ~ScRandomNumberGeneratorDialog() override;
30 
31  virtual void SetReference( const ScRange& rRef, ScDocument& rDoc ) override;
32  virtual void SetActive() override;
33  virtual void Close() override;
34 
35 private:
36  // Data
38  const ScDocument& mrDoc;
39 
41 
43 
44  // Widgets
45  std::unique_ptr<weld::Label> mxInputRangeText;
46  std::unique_ptr<formula::RefEdit> mxInputRangeEdit;
47  std::unique_ptr<formula::RefButton> mxInputRangeButton;
48  std::unique_ptr<weld::ComboBox> mxDistributionCombo;
49  std::unique_ptr<weld::Label> mxParameter1Text;
50  std::unique_ptr<weld::SpinButton> mxParameter1Value;
51  std::unique_ptr<weld::Label> mxParameter2Text;
52  std::unique_ptr<weld::SpinButton> mxParameter2Value;
53  std::unique_ptr<weld::SpinButton> mxSeed;
54  std::unique_ptr<weld::CheckButton> mxEnableSeed;
55  std::unique_ptr<weld::SpinButton> mxDecimalPlaces;
56  std::unique_ptr<weld::CheckButton> mxEnableRounding;
57  std::unique_ptr<weld::Button> mxButtonApply;
58  std::unique_ptr<weld::Button> mxButtonOk;
59  std::unique_ptr<weld::Button> mxButtonClose;
60 
61  void Init();
62  void GetRangeFromSelection();
63 
64  template<class RNG>
65 
66  void GenerateNumbers(RNG& randomGenerator, const char* pDistributionStringId, const std::optional<sal_Int8> aDecimalPlaces);
67 
69 
70  DECL_LINK( OkClicked, weld::Button&, void );
71  DECL_LINK( CloseClicked, weld::Button&, void );
72  DECL_LINK( ApplyClicked, weld::Button&, void );
73  DECL_LINK( GetEditFocusHandler, formula::RefEdit&, void );
74  DECL_LINK( GetButtonFocusHandler, formula::RefButton&, void );
75  DECL_LINK( LoseEditFocusHandler, formula::RefEdit&, void );
76  DECL_LINK( LoseButtonFocusHandler, formula::RefButton&, void );
77 
78  DECL_LINK( InputRangeModified, formula::RefEdit&, void );
79  DECL_LINK( Parameter1ValueModified, weld::SpinButton&, void );
80  DECL_LINK( Parameter2ValueModified, weld::SpinButton&, void );
81  DECL_LINK( DistributionChanged, weld::ComboBox&, void );
82  DECL_LINK( CheckChanged, weld::ToggleButton&, void );
83 
84 };
85 
86 #endif // INCLUDED_SC_SOURCE_UI_INC_RANDOMNUMBERGENERATORDIALOG_HXX
87 
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScRandomNumberGeneratorDialog(SfxBindings *pB, SfxChildWindow *pCW, weld::Window *pParent, ScViewData &rViewData)
std::unique_ptr< weld::Label > mxParameter2Text
std::unique_ptr< weld::Button > mxButtonOk
std::unique_ptr< weld::CheckButton > mxEnableSeed
std::unique_ptr< weld::Button > mxButtonClose
std::unique_ptr< formula::RefEdit > mxInputRangeEdit
std::unique_ptr< weld::SpinButton > mxParameter2Value
virtual void SetReference(const ScRange &rRef, ScDocument &rDoc) override
std::unique_ptr< weld::SpinButton > mxParameter1Value
std::unique_ptr< weld::ComboBox > mxDistributionCombo
std::unique_ptr< weld::SpinButton > mxSeed
std::unique_ptr< weld::Label > mxInputRangeText
void GenerateNumbers(RNG &randomGenerator, const char *pDistributionStringId, const std::optional< sal_Int8 > aDecimalPlaces)
DECL_LINK(OkClicked, weld::Button &, void)
std::unique_ptr< weld::SpinButton > mxDecimalPlaces
std::unique_ptr< formula::RefButton > mxInputRangeButton
std::unique_ptr< weld::CheckButton > mxEnableRounding
std::unique_ptr< weld::Label > mxParameter1Text
std::unique_ptr< weld::Button > mxButtonApply