diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2020-06-18 12:15:13 +0200 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2020-07-03 09:50:28 +0200 |
commit | 004512d87ab70587d95a708116a5c2f4b870565c (patch) | |
tree | 88c1baa57b3d806b430ce3138cb49fcf74c369f2 /sfx2 | |
parent | 3655ff091ebb6b2ecf0ef5dda3c290aa954df617 (diff) |
notebookbar: allow to create multiple instances for online
Change-Id: Ic8a3d07ec6ec5a5d6d56a3958e91d3074ce1493e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96936
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97788
Tested-by: Jenkins
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/notebookbar/SfxNotebookBar.cxx | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx index 78a8d0edc4bf..ad8d22dc9f77 100644 --- a/sfx2/source/notebookbar/SfxNotebookBar.cxx +++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx @@ -16,6 +16,7 @@ #include <sfx2/viewfrm.hxx> #include <sfx2/sfxsids.hrc> #include <comphelper/processfactory.hxx> +#include <comphelper/lok.hxx> #include <com/sun/star/frame/UnknownModuleException.hpp> #include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp> #include <com/sun/star/ui/XContextChangeEventMultiplexer.hpp> @@ -43,7 +44,7 @@ const char MERGE_NOTEBOOKBAR_IMAGEID[] = "ImageIdentifier"; bool SfxNotebookBar::m_bLock = false; bool SfxNotebookBar::m_bHide = false; -std::unique_ptr<WeldedTabbedNotebookbar> SfxNotebookBar::m_pNotebookBarWeldedWrapper; +std::map<const SfxViewShell*, std::shared_ptr<WeldedTabbedNotebookbar>> SfxNotebookBar::m_pNotebookBarWeldedWrapper; static void NotebookbarAddonValues( std::vector<Image>& aImageValues, @@ -363,7 +364,7 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow, bool bChangedFile = sNewFile != sCurrentFile; if ((!sFile.isEmpty() && bChangedFile) || !pNotebookBar || !pNotebookBar->IsVisible() - || bReloadNotebookbar) + || bReloadNotebookbar || comphelper::LibreOfficeKit::isActive()) { RemoveListeners(pSysWindow); @@ -382,12 +383,16 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow, pNotebookBar = pSysWindow->GetNotebookBar(); pNotebookBar->Show(); - if ((!m_pNotebookBarWeldedWrapper || bReloadNotebookbar) && pNotebookBar->IsWelded()) + const SfxViewShell* pViewShell = SfxViewShell::Current(); + + bool hasWeldedWrapper = m_pNotebookBarWeldedWrapper.find(pViewShell) != m_pNotebookBarWeldedWrapper.end(); + if ((!hasWeldedWrapper || bReloadNotebookbar) && pNotebookBar->IsWelded()) { - m_pNotebookBarWeldedWrapper.reset(new WeldedTabbedNotebookbar(pNotebookBar->GetMainContainer(), - pNotebookBar->GetUIFilePath(), - xFrame)); - pNotebookBar->SetDisposeCallback(LINK(nullptr, SfxNotebookBar, VclDisposeHdl)); + m_pNotebookBarWeldedWrapper.emplace(std::make_pair(pViewShell, + new WeldedTabbedNotebookbar(pNotebookBar->GetMainContainer(), + pNotebookBar->GetUIFilePath(), + xFrame))); + pNotebookBar->SetDisposeCallback(LINK(nullptr, SfxNotebookBar, VclDisposeHdl), pViewShell); } pNotebookBar->GetParent()->Resize(); @@ -550,9 +555,9 @@ void SfxNotebookBar::ReloadNotebookBar(const OUString& sUIPath) } } -IMPL_STATIC_LINK_NOARG(SfxNotebookBar, VclDisposeHdl, const void*, void) +IMPL_STATIC_LINK(SfxNotebookBar, VclDisposeHdl, const SfxViewShell*, pViewShell, void) { - m_pNotebookBarWeldedWrapper.reset(); + m_pNotebookBarWeldedWrapper.erase(pViewShell); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |