From adb901ca11afa5a153ecd433375b9ab1dfc2fd03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20K=C5=82os?= Date: Mon, 3 Aug 2020 09:40:31 +0200 Subject: [PATCH] notebookbar: control early init per view MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I9b743bc6d62256289549cd8002b76bcb918222b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99986 Tested-by: Jenkins CollaboraOffice Reviewed-by: Szymon Kłos (cherry picked from commit fddfeb653dfd5dd73cbccb4433678d397f092df9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99921 Tested-by: Jenkins --- sfx2/source/notebookbar/SfxNotebookBar.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx index dd79e65fa3ec..16a0608f7b30 100644 --- a/sfx2/source/notebookbar/SfxNotebookBar.cxx +++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include using namespace sfx2; @@ -366,13 +367,16 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow, if ((!sFile.isEmpty() && bChangedFile) || !pNotebookBar || !pNotebookBar->IsVisible() || bReloadNotebookbar || comphelper::LibreOfficeKit::isActive()) { + 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 - static bool bSkipFirstInit = true; - if (comphelper::LibreOfficeKit::isActive() && bSkipFirstInit) + static std::map bSkippedFirstInit; + if (comphelper::LibreOfficeKit::isActive() + && bSkippedFirstInit.find(pViewShell) == bSkippedFirstInit.end()) { - bSkipFirstInit = false; + bSkippedFirstInit[pViewShell] = true; return false; } @@ -393,7 +397,6 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow, pNotebookBar = pSysWindow->GetNotebookBar(); pNotebookBar->Show(); - const SfxViewShell* pViewShell = SfxViewShell::Current(); bool hasWeldedWrapper = m_pNotebookBarWeldedWrapper.find(pViewShell) != m_pNotebookBarWeldedWrapper.end(); if ((!hasWeldedWrapper || bReloadNotebookbar) && pNotebookBar->IsWelded())