summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-07-08 00:46:26 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-07-12 18:56:47 +0200
commitbe6c884feb389ec6931e1853aa421d5bccd69f12 (patch)
tree163fe9293cf198321550ab852e8a80d5cf8a07ba /sfx2
parent4e6a1615d1a4c81c490cfb479d5e30f4e98adc47 (diff)
add methods to add random controllers to sidebar
Change-Id: Ia3e80cc63491f1edd49eaf86cc8c25d67e4a8b28
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx49
1 files changed, 34 insertions, 15 deletions
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index d98a5b53d52b..61492cea88c7 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -124,15 +124,7 @@ SidebarController::SidebarController (
// Decks and panel collections for this sidebar
mpResourceManager = std::unique_ptr<ResourceManager>(new ResourceManager());
- // Listen for context change events.
- css::uno::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
- css::ui::ContextChangeEventMultiplexer::get(
- ::comphelper::getProcessComponentContext()));
- if (xMultiplexer.is())
- xMultiplexer->addContextChangeEventListener(
- static_cast<css::ui::XContextChangeEventListener*>(this),
- mxFrame->getController());
-
+ registerSidebarForFrame(this, mxFrame->getController());
// Listen for window events.
mpParentWindow->AddEventListener(LINK(this, SidebarController, WindowEventHandler));
@@ -149,12 +141,6 @@ SidebarController::SidebarController (
mxReadOnlyModeDispatch->addStatusListener(this, aURL);
SwitchToDeck(gsDefaultDeckId);
-
- WeakReference<SidebarController> xWeakController (this);
- maSidebarControllerContainer.insert(
- SidebarControllerContainer::value_type(
- rxFrame->getController(),
- xWeakController));
}
SidebarController::~SidebarController()
@@ -175,6 +161,39 @@ SidebarController* SidebarController::GetSidebarControllerForFrame (
return dynamic_cast<SidebarController*>(xController.get());
}
+void SidebarController::registerSidebarForFrame(SidebarController* pController, css::uno::Reference<css::frame::XController> xController)
+{
+ // Listen for context change events.
+ css::uno::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
+ css::ui::ContextChangeEventMultiplexer::get(
+ ::comphelper::getProcessComponentContext()));
+ if (xMultiplexer.is())
+ xMultiplexer->addContextChangeEventListener(
+ static_cast<css::ui::XContextChangeEventListener*>(pController),
+ xController);
+
+ WeakReference<SidebarController> xWeakController (pController);
+ maSidebarControllerContainer.insert(
+ SidebarControllerContainer::value_type(
+ xController,
+ xWeakController));
+}
+
+void SidebarController::unregisterSidebarForFrame(SidebarController* pController, css::uno::Reference<css::frame::XController> xController)
+{
+ SidebarControllerContainer::iterator iEntry (maSidebarControllerContainer.find(xController));
+ if (iEntry != maSidebarControllerContainer.end())
+ maSidebarControllerContainer.erase(iEntry);
+
+ css::uno::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
+ css::ui::ContextChangeEventMultiplexer::get(
+ ::comphelper::getProcessComponentContext()));
+ if (xMultiplexer.is())
+ xMultiplexer->removeContextChangeEventListener(
+ static_cast<css::ui::XContextChangeEventListener*>(pController),
+ xController);
+}
+
void SAL_CALL SidebarController::disposing()
{
mpCloseIndicator.disposeAndClear();