LibreOffice Module sc (master)  1
SamplingDialog.cxx
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 #include <svl/undo.hxx>
12 #include <comphelper/random.hxx>
13 #include <rangelst.hxx>
14 #include <docsh.hxx>
15 #include <document.hxx>
16 #include <reffact.hxx>
17 #include <docfunc.hxx>
18 #include <SamplingDialog.hxx>
19 #include <scresid.hxx>
20 #include <strings.hrc>
21 
23  weld::Window* pParent, ScViewData& rViewData)
24  : ScAnyRefDlgController(pSfxBindings, pChildWindow, pParent,
25  "modules/scalc/ui/samplingdialog.ui", "SamplingDialog")
26  , mpActiveEdit(nullptr)
27  , mViewData(rViewData)
28  , mDocument(rViewData.GetDocument())
29  , mInputRange(ScAddress::INITIALIZE_INVALID)
30  , mAddressDetails(mDocument.GetAddressConvention(), 0, 0)
31  , mOutputAddress(ScAddress::INITIALIZE_INVALID)
32  , mCurrentAddress(rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo())
33  , mnLastSampleSizeValue(1)
34  , mnLastPeriodValue(1)
35  , mDialogLostFocus(false)
36  , mxInputRangeLabel(m_xBuilder->weld_label("input-range-label"))
37  , mxInputRangeEdit(new formula::RefEdit(m_xBuilder->weld_entry("input-range-edit")))
38  , mxInputRangeButton(new formula::RefButton(m_xBuilder->weld_button("input-range-button")))
39  , mxOutputRangeLabel(m_xBuilder->weld_label("output-range-label"))
40  , mxOutputRangeEdit(new formula::RefEdit(m_xBuilder->weld_entry("output-range-edit")))
41  , mxOutputRangeButton(new formula::RefButton(m_xBuilder->weld_button("output-range-button")))
42  , mxSampleSize(m_xBuilder->weld_spin_button("sample-size-spin"))
43  , mxPeriod(m_xBuilder->weld_spin_button("period-spin"))
44  , mxRandomMethodRadio(m_xBuilder->weld_radio_button("random-method-radio"))
45  , mxWithReplacement(m_xBuilder->weld_check_button("with-replacement"))
46  , mxKeepOrder(m_xBuilder->weld_check_button("keep-order"))
47  , mxPeriodicMethodRadio(m_xBuilder->weld_radio_button("periodic-method-radio"))
48  , mxButtonOk(m_xBuilder->weld_button("ok"))
49  , mxButtonCancel(m_xBuilder->weld_button("cancel"))
50 {
51  mxInputRangeEdit->SetReferences(this, mxInputRangeLabel.get());
52  mxInputRangeButton->SetReferences(this, mxInputRangeEdit.get());
53 
54  mxOutputRangeEdit->SetReferences(this, mxOutputRangeLabel.get());
55  mxOutputRangeButton->SetReferences(this, mxOutputRangeEdit.get());
56 
57  Init();
59 }
60 
62 {
63 }
64 
66 {
67  mxButtonCancel->connect_clicked( LINK( this, ScSamplingDialog, ButtonClicked ) );
68  mxButtonOk->connect_clicked( LINK( this, ScSamplingDialog, ButtonClicked ) );
69  mxButtonOk->set_sensitive(false);
70 
71  Link<formula::RefEdit&,void> aEditLink = LINK( this, ScSamplingDialog, GetEditFocusHandler );
72  mxInputRangeEdit->SetGetFocusHdl( aEditLink );
73  mxOutputRangeEdit->SetGetFocusHdl( aEditLink );
74  Link<formula::RefButton&,void> aButtonLink = LINK( this, ScSamplingDialog, GetButtonFocusHandler );
75  mxInputRangeButton->SetGetFocusHdl( aButtonLink );
76  mxOutputRangeButton->SetGetFocusHdl( aButtonLink );
77 
78  aEditLink = LINK( this, ScSamplingDialog, LoseEditFocusHandler );
79  mxInputRangeEdit->SetLoseFocusHdl( aEditLink );
80  mxOutputRangeEdit->SetLoseFocusHdl( aEditLink );
81  aButtonLink = LINK( this, ScSamplingDialog, LoseButtonFocusHandler );
82  mxInputRangeButton->SetLoseFocusHdl( aButtonLink );
83  mxOutputRangeButton->SetLoseFocusHdl( aButtonLink );
84 
85  Link<formula::RefEdit&,void> aLink2 = LINK( this, ScSamplingDialog, RefInputModifyHandler);
86  mxInputRangeEdit->SetModifyHdl( aLink2);
87  mxOutputRangeEdit->SetModifyHdl( aLink2);
88 
89  mxSampleSize->connect_value_changed( LINK( this, ScSamplingDialog, SamplingSizeValueModified ));
90  mxPeriod->connect_value_changed( LINK( this, ScSamplingDialog, PeriodValueModified ));
91 
93  mxRandomMethodRadio->connect_toggled( LINK( this, ScSamplingDialog, ToggleSamplingMethod ) );
94 
95  mxWithReplacement->connect_toggled( LINK( this, ScSamplingDialog, CheckHdl));
96  mxKeepOrder->connect_toggled( LINK( this, ScSamplingDialog, CheckHdl));
97 
98  mxOutputRangeEdit->GrabFocus();
99  mxPeriodicMethodRadio->set_active(true);
100 
102 }
103 
105 {
108  mxInputRangeEdit->SetText(aCurrentString);
109 }
110 
112 {
113  if ( mDialogLostFocus )
114  {
115  mDialogLostFocus = false;
116  if( mpActiveEdit )
118  }
119  else
120  {
121  m_xDialog->grab_focus();
122  }
123  RefInputDone();
124 }
125 
127 {
129 }
130 
131 void ScSamplingDialog::SetReference( const ScRange& rReferenceRange, ScDocument& rDocument )
132 {
133  if ( mpActiveEdit )
134  {
135  if ( rReferenceRange.aStart != rReferenceRange.aEnd )
137 
138  OUString aReferenceString;
139 
140  if ( mpActiveEdit == mxInputRangeEdit.get() )
141  {
142  mInputRange = rReferenceRange;
143  aReferenceString = mInputRange.Format(rDocument, ScRefFlags::RANGE_ABS_3D, mAddressDetails);
144  mxInputRangeEdit->SetRefString( aReferenceString );
145 
147  }
148  else if ( mpActiveEdit == mxOutputRangeEdit.get() )
149  {
150  mOutputAddress = rReferenceRange.aStart;
151 
152  ScRefFlags nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ?
155  aReferenceString = mOutputAddress.Format(nFormat, &rDocument, rDocument.GetAddressConvention());
156  mxOutputRangeEdit->SetRefString( aReferenceString );
157 
158  // Change sampling size according to output range selection
159  sal_Int64 aSelectedSampleSize = rReferenceRange.aEnd.Row() - rReferenceRange.aStart.Row() + 1;
160  if (aSelectedSampleSize > 1)
161  mxSampleSize->set_value(aSelectedSampleSize);
162  SamplingSizeValueModified(*mxSampleSize);
163  }
164  }
165 
166  // Enable OK if both, input range and output address are set.
167  // Disable if at least one is invalid.
168  mxButtonOk->set_sensitive(mInputRange.IsValid() && mOutputAddress.IsValid());
169 }
170 
172 {
173  ScAddress aStart = mInputRange.aStart;
174  ScAddress aEnd = mInputRange.aEnd;
175 
176  SCTAB outTab = mOutputAddress.Tab();
177  SCROW outRow = mOutputAddress.Row();
178 
179  sal_Int64 aPeriod = mxPeriod->get_value();
180 
181  for (SCROW inTab = aStart.Tab(); inTab <= aEnd.Tab(); inTab++)
182  {
183  SCCOL outCol = mOutputAddress.Col();
184  for (SCCOL inCol = aStart.Col(); inCol <= aEnd.Col(); inCol++)
185  {
186  sal_Int64 i = 0;
187  outRow = mOutputAddress.Row();
188  for (SCROW inRow = aStart.Row(); inRow <= aEnd.Row(); inRow++)
189  {
190  assert(aPeriod && "div-by-zero");
191  if (i % aPeriod == aPeriod - 1 ) // Sample the last of period
192  {
193  double aValue = mDocument.GetValue(ScAddress(inCol, inRow, inTab));
194  pDocShell->GetDocFunc().SetValueCell(ScAddress(outCol, outRow, outTab), aValue, true);
195  outRow++;
196  }
197  i++;
198  }
199  outCol++;
200  }
201  outTab++;
202  }
203 
204  return ScRange(mOutputAddress, ScAddress(outTab, outRow, outTab) );
205 }
206 
208 {
209  ScAddress aStart = mInputRange.aStart;
210  ScAddress aEnd = mInputRange.aEnd;
211 
212  SCTAB outTab = mOutputAddress.Tab();
213  SCROW outRow = mOutputAddress.Row();
214 
215  const sal_Int64 nSampleSize = mxSampleSize->get_value();
216 
217  // This implementation groups by columns. Other options could be grouping
218  // by rows or area.
219  const sal_Int64 nPopulationSize = aEnd.Row() - aStart.Row() + 1;
220 
221  const bool bWithReplacement = mxWithReplacement->get_sensitive() && mxWithReplacement->get_active();
222 
223  // WOR (WithOutReplacement) can't draw more than population. Catch that in
224  // the caller.
225  assert( bWithReplacement || nSampleSize <= nPopulationSize);
226  if (!bWithReplacement && nSampleSize > nPopulationSize)
227  // Would enter an endless loop below, bail out.
228  return ScRange( mOutputAddress);
229 
230  for (SCROW inTab = aStart.Tab(); inTab <= aEnd.Tab(); inTab++)
231  {
232  SCCOL outCol = mOutputAddress.Col();
233  for (SCCOL inCol = aStart.Col(); inCol <= aEnd.Col(); inCol++)
234  {
235  outRow = mOutputAddress.Row();
236  std::vector<bool> vUsed( nPopulationSize, false);
237 
238  while ((outRow - mOutputAddress.Row()) < nSampleSize)
239  {
240  // [a,b] *both* inclusive
241  SCROW nRandom = comphelper::rng::uniform_int_distribution( aStart.Row(), aEnd.Row());
242 
243  if (!bWithReplacement)
244  {
245  nRandom -= aStart.Row();
246  if (vUsed[nRandom])
247  {
248  // Find a nearest one, preferring forwards.
249  // Again: it's essential that the loop is entered only
250  // if nSampleSize<=nPopulationSize, which is checked
251  // above.
252  SCROW nBack = nRandom;
253  SCROW nForw = nRandom;
254  do
255  {
256  if (nForw < nPopulationSize - 1 && !vUsed[++nForw])
257  {
258  nRandom = nForw;
259  break;
260  }
261  if (nBack > 0 && !vUsed[--nBack])
262  {
263  nRandom = nBack;
264  break;
265  }
266  }
267  while (true);
268  }
269  vUsed[nRandom] = true;
270  nRandom += aStart.Row();
271  }
272 
273  const double fValue = mDocument.GetValue( ScAddress(inCol, nRandom, inTab) );
274  pDocShell->GetDocFunc().SetValueCell(ScAddress(outCol, outRow, outTab), fValue, true);
275  outRow++;
276  }
277  outCol++;
278  }
279  outTab++;
280  }
281 
282  return ScRange(mOutputAddress, ScAddress(outTab, outRow, outTab) );
283 }
284 
286 {
287  ScAddress aStart = mInputRange.aStart;
288  ScAddress aEnd = mInputRange.aEnd;
289 
290  SCTAB outTab = mOutputAddress.Tab();
291  SCROW outRow = mOutputAddress.Row();
292 
293  SCROW inRow;
294 
295  sal_Int64 aSampleSize = mxSampleSize->get_value();
296 
297  for (SCROW inTab = aStart.Tab(); inTab <= aEnd.Tab(); inTab++)
298  {
299  SCCOL outCol = mOutputAddress.Col();
300  for (SCCOL inCol = aStart.Col(); inCol <= aEnd.Col(); inCol++)
301  {
302  SCROW aPopulationSize = (aEnd.Row() - aStart.Row()) + 1;
303 
304  outRow = mOutputAddress.Row();
305  inRow = aStart.Row();
306 
307  while ((outRow - mOutputAddress.Row()) < aSampleSize)
308  {
309  double aRandomValue = comphelper::rng::uniform_real_distribution();
310 
311  if ( (aPopulationSize - (inRow - aStart.Row())) * aRandomValue >= aSampleSize - (outRow - mOutputAddress.Row()) )
312  {
313  inRow++;
314  }
315  else
316  {
317  double aValue = mDocument.GetValue( ScAddress(inCol, inRow, inTab) );
318  pDocShell->GetDocFunc().SetValueCell(ScAddress(outCol, outRow, outTab), aValue, true);
319  inRow++;
320  outRow++;
321  }
322  }
323  outCol++;
324  }
325  outTab++;
326  }
327 
328  return ScRange(mOutputAddress, ScAddress(outTab, outRow, outTab) );
329 }
330 
332 {
333  OUString aUndo(ScResId(STR_SAMPLING_UNDO_NAME));
334  ScDocShell* pDocShell = mViewData.GetDocShell();
335  SfxUndoManager* pUndoManager = pDocShell->GetUndoManager();
336 
337  ScRange aModifiedRange;
338 
339  pUndoManager->EnterListAction( aUndo, aUndo, 0, mViewData.GetViewShell()->GetViewShellId() );
340 
341  if (mxRandomMethodRadio->get_active())
342  {
343  if (mxKeepOrder->get_sensitive() && mxKeepOrder->get_active())
344  aModifiedRange = PerformRandomSamplingKeepOrder(pDocShell);
345  else
346  aModifiedRange = PerformRandomSampling(pDocShell);
347  }
348  else if (mxPeriodicMethodRadio->get_active())
349  {
350  aModifiedRange = PerformPeriodicSampling(pDocShell);
351  }
352 
353  pUndoManager->LeaveListAction();
354  pDocShell->PostPaint(aModifiedRange, PaintPartFlags::Grid);
355 }
356 
358 {
359  return mInputRange.IsValid() ? mInputRange.aEnd.Row() - mInputRange.aStart.Row() + 1 : 0;
360 }
361 
363 {
364  // Limit sample size (for WOR methods) and period if population is smaller
365  // than last known value. When enlargening the input population range the
366  // values will be adjusted up to the last known value again.
367  const sal_Int64 nPopulationSize = GetPopulationSize();
368  if (nPopulationSize <= mnLastSampleSizeValue && !mxWithReplacement->get_active())
369  mxSampleSize->set_value( nPopulationSize);
370  if (nPopulationSize <= mnLastPeriodValue)
371  mxPeriod->set_value( nPopulationSize);
372 }
373 
374 IMPL_LINK_NOARG(ScSamplingDialog, SamplingSizeValueModified, weld::SpinButton&, void)
375 {
376  if (!mxWithReplacement->get_active())
377  {
378  // For all WOR methods limit sample size to population size.
379  const sal_Int64 nPopulationSize = GetPopulationSize();
380  if (mxSampleSize->get_value() > nPopulationSize)
381  mxSampleSize->set_value(nPopulationSize);
382  }
383  mnLastSampleSizeValue = mxSampleSize->get_value();
384 }
385 
386 IMPL_LINK_NOARG(ScSamplingDialog, PeriodValueModified, weld::SpinButton&, void)
387 {
388  // Limit period to population size.
389  const sal_Int64 nPopulationSize = GetPopulationSize();
390  if (mxPeriod->get_value() > nPopulationSize)
391  mxPeriod->set_value(nPopulationSize);
392  mnLastPeriodValue = mxPeriod->get_value();
393 }
394 
395 IMPL_LINK( ScSamplingDialog, GetEditFocusHandler, formula::RefEdit&, rCtrl, void )
396 {
397  if (&rCtrl == mxInputRangeEdit.get())
398  mpActiveEdit = mxInputRangeEdit.get();
399  else if (&rCtrl == mxOutputRangeEdit.get())
400  mpActiveEdit = mxOutputRangeEdit.get();
401  else
402  mpActiveEdit = nullptr;
403 
404  if (mpActiveEdit)
405  mpActiveEdit->SelectAll();
406 }
407 
408 IMPL_LINK(ScSamplingDialog, GetButtonFocusHandler, formula::RefButton&, rCtrl, void)
409 {
410  if (&rCtrl == mxInputRangeButton.get())
411  mpActiveEdit = mxInputRangeEdit.get();
412  else if (&rCtrl == mxOutputRangeButton.get())
413  mpActiveEdit = mxOutputRangeEdit.get();
414  else
415  mpActiveEdit = nullptr;
416 
417  if (mpActiveEdit)
418  mpActiveEdit->SelectAll();
419 }
420 
421 
422 IMPL_LINK(ScSamplingDialog, ButtonClicked, weld::Button&, rButton, void)
423 {
424  if (&rButton == mxButtonOk.get())
425  {
426  PerformSampling();
427  response(RET_OK);
428  }
429  else
430  response(RET_CANCEL);
431 }
432 
433 IMPL_LINK_NOARG(ScSamplingDialog, LoseEditFocusHandler, formula::RefEdit&, void)
434 {
435  mDialogLostFocus = !m_xDialog->has_toplevel_focus();
436 }
437 
438 IMPL_LINK_NOARG(ScSamplingDialog, LoseButtonFocusHandler, formula::RefButton&, void)
439 {
440  mDialogLostFocus = !m_xDialog->has_toplevel_focus();
441 }
442 
443 IMPL_LINK_NOARG(ScSamplingDialog, ToggleSamplingMethod, weld::Toggleable&, void)
444 {
445  ToggleSamplingMethod();
446 }
447 
449 {
450  if (mxRandomMethodRadio->get_active())
451  {
452  mxPeriod->set_sensitive(false);
453  mxSampleSize->set_sensitive(true);
454  mxWithReplacement->set_sensitive(true);
455  mxKeepOrder->set_sensitive(true);
456  }
457  else if (mxPeriodicMethodRadio->get_active())
458  {
459  // WOR keeping order.
460  mxPeriod->set_sensitive(true);
461  mxSampleSize->set_sensitive(false);
462  mxWithReplacement->set_active(false);
463  mxWithReplacement->set_sensitive(false);
464  mxKeepOrder->set_active(true);
465  mxKeepOrder->set_sensitive(false);
466  }
467 }
468 
470 {
471  // Keep both checkboxes enabled so user can easily switch between the three
472  // possible combinations (one or the other or none), just uncheck the other
473  // one if one is checked. Otherwise the other checkbox would had to be
474  // disabled until user unchecks the enabled one again, which would force
475  // user to two clicks to switch.
476  if (&rBtn == mxWithReplacement.get())
477  {
478  if (mxWithReplacement->get_active())
479  {
480  // For WR can't keep order.
481  mxKeepOrder->set_active(false);
482  }
483  else
484  {
485  // For WOR limit sample size to population size.
486  SamplingSizeValueModified(*mxSampleSize);
487  }
488  }
489  else if (&rBtn == mxKeepOrder.get())
490  {
491  if (mxKeepOrder->get_active())
492  {
493  // Keep order is always WOR.
494  mxWithReplacement->set_active(false);
495  SamplingSizeValueModified(*mxSampleSize);
496  }
497  }
498 }
499 
500 IMPL_LINK_NOARG(ScSamplingDialog, RefInputModifyHandler, formula::RefEdit&, void)
501 {
502  if ( mpActiveEdit )
503  {
504  if ( mpActiveEdit == mxInputRangeEdit.get() )
505  {
506  ScRangeList aRangeList;
507  bool bValid = ParseWithNames( aRangeList, mxInputRangeEdit->GetText(), mDocument);
508  const ScRange* pRange = (bValid && aRangeList.size() == 1) ? &aRangeList[0] : nullptr;
509  if (pRange)
510  {
511  mInputRange = *pRange;
512  // Highlight the resulting range.
513  mxInputRangeEdit->StartUpdateData();
514 
515  LimitSampleSizeAndPeriod();
516  }
517  else
518  {
519  mInputRange = ScRange( ScAddress::INITIALIZE_INVALID);
520  }
521  }
522  else if ( mpActiveEdit == mxOutputRangeEdit.get() )
523  {
524  ScRangeList aRangeList;
525  bool bValid = ParseWithNames( aRangeList, mxOutputRangeEdit->GetText(), mDocument);
526  const ScRange* pRange = (bValid && aRangeList.size() == 1) ? &aRangeList[0] : nullptr;
527  if (pRange)
528  {
529  mOutputAddress = pRange->aStart;
530 
531  // Crop output range to top left address for Edit field.
532  if (pRange->aStart != pRange->aEnd)
533  {
534  ScRefFlags nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ?
537  OUString aReferenceString = mOutputAddress.Format(nFormat, &mDocument, mDocument.GetAddressConvention());
538  mxOutputRangeEdit->SetRefString( aReferenceString );
539  }
540 
541  // Change sampling size according to output range selection
542  sal_Int64 aSelectedSampleSize = pRange->aEnd.Row() - pRange->aStart.Row() + 1;
543  if (aSelectedSampleSize > 1)
544  mxSampleSize->set_value(aSelectedSampleSize);
545  SamplingSizeValueModified(*mxSampleSize);
546 
547  // Highlight the resulting range.
548  mxOutputRangeEdit->StartUpdateData();
549  }
550  else
551  {
552  mOutputAddress = ScAddress( ScAddress::INITIALIZE_INVALID);
553  }
554  }
555  }
556 
557  // Enable OK if both, input range and output address are set.
558  mxButtonOk->set_sensitive(mInputRange.IsValid() && mOutputAddress.IsValid());
559 }
560 
561 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SC_DLLPUBLIC void Format(OStringBuffer &r, ScRefFlags nFlags, const ScDocument *pDocument=nullptr, const Details &rDetails=detailsOOOa1) const
Definition: address.cxx:2116
IMPL_LINK(ScSamplingDialog, GetEditFocusHandler, formula::RefEdit &, rCtrl, void)
ScViewData & mViewData
void LimitSampleSizeAndPeriod()
ScDocShell * GetDocShell() const
Definition: viewdata.hxx:353
ScAddress aStart
Definition: address.hxx:499
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
SCROW Row() const
Definition: address.hxx:261
ScRange PerformRandomSampling(ScDocShell *pDocShell)
std::unique_ptr< weld::Label > mxOutputRangeLabel
std::unique_ptr< weld::Label > mxInputRangeLabel
std::unique_ptr< weld::CheckButton > mxWithReplacement
ScAddress aEnd
Definition: address.hxx:500
RET_CANCEL
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
Definition: documen3.cxx:494
virtual SfxUndoManager * GetUndoManager() override
Definition: docsh.cxx:2806
virtual void Close() override
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
virtual void SetReference(const ScRange &rRef, ScDocument &rDoc) override
SCTAB Tab() const
Definition: address.hxx:270
ScRange PerformPeriodicSampling(ScDocShell *pDocShell)
SC_DLLPUBLIC double GetValue(const ScAddress &rPos) const
Definition: document.cxx:3659
ScTabViewShell * GetViewShell() const
Definition: viewdata.hxx:356
bool IsValid() const
Definition: address.hxx:292
virtual ~ScSamplingDialog() override
virtual void SetActive() override
bool SetValueCell(const ScAddress &rPos, double fVal, bool bInteraction)
Definition: docfunc.cxx:858
int i
sal_Int16 SCCOL
Definition: types.hxx:21
SC_DLLPUBLIC OUString Format(const ScDocument &rDocument, ScRefFlags nFlags=ScRefFlags::ZERO, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1, bool bFullAddressNotation=false) const
Returns string with formatted cell range from aStart to aEnd, according to provided address conventio...
Definition: address.cxx:2212
std::unique_ptr< weld::SpinButton > mxSampleSize
size_t size() const
Definition: rangelst.hxx:89
ScMarkType GetSimpleArea(SCCOL &rStartCol, SCROW &rStartRow, SCTAB &rStartTab, SCCOL &rEndCol, SCROW &rEndRow, SCTAB &rEndTab) const
Definition: viewdata.cxx:1173
IMPL_LINK_NOARG(ScSamplingDialog, SamplingSizeValueModified, weld::SpinButton &, void)
virtual void RefInputDone(bool bForced=false) override
Definition: anyrefdg.cxx:756
formula::RefEdit * mpActiveEdit
ScAddress mCurrentAddress
ScAddress::Details mAddressDetails
bool IsValid() const
Definition: address.hxx:546
std::unique_ptr< formula::RefEdit > mxInputRangeEdit
void PostPaint(SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab, PaintPartFlags nPart, sal_uInt16 nExtFlags=0)
Definition: docsh3.cxx:100
double uniform_real_distribution(double a=0.0, double b=1.0)
SCCOL Col() const
Definition: address.hxx:266
size_t LeaveListAction()
std::unique_ptr< weld::SpinButton > mxPeriod
std::unique_ptr< weld::RadioButton > mxPeriodicMethodRadio
sal_Int32 SCROW
Definition: types.hxx:17
OUString ScResId(std::string_view aId)
Definition: scdll.cxx:89
std::unique_ptr< weld::RadioButton > mxRandomMethodRadio
RET_OK
int uniform_int_distribution(int a, int b)
Reference< XExecutableDialog > m_xDialog
virtual void EnterListAction(const OUString &rComment, const OUString &rRepeatComment, sal_uInt16 nId, ViewShellId nViewShellId)
std::unique_ptr< weld::Button > mxButtonOk
ScRange PerformRandomSamplingKeepOrder(ScDocShell *pDocShell)
std::unique_ptr< weld::Button > mxButtonCancel
sal_Int64 mnLastPeriodValue
ScDocFunc & GetDocFunc()
Definition: docsh.hxx:218
ScRefFlags
Definition: address.hxx:144
bool DoClose(sal_uInt16 nId)
Definition: anyrefdg.cxx:695
std::unique_ptr< formula::RefButton > mxOutputRangeButton
std::unique_ptr< formula::RefEdit > mxOutputRangeEdit
std::unique_ptr< formula::RefButton > mxInputRangeButton
sal_Int16 SCTAB
Definition: types.hxx:22
virtual void RefInputStart(formula::RefEdit *pEdit, formula::RefButton *pButton=nullptr) override
Definition: anyrefdg.cxx:726
ViewShellId GetViewShellId() const override