cui/source/dialogs/welcomedlg.cxx |   28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

New commits:
commit c353ebe6ef9ca9dfc8107fe2e21cc522dbb32f9b
Author:     Heiko Tietze <tietze.he...@gmail.com>
AuthorDate: Mon May 12 17:02:40 2025 +0200
Commit:     Heiko Tietze <heiko.tie...@documentfoundation.org>
CommitDate: Tue May 13 07:59:48 2025 +0200

    Resolves tdf#166543 - Apply UI choice on Welcome dialog to all modules
    
    Change-Id: Ia576d9da46602529550ce75ddfbe3c4557934f4b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185226
    Tested-by: Jenkins
    Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org>

diff --git a/cui/source/dialogs/welcomedlg.cxx 
b/cui/source/dialogs/welcomedlg.cxx
index 941bda793035..88eb32d29b5a 100644
--- a/cui/source/dialogs/welcomedlg.cxx
+++ b/cui/source/dialogs/welcomedlg.cxx
@@ -14,6 +14,8 @@
 #include "../options/appearance.hxx"
 
 #include <comphelper/dispatchcommand.hxx>
+#include <officecfg/Office/UI/ToolbarMode.hxx>
+#include <unotools/confignode.hxx>
 
 #include <sfx2/bindings.hxx>
 #include <sfx2/dispatch.hxx>
@@ -93,6 +95,32 @@ IMPL_LINK_NOARG(WelcomeDialog, OnActionClick, weld::Button&, 
void)
         {
             UITabPage* pUITabPage = static_cast<UITabPage*>(GetCurTabPage());
             OUString sCmd = pUITabPage->GetSelectedMode();
+
+            std::shared_ptr<comphelper::ConfigurationChanges> aBatch(
+                comphelper::ConfigurationChanges::create());
+            officecfg::Office::UI::ToolbarMode::ActiveWriter::set(sCmd, 
aBatch);
+            officecfg::Office::UI::ToolbarMode::ActiveCalc::set(sCmd, aBatch);
+            officecfg::Office::UI::ToolbarMode::ActiveImpress::set(sCmd, 
aBatch);
+            officecfg::Office::UI::ToolbarMode::ActiveDraw::set(sCmd, aBatch);
+            aBatch->commit();
+
+            const OUString sCurrentApp = UITabPage::GetCurrentApp();
+            if (SfxViewFrame::Current())
+            {
+                const auto& xContext = 
comphelper::getProcessComponentContext();
+                const utl::OConfigurationTreeRoot aAppNode(
+                    xContext, 
u"org.openoffice.Office.UI.ToolbarMode/Applications/"_ustr, true);
+                if (sCurrentApp != "Writer")
+                    aAppNode.setNodeValue(u"Writer/Active"_ustr, 
css::uno::Any(sCmd));
+                if (sCurrentApp != "Calc")
+                    aAppNode.setNodeValue(u"Calc/Active"_ustr, 
css::uno::Any(sCmd));
+                if (sCurrentApp != "Impress")
+                    aAppNode.setNodeValue(u"Impress/Active"_ustr, 
css::uno::Any(sCmd));
+                if (sCurrentApp != "Draw")
+                    aAppNode.setNodeValue(u"Draw/Active"_ustr, 
css::uno::Any(sCmd));
+                aAppNode.commit();
+            };
+
             comphelper::dispatchCommand(".uno:ToolbarMode?Mode:string=" + 
sCmd, {});
         }
         break;

Reply via email to