summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sfx2/sidebar/SidebarController.hxx2
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx10
-rw-r--r--sfx2/source/sidebar/Theme.cxx6
3 files changed, 13 insertions, 5 deletions
diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx
index 133c1f5806c6..3df8d8fb2e45 100644
--- a/include/sfx2/sidebar/SidebarController.hxx
+++ b/include/sfx2/sidebar/SidebarController.hxx
@@ -29,6 +29,7 @@
#include <sfx2/sidebar/TabBar.hxx>
#include <sfx2/viewfrm.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
#include <com/sun/star/frame/XStatusListener.hpp>
#include <com/sun/star/frame/XFrameActionListener.hpp>
@@ -194,6 +195,7 @@ private:
OUString msCurrentDeckId;
AsynchronousCall maPropertyChangeForwarder;
AsynchronousCall maContextChangeUpdate;
+ css::uno::Reference<css::beans::XPropertySet> mxThemePropertySet;
/** Two flags control whether the deck is displayed or if only the
tab bar remains visible.
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 803d1c10a739..c03b2a96acdb 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -157,7 +157,8 @@ rtl::Reference<SidebarController> SidebarController::create(SidebarDockingWindow
instance->mpParentWindow->AddEventListener(LINK(instance.get(), SidebarController, WindowEventHandler));
// Listen for theme property changes.
- Theme::GetPropertySet()->addPropertyChangeListener(
+ instance->mxThemePropertySet = Theme::GetPropertySet();
+ instance->mxThemePropertySet->addPropertyChangeListener(
"",
static_cast<css::beans::XPropertyChangeListener*>(instance.get()));
@@ -312,9 +313,10 @@ void SAL_CALL SidebarController::disposing()
if (mxReadOnlyModeDispatch.is())
mxReadOnlyModeDispatch->removeStatusListener(this, Tools::GetURL(gsReadOnlyCommandName));
- Theme::GetPropertySet()->removePropertyChangeListener(
- "",
- static_cast<css::beans::XPropertyChangeListener*>(this));
+ if (mxThemePropertySet.is())
+ mxThemePropertySet->removePropertyChangeListener(
+ "",
+ static_cast<css::beans::XPropertyChangeListener*>(this));
if (mpParentWindow != nullptr)
{
diff --git a/sfx2/source/sidebar/Theme.cxx b/sfx2/source/sidebar/Theme.cxx
index cd4ce36bd658..6d6fe7bc517f 100644
--- a/sfx2/source/sidebar/Theme.cxx
+++ b/sfx2/source/sidebar/Theme.cxx
@@ -32,6 +32,7 @@ namespace sfx2::sidebar {
Theme& Theme::GetCurrentTheme()
{
+ OSL_ASSERT(SfxGetpApp());
return SfxGetpApp()->GetSidebarTheme();
}
@@ -177,7 +178,10 @@ void SAL_CALL Theme::disposing()
Reference<beans::XPropertySet> Theme::GetPropertySet()
{
- return Reference<beans::XPropertySet>(static_cast<XWeak*>(&GetCurrentTheme()), UNO_QUERY);
+ if (SfxGetpApp())
+ return Reference<beans::XPropertySet>(static_cast<XWeak*>(&GetCurrentTheme()), UNO_QUERY);
+ else
+ return Reference<beans::XPropertySet>();
}
Reference<beans::XPropertySetInfo> SAL_CALL Theme::getPropertySetInfo()