summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-01-31 14:29:18 +0000
committerMichael Stahl <mstahl@redhat.com>2017-02-01 14:40:03 +0000
commitfe85d526323ef562504289c2a0d76a1af94e7a82 (patch)
treea607ec0cf1bf0d0f5243e6a2dfd4af30f6e4f26f
parent70784f06ebd592070c85ffb93dfdbaa4322a55d4 (diff)
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 Reviewed-on: https://gerrit.libreoffice.org/33758 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 3e27ba70ce212642026874ba73021930a06cdbbd) Change-Id: I141509d4a262307afd7dcfc3d77de6cdd6dbfa5f Reviewed-on: https://gerrit.libreoffice.org/33767 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--include/sfx2/sidebar/SidebarController.hxx10
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx14
2 files changed, 22 insertions, 2 deletions
diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx
index 76342726d299..199edd3a5e2c 100644
--- a/include/sfx2/sidebar/SidebarController.hxx
+++ b/include/sfx2/sidebar/SidebarController.hxx
@@ -39,16 +39,18 @@
#include <boost/optional.hpp>
#include <cppuhelper/compbase4.hxx>
+#include <cppuhelper/compbase5.hxx>
#include <cppuhelper/basemutex.hxx>
namespace
{
- typedef ::cppu::WeakComponentImplHelper4 <
+ typedef ::cppu::WeakComponentImplHelper5 <
css::ui::XContextChangeEventListener,
css::beans::XPropertyChangeListener,
css::ui::XSidebar,
- css::frame::XStatusListener
+ css::frame::XStatusListener,
+ css::frame::XFrameActionListener
> SidebarControllerInterfaceBase;
}
@@ -105,6 +107,10 @@ public:
virtual void SAL_CALL statusChanged (const css::frame::FeatureStateEvent& rEvent)
throw(css::uno::RuntimeException, std::exception) override;
+ // frame::XFrameActionListener
+ virtual void SAL_CALL frameAction (const css::frame::FrameActionEvent& rEvent)
+ throw (com::sun::star::uno::RuntimeException, std::exception) override;
+
// ui::XSidebar
virtual void SAL_CALL requestLayout()
throw(css::uno::RuntimeException, std::exception) override;
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 011030947e08..fc458593b625 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -121,6 +121,7 @@ SidebarController::SidebarController (
mpResourceManager = o3tl::make_unique<ResourceManager>();
registerSidebarForFrame(this, mxFrame->getController());
+ rxFrame->addFrameActionListener(this);
// Listen for window events.
mpParentWindow->AddEventListener(LINK(this, SidebarController, WindowEventHandler));
@@ -187,6 +188,7 @@ void SidebarController::unregisterSidebarForFrame(SidebarController* pController
void SidebarController::disposeDecks()
{
+ SolarMutexGuard aSolarMutexGuard;
mpCurrentDeck.clear();
maFocusManager.Clear();
mpResourceManager->disposeDecks();
@@ -231,6 +233,7 @@ void SAL_CALL SidebarController::disposing()
if (!xController.is())
xController = mxCurrentController;
+ mxFrame->removeFrameActionListener(this);
unregisterSidebarForFrame(this, xController);
if (mxReadOnlyModeDispatch.is())
@@ -1307,6 +1310,17 @@ void SidebarController::updateModel(const css::uno::Reference<css::frame::XModel
mpResourceManager->UpdateModel(xModel);
}
+void SidebarController::frameAction(const css::frame::FrameActionEvent& rEvent)
+ throw (com::sun::star::uno::RuntimeException, std::exception)
+{
+ 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