summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorTomaž Vajngerl <quikee@gmail.com>2013-07-16 19:06:50 +0200
committerTomaž Vajngerl <quikee@gmail.com>2013-07-19 16:57:37 +0200
commitf2c9aa43666101c6970ea33f50fb4e780b99b97c (patch)
treebadef17067ab93d4f2f65ab013040eb92beee2a8 /sc/source
parentd2734a6ae65dc655787ba5a48d1fb5f44905a937 (diff)
fdo#66477 Add sampling feature to calc
Initial implementation of SamplingDialog. Change-Id: If26e8561705229f83777fb50d53c86b9fe056ffa
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/ui/StatisticsDialogs/SamplingDialog.cxx251
-rw-r--r--sc/source/ui/app/scdll.cxx1
-rw-r--r--sc/source/ui/inc/SamplingDialog.hxx79
-rw-r--r--sc/source/ui/inc/reffact.hxx1
-rw-r--r--sc/source/ui/view/cellsh.cxx1
-rw-r--r--sc/source/ui/view/cellsh1.cxx11
-rw-r--r--sc/source/ui/view/reffact.cxx74
-rw-r--r--sc/source/ui/view/tabvwsh.cxx1
-rw-r--r--sc/source/ui/view/tabvwshc.cxx8
9 files changed, 364 insertions, 63 deletions
diff --git a/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx b/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx
new file mode 100644
index 000000000000..c9e8c3462e01
--- /dev/null
+++ b/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx
@@ -0,0 +1,251 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include <sfx2/dispatch.hxx>
+#include <svl/zforlist.hxx>
+#include <svl/undo.hxx>
+
+#include "rangelst.hxx"
+#include "scitems.hxx"
+#include "docsh.hxx"
+#include "document.hxx"
+#include "uiitems.hxx"
+#include "reffact.hxx"
+#include "scresid.hxx"
+#include "random.hxx"
+#include "docfunc.hxx"
+#include "globstr.hrc"
+#include "sc.hrc"
+
+#include <boost/random.hpp>
+
+#include "SamplingDialog.hxx"
+
+#define ABS_DREF3D SCA_VALID | SCA_COL_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_TAB_ABSOLUTE | SCA_COL2_ABSOLUTE | SCA_ROW2_ABSOLUTE | SCA_TAB2_ABSOLUTE | SCA_TAB_3D
+
+namespace
+{
+}
+
+ScSamplingDialog::ScSamplingDialog(
+ SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, ScViewData* pViewData ) :
+ ScAnyRefDlg ( pB, pCW, pParent, "SamplingDialog", "modules/scalc/ui/samplingdialog.ui" ),
+ mViewData ( pViewData ),
+ mDocument ( pViewData->GetDocument() ),
+ mAddressDetails ( mDocument->GetAddressConvention(), 0, 0 ),
+ mCurrentAddress ( pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo() ),
+ mDialogLostFocus( false )
+{
+ get(mpInputRangeLabel, "input-range-label");
+ get(mpInputRangeEdit, "input-range-edit");
+ mpInputRangeEdit->SetReferences(this, mpInputRangeLabel);
+ get(mpInputRangeButton, "input-range-button");
+ mpInputRangeButton->SetReferences(this, mpInputRangeEdit);
+
+ get(mpOutputRangeLabel, "output-range-label");
+ get(mpOutputRangeEdit, "output-range-edit");
+ mpOutputRangeEdit->SetReferences(this, mpOutputRangeLabel);
+ get(mpOutputRangeButton, "output-range-button");
+ mpOutputRangeButton->SetReferences(this, mpOutputRangeEdit);
+
+ get(mpButtonOk, "ok");
+ get(mpButtonApply, "apply");
+ get(mpButtonCancel, "cancel");
+
+ Init();
+ GetRangeFromSelection();
+}
+
+void ScSamplingDialog::Init()
+{
+ mpButtonOk->SetClickHdl( LINK( this, ScSamplingDialog, OkClicked ) );
+ mpButtonCancel->SetClickHdl( LINK( this, ScSamplingDialog, CancelClicked ) );
+ mpButtonApply->SetClickHdl( LINK( this, ScSamplingDialog, ApplyClicked ) );
+
+ Link aLink = LINK( this, ScSamplingDialog, GetFocusHandler );
+ mpInputRangeEdit->SetGetFocusHdl( aLink );
+ mpInputRangeButton->SetGetFocusHdl( aLink );
+ mpOutputRangeEdit->SetGetFocusHdl( aLink );
+ mpOutputRangeButton->SetGetFocusHdl( aLink );
+
+ aLink = LINK( this, ScSamplingDialog, LoseFocusHandler );
+ mpInputRangeEdit->SetLoseFocusHdl( aLink );
+ mpInputRangeButton->SetLoseFocusHdl( aLink );
+ mpOutputRangeEdit->SetLoseFocusHdl( aLink );
+ mpOutputRangeButton->SetLoseFocusHdl( aLink );
+}
+
+void ScSamplingDialog::GetRangeFromSelection()
+{
+ OUString aCurrentString;
+ mViewData->GetSimpleArea(mInputRange);
+ mInputRange.Format( aCurrentString, ABS_DREF3D, mDocument, mAddressDetails );
+ mpInputRangeEdit->SetText( aCurrentString );
+}
+
+
+ScSamplingDialog::~ScSamplingDialog()
+{
+}
+
+void ScSamplingDialog::SetActive()
+{
+ if ( mDialogLostFocus )
+ {
+ mDialogLostFocus = false;
+ if( mpActiveEdit )
+ mpActiveEdit->GrabFocus();
+ }
+ else
+ {
+ GrabFocus();
+ }
+ RefInputDone();
+}
+
+sal_Bool ScSamplingDialog::Close()
+{
+ return DoClose( ScSamplingDialogWrapper::GetChildWindowId() );
+}
+
+void ScSamplingDialog::SetReference( const ScRange& rReferenceRange, ScDocument* pDocument )
+{
+ if ( mpActiveEdit )
+ {
+ if ( rReferenceRange.aStart != rReferenceRange.aEnd )
+ RefInputStart( mpActiveEdit );
+
+ String aReferenceString;
+
+ if ( mpActiveEdit == mpInputRangeEdit )
+ {
+ mInputRange = rReferenceRange;
+ mInputRange.Format( aReferenceString, ABS_DREF3D, pDocument, mAddressDetails );
+ mpInputRangeEdit->SetRefString( aReferenceString );
+ }
+ else if ( mpActiveEdit == mpOutputRangeEdit )
+ {
+ mOutputAddress = rReferenceRange.aStart;
+ sal_uInt16 nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ? SCA_ABS : SCA_ABS_3D;
+ mOutputAddress.Format( aReferenceString, nFormat, pDocument, pDocument->GetAddressConvention() );
+ mpActiveEdit->SetRefString( aReferenceString );
+ }
+ }
+}
+
+void ScSamplingDialog::PerformSampling()
+{
+ OUString aUndo("A");
+ ScDocShell* pDocShell = mViewData->GetDocShell();
+ svl::IUndoManager* pUndoManager = pDocShell->GetUndoManager();
+ pUndoManager->EnterListAction( aUndo, aUndo );
+
+ SCCOL nColStart = mInputRange.aStart.Col();
+ SCCOL nColEnd = mInputRange.aEnd.Col();
+ SCROW nRowStart = mInputRange.aStart.Row();
+ SCROW nRowEnd = mInputRange.aEnd.Row();
+ SCTAB nTabStart = mInputRange.aStart.Tab();
+ SCTAB nTabEnd = mInputRange.aEnd.Tab();
+
+ TimeValue now;
+ osl_getSystemTime(&now);
+ boost::mt19937 seed(now.Nanosec);
+ boost::uniform_01<boost::mt19937> rng(seed);
+
+ SCTAB nOutTab = mOutputAddress.Tab();
+ SCCOL nOutCol = mOutputAddress.Col();
+ SCROW nOutRow = mOutputAddress.Row();
+ for (SCROW nTab = nTabStart; nTab <= nTabEnd; nTab++)
+ {
+ nOutCol = mOutputAddress.Col();
+ for (SCCOL nCol = nColStart; nCol <= nColEnd; nCol++)
+ {
+ nOutRow = mOutputAddress.Row();
+ SCROW nRow = nRowStart;
+
+ SCROW t = 0;
+ SCROW N = (nRowEnd - nRowStart) + 1;
+ int m = 0;
+ int n = 3;
+ double u;
+
+ while (m < n)
+ {
+ u = rng();
+ if ( (N - t)*u >= n - m )
+ {
+ nRow++;
+ t++;
+ }
+ else
+ {
+ double aValue = mDocument->GetValue( ScAddress(nCol, nRow, nTab) );
+ pDocShell->GetDocFunc().SetValueCell(ScAddress(nOutCol, nOutRow, nOutTab), aValue, true);
+ nRow++;
+ nOutRow++;
+ m++;
+ t++;
+ }
+ }
+
+ nOutCol++;
+ }
+ nOutTab++;
+ }
+
+ ScRange aOutputRange(mOutputAddress, ScAddress(nOutCol, nOutRow, nOutTab) );
+
+ pUndoManager->LeaveListAction();
+
+ pDocShell->PostPaint( aOutputRange, PAINT_GRID );
+}
+
+IMPL_LINK( ScSamplingDialog, OkClicked, PushButton*, /*pButton*/ )
+{
+ PerformSampling();
+ Close();
+ return 0;
+}
+
+
+IMPL_LINK( ScSamplingDialog, ApplyClicked, PushButton*, /*pButton*/ )
+{
+ PerformSampling();
+ return 0;
+}
+
+IMPL_LINK( ScSamplingDialog, CancelClicked, PushButton*, /*pButton*/ )
+{
+ Close();
+ return 0;
+}
+
+IMPL_LINK( ScSamplingDialog, GetFocusHandler, Control*, pCtrl )
+{
+ mpActiveEdit = NULL;
+
+ if( (pCtrl == (Control*) mpInputRangeEdit) || (pCtrl == (Control*) mpInputRangeButton) )
+ mpActiveEdit = mpInputRangeEdit;
+ else if( (pCtrl == (Control*) mpOutputRangeEdit) || (pCtrl == (Control*) mpOutputRangeButton) )
+ mpActiveEdit = mpOutputRangeEdit;
+
+ if( mpActiveEdit )
+ mpActiveEdit->SetSelection( Selection( 0, SELECTION_MAX ) );
+
+ return 0;
+}
+
+IMPL_LINK_NOARG(ScSamplingDialog, LoseFocusHandler)
+{
+ mDialogLostFocus = !IsActive();
+ return 0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index cb6929ecd908..60da88491796 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -268,6 +268,7 @@ void ScDLL::Init()
ScFormulaDlgWrapper ::RegisterChildWindow(false, pMod);
ScRandomNumberGeneratorDialogWrapper::RegisterChildWindow(false, pMod);
+ ScSamplingDialogWrapper ::RegisterChildWindow(false, pMod);
// First docking Window for Calc
ScFunctionChildWindow ::RegisterChildWindow(false, pMod);
diff --git a/sc/source/ui/inc/SamplingDialog.hxx b/sc/source/ui/inc/SamplingDialog.hxx
new file mode 100644
index 000000000000..b46524a940bf
--- /dev/null
+++ b/sc/source/ui/inc/SamplingDialog.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef SAMPLING_DIALOG_HXX
+#define SAMPLING_DIALOG_HXX
+
+#include "global.hxx"
+#include "address.hxx"
+#include "anyrefdg.hxx"
+
+#include <vcl/fixed.hxx>
+#include <vcl/group.hxx>
+#include <vcl/lstbox.hxx>
+
+class ScSamplingDialog : public ScAnyRefDlg
+{
+public:
+ ScSamplingDialog(
+ SfxBindings* pB, SfxChildWindow* pCW,
+ Window* pParent, ScViewData* pViewData );
+
+ virtual ~ScSamplingDialog();
+
+ virtual void SetReference( const ScRange& rRef, ScDocument* pDoc );
+ virtual void SetActive();
+ virtual sal_Bool Close();
+
+private:
+ // Widgets
+ FixedText* mpInputRangeLabel;
+ formula::RefEdit* mpInputRangeEdit;
+ formula::RefButton* mpInputRangeButton;
+
+ FixedText* mpOutputRangeLabel;
+ formula::RefEdit* mpOutputRangeEdit;
+ formula::RefButton* mpOutputRangeButton;
+
+ PushButton* mpButtonApply;
+ OKButton* mpButtonOk;
+ CancelButton* mpButtonCancel;
+
+ //
+ formula::RefEdit* mpActiveEdit;
+
+ // Data
+ ScViewData* mViewData;
+ ScDocument* mDocument;
+
+ ScRange mInputRange;
+ ScAddress::Details mAddressDetails;
+ ScAddress mOutputAddress;
+
+ ScAddress mCurrentAddress;
+
+ bool mDialogLostFocus;
+
+ void Init();
+ void GetRangeFromSelection();
+ void PerformSampling();
+
+ DECL_LINK( OkClicked, PushButton* );
+ DECL_LINK( CancelClicked, PushButton* );
+ DECL_LINK( ApplyClicked, PushButton* );
+ DECL_LINK( GetFocusHandler, Control* );
+ DECL_LINK( LoseFocusHandler, void* );
+
+};
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/reffact.hxx b/sc/source/ui/inc/reffact.hxx
index aa94ff1108eb..7c1e7d0150d0 100644
--- a/sc/source/ui/inc/reffact.hxx
+++ b/sc/source/ui/inc/reffact.hxx
@@ -51,6 +51,7 @@ DECL_WRAPPER_WITHID(ScFormulaDlgWrapper)
DECL_WRAPPER_WITHID(ScHighlightChgDlgWrapper)
DECL_WRAPPER_WITHID(ScRandomNumberGeneratorDialogWrapper)
+DECL_WRAPPER_WITHID(ScSamplingDialogWrapper)
class ScAcceptChgDlgWrapper: public SfxChildWindow
{
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index 05d55f4dee3e..489763953595 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -172,6 +172,7 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet )
break;
case FID_FILL_SERIES: // fill block
case SID_OPENDLG_RANDOM_NUMBER_GENERATOR:
+ case SID_SAMPLING_DIALOG:
case SID_OPENDLG_TABOP: // multiple-cell operations, are at least 2 cells marked?
if (pDoc->GetChangeTrack()!=NULL &&nWhich ==SID_OPENDLG_TABOP)
bDisable = sal_True;
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index daac7ec9ca4b..15953b3f3e2f 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -905,7 +905,16 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
break;
case SID_OPENDLG_RANDOM_NUMBER_GENERATOR:
{
- sal_uInt16 nId = ScRandomNumberGeneratorDialogWrapper::GetChildWindowId();
+ sal_uInt16 nId = ScRandomNumberGeneratorDialogWrapper::GetChildWindowId();
+ SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
+ SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
+
+ pScMod->SetRefDialog( nId, pWnd ? false : sal_True );
+ }
+ break;
+ case SID_SAMPLING_DIALOG:
+ {
+ sal_uInt16 nId = ScSamplingDialogWrapper::GetChildWindowId();
SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
diff --git a/sc/source/ui/view/reffact.cxx b/sc/source/ui/view/reffact.cxx
index cf7e796af408..65adb74eac06 100644
--- a/sc/source/ui/view/reffact.cxx
+++ b/sc/source/ui/view/reffact.cxx
@@ -52,6 +52,7 @@ SFX_IMPL_MODELESSDIALOG_WITHID(ScHighlightChgDlgWrapper, FID_CHG_SHOW )
SFX_IMPL_MODELESSDIALOG_WITHID(ScSimpleRefDlgWrapper, WID_SIMPLE_REF )
SFX_IMPL_MODELESSDIALOG_WITHID(ScRandomNumberGeneratorDialogWrapper, SID_OPENDLG_RANDOM_NUMBER_GENERATOR )
+SFX_IMPL_MODELESSDIALOG_WITHID(ScSamplingDialogWrapper, SID_SAMPLING_DIALOG )
SFX_IMPL_CHILDWINDOW_WITHID(ScValidityRefChildWin, SID_VALIDITY_REFERENCE)
@@ -71,7 +72,10 @@ SfxChildWinInfo ScValidityRefChildWin::GetInfo() const
return anInfo;
}
-namespace { ScTabViewShell * lcl_GetTabViewShell( SfxBindings *pBindings ); }
+namespace
+{
+ ScTabViewShell* lcl_GetTabViewShell( SfxBindings* pBindings );
+}
#define IMPL_CHILD_CTOR(Class,sid) \
Class::Class( Window* pParentP, \
@@ -96,101 +100,47 @@ namespace { ScTabViewShell * lcl_GetTabViewShell( SfxBindings *pBindings ); }
pViewShell->GetViewFrame()->SetChildWindow( nId, false ); \
}
-
-//=========================================================================
-
-//-------------------------------------------------------------------------
-// ScNameDlgWrapper
-//-------------------------------------------------------------------------
-
IMPL_CHILD_CTOR( ScNameDlgWrapper, FID_DEFINE_NAME )
-//-------------------------------------------------------------------------
-// ScNameDlgWrapper
-//-------------------------------------------------------------------------
-
IMPL_CHILD_CTOR( ScNameDefDlgWrapper, FID_ADD_NAME )
-//-------------------------------------------------------------------------
-// ScSolverDlgWrapper
-//-------------------------------------------------------------------------
-
IMPL_CHILD_CTOR( ScSolverDlgWrapper, SID_OPENDLG_SOLVE )
-//-------------------------------------------------------------------------
-// ScOptSolverDlgWrapper
-//-------------------------------------------------------------------------
-
IMPL_CHILD_CTOR( ScOptSolverDlgWrapper, SID_OPENDLG_OPTSOLVER )
-IMPL_CHILD_CTOR(ScXMLSourceDlgWrapper, SID_MANAGE_XML_SOURCE)
-
-//-------------------------------------------------------------------------
-// ScPivotLayoutWrapper
-//-------------------------------------------------------------------------
+IMPL_CHILD_CTOR( ScXMLSourceDlgWrapper, SID_MANAGE_XML_SOURCE)
IMPL_CHILD_CTOR( ScPivotLayoutWrapper, SID_OPENDLG_PIVOTTABLE )
-//-------------------------------------------------------------------------
-// ScTabOpDlgWrapper
-//-------------------------------------------------------------------------
-
IMPL_CHILD_CTOR( ScTabOpDlgWrapper, SID_OPENDLG_TABOP )
-//-------------------------------------------------------------------------
-// ScFilterDlgWrapper
-//-------------------------------------------------------------------------
-
IMPL_CHILD_CTOR( ScFilterDlgWrapper, SID_FILTER )
-//-------------------------------------------------------------------------
-// ScSpecialFilterDlgWrapper
-//-------------------------------------------------------------------------
-
IMPL_CHILD_CTOR( ScSpecialFilterDlgWrapper, SID_SPECIAL_FILTER )
-//-------------------------------------------------------------------------
-// ScDbNameDlgWrapper
-//-------------------------------------------------------------------------
-
IMPL_CHILD_CTOR( ScDbNameDlgWrapper, SID_DEFINE_DBNAME )
-//-------------------------------------------------------------------------
-// ScColRowNameRangesDlgWrapper
-//-------------------------------------------------------------------------
-
IMPL_CHILD_CTOR( ScColRowNameRangesDlgWrapper, SID_DEFINE_COLROWNAMERANGES )
-//-------------------------------------------------------------------------
-// ScConsolidateDlgWrapper
-//-------------------------------------------------------------------------
-
IMPL_CHILD_CTOR( ScConsolidateDlgWrapper, SID_OPENDLG_CONSOLIDATE )
-//-------------------------------------------------------------------------
-// ScPrintAreasDlgWrapper
-//-------------------------------------------------------------------------
-
IMPL_CHILD_CTOR( ScPrintAreasDlgWrapper, SID_OPENDLG_EDIT_PRINTAREA )
-//-------------------------------------------------------------------------
-// ScFormulaDlgWrapper
-//-------------------------------------------------------------------------
-
IMPL_CHILD_CTOR( ScFormulaDlgWrapper, SID_OPENDLG_FUNCTION )
-
IMPL_CHILD_CTOR( ScRandomNumberGeneratorDialogWrapper, SID_OPENDLG_RANDOM_NUMBER_GENERATOR )
+IMPL_CHILD_CTOR( ScSamplingDialogWrapper, SID_SAMPLING_DIALOG )
+
//-------------------------------------------------------------------------
// ScSimpleRefDlgWrapper
//-------------------------------------------------------------------------
static sal_Bool bScSimpleRefFlag;
-static long nScSimpleRefHeight;
-static long nScSimpleRefWidth;
-static long nScSimpleRefX;
-static long nScSimpleRefY;
+static long nScSimpleRefHeight;
+static long nScSimpleRefWidth;
+static long nScSimpleRefX;
+static long nScSimpleRefY;
static sal_Bool bAutoReOpen=sal_True;
ScSimpleRefDlgWrapper::ScSimpleRefDlgWrapper( Window* pParentP,
diff --git a/sc/source/ui/view/tabvwsh.cxx b/sc/source/ui/view/tabvwsh.cxx
index c53bf66f0e84..699a29df406a 100644
--- a/sc/source/ui/view/tabvwsh.cxx
+++ b/sc/source/ui/view/tabvwsh.cxx
@@ -82,6 +82,7 @@ SFX_IMPL_INTERFACE(ScTabViewShell,SfxViewShell,ScResId(SCSTR_TABVIEWSHELL))
SFX_CHILDWINDOW_REGISTRATION(ScValidityRefChildWin::GetChildWindowId());
SFX_CHILDWINDOW_REGISTRATION(ScRandomNumberGeneratorDialogWrapper::GetChildWindowId());
+ SFX_CHILDWINDOW_REGISTRATION(ScSamplingDialogWrapper::GetChildWindowId());
}
SFX_IMPL_NAMED_VIEWFACTORY( ScTabViewShell, "Default" )
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index a613c77b30d8..0b169bfd5feb 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -62,6 +62,7 @@
#include "xmlsourcedlg.hxx"
#include "RandomNumberGeneratorDialog.hxx"
+#include "SamplingDialog.hxx"
//------------------------------------------------------------------
@@ -320,6 +321,13 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog(
}
break;
+ case SID_SAMPLING_DIALOG:
+ {
+ ScViewData* pViewData = GetViewData();
+ pResult = new ScSamplingDialog( pB, pCW, pParent, pViewData );
+ }
+ break;
+
case SID_OPENDLG_OPTSOLVER:
{
ScViewData* pViewData = GetViewData();