Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / sc / source / ui / inc / SamplingDialog.hxx
blob6fa6cdcb1903b5952d2e523df9b7ad0d59ecf735
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_SAMPLINGDIALOG_HXX
12 #define INCLUDED_SC_SOURCE_UI_INC_SAMPLINGDIALOG_HXX
14 #include <address.hxx>
15 #include "anyrefdg.hxx"
16 #include "viewdata.hxx"
18 class ScSamplingDialog : public ScAnyRefDlgController
20 public:
21 ScSamplingDialog(
22 SfxBindings* pB, SfxChildWindow* pCW,
23 weld::Window* pParent, ScViewData* pViewData );
25 virtual ~ScSamplingDialog() override;
27 virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) override;
28 virtual void SetActive() override;
29 virtual void Close() override;
31 private:
32 formula::RefEdit* mpActiveEdit;
34 // Data
35 ScViewData* const mViewData;
36 ScDocument* const mDocument;
38 ScRange mInputRange;
39 ScAddress::Details const mAddressDetails;
40 ScAddress mOutputAddress;
42 ScAddress const mCurrentAddress;
44 sal_Int64 mnLastSampleSizeValue;
45 sal_Int64 mnLastPeriodValue;
47 bool mDialogLostFocus;
49 // Widgets
50 std::unique_ptr<weld::Label> mxInputRangeLabel;
51 std::unique_ptr<formula::RefEdit> mxInputRangeEdit;
52 std::unique_ptr<formula::RefButton> mxInputRangeButton;
54 std::unique_ptr<weld::Label> mxOutputRangeLabel;
55 std::unique_ptr<formula::RefEdit> mxOutputRangeEdit;
56 std::unique_ptr<formula::RefButton> mxOutputRangeButton;
58 std::unique_ptr<weld::SpinButton> mxSampleSize;
59 std::unique_ptr<weld::SpinButton> mxPeriod;
61 std::unique_ptr<weld::RadioButton> mxRandomMethodRadio;
62 std::unique_ptr<weld::CheckButton> mxWithReplacement;
63 std::unique_ptr<weld::CheckButton> mxKeepOrder;
64 std::unique_ptr<weld::RadioButton> mxPeriodicMethodRadio;
66 std::unique_ptr<weld::Button> mxButtonOk;
68 void Init();
69 void GetRangeFromSelection();
70 void PerformSampling();
71 sal_Int64 GetPopulationSize() const;
72 void LimitSampleSizeAndPeriod();
74 ScRange PerformRandomSampling(ScDocShell* pDocShell);
75 ScRange PerformRandomSamplingKeepOrder(ScDocShell* pDocShell);
76 ScRange PerformPeriodicSampling(ScDocShell* pDocShell);
78 DECL_LINK( OkClicked, weld::Button&, void );
79 DECL_LINK( GetEditFocusHandler, formula::RefEdit&, void );
80 DECL_LINK( GetButtonFocusHandler, formula::RefButton&, void );
81 DECL_LINK( LoseEditFocusHandler, formula::RefEdit&, void );
82 DECL_LINK( LoseButtonFocusHandler, formula::RefButton&, void );
83 DECL_LINK( SamplingSizeValueModified, weld::SpinButton&, void );
84 DECL_LINK( PeriodValueModified, weld::SpinButton&, void );
85 DECL_LINK( ToggleSamplingMethod, weld::ToggleButton&, void );
86 DECL_LINK( RefInputModifyHandler, formula::RefEdit&, void );
87 DECL_LINK( CheckHdl, weld::Button&, void );
88 void ToggleSamplingMethod();
91 #endif
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */