diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2022-02-22 13:03:24 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2022-05-01 20:19:23 +0200 |
commit | 22887ce7b1ea890e06f4b64bafc97686f30ec129 (patch) | |
tree | 8dc850bd4463dfc6f65510000c443c27827c87c8 /sfx2 | |
parent | db2e2e555b26c92af38be13f68d494423fc236e3 (diff) |
lok: reset ui mode state when switch to notebookbar cancelled
We have to keep state in the register in sync with the view.
When we cancelled notebookbar usage we need to revert Default state
so next time we will be able to activate notebookbar.
Change-Id: Ie5f7d0160c9c22c6621aca73b2cdd7197f86ff78
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133325
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133654
Tested-by: Jenkins
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/notebookbar/SfxNotebookBar.cxx | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx index 3f7bb9863314..58647afe2645 100644 --- a/sfx2/source/notebookbar/SfxNotebookBar.cxx +++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx @@ -288,6 +288,26 @@ bool SfxNotebookBar::IsActive() return false; } +void SfxNotebookBar::ResetActiveToolbarModeToDefault(vcl::EnumContext::Application eApp) +{ + const OUString appName( lcl_getAppName( eApp ) ); + + if ( appName.isEmpty() ) + return; + + const OUString aPath = "org.openoffice.Office.UI.ToolbarMode/Applications/" + appName; + + utl::OConfigurationTreeRoot aAppNode( + ::comphelper::getProcessComponentContext(), + aPath, + true); + if ( !aAppNode.isValid() ) + return; + + aAppNode.setNodeValue( "Active", makeAny( OUString( "Default" ) ) ); + aAppNode.commit(); +} + void SfxNotebookBar::ExecMethod(SfxBindings& rBindings, const OUString& rUIName) { // Save active UI file name @@ -333,9 +353,13 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow, const Reference<frame::XModuleManager> xModuleManager = frame::ModuleManager::create( xContext ); OUString aModuleName = xModuleManager->identify( xFrame ); vcl::EnumContext::Application eApp = vcl::EnumContext::GetApplicationEnum( aModuleName ); - OUString sFile = lcl_getNotebookbarFileName( eApp ); + + OUString sFile; if (comphelper::LibreOfficeKit::isActive()) sFile = "notebookbar_online.ui"; + else + sFile = lcl_getNotebookbarFileName( eApp ); + OUString sNewFile = rUIFile + sFile; OUString sCurrentFile; VclPtr<NotebookBar> pNotebookBar = pSysWindow->GetNotebookBar(); @@ -357,6 +381,7 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow, && bSkippedFirstInit.find(pViewShell) == bSkippedFirstInit.end()) { bSkippedFirstInit[pViewShell] = true; + ResetActiveToolbarModeToDefault(eApp); return false; } |