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