summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compilerplugins/clang/badstatics.cxx1
-rw-r--r--include/sfx2/notebookbar/SfxNotebookBar.hxx7
-rw-r--r--include/vcl/notebookbar.hxx6
-rw-r--r--sfx2/source/notebookbar/SfxNotebookBar.cxx23
-rw-r--r--vcl/source/control/notebookbar.cxx12
5 files changed, 34 insertions, 15 deletions
diff --git a/compilerplugins/clang/badstatics.cxx b/compilerplugins/clang/badstatics.cxx
index 0e9e6b36be54..e50a8df3ccda 100644
--- a/compilerplugins/clang/badstatics.cxx
+++ b/compilerplugins/clang/badstatics.cxx
@@ -208,6 +208,7 @@ public:
.Class("ScDocument").GlobalNamespace()) // not owning
|| name == "s_aLOKWindowsMap" // LOK only, guarded by assert, and LOK never tries to perform a VCL cleanup
|| name == "s_aLOKWeldBuildersMap" // LOK only, similar case as above
+ || name == "m_pNotebookBarWeldedWrapper" // LOK only, warning about map's key, no VCL cleanup performed
|| name == "gStaticManager" // vcl/source/graphic/Manager.cxx - stores non-owning pointers
|| name == "aThreadedInterpreterPool" // ScInterpreterContext(Pool), not owning
|| name == "aNonThreadedInterpreterPool" // ScInterpreterContext(Pool), not owning
diff --git a/include/sfx2/notebookbar/SfxNotebookBar.hxx b/include/sfx2/notebookbar/SfxNotebookBar.hxx
index 4fbda295cace..53d028bcd9b8 100644
--- a/include/sfx2/notebookbar/SfxNotebookBar.hxx
+++ b/include/sfx2/notebookbar/SfxNotebookBar.hxx
@@ -12,12 +12,14 @@
#include <sfx2/dllapi.h>
#include <rtl/ustring.hxx>
+#include <map>
namespace com::sun::star::frame { class XFrame; }
namespace com::sun::star::uno { template <typename > class Reference; }
class SfxBindings;
class SfxViewFrame;
+class SfxViewShell;
class SystemWindow;
class WeldedTabbedNotebookbar;
@@ -60,9 +62,10 @@ public:
private:
static bool m_bLock;
static bool m_bHide;
- static std::unique_ptr<WeldedTabbedNotebookbar> m_pNotebookBarWeldedWrapper;
- DECL_STATIC_LINK(SfxNotebookBar, VclDisposeHdl, const void*, void);
+ static std::map<const SfxViewShell*, std::shared_ptr<WeldedTabbedNotebookbar>> m_pNotebookBarWeldedWrapper;
+
+ DECL_STATIC_LINK(SfxNotebookBar, VclDisposeHdl, const SfxViewShell*, void);
};
} // namespace sfx2
diff --git a/include/vcl/notebookbar.hxx b/include/vcl/notebookbar.hxx
index 5086b263c6ab..75383b9d2d7c 100644
--- a/include/vcl/notebookbar.hxx
+++ b/include/vcl/notebookbar.hxx
@@ -21,6 +21,7 @@ namespace com::sun::star::ui { class XContextChangeEventListener; }
class NotebookbarContextControl;
class SystemWindow;
+class SfxViewShell;
/// This implements Widget Layout-based notebook-like menu bar.
class VCL_DLLPUBLIC NotebookBar final : public Control, public VclBuilderContainer
@@ -50,7 +51,7 @@ public:
bool IsWelded() { return m_bIsWelded; }
VclPtr<vcl::Window>& GetMainContainer() { return m_xVclContentArea; }
OUString GetUIFilePath() { return m_sUIXMLDescription; }
- void SetDisposeCallback(const Link<const void*, void> rDisposeCallback);
+ void SetDisposeCallback(const Link<const SfxViewShell*, void> rDisposeCallback, const SfxViewShell* pViewShell);
private:
VclPtr<SystemWindow> m_pSystemWindow;
@@ -58,11 +59,12 @@ private:
std::set<css::uno::Reference<css::frame::XController>> m_alisteningControllers;
std::vector<NotebookbarContextControl*> m_pContextContainers;
css::uno::Reference<css::frame::XFrame> mxFrame;
+ const SfxViewShell* m_pViewShell;
VclPtr<vcl::Window> m_xVclContentArea;
bool m_bIsWelded;
OUString m_sUIXMLDescription;
- Link<const void*, void> m_rDisposeLink;
+ Link<const SfxViewShell*, void> m_rDisposeLink;
AllSettings DefaultSettings;
AllSettings PersonaSettings;
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: */
diff --git a/vcl/source/control/notebookbar.cxx b/vcl/source/control/notebookbar.cxx
index 7f4922c54212..3dd4f889ee71 100644
--- a/vcl/source/control/notebookbar.cxx
+++ b/vcl/source/control/notebookbar.cxx
@@ -56,6 +56,7 @@ NotebookBar::NotebookBar(Window* pParent, const OString& rID, const OUString& rU
const NotebookBarAddonsItem& aNotebookBarAddonsItem)
: Control(pParent)
, m_pEventListener(new NotebookBarContextChangeEventListener(this))
+ , m_pViewShell(nullptr)
, m_bIsWelded(false)
, m_sUIXMLDescription(rUIXMLDescription)
{
@@ -105,9 +106,10 @@ NotebookBar::NotebookBar(Window* pParent, const OString& rID, const OUString& rU
UpdateBackground();
}
-void NotebookBar::SetDisposeCallback(const Link<const void*, void> rDisposeCallback)
+void NotebookBar::SetDisposeCallback(const Link<const SfxViewShell*, void> rDisposeCallback, const SfxViewShell* pViewShell)
{
m_rDisposeLink = rDisposeCallback;
+ m_pViewShell = pViewShell;
}
NotebookBar::~NotebookBar()
@@ -123,7 +125,7 @@ void NotebookBar::dispose()
m_pSystemWindow.clear();
if (m_rDisposeLink.IsSet())
- m_rDisposeLink.Call(nullptr);
+ m_rDisposeLink.Call(m_pViewShell);
if (m_bIsWelded)
m_xVclContentArea.disposeAndClear();
@@ -224,6 +226,9 @@ void SAL_CALL NotebookBarContextChangeEventListener::notifyContextChangeEvent(co
void NotebookBar::ControlListenerForCurrentController(bool bListen)
{
+ if (comphelper::LibreOfficeKit::isActive())
+ return;
+
auto xController = mxFrame->getController();
if(bListen)
{
@@ -251,6 +256,9 @@ void NotebookBar::ControlListenerForCurrentController(bool bListen)
void NotebookBar::StopListeningAllControllers()
{
+ if (comphelper::LibreOfficeKit::isActive())
+ return;
+
auto xMultiplexer(
css::ui::ContextChangeEventMultiplexer::get(comphelper::getProcessComponentContext()));
xMultiplexer->removeAllContextChangeEventListeners(m_pEventListener);