tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / inc / SamplingDialog.hxx
blobe561092a80f16c04b5cb0f82084852a674a94a57
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 #pragma once
13 #include <address.hxx>
14 #include "anyrefdg.hxx"
15 #include "viewdata.hxx"
17 class ScSamplingDialog : public ScAnyRefDlgController
19 public:
20 ScSamplingDialog(
21 SfxBindings* pB, SfxChildWindow* pCW,
22 weld::Window* pParent, ScViewData& rViewData );
24 virtual ~ScSamplingDialog() override;
26 virtual void SetReference( const ScRange& rRef, ScDocument& rDoc ) override;
27 virtual void SetActive() override;
28 virtual void Close() override;
30 private:
31 formula::RefEdit* mpActiveEdit;
33 // Data
34 ScViewData& mViewData;
35 const ScDocument& mDocument;
37 ScRange mInputRange;
38 ScAddress::Details mAddressDetails;
39 ScAddress mOutputAddress;
41 ScAddress mCurrentAddress;
43 sal_Int64 mnLastSampleSizeValue;
44 sal_Int64 mnLastPeriodValue;
46 bool mDialogLostFocus;
48 // Widgets
49 std::unique_ptr<weld::Label> mxInputRangeLabel;
50 std::unique_ptr<formula::RefEdit> mxInputRangeEdit;
51 std::unique_ptr<formula::RefButton> mxInputRangeButton;
53 std::unique_ptr<weld::Label> mxOutputRangeLabel;
54 std::unique_ptr<formula::RefEdit> mxOutputRangeEdit;
55 std::unique_ptr<formula::RefButton> mxOutputRangeButton;
57 std::unique_ptr<weld::SpinButton> mxSampleSize;
58 std::unique_ptr<weld::SpinButton> mxPeriod;
60 std::unique_ptr<weld::RadioButton> mxRandomMethodRadio;
61 std::unique_ptr<weld::CheckButton> mxWithReplacement;
62 std::unique_ptr<weld::CheckButton> mxKeepOrder;
63 std::unique_ptr<weld::RadioButton> mxPeriodicMethodRadio;
65 std::unique_ptr<weld::Button> mxButtonOk;
66 std::unique_ptr<weld::Button> mxButtonCancel;
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( ButtonClicked, 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::Toggleable&, void );
86 DECL_LINK( RefInputModifyHandler, formula::RefEdit&, void );
87 DECL_LINK( CheckHdl, weld::Toggleable&, void );
88 void ToggleSamplingMethod();
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */