sfx2/source/view/viewfrm.cxx |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

New commits:
commit ef1484c731140699f26d15f4cda36f1a81e73abe
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Fri Jul 7 13:53:01 2023 -0400
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Tue Jul 18 00:00:15 2023 +0200

    Revert "Revert "tdf#126006 sc SID_RELOAD: restart notebookbar""
    
    This reverts commit d0bbc16b1715a3711d872a36c7e525e8d3811669.
    
    My laptop is failing to complete UITests all the time,
    so likely this patch wasn't to blame after all.
    
    Change-Id: I3fa9fbb8ffc8df1fd9e45f8bcb6489594a8c0c46
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154199
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 196a18d3d335..0766eec86088 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -838,8 +838,18 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
 
                     UpdateDocument_Impl();
 
-                    if 
(vcl::CommandInfoProvider::GetModuleIdentifier(GetFrame().GetFrameInterface()) 
== "com.sun.star.text.TextDocument")
-                        
sfx2::SfxNotebookBar::ReloadNotebookBar(u"modules/swriter/ui/");
+                    auto sModule = 
vcl::CommandInfoProvider::GetModuleIdentifier(GetFrame().GetFrameInterface());
+                    OUString sReloadNotebookBar;
+                    if (sModule == "com.sun.star.text.TextDocument")
+                        sReloadNotebookBar = u"modules/swriter/ui/";
+                    else if (sModule == 
"com.sun.star.sheet.SpreadsheetDocument")
+                        sReloadNotebookBar = u"modules/scalc/ui/";
+                    else if (sfx2::SfxNotebookBar::IsActive()
+                             && sModule != "presentation.PresentationDocument"
+                             && sModule != 
"com.sun.star.drawing.DrawingDocument")
+                    {
+                        assert(false && "SID_RELOAD Notebookbar active, but 
not refreshed here");
+                    }
 
                     try
                     {
@@ -878,6 +888,10 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
 
                     // Propagate document closure.
                     SfxGetpApp()->NotifyEvent( SfxEventHint( 
SfxEventHintId::CloseDoc, GlobalEventConfig::GetEventName( 
GlobalEventId::CLOSEDOC ), xOldObj ) );
+
+                    // tdf#126006 Calc needs to reload the notebookbar after 
closing the document
+                    if (!sReloadNotebookBar.isEmpty())
+                        
sfx2::SfxNotebookBar::ReloadNotebookBar(sReloadNotebookBar);
                 }
 
                 // Record as done

Reply via email to