This fixes regression from commit db5a78c8ab
lok: notebookbar: don't recreate toolbars too often
When we had 2 sessions with notebookbar and one of them switched
to compact mode - other session's notebookbar didn't work.
Before previous change we recreated notebookbar and its welded wrapper
on every StateMethod call for LOK case. So when it become destroyed
we made it working again. But now we need to introduce better management
and not rely on single instence we get from SystemWindow.
Also it's bad idea to rely 100% on SfxNotebookBar::IsActive in LOK
case as when other view will turn notebookbar off, but QueryState
will be trigerred in our session - we will think that it should be
destroyed (it reads config state which is shared between views).
So trust only "true" value (it happens after calling SID_TOOLBAR_MODE),
but destroy notebookbar only after explicit call of
SfxNotebookBar::CloseMethod. It seems to have good result when tested
with multiple views in Online. Maybe we can track Notebookbar state
per view later to make things simpler in LOK case.
Change-Id: Ie739c6441ca05884b0ef20bff23751467706b562
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158936
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>