cui/source/dialogs/SpellDialog.cxx | 30 +++++++++++++++++++----------- cui/source/inc/SpellDialog.hxx | 1 + vcl/jsdialog/enabled.cxx | 2 ++ 3 files changed, 22 insertions(+), 11 deletions(-)
New commits: commit ac46f272a4946a8f18a89ba08fa376a3e879b276 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Tue Mar 21 09:51:31 2023 +0100 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Tue Mar 21 12:37:17 2023 +0000 jsdialog: enable spelling options dialog and make it async Change-Id: Idbf8661aa106d69e60ab6037052fd3d6dec28c06 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149205 Tested-by: Szymon Kłos <szymon.k...@collabora.com> Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index fcccc443aa4f..34564c712ee7 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -225,6 +225,12 @@ SpellDialog::SpellDialog(SpellDialogChildWindow* pChildWindow, SpellDialog::~SpellDialog() { + if (m_xOptionsDlg) + { + m_xOptionsDlg->response(RET_CANCEL); + m_xOptionsDlg.reset(); + } + if (m_pInitHdlEvent) Application::RemoveUserEvent(m_pInitHdlEvent); if (pImpl) @@ -462,19 +468,21 @@ IMPL_LINK_NOARG(SpellDialog, CheckGrammarHdl, weld::Toggleable&, void) void SpellDialog::StartSpellOptDlg_Impl() { - SfxItemSetFixed<SID_AUTOSPELL_CHECK,SID_AUTOSPELL_CHECK> aSet( SfxGetpApp()->GetPool() ); - SfxSingleTabDialogController aDlg(m_xDialog.get(), &aSet, "cui/ui/spelloptionsdialog.ui", "SpellOptionsDialog"); + auto xSet = std::make_shared<SfxItemSetFixed<SID_AUTOSPELL_CHECK,SID_AUTOSPELL_CHECK>>( SfxGetpApp()->GetPool() ); + m_xOptionsDlg = std::make_shared<SfxSingleTabDialogController>(m_xDialog.get(), xSet.get(), "cui/ui/spelloptionsdialog.ui", "SpellOptionsDialog"); - std::unique_ptr<SfxTabPage> xPage = SvxLinguTabPage::Create(aDlg.get_content_area(), &aDlg, &aSet); + std::unique_ptr<SfxTabPage> xPage = SvxLinguTabPage::Create(m_xOptionsDlg->get_content_area(), m_xOptionsDlg.get(), xSet.get()); static_cast<SvxLinguTabPage*>(xPage.get())->HideGroups( GROUP_MODULES ); - aDlg.SetTabPage(std::move(xPage)); - if (RET_OK == aDlg.run()) - { - InitUserDicts(); - const SfxItemSet* pOutSet = aDlg.GetOutputItemSet(); - if(pOutSet) - OfaTreeOptionsDialog::ApplyLanguageOptions(*pOutSet); - } + m_xOptionsDlg->SetTabPage(std::move(xPage)); + weld::GenericDialogController::runAsync(m_xOptionsDlg, [this, xSet] (sal_uInt32 nResult) { + if (RET_OK == nResult) + { + InitUserDicts(); + const SfxItemSet* pOutSet = m_xOptionsDlg->GetOutputItemSet(); + if(pOutSet) + OfaTreeOptionsDialog::ApplyLanguageOptions(*pOutSet); + } + }); } namespace diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx index 3c6a7b229ebb..a7e6cd398e2f 100644 --- a/cui/source/inc/SpellDialog.hxx +++ b/cui/source/inc/SpellDialog.hxx @@ -165,6 +165,7 @@ private: std::unique_ptr<weld::Button> m_xClosePB; std::unique_ptr<weld::Toolbar> m_xToolbar; std::unique_ptr<weld::CustomWeld> m_xSentenceEDWeld; + std::shared_ptr<SfxSingleTabDialogController> m_xOptionsDlg; DECL_LINK(ChangeHdl, weld::Button&, void); DECL_LINK(DoubleClickChangeHdl, weld::TreeView&, bool); diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx index 4e5c79c1bf9b..935a81ba6e6d 100644 --- a/vcl/jsdialog/enabled.cxx +++ b/vcl/jsdialog/enabled.cxx @@ -44,6 +44,7 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool bMobile) || rUIFile == u"cui/ui/imagetabpage.ui" || rUIFile == u"cui/ui/macroselectordialog.ui" || rUIFile == u"cui/ui/numberingformatpage.ui" + || rUIFile == u"cui/ui/optlingupage.ui" || rUIFile == u"cui/ui/pageformatpage.ui" || rUIFile == u"cui/ui/paragalignpage.ui" || rUIFile == u"cui/ui/paraindentspacing.ui" @@ -56,6 +57,7 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool bMobile) || rUIFile == u"cui/ui/similaritysearchdialog.ui" || rUIFile == u"cui/ui/specialcharacters.ui" || rUIFile == u"cui/ui/spellingdialog.ui" + || rUIFile == u"cui/ui/spelloptionsdialog.ui" || rUIFile == u"cui/ui/splitcellsdialog.ui" || rUIFile == u"cui/ui/textflowpage.ui" || rUIFile == u"cui/ui/transparencytabpage.ui"