diff options
-rw-r--r-- | include/sfx2/sidebar/SidebarController.hxx | 7 | ||||
-rw-r--r-- | sfx2/source/sidebar/SidebarController.cxx | 14 |
2 files changed, 20 insertions, 1 deletions
diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx index d4cdd574191d..ca71500069e4 100644 --- a/include/sfx2/sidebar/SidebarController.hxx +++ b/include/sfx2/sidebar/SidebarController.hxx @@ -48,7 +48,8 @@ namespace css::ui::XContextChangeEventListener, css::beans::XPropertyChangeListener, css::ui::XSidebar, - css::frame::XStatusListener + css::frame::XStatusListener, + css::frame::XFrameActionListener > SidebarControllerInterfaceBase; } @@ -105,6 +106,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 98112eb0028e..58117bd336db 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -118,6 +118,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)); @@ -184,6 +185,7 @@ void SidebarController::unregisterSidebarForFrame(SidebarController* pController void SidebarController::disposeDecks() { + SolarMutexGuard aSolarMutexGuard; mpCurrentDeck.clear(); maFocusManager.Clear(); mpResourceManager->disposeDecks(); @@ -228,6 +230,7 @@ void SAL_CALL SidebarController::disposing() if (!xController.is()) xController = mxCurrentController; + mxFrame->removeFrameActionListener(this); unregisterSidebarForFrame(this, xController); if (mxReadOnlyModeDispatch.is()) @@ -1311,6 +1314,17 @@ void SidebarController::FadeIn() mpSplitWindow->FadeIn(); } +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 |