diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2022-06-07 10:11:48 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2022-06-12 10:38:27 +0200 |
commit | 881774e9e35055cbaed36324542bae006eedb4fb (patch) | |
tree | 43fabaeb51de72e5eaca85d61e6c7d7f850bff82 /sfx2 | |
parent | 932257c50c1dc9302b14862424e24e975f88bcc2 (diff) |
Related: tdf#125040 NB: rework print preview context
Current implementation broadcasts the context change before the
new controller was set on the frame (via XFrame::setComponent).
This isn't going to work for anything LayoutManager based, as
it responds to frame events by recreating all toolbars, so the
newly created toolbar won't see the context sent for the old
controller.
Solve that by delaying the context change to SfxShell::Activate,
like anywhere else in the codebase. And make NB listen to frame
events, so it could also switch listening to the new controller.
Also fixed a crash when switching to print preview in Writer with
the navigator in the sidebar being active. Ideally we shouldn't
even try to create sidebar panels in print preview, as the sidebar
as a whole is disabled. But left that for a future investigation.
Change-Id: I07759c676d2a2eb6f752fe778b559b15d2d759ec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135492
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/notebookbar/SfxNotebookBar.cxx | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx index aa602ba17a60..451c94cf3966 100644 --- a/sfx2/source/notebookbar/SfxNotebookBar.cxx +++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx @@ -202,7 +202,6 @@ void SfxNotebookBar::CloseMethod(SystemWindow* pSysWindow) { if (pSysWindow) { - RemoveListeners(pSysWindow); if(pSysWindow->GetNotebookBar()) pSysWindow->CloseNotebookBar(); if (SfxViewFrame::Current()) @@ -432,7 +431,7 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow, if(pView) { - pNotebookBar->ControlListenerForCurrentController(true); + pNotebookBar->SetupListener(true); } } @@ -441,7 +440,6 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow, else if (auto pNotebookBar = pSysWindow->GetNotebookBar()) { vcl::Window* pParent = pNotebookBar->GetParent(); - RemoveListeners(pSysWindow); pSysWindow->CloseNotebookBar(); pParent->Resize(); SfxNotebookBar::ShowMenubar(true); @@ -454,7 +452,7 @@ void SfxNotebookBar::RemoveListeners(SystemWindow const * pSysWindow) { if (auto pNotebookBar = pSysWindow->GetNotebookBar()) { - pNotebookBar->StopListeningAllControllers(); + pNotebookBar->SetupListener(false); } } |