sfx2/source/notebookbar/SfxNotebookBar.cxx |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit 3d15de525534197960e9a9c64eba3ad2153aa113
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Fri Nov 3 08:52:32 2023 +0100
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Fri Nov 3 12:54:48 2023 +0100

    lok: notebookbar: don't recreate toolbars too often
    
    commit  004512d87ab70587d95a708116a5c2f4b870565c
    notebookbar: allow to create multiple instances for online
    
    Changed SfxNotebookBar::StateMethod so in LOK case it always
    enter to the code block which is meant to be used for
    creating or reloading notebookbar. Change that so we check
    if notebookbar was initialized for given view already.
    
    Change-Id: Icfa1e572769043509479b7b98d055120ac3d1f74
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158872
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx 
b/sfx2/source/notebookbar/SfxNotebookBar.cxx
index 0a21ffa98c8a..e9e85de271bd 100644
--- a/sfx2/source/notebookbar/SfxNotebookBar.cxx
+++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx
@@ -377,11 +377,12 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
 
         bool bChangedFile = sNewFile != sCurrentFile;
 
+        const SfxViewShell* pViewShell = SfxViewShell::Current();
+        bool hasWeldedWrapper = m_pNotebookBarWeldedWrapper.find(pViewShell) 
!= m_pNotebookBarWeldedWrapper.end();
+
         if ((!sFile.isEmpty() && bChangedFile) || !pNotebookBar || 
!pNotebookBar->IsVisible()
-            || bReloadNotebookbar || comphelper::LibreOfficeKit::isActive())
+            || bReloadNotebookbar || (comphelper::LibreOfficeKit::isActive() 
&& !hasWeldedWrapper))
         {
-            const SfxViewShell* pViewShell = SfxViewShell::Current();
-
             // Notebookbar was loaded too early what caused:
             //   * in LOK: Paste Special feature was incorrectly initialized
             // Skip first request so Notebookbar will be initialized after 
document was loaded
@@ -418,8 +419,6 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
             pNotebookBar = pSysWindow->GetNotebookBar();
             pNotebookBar->Show();
 
-
-            bool hasWeldedWrapper = 
m_pNotebookBarWeldedWrapper.find(pViewShell) != 
m_pNotebookBarWeldedWrapper.end();
             if ((!hasWeldedWrapper || bReloadNotebookbar) && 
pNotebookBar->IsWelded())
             {
                 sal_uInt64 nWindowId = 
reinterpret_cast<sal_uInt64>(pViewShell);

Reply via email to