xref: /AOO41X/main/sfx2/source/sidebar/Theme.cxx (revision 6e6252f3befa05bc224ccca5b42586426e555523)
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();
108f120fe41SAndre Fischer     else
109f120fe41SAndre Fischer         return COL_WHITE;
110ff12d537SAndre Fischer }
111ff12d537SAndre Fischer 
112ff12d537SAndre Fischer 
113ff12d537SAndre Fischer 
114ff12d537SAndre Fischer 
115b9e67834SAndre Fischer const Paint& Theme::GetPaint (const ThemeItem eItem)
116ff12d537SAndre Fischer {
117b9e67834SAndre Fischer     const PropertyType eType (GetPropertyType(eItem));
118b9e67834SAndre Fischer     OSL_ASSERT(eType==PT_Paint);
119b9e67834SAndre Fischer     const sal_Int32 nIndex (GetIndex(eItem, eType));
120b9e67834SAndre Fischer     const Theme& rTheme (GetCurrentTheme());
121b9e67834SAndre Fischer     return rTheme.maPaints[nIndex];
122ff12d537SAndre Fischer }
123ff12d537SAndre Fischer 
124ff12d537SAndre Fischer 
125ff12d537SAndre Fischer 
126ff12d537SAndre Fischer 
1277a32b0c8SAndre Fischer const Wallpaper Theme::GetWallpaper (const ThemeItem eItem)
1287a32b0c8SAndre Fischer {
1297a32b0c8SAndre Fischer     return GetPaint(eItem).GetWallpaper();
1307a32b0c8SAndre Fischer }
1317a32b0c8SAndre Fischer 
1327a32b0c8SAndre Fischer 
1337a32b0c8SAndre Fischer 
1347a32b0c8SAndre Fischer 
135b9e67834SAndre Fischer sal_Int32 Theme::GetInteger (const ThemeItem eItem)
136ff12d537SAndre Fischer {
137b9e67834SAndre Fischer     const PropertyType eType (GetPropertyType(eItem));
138b9e67834SAndre Fischer     OSL_ASSERT(eType==PT_Integer);
139b9e67834SAndre Fischer     const sal_Int32 nIndex (GetIndex(eItem, eType));
140b9e67834SAndre Fischer     const Theme& rTheme (GetCurrentTheme());
141b9e67834SAndre Fischer     return rTheme.maIntegers[nIndex];
142ff12d537SAndre Fischer }
143ff12d537SAndre Fischer 
144ff12d537SAndre Fischer 
145ff12d537SAndre Fischer 
146ff12d537SAndre Fischer 
147b9e67834SAndre Fischer bool Theme::GetBoolean (const ThemeItem eItem)
148ff12d537SAndre Fischer {
149b9e67834SAndre Fischer     const PropertyType eType (GetPropertyType(eItem));
150b9e67834SAndre Fischer     OSL_ASSERT(eType==PT_Boolean);
151b9e67834SAndre Fischer     const sal_Int32 nIndex (GetIndex(eItem, eType));
152b9e67834SAndre Fischer     const Theme& rTheme (GetCurrentTheme());
153b9e67834SAndre Fischer     return rTheme.maBooleans[nIndex];
154ff12d537SAndre Fischer }
155ff12d537SAndre Fischer 
156ff12d537SAndre Fischer 
157ff12d537SAndre Fischer 
158ff12d537SAndre Fischer 
15995a18594SAndre Fischer Rectangle Theme::GetRectangle (const ThemeItem eItem)
16095a18594SAndre Fischer {
16195a18594SAndre Fischer     const PropertyType eType (GetPropertyType(eItem));
16295a18594SAndre Fischer     OSL_ASSERT(eType==PT_Rectangle);
16395a18594SAndre Fischer     const sal_Int32 nIndex (GetIndex(eItem, eType));
16495a18594SAndre Fischer     const Theme& rTheme (GetCurrentTheme());
16595a18594SAndre Fischer     return rTheme.maRectangles[nIndex];
16695a18594SAndre Fischer }
16795a18594SAndre Fischer 
16895a18594SAndre Fischer 
16995a18594SAndre Fischer 
17095a18594SAndre Fischer 
171ff12d537SAndre Fischer bool Theme::IsHighContrastMode (void)
172ff12d537SAndre Fischer {
173b9e67834SAndre Fischer     const Theme& rTheme (GetCurrentTheme());
174b9e67834SAndre Fischer     return rTheme.mbIsHighContrastMode;
175ff12d537SAndre Fischer }
176ff12d537SAndre Fischer 
177ff12d537SAndre Fischer 
178ff12d537SAndre Fischer 
179ff12d537SAndre Fischer 
180ff12d537SAndre Fischer void Theme::HandleDataChange (void)
181ff12d537SAndre Fischer {
18295a18594SAndre Fischer     Theme& rTheme (GetCurrentTheme());
18395a18594SAndre Fischer 
18495a18594SAndre Fischer     if ( ! rTheme.mbIsHighContrastModeSetManually)
18595a18594SAndre Fischer     {
18695a18594SAndre Fischer         // Do not modify mbIsHighContrastMode when it was manually set.
187b9e67834SAndre Fischer         GetCurrentTheme().mbIsHighContrastMode = Application::GetSettings().GetStyleSettings().GetHighContrastMode();
18895a18594SAndre Fischer         rTheme.maRawValues[Bool_IsHighContrastModeActive] = Any(GetCurrentTheme().mbIsHighContrastMode);
18995a18594SAndre Fischer     }
19095a18594SAndre Fischer 
19195a18594SAndre Fischer     GetCurrentTheme().UpdateTheme();
192ff12d537SAndre Fischer }
193ff12d537SAndre Fischer 
194ff12d537SAndre Fischer 
195ff12d537SAndre Fischer 
196ff12d537SAndre Fischer 
197b9e67834SAndre Fischer void Theme::InitializeTheme (void)
198ff12d537SAndre Fischer {
19995a18594SAndre Fischer     setPropertyValue(
20095a18594SAndre Fischer         maPropertyIdToNameMap[Bool_UseSymphonyIcons],
20195a18594SAndre Fischer         Any(true));
20295a18594SAndre Fischer     setPropertyValue(
20395a18594SAndre Fischer         maPropertyIdToNameMap[Bool_UseSystemColors],
20495a18594SAndre Fischer         Any(false));
20595a18594SAndre Fischer }
20695a18594SAndre Fischer 
20795a18594SAndre Fischer 
20895a18594SAndre Fischer 
20995a18594SAndre Fischer 
21095a18594SAndre Fischer void Theme::UpdateTheme (void)
21195a18594SAndre Fischer {
212ff12d537SAndre Fischer     SidebarResource aLocalResource;
213ff12d537SAndre Fischer 
214b9e67834SAndre Fischer     try
215b9e67834SAndre Fischer     {
21695a18594SAndre Fischer         const StyleSettings& rStyle (Application::GetSettings().GetStyleSettings());
21795a18594SAndre Fischer         const bool bUseSystemColors (GetBoolean(Bool_UseSystemColors));
21895a18594SAndre Fischer 
21995a18594SAndre Fischer #define Alternatives(n,hc,sys) (mbIsHighContrastMode ? hc : (bUseSystemColors ? sys : n))
22095a18594SAndre Fischer 
2218dcb2a10SAndre Fischer         const Color aBaseBackgroundColor (rStyle.GetDialogColor());
2228dcb2a10SAndre Fischer         Color aBorderColor (aBaseBackgroundColor);
2238dcb2a10SAndre Fischer         aBorderColor.DecreaseLuminance(15);
2248dcb2a10SAndre Fischer         Color aSecondColor (aBaseBackgroundColor);
2258dcb2a10SAndre Fischer         aSecondColor.DecreaseLuminance(15);
2268dcb2a10SAndre Fischer 
227b9e67834SAndre Fischer         setPropertyValue(
228b9e67834SAndre Fischer             maPropertyIdToNameMap[Paint_DeckBackground],
2298dcb2a10SAndre Fischer             Any(sal_Int32(rStyle.GetMenuColor().GetRGBColor())));
23095a18594SAndre Fischer 
231b9e67834SAndre Fischer         setPropertyValue(
232b9e67834SAndre Fischer             maPropertyIdToNameMap[Paint_DeckTitleBarBackground],
2338dcb2a10SAndre Fischer             Any(sal_Int32(aBaseBackgroundColor.GetRGBColor())));
234b9e67834SAndre Fischer         setPropertyValue(
235b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_DeckLeftPadding],
236b9e67834SAndre Fischer             Any(sal_Int32(2)));
237b9e67834SAndre Fischer         setPropertyValue(
238b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_DeckTopPadding],
239b9e67834SAndre Fischer             Any(sal_Int32(2)));
240b9e67834SAndre Fischer         setPropertyValue(
241b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_DeckRightPadding],
242b9e67834SAndre Fischer             Any(sal_Int32(2)));
243b9e67834SAndre Fischer         setPropertyValue(
244b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_DeckBottomPadding],
245b9e67834SAndre Fischer             Any(sal_Int32(2)));
246b9e67834SAndre Fischer         setPropertyValue(
247b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_DeckBorderSize],
248b9e67834SAndre Fischer             Any(sal_Int32(1)));
249b9e67834SAndre Fischer         setPropertyValue(
250b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_DeckSeparatorHeight],
251b9e67834SAndre Fischer             Any(sal_Int32(1)));
252b9e67834SAndre Fischer         setPropertyValue(
253b9e67834SAndre Fischer             maPropertyIdToNameMap[Color_DeckTitleFont],
2548dcb2a10SAndre Fischer             Any(sal_Int32(rStyle.GetFontColor().GetRGBColor())));
255b9e67834SAndre Fischer         setPropertyValue(
256b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_DeckTitleBarHeight],
25795a18594SAndre Fischer             Any(sal_Int32(Alternatives(
25895a18594SAndre Fischer                         26,
25995a18594SAndre Fischer                         26,
26095a18594SAndre Fischer                         rStyle.GetFloatTitleHeight()))));
261b9e67834SAndre Fischer         setPropertyValue(
262b9e67834SAndre Fischer             maPropertyIdToNameMap[Paint_PanelBackground],
2638dcb2a10SAndre Fischer             Any(sal_Int32(rStyle.GetDialogColor().GetRGBColor())));
2648dcb2a10SAndre Fischer         //            Any(sal_Int32(mbIsHighContrastMode ? 0x000000 :
2658dcb2a10SAndre Fischer         //            0xffffff)));
2668dcb2a10SAndre Fischer 
267b9e67834SAndre Fischer         setPropertyValue(
268b9e67834SAndre Fischer             maPropertyIdToNameMap[Paint_PanelTitleBarBackground],
2698dcb2a10SAndre Fischer             Any(Tools::VclToAwtGradient(Gradient(
2708dcb2a10SAndre Fischer                         GRADIENT_LINEAR,
2718dcb2a10SAndre Fischer                         aSecondColor.GetRGBColor(),
2728dcb2a10SAndre Fischer                         aBaseBackgroundColor.GetRGBColor()
2738dcb2a10SAndre Fischer                         ))));
274b9e67834SAndre Fischer         setPropertyValue(
275b9e67834SAndre Fischer             maPropertyIdToNameMap[Color_PanelTitleFont],
276b9e67834SAndre Fischer             Any(sal_Int32(mbIsHighContrastMode ? 0x00ff00 : 0x262626)));
277b9e67834SAndre Fischer         setPropertyValue(
278b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_PanelTitleBarHeight],
27995a18594SAndre Fischer             Any(sal_Int32(Alternatives(
28095a18594SAndre Fischer                         26,
28195a18594SAndre Fischer                         26,
28295a18594SAndre Fischer                         rStyle.GetTitleHeight()))));
283b9e67834SAndre Fischer         setPropertyValue(
284b9e67834SAndre Fischer             maPropertyIdToNameMap[Paint_TabBarBackground],
2858dcb2a10SAndre Fischer             Any(sal_Int32(aBaseBackgroundColor.GetRGBColor())));
286b9e67834SAndre Fischer         setPropertyValue(
287b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_TabBarLeftPadding],
288b9e67834SAndre Fischer             Any(sal_Int32(2)));
289b9e67834SAndre Fischer         setPropertyValue(
290b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_TabBarTopPadding],
291b9e67834SAndre Fischer             Any(sal_Int32(2)));
292b9e67834SAndre Fischer         setPropertyValue(
293b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_TabBarRightPadding],
294b9e67834SAndre Fischer             Any(sal_Int32(2)));
295b9e67834SAndre Fischer         setPropertyValue(
296b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_TabBarBottomPadding],
297b9e67834SAndre Fischer             Any(sal_Int32(2)));
298ff12d537SAndre Fischer 
299b9e67834SAndre Fischer         setPropertyValue(
300b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_TabMenuPadding],
301b9e67834SAndre Fischer             Any(sal_Int32(6)));
302b9e67834SAndre Fischer         setPropertyValue(
303b9e67834SAndre Fischer             maPropertyIdToNameMap[Color_TabMenuSeparator],
3048dcb2a10SAndre Fischer             Any(sal_Int32(aBorderColor.GetRGBColor())));
305b9e67834SAndre Fischer         setPropertyValue(
306b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_TabMenuSeparatorPadding],
307b9e67834SAndre Fischer             Any(sal_Int32(7)));
308ff12d537SAndre Fischer 
309b9e67834SAndre Fischer         setPropertyValue(
310b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_TabItemWidth],
311b9e67834SAndre Fischer             Any(sal_Int32(32)));
312b9e67834SAndre Fischer         setPropertyValue(
313b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_TabItemHeight],
314b9e67834SAndre Fischer             Any(sal_Int32(32)));
315b9e67834SAndre Fischer         setPropertyValue(
316b9e67834SAndre Fischer             maPropertyIdToNameMap[Color_TabItemBorder],
3178dcb2a10SAndre Fischer             Any(sal_Int32(rStyle.GetActiveBorderColor().GetRGBColor())));
3188dcb2a10SAndre Fischer         //                    mbIsHighContrastMode ? 0x00ff00 : 0xbfbfbf)));
3198dcb2a10SAndre Fischer 
3208dcb2a10SAndre Fischer         setPropertyValue(
3218dcb2a10SAndre Fischer             maPropertyIdToNameMap[Paint_DropDownBackground],
3228dcb2a10SAndre Fischer             Any(sal_Int32(aBaseBackgroundColor.GetRGBColor())));
3238dcb2a10SAndre Fischer         setPropertyValue(
3248dcb2a10SAndre Fischer             maPropertyIdToNameMap[Color_DropDownBorder],
3258dcb2a10SAndre Fischer             Any(sal_Int32(rStyle.GetActiveBorderColor().GetRGBColor())));
3268dcb2a10SAndre Fischer 
327b9e67834SAndre Fischer         setPropertyValue(
3285f1c83ffSOliver-Rainer Wittmann             maPropertyIdToNameMap[Color_Highlight],
3295f1c83ffSOliver-Rainer Wittmann             Any(sal_Int32(rStyle.GetHighlightColor().GetRGBColor())));
3305f1c83ffSOliver-Rainer Wittmann         setPropertyValue(
3315f1c83ffSOliver-Rainer Wittmann             maPropertyIdToNameMap[Color_HighlightText],
3325f1c83ffSOliver-Rainer Wittmann             Any(sal_Int32(rStyle.GetHighlightTextColor().GetRGBColor())));
3335f1c83ffSOliver-Rainer Wittmann 
3345f1c83ffSOliver-Rainer Wittmann         setPropertyValue(
33595a18594SAndre Fischer             maPropertyIdToNameMap[Paint_TabItemBackgroundNormal],
33695a18594SAndre Fischer             Any());
33795a18594SAndre Fischer         setPropertyValue(
33895a18594SAndre Fischer             maPropertyIdToNameMap[Paint_TabItemBackgroundHighlight],
3398dcb2a10SAndre Fischer             Any(sal_Int32(rStyle.GetActiveTabColor().GetRGBColor())));
3408dcb2a10SAndre Fischer         //                    mbIsHighContrastMode ? 0x000000 : 0x00ffffff)));
341ff12d537SAndre Fischer 
342b9e67834SAndre Fischer         setPropertyValue(
343b9e67834SAndre Fischer             maPropertyIdToNameMap[Paint_HorizontalBorder],
3448dcb2a10SAndre Fischer             Any(sal_Int32(aBorderColor.GetRGBColor())));
3458dcb2a10SAndre Fischer         //                    mbIsHighContrastMode ? 0x00ff00 :  0xe4e4e4)));
346b9e67834SAndre Fischer         setPropertyValue(
347b9e67834SAndre Fischer             maPropertyIdToNameMap[Paint_VerticalBorder],
3488dcb2a10SAndre Fischer             Any(sal_Int32(aBorderColor.GetRGBColor())));
3498dcb2a10SAndre Fischer         //                    mbIsHighContrastMode ? 0x00ff00 : 0xe4e4e4)));
350ff12d537SAndre Fischer 
351b9e67834SAndre Fischer         setPropertyValue(
352b9e67834SAndre Fischer             maPropertyIdToNameMap[Image_Grip],
353b9e67834SAndre Fischer             Any(
354b9e67834SAndre Fischer                 mbIsHighContrastMode
355b9e67834SAndre Fischer                     ? A2S("private:graphicrepository/sfx2/res/grip_hc.png")
356b9e67834SAndre Fischer                     : A2S("private:graphicrepository/sfx2/res/grip.png")));
357b9e67834SAndre Fischer         setPropertyValue(
358b9e67834SAndre Fischer             maPropertyIdToNameMap[Image_Expand],
359b9e67834SAndre Fischer             Any(
360b9e67834SAndre Fischer                 mbIsHighContrastMode
361*6e6252f3SAndre Fischer                     ? A2S("private:graphicrepository/res/plus_sch.png")
362*6e6252f3SAndre Fischer                     : A2S("private:graphicrepository/res/plus.png")));
363b9e67834SAndre Fischer         setPropertyValue(
364b9e67834SAndre Fischer             maPropertyIdToNameMap[Image_Collapse],
365b9e67834SAndre Fischer             Any(
366b9e67834SAndre Fischer                 mbIsHighContrastMode
367*6e6252f3SAndre Fischer                     ? A2S("private:graphicrepository/res/minus_sch.png")
368*6e6252f3SAndre Fischer                     : A2S("private:graphicrepository/res/minus.png")));
369b9e67834SAndre Fischer         setPropertyValue(
3707a32b0c8SAndre Fischer             maPropertyIdToNameMap[Image_TabBarMenu],
371b9e67834SAndre Fischer             Any(
372b9e67834SAndre Fischer                 mbIsHighContrastMode
37395a18594SAndre Fischer                     ? A2S("private:graphicrepository/sfx2/res/menu_hc.png")
374*6e6252f3SAndre Fischer                     : A2S("private:graphicrepository/sfx2/res/symphony/open_more.png")));
375b9e67834SAndre Fischer         setPropertyValue(
3767a32b0c8SAndre Fischer             maPropertyIdToNameMap[Image_PanelMenu],
3777a32b0c8SAndre Fischer             Any(
3787a32b0c8SAndre Fischer                 mbIsHighContrastMode
379*6e6252f3SAndre Fischer                     ? A2S("private:graphicrepository/sfx2/res/symphony/morebutton.png")
380*6e6252f3SAndre Fischer                     : A2S("private:graphicrepository/sfx2/res/symphony/morebutton_h.png")));
3817a32b0c8SAndre Fischer         setPropertyValue(
3827a32b0c8SAndre Fischer             maPropertyIdToNameMap[Image_Closer],
3837a32b0c8SAndre Fischer             Any(A2S("private:graphicrepository/sfx2/res/closedoc.png")));
3847a32b0c8SAndre Fischer         setPropertyValue(
38595a18594SAndre Fischer             maPropertyIdToNameMap[Image_ToolBoxItemSeparator],
38695a18594SAndre Fischer             Any(
38795a18594SAndre Fischer                 A2S("private:graphicrepository/sfx2/res/separator.png")));
38895a18594SAndre Fischer 
38995a18594SAndre Fischer         // ToolBox
3908dcb2a10SAndre Fischer 
3918dcb2a10SAndre Fischer         /*
3928dcb2a10SAndre Fischer         // Separator style
3938dcb2a10SAndre Fischer         setPropertyValue(
3948dcb2a10SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBackground],
3958dcb2a10SAndre Fischer             Any(sal_Int32(rStyle.GetMenuColor().GetRGBColor())));
3968dcb2a10SAndre Fischer         setPropertyValue(
3978dcb2a10SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBorderTopLeft],
3988dcb2a10SAndre Fischer             Any());
3998dcb2a10SAndre Fischer         setPropertyValue(
4008dcb2a10SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBorderCenterCorners],
4018dcb2a10SAndre Fischer             Any());
4028dcb2a10SAndre Fischer         setPropertyValue(
4038dcb2a10SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBorderBottomRight],
4048dcb2a10SAndre Fischer             Any());
4058dcb2a10SAndre Fischer         setPropertyValue(
4068dcb2a10SAndre Fischer             maPropertyIdToNameMap[Rect_ToolBoxPadding],
4078dcb2a10SAndre Fischer             Any(awt::Rectangle(2,2,2,2)));
4088dcb2a10SAndre Fischer         setPropertyValue(
4098dcb2a10SAndre Fischer             maPropertyIdToNameMap[Rect_ToolBoxBorder],
4108dcb2a10SAndre Fischer             Any(awt::Rectangle(0,0,0,0)));
4118dcb2a10SAndre Fischer         setPropertyValue(
4128dcb2a10SAndre Fischer             maPropertyIdToNameMap[Bool_UseToolBoxItemSeparator],
4138dcb2a10SAndre Fischer             Any(true));
4148dcb2a10SAndre Fischer 
4158dcb2a10SAndre Fischer         */
4168dcb2a10SAndre Fischer 
4178dcb2a10SAndre Fischer         // Gradient style
41895a18594SAndre Fischer         setPropertyValue(
41995a18594SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBackground],
42095a18594SAndre Fischer             Any(Tools::VclToAwtGradient(Gradient(
42195a18594SAndre Fischer                         GRADIENT_LINEAR,
42295a18594SAndre Fischer                         Color(0xf2f2f2),
42395a18594SAndre Fischer                         Color(0xfefefe)
42495a18594SAndre Fischer                         ))));
42595a18594SAndre Fischer         setPropertyValue(
42695a18594SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBorderTopLeft],
42795a18594SAndre Fischer             mbIsHighContrastMode
42895a18594SAndre Fischer                 ? Any(util::Color(sal_uInt32(0x00ff00)))
42995a18594SAndre Fischer                 : Any(util::Color(sal_uInt32(0xf2f2f2))));
43095a18594SAndre Fischer         setPropertyValue(
43195a18594SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBorderCenterCorners],
43295a18594SAndre Fischer             mbIsHighContrastMode
43395a18594SAndre Fischer                 ? Any(util::Color(sal_uInt32(0x00ff00)))
43495a18594SAndre Fischer                 : Any(util::Color(sal_uInt32(0xf2f2f2))));
43595a18594SAndre Fischer         setPropertyValue(
43695a18594SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBorderBottomRight],
43795a18594SAndre Fischer             mbIsHighContrastMode
43895a18594SAndre Fischer                 ? Any(util::Color(sal_uInt32(0x00ff00)))
43995a18594SAndre Fischer                 : Any(util::Color(sal_uInt32(0xf2f2f2))));
44095a18594SAndre Fischer         setPropertyValue(
44195a18594SAndre Fischer             maPropertyIdToNameMap[Rect_ToolBoxPadding],
44295a18594SAndre Fischer             Any(awt::Rectangle(2,2,2,2)));
44395a18594SAndre Fischer         setPropertyValue(
44495a18594SAndre Fischer             maPropertyIdToNameMap[Rect_ToolBoxBorder],
44595a18594SAndre Fischer             Any(awt::Rectangle(1,1,1,1)));
44695a18594SAndre Fischer         setPropertyValue(
44795a18594SAndre Fischer             maPropertyIdToNameMap[Bool_UseToolBoxItemSeparator],
44895a18594SAndre Fischer             Any(false));
449ff12d537SAndre Fischer     }
45095a18594SAndre Fischer     catch(beans::UnknownPropertyException& rException)
451b9e67834SAndre Fischer     {
45295a18594SAndre Fischer         OSL_TRACE("unknown property: %s",
45395a18594SAndre Fischer             OUStringToOString(
45495a18594SAndre Fischer                 rException.Message,
45595a18594SAndre Fischer                 RTL_TEXTENCODING_ASCII_US).getStr());
456b9e67834SAndre Fischer         OSL_ASSERT(false);
457b9e67834SAndre Fischer     }
458b9e67834SAndre Fischer }
459b9e67834SAndre Fischer 
460b9e67834SAndre Fischer 
461b9e67834SAndre Fischer 
462b9e67834SAndre Fischer 
463b9e67834SAndre Fischer void SAL_CALL Theme::disposing (void)
464b9e67834SAndre Fischer {
465b9e67834SAndre Fischer     ChangeListeners aListeners;
466b9e67834SAndre Fischer     maChangeListeners.swap(aListeners);
467b9e67834SAndre Fischer 
468b9e67834SAndre Fischer     const lang::EventObject aEvent (static_cast<XWeak*>(this));
469b9e67834SAndre Fischer 
470b9e67834SAndre Fischer     for (ChangeListeners::const_iterator
471b9e67834SAndre Fischer              iContainer(maChangeListeners.begin()),
472b9e67834SAndre Fischer              iContainerEnd(maChangeListeners.end());
473b9e67834SAndre Fischer          iContainerEnd!=iContainerEnd;
474b9e67834SAndre Fischer          ++iContainerEnd)
475b9e67834SAndre Fischer     {
476b9e67834SAndre Fischer         for (ChangeListenerContainer::const_iterator
477b9e67834SAndre Fischer                  iListener(iContainer->second.begin()),
478b9e67834SAndre Fischer                  iEnd(iContainer->second.end());
479b9e67834SAndre Fischer              iListener!=iEnd;
480b9e67834SAndre Fischer              ++iListener)
481b9e67834SAndre Fischer         {
482b9e67834SAndre Fischer             try
483b9e67834SAndre Fischer             {
484b9e67834SAndre Fischer                 (*iListener)->disposing(aEvent);
485b9e67834SAndre Fischer             }
486b9e67834SAndre Fischer             catch(const Exception&)
487b9e67834SAndre Fischer             {
488b9e67834SAndre Fischer             }
489b9e67834SAndre Fischer         }
490b9e67834SAndre Fischer     }
491b9e67834SAndre Fischer }
492b9e67834SAndre Fischer 
493b9e67834SAndre Fischer 
494b9e67834SAndre Fischer 
495b9e67834SAndre Fischer 
496b9e67834SAndre Fischer Reference<beans::XPropertySet> Theme::GetPropertySet (void)
497b9e67834SAndre Fischer {
498b9e67834SAndre Fischer     return Reference<beans::XPropertySet>(static_cast<XWeak*>(&GetCurrentTheme()), UNO_QUERY);
499b9e67834SAndre Fischer }
500b9e67834SAndre Fischer 
501b9e67834SAndre Fischer 
502b9e67834SAndre Fischer 
503b9e67834SAndre Fischer 
504b9e67834SAndre Fischer Reference<beans::XPropertySetInfo> SAL_CALL Theme::getPropertySetInfo (void)
505b9e67834SAndre Fischer     throw(cssu::RuntimeException)
506b9e67834SAndre Fischer {
50795a18594SAndre Fischer     return Reference<beans::XPropertySetInfo>(this);
508b9e67834SAndre Fischer }
509b9e67834SAndre Fischer 
510b9e67834SAndre Fischer 
511b9e67834SAndre Fischer 
512b9e67834SAndre Fischer 
513b9e67834SAndre Fischer void SAL_CALL Theme::setPropertyValue (
514b9e67834SAndre Fischer     const ::rtl::OUString& rsPropertyName,
515b9e67834SAndre Fischer     const cssu::Any& rValue)
516b9e67834SAndre Fischer     throw(cssu::RuntimeException)
517b9e67834SAndre Fischer {
518b9e67834SAndre Fischer     PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
519b9e67834SAndre Fischer     if (iId == maPropertyNameToIdMap.end())
52095a18594SAndre Fischer         throw beans::UnknownPropertyException(rsPropertyName, NULL);
521b9e67834SAndre Fischer 
522b9e67834SAndre Fischer     const PropertyType eType (GetPropertyType(iId->second));
523b9e67834SAndre Fischer     if (eType == PT_Invalid)
52495a18594SAndre Fischer         throw beans::UnknownPropertyException(rsPropertyName, NULL);
525b9e67834SAndre Fischer 
526b9e67834SAndre Fischer     const ThemeItem eItem (iId->second);
527b9e67834SAndre Fischer 
528b9e67834SAndre Fischer     if (rValue == maRawValues[eItem])
529b9e67834SAndre Fischer     {
530b9e67834SAndre Fischer         // Value is not different from the one in the property
531b9e67834SAndre Fischer         // set => nothing to do.
532b9e67834SAndre Fischer         return;
533b9e67834SAndre Fischer     }
534b9e67834SAndre Fischer 
535b9e67834SAndre Fischer     const Any aOldValue (maRawValues[eItem]);
536b9e67834SAndre Fischer 
537b9e67834SAndre Fischer     const beans::PropertyChangeEvent aEvent(
538b9e67834SAndre Fischer         static_cast<XWeak*>(this),
539b9e67834SAndre Fischer         rsPropertyName,
540b9e67834SAndre Fischer         sal_False,
541b9e67834SAndre Fischer         eItem,
542b9e67834SAndre Fischer         aOldValue,
543b9e67834SAndre Fischer         rValue);
544b9e67834SAndre Fischer 
545b9e67834SAndre Fischer     if (DoVetoableListenersVeto(GetVetoableListeners(__AnyItem, false), aEvent))
546b9e67834SAndre Fischer         return;
547b9e67834SAndre Fischer     if (DoVetoableListenersVeto(GetVetoableListeners(eItem, false), aEvent))
548b9e67834SAndre Fischer         return;
549b9e67834SAndre Fischer 
550b9e67834SAndre Fischer     maRawValues[eItem] = rValue;
551b9e67834SAndre Fischer     ProcessNewValue(rValue, eItem, eType);
552b9e67834SAndre Fischer 
553b9e67834SAndre Fischer     BroadcastPropertyChange(GetChangeListeners(__AnyItem, false), aEvent);
554b9e67834SAndre Fischer     BroadcastPropertyChange(GetChangeListeners(eItem, false), aEvent);
555b9e67834SAndre Fischer }
556b9e67834SAndre Fischer 
557b9e67834SAndre Fischer 
558b9e67834SAndre Fischer 
559b9e67834SAndre Fischer 
560b9e67834SAndre Fischer Any SAL_CALL Theme::getPropertyValue (
561b9e67834SAndre Fischer     const ::rtl::OUString& rsPropertyName)
562b9e67834SAndre Fischer     throw(css::beans::UnknownPropertyException,
563b9e67834SAndre Fischer         css::lang::WrappedTargetException,
564b9e67834SAndre Fischer         cssu::RuntimeException)
565b9e67834SAndre Fischer {
566b9e67834SAndre Fischer     PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
567b9e67834SAndre Fischer     if (iId == maPropertyNameToIdMap.end())
568b9e67834SAndre Fischer         throw beans::UnknownPropertyException();
569b9e67834SAndre Fischer 
570b9e67834SAndre Fischer     const PropertyType eType (GetPropertyType(iId->second));
571b9e67834SAndre Fischer     if (eType == PT_Invalid)
572b9e67834SAndre Fischer         throw beans::UnknownPropertyException();
573b9e67834SAndre Fischer 
574b9e67834SAndre Fischer     const ThemeItem eItem (iId->second);
575b9e67834SAndre Fischer 
576b9e67834SAndre Fischer     return maRawValues[eItem];
577b9e67834SAndre Fischer }
578b9e67834SAndre Fischer 
579b9e67834SAndre Fischer 
580b9e67834SAndre Fischer 
581b9e67834SAndre Fischer 
582b9e67834SAndre Fischer void SAL_CALL Theme::addPropertyChangeListener(
583b9e67834SAndre Fischer     const ::rtl::OUString& rsPropertyName,
584b9e67834SAndre Fischer     const cssu::Reference<css::beans::XPropertyChangeListener>& rxListener)
585b9e67834SAndre Fischer     throw(css::beans::UnknownPropertyException,
586b9e67834SAndre Fischer         css::lang::WrappedTargetException,
587b9e67834SAndre Fischer         cssu::RuntimeException)
588b9e67834SAndre Fischer {
589b9e67834SAndre Fischer     ThemeItem eItem (__AnyItem);
590b9e67834SAndre Fischer     if (rsPropertyName.getLength() > 0)
591b9e67834SAndre Fischer     {
592b9e67834SAndre Fischer         PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
593b9e67834SAndre Fischer         if (iId == maPropertyNameToIdMap.end())
594b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
595b9e67834SAndre Fischer 
596b9e67834SAndre Fischer         const PropertyType eType (GetPropertyType(iId->second));
597b9e67834SAndre Fischer         if (eType == PT_Invalid)
598b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
599b9e67834SAndre Fischer 
600b9e67834SAndre Fischer         eItem = iId->second;
601b9e67834SAndre Fischer     }
602b9e67834SAndre Fischer     ChangeListenerContainer* pListeners = GetChangeListeners(eItem, true);
603b9e67834SAndre Fischer     if (pListeners != NULL)
604b9e67834SAndre Fischer         pListeners->push_back(rxListener);
605b9e67834SAndre Fischer }
606b9e67834SAndre Fischer 
607b9e67834SAndre Fischer 
608b9e67834SAndre Fischer 
609b9e67834SAndre Fischer 
610b9e67834SAndre Fischer void SAL_CALL Theme::removePropertyChangeListener(
611b9e67834SAndre Fischer     const ::rtl::OUString& rsPropertyName,
612b9e67834SAndre Fischer     const cssu::Reference<css::beans::XPropertyChangeListener>& rxListener)
613b9e67834SAndre Fischer     throw(css::beans::UnknownPropertyException,
614b9e67834SAndre Fischer         css::lang::WrappedTargetException,
615b9e67834SAndre Fischer         cssu::RuntimeException)
616b9e67834SAndre Fischer {
617b9e67834SAndre Fischer     ThemeItem eItem (__AnyItem);
618b9e67834SAndre Fischer     if (rsPropertyName.getLength() > 0)
619b9e67834SAndre Fischer     {
620b9e67834SAndre Fischer         PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
621b9e67834SAndre Fischer         if (iId == maPropertyNameToIdMap.end())
622b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
623b9e67834SAndre Fischer 
624b9e67834SAndre Fischer         const PropertyType eType (GetPropertyType(iId->second));
625b9e67834SAndre Fischer         if (eType == PT_Invalid)
626b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
627b9e67834SAndre Fischer 
628b9e67834SAndre Fischer         eItem = iId->second;
629b9e67834SAndre Fischer     }
630b9e67834SAndre Fischer     ChangeListenerContainer* pContainer = GetChangeListeners(eItem, false);
631b9e67834SAndre Fischer     if (pContainer != NULL)
632b9e67834SAndre Fischer     {
633b9e67834SAndre Fischer         ChangeListenerContainer::iterator iListener (::std::find(pContainer->begin(), pContainer->end(), rxListener));
634b9e67834SAndre Fischer         if (iListener != pContainer->end())
635b9e67834SAndre Fischer         {
636b9e67834SAndre Fischer             pContainer->erase(iListener);
637b9e67834SAndre Fischer 
638b9e67834SAndre Fischer             // Remove the listener container when empty.
639b9e67834SAndre Fischer             if (pContainer->empty())
640b9e67834SAndre Fischer                 maChangeListeners.erase(eItem);
641b9e67834SAndre Fischer         }
642b9e67834SAndre Fischer     }
643b9e67834SAndre Fischer }
644b9e67834SAndre Fischer 
645b9e67834SAndre Fischer 
646b9e67834SAndre Fischer 
647b9e67834SAndre Fischer 
648b9e67834SAndre Fischer void SAL_CALL Theme::addVetoableChangeListener(
649b9e67834SAndre Fischer     const ::rtl::OUString& rsPropertyName,
650b9e67834SAndre Fischer     const cssu::Reference<css::beans::XVetoableChangeListener>& rxListener)
651b9e67834SAndre Fischer     throw(css::beans::UnknownPropertyException,
652b9e67834SAndre Fischer         css::lang::WrappedTargetException,
653b9e67834SAndre Fischer         cssu::RuntimeException)
654b9e67834SAndre Fischer {
655b9e67834SAndre Fischer     ThemeItem eItem (__AnyItem);
656b9e67834SAndre Fischer     if (rsPropertyName.getLength() > 0)
657b9e67834SAndre Fischer     {
658b9e67834SAndre Fischer         PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
659b9e67834SAndre Fischer         if (iId == maPropertyNameToIdMap.end())
660b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
661b9e67834SAndre Fischer 
662b9e67834SAndre Fischer         const PropertyType eType (GetPropertyType(iId->second));
663b9e67834SAndre Fischer         if (eType == PT_Invalid)
664b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
665b9e67834SAndre Fischer 
666b9e67834SAndre Fischer         eItem = iId->second;
667b9e67834SAndre Fischer     }
668b9e67834SAndre Fischer     VetoableListenerContainer* pListeners = GetVetoableListeners(eItem, true);
669b9e67834SAndre Fischer     if (pListeners != NULL)
670b9e67834SAndre Fischer         pListeners->push_back(rxListener);
671b9e67834SAndre Fischer }
672b9e67834SAndre Fischer 
673b9e67834SAndre Fischer 
674b9e67834SAndre Fischer 
675b9e67834SAndre Fischer 
676b9e67834SAndre Fischer void SAL_CALL Theme::removeVetoableChangeListener(
677b9e67834SAndre Fischer     const ::rtl::OUString& rsPropertyName,
678b9e67834SAndre Fischer     const cssu::Reference<css::beans::XVetoableChangeListener>& rxListener)
679b9e67834SAndre Fischer     throw(css::beans::UnknownPropertyException,
680b9e67834SAndre Fischer         css::lang::WrappedTargetException,
681b9e67834SAndre Fischer         cssu::RuntimeException)
682b9e67834SAndre Fischer {
683b9e67834SAndre Fischer     ThemeItem eItem (__AnyItem);
684b9e67834SAndre Fischer     if (rsPropertyName.getLength() > 0)
685b9e67834SAndre Fischer     {
686b9e67834SAndre Fischer         PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
687b9e67834SAndre Fischer         if (iId == maPropertyNameToIdMap.end())
688b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
689b9e67834SAndre Fischer 
690b9e67834SAndre Fischer         const PropertyType eType (GetPropertyType(iId->second));
691b9e67834SAndre Fischer         if (eType == PT_Invalid)
692b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
693b9e67834SAndre Fischer 
694b9e67834SAndre Fischer         eItem = iId->second;
695b9e67834SAndre Fischer     }
696b9e67834SAndre Fischer     VetoableListenerContainer* pContainer = GetVetoableListeners(eItem, false);
697b9e67834SAndre Fischer     if (pContainer != NULL)
698b9e67834SAndre Fischer     {
699b9e67834SAndre Fischer         VetoableListenerContainer::iterator iListener (::std::find(pContainer->begin(), pContainer->end(), rxListener));
700b9e67834SAndre Fischer         if (iListener != pContainer->end())
701b9e67834SAndre Fischer         {
702b9e67834SAndre Fischer             pContainer->erase(iListener);
703b9e67834SAndre Fischer             // Remove container when empty.
704b9e67834SAndre Fischer             if (pContainer->empty())
705b9e67834SAndre Fischer                 maVetoableListeners.erase(eItem);
706b9e67834SAndre Fischer         }
707b9e67834SAndre Fischer     }
708b9e67834SAndre Fischer }
709b9e67834SAndre Fischer 
710b9e67834SAndre Fischer 
711b9e67834SAndre Fischer 
712b9e67834SAndre Fischer 
71395a18594SAndre Fischer cssu::Sequence<css::beans::Property> SAL_CALL Theme::getProperties (void)
71495a18594SAndre Fischer     throw(cssu::RuntimeException)
71595a18594SAndre Fischer {
71695a18594SAndre Fischer     ::std::vector<beans::Property> aProperties;
71795a18594SAndre Fischer 
71895a18594SAndre Fischer     for (sal_Int32 nItem(__Begin),nEnd(__End); nItem!=nEnd; ++nItem)
71995a18594SAndre Fischer     {
72095a18594SAndre Fischer         const ThemeItem eItem (static_cast<ThemeItem>(nItem));
72195a18594SAndre Fischer         const PropertyType eType (GetPropertyType(eItem));
72295a18594SAndre Fischer         if (eType == PT_Invalid)
72395a18594SAndre Fischer             continue;
72495a18594SAndre Fischer 
72595a18594SAndre Fischer         const beans::Property aProperty(
72695a18594SAndre Fischer             maPropertyIdToNameMap[eItem],
72795a18594SAndre Fischer             eItem,
72895a18594SAndre Fischer             GetCppuType(eType),
72995a18594SAndre Fischer             0);
73095a18594SAndre Fischer         aProperties.push_back(aProperty);
73195a18594SAndre Fischer     }
73295a18594SAndre Fischer 
73395a18594SAndre Fischer     return cssu::Sequence<css::beans::Property>(
73495a18594SAndre Fischer         &aProperties.front(),
73595a18594SAndre Fischer         aProperties.size());
73695a18594SAndre Fischer }
73795a18594SAndre Fischer 
73895a18594SAndre Fischer 
73995a18594SAndre Fischer 
74095a18594SAndre Fischer 
74195a18594SAndre Fischer beans::Property SAL_CALL Theme::getPropertyByName (const ::rtl::OUString& rsPropertyName)
74295a18594SAndre Fischer     throw(css::beans::UnknownPropertyException,
74395a18594SAndre Fischer         cssu::RuntimeException)
74495a18594SAndre Fischer {
74595a18594SAndre Fischer     PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
74695a18594SAndre Fischer     if (iId == maPropertyNameToIdMap.end())
74795a18594SAndre Fischer         throw beans::UnknownPropertyException();
74895a18594SAndre Fischer 
74995a18594SAndre Fischer     const PropertyType eType (GetPropertyType(iId->second));
75095a18594SAndre Fischer     if (eType == PT_Invalid)
75195a18594SAndre Fischer         throw beans::UnknownPropertyException();
75295a18594SAndre Fischer 
75395a18594SAndre Fischer     const ThemeItem eItem (iId->second);
75495a18594SAndre Fischer 
75595a18594SAndre Fischer     return beans::Property(
75695a18594SAndre Fischer         rsPropertyName,
75795a18594SAndre Fischer         eItem,
75895a18594SAndre Fischer         GetCppuType(eType),
75995a18594SAndre Fischer         0);
76095a18594SAndre Fischer }
76195a18594SAndre Fischer 
76295a18594SAndre Fischer 
76395a18594SAndre Fischer 
76495a18594SAndre Fischer 
76595a18594SAndre Fischer sal_Bool SAL_CALL Theme::hasPropertyByName (const ::rtl::OUString& rsPropertyName)
76695a18594SAndre Fischer     throw(cssu::RuntimeException)
76795a18594SAndre Fischer {
76895a18594SAndre Fischer     PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
76995a18594SAndre Fischer     if (iId == maPropertyNameToIdMap.end())
77095a18594SAndre Fischer         return sal_False;
77195a18594SAndre Fischer 
77295a18594SAndre Fischer     const PropertyType eType (GetPropertyType(iId->second));
77395a18594SAndre Fischer     if (eType == PT_Invalid)
77495a18594SAndre Fischer         return sal_False;
77595a18594SAndre Fischer 
77695a18594SAndre Fischer     return sal_True;
77795a18594SAndre Fischer }
77895a18594SAndre Fischer 
77995a18594SAndre Fischer 
78095a18594SAndre Fischer 
78195a18594SAndre Fischer 
782b9e67834SAndre Fischer void Theme::SetupPropertyMaps (void)
783b9e67834SAndre Fischer {
78495a18594SAndre Fischer     maPropertyIdToNameMap.resize(__Post_Rect);
785b9e67834SAndre Fischer     maImages.resize(__Image_Color - __Pre_Image - 1);
786b9e67834SAndre Fischer     maColors.resize(__Color_Paint - __Image_Color - 1);
787b9e67834SAndre Fischer     maPaints.resize(__Paint_Int - __Color_Paint - 1);
788b9e67834SAndre Fischer     maIntegers.resize(__Int_Bool - __Paint_Int - 1);
78995a18594SAndre Fischer     maBooleans.resize(__Bool_Rect - __Int_Bool - 1);
79095a18594SAndre Fischer     maRectangles.resize(__Post_Rect - __Bool_Rect - 1);
791b9e67834SAndre Fischer 
792b9e67834SAndre Fischer     #define AddEntry(e) maPropertyNameToIdMap[A2S(#e)]=e; maPropertyIdToNameMap[e]=A2S(#e)
79395a18594SAndre Fischer 
794b9e67834SAndre Fischer     AddEntry(Image_Grip);
795b9e67834SAndre Fischer     AddEntry(Image_Expand);
796b9e67834SAndre Fischer     AddEntry(Image_Collapse);
7977a32b0c8SAndre Fischer     AddEntry(Image_TabBarMenu);
7987a32b0c8SAndre Fischer     AddEntry(Image_PanelMenu);
79995a18594SAndre Fischer     AddEntry(Image_ToolBoxItemSeparator);
8007a32b0c8SAndre Fischer     AddEntry(Image_Closer);
801b9e67834SAndre Fischer 
802b9e67834SAndre Fischer     AddEntry(Color_DeckTitleFont);
803b9e67834SAndre Fischer     AddEntry(Color_PanelTitleFont);
804b9e67834SAndre Fischer     AddEntry(Color_TabMenuSeparator);
805b9e67834SAndre Fischer     AddEntry(Color_TabItemBorder);
8068dcb2a10SAndre Fischer     AddEntry(Color_DropDownBorder);
8075f1c83ffSOliver-Rainer Wittmann     AddEntry(Color_Highlight);
8085f1c83ffSOliver-Rainer Wittmann     AddEntry(Color_HighlightText);
809b9e67834SAndre Fischer 
810b9e67834SAndre Fischer     AddEntry(Paint_DeckBackground);
811b9e67834SAndre Fischer     AddEntry(Paint_DeckTitleBarBackground);
812b9e67834SAndre Fischer     AddEntry(Paint_PanelBackground);
813b9e67834SAndre Fischer     AddEntry(Paint_PanelTitleBarBackground);
814b9e67834SAndre Fischer     AddEntry(Paint_TabBarBackground);
81595a18594SAndre Fischer     AddEntry(Paint_TabItemBackgroundNormal);
81695a18594SAndre Fischer     AddEntry(Paint_TabItemBackgroundHighlight);
817b9e67834SAndre Fischer     AddEntry(Paint_HorizontalBorder);
818b9e67834SAndre Fischer     AddEntry(Paint_VerticalBorder);
81995a18594SAndre Fischer     AddEntry(Paint_ToolBoxBackground);
82095a18594SAndre Fischer     AddEntry(Paint_ToolBoxBorderTopLeft);
82195a18594SAndre Fischer     AddEntry(Paint_ToolBoxBorderCenterCorners);
82295a18594SAndre Fischer     AddEntry(Paint_ToolBoxBorderBottomRight);
8238dcb2a10SAndre Fischer     AddEntry(Paint_DropDownBackground);
824b9e67834SAndre Fischer 
825b9e67834SAndre Fischer     AddEntry(Int_DeckTitleBarHeight);
826b9e67834SAndre Fischer     AddEntry(Int_DeckBorderSize);
827b9e67834SAndre Fischer     AddEntry(Int_DeckSeparatorHeight);
828b9e67834SAndre Fischer     AddEntry(Int_PanelTitleBarHeight);
829b9e67834SAndre Fischer     AddEntry(Int_TabMenuPadding);
830b9e67834SAndre Fischer     AddEntry(Int_TabMenuSeparatorPadding);
831b9e67834SAndre Fischer     AddEntry(Int_TabItemWidth);
832b9e67834SAndre Fischer     AddEntry(Int_TabItemHeight);
833b9e67834SAndre Fischer     AddEntry(Int_DeckLeftPadding);
834b9e67834SAndre Fischer     AddEntry(Int_DeckTopPadding);
835b9e67834SAndre Fischer     AddEntry(Int_DeckRightPadding);
836b9e67834SAndre Fischer     AddEntry(Int_DeckBottomPadding);
837b9e67834SAndre Fischer     AddEntry(Int_TabBarLeftPadding);
838b9e67834SAndre Fischer     AddEntry(Int_TabBarTopPadding);
839b9e67834SAndre Fischer     AddEntry(Int_TabBarRightPadding);
840b9e67834SAndre Fischer     AddEntry(Int_TabBarBottomPadding);
841b9e67834SAndre Fischer 
842b9e67834SAndre Fischer     AddEntry(Bool_UseSymphonyIcons);
84395a18594SAndre Fischer     AddEntry(Bool_UseSystemColors);
84495a18594SAndre Fischer     AddEntry(Bool_UseToolBoxItemSeparator);
84595a18594SAndre Fischer     AddEntry(Bool_IsHighContrastModeActive);
84695a18594SAndre Fischer 
84795a18594SAndre Fischer     AddEntry(Rect_ToolBoxPadding);
84895a18594SAndre Fischer     AddEntry(Rect_ToolBoxBorder);
84995a18594SAndre Fischer 
850b9e67834SAndre Fischer     #undef AddEntry
851b9e67834SAndre Fischer 
852b9e67834SAndre Fischer     maRawValues.resize(maPropertyIdToNameMap.size());
853b9e67834SAndre Fischer }
854b9e67834SAndre Fischer 
855b9e67834SAndre Fischer 
856b9e67834SAndre Fischer 
857b9e67834SAndre Fischer 
858b9e67834SAndre Fischer Theme::PropertyType Theme::GetPropertyType (const ThemeItem eItem)
859b9e67834SAndre Fischer {
860b9e67834SAndre Fischer     switch(eItem)
861b9e67834SAndre Fischer     {
862b9e67834SAndre Fischer         case Image_Grip:
863b9e67834SAndre Fischer         case Image_Expand:
864b9e67834SAndre Fischer         case Image_Collapse:
8657a32b0c8SAndre Fischer         case Image_TabBarMenu:
8667a32b0c8SAndre Fischer         case Image_PanelMenu:
86795a18594SAndre Fischer         case Image_ToolBoxItemSeparator:
8687a32b0c8SAndre Fischer         case Image_Closer:
869b9e67834SAndre Fischer             return PT_Image;
870b9e67834SAndre Fischer 
871b9e67834SAndre Fischer         case Color_DeckTitleFont:
872b9e67834SAndre Fischer         case Color_PanelTitleFont:
873b9e67834SAndre Fischer         case Color_TabMenuSeparator:
874b9e67834SAndre Fischer         case Color_TabItemBorder:
8758dcb2a10SAndre Fischer         case Color_DropDownBorder:
8765f1c83ffSOliver-Rainer Wittmann         case Color_Highlight:
8775f1c83ffSOliver-Rainer Wittmann         case Color_HighlightText:
878b9e67834SAndre Fischer             return PT_Color;
879b9e67834SAndre Fischer 
880b9e67834SAndre Fischer         case Paint_DeckBackground:
881b9e67834SAndre Fischer         case Paint_DeckTitleBarBackground:
882b9e67834SAndre Fischer         case Paint_PanelBackground:
883b9e67834SAndre Fischer         case Paint_PanelTitleBarBackground:
884b9e67834SAndre Fischer         case Paint_TabBarBackground:
88595a18594SAndre Fischer         case Paint_TabItemBackgroundNormal:
88695a18594SAndre Fischer         case Paint_TabItemBackgroundHighlight:
887b9e67834SAndre Fischer         case Paint_HorizontalBorder:
888b9e67834SAndre Fischer         case Paint_VerticalBorder:
88995a18594SAndre Fischer         case Paint_ToolBoxBackground:
89095a18594SAndre Fischer         case Paint_ToolBoxBorderTopLeft:
89195a18594SAndre Fischer         case Paint_ToolBoxBorderCenterCorners:
89295a18594SAndre Fischer         case Paint_ToolBoxBorderBottomRight:
8938dcb2a10SAndre Fischer         case Paint_DropDownBackground:
894b9e67834SAndre Fischer             return PT_Paint;
895b9e67834SAndre Fischer 
896b9e67834SAndre Fischer         case Int_DeckTitleBarHeight:
897b9e67834SAndre Fischer         case Int_DeckBorderSize:
898b9e67834SAndre Fischer         case Int_DeckSeparatorHeight:
899b9e67834SAndre Fischer         case Int_PanelTitleBarHeight:
900b9e67834SAndre Fischer         case Int_TabMenuPadding:
901b9e67834SAndre Fischer         case Int_TabMenuSeparatorPadding:
902b9e67834SAndre Fischer         case Int_TabItemWidth:
903b9e67834SAndre Fischer         case Int_TabItemHeight:
904b9e67834SAndre Fischer         case Int_DeckLeftPadding:
905b9e67834SAndre Fischer         case Int_DeckTopPadding:
906b9e67834SAndre Fischer         case Int_DeckRightPadding:
907b9e67834SAndre Fischer         case Int_DeckBottomPadding:
908b9e67834SAndre Fischer         case Int_TabBarLeftPadding:
909b9e67834SAndre Fischer         case Int_TabBarTopPadding:
910b9e67834SAndre Fischer         case Int_TabBarRightPadding:
911b9e67834SAndre Fischer         case Int_TabBarBottomPadding:
912b9e67834SAndre Fischer             return PT_Integer;
913b9e67834SAndre Fischer 
914b9e67834SAndre Fischer         case Bool_UseSymphonyIcons:
91595a18594SAndre Fischer         case Bool_UseSystemColors:
91695a18594SAndre Fischer         case Bool_UseToolBoxItemSeparator:
91795a18594SAndre Fischer         case Bool_IsHighContrastModeActive:
918b9e67834SAndre Fischer             return PT_Boolean;
919b9e67834SAndre Fischer 
92095a18594SAndre Fischer         case Rect_ToolBoxBorder:
92195a18594SAndre Fischer         case Rect_ToolBoxPadding:
92295a18594SAndre Fischer             return PT_Rectangle;
92395a18594SAndre Fischer 
924b9e67834SAndre Fischer         default:
925b9e67834SAndre Fischer             return PT_Invalid;
926b9e67834SAndre Fischer     }
927b9e67834SAndre Fischer }
928b9e67834SAndre Fischer 
929b9e67834SAndre Fischer 
930b9e67834SAndre Fischer 
931b9e67834SAndre Fischer 
93295a18594SAndre Fischer cssu::Type Theme::GetCppuType (const PropertyType eType)
93395a18594SAndre Fischer {
93495a18594SAndre Fischer     switch(eType)
93595a18594SAndre Fischer     {
93695a18594SAndre Fischer         case PT_Image:
93795a18594SAndre Fischer             return getCppuType((rtl::OUString*)NULL);
93895a18594SAndre Fischer 
93995a18594SAndre Fischer         case PT_Color:
94095a18594SAndre Fischer             return getCppuType((sal_uInt32*)NULL);
94195a18594SAndre Fischer 
94295a18594SAndre Fischer         case PT_Paint:
94395a18594SAndre Fischer             return getCppuVoidType();
94495a18594SAndre Fischer 
94595a18594SAndre Fischer         case PT_Integer:
94695a18594SAndre Fischer             return getCppuType((sal_Int32*)NULL);
94795a18594SAndre Fischer 
94895a18594SAndre Fischer         case PT_Boolean:
94995a18594SAndre Fischer             return getCppuType((sal_Bool*)NULL);
95095a18594SAndre Fischer 
95195a18594SAndre Fischer         case PT_Rectangle:
95295a18594SAndre Fischer             return getCppuType((awt::Rectangle*)NULL);
95395a18594SAndre Fischer 
95495a18594SAndre Fischer         case PT_Invalid:
95595a18594SAndre Fischer         default:
95695a18594SAndre Fischer             return getCppuVoidType();
95795a18594SAndre Fischer     }
95895a18594SAndre Fischer }
95995a18594SAndre Fischer 
96095a18594SAndre Fischer 
96195a18594SAndre Fischer 
96295a18594SAndre Fischer 
963b9e67834SAndre Fischer sal_Int32 Theme::GetIndex (const ThemeItem eItem, const PropertyType eType)
964b9e67834SAndre Fischer {
965b9e67834SAndre Fischer     switch(eType)
966b9e67834SAndre Fischer     {
967b9e67834SAndre Fischer         case PT_Image:
968b9e67834SAndre Fischer             return eItem - __Pre_Image-1;
969b9e67834SAndre Fischer         case PT_Color:
970b9e67834SAndre Fischer             return eItem - __Image_Color-1;
971b9e67834SAndre Fischer         case PT_Paint:
972b9e67834SAndre Fischer             return eItem - __Color_Paint-1;
973b9e67834SAndre Fischer         case PT_Integer:
974b9e67834SAndre Fischer             return eItem - __Paint_Int-1;
975b9e67834SAndre Fischer         case PT_Boolean:
976b9e67834SAndre Fischer             return eItem - __Int_Bool-1;
97795a18594SAndre Fischer         case PT_Rectangle:
97895a18594SAndre Fischer             return eItem - __Bool_Rect-1;
979b9e67834SAndre Fischer 
980b9e67834SAndre Fischer         default:
981b9e67834SAndre Fischer             OSL_ASSERT(false);
982b9e67834SAndre Fischer             return 0;
983b9e67834SAndre Fischer     }
984b9e67834SAndre Fischer }
985b9e67834SAndre Fischer 
986b9e67834SAndre Fischer 
987b9e67834SAndre Fischer 
988b9e67834SAndre Fischer 
989b9e67834SAndre Fischer Theme::VetoableListenerContainer* Theme::GetVetoableListeners (
990b9e67834SAndre Fischer     const ThemeItem eItem,
991b9e67834SAndre Fischer     const bool bCreate)
992b9e67834SAndre Fischer {
993b9e67834SAndre Fischer     VetoableListeners::iterator iContainer (maVetoableListeners.find(eItem));
994b9e67834SAndre Fischer     if (iContainer != maVetoableListeners.end())
995b9e67834SAndre Fischer         return &iContainer->second;
996b9e67834SAndre Fischer     else if (bCreate)
997b9e67834SAndre Fischer     {
998b9e67834SAndre Fischer         maVetoableListeners[eItem] = VetoableListenerContainer();
999b9e67834SAndre Fischer         return &maVetoableListeners[eItem];
1000b9e67834SAndre Fischer     }
1001b9e67834SAndre Fischer     else
1002b9e67834SAndre Fischer         return NULL;
1003b9e67834SAndre Fischer }
1004b9e67834SAndre Fischer 
1005b9e67834SAndre Fischer 
1006b9e67834SAndre Fischer 
1007b9e67834SAndre Fischer 
1008b9e67834SAndre Fischer Theme::ChangeListenerContainer* Theme::GetChangeListeners (
1009b9e67834SAndre Fischer     const ThemeItem eItem,
1010b9e67834SAndre Fischer     const bool bCreate)
1011b9e67834SAndre Fischer {
1012b9e67834SAndre Fischer     ChangeListeners::iterator iContainer (maChangeListeners.find(eItem));
1013b9e67834SAndre Fischer     if (iContainer != maChangeListeners.end())
1014b9e67834SAndre Fischer         return &iContainer->second;
1015b9e67834SAndre Fischer     else if (bCreate)
1016b9e67834SAndre Fischer     {
1017b9e67834SAndre Fischer         maChangeListeners[eItem] = ChangeListenerContainer();
1018b9e67834SAndre Fischer         return &maChangeListeners[eItem];
1019b9e67834SAndre Fischer     }
1020b9e67834SAndre Fischer     else
1021b9e67834SAndre Fischer         return NULL;
1022b9e67834SAndre Fischer }
1023b9e67834SAndre Fischer 
1024b9e67834SAndre Fischer 
1025b9e67834SAndre Fischer 
1026b9e67834SAndre Fischer 
1027b9e67834SAndre Fischer bool Theme::DoVetoableListenersVeto (
1028b9e67834SAndre Fischer     const VetoableListenerContainer* pListeners,
1029b9e67834SAndre Fischer     const beans::PropertyChangeEvent& rEvent) const
1030b9e67834SAndre Fischer {
1031b9e67834SAndre Fischer     if (pListeners == NULL)
1032b9e67834SAndre Fischer         return false;
1033b9e67834SAndre Fischer 
1034b9e67834SAndre Fischer     VetoableListenerContainer aListeners (*pListeners);
1035b9e67834SAndre Fischer     try
1036b9e67834SAndre Fischer     {
1037b9e67834SAndre Fischer         for (VetoableListenerContainer::const_iterator
1038b9e67834SAndre Fischer                  iListener(aListeners.begin()),
1039b9e67834SAndre Fischer                  iEnd(aListeners.end());
1040b9e67834SAndre Fischer              iListener!=iEnd;
1041b9e67834SAndre Fischer              ++iListener)
1042b9e67834SAndre Fischer         {
1043b9e67834SAndre Fischer             (*iListener)->vetoableChange(rEvent);
1044b9e67834SAndre Fischer         }
1045b9e67834SAndre Fischer     }
1046b9e67834SAndre Fischer     catch(const beans::PropertyVetoException&)
1047b9e67834SAndre Fischer     {
1048b9e67834SAndre Fischer         return true;
1049b9e67834SAndre Fischer     }
1050b9e67834SAndre Fischer     catch(const Exception&)
1051b9e67834SAndre Fischer     {
1052b9e67834SAndre Fischer         // Ignore any other errors (such as disposed listeners).
1053b9e67834SAndre Fischer     }
1054b9e67834SAndre Fischer     return false;
1055b9e67834SAndre Fischer }
1056b9e67834SAndre Fischer 
1057b9e67834SAndre Fischer 
1058b9e67834SAndre Fischer 
1059b9e67834SAndre Fischer 
1060b9e67834SAndre Fischer void Theme::BroadcastPropertyChange (
1061b9e67834SAndre Fischer     const ChangeListenerContainer* pListeners,
1062b9e67834SAndre Fischer     const beans::PropertyChangeEvent& rEvent) const
1063b9e67834SAndre Fischer {
1064b9e67834SAndre Fischer     if (pListeners == NULL)
1065b9e67834SAndre Fischer         return;
1066b9e67834SAndre Fischer 
1067b9e67834SAndre Fischer     const ChangeListenerContainer aListeners (*pListeners);
1068b9e67834SAndre Fischer     try
1069b9e67834SAndre Fischer     {
1070b9e67834SAndre Fischer         for (ChangeListenerContainer::const_iterator
1071b9e67834SAndre Fischer                  iListener(aListeners.begin()),
1072b9e67834SAndre Fischer                  iEnd(aListeners.end());
1073b9e67834SAndre Fischer              iListener!=iEnd;
1074b9e67834SAndre Fischer              ++iListener)
1075b9e67834SAndre Fischer         {
1076b9e67834SAndre Fischer             (*iListener)->propertyChange(rEvent);
1077b9e67834SAndre Fischer         }
1078b9e67834SAndre Fischer     }
1079b9e67834SAndre Fischer     catch(const Exception&)
1080b9e67834SAndre Fischer     {
1081b9e67834SAndre Fischer         // Ignore any errors (such as disposed listeners).
1082b9e67834SAndre Fischer     }
1083b9e67834SAndre Fischer }
1084b9e67834SAndre Fischer 
1085b9e67834SAndre Fischer 
1086b9e67834SAndre Fischer 
1087b9e67834SAndre Fischer 
1088b9e67834SAndre Fischer void Theme::ProcessNewValue (
1089b9e67834SAndre Fischer     const Any& rValue,
1090b9e67834SAndre Fischer     const ThemeItem eItem,
1091b9e67834SAndre Fischer     const PropertyType eType)
1092b9e67834SAndre Fischer {
1093b9e67834SAndre Fischer     const sal_Int32 nIndex (GetIndex (eItem, eType));
1094b9e67834SAndre Fischer     switch (eType)
1095b9e67834SAndre Fischer     {
1096b9e67834SAndre Fischer         case PT_Image:
1097b9e67834SAndre Fischer         {
1098b9e67834SAndre Fischer             ::rtl::OUString sURL;
1099b9e67834SAndre Fischer             if (rValue >>= sURL)
1100b9e67834SAndre Fischer             {
1101b9e67834SAndre Fischer                 maImages[nIndex] = Tools::GetImage(sURL, NULL);
1102b9e67834SAndre Fischer             }
1103b9e67834SAndre Fischer             break;
1104b9e67834SAndre Fischer         }
1105b9e67834SAndre Fischer         case PT_Color:
1106b9e67834SAndre Fischer         {
110795a18594SAndre Fischer             sal_Int32 nColorValue (0);
1108b9e67834SAndre Fischer             if (rValue >>= nColorValue)
1109b9e67834SAndre Fischer             {
1110b9e67834SAndre Fischer                 maColors[nIndex] = Color(nColorValue);
1111b9e67834SAndre Fischer             }
1112b9e67834SAndre Fischer             break;
1113b9e67834SAndre Fischer         }
1114b9e67834SAndre Fischer         case PT_Paint:
1115b9e67834SAndre Fischer         {
111695a18594SAndre Fischer             maPaints[nIndex] = Paint::Create(rValue);
1117b9e67834SAndre Fischer             break;
1118b9e67834SAndre Fischer         }
1119b9e67834SAndre Fischer         case PT_Integer:
1120b9e67834SAndre Fischer         {
112195a18594SAndre Fischer             sal_Int32 nValue (0);
1122b9e67834SAndre Fischer             if (rValue >>= nValue)
1123b9e67834SAndre Fischer             {
1124b9e67834SAndre Fischer                 maIntegers[nIndex] = nValue;
1125b9e67834SAndre Fischer             }
1126b9e67834SAndre Fischer             break;
1127b9e67834SAndre Fischer         }
1128b9e67834SAndre Fischer         case PT_Boolean:
1129b9e67834SAndre Fischer         {
113095a18594SAndre Fischer             sal_Bool nValue (0);
1131b9e67834SAndre Fischer             if (rValue >>= nValue)
1132b9e67834SAndre Fischer             {
1133b9e67834SAndre Fischer                 maBooleans[nIndex] = (nValue==sal_True);
113495a18594SAndre Fischer                 if (eItem == Bool_IsHighContrastModeActive)
113595a18594SAndre Fischer                 {
113695a18594SAndre Fischer                     mbIsHighContrastModeSetManually = true;
113795a18594SAndre Fischer                     mbIsHighContrastMode = maBooleans[nIndex];
113895a18594SAndre Fischer                     HandleDataChange();
113995a18594SAndre Fischer                 }
114095a18594SAndre Fischer                 else if (eItem == Bool_UseSystemColors)
114195a18594SAndre Fischer                 {
114295a18594SAndre Fischer                     HandleDataChange();
114395a18594SAndre Fischer                 }
114495a18594SAndre Fischer             }
114595a18594SAndre Fischer             break;
114695a18594SAndre Fischer         }
114795a18594SAndre Fischer         case PT_Rectangle:
114895a18594SAndre Fischer         {
114995a18594SAndre Fischer             awt::Rectangle aBox;
115095a18594SAndre Fischer             if (rValue >>= aBox)
115195a18594SAndre Fischer             {
115295a18594SAndre Fischer                 maRectangles[nIndex] = Rectangle(
115395a18594SAndre Fischer                     aBox.X,
115495a18594SAndre Fischer                     aBox.Y,
115595a18594SAndre Fischer                     aBox.Width,
115695a18594SAndre Fischer                     aBox.Height);
1157b9e67834SAndre Fischer             }
1158b9e67834SAndre Fischer             break;
1159b9e67834SAndre Fischer         }
1160b9e67834SAndre Fischer         case PT_Invalid:
1161b9e67834SAndre Fischer             OSL_ASSERT(eType != PT_Invalid);
1162b9e67834SAndre Fischer             throw RuntimeException();
1163b9e67834SAndre Fischer     }
1164b9e67834SAndre Fischer }
1165b9e67834SAndre Fischer 
1166b9e67834SAndre Fischer 
1167b9e67834SAndre Fischer 
1168ff12d537SAndre Fischer 
1169ff12d537SAndre Fischer } } // end of namespace sfx2::sidebar
1170