LibreOffice Module sc (master)  1
SamplingDialog.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_SAMPLINGDIALOG_HXX
12 #define INCLUDED_SC_SOURCE_UI_INC_SAMPLINGDIALOG_HXX
13 
14 #include <address.hxx>
15 #include "anyrefdg.hxx"
16 #include "viewdata.hxx"
17 
19 {
20 public:
22  SfxBindings* pB, SfxChildWindow* pCW,
23  weld::Window* pParent, ScViewData& rViewData );
24 
25  virtual ~ScSamplingDialog() override;
26 
27  virtual void SetReference( const ScRange& rRef, ScDocument& rDoc ) override;
28  virtual void SetActive() override;
29  virtual void Close() override;
30 
31 private:
33 
34  // Data
37 
41 
43 
45  sal_Int64 mnLastPeriodValue;
46 
48 
49  // Widgets
50  std::unique_ptr<weld::Label> mxInputRangeLabel;
51  std::unique_ptr<formula::RefEdit> mxInputRangeEdit;
52  std::unique_ptr<formula::RefButton> mxInputRangeButton;
53 
54  std::unique_ptr<weld::Label> mxOutputRangeLabel;
55  std::unique_ptr<formula::RefEdit> mxOutputRangeEdit;
56  std::unique_ptr<formula::RefButton> mxOutputRangeButton;
57 
58  std::unique_ptr<weld::SpinButton> mxSampleSize;
59  std::unique_ptr<weld::SpinButton> mxPeriod;
60 
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;
65 
66  std::unique_ptr<weld::Button> mxButtonOk;
67  std::unique_ptr<weld::Button> mxButtonCancel;
68 
69  void Init();
70  void GetRangeFromSelection();
71  void PerformSampling();
72  sal_Int64 GetPopulationSize() const;
74 
78 
79  DECL_LINK( ButtonClicked, weld::Button&, void );
80  DECL_LINK( GetEditFocusHandler, formula::RefEdit&, void );
81  DECL_LINK( GetButtonFocusHandler, formula::RefButton&, void );
82  DECL_LINK( LoseEditFocusHandler, formula::RefEdit&, void );
83  DECL_LINK( LoseButtonFocusHandler, formula::RefButton&, void );
84  DECL_LINK( SamplingSizeValueModified, weld::SpinButton&, void );
85  DECL_LINK( PeriodValueModified, weld::SpinButton&, void );
87  DECL_LINK( RefInputModifyHandler, formula::RefEdit&, void );
88  DECL_LINK( CheckHdl, weld::Button&, void );
89  void ToggleSamplingMethod();
90 };
91 
92 #endif
93 
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScViewData & mViewData
void LimitSampleSizeAndPeriod()
std::unique_ptr< weld::CheckButton > mxKeepOrder
ScAddress mOutputAddress
sal_Int64 GetPopulationSize() const
ScSamplingDialog(SfxBindings *pB, SfxChildWindow *pCW, weld::Window *pParent, ScViewData &rViewData)
const ScDocument & mDocument
ScRange PerformRandomSampling(ScDocShell *pDocShell)
std::unique_ptr< weld::Label > mxOutputRangeLabel
std::unique_ptr< weld::Label > mxInputRangeLabel
sal_Int64 mnLastSampleSizeValue
std::unique_ptr< weld::CheckButton > mxWithReplacement
virtual void Close() override
virtual void SetReference(const ScRange &rRef, ScDocument &rDoc) override
ScRange PerformPeriodicSampling(ScDocShell *pDocShell)
virtual ~ScSamplingDialog() override
virtual void SetActive() override
DECL_LINK(ButtonClicked, weld::Button &, void)
std::unique_ptr< weld::SpinButton > mxSampleSize
formula::RefEdit * mpActiveEdit
ScAddress mCurrentAddress
ScAddress::Details mAddressDetails
std::unique_ptr< formula::RefEdit > mxInputRangeEdit
std::unique_ptr< weld::SpinButton > mxPeriod
std::unique_ptr< weld::RadioButton > mxPeriodicMethodRadio
std::unique_ptr< weld::RadioButton > mxRandomMethodRadio
std::unique_ptr< weld::Button > mxButtonOk
ScRange PerformRandomSamplingKeepOrder(ScDocShell *pDocShell)
std::unique_ptr< weld::Button > mxButtonCancel
sal_Int64 mnLastPeriodValue
std::unique_ptr< formula::RefButton > mxOutputRangeButton
std::unique_ptr< formula::RefEdit > mxOutputRangeEdit
std::unique_ptr< formula::RefButton > mxInputRangeButton