cui/source/factory/dlgfact.cxx | 10 ++++++++++ cui/source/factory/dlgfact.hxx | 11 +++++++++++ include/sfx2/sfxdlg.hxx | 14 ++++++++++++++ sfx2/source/dialog/StyleList.cxx | 29 +++++++++++++++++------------ sfx2/source/dialog/templdlg.cxx | 17 ++++++++++++++--- 5 files changed, 66 insertions(+), 15 deletions(-)
New commits: commit e16ee21f1338f79beae34f83f7d47dfe9af2d223 Author: Szymon Kłos <[email protected]> AuthorDate: Tue Dec 16 15:26:01 2025 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Fri Dec 19 09:36:27 2025 +0100 Make New Style Dialog Async - can be found in "Styles sidebar" - top toolbar contains "new by example" Change-Id: I91d5a34e85d8e2613f1f754fe4c5246e8425cccf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195730 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index bb1561f4803c..5cc0ed5ab423 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -147,6 +147,7 @@ IMPL_ABSTDLG_CLASS_ASYNC(CuiAbstractTabController,SfxTabDialogController) IMPL_ABSTDLG_CLASS(CuiAbstractController) IMPL_ABSTDLG_CLASS_ASYNC(CuiAbstractSingleTabController, SfxSingleTabDialogController) IMPL_ABSTDLG_CLASS_ASYNC(CuiAbstractWidgetTestControllerAsync,weld::GenericDialogController) +IMPL_ABSTDLG_CLASS_ASYNC(AbstractNewStyleDialog, SfxNewStyleDlg) short AbstractHyphenWordDialog_Impl::Execute() { @@ -1605,6 +1606,15 @@ AbstractDialogFactory_Impl::CreateDiagramDialog( std::make_unique<DiagramDialog>(pParent, rDiagram)); } +VclPtr<AbstractNewStyleDialog> +AbstractDialogFactory_Impl::CreateNewStyleDialog( + weld::Container* pParent, + SfxStyleSheetBasePool& rPool, + SfxStyleFamily nFamily) +{ + return VclPtr<AbstractNewStyleDialog_Impl>::Create(std::make_shared<SfxNewStyleDlg>(pParent, rPool, nFamily)); +} + #ifdef _WIN32 VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateFileExtCheckDialog(weld::Window* pParent, const OUString& sTitle, diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index 793cf193af09..65524bd88bfb 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -26,6 +26,7 @@ #include <com/sun/star/frame/XFrame.hpp> #include <cfgutil.hxx> +#include <sfx2/newstyle.hxx> #include <svx/cuicharmap.hxx> #include <dlgname.hxx> #include <cuifmsearch.hxx> @@ -439,6 +440,11 @@ DECL_ABSTDLG_CLASS_ASYNC(AbstractAdditionsDialog,weld::GenericDialogController) DECL_ABSTDLG_CLASS_ASYNC(AbstractDiagramDialog,DiagramDialog) }; +// AbstractNewStyleDialog_Impl +DECL_ABSTDLG_CLASS_SHARED_ASYNC(AbstractNewStyleDialog,AbstractNewStyleDialog,SfxNewStyleDlg) + virtual OUString GetName() const override { return m_xDlg->GetName(); } +}; + //AbstractDialogFactory_Impl implementations class AbstractDialogFactory_Impl : public SvxAbstractDialogFactory { @@ -642,6 +648,11 @@ public: weld::Window* pParent, SdrObjGroup& rDiagram) override; + virtual VclPtr<AbstractNewStyleDialog> CreateNewStyleDialog( + weld::Container* pParent, + SfxStyleSheetBasePool& rPool, + SfxStyleFamily nFamily) override; + #ifdef _WIN32 virtual VclPtr<VclAbstractDialog> CreateFileExtCheckDialog(weld::Window* pParent, const OUString& sTitle, diff --git a/include/sfx2/sfxdlg.hxx b/include/sfx2/sfxdlg.hxx index d5cf73b667bf..5b91f2fb905e 100644 --- a/include/sfx2/sfxdlg.hxx +++ b/include/sfx2/sfxdlg.hxx @@ -26,6 +26,7 @@ #include <sot/formats.hxx> #include <sfx2/tabdlg.hxx> +#include <svl/style.hxx> #include <com/sun/star/uno/Reference.h> class SfxItemSet; @@ -122,6 +123,15 @@ public: virtual void LoadLastUsedMacro() const = 0; }; +class AbstractNewStyleDialog : virtual public VclAbstractDialog +{ +protected: + virtual ~AbstractNewStyleDialog() override = default; + +public: + virtual OUString GetName() const = 0; +}; + namespace com::sun::star::frame { class XFrame; } class SFX2_DLLPUBLIC SfxAbstractDialogFactory : virtual public VclAbstractDialogFactory @@ -167,6 +177,10 @@ public: virtual VclPtr<VclAbstractDialog> CreateToolbarmodeDialog(weld::Window* _pParent) = 0; virtual VclPtr<VclAbstractDialog> CreateWidgetTestDialog(weld::Window* _pParent) = 0; + + virtual VclPtr<AbstractNewStyleDialog> CreateNewStyleDialog(weld::Container* pParent, + SfxStyleSheetBasePool& rPool, + SfxStyleFamily nFamily) = 0; }; #endif diff --git a/sfx2/source/dialog/StyleList.cxx b/sfx2/source/dialog/StyleList.cxx index 2363ca06749d..515687242285 100644 --- a/sfx2/source/dialog/StyleList.cxx +++ b/sfx2/source/dialog/StyleList.cxx @@ -43,10 +43,10 @@ #include <sfx2/bindings.hxx> #include <templdgi.hxx> #include <tplcitem.hxx> +#include <sfx2/sfxdlg.hxx> #include <sfx2/styfitem.hxx> #include <sfx2/objsh.hxx> #include <sfx2/viewsh.hxx> -#include <sfx2/newstyle.hxx> #include <sfx2/tplpitem.hxx> #include <sfx2/sfxresid.hxx> @@ -580,17 +580,22 @@ IMPL_LINK_NOARG(StyleList, NewMenuExecuteAction, void*, void) nFilter = m_nAppFilter; // why? : FloatingWindow must not be parent of a modal dialog - SfxNewStyleDlg aDlg(m_pContainer, *m_pStyleSheetPool, eFam); - auto nResult = aDlg.run(); - if (nResult == RET_OK) - { - const OUString aTemplName(aDlg.GetName()); - m_pParentDialog->Execute_Impl(SID_STYLE_NEW_BY_EXAMPLE, aTemplName, u""_ustr, - static_cast<sal_uInt16>(GetFamilyItem()->GetFamily()), *this, - nFilter); - UpdateFamily(); - m_aUpdateFamily.Call(*this); - } + SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); + VclPtr<AbstractNewStyleDialog> pDlg( + pFact->CreateNewStyleDialog(m_pContainer, *m_pStyleSheetPool, eFam)); + + pDlg->StartExecuteAsync([this, pDlg, eFam, nFilter](sal_Int32 nResult) { + if (nResult == RET_OK) + { + const OUString aTemplName(pDlg->GetName()); + m_pParentDialog->Execute_Impl(SID_STYLE_NEW_BY_EXAMPLE, aTemplName, u""_ustr, + static_cast<sal_uInt16>(eFam), *this, nFilter); + UpdateFamily(); + m_aUpdateFamily.Call(*this); + } + + pDlg->disposeOnce(); + }); } void StyleList::DropHdl(const OUString& rStyle, const OUString& rParent) commit 4debae98eab4bc525f517aacb70e47dbd367fff4 Author: Szymon Kłos <[email protected]> AuthorDate: Tue Dec 16 12:17:48 2025 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Fri Dec 19 09:36:18 2025 +0100 lok: show new style from selection in sidebar - not all options are working yet, show only "new form selection" Change-Id: I5d2321c67eac3ec77fe4f5781b190bfd8ee65434 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195707 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 934167102946..77ae7d2d05df 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -809,13 +809,20 @@ SfxTemplateDialog_Impl::SfxTemplateDialog_Impl(SfxBindings* pB, SfxTemplatePanel // shown/hidden in SfxTemplateDialog_Impl::ReplaceUpdateButtonByMenu() m_xActionTbR->set_item_help_id(u"new"_ustr, HID_TEMPLDLG_NEWBYEXAMPLE); m_xActionTbR->set_item_help_id(u"newmenu"_ustr, HID_TEMPLDLG_NEWBYEXAMPLE); - m_xActionTbR->set_item_menu(u"newmenu"_ustr, m_xToolMenu.get()); - m_xToolMenu->connect_activate(LINK(this, SfxTemplateDialog_Impl, ToolMenuSelectHdl)); m_xActionTbR->set_item_help_id(u"update"_ustr, HID_TEMPLDLG_UPDATEBYEXAMPLE); // Features not working in LOK yet if (comphelper::LibreOfficeKit::isActive()) - m_xActionTbR->hide(); + { + m_xActionTbR->set_item_visible(u"watercan"_ustr, false); + m_xActionTbR->set_item_visible(u"newmenu"_ustr, false); + m_xActionTbR->set_item_visible(u"update"_ustr, false); + } + else + { + m_xActionTbR->set_item_menu(u"newmenu"_ustr, m_xToolMenu.get()); + m_xToolMenu->connect_activate(LINK(this, SfxTemplateDialog_Impl, ToolMenuSelectHdl)); + } Initialize(); } @@ -862,6 +869,10 @@ void SfxTemplateDialog_Impl::InsertFamilyItem(sal_uInt16 nId, const SfxStyleFami void SfxTemplateDialog_Impl::ReplaceUpdateButtonByMenu() { + // in LOK we don't support all options yet + if (comphelper::LibreOfficeKit::isActive()) + return; + m_xActionTbR->set_item_visible(u"update"_ustr, false); m_xActionTbR->set_item_visible(u"new"_ustr, false); m_xActionTbR->set_item_visible(u"newmenu"_ustr, true);
