xref: /AOO41X/main/sfx2/source/sidebar/Theme.cxx (revision 5f1c83ff120c395cfa2329bae250db84e7fd7ebd)
1ff12d537SAndre Fischer /**************************************************************
2ff12d537SAndre Fischer  *
3ff12d537SAndre Fischer  * Licensed to the Apache Software Foundation (ASF) under one
4ff12d537SAndre Fischer  * or more contributor license agreements.  See the NOTICE file
5ff12d537SAndre Fischer  * distributed with this work for additional information
6ff12d537SAndre Fischer  * regarding copyright ownership.  The ASF licenses this file
7ff12d537SAndre Fischer  * to you under the Apache License, Version 2.0 (the
8ff12d537SAndre Fischer  * "License"); you may not use this file except in compliance
9ff12d537SAndre Fischer  * with the License.  You may obtain a copy of the License at
10ff12d537SAndre Fischer  *
11ff12d537SAndre Fischer  *   http://www.apache.org/licenses/LICENSE-2.0
12ff12d537SAndre Fischer  *
13ff12d537SAndre Fischer  * Unless required by applicable law or agreed to in writing,
14ff12d537SAndre Fischer  * software distributed under the License is distributed on an
15ff12d537SAndre Fischer  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16ff12d537SAndre Fischer  * KIND, either express or implied.  See the License for the
17ff12d537SAndre Fischer  * specific language governing permissions and limitations
18ff12d537SAndre Fischer  * under the License.
19ff12d537SAndre Fischer  *
20ff12d537SAndre Fischer  *************************************************************/
21ff12d537SAndre Fischer 
22ff12d537SAndre Fischer #include "precompiled_sfx2.hxx"
23ff12d537SAndre Fischer 
24b9e67834SAndre Fischer #include "sfx2/sidebar/Theme.hxx"
25ff12d537SAndre Fischer #include "Paint.hxx"
26ff12d537SAndre Fischer #include "SidebarResource.hxx"
27b9e67834SAndre Fischer #include "Tools.hxx"
28ff12d537SAndre Fischer 
29b9e67834SAndre Fischer #include <tools/svborder.hxx>
30ff12d537SAndre Fischer #include <tools/rc.hxx>
31ff12d537SAndre Fischer #include <vcl/svapp.hxx>
32ff12d537SAndre Fischer 
33b9e67834SAndre Fischer using namespace css;
34b9e67834SAndre Fischer using namespace cssu;
35b9e67834SAndre Fischer 
36ff12d537SAndre Fischer 
37ff12d537SAndre Fischer namespace sfx2 { namespace sidebar {
38ff12d537SAndre Fischer 
39b9e67834SAndre Fischer ::rtl::Reference<Theme> Theme::mpInstance;
40ff12d537SAndre Fischer 
41b9e67834SAndre Fischer 
42b9e67834SAndre Fischer 
43b9e67834SAndre Fischer 
44b9e67834SAndre Fischer Theme& Theme::GetCurrentTheme (void)
45ff12d537SAndre Fischer {
46b9e67834SAndre Fischer     if ( ! mpInstance.is())
47ff12d537SAndre Fischer     {
48b9e67834SAndre Fischer         mpInstance.set(new Theme());
49b9e67834SAndre Fischer         mpInstance->InitializeTheme();
50ff12d537SAndre Fischer     }
51b9e67834SAndre Fischer     return *mpInstance;
52ff12d537SAndre Fischer }
53ff12d537SAndre Fischer 
54ff12d537SAndre Fischer 
55ff12d537SAndre Fischer 
56ff12d537SAndre Fischer 
57b9e67834SAndre Fischer Theme::Theme (void)
58b9e67834SAndre Fischer     : ThemeInterfaceBase(m_aMutex),
59b9e67834SAndre Fischer       maImages(),
60b9e67834SAndre Fischer       maColors(),
61b9e67834SAndre Fischer       maPaints(),
62b9e67834SAndre Fischer       maIntegers(),
63b9e67834SAndre Fischer       maBooleans(),
64b9e67834SAndre Fischer       mbIsHighContrastMode(Application::GetSettings().GetStyleSettings().GetHighContrastMode()),
6595a18594SAndre Fischer       mbIsHighContrastModeSetManually(false),
66b9e67834SAndre Fischer       maPropertyNameToIdMap(),
67b9e67834SAndre Fischer       maPropertyIdToNameMap(),
68b9e67834SAndre Fischer       maRawValues(),
69b9e67834SAndre Fischer       maChangeListeners(),
70b9e67834SAndre Fischer       maVetoableListeners()
71b9e67834SAndre Fischer 
72ff12d537SAndre Fischer {
73b9e67834SAndre Fischer     SetupPropertyMaps();
74ff12d537SAndre Fischer }
75ff12d537SAndre Fischer 
76ff12d537SAndre Fischer 
77ff12d537SAndre Fischer 
78ff12d537SAndre Fischer 
79b9e67834SAndre Fischer Theme::~Theme (void)
80ff12d537SAndre Fischer {
81ff12d537SAndre Fischer }
82ff12d537SAndre Fischer 
83ff12d537SAndre Fischer 
84ff12d537SAndre Fischer 
85ff12d537SAndre Fischer 
86b9e67834SAndre Fischer Image Theme::GetImage (const ThemeItem eItem)
87ff12d537SAndre Fischer {
88b9e67834SAndre Fischer     const PropertyType eType (GetPropertyType(eItem));
89b9e67834SAndre Fischer     OSL_ASSERT(eType==PT_Image);
90b9e67834SAndre Fischer     const sal_Int32 nIndex (GetIndex(eItem, eType));
91b9e67834SAndre Fischer     const Theme& rTheme (GetCurrentTheme());
92b9e67834SAndre Fischer     return rTheme.maImages[nIndex];
93ff12d537SAndre Fischer }
94ff12d537SAndre Fischer 
95ff12d537SAndre Fischer 
96ff12d537SAndre Fischer 
97ff12d537SAndre Fischer 
98b9e67834SAndre Fischer Color Theme::GetColor (const ThemeItem eItem)
99ff12d537SAndre Fischer {
100b9e67834SAndre Fischer     const PropertyType eType (GetPropertyType(eItem));
1018dcb2a10SAndre Fischer     OSL_ASSERT(eType==PT_Color || eType==PT_Paint);
102b9e67834SAndre Fischer     const sal_Int32 nIndex (GetIndex(eItem, eType));
103b9e67834SAndre Fischer     const Theme& rTheme (GetCurrentTheme());
1048dcb2a10SAndre Fischer     if (eType == PT_Color)
105b9e67834SAndre Fischer         return rTheme.maColors[nIndex];
1068dcb2a10SAndre Fischer     else if (eType == PT_Paint)
1078dcb2a10SAndre Fischer         return rTheme.maPaints[nIndex].GetColor();
108ff12d537SAndre Fischer }
109ff12d537SAndre Fischer 
110ff12d537SAndre Fischer 
111ff12d537SAndre Fischer 
112ff12d537SAndre Fischer 
113b9e67834SAndre Fischer const Paint& Theme::GetPaint (const ThemeItem eItem)
114ff12d537SAndre Fischer {
115b9e67834SAndre Fischer     const PropertyType eType (GetPropertyType(eItem));
116b9e67834SAndre Fischer     OSL_ASSERT(eType==PT_Paint);
117b9e67834SAndre Fischer     const sal_Int32 nIndex (GetIndex(eItem, eType));
118b9e67834SAndre Fischer     const Theme& rTheme (GetCurrentTheme());
119b9e67834SAndre Fischer     return rTheme.maPaints[nIndex];
120ff12d537SAndre Fischer }
121ff12d537SAndre Fischer 
122ff12d537SAndre Fischer 
123ff12d537SAndre Fischer 
124ff12d537SAndre Fischer 
1257a32b0c8SAndre Fischer const Wallpaper Theme::GetWallpaper (const ThemeItem eItem)
1267a32b0c8SAndre Fischer {
1277a32b0c8SAndre Fischer     return GetPaint(eItem).GetWallpaper();
1287a32b0c8SAndre Fischer }
1297a32b0c8SAndre Fischer 
1307a32b0c8SAndre Fischer 
1317a32b0c8SAndre Fischer 
1327a32b0c8SAndre Fischer 
133b9e67834SAndre Fischer sal_Int32 Theme::GetInteger (const ThemeItem eItem)
134ff12d537SAndre Fischer {
135b9e67834SAndre Fischer     const PropertyType eType (GetPropertyType(eItem));
136b9e67834SAndre Fischer     OSL_ASSERT(eType==PT_Integer);
137b9e67834SAndre Fischer     const sal_Int32 nIndex (GetIndex(eItem, eType));
138b9e67834SAndre Fischer     const Theme& rTheme (GetCurrentTheme());
139b9e67834SAndre Fischer     return rTheme.maIntegers[nIndex];
140ff12d537SAndre Fischer }
141ff12d537SAndre Fischer 
142ff12d537SAndre Fischer 
143ff12d537SAndre Fischer 
144ff12d537SAndre Fischer 
145b9e67834SAndre Fischer bool Theme::GetBoolean (const ThemeItem eItem)
146ff12d537SAndre Fischer {
147b9e67834SAndre Fischer     const PropertyType eType (GetPropertyType(eItem));
148b9e67834SAndre Fischer     OSL_ASSERT(eType==PT_Boolean);
149b9e67834SAndre Fischer     const sal_Int32 nIndex (GetIndex(eItem, eType));
150b9e67834SAndre Fischer     const Theme& rTheme (GetCurrentTheme());
151b9e67834SAndre Fischer     return rTheme.maBooleans[nIndex];
152ff12d537SAndre Fischer }
153ff12d537SAndre Fischer 
154ff12d537SAndre Fischer 
155ff12d537SAndre Fischer 
156ff12d537SAndre Fischer 
15795a18594SAndre Fischer Rectangle Theme::GetRectangle (const ThemeItem eItem)
15895a18594SAndre Fischer {
15995a18594SAndre Fischer     const PropertyType eType (GetPropertyType(eItem));
16095a18594SAndre Fischer     OSL_ASSERT(eType==PT_Rectangle);
16195a18594SAndre Fischer     const sal_Int32 nIndex (GetIndex(eItem, eType));
16295a18594SAndre Fischer     const Theme& rTheme (GetCurrentTheme());
16395a18594SAndre Fischer     return rTheme.maRectangles[nIndex];
16495a18594SAndre Fischer }
16595a18594SAndre Fischer 
16695a18594SAndre Fischer 
16795a18594SAndre Fischer 
16895a18594SAndre Fischer 
169ff12d537SAndre Fischer bool Theme::IsHighContrastMode (void)
170ff12d537SAndre Fischer {
171b9e67834SAndre Fischer     const Theme& rTheme (GetCurrentTheme());
172b9e67834SAndre Fischer     return rTheme.mbIsHighContrastMode;
173ff12d537SAndre Fischer }
174ff12d537SAndre Fischer 
175ff12d537SAndre Fischer 
176ff12d537SAndre Fischer 
177ff12d537SAndre Fischer 
178ff12d537SAndre Fischer void Theme::HandleDataChange (void)
179ff12d537SAndre Fischer {
18095a18594SAndre Fischer     Theme& rTheme (GetCurrentTheme());
18195a18594SAndre Fischer 
18295a18594SAndre Fischer     if ( ! rTheme.mbIsHighContrastModeSetManually)
18395a18594SAndre Fischer     {
18495a18594SAndre Fischer         // Do not modify mbIsHighContrastMode when it was manually set.
185b9e67834SAndre Fischer         GetCurrentTheme().mbIsHighContrastMode = Application::GetSettings().GetStyleSettings().GetHighContrastMode();
18695a18594SAndre Fischer         rTheme.maRawValues[Bool_IsHighContrastModeActive] = Any(GetCurrentTheme().mbIsHighContrastMode);
18795a18594SAndre Fischer     }
18895a18594SAndre Fischer 
18995a18594SAndre Fischer     GetCurrentTheme().UpdateTheme();
190ff12d537SAndre Fischer }
191ff12d537SAndre Fischer 
192ff12d537SAndre Fischer 
193ff12d537SAndre Fischer 
194ff12d537SAndre Fischer 
195b9e67834SAndre Fischer void Theme::InitializeTheme (void)
196ff12d537SAndre Fischer {
19795a18594SAndre Fischer     setPropertyValue(
19895a18594SAndre Fischer         maPropertyIdToNameMap[Bool_UseSymphonyIcons],
19995a18594SAndre Fischer         Any(true));
20095a18594SAndre Fischer     setPropertyValue(
20195a18594SAndre Fischer         maPropertyIdToNameMap[Bool_UseSystemColors],
20295a18594SAndre Fischer         Any(false));
20395a18594SAndre Fischer }
20495a18594SAndre Fischer 
20595a18594SAndre Fischer 
20695a18594SAndre Fischer 
20795a18594SAndre Fischer 
20895a18594SAndre Fischer void Theme::UpdateTheme (void)
20995a18594SAndre Fischer {
210ff12d537SAndre Fischer     SidebarResource aLocalResource;
211ff12d537SAndre Fischer 
212b9e67834SAndre Fischer     try
213b9e67834SAndre Fischer     {
21495a18594SAndre Fischer         const StyleSettings& rStyle (Application::GetSettings().GetStyleSettings());
21595a18594SAndre Fischer         const bool bUseSystemColors (GetBoolean(Bool_UseSystemColors));
21695a18594SAndre Fischer 
21795a18594SAndre Fischer #define Alternatives(n,hc,sys) (mbIsHighContrastMode ? hc : (bUseSystemColors ? sys : n))
21895a18594SAndre Fischer 
2198dcb2a10SAndre Fischer         const Color aBaseBackgroundColor (rStyle.GetDialogColor());
2208dcb2a10SAndre Fischer         Color aBorderColor (aBaseBackgroundColor);
2218dcb2a10SAndre Fischer         aBorderColor.DecreaseLuminance(15);
2228dcb2a10SAndre Fischer         Color aSecondColor (aBaseBackgroundColor);
2238dcb2a10SAndre Fischer         aSecondColor.DecreaseLuminance(15);
2248dcb2a10SAndre Fischer 
225b9e67834SAndre Fischer         setPropertyValue(
226b9e67834SAndre Fischer             maPropertyIdToNameMap[Paint_DeckBackground],
2278dcb2a10SAndre Fischer             Any(sal_Int32(rStyle.GetMenuColor().GetRGBColor())));
22895a18594SAndre Fischer 
229b9e67834SAndre Fischer         setPropertyValue(
230b9e67834SAndre Fischer             maPropertyIdToNameMap[Paint_DeckTitleBarBackground],
2318dcb2a10SAndre Fischer             Any(sal_Int32(aBaseBackgroundColor.GetRGBColor())));
232b9e67834SAndre Fischer         setPropertyValue(
233b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_DeckLeftPadding],
234b9e67834SAndre Fischer             Any(sal_Int32(2)));
235b9e67834SAndre Fischer         setPropertyValue(
236b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_DeckTopPadding],
237b9e67834SAndre Fischer             Any(sal_Int32(2)));
238b9e67834SAndre Fischer         setPropertyValue(
239b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_DeckRightPadding],
240b9e67834SAndre Fischer             Any(sal_Int32(2)));
241b9e67834SAndre Fischer         setPropertyValue(
242b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_DeckBottomPadding],
243b9e67834SAndre Fischer             Any(sal_Int32(2)));
244b9e67834SAndre Fischer         setPropertyValue(
245b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_DeckBorderSize],
246b9e67834SAndre Fischer             Any(sal_Int32(1)));
247b9e67834SAndre Fischer         setPropertyValue(
248b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_DeckSeparatorHeight],
249b9e67834SAndre Fischer             Any(sal_Int32(1)));
250b9e67834SAndre Fischer         setPropertyValue(
251b9e67834SAndre Fischer             maPropertyIdToNameMap[Color_DeckTitleFont],
2528dcb2a10SAndre Fischer             Any(sal_Int32(rStyle.GetFontColor().GetRGBColor())));
253b9e67834SAndre Fischer         setPropertyValue(
254b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_DeckTitleBarHeight],
25595a18594SAndre Fischer             Any(sal_Int32(Alternatives(
25695a18594SAndre Fischer                         26,
25795a18594SAndre Fischer                         26,
25895a18594SAndre Fischer                         rStyle.GetFloatTitleHeight()))));
259b9e67834SAndre Fischer         setPropertyValue(
260b9e67834SAndre Fischer             maPropertyIdToNameMap[Paint_PanelBackground],
2618dcb2a10SAndre Fischer             Any(sal_Int32(rStyle.GetDialogColor().GetRGBColor())));
2628dcb2a10SAndre Fischer         //            Any(sal_Int32(mbIsHighContrastMode ? 0x000000 :
2638dcb2a10SAndre Fischer         //            0xffffff)));
2648dcb2a10SAndre Fischer 
265b9e67834SAndre Fischer         setPropertyValue(
266b9e67834SAndre Fischer             maPropertyIdToNameMap[Paint_PanelTitleBarBackground],
2678dcb2a10SAndre Fischer             Any(Tools::VclToAwtGradient(Gradient(
2688dcb2a10SAndre Fischer                         GRADIENT_LINEAR,
2698dcb2a10SAndre Fischer                         aSecondColor.GetRGBColor(),
2708dcb2a10SAndre Fischer                         aBaseBackgroundColor.GetRGBColor()
2718dcb2a10SAndre Fischer                         ))));
272b9e67834SAndre Fischer         setPropertyValue(
273b9e67834SAndre Fischer             maPropertyIdToNameMap[Color_PanelTitleFont],
274b9e67834SAndre Fischer             Any(sal_Int32(mbIsHighContrastMode ? 0x00ff00 : 0x262626)));
275b9e67834SAndre Fischer         setPropertyValue(
276b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_PanelTitleBarHeight],
27795a18594SAndre Fischer             Any(sal_Int32(Alternatives(
27895a18594SAndre Fischer                         26,
27995a18594SAndre Fischer                         26,
28095a18594SAndre Fischer                         rStyle.GetTitleHeight()))));
281b9e67834SAndre Fischer         setPropertyValue(
282b9e67834SAndre Fischer             maPropertyIdToNameMap[Paint_TabBarBackground],
2838dcb2a10SAndre Fischer             Any(sal_Int32(aBaseBackgroundColor.GetRGBColor())));
284b9e67834SAndre Fischer         setPropertyValue(
285b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_TabBarLeftPadding],
286b9e67834SAndre Fischer             Any(sal_Int32(2)));
287b9e67834SAndre Fischer         setPropertyValue(
288b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_TabBarTopPadding],
289b9e67834SAndre Fischer             Any(sal_Int32(2)));
290b9e67834SAndre Fischer         setPropertyValue(
291b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_TabBarRightPadding],
292b9e67834SAndre Fischer             Any(sal_Int32(2)));
293b9e67834SAndre Fischer         setPropertyValue(
294b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_TabBarBottomPadding],
295b9e67834SAndre Fischer             Any(sal_Int32(2)));
296ff12d537SAndre Fischer 
297b9e67834SAndre Fischer         setPropertyValue(
298b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_TabMenuPadding],
299b9e67834SAndre Fischer             Any(sal_Int32(6)));
300b9e67834SAndre Fischer         setPropertyValue(
301b9e67834SAndre Fischer             maPropertyIdToNameMap[Color_TabMenuSeparator],
3028dcb2a10SAndre Fischer             Any(sal_Int32(aBorderColor.GetRGBColor())));
303b9e67834SAndre Fischer         setPropertyValue(
304b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_TabMenuSeparatorPadding],
305b9e67834SAndre Fischer             Any(sal_Int32(7)));
306ff12d537SAndre Fischer 
307b9e67834SAndre Fischer         setPropertyValue(
308b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_TabItemWidth],
309b9e67834SAndre Fischer             Any(sal_Int32(32)));
310b9e67834SAndre Fischer         setPropertyValue(
311b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_TabItemHeight],
312b9e67834SAndre Fischer             Any(sal_Int32(32)));
313b9e67834SAndre Fischer         setPropertyValue(
314b9e67834SAndre Fischer             maPropertyIdToNameMap[Color_TabItemBorder],
3158dcb2a10SAndre Fischer             Any(sal_Int32(rStyle.GetActiveBorderColor().GetRGBColor())));
3168dcb2a10SAndre Fischer         //                    mbIsHighContrastMode ? 0x00ff00 : 0xbfbfbf)));
3178dcb2a10SAndre Fischer 
3188dcb2a10SAndre Fischer         setPropertyValue(
3198dcb2a10SAndre Fischer             maPropertyIdToNameMap[Paint_DropDownBackground],
3208dcb2a10SAndre Fischer             Any(sal_Int32(aBaseBackgroundColor.GetRGBColor())));
3218dcb2a10SAndre Fischer         setPropertyValue(
3228dcb2a10SAndre Fischer             maPropertyIdToNameMap[Color_DropDownBorder],
3238dcb2a10SAndre Fischer             Any(sal_Int32(rStyle.GetActiveBorderColor().GetRGBColor())));
3248dcb2a10SAndre Fischer 
325b9e67834SAndre Fischer         setPropertyValue(
326*5f1c83ffSOliver-Rainer Wittmann             maPropertyIdToNameMap[Color_Highlight],
327*5f1c83ffSOliver-Rainer Wittmann             Any(sal_Int32(rStyle.GetHighlightColor().GetRGBColor())));
328*5f1c83ffSOliver-Rainer Wittmann         setPropertyValue(
329*5f1c83ffSOliver-Rainer Wittmann             maPropertyIdToNameMap[Color_HighlightText],
330*5f1c83ffSOliver-Rainer Wittmann             Any(sal_Int32(rStyle.GetHighlightTextColor().GetRGBColor())));
331*5f1c83ffSOliver-Rainer Wittmann 
332*5f1c83ffSOliver-Rainer Wittmann         setPropertyValue(
33395a18594SAndre Fischer             maPropertyIdToNameMap[Paint_TabItemBackgroundNormal],
33495a18594SAndre Fischer             Any());
33595a18594SAndre Fischer         setPropertyValue(
33695a18594SAndre Fischer             maPropertyIdToNameMap[Paint_TabItemBackgroundHighlight],
3378dcb2a10SAndre Fischer             Any(sal_Int32(rStyle.GetActiveTabColor().GetRGBColor())));
3388dcb2a10SAndre Fischer         //                    mbIsHighContrastMode ? 0x000000 : 0x00ffffff)));
339ff12d537SAndre Fischer 
340b9e67834SAndre Fischer         setPropertyValue(
341b9e67834SAndre Fischer             maPropertyIdToNameMap[Paint_HorizontalBorder],
3428dcb2a10SAndre Fischer             Any(sal_Int32(aBorderColor.GetRGBColor())));
3438dcb2a10SAndre Fischer         //                    mbIsHighContrastMode ? 0x00ff00 :  0xe4e4e4)));
344b9e67834SAndre Fischer         setPropertyValue(
345b9e67834SAndre Fischer             maPropertyIdToNameMap[Paint_VerticalBorder],
3468dcb2a10SAndre Fischer             Any(sal_Int32(aBorderColor.GetRGBColor())));
3478dcb2a10SAndre Fischer         //                    mbIsHighContrastMode ? 0x00ff00 : 0xe4e4e4)));
348ff12d537SAndre Fischer 
349b9e67834SAndre Fischer         setPropertyValue(
350b9e67834SAndre Fischer             maPropertyIdToNameMap[Image_Grip],
351b9e67834SAndre Fischer             Any(
352b9e67834SAndre Fischer                 mbIsHighContrastMode
353b9e67834SAndre Fischer                     ? A2S("private:graphicrepository/sfx2/res/grip_hc.png")
354b9e67834SAndre Fischer                     : A2S("private:graphicrepository/sfx2/res/grip.png")));
355b9e67834SAndre Fischer         setPropertyValue(
356b9e67834SAndre Fischer             maPropertyIdToNameMap[Image_Expand],
357b9e67834SAndre Fischer             Any(
358b9e67834SAndre Fischer                 mbIsHighContrastMode
3597a32b0c8SAndre Fischer                     ? A2S("private:graphicrepository/svtools/res/triangle_right_hc.png")
3607a32b0c8SAndre Fischer                     : A2S("private:graphicrepository/svtools/res/triangle_right.png")));
3617a32b0c8SAndre Fischer         //                    ? A2S("private:graphicrepository/res/plus_sch.png")
3627a32b0c8SAndre Fischer         //                    : A2S("private:graphicrepository/res/plus.png")));
363b9e67834SAndre Fischer         setPropertyValue(
364b9e67834SAndre Fischer             maPropertyIdToNameMap[Image_Collapse],
365b9e67834SAndre Fischer             Any(
366b9e67834SAndre Fischer                 mbIsHighContrastMode
3677a32b0c8SAndre Fischer                     ? A2S("private:graphicrepository/svtools/res/triangle_down_hc.png")
3687a32b0c8SAndre Fischer                     : A2S("private:graphicrepository/svtools/res/triangle_down.png")));
3697a32b0c8SAndre Fischer         //                    ? A2S("private:graphicrepository/res/minus_sch.png")
3707a32b0c8SAndre Fischer         //                    : A2S("private:graphicrepository/res/minus.png")));
371b9e67834SAndre Fischer         setPropertyValue(
3727a32b0c8SAndre Fischer             maPropertyIdToNameMap[Image_TabBarMenu],
373b9e67834SAndre Fischer             Any(
374b9e67834SAndre Fischer                 mbIsHighContrastMode
37595a18594SAndre Fischer                     ? A2S("private:graphicrepository/sfx2/res/menu_hc.png")
376b9e67834SAndre Fischer                     : A2S("private:graphicrepository/sfx2/res/menu.png")));
377b9e67834SAndre Fischer         setPropertyValue(
3787a32b0c8SAndre Fischer             maPropertyIdToNameMap[Image_PanelMenu],
3797a32b0c8SAndre Fischer             Any(
3807a32b0c8SAndre Fischer                 mbIsHighContrastMode
3817a32b0c8SAndre Fischer                     ? A2S("private:graphicrepository/res/imh30823.png")
3827a32b0c8SAndre Fischer                     : A2S("private:graphicrepository/res/im30823.png")));
3837a32b0c8SAndre Fischer         setPropertyValue(
3847a32b0c8SAndre Fischer             maPropertyIdToNameMap[Image_Closer],
3857a32b0c8SAndre Fischer             Any(A2S("private:graphicrepository/sfx2/res/closedoc.png")));
3867a32b0c8SAndre Fischer         setPropertyValue(
38795a18594SAndre Fischer             maPropertyIdToNameMap[Image_ToolBoxItemSeparator],
38895a18594SAndre Fischer             Any(
38995a18594SAndre Fischer                 A2S("private:graphicrepository/sfx2/res/separator.png")));
39095a18594SAndre Fischer 
39195a18594SAndre Fischer         // ToolBox
3928dcb2a10SAndre Fischer 
3938dcb2a10SAndre Fischer         /*
3948dcb2a10SAndre Fischer         // Separator style
3958dcb2a10SAndre Fischer         setPropertyValue(
3968dcb2a10SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBackground],
3978dcb2a10SAndre Fischer             Any(sal_Int32(rStyle.GetMenuColor().GetRGBColor())));
3988dcb2a10SAndre Fischer         setPropertyValue(
3998dcb2a10SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBorderTopLeft],
4008dcb2a10SAndre Fischer             Any());
4018dcb2a10SAndre Fischer         setPropertyValue(
4028dcb2a10SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBorderCenterCorners],
4038dcb2a10SAndre Fischer             Any());
4048dcb2a10SAndre Fischer         setPropertyValue(
4058dcb2a10SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBorderBottomRight],
4068dcb2a10SAndre Fischer             Any());
4078dcb2a10SAndre Fischer         setPropertyValue(
4088dcb2a10SAndre Fischer             maPropertyIdToNameMap[Rect_ToolBoxPadding],
4098dcb2a10SAndre Fischer             Any(awt::Rectangle(2,2,2,2)));
4108dcb2a10SAndre Fischer         setPropertyValue(
4118dcb2a10SAndre Fischer             maPropertyIdToNameMap[Rect_ToolBoxBorder],
4128dcb2a10SAndre Fischer             Any(awt::Rectangle(0,0,0,0)));
4138dcb2a10SAndre Fischer         setPropertyValue(
4148dcb2a10SAndre Fischer             maPropertyIdToNameMap[Bool_UseToolBoxItemSeparator],
4158dcb2a10SAndre Fischer             Any(true));
4168dcb2a10SAndre Fischer 
4178dcb2a10SAndre Fischer         */
4188dcb2a10SAndre Fischer 
4198dcb2a10SAndre Fischer         // Gradient style
42095a18594SAndre Fischer         setPropertyValue(
42195a18594SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBackground],
42295a18594SAndre Fischer             Any(Tools::VclToAwtGradient(Gradient(
42395a18594SAndre Fischer                         GRADIENT_LINEAR,
42495a18594SAndre Fischer                         Color(0xf2f2f2),
42595a18594SAndre Fischer                         Color(0xfefefe)
42695a18594SAndre Fischer                         ))));
42795a18594SAndre Fischer         setPropertyValue(
42895a18594SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBorderTopLeft],
42995a18594SAndre Fischer             mbIsHighContrastMode
43095a18594SAndre Fischer                 ? Any(util::Color(sal_uInt32(0x00ff00)))
43195a18594SAndre Fischer                 : Any(util::Color(sal_uInt32(0xf2f2f2))));
43295a18594SAndre Fischer         setPropertyValue(
43395a18594SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBorderCenterCorners],
43495a18594SAndre Fischer             mbIsHighContrastMode
43595a18594SAndre Fischer                 ? Any(util::Color(sal_uInt32(0x00ff00)))
43695a18594SAndre Fischer                 : Any(util::Color(sal_uInt32(0xf2f2f2))));
43795a18594SAndre Fischer         setPropertyValue(
43895a18594SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBorderBottomRight],
43995a18594SAndre Fischer             mbIsHighContrastMode
44095a18594SAndre Fischer                 ? Any(util::Color(sal_uInt32(0x00ff00)))
44195a18594SAndre Fischer                 : Any(util::Color(sal_uInt32(0xf2f2f2))));
44295a18594SAndre Fischer         setPropertyValue(
44395a18594SAndre Fischer             maPropertyIdToNameMap[Rect_ToolBoxPadding],
44495a18594SAndre Fischer             Any(awt::Rectangle(2,2,2,2)));
44595a18594SAndre Fischer         setPropertyValue(
44695a18594SAndre Fischer             maPropertyIdToNameMap[Rect_ToolBoxBorder],
44795a18594SAndre Fischer             Any(awt::Rectangle(1,1,1,1)));
44895a18594SAndre Fischer         setPropertyValue(
44995a18594SAndre Fischer             maPropertyIdToNameMap[Bool_UseToolBoxItemSeparator],
45095a18594SAndre Fischer             Any(false));
451ff12d537SAndre Fischer     }
45295a18594SAndre Fischer     catch(beans::UnknownPropertyException& rException)
453b9e67834SAndre Fischer     {
45495a18594SAndre Fischer         OSL_TRACE("unknown property: %s",
45595a18594SAndre Fischer             OUStringToOString(
45695a18594SAndre Fischer                 rException.Message,
45795a18594SAndre Fischer                 RTL_TEXTENCODING_ASCII_US).getStr());
458b9e67834SAndre Fischer         OSL_ASSERT(false);
459b9e67834SAndre Fischer     }
460b9e67834SAndre Fischer }
461b9e67834SAndre Fischer 
462b9e67834SAndre Fischer 
463b9e67834SAndre Fischer 
464b9e67834SAndre Fischer 
465b9e67834SAndre Fischer void SAL_CALL Theme::disposing (void)
466b9e67834SAndre Fischer {
467b9e67834SAndre Fischer     ChangeListeners aListeners;
468b9e67834SAndre Fischer     maChangeListeners.swap(aListeners);
469b9e67834SAndre Fischer 
470b9e67834SAndre Fischer     const lang::EventObject aEvent (static_cast<XWeak*>(this));
471b9e67834SAndre Fischer 
472b9e67834SAndre Fischer     for (ChangeListeners::const_iterator
473b9e67834SAndre Fischer              iContainer(maChangeListeners.begin()),
474b9e67834SAndre Fischer              iContainerEnd(maChangeListeners.end());
475b9e67834SAndre Fischer          iContainerEnd!=iContainerEnd;
476b9e67834SAndre Fischer          ++iContainerEnd)
477b9e67834SAndre Fischer     {
478b9e67834SAndre Fischer         for (ChangeListenerContainer::const_iterator
479b9e67834SAndre Fischer                  iListener(iContainer->second.begin()),
480b9e67834SAndre Fischer                  iEnd(iContainer->second.end());
481b9e67834SAndre Fischer              iListener!=iEnd;
482b9e67834SAndre Fischer              ++iListener)
483b9e67834SAndre Fischer         {
484b9e67834SAndre Fischer             try
485b9e67834SAndre Fischer             {
486b9e67834SAndre Fischer                 (*iListener)->disposing(aEvent);
487b9e67834SAndre Fischer             }
488b9e67834SAndre Fischer             catch(const Exception&)
489b9e67834SAndre Fischer             {
490b9e67834SAndre Fischer             }
491b9e67834SAndre Fischer         }
492b9e67834SAndre Fischer     }
493b9e67834SAndre Fischer }
494b9e67834SAndre Fischer 
495b9e67834SAndre Fischer 
496b9e67834SAndre Fischer 
497b9e67834SAndre Fischer 
498b9e67834SAndre Fischer Reference<beans::XPropertySet> Theme::GetPropertySet (void)
499b9e67834SAndre Fischer {
500b9e67834SAndre Fischer     return Reference<beans::XPropertySet>(static_cast<XWeak*>(&GetCurrentTheme()), UNO_QUERY);
501b9e67834SAndre Fischer }
502b9e67834SAndre Fischer 
503b9e67834SAndre Fischer 
504b9e67834SAndre Fischer 
505b9e67834SAndre Fischer 
506b9e67834SAndre Fischer Reference<beans::XPropertySetInfo> SAL_CALL Theme::getPropertySetInfo (void)
507b9e67834SAndre Fischer     throw(cssu::RuntimeException)
508b9e67834SAndre Fischer {
50995a18594SAndre Fischer     return Reference<beans::XPropertySetInfo>(this);
510b9e67834SAndre Fischer }
511b9e67834SAndre Fischer 
512b9e67834SAndre Fischer 
513b9e67834SAndre Fischer 
514b9e67834SAndre Fischer 
515b9e67834SAndre Fischer void SAL_CALL Theme::setPropertyValue (
516b9e67834SAndre Fischer     const ::rtl::OUString& rsPropertyName,
517b9e67834SAndre Fischer     const cssu::Any& rValue)
518b9e67834SAndre Fischer     throw(cssu::RuntimeException)
519b9e67834SAndre Fischer {
520b9e67834SAndre Fischer     PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
521b9e67834SAndre Fischer     if (iId == maPropertyNameToIdMap.end())
52295a18594SAndre Fischer         throw beans::UnknownPropertyException(rsPropertyName, NULL);
523b9e67834SAndre Fischer 
524b9e67834SAndre Fischer     const PropertyType eType (GetPropertyType(iId->second));
525b9e67834SAndre Fischer     if (eType == PT_Invalid)
52695a18594SAndre Fischer         throw beans::UnknownPropertyException(rsPropertyName, NULL);
527b9e67834SAndre Fischer 
528b9e67834SAndre Fischer     const ThemeItem eItem (iId->second);
529b9e67834SAndre Fischer 
530b9e67834SAndre Fischer     if (rValue == maRawValues[eItem])
531b9e67834SAndre Fischer     {
532b9e67834SAndre Fischer         // Value is not different from the one in the property
533b9e67834SAndre Fischer         // set => nothing to do.
534b9e67834SAndre Fischer         return;
535b9e67834SAndre Fischer     }
536b9e67834SAndre Fischer 
537b9e67834SAndre Fischer     const Any aOldValue (maRawValues[eItem]);
538b9e67834SAndre Fischer 
539b9e67834SAndre Fischer     const beans::PropertyChangeEvent aEvent(
540b9e67834SAndre Fischer         static_cast<XWeak*>(this),
541b9e67834SAndre Fischer         rsPropertyName,
542b9e67834SAndre Fischer         sal_False,
543b9e67834SAndre Fischer         eItem,
544b9e67834SAndre Fischer         aOldValue,
545b9e67834SAndre Fischer         rValue);
546b9e67834SAndre Fischer 
547b9e67834SAndre Fischer     if (DoVetoableListenersVeto(GetVetoableListeners(__AnyItem, false), aEvent))
548b9e67834SAndre Fischer         return;
549b9e67834SAndre Fischer     if (DoVetoableListenersVeto(GetVetoableListeners(eItem, false), aEvent))
550b9e67834SAndre Fischer         return;
551b9e67834SAndre Fischer 
552b9e67834SAndre Fischer     maRawValues[eItem] = rValue;
553b9e67834SAndre Fischer     ProcessNewValue(rValue, eItem, eType);
554b9e67834SAndre Fischer 
555b9e67834SAndre Fischer     BroadcastPropertyChange(GetChangeListeners(__AnyItem, false), aEvent);
556b9e67834SAndre Fischer     BroadcastPropertyChange(GetChangeListeners(eItem, false), aEvent);
557b9e67834SAndre Fischer }
558b9e67834SAndre Fischer 
559b9e67834SAndre Fischer 
560b9e67834SAndre Fischer 
561b9e67834SAndre Fischer 
562b9e67834SAndre Fischer Any SAL_CALL Theme::getPropertyValue (
563b9e67834SAndre Fischer     const ::rtl::OUString& rsPropertyName)
564b9e67834SAndre Fischer     throw(css::beans::UnknownPropertyException,
565b9e67834SAndre Fischer         css::lang::WrappedTargetException,
566b9e67834SAndre Fischer         cssu::RuntimeException)
567b9e67834SAndre Fischer {
568b9e67834SAndre Fischer     PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
569b9e67834SAndre Fischer     if (iId == maPropertyNameToIdMap.end())
570b9e67834SAndre Fischer         throw beans::UnknownPropertyException();
571b9e67834SAndre Fischer 
572b9e67834SAndre Fischer     const PropertyType eType (GetPropertyType(iId->second));
573b9e67834SAndre Fischer     if (eType == PT_Invalid)
574b9e67834SAndre Fischer         throw beans::UnknownPropertyException();
575b9e67834SAndre Fischer 
576b9e67834SAndre Fischer     const ThemeItem eItem (iId->second);
577b9e67834SAndre Fischer 
578b9e67834SAndre Fischer     return maRawValues[eItem];
579b9e67834SAndre Fischer }
580b9e67834SAndre Fischer 
581b9e67834SAndre Fischer 
582b9e67834SAndre Fischer 
583b9e67834SAndre Fischer 
584b9e67834SAndre Fischer void SAL_CALL Theme::addPropertyChangeListener(
585b9e67834SAndre Fischer     const ::rtl::OUString& rsPropertyName,
586b9e67834SAndre Fischer     const cssu::Reference<css::beans::XPropertyChangeListener>& rxListener)
587b9e67834SAndre Fischer     throw(css::beans::UnknownPropertyException,
588b9e67834SAndre Fischer         css::lang::WrappedTargetException,
589b9e67834SAndre Fischer         cssu::RuntimeException)
590b9e67834SAndre Fischer {
591b9e67834SAndre Fischer     ThemeItem eItem (__AnyItem);
592b9e67834SAndre Fischer     if (rsPropertyName.getLength() > 0)
593b9e67834SAndre Fischer     {
594b9e67834SAndre Fischer         PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
595b9e67834SAndre Fischer         if (iId == maPropertyNameToIdMap.end())
596b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
597b9e67834SAndre Fischer 
598b9e67834SAndre Fischer         const PropertyType eType (GetPropertyType(iId->second));
599b9e67834SAndre Fischer         if (eType == PT_Invalid)
600b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
601b9e67834SAndre Fischer 
602b9e67834SAndre Fischer         eItem = iId->second;
603b9e67834SAndre Fischer     }
604b9e67834SAndre Fischer     ChangeListenerContainer* pListeners = GetChangeListeners(eItem, true);
605b9e67834SAndre Fischer     if (pListeners != NULL)
606b9e67834SAndre Fischer         pListeners->push_back(rxListener);
607b9e67834SAndre Fischer }
608b9e67834SAndre Fischer 
609b9e67834SAndre Fischer 
610b9e67834SAndre Fischer 
611b9e67834SAndre Fischer 
612b9e67834SAndre Fischer void SAL_CALL Theme::removePropertyChangeListener(
613b9e67834SAndre Fischer     const ::rtl::OUString& rsPropertyName,
614b9e67834SAndre Fischer     const cssu::Reference<css::beans::XPropertyChangeListener>& rxListener)
615b9e67834SAndre Fischer     throw(css::beans::UnknownPropertyException,
616b9e67834SAndre Fischer         css::lang::WrappedTargetException,
617b9e67834SAndre Fischer         cssu::RuntimeException)
618b9e67834SAndre Fischer {
619b9e67834SAndre Fischer     ThemeItem eItem (__AnyItem);
620b9e67834SAndre Fischer     if (rsPropertyName.getLength() > 0)
621b9e67834SAndre Fischer     {
622b9e67834SAndre Fischer         PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
623b9e67834SAndre Fischer         if (iId == maPropertyNameToIdMap.end())
624b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
625b9e67834SAndre Fischer 
626b9e67834SAndre Fischer         const PropertyType eType (GetPropertyType(iId->second));
627b9e67834SAndre Fischer         if (eType == PT_Invalid)
628b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
629b9e67834SAndre Fischer 
630b9e67834SAndre Fischer         eItem = iId->second;
631b9e67834SAndre Fischer     }
632b9e67834SAndre Fischer     ChangeListenerContainer* pContainer = GetChangeListeners(eItem, false);
633b9e67834SAndre Fischer     if (pContainer != NULL)
634b9e67834SAndre Fischer     {
635b9e67834SAndre Fischer         ChangeListenerContainer::iterator iListener (::std::find(pContainer->begin(), pContainer->end(), rxListener));
636b9e67834SAndre Fischer         if (iListener != pContainer->end())
637b9e67834SAndre Fischer         {
638b9e67834SAndre Fischer             pContainer->erase(iListener);
639b9e67834SAndre Fischer 
640b9e67834SAndre Fischer             // Remove the listener container when empty.
641b9e67834SAndre Fischer             if (pContainer->empty())
642b9e67834SAndre Fischer                 maChangeListeners.erase(eItem);
643b9e67834SAndre Fischer         }
644b9e67834SAndre Fischer     }
645b9e67834SAndre Fischer }
646b9e67834SAndre Fischer 
647b9e67834SAndre Fischer 
648b9e67834SAndre Fischer 
649b9e67834SAndre Fischer 
650b9e67834SAndre Fischer void SAL_CALL Theme::addVetoableChangeListener(
651b9e67834SAndre Fischer     const ::rtl::OUString& rsPropertyName,
652b9e67834SAndre Fischer     const cssu::Reference<css::beans::XVetoableChangeListener>& rxListener)
653b9e67834SAndre Fischer     throw(css::beans::UnknownPropertyException,
654b9e67834SAndre Fischer         css::lang::WrappedTargetException,
655b9e67834SAndre Fischer         cssu::RuntimeException)
656b9e67834SAndre Fischer {
657b9e67834SAndre Fischer     ThemeItem eItem (__AnyItem);
658b9e67834SAndre Fischer     if (rsPropertyName.getLength() > 0)
659b9e67834SAndre Fischer     {
660b9e67834SAndre Fischer         PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
661b9e67834SAndre Fischer         if (iId == maPropertyNameToIdMap.end())
662b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
663b9e67834SAndre Fischer 
664b9e67834SAndre Fischer         const PropertyType eType (GetPropertyType(iId->second));
665b9e67834SAndre Fischer         if (eType == PT_Invalid)
666b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
667b9e67834SAndre Fischer 
668b9e67834SAndre Fischer         eItem = iId->second;
669b9e67834SAndre Fischer     }
670b9e67834SAndre Fischer     VetoableListenerContainer* pListeners = GetVetoableListeners(eItem, true);
671b9e67834SAndre Fischer     if (pListeners != NULL)
672b9e67834SAndre Fischer         pListeners->push_back(rxListener);
673b9e67834SAndre Fischer }
674b9e67834SAndre Fischer 
675b9e67834SAndre Fischer 
676b9e67834SAndre Fischer 
677b9e67834SAndre Fischer 
678b9e67834SAndre Fischer void SAL_CALL Theme::removeVetoableChangeListener(
679b9e67834SAndre Fischer     const ::rtl::OUString& rsPropertyName,
680b9e67834SAndre Fischer     const cssu::Reference<css::beans::XVetoableChangeListener>& rxListener)
681b9e67834SAndre Fischer     throw(css::beans::UnknownPropertyException,
682b9e67834SAndre Fischer         css::lang::WrappedTargetException,
683b9e67834SAndre Fischer         cssu::RuntimeException)
684b9e67834SAndre Fischer {
685b9e67834SAndre Fischer     ThemeItem eItem (__AnyItem);
686b9e67834SAndre Fischer     if (rsPropertyName.getLength() > 0)
687b9e67834SAndre Fischer     {
688b9e67834SAndre Fischer         PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
689b9e67834SAndre Fischer         if (iId == maPropertyNameToIdMap.end())
690b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
691b9e67834SAndre Fischer 
692b9e67834SAndre Fischer         const PropertyType eType (GetPropertyType(iId->second));
693b9e67834SAndre Fischer         if (eType == PT_Invalid)
694b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
695b9e67834SAndre Fischer 
696b9e67834SAndre Fischer         eItem = iId->second;
697b9e67834SAndre Fischer     }
698b9e67834SAndre Fischer     VetoableListenerContainer* pContainer = GetVetoableListeners(eItem, false);
699b9e67834SAndre Fischer     if (pContainer != NULL)
700b9e67834SAndre Fischer     {
701b9e67834SAndre Fischer         VetoableListenerContainer::iterator iListener (::std::find(pContainer->begin(), pContainer->end(), rxListener));
702b9e67834SAndre Fischer         if (iListener != pContainer->end())
703b9e67834SAndre Fischer         {
704b9e67834SAndre Fischer             pContainer->erase(iListener);
705b9e67834SAndre Fischer             // Remove container when empty.
706b9e67834SAndre Fischer             if (pContainer->empty())
707b9e67834SAndre Fischer                 maVetoableListeners.erase(eItem);
708b9e67834SAndre Fischer         }
709b9e67834SAndre Fischer     }
710b9e67834SAndre Fischer }
711b9e67834SAndre Fischer 
712b9e67834SAndre Fischer 
713b9e67834SAndre Fischer 
714b9e67834SAndre Fischer 
71595a18594SAndre Fischer cssu::Sequence<css::beans::Property> SAL_CALL Theme::getProperties (void)
71695a18594SAndre Fischer     throw(cssu::RuntimeException)
71795a18594SAndre Fischer {
71895a18594SAndre Fischer     ::std::vector<beans::Property> aProperties;
71995a18594SAndre Fischer 
72095a18594SAndre Fischer     for (sal_Int32 nItem(__Begin),nEnd(__End); nItem!=nEnd; ++nItem)
72195a18594SAndre Fischer     {
72295a18594SAndre Fischer         const ThemeItem eItem (static_cast<ThemeItem>(nItem));
72395a18594SAndre Fischer         const PropertyType eType (GetPropertyType(eItem));
72495a18594SAndre Fischer         if (eType == PT_Invalid)
72595a18594SAndre Fischer             continue;
72695a18594SAndre Fischer 
72795a18594SAndre Fischer         const beans::Property aProperty(
72895a18594SAndre Fischer             maPropertyIdToNameMap[eItem],
72995a18594SAndre Fischer             eItem,
73095a18594SAndre Fischer             GetCppuType(eType),
73195a18594SAndre Fischer             0);
73295a18594SAndre Fischer         aProperties.push_back(aProperty);
73395a18594SAndre Fischer     }
73495a18594SAndre Fischer 
73595a18594SAndre Fischer     return cssu::Sequence<css::beans::Property>(
73695a18594SAndre Fischer         &aProperties.front(),
73795a18594SAndre Fischer         aProperties.size());
73895a18594SAndre Fischer }
73995a18594SAndre Fischer 
74095a18594SAndre Fischer 
74195a18594SAndre Fischer 
74295a18594SAndre Fischer 
74395a18594SAndre Fischer beans::Property SAL_CALL Theme::getPropertyByName (const ::rtl::OUString& rsPropertyName)
74495a18594SAndre Fischer     throw(css::beans::UnknownPropertyException,
74595a18594SAndre Fischer         cssu::RuntimeException)
74695a18594SAndre Fischer {
74795a18594SAndre Fischer     PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
74895a18594SAndre Fischer     if (iId == maPropertyNameToIdMap.end())
74995a18594SAndre Fischer         throw beans::UnknownPropertyException();
75095a18594SAndre Fischer 
75195a18594SAndre Fischer     const PropertyType eType (GetPropertyType(iId->second));
75295a18594SAndre Fischer     if (eType == PT_Invalid)
75395a18594SAndre Fischer         throw beans::UnknownPropertyException();
75495a18594SAndre Fischer 
75595a18594SAndre Fischer     const ThemeItem eItem (iId->second);
75695a18594SAndre Fischer 
75795a18594SAndre Fischer     return beans::Property(
75895a18594SAndre Fischer         rsPropertyName,
75995a18594SAndre Fischer         eItem,
76095a18594SAndre Fischer         GetCppuType(eType),
76195a18594SAndre Fischer         0);
76295a18594SAndre Fischer }
76395a18594SAndre Fischer 
76495a18594SAndre Fischer 
76595a18594SAndre Fischer 
76695a18594SAndre Fischer 
76795a18594SAndre Fischer sal_Bool SAL_CALL Theme::hasPropertyByName (const ::rtl::OUString& rsPropertyName)
76895a18594SAndre Fischer     throw(cssu::RuntimeException)
76995a18594SAndre Fischer {
77095a18594SAndre Fischer     PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
77195a18594SAndre Fischer     if (iId == maPropertyNameToIdMap.end())
77295a18594SAndre Fischer         return sal_False;
77395a18594SAndre Fischer 
77495a18594SAndre Fischer     const PropertyType eType (GetPropertyType(iId->second));
77595a18594SAndre Fischer     if (eType == PT_Invalid)
77695a18594SAndre Fischer         return sal_False;
77795a18594SAndre Fischer 
77895a18594SAndre Fischer     return sal_True;
77995a18594SAndre Fischer }
78095a18594SAndre Fischer 
78195a18594SAndre Fischer 
78295a18594SAndre Fischer 
78395a18594SAndre Fischer 
784b9e67834SAndre Fischer void Theme::SetupPropertyMaps (void)
785b9e67834SAndre Fischer {
78695a18594SAndre Fischer     maPropertyIdToNameMap.resize(__Post_Rect);
787b9e67834SAndre Fischer     maImages.resize(__Image_Color - __Pre_Image - 1);
788b9e67834SAndre Fischer     maColors.resize(__Color_Paint - __Image_Color - 1);
789b9e67834SAndre Fischer     maPaints.resize(__Paint_Int - __Color_Paint - 1);
790b9e67834SAndre Fischer     maIntegers.resize(__Int_Bool - __Paint_Int - 1);
79195a18594SAndre Fischer     maBooleans.resize(__Bool_Rect - __Int_Bool - 1);
79295a18594SAndre Fischer     maRectangles.resize(__Post_Rect - __Bool_Rect - 1);
793b9e67834SAndre Fischer 
794b9e67834SAndre Fischer     #define AddEntry(e) maPropertyNameToIdMap[A2S(#e)]=e; maPropertyIdToNameMap[e]=A2S(#e)
79595a18594SAndre Fischer 
796b9e67834SAndre Fischer     AddEntry(Image_Grip);
797b9e67834SAndre Fischer     AddEntry(Image_Expand);
798b9e67834SAndre Fischer     AddEntry(Image_Collapse);
7997a32b0c8SAndre Fischer     AddEntry(Image_TabBarMenu);
8007a32b0c8SAndre Fischer     AddEntry(Image_PanelMenu);
80195a18594SAndre Fischer     AddEntry(Image_ToolBoxItemSeparator);
8027a32b0c8SAndre Fischer     AddEntry(Image_Closer);
803b9e67834SAndre Fischer 
804b9e67834SAndre Fischer     AddEntry(Color_DeckTitleFont);
805b9e67834SAndre Fischer     AddEntry(Color_PanelTitleFont);
806b9e67834SAndre Fischer     AddEntry(Color_TabMenuSeparator);
807b9e67834SAndre Fischer     AddEntry(Color_TabItemBorder);
8088dcb2a10SAndre Fischer     AddEntry(Color_DropDownBorder);
809*5f1c83ffSOliver-Rainer Wittmann     AddEntry(Color_Highlight);
810*5f1c83ffSOliver-Rainer Wittmann     AddEntry(Color_HighlightText);
811b9e67834SAndre Fischer 
812b9e67834SAndre Fischer     AddEntry(Paint_DeckBackground);
813b9e67834SAndre Fischer     AddEntry(Paint_DeckTitleBarBackground);
814b9e67834SAndre Fischer     AddEntry(Paint_PanelBackground);
815b9e67834SAndre Fischer     AddEntry(Paint_PanelTitleBarBackground);
816b9e67834SAndre Fischer     AddEntry(Paint_TabBarBackground);
81795a18594SAndre Fischer     AddEntry(Paint_TabItemBackgroundNormal);
81895a18594SAndre Fischer     AddEntry(Paint_TabItemBackgroundHighlight);
819b9e67834SAndre Fischer     AddEntry(Paint_HorizontalBorder);
820b9e67834SAndre Fischer     AddEntry(Paint_VerticalBorder);
82195a18594SAndre Fischer     AddEntry(Paint_ToolBoxBackground);
82295a18594SAndre Fischer     AddEntry(Paint_ToolBoxBorderTopLeft);
82395a18594SAndre Fischer     AddEntry(Paint_ToolBoxBorderCenterCorners);
82495a18594SAndre Fischer     AddEntry(Paint_ToolBoxBorderBottomRight);
8258dcb2a10SAndre Fischer     AddEntry(Paint_DropDownBackground);
826b9e67834SAndre Fischer 
827b9e67834SAndre Fischer     AddEntry(Int_DeckTitleBarHeight);
828b9e67834SAndre Fischer     AddEntry(Int_DeckBorderSize);
829b9e67834SAndre Fischer     AddEntry(Int_DeckSeparatorHeight);
830b9e67834SAndre Fischer     AddEntry(Int_PanelTitleBarHeight);
831b9e67834SAndre Fischer     AddEntry(Int_TabMenuPadding);
832b9e67834SAndre Fischer     AddEntry(Int_TabMenuSeparatorPadding);
833b9e67834SAndre Fischer     AddEntry(Int_TabItemWidth);
834b9e67834SAndre Fischer     AddEntry(Int_TabItemHeight);
835b9e67834SAndre Fischer     AddEntry(Int_DeckLeftPadding);
836b9e67834SAndre Fischer     AddEntry(Int_DeckTopPadding);
837b9e67834SAndre Fischer     AddEntry(Int_DeckRightPadding);
838b9e67834SAndre Fischer     AddEntry(Int_DeckBottomPadding);
839b9e67834SAndre Fischer     AddEntry(Int_TabBarLeftPadding);
840b9e67834SAndre Fischer     AddEntry(Int_TabBarTopPadding);
841b9e67834SAndre Fischer     AddEntry(Int_TabBarRightPadding);
842b9e67834SAndre Fischer     AddEntry(Int_TabBarBottomPadding);
843b9e67834SAndre Fischer 
844b9e67834SAndre Fischer     AddEntry(Bool_UseSymphonyIcons);
84595a18594SAndre Fischer     AddEntry(Bool_UseSystemColors);
84695a18594SAndre Fischer     AddEntry(Bool_UseToolBoxItemSeparator);
84795a18594SAndre Fischer     AddEntry(Bool_IsHighContrastModeActive);
84895a18594SAndre Fischer 
84995a18594SAndre Fischer     AddEntry(Rect_ToolBoxPadding);
85095a18594SAndre Fischer     AddEntry(Rect_ToolBoxBorder);
85195a18594SAndre Fischer 
852b9e67834SAndre Fischer     #undef AddEntry
853b9e67834SAndre Fischer 
854b9e67834SAndre Fischer     maRawValues.resize(maPropertyIdToNameMap.size());
855b9e67834SAndre Fischer }
856b9e67834SAndre Fischer 
857b9e67834SAndre Fischer 
858b9e67834SAndre Fischer 
859b9e67834SAndre Fischer 
860b9e67834SAndre Fischer Theme::PropertyType Theme::GetPropertyType (const ThemeItem eItem)
861b9e67834SAndre Fischer {
862b9e67834SAndre Fischer     switch(eItem)
863b9e67834SAndre Fischer     {
864b9e67834SAndre Fischer         case Image_Grip:
865b9e67834SAndre Fischer         case Image_Expand:
866b9e67834SAndre Fischer         case Image_Collapse:
8677a32b0c8SAndre Fischer         case Image_TabBarMenu:
8687a32b0c8SAndre Fischer         case Image_PanelMenu:
86995a18594SAndre Fischer         case Image_ToolBoxItemSeparator:
8707a32b0c8SAndre Fischer         case Image_Closer:
871b9e67834SAndre Fischer             return PT_Image;
872b9e67834SAndre Fischer 
873b9e67834SAndre Fischer         case Color_DeckTitleFont:
874b9e67834SAndre Fischer         case Color_PanelTitleFont:
875b9e67834SAndre Fischer         case Color_TabMenuSeparator:
876b9e67834SAndre Fischer         case Color_TabItemBorder:
8778dcb2a10SAndre Fischer         case Color_DropDownBorder:
878*5f1c83ffSOliver-Rainer Wittmann         case Color_Highlight:
879*5f1c83ffSOliver-Rainer Wittmann         case Color_HighlightText:
880b9e67834SAndre Fischer             return PT_Color;
881b9e67834SAndre Fischer 
882b9e67834SAndre Fischer         case Paint_DeckBackground:
883b9e67834SAndre Fischer         case Paint_DeckTitleBarBackground:
884b9e67834SAndre Fischer         case Paint_PanelBackground:
885b9e67834SAndre Fischer         case Paint_PanelTitleBarBackground:
886b9e67834SAndre Fischer         case Paint_TabBarBackground:
88795a18594SAndre Fischer         case Paint_TabItemBackgroundNormal:
88895a18594SAndre Fischer         case Paint_TabItemBackgroundHighlight:
889b9e67834SAndre Fischer         case Paint_HorizontalBorder:
890b9e67834SAndre Fischer         case Paint_VerticalBorder:
89195a18594SAndre Fischer         case Paint_ToolBoxBackground:
89295a18594SAndre Fischer         case Paint_ToolBoxBorderTopLeft:
89395a18594SAndre Fischer         case Paint_ToolBoxBorderCenterCorners:
89495a18594SAndre Fischer         case Paint_ToolBoxBorderBottomRight:
8958dcb2a10SAndre Fischer         case Paint_DropDownBackground:
896b9e67834SAndre Fischer             return PT_Paint;
897b9e67834SAndre Fischer 
898b9e67834SAndre Fischer         case Int_DeckTitleBarHeight:
899b9e67834SAndre Fischer         case Int_DeckBorderSize:
900b9e67834SAndre Fischer         case Int_DeckSeparatorHeight:
901b9e67834SAndre Fischer         case Int_PanelTitleBarHeight:
902b9e67834SAndre Fischer         case Int_TabMenuPadding:
903b9e67834SAndre Fischer         case Int_TabMenuSeparatorPadding:
904b9e67834SAndre Fischer         case Int_TabItemWidth:
905b9e67834SAndre Fischer         case Int_TabItemHeight:
906b9e67834SAndre Fischer         case Int_DeckLeftPadding:
907b9e67834SAndre Fischer         case Int_DeckTopPadding:
908b9e67834SAndre Fischer         case Int_DeckRightPadding:
909b9e67834SAndre Fischer         case Int_DeckBottomPadding:
910b9e67834SAndre Fischer         case Int_TabBarLeftPadding:
911b9e67834SAndre Fischer         case Int_TabBarTopPadding:
912b9e67834SAndre Fischer         case Int_TabBarRightPadding:
913b9e67834SAndre Fischer         case Int_TabBarBottomPadding:
914b9e67834SAndre Fischer             return PT_Integer;
915b9e67834SAndre Fischer 
916b9e67834SAndre Fischer         case Bool_UseSymphonyIcons:
91795a18594SAndre Fischer         case Bool_UseSystemColors:
91895a18594SAndre Fischer         case Bool_UseToolBoxItemSeparator:
91995a18594SAndre Fischer         case Bool_IsHighContrastModeActive:
920b9e67834SAndre Fischer             return PT_Boolean;
921b9e67834SAndre Fischer 
92295a18594SAndre Fischer         case Rect_ToolBoxBorder:
92395a18594SAndre Fischer         case Rect_ToolBoxPadding:
92495a18594SAndre Fischer             return PT_Rectangle;
92595a18594SAndre Fischer 
926b9e67834SAndre Fischer         default:
927b9e67834SAndre Fischer             return PT_Invalid;
928b9e67834SAndre Fischer     }
929b9e67834SAndre Fischer }
930b9e67834SAndre Fischer 
931b9e67834SAndre Fischer 
932b9e67834SAndre Fischer 
933b9e67834SAndre Fischer 
93495a18594SAndre Fischer cssu::Type Theme::GetCppuType (const PropertyType eType)
93595a18594SAndre Fischer {
93695a18594SAndre Fischer     switch(eType)
93795a18594SAndre Fischer     {
93895a18594SAndre Fischer         case PT_Image:
93995a18594SAndre Fischer             return getCppuType((rtl::OUString*)NULL);
94095a18594SAndre Fischer 
94195a18594SAndre Fischer         case PT_Color:
94295a18594SAndre Fischer             return getCppuType((sal_uInt32*)NULL);
94395a18594SAndre Fischer 
94495a18594SAndre Fischer         case PT_Paint:
94595a18594SAndre Fischer             return getCppuVoidType();
94695a18594SAndre Fischer 
94795a18594SAndre Fischer         case PT_Integer:
94895a18594SAndre Fischer             return getCppuType((sal_Int32*)NULL);
94995a18594SAndre Fischer 
95095a18594SAndre Fischer         case PT_Boolean:
95195a18594SAndre Fischer             return getCppuType((sal_Bool*)NULL);
95295a18594SAndre Fischer 
95395a18594SAndre Fischer         case PT_Rectangle:
95495a18594SAndre Fischer             return getCppuType((awt::Rectangle*)NULL);
95595a18594SAndre Fischer 
95695a18594SAndre Fischer         case PT_Invalid:
95795a18594SAndre Fischer         default:
95895a18594SAndre Fischer             return getCppuVoidType();
95995a18594SAndre Fischer     }
96095a18594SAndre Fischer }
96195a18594SAndre Fischer 
96295a18594SAndre Fischer 
96395a18594SAndre Fischer 
96495a18594SAndre Fischer 
965b9e67834SAndre Fischer sal_Int32 Theme::GetIndex (const ThemeItem eItem, const PropertyType eType)
966b9e67834SAndre Fischer {
967b9e67834SAndre Fischer     switch(eType)
968b9e67834SAndre Fischer     {
969b9e67834SAndre Fischer         case PT_Image:
970b9e67834SAndre Fischer             return eItem - __Pre_Image-1;
971b9e67834SAndre Fischer         case PT_Color:
972b9e67834SAndre Fischer             return eItem - __Image_Color-1;
973b9e67834SAndre Fischer         case PT_Paint:
974b9e67834SAndre Fischer             return eItem - __Color_Paint-1;
975b9e67834SAndre Fischer         case PT_Integer:
976b9e67834SAndre Fischer             return eItem - __Paint_Int-1;
977b9e67834SAndre Fischer         case PT_Boolean:
978b9e67834SAndre Fischer             return eItem - __Int_Bool-1;
97995a18594SAndre Fischer         case PT_Rectangle:
98095a18594SAndre Fischer             return eItem - __Bool_Rect-1;
981b9e67834SAndre Fischer 
982b9e67834SAndre Fischer         default:
983b9e67834SAndre Fischer             OSL_ASSERT(false);
984b9e67834SAndre Fischer             return 0;
985b9e67834SAndre Fischer     }
986b9e67834SAndre Fischer }
987b9e67834SAndre Fischer 
988b9e67834SAndre Fischer 
989b9e67834SAndre Fischer 
990b9e67834SAndre Fischer 
991b9e67834SAndre Fischer Theme::VetoableListenerContainer* Theme::GetVetoableListeners (
992b9e67834SAndre Fischer     const ThemeItem eItem,
993b9e67834SAndre Fischer     const bool bCreate)
994b9e67834SAndre Fischer {
995b9e67834SAndre Fischer     VetoableListeners::iterator iContainer (maVetoableListeners.find(eItem));
996b9e67834SAndre Fischer     if (iContainer != maVetoableListeners.end())
997b9e67834SAndre Fischer         return &iContainer->second;
998b9e67834SAndre Fischer     else if (bCreate)
999b9e67834SAndre Fischer     {
1000b9e67834SAndre Fischer         maVetoableListeners[eItem] = VetoableListenerContainer();
1001b9e67834SAndre Fischer         return &maVetoableListeners[eItem];
1002b9e67834SAndre Fischer     }
1003b9e67834SAndre Fischer     else
1004b9e67834SAndre Fischer         return NULL;
1005b9e67834SAndre Fischer }
1006b9e67834SAndre Fischer 
1007b9e67834SAndre Fischer 
1008b9e67834SAndre Fischer 
1009b9e67834SAndre Fischer 
1010b9e67834SAndre Fischer Theme::ChangeListenerContainer* Theme::GetChangeListeners (
1011b9e67834SAndre Fischer     const ThemeItem eItem,
1012b9e67834SAndre Fischer     const bool bCreate)
1013b9e67834SAndre Fischer {
1014b9e67834SAndre Fischer     ChangeListeners::iterator iContainer (maChangeListeners.find(eItem));
1015b9e67834SAndre Fischer     if (iContainer != maChangeListeners.end())
1016b9e67834SAndre Fischer         return &iContainer->second;
1017b9e67834SAndre Fischer     else if (bCreate)
1018b9e67834SAndre Fischer     {
1019b9e67834SAndre Fischer         maChangeListeners[eItem] = ChangeListenerContainer();
1020b9e67834SAndre Fischer         return &maChangeListeners[eItem];
1021b9e67834SAndre Fischer     }
1022b9e67834SAndre Fischer     else
1023b9e67834SAndre Fischer         return NULL;
1024b9e67834SAndre Fischer }
1025b9e67834SAndre Fischer 
1026b9e67834SAndre Fischer 
1027b9e67834SAndre Fischer 
1028b9e67834SAndre Fischer 
1029b9e67834SAndre Fischer bool Theme::DoVetoableListenersVeto (
1030b9e67834SAndre Fischer     const VetoableListenerContainer* pListeners,
1031b9e67834SAndre Fischer     const beans::PropertyChangeEvent& rEvent) const
1032b9e67834SAndre Fischer {
1033b9e67834SAndre Fischer     if (pListeners == NULL)
1034b9e67834SAndre Fischer         return false;
1035b9e67834SAndre Fischer 
1036b9e67834SAndre Fischer     VetoableListenerContainer aListeners (*pListeners);
1037b9e67834SAndre Fischer     try
1038b9e67834SAndre Fischer     {
1039b9e67834SAndre Fischer         for (VetoableListenerContainer::const_iterator
1040b9e67834SAndre Fischer                  iListener(aListeners.begin()),
1041b9e67834SAndre Fischer                  iEnd(aListeners.end());
1042b9e67834SAndre Fischer              iListener!=iEnd;
1043b9e67834SAndre Fischer              ++iListener)
1044b9e67834SAndre Fischer         {
1045b9e67834SAndre Fischer             (*iListener)->vetoableChange(rEvent);
1046b9e67834SAndre Fischer         }
1047b9e67834SAndre Fischer     }
1048b9e67834SAndre Fischer     catch(const beans::PropertyVetoException&)
1049b9e67834SAndre Fischer     {
1050b9e67834SAndre Fischer         return true;
1051b9e67834SAndre Fischer     }
1052b9e67834SAndre Fischer     catch(const Exception&)
1053b9e67834SAndre Fischer     {
1054b9e67834SAndre Fischer         // Ignore any other errors (such as disposed listeners).
1055b9e67834SAndre Fischer     }
1056b9e67834SAndre Fischer     return false;
1057b9e67834SAndre Fischer }
1058b9e67834SAndre Fischer 
1059b9e67834SAndre Fischer 
1060b9e67834SAndre Fischer 
1061b9e67834SAndre Fischer 
1062b9e67834SAndre Fischer void Theme::BroadcastPropertyChange (
1063b9e67834SAndre Fischer     const ChangeListenerContainer* pListeners,
1064b9e67834SAndre Fischer     const beans::PropertyChangeEvent& rEvent) const
1065b9e67834SAndre Fischer {
1066b9e67834SAndre Fischer     if (pListeners == NULL)
1067b9e67834SAndre Fischer         return;
1068b9e67834SAndre Fischer 
1069b9e67834SAndre Fischer     const ChangeListenerContainer aListeners (*pListeners);
1070b9e67834SAndre Fischer     try
1071b9e67834SAndre Fischer     {
1072b9e67834SAndre Fischer         for (ChangeListenerContainer::const_iterator
1073b9e67834SAndre Fischer                  iListener(aListeners.begin()),
1074b9e67834SAndre Fischer                  iEnd(aListeners.end());
1075b9e67834SAndre Fischer              iListener!=iEnd;
1076b9e67834SAndre Fischer              ++iListener)
1077b9e67834SAndre Fischer         {
1078b9e67834SAndre Fischer             (*iListener)->propertyChange(rEvent);
1079b9e67834SAndre Fischer         }
1080b9e67834SAndre Fischer     }
1081b9e67834SAndre Fischer     catch(const Exception&)
1082b9e67834SAndre Fischer     {
1083b9e67834SAndre Fischer         // Ignore any errors (such as disposed listeners).
1084b9e67834SAndre Fischer     }
1085b9e67834SAndre Fischer }
1086b9e67834SAndre Fischer 
1087b9e67834SAndre Fischer 
1088b9e67834SAndre Fischer 
1089b9e67834SAndre Fischer 
1090b9e67834SAndre Fischer void Theme::ProcessNewValue (
1091b9e67834SAndre Fischer     const Any& rValue,
1092b9e67834SAndre Fischer     const ThemeItem eItem,
1093b9e67834SAndre Fischer     const PropertyType eType)
1094b9e67834SAndre Fischer {
1095b9e67834SAndre Fischer     const sal_Int32 nIndex (GetIndex (eItem, eType));
1096b9e67834SAndre Fischer     switch (eType)
1097b9e67834SAndre Fischer     {
1098b9e67834SAndre Fischer         case PT_Image:
1099b9e67834SAndre Fischer         {
1100b9e67834SAndre Fischer             ::rtl::OUString sURL;
1101b9e67834SAndre Fischer             if (rValue >>= sURL)
1102b9e67834SAndre Fischer             {
1103b9e67834SAndre Fischer                 maImages[nIndex] = Tools::GetImage(sURL, NULL);
1104b9e67834SAndre Fischer             }
1105b9e67834SAndre Fischer             break;
1106b9e67834SAndre Fischer         }
1107b9e67834SAndre Fischer         case PT_Color:
1108b9e67834SAndre Fischer         {
110995a18594SAndre Fischer             sal_Int32 nColorValue (0);
1110b9e67834SAndre Fischer             if (rValue >>= nColorValue)
1111b9e67834SAndre Fischer             {
1112b9e67834SAndre Fischer                 maColors[nIndex] = Color(nColorValue);
1113b9e67834SAndre Fischer             }
1114b9e67834SAndre Fischer             break;
1115b9e67834SAndre Fischer         }
1116b9e67834SAndre Fischer         case PT_Paint:
1117b9e67834SAndre Fischer         {
111895a18594SAndre Fischer             maPaints[nIndex] = Paint::Create(rValue);
1119b9e67834SAndre Fischer             break;
1120b9e67834SAndre Fischer         }
1121b9e67834SAndre Fischer         case PT_Integer:
1122b9e67834SAndre Fischer         {
112395a18594SAndre Fischer             sal_Int32 nValue (0);
1124b9e67834SAndre Fischer             if (rValue >>= nValue)
1125b9e67834SAndre Fischer             {
1126b9e67834SAndre Fischer                 maIntegers[nIndex] = nValue;
1127b9e67834SAndre Fischer             }
1128b9e67834SAndre Fischer             break;
1129b9e67834SAndre Fischer         }
1130b9e67834SAndre Fischer         case PT_Boolean:
1131b9e67834SAndre Fischer         {
113295a18594SAndre Fischer             sal_Bool nValue (0);
1133b9e67834SAndre Fischer             if (rValue >>= nValue)
1134b9e67834SAndre Fischer             {
1135b9e67834SAndre Fischer                 maBooleans[nIndex] = (nValue==sal_True);
113695a18594SAndre Fischer                 if (eItem == Bool_IsHighContrastModeActive)
113795a18594SAndre Fischer                 {
113895a18594SAndre Fischer                     mbIsHighContrastModeSetManually = true;
113995a18594SAndre Fischer                     mbIsHighContrastMode = maBooleans[nIndex];
114095a18594SAndre Fischer                     HandleDataChange();
114195a18594SAndre Fischer                 }
114295a18594SAndre Fischer                 else if (eItem == Bool_UseSystemColors)
114395a18594SAndre Fischer                 {
114495a18594SAndre Fischer                     HandleDataChange();
114595a18594SAndre Fischer                 }
114695a18594SAndre Fischer             }
114795a18594SAndre Fischer             break;
114895a18594SAndre Fischer         }
114995a18594SAndre Fischer         case PT_Rectangle:
115095a18594SAndre Fischer         {
115195a18594SAndre Fischer             awt::Rectangle aBox;
115295a18594SAndre Fischer             if (rValue >>= aBox)
115395a18594SAndre Fischer             {
115495a18594SAndre Fischer                 maRectangles[nIndex] = Rectangle(
115595a18594SAndre Fischer                     aBox.X,
115695a18594SAndre Fischer                     aBox.Y,
115795a18594SAndre Fischer                     aBox.Width,
115895a18594SAndre Fischer                     aBox.Height);
1159b9e67834SAndre Fischer             }
1160b9e67834SAndre Fischer             break;
1161b9e67834SAndre Fischer         }
1162b9e67834SAndre Fischer         case PT_Invalid:
1163b9e67834SAndre Fischer             OSL_ASSERT(eType != PT_Invalid);
1164b9e67834SAndre Fischer             throw RuntimeException();
1165b9e67834SAndre Fischer     }
1166b9e67834SAndre Fischer }
1167b9e67834SAndre Fischer 
1168b9e67834SAndre Fischer 
1169b9e67834SAndre Fischer 
1170ff12d537SAndre Fischer 
1171ff12d537SAndre Fischer } } // end of namespace sfx2::sidebar
1172