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 #pragma once
12 
13 #include <sal/config.h>
14 
15 #include <optional>
16 
17 #include <address.hxx>
18 #include "anyrefdg.hxx"
19 #include "viewdata.hxx"
20 
22 {
23 public:
25  SfxBindings* pB, SfxChildWindow* pCW,
26  weld::Window* pParent, ScViewData& rViewData );
27 
28  virtual ~ScRandomNumberGeneratorDialog() override;
29 
30  virtual void SetReference( const ScRange& rRef, ScDocument& rDoc ) override;
31  virtual void SetActive() override;
32  virtual void Close() override;
33 
34 private:
35  // Data
37  const ScDocument& mrDoc;
38 
40 
42 
43  // Widgets
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;
59 
60  void Init();
61  void GetRangeFromSelection();
62 
63  template<class RNG>
64 
65  void GenerateNumbers(RNG& randomGenerator, TranslateId pDistributionStringId, const std::optional<sal_Int8> aDecimalPlaces);
66 
68 
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 );
76 
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 );
82 
83 };
84 
85 /* 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
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
void GenerateNumbers(RNG &randomGenerator, TranslateId pDistributionStringId, const std::optional< sal_Int8 > aDecimalPlaces)