1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
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
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
;
32 formula::RefEdit
* mpActiveEdit
;
35 ScViewData
* const mViewData
;
36 ScDocument
* const mDocument
;
39 ScAddress::Details
const mAddressDetails
;
40 ScAddress mOutputAddress
;
42 ScAddress
const mCurrentAddress
;
44 sal_Int64 mnLastSampleSizeValue
;
45 sal_Int64 mnLastPeriodValue
;
47 bool mDialogLostFocus
;
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
;
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();
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */