summaryrefslogtreecommitdiffstats
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-01-31 14:29:18 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-01-31 16:38:14 +0000
commit3e27ba70ce212642026874ba73021930a06cdbbd (patch)
treedcce8db00668fac73a0aebc87b1ae77bf8902512 /sfx2
parentCompatibility options refactoring. Part 1 small fix (diff)
downloadcore-3e27ba70ce212642026874ba73021930a06cdbbd.tar.gz
core-3e27ba70ce212642026874ba73021930a06cdbbd.zip
Resolves: tdf#104884 print preview replaces the frame controller
so the sidebar is listening to the old controller which has been disposed[1] so when print preview exits and yet another controller replaces the print preview one then the sidebar still doesn't listen to the current one. framework broadcasts COMPONENT_DETACHING/COMPONENT_REATTACHED around these changes, so if we listen to them we can keep attached to whatever is the current component [1] note that ContextChangeEventMultipler doesn't inform clients that the controller has been disposed, this remains unchanged here Change-Id: I141509d4a262307afd7dcfc3d77de6cdd6dbfa5f Reviewed-on: https://gerrit.libreoffice.org/33758 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 4e275a5d1ab5..4a6ec25063dd 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -126,6 +126,7 @@ rtl::Reference<SidebarController> SidebarController::create(
new SidebarController(pParentWindow, rxFrame));
registerSidebarForFrame(instance.get(), rxFrame->getController());
+ rxFrame->addFrameActionListener(instance.get());
// Listen for window events.
instance->mpParentWindow->AddEventListener(LINK(instance.get(), SidebarController, WindowEventHandler));
@@ -236,6 +237,7 @@ void SAL_CALL SidebarController::disposing()
if (!xController.is())
xController = mxCurrentController;
+ mxFrame->removeFrameActionListener(this);
unregisterSidebarForFrame(this, xController);
if (mxReadOnlyModeDispatch.is())
@@ -1316,6 +1318,16 @@ void SidebarController::FadeIn()
mpSplitWindow->FadeIn();
}
+void SidebarController::frameAction(const css::frame::FrameActionEvent& rEvent)
+{
+ if (rEvent.Frame == mxFrame)
+ {
+ if (rEvent.Action == css::frame::FrameAction_COMPONENT_DETACHING)
+ unregisterSidebarForFrame(this, mxFrame->getController());
+ else if (rEvent.Action == css::frame::FrameAction_COMPONENT_REATTACHED)
+ registerSidebarForFrame(this, mxFrame->getController());
+ }
+}
} } // end of namespace sfx2::sidebar