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 #pragma once
12 
13 #include <address.hxx>
14 #include "anyrefdg.hxx"
15 #include "viewdata.hxx"
16 
18 {
19 public:
21  SfxBindings* pB, SfxChildWindow* pCW,
22  weld::Window* pParent, ScViewData& rViewData );
23 
24  virtual ~ScSamplingDialog() override;
25 
26  virtual void SetReference( const ScRange& rRef, ScDocument& rDoc ) override;
27  virtual void SetActive() override;
28  virtual void Close() override;
29 
30 private:
32 
33  // Data
36 
40 
42 
44  sal_Int64 mnLastPeriodValue;
45 
47 
48  // Widgets
49  std::unique_ptr<weld::Label> mxInputRangeLabel;
50  std::unique_ptr<formula::RefEdit> mxInputRangeEdit;
51  std::unique_ptr<formula::RefButton> mxInputRangeButton;
52 
53  std::unique_ptr<weld::Label> mxOutputRangeLabel;
54  std::unique_ptr<formula::RefEdit> mxOutputRangeEdit;
55  std::unique_ptr<formula::RefButton> mxOutputRangeButton;
56 
57  std::unique_ptr<weld::SpinButton> mxSampleSize;
58  std::unique_ptr<weld::SpinButton> mxPeriod;
59 
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;
64 
65  std::unique_ptr<weld::Button> mxButtonOk;
66  std::unique_ptr<weld::Button> mxButtonCancel;
67 
68  void Init();
69  void GetRangeFromSelection();
70  void PerformSampling();
71  sal_Int64 GetPopulationSize() const;
73 
77 
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 );
86  DECL_LINK( RefInputModifyHandler, formula::RefEdit&, void );
87  DECL_LINK( CheckHdl, weld::Toggleable&, void );
88  void ToggleSamplingMethod();
89 };
90 
91 /* 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