Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / sc / source / ui / inc / RandomNumberGeneratorDialog.hxx
blob4dd9c4b10b2a939a36d0cfb8f3ba33f042648a86
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
9 */
11 #ifndef INCLUDED_SC_SOURCE_UI_INC_RANDOMNUMBERGENERATORDIALOG_HXX
12 #define INCLUDED_SC_SOURCE_UI_INC_RANDOMNUMBERGENERATORDIALOG_HXX
14 #include "global.hxx"
15 #include "address.hxx"
16 #include "anyrefdg.hxx"
18 #include <vcl/fixed.hxx>
19 #include <vcl/group.hxx>
20 #include <vcl/lstbox.hxx>
22 #include <boost/optional.hpp>
24 class ScRandomNumberGeneratorDialog : public ScAnyRefDlg
26 public:
27 ScRandomNumberGeneratorDialog(
28 SfxBindings* pB, SfxChildWindow* pCW,
29 vcl::Window* pParent, ScViewData* pViewData );
31 virtual ~ScRandomNumberGeneratorDialog();
32 virtual void dispose() override;
34 virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) override;
35 virtual void SetActive() override;
36 virtual bool Close() override;
38 private:
39 // Widgets
40 VclPtr<FixedText> mpInputRangeText;
41 VclPtr<formula::RefEdit> mpInputRangeEdit;
42 VclPtr<formula::RefButton> mpInputRangeButton;
43 VclPtr<ListBox> mpDistributionCombo;
44 VclPtr<FixedText> mpParameter1Text;
45 VclPtr<NumericField> mpParameter1Value;
46 VclPtr<FixedText> mpParameter2Text;
47 VclPtr<NumericField> mpParameter2Value;
48 VclPtr<NumericField> mpSeed;
49 VclPtr<CheckBox> mpEnableSeed;
50 VclPtr<NumericField> mpDecimalPlaces;
51 VclPtr<CheckBox> mpEnableRounding;
52 VclPtr<PushButton> mpButtonApply;
53 VclPtr<OKButton> mpButtonOk;
54 VclPtr<CloseButton> mpButtonClose;
56 // Data
57 ScViewData* mpViewData;
58 ScDocument* mpDoc;
60 ScRange maInputRange;
62 bool mbDialogLostFocus;
64 void Init();
65 void GetRangeFromSelection();
67 template<class RNG>
69 void GenerateNumbers(RNG& randomGenerator, const sal_Int16 aDistributionStringId, const boost::optional<sal_Int8> aDecimalPlaces);
71 void SelectGeneratorAndGenerateNumbers();
73 DECL_LINK_TYPED( OkClicked, Button*, void );
74 DECL_LINK_TYPED( CloseClicked, Button*, void );
75 DECL_LINK_TYPED( ApplyClicked, Button*, void );
76 DECL_LINK_TYPED( GetFocusHandler, Control&, void );
77 DECL_LINK_TYPED( LoseFocusHandler, Control&, void );
79 DECL_LINK_TYPED( InputRangeModified, Edit&, void );
80 DECL_LINK_TYPED( Parameter1ValueModified, Edit&, void );
81 DECL_LINK_TYPED( Parameter2ValueModified, Edit&, void );
82 DECL_LINK_TYPED( DistributionChanged, ListBox&, void );
83 DECL_LINK_TYPED( CheckChanged, CheckBox&, void );
87 #endif // INCLUDED_SC_SOURCE_UI_INC_RANDOMNUMBERGENERATORDIALOG_HXX
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */