1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sfx2/sidebar/Theme.hxx>
21 #include <sidebar/Tools.hxx>
22 #include <sfx2/app.hxx>
24 #include <vcl/svapp.hxx>
25 #include <vcl/settings.hxx>
26 #include <tools/diagnose_ex.h>
28 #include <com/sun/star/awt/Rectangle.hpp>
31 using namespace css::uno
;
33 namespace sfx2::sidebar
{
35 Theme
& Theme::GetCurrentTheme()
37 return SfxGetpApp()->GetSidebarTheme();
41 : ThemeInterfaceBase(m_aMutex
),
46 mbIsHighContrastMode(Application::GetSettings().GetStyleSettings().GetHighContrastMode()),
47 mbIsHighContrastModeSetManually(false),
48 maPropertyNameToIdMap(),
49 maPropertyIdToNameMap(),
62 Image
Theme::GetImage (const ThemeItem eItem
)
64 const PropertyType
eType (GetPropertyType(eItem
));
65 OSL_ASSERT(eType
==PT_Image
);
66 const sal_Int32
nIndex (GetIndex(eItem
, eType
));
67 const Theme
& rTheme (GetCurrentTheme());
68 return rTheme
.maImages
[nIndex
];
71 Color
Theme::GetColor (const ThemeItem eItem
)
73 const PropertyType
eType (GetPropertyType(eItem
));
74 OSL_ASSERT(eType
==PT_Color
);
75 const sal_Int32
nIndex (GetIndex(eItem
, eType
));
76 const Theme
& rTheme (GetCurrentTheme());
77 if (eType
== PT_Color
)
78 return rTheme
.maColors
[nIndex
];
83 sal_Int32
Theme::GetInteger (const ThemeItem eItem
)
85 const PropertyType
eType (GetPropertyType(eItem
));
86 OSL_ASSERT(eType
==PT_Integer
);
87 const sal_Int32
nIndex (GetIndex(eItem
, eType
));
88 const Theme
& rTheme (GetCurrentTheme());
89 return rTheme
.maIntegers
[nIndex
];
92 bool Theme::GetBoolean (const ThemeItem eItem
)
94 const PropertyType
eType (GetPropertyType(eItem
));
95 OSL_ASSERT(eType
==PT_Boolean
);
96 const sal_Int32
nIndex (GetIndex(eItem
, eType
));
97 const Theme
& rTheme (GetCurrentTheme());
98 return rTheme
.maBooleans
[nIndex
];
101 bool Theme::IsHighContrastMode()
103 const Theme
& rTheme (GetCurrentTheme());
104 return rTheme
.mbIsHighContrastMode
;
107 void Theme::HandleDataChange()
109 Theme
& rTheme (GetCurrentTheme());
111 if ( ! rTheme
.mbIsHighContrastModeSetManually
)
113 // Do not modify mbIsHighContrastMode when it was manually set.
114 GetCurrentTheme().mbIsHighContrastMode
= Application::GetSettings().GetStyleSettings().GetHighContrastMode();
115 rTheme
.maRawValues
[Bool_IsHighContrastModeActive
] <<= GetCurrentTheme().mbIsHighContrastMode
;
118 GetCurrentTheme().UpdateTheme();
121 void Theme::InitializeTheme()
124 maPropertyIdToNameMap
[Bool_UseSystemColors
],
128 void Theme::UpdateTheme()
132 const StyleSettings
& rStyle (Application::GetSettings().GetStyleSettings());
133 const bool bUseSystemColors (GetBoolean(Bool_UseSystemColors
));
135 #define Alternatives(n,hc,sys) (mbIsHighContrastMode ? hc : (bUseSystemColors ? sys : n))
137 Color
aBaseBackgroundColor (rStyle
.GetDialogColor());
138 // UX says this should be a little brighter, but that looks off when compared to the other windows.
139 //aBaseBackgroundColor.IncreaseLuminance(7);
140 Color
aBorderColor (aBaseBackgroundColor
);
141 Color
aSecondColor (aBaseBackgroundColor
);
142 aSecondColor
.DecreaseLuminance(15);
145 maPropertyIdToNameMap
[Color_DeckBackground
],
146 Any(sal_Int32(aBaseBackgroundColor
.GetRGBColor())));
149 maPropertyIdToNameMap
[Color_DeckTitleBarBackground
],
150 Any(sal_Int32(aBaseBackgroundColor
.GetRGBColor())));
152 maPropertyIdToNameMap
[Int_DeckSeparatorHeight
],
155 maPropertyIdToNameMap
[Color_DeckTitleFont
],
156 Any(sal_Int32(rStyle
.GetFontColor().GetRGBColor())));
158 maPropertyIdToNameMap
[Int_DeckTitleBarHeight
],
159 Any(sal_Int32(Alternatives(
162 rStyle
.GetFloatTitleHeight()))));
164 maPropertyIdToNameMap
[Color_PanelBackground
],
165 Any(sal_Int32(aBaseBackgroundColor
.GetRGBColor())));
168 maPropertyIdToNameMap
[Color_PanelTitleBarBackground
],
169 Any(sal_Int32(aSecondColor
.GetRGBColor())));
171 maPropertyIdToNameMap
[Color_PanelTitleFont
],
172 Any(sal_Int32(mbIsHighContrastMode
? 0x00ff00 : 0x262626)));
174 maPropertyIdToNameMap
[Int_PanelTitleBarHeight
],
175 Any(sal_Int32(Alternatives(
178 rStyle
.GetTitleHeight()))));
180 maPropertyIdToNameMap
[Color_TabBarBackground
],
181 Any(sal_Int32(aBaseBackgroundColor
.GetRGBColor())));
184 maPropertyIdToNameMap
[Color_DropDownBackground
],
185 Any(sal_Int32(aBaseBackgroundColor
.GetRGBColor())));
188 maPropertyIdToNameMap
[Color_Highlight
],
189 Any(sal_Int32(rStyle
.GetHighlightColor().GetRGBColor())));
191 maPropertyIdToNameMap
[Color_HighlightText
],
192 Any(sal_Int32(rStyle
.GetHighlightTextColor().GetRGBColor())));
195 maPropertyIdToNameMap
[Color_HorizontalBorder
],
196 Any(sal_Int32(aBorderColor
.GetRGBColor())));
199 maPropertyIdToNameMap
[Color_VerticalBorder
],
200 Any(sal_Int32(aBorderColor
.GetRGBColor())));
202 maPropertyIdToNameMap
[Image_CloseIndicator
],
203 Any(OUString("private:graphicrepository/cmd/lc_decrementlevel.png")));
205 catch(beans::UnknownPropertyException
const &)
207 DBG_UNHANDLED_EXCEPTION("sfx", "unknown property");
212 void SAL_CALL
Theme::disposing()
214 SolarMutexGuard aGuard
;
216 ChangeListeners aListeners
;
217 aListeners
.swap(maChangeListeners
);
219 const lang::EventObject
aEvent (static_cast<XWeak
*>(this));
221 for (const auto& rContainer
: aListeners
)
223 for (const auto& rxListener
: rContainer
.second
)
227 rxListener
->disposing(aEvent
);
229 catch(const Exception
&)
236 Reference
<beans::XPropertySet
> Theme::GetPropertySet()
238 return Reference
<beans::XPropertySet
>(static_cast<XWeak
*>(&GetCurrentTheme()), UNO_QUERY
);
241 Reference
<beans::XPropertySetInfo
> SAL_CALL
Theme::getPropertySetInfo()
243 return Reference
<beans::XPropertySetInfo
>(this);
246 void SAL_CALL
Theme::setPropertyValue (
247 const OUString
& rsPropertyName
,
248 const css::uno::Any
& rValue
)
250 SolarMutexGuard aGuard
;
252 PropertyNameToIdMap::const_iterator
iId (maPropertyNameToIdMap
.find(rsPropertyName
));
253 if (iId
== maPropertyNameToIdMap
.end())
254 throw beans::UnknownPropertyException(rsPropertyName
);
256 const PropertyType
eType (GetPropertyType(iId
->second
));
257 if (eType
== PT_Invalid
)
258 throw beans::UnknownPropertyException(rsPropertyName
);
260 const ThemeItem
eItem (iId
->second
);
262 if (rValue
== maRawValues
[eItem
])
264 // Value is not different from the one in the property
265 // set => nothing to do.
269 const Any
aOldValue (maRawValues
[eItem
]);
271 const beans::PropertyChangeEvent
aEvent(
272 static_cast<XWeak
*>(this),
279 if (DoVetoableListenersVeto(GetVetoableListeners(AnyItem_
, false), aEvent
))
281 if (DoVetoableListenersVeto(GetVetoableListeners(eItem
, false), aEvent
))
284 maRawValues
[eItem
] = rValue
;
285 ProcessNewValue(rValue
, eItem
, eType
);
287 BroadcastPropertyChange(GetChangeListeners(AnyItem_
, false), aEvent
);
288 BroadcastPropertyChange(GetChangeListeners(eItem
, false), aEvent
);
291 Any SAL_CALL
Theme::getPropertyValue (
292 const OUString
& rsPropertyName
)
294 SolarMutexGuard aGuard
;
296 PropertyNameToIdMap::const_iterator
iId (maPropertyNameToIdMap
.find(rsPropertyName
));
297 if (iId
== maPropertyNameToIdMap
.end())
298 throw beans::UnknownPropertyException(rsPropertyName
);
300 const PropertyType
eType (GetPropertyType(iId
->second
));
301 if (eType
== PT_Invalid
)
302 throw beans::UnknownPropertyException(rsPropertyName
);
304 const ThemeItem
eItem (iId
->second
);
306 return maRawValues
[eItem
];
309 void SAL_CALL
Theme::addPropertyChangeListener(
310 const OUString
& rsPropertyName
,
311 const css::uno::Reference
<css::beans::XPropertyChangeListener
>& rxListener
)
313 SolarMutexGuard aGuard
;
315 ThemeItem
eItem (AnyItem_
);
316 if (rsPropertyName
.getLength() > 0)
318 PropertyNameToIdMap::const_iterator
iId (maPropertyNameToIdMap
.find(rsPropertyName
));
319 if (iId
== maPropertyNameToIdMap
.end())
320 throw beans::UnknownPropertyException(rsPropertyName
);
322 const PropertyType
eType (GetPropertyType(iId
->second
));
323 if (eType
== PT_Invalid
)
324 throw beans::UnknownPropertyException(rsPropertyName
);
328 ChangeListenerContainer
* pListeners
= GetChangeListeners(eItem
, true);
329 if (pListeners
!= nullptr)
330 pListeners
->push_back(rxListener
);
333 void SAL_CALL
Theme::removePropertyChangeListener(
334 const OUString
& rsPropertyName
,
335 const css::uno::Reference
<css::beans::XPropertyChangeListener
>& rxListener
)
337 SolarMutexGuard aGuard
;
339 ThemeItem
eItem (AnyItem_
);
340 if (rsPropertyName
.getLength() > 0)
342 PropertyNameToIdMap::const_iterator
iId (maPropertyNameToIdMap
.find(rsPropertyName
));
343 if (iId
== maPropertyNameToIdMap
.end())
344 throw beans::UnknownPropertyException(rsPropertyName
);
346 const PropertyType
eType (GetPropertyType(iId
->second
));
347 if (eType
== PT_Invalid
)
348 throw beans::UnknownPropertyException(rsPropertyName
);
352 ChangeListenerContainer
* pContainer
= GetChangeListeners(eItem
, false);
353 if (pContainer
!= nullptr)
355 ChangeListenerContainer::iterator
iListener (::std::find(pContainer
->begin(), pContainer
->end(), rxListener
));
356 if (iListener
!= pContainer
->end())
358 pContainer
->erase(iListener
);
360 // Remove the listener container when empty.
361 if (pContainer
->empty())
362 maChangeListeners
.erase(eItem
);
367 void SAL_CALL
Theme::addVetoableChangeListener(
368 const OUString
& rsPropertyName
,
369 const css::uno::Reference
<css::beans::XVetoableChangeListener
>& rxListener
)
371 SolarMutexGuard aGuard
;
373 ThemeItem
eItem (AnyItem_
);
374 if (rsPropertyName
.getLength() > 0)
376 PropertyNameToIdMap::const_iterator
iId (maPropertyNameToIdMap
.find(rsPropertyName
));
377 if (iId
== maPropertyNameToIdMap
.end())
378 throw beans::UnknownPropertyException(rsPropertyName
);
380 const PropertyType
eType (GetPropertyType(iId
->second
));
381 if (eType
== PT_Invalid
)
382 throw beans::UnknownPropertyException(rsPropertyName
);
386 VetoableListenerContainer
* pListeners
= GetVetoableListeners(eItem
, true);
387 if (pListeners
!= nullptr)
388 pListeners
->push_back(rxListener
);
391 void SAL_CALL
Theme::removeVetoableChangeListener(
392 const OUString
& rsPropertyName
,
393 const css::uno::Reference
<css::beans::XVetoableChangeListener
>& rxListener
)
395 SolarMutexGuard aGuard
;
397 ThemeItem
eItem (AnyItem_
);
398 if (rsPropertyName
.getLength() > 0)
400 PropertyNameToIdMap::const_iterator
iId (maPropertyNameToIdMap
.find(rsPropertyName
));
401 if (iId
== maPropertyNameToIdMap
.end())
402 throw beans::UnknownPropertyException(rsPropertyName
);
404 const PropertyType
eType (GetPropertyType(iId
->second
));
405 if (eType
== PT_Invalid
)
406 throw beans::UnknownPropertyException(rsPropertyName
);
410 VetoableListenerContainer
* pContainer
= GetVetoableListeners(eItem
, false);
411 if (pContainer
!= nullptr)
413 VetoableListenerContainer::iterator
iListener (::std::find(pContainer
->begin(), pContainer
->end(), rxListener
));
414 if (iListener
!= pContainer
->end())
416 pContainer
->erase(iListener
);
417 // Remove container when empty.
418 if (pContainer
->empty())
419 maVetoableListeners
.erase(eItem
);
424 css::uno::Sequence
<css::beans::Property
> SAL_CALL
Theme::getProperties()
426 SolarMutexGuard aGuard
;
428 ::std::vector
<beans::Property
> aProperties
;
430 sal_Int32
const nEnd(End_
);
431 for (sal_Int32
nItem(Begin_
); nItem
!=nEnd
; ++nItem
)
433 const ThemeItem
eItem (static_cast<ThemeItem
>(nItem
));
434 const PropertyType
eType (GetPropertyType(eItem
));
435 if (eType
== PT_Invalid
)
438 const beans::Property
aProperty(
439 maPropertyIdToNameMap
[eItem
],
443 aProperties
.push_back(aProperty
);
446 return css::uno::Sequence
<css::beans::Property
>(
451 beans::Property SAL_CALL
Theme::getPropertyByName (const OUString
& rsPropertyName
)
453 SolarMutexGuard aGuard
;
455 PropertyNameToIdMap::const_iterator
iId (maPropertyNameToIdMap
.find(rsPropertyName
));
456 if (iId
== maPropertyNameToIdMap
.end())
457 throw beans::UnknownPropertyException(rsPropertyName
);
459 const PropertyType
eType (GetPropertyType(iId
->second
));
460 if (eType
== PT_Invalid
)
461 throw beans::UnknownPropertyException(rsPropertyName
);
463 const ThemeItem
eItem (iId
->second
);
465 return beans::Property(
472 sal_Bool SAL_CALL
Theme::hasPropertyByName (const OUString
& rsPropertyName
)
474 SolarMutexGuard aGuard
;
476 PropertyNameToIdMap::const_iterator
iId (maPropertyNameToIdMap
.find(rsPropertyName
));
477 if (iId
== maPropertyNameToIdMap
.end())
480 const PropertyType
eType (GetPropertyType(iId
->second
));
481 if (eType
== PT_Invalid
)
487 void Theme::SetupPropertyMaps()
489 maPropertyIdToNameMap
.resize(Post_Bool_
);
490 maImages
.resize(Image_Color_
- Pre_Image_
- 1);
491 maColors
.resize(Color_Int_
- Image_Color_
- 1);
492 maIntegers
.resize(Int_Bool_
- Color_Int_
- 1);
493 maBooleans
.resize(Post_Bool_
- Int_Bool_
- 1);
495 maPropertyNameToIdMap
["Image_CloseIndicator"]=Image_CloseIndicator
;
496 maPropertyIdToNameMap
[Image_CloseIndicator
]="Image_CloseIndicator";
499 maPropertyNameToIdMap
["Color_DeckTitleFont"]=Color_DeckTitleFont
;
500 maPropertyIdToNameMap
[Color_DeckTitleFont
]="Color_DeckTitleFont";
502 maPropertyNameToIdMap
["Color_PanelTitleFont"]=Color_PanelTitleFont
;
503 maPropertyIdToNameMap
[Color_PanelTitleFont
]="Color_PanelTitleFont";
505 maPropertyNameToIdMap
["Color_Highlight"]=Color_Highlight
;
506 maPropertyIdToNameMap
[Color_Highlight
]="Color_Highlight";
508 maPropertyNameToIdMap
["Color_HighlightText"]=Color_HighlightText
;
509 maPropertyIdToNameMap
[Color_HighlightText
]="Color_HighlightText";
512 maPropertyNameToIdMap
["Color_DeckBackground"]=Color_DeckBackground
;
513 maPropertyIdToNameMap
[Color_DeckBackground
]="Color_DeckBackground";
515 maPropertyNameToIdMap
["Color_DeckTitleBarBackground"]=Color_DeckTitleBarBackground
;
516 maPropertyIdToNameMap
[Color_DeckTitleBarBackground
]="Color_DeckTitleBarBackground";
518 maPropertyNameToIdMap
["Color_PanelBackground"]=Color_PanelBackground
;
519 maPropertyIdToNameMap
[Color_PanelBackground
]="Color_PanelBackground";
521 maPropertyNameToIdMap
["Color_PanelTitleBarBackground"]=Color_PanelTitleBarBackground
;
522 maPropertyIdToNameMap
[Color_PanelTitleBarBackground
]="Color_PanelTitleBarBackground";
524 maPropertyNameToIdMap
["Color_TabBarBackground"]=Color_TabBarBackground
;
525 maPropertyIdToNameMap
[Color_TabBarBackground
]="Color_TabBarBackground";
527 maPropertyNameToIdMap
["Color_HorizontalBorder"]=Color_HorizontalBorder
;
528 maPropertyIdToNameMap
[Color_HorizontalBorder
]="Color_HorizontalBorder";
530 maPropertyNameToIdMap
["Color_VerticalBorder"]=Color_VerticalBorder
;
531 maPropertyIdToNameMap
[Color_VerticalBorder
]="Color_VerticalBorder";
533 maPropertyNameToIdMap
["Color_DropDownBackground"]=Color_DropDownBackground
;
534 maPropertyIdToNameMap
[Color_DropDownBackground
]="Color_DropDownBackground";
537 maPropertyNameToIdMap
["Int_DeckTitleBarHeight"]=Int_DeckTitleBarHeight
;
538 maPropertyIdToNameMap
[Int_DeckTitleBarHeight
]="Int_DeckTitleBarHeight";
540 maPropertyNameToIdMap
["Int_DeckBorderSize"]=Int_DeckBorderSize
;
541 maPropertyIdToNameMap
[Int_DeckBorderSize
]="Int_DeckBorderSize";
543 maPropertyNameToIdMap
["Int_DeckSeparatorHeight"]=Int_DeckSeparatorHeight
;
544 maPropertyIdToNameMap
[Int_DeckSeparatorHeight
]="Int_DeckSeparatorHeight";
546 maPropertyNameToIdMap
["Int_PanelTitleBarHeight"]=Int_PanelTitleBarHeight
;
547 maPropertyIdToNameMap
[Int_PanelTitleBarHeight
]="Int_PanelTitleBarHeight";
549 maPropertyNameToIdMap
["Int_DeckLeftPadding"]=Int_DeckLeftPadding
;
550 maPropertyIdToNameMap
[Int_DeckLeftPadding
]="Int_DeckLeftPadding";
552 maPropertyNameToIdMap
["Int_DeckTopPadding"]=Int_DeckTopPadding
;
553 maPropertyIdToNameMap
[Int_DeckTopPadding
]="Int_DeckTopPadding";
555 maPropertyNameToIdMap
["Int_DeckRightPadding"]=Int_DeckRightPadding
;
556 maPropertyIdToNameMap
[Int_DeckRightPadding
]="Int_DeckRightPadding";
558 maPropertyNameToIdMap
["Int_DeckBottomPadding"]=Int_DeckBottomPadding
;
559 maPropertyIdToNameMap
[Int_DeckBottomPadding
]="Int_DeckBottomPadding";
562 maPropertyNameToIdMap
["Bool_UseSystemColors"]=Bool_UseSystemColors
;
563 maPropertyIdToNameMap
[Bool_UseSystemColors
]="Bool_UseSystemColors";
565 maPropertyNameToIdMap
["Bool_IsHighContrastModeActive"]=Bool_IsHighContrastModeActive
;
566 maPropertyIdToNameMap
[Bool_IsHighContrastModeActive
]="Bool_IsHighContrastModeActive";
568 maRawValues
.resize(maPropertyIdToNameMap
.size());
571 Theme::PropertyType
Theme::GetPropertyType (const ThemeItem eItem
)
575 case Image_CloseIndicator
:
578 case Color_DeckTitleFont
:
579 case Color_PanelTitleFont
:
580 case Color_Highlight
:
581 case Color_HighlightText
:
582 case Color_DeckBackground
:
583 case Color_DeckTitleBarBackground
:
584 case Color_PanelBackground
:
585 case Color_PanelTitleBarBackground
:
586 case Color_TabBarBackground
:
587 case Color_HorizontalBorder
:
588 case Color_VerticalBorder
:
589 case Color_DropDownBackground
:
592 case Int_DeckTitleBarHeight
:
593 case Int_DeckBorderSize
:
594 case Int_DeckSeparatorHeight
:
595 case Int_PanelTitleBarHeight
:
596 case Int_DeckLeftPadding
:
597 case Int_DeckTopPadding
:
598 case Int_DeckRightPadding
:
599 case Int_DeckBottomPadding
:
602 case Bool_UseSystemColors
:
603 case Bool_IsHighContrastModeActive
:
611 css::uno::Type
const & Theme::GetCppuType (const PropertyType eType
)
616 return cppu::UnoType
<OUString
>::get();
619 return cppu::UnoType
<sal_uInt32
>::get();
622 return cppu::UnoType
<sal_Int32
>::get();
625 return cppu::UnoType
<sal_Bool
>::get();
629 return cppu::UnoType
<void>::get();
633 sal_Int32
Theme::GetIndex (const ThemeItem eItem
, const PropertyType eType
)
638 return eItem
- Pre_Image_
-1;
640 return eItem
- Image_Color_
-1;
642 return eItem
- Color_Int_
-1;
644 return eItem
- Int_Bool_
-1;
651 Theme::VetoableListenerContainer
* Theme::GetVetoableListeners (
652 const ThemeItem eItem
,
655 VetoableListeners::iterator
iContainer (maVetoableListeners
.find(eItem
));
656 if (iContainer
!= maVetoableListeners
.end())
657 return &iContainer
->second
;
660 maVetoableListeners
[eItem
] = VetoableListenerContainer();
661 return &maVetoableListeners
[eItem
];
667 Theme::ChangeListenerContainer
* Theme::GetChangeListeners (
668 const ThemeItem eItem
,
671 ChangeListeners::iterator
iContainer (maChangeListeners
.find(eItem
));
672 if (iContainer
!= maChangeListeners
.end())
673 return &iContainer
->second
;
676 maChangeListeners
[eItem
] = ChangeListenerContainer();
677 return &maChangeListeners
[eItem
];
683 bool Theme::DoVetoableListenersVeto (
684 const VetoableListenerContainer
* pListeners
,
685 const beans::PropertyChangeEvent
& rEvent
)
687 if (pListeners
== nullptr)
690 VetoableListenerContainer
aListeners (*pListeners
);
693 for (const auto& rxListener
: aListeners
)
695 rxListener
->vetoableChange(rEvent
);
698 catch(const beans::PropertyVetoException
&)
702 catch(const Exception
&)
704 // Ignore any other errors (such as disposed listeners).
709 void Theme::BroadcastPropertyChange (
710 const ChangeListenerContainer
* pListeners
,
711 const beans::PropertyChangeEvent
& rEvent
)
713 if (pListeners
== nullptr)
716 const ChangeListenerContainer
aListeners (*pListeners
);
719 for (const auto& rxListener
: aListeners
)
721 rxListener
->propertyChange(rEvent
);
724 catch(const Exception
&)
726 // Ignore any errors (such as disposed listeners).
730 void Theme::ProcessNewValue (
732 const ThemeItem eItem
,
733 const PropertyType eType
)
735 const sal_Int32
nIndex (GetIndex (eItem
, eType
));
743 maImages
[nIndex
] = Image(Tools::GetImage(sURL
, nullptr));
749 sal_Int32
nColorValue (0);
750 if (rValue
>>= nColorValue
)
752 maColors
[nIndex
] = Color(nColorValue
);
758 sal_Int32
nValue (0);
759 if (rValue
>>= nValue
)
761 maIntegers
[nIndex
] = nValue
;
768 if (rValue
>>= bValue
)
770 maBooleans
[nIndex
] = bValue
;
771 if (eItem
== Bool_IsHighContrastModeActive
)
773 mbIsHighContrastModeSetManually
= true;
774 mbIsHighContrastMode
= maBooleans
[nIndex
];
777 else if (eItem
== Bool_UseSystemColors
)
785 OSL_ASSERT(eType
!= PT_Invalid
);
786 throw RuntimeException();
790 } // end of namespace sfx2::sidebar
792 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */