sd/source/ui/view/ToolBarManager.cxx |   66 +++++++++++++++++++----------------
 1 file changed, 36 insertions(+), 30 deletions(-)

New commits:
commit e58e251756ecb0312cb6891d4df23e17ef8f6fcb
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Mon Jul 17 15:43:39 2023 -0400
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Tue Jul 18 02:33:24 2023 +0200

    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 <jl...@mail.com>

diff --git a/sd/source/ui/view/ToolBarManager.cxx 
b/sd/source/ui/view/ToolBarManager.cxx
index edd39c73110b..0db84b25a3b4 100644
--- a/sd/source/ui/view/ToolBarManager.cxx
+++ b/sd/source/ui/view/ToolBarManager.cxx
@@ -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;
+        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::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::Table:
+                
mpToolBarManager->SetToolBarShell(ToolBarManager::ToolBarGroup::Function,
+                                                  
ToolbarId::Draw_Table_Toolbox);
+                bTextEdit = true;
+                break;
 
-        case SdrViewContext::Standard:
-        default:
-            if( !bTextEdit )
-            {
-                switch(rViewShell.GetShellType())
+            case SdrViewContext::Standard:
+            default:
+                if (!bTextEdit)
                 {
-                    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(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;
                 }
-                break;
-            }
+        }
     }
 
     if( bTextEdit )

Reply via email to