tdf#126095 sd notebookbar: don't force table/media toolbar

Perhaps the entire function could return early
in case the notebookbar is active, but only if all of them
have a context notebookbar tab.
Some of them I can't check since I don't know how to trigger them.

Images, media, and tables all do have a context bar.
(Media's bar is missing useful things like location, mute,
and even file-location path.
(Those will come separately in another commit.)

Change-Id: Ic4623a1cab3abc1ac1f83622cbd11e549d2b0b98
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154559
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
This commit is contained in:
Justin Luth
2023-07-18 02:33:24 +02:00
parent 1de07de0cb
commit e58e251756
+40 -34
View File
@@ -31,6 +31,7 @@
#include <o3tl/deleter.hxx>
#include <o3tl/enumrange.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/notebookbar/SfxNotebookBar.hxx>
#include <sfx2/objsh.hxx>
#include <sfx2/toolbarids.hxx>
#include <sfx2/viewfrm.hxx>
@@ -1043,42 +1044,47 @@ void ToolBarRules::SelectionHasChanged (
mpToolBarManager->ResetToolBars(ToolBarManager::ToolBarGroup::Function);
switch (rView.GetContext())
if (!sfx2::SfxNotebookBar::IsActive())
{
case SdrViewContext::Graphic:
if( !bTextEdit )
mpToolBarManager->SetToolBarShell(ToolBarManager::ToolBarGroup::Function, ToolbarId::Draw_Graf_Toolbox);
break;
case SdrViewContext::Media:
if( !bTextEdit )
mpToolBarManager->SetToolBarShell(ToolBarManager::ToolBarGroup::Function, ToolbarId::Draw_Media_Toolbox);
break;
case SdrViewContext::Table:
mpToolBarManager->SetToolBarShell(ToolBarManager::ToolBarGroup::Function, ToolbarId::Draw_Table_Toolbox);
bTextEdit = true;
break;
case SdrViewContext::Standard:
default:
if( !bTextEdit )
{
switch(rViewShell.GetShellType())
{
case ::sd::ViewShell::ST_IMPRESS:
case ::sd::ViewShell::ST_DRAW:
case ::sd::ViewShell::ST_NOTES:
case ::sd::ViewShell::ST_HANDOUT:
mpToolBarManager->SetToolBar(
ToolBarManager::ToolBarGroup::Function,
ToolBarManager::msDrawingObjectToolBar);
break;
default:
break;
}
switch (rView.GetContext())
{
case SdrViewContext::Graphic:
if (!bTextEdit)
mpToolBarManager->SetToolBarShell(ToolBarManager::ToolBarGroup::Function,
ToolbarId::Draw_Graf_Toolbox);
break;
}
case SdrViewContext::Media:
if (!bTextEdit)
mpToolBarManager->SetToolBarShell(ToolBarManager::ToolBarGroup::Function,
ToolbarId::Draw_Media_Toolbox);
break;
case SdrViewContext::Table:
mpToolBarManager->SetToolBarShell(ToolBarManager::ToolBarGroup::Function,
ToolbarId::Draw_Table_Toolbox);
bTextEdit = true;
break;
case SdrViewContext::Standard:
default:
if (!bTextEdit)
{
switch(rViewShell.GetShellType())
{
case ::sd::ViewShell::ST_IMPRESS:
case ::sd::ViewShell::ST_DRAW:
case ::sd::ViewShell::ST_NOTES:
case ::sd::ViewShell::ST_HANDOUT:
mpToolBarManager->SetToolBar(ToolBarManager::ToolBarGroup::Function,
ToolBarManager::msDrawingObjectToolBar);
break;
default:
break;
}
break;
}
}
}
if( bTextEdit )