cui/source/dialogs/SpellDialog.cxx | 31 ++++++++++++++++++++----------- cui/source/inc/SpellDialog.hxx | 1 + cui/uiconfig/ui/spelloptionsdialog.ui | 20 +++++++++++++++++--- include/sfx2/basedlgs.hxx | 4 ++++ sc/qa/uitest/calc_tests8/tdf125051.py | 3 +-- sfx2/source/dialog/basedlgs.cxx | 11 +++++++++++ vcl/jsdialog/enabled.cxx | 2 ++ 7 files changed, 56 insertions(+), 16 deletions(-)
New commits: commit 735437b3b663f43dd7ef6bb2e8c8666673c14c49 Author: Szymon Kłos <[email protected]> AuthorDate: Tue Mar 21 17:47:01 2023 +0100 Commit: Szymon Kłos <[email protected]> CommitDate: Mon Apr 3 14:03:16 2023 +0200 jsdialog: keep button under content in SpellCheck Options Change-Id: I75b1424fe688f975b88634d6355cd0311fc07057 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149227 Tested-by: Szymon Kłos <[email protected]> Reviewed-by: Szymon Kłos <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149825 Tested-by: Jenkins diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index ebf684dfef47..09b8a9fc43f9 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -469,7 +469,8 @@ IMPL_LINK_NOARG(SpellDialog, CheckGrammarHdl, weld::Toggleable&, void) void SpellDialog::StartSpellOptDlg_Impl() { 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"); + m_xOptionsDlg = std::make_shared<SfxSingleTabDialogController>( + m_xDialog.get(), xSet.get(), "content", "cui/ui/spelloptionsdialog.ui", "SpellOptionsDialog"); 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 ); diff --git a/cui/uiconfig/ui/spelloptionsdialog.ui b/cui/uiconfig/ui/spelloptionsdialog.ui index ef690fd7da60..d5e80649731d 100644 --- a/cui/uiconfig/ui/spelloptionsdialog.ui +++ b/cui/uiconfig/ui/spelloptionsdialog.ui @@ -17,6 +17,23 @@ <property name="can_focus">False</property> <property name="orientation">vertical</property> <property name="spacing">12</property> + <child> + <object class="GtkBox" id="content"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">12</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="pack_type">begin</property> + <property name="position">0</property> + </packing> + </child> <child internal-child="action_area"> <object class="GtkButtonBox" id="dialog-action_area1"> <property name="can_focus">False</property> @@ -74,9 +91,6 @@ <property name="position">0</property> </packing> </child> - <child> - <placeholder/> - </child> </object> </child> <action-widgets> diff --git a/include/sfx2/basedlgs.hxx b/include/sfx2/basedlgs.hxx index 9b74669b3f33..f87fe22c1dbd 100644 --- a/include/sfx2/basedlgs.hxx +++ b/include/sfx2/basedlgs.hxx @@ -107,6 +107,10 @@ public: const OUString& rUIXMLDescription = OUString("sfx/ui/singletabdialog.ui"), const OUString& rID = OUString("SingleTabDialog")); + SfxSingleTabDialogController(weld::Widget* pParent, const SfxItemSet* pOptionsSet, + const OUString& rContainerId, const OUString& rUIXMLDescription, + const OUString& rID); + weld::Container* get_content_area() { return m_xContainer.get(); } virtual ~SfxSingleTabDialogController() override; diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index 285c3b5b526e..acbed68f87bc 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -233,6 +233,17 @@ SfxSingleTabDialogController::SfxSingleTabDialogController(weld::Widget *pParent m_xOKBtn->connect_clicked(LINK(this, SfxSingleTabDialogController, OKHdl_Impl)); } +SfxSingleTabDialogController::SfxSingleTabDialogController(weld::Widget *pParent, const SfxItemSet* pSet, + const OUString& rContainerId, const OUString& rUIXMLDescription, const OUString& rID) + : SfxOkDialogController(pParent, rUIXMLDescription, rID) + , m_pInputSet(pSet) + , m_xContainer(m_xBuilder->weld_container(rContainerId)) + , m_xOKBtn(m_xBuilder->weld_button("ok")) + , m_xHelpBtn(m_xBuilder->weld_button("help")) +{ + m_xOKBtn->connect_clicked(LINK(this, SfxSingleTabDialogController, OKHdl_Impl)); +} + SfxSingleTabDialogController::~SfxSingleTabDialogController() { } commit 778e034d89f1e8236cc5afdff902f165637ce9ca Author: Szymon Kłos <[email protected]> AuthorDate: Tue Mar 21 09:51:31 2023 +0100 Commit: Szymon Kłos <[email protected]> CommitDate: Mon Apr 3 14:03:04 2023 +0200 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 <[email protected]> Reviewed-by: Szymon Kłos <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149824 Tested-by: Jenkins diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index b5356aa30a45..ebf684dfef47 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 3c45ffce043b..3b8d2f9fa02f 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/sc/qa/uitest/calc_tests8/tdf125051.py b/sc/qa/uitest/calc_tests8/tdf125051.py index 5b8ccd15bb03..89314b2690e9 100644 --- a/sc/qa/uitest/calc_tests8/tdf125051.py +++ b/sc/qa/uitest/calc_tests8/tdf125051.py @@ -28,8 +28,7 @@ class tdf125051(UITestCase): #open options optionsBtn = xDialog.getChild("options") - with self.ui_test.execute_blocking_action(optionsBtn.executeAction, args=('CLICK', ()), close_button="cancel"): - pass + self.ui_test.execute_dialog_through_action(optionsBtn, "CLICK", None, "DialogExecute", "cancel") closeBtn = xDialog.getChild("close") #close Spelling dialog self.ui_test.close_dialog_through_button(closeBtn) diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx index c595873ee3fc..76c5c7b4edde 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/thesaurus.ui"
