From 9bc1ffa2153d2474b023e0860d3c9c68ee18727b Mon Sep 17 00:00:00 2001 From: Maxim Monastirsky Date: Mon, 6 Jun 2022 22:50:14 +0300 Subject: tdf#125040 Make single mode toolbar context aware This patch modifies the "Standard (Single Mode)" toolbar to have an optional context-aware section, given that a corresponding singlemode-.xml files exist. This is a lot like the "Contextual Single" NB, except that it's implemented with regular toolbars, so docking/ customization/extensions/uno api etc. are all working. In addition, the "Single Toolbar" mode was modified to not show any other contextual toolbar. (But of course the single mode toolbar itself is perfectly usable outside of this mode.) Change-Id: Id746d9df59340a81962a8689b132941deea54b6c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135591 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky --- sfx2/source/appl/workwin.cxx | 2 +- sfx2/source/notebookbar/SfxNotebookBar.cxx | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index 4874db7ee5f6..fb3955ee2c5c 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -1195,7 +1195,7 @@ void SfxWorkWindow::UpdateObjectBars_Impl2() // Iterate over all Toolboxes xLayoutManager->lock(); - const bool isNotebookBarActive = sfx2::SfxNotebookBar::IsActive(); + const bool isNotebookBarActive = sfx2::SfxNotebookBar::IsActive(true); for ( auto const & n: aObjBarList ) { ToolbarId eId = n.eId; diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx index 451c94cf3966..ec1f5bf33c0d 100644 --- a/sfx2/source/notebookbar/SfxNotebookBar.cxx +++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx @@ -221,7 +221,7 @@ void SfxNotebookBar::UnlockNotebookBar() m_bLock = false; } -bool SfxNotebookBar::IsActive() +bool SfxNotebookBar::IsActive(bool bConsiderSingleToolbar) { if (m_bHide) return false; @@ -265,6 +265,9 @@ bool SfxNotebookBar::IsActive() OUString aActive = comphelper::getString( aAppNode.getNodeValue( "Active" ) ); + if (bConsiderSingleToolbar && aActive == "Single") + return true; + if (comphelper::LibreOfficeKit::isActive() && aActive == "notebookbar_online.ui") return true; -- cgit