diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-04-16 17:17:58 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-04-17 22:21:54 +0200 |
commit | e54762baa8019d02cadd311e750f6ff0d276f67b (patch) | |
tree | cfc9596639edeab1a0f3d659c55be60dc138e145 /sc/source/ui/view/cellsh2.cxx | |
parent | 05a0c51ced86460b273a24f5884c99f46d8aae0d (diff) |
weld ScTPValidationValue and ScValidationDlg
Change-Id: I74b1569fe378f42c1cc78ca8d9b758c6e585c979
Reviewed-on: https://gerrit.libreoffice.org/70845
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source/ui/view/cellsh2.cxx')
-rw-r--r-- | sc/source/ui/view/cellsh2.cxx | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index f827a032e1c2..9043bd3a4ba9 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -210,6 +210,26 @@ static bool lcl_GetSortParam( const ScViewData* pData, const ScSortParam& rSortP return bSort; } +namespace +{ + // this registers the dialog which Find1RefWindow search for + class ScValidationRegisteredDlg + { + std::shared_ptr<SfxDialogController> m_xDlg; + public: + ScValidationRegisteredDlg(weld::Window* pParent, std::shared_ptr<SfxDialogController>& rDlg) + : m_xDlg(rDlg) + { + SC_MOD()->RegisterRefController(static_cast<sal_uInt16>(ScValidationDlg::SLOTID), m_xDlg, pParent); + } + ~ScValidationRegisteredDlg() + { + m_xDlg->Close(); + SC_MOD()->UnregisterRefController(static_cast<sal_uInt16>(ScValidationDlg::SLOTID), m_xDlg); + } + }; +} + void ScCellShell::ExecuteDB( SfxRequest& rReq ) { ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); @@ -870,12 +890,15 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) } // cell range picker - ScopedVclPtrInstance<ScValidationDlg> pDlg(GetViewData()->GetActiveWin(), &aArgSet, pTabViewShell); + vcl::Window* pWin = GetViewData()->GetActiveWin(); + weld::Window* pParentWin = pWin ? pWin->GetFrameWeld() : nullptr; + std::shared_ptr<SfxDialogController> xDlg(new ScValidationDlg(pParentWin, &aArgSet, pTabViewShell)); + ScValidationRegisteredDlg aRegisterThatDlgExists(pParentWin, xDlg); - short nResult = pDlg->Execute(); + short nResult = xDlg->run(); if ( nResult == RET_OK ) { - const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); + const SfxItemSet* pOutSet = static_cast<ScValidationDlg*>(xDlg.get())->GetOutputItemSet(); if ( pOutSet->GetItemState( FID_VALID_MODE, true, &pItem ) == SfxItemState::SET ) eMode = static_cast<ScValidationMode>(static_cast<const SfxAllEnumItem*>(pItem)->GetValue()); |