xref: /AOO41X/main/sfx2/source/sidebar/Theme.cxx (revision 8dcb2a100eb78f12871a9e67d867e1bc0c7bdb07)
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));
101*8dcb2a10SAndre Fischer     OSL_ASSERT(eType==PT_Color || eType==PT_Paint);
102b9e67834SAndre Fischer     const sal_Int32 nIndex (GetIndex(eItem, eType));
103b9e67834SAndre Fischer     const Theme& rTheme (GetCurrentTheme());
104*8dcb2a10SAndre Fischer     if (eType == PT_Color)
105b9e67834SAndre Fischer         return rTheme.maColors[nIndex];
106*8dcb2a10SAndre Fischer     else if (eType == PT_Paint)
107*8dcb2a10SAndre 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 
219*8dcb2a10SAndre Fischer         const Color aBaseBackgroundColor (rStyle.GetDialogColor());
220*8dcb2a10SAndre Fischer         Color aBorderColor (aBaseBackgroundColor);
221*8dcb2a10SAndre Fischer         aBorderColor.DecreaseLuminance(15);
222*8dcb2a10SAndre Fischer         Color aSecondColor (aBaseBackgroundColor);
223*8dcb2a10SAndre Fischer         aSecondColor.DecreaseLuminance(15);
224*8dcb2a10SAndre Fischer 
225b9e67834SAndre Fischer         setPropertyValue(
226b9e67834SAndre Fischer             maPropertyIdToNameMap[Paint_DeckBackground],
227*8dcb2a10SAndre Fischer             Any(sal_Int32(rStyle.GetMenuColor().GetRGBColor())));
22895a18594SAndre Fischer 
229b9e67834SAndre Fischer         setPropertyValue(
230b9e67834SAndre Fischer             maPropertyIdToNameMap[Paint_DeckTitleBarBackground],
231*8dcb2a10SAndre 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],
252*8dcb2a10SAndre 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],
261*8dcb2a10SAndre Fischer             Any(sal_Int32(rStyle.GetDialogColor().GetRGBColor())));
262*8dcb2a10SAndre Fischer         //            Any(sal_Int32(mbIsHighContrastMode ? 0x000000 :
263*8dcb2a10SAndre Fischer         //            0xffffff)));
264*8dcb2a10SAndre Fischer 
265b9e67834SAndre Fischer         setPropertyValue(
266b9e67834SAndre Fischer             maPropertyIdToNameMap[Paint_PanelTitleBarBackground],
267*8dcb2a10SAndre Fischer             Any(Tools::VclToAwtGradient(Gradient(
268*8dcb2a10SAndre Fischer                         GRADIENT_LINEAR,
269*8dcb2a10SAndre Fischer                         aSecondColor.GetRGBColor(),
270*8dcb2a10SAndre Fischer                         aBaseBackgroundColor.GetRGBColor()
271*8dcb2a10SAndre 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],
283*8dcb2a10SAndre 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],
302*8dcb2a10SAndre 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],
315*8dcb2a10SAndre Fischer             Any(sal_Int32(rStyle.GetActiveBorderColor().GetRGBColor())));
316*8dcb2a10SAndre Fischer         //                    mbIsHighContrastMode ? 0x00ff00 : 0xbfbfbf)));
317*8dcb2a10SAndre Fischer 
318*8dcb2a10SAndre Fischer         setPropertyValue(
319*8dcb2a10SAndre Fischer             maPropertyIdToNameMap[Paint_DropDownBackground],
320*8dcb2a10SAndre Fischer             Any(sal_Int32(aBaseBackgroundColor.GetRGBColor())));
321*8dcb2a10SAndre Fischer         setPropertyValue(
322*8dcb2a10SAndre Fischer             maPropertyIdToNameMap[Color_DropDownBorder],
323*8dcb2a10SAndre Fischer             Any(sal_Int32(rStyle.GetActiveBorderColor().GetRGBColor())));
324*8dcb2a10SAndre Fischer 
325b9e67834SAndre Fischer         setPropertyValue(
32695a18594SAndre Fischer             maPropertyIdToNameMap[Paint_TabItemBackgroundNormal],
32795a18594SAndre Fischer             Any());
32895a18594SAndre Fischer         setPropertyValue(
32995a18594SAndre Fischer             maPropertyIdToNameMap[Paint_TabItemBackgroundHighlight],
330*8dcb2a10SAndre Fischer             Any(sal_Int32(rStyle.GetActiveTabColor().GetRGBColor())));
331*8dcb2a10SAndre Fischer         //                    mbIsHighContrastMode ? 0x000000 : 0x00ffffff)));
332ff12d537SAndre Fischer 
333b9e67834SAndre Fischer         setPropertyValue(
334b9e67834SAndre Fischer             maPropertyIdToNameMap[Paint_HorizontalBorder],
335*8dcb2a10SAndre Fischer             Any(sal_Int32(aBorderColor.GetRGBColor())));
336*8dcb2a10SAndre Fischer         //                    mbIsHighContrastMode ? 0x00ff00 :  0xe4e4e4)));
337b9e67834SAndre Fischer         setPropertyValue(
338b9e67834SAndre Fischer             maPropertyIdToNameMap[Paint_VerticalBorder],
339*8dcb2a10SAndre Fischer             Any(sal_Int32(aBorderColor.GetRGBColor())));
340*8dcb2a10SAndre Fischer         //                    mbIsHighContrastMode ? 0x00ff00 : 0xe4e4e4)));
341ff12d537SAndre Fischer 
342b9e67834SAndre Fischer         setPropertyValue(
343b9e67834SAndre Fischer             maPropertyIdToNameMap[Image_Grip],
344b9e67834SAndre Fischer             Any(
345b9e67834SAndre Fischer                 mbIsHighContrastMode
346b9e67834SAndre Fischer                     ? A2S("private:graphicrepository/sfx2/res/grip_hc.png")
347b9e67834SAndre Fischer                     : A2S("private:graphicrepository/sfx2/res/grip.png")));
348b9e67834SAndre Fischer         setPropertyValue(
349b9e67834SAndre Fischer             maPropertyIdToNameMap[Image_Expand],
350b9e67834SAndre Fischer             Any(
351b9e67834SAndre Fischer                 mbIsHighContrastMode
3527a32b0c8SAndre Fischer                     ? A2S("private:graphicrepository/svtools/res/triangle_right_hc.png")
3537a32b0c8SAndre Fischer                     : A2S("private:graphicrepository/svtools/res/triangle_right.png")));
3547a32b0c8SAndre Fischer         //                    ? A2S("private:graphicrepository/res/plus_sch.png")
3557a32b0c8SAndre Fischer         //                    : A2S("private:graphicrepository/res/plus.png")));
356b9e67834SAndre Fischer         setPropertyValue(
357b9e67834SAndre Fischer             maPropertyIdToNameMap[Image_Collapse],
358b9e67834SAndre Fischer             Any(
359b9e67834SAndre Fischer                 mbIsHighContrastMode
3607a32b0c8SAndre Fischer                     ? A2S("private:graphicrepository/svtools/res/triangle_down_hc.png")
3617a32b0c8SAndre Fischer                     : A2S("private:graphicrepository/svtools/res/triangle_down.png")));
3627a32b0c8SAndre Fischer         //                    ? A2S("private:graphicrepository/res/minus_sch.png")
3637a32b0c8SAndre Fischer         //                    : A2S("private:graphicrepository/res/minus.png")));
364b9e67834SAndre Fischer         setPropertyValue(
3657a32b0c8SAndre Fischer             maPropertyIdToNameMap[Image_TabBarMenu],
366b9e67834SAndre Fischer             Any(
367b9e67834SAndre Fischer                 mbIsHighContrastMode
36895a18594SAndre Fischer                     ? A2S("private:graphicrepository/sfx2/res/menu_hc.png")
369b9e67834SAndre Fischer                     : A2S("private:graphicrepository/sfx2/res/menu.png")));
370b9e67834SAndre Fischer         setPropertyValue(
3717a32b0c8SAndre Fischer             maPropertyIdToNameMap[Image_PanelMenu],
3727a32b0c8SAndre Fischer             Any(
3737a32b0c8SAndre Fischer                 mbIsHighContrastMode
3747a32b0c8SAndre Fischer                     ? A2S("private:graphicrepository/res/imh30823.png")
3757a32b0c8SAndre Fischer                     : A2S("private:graphicrepository/res/im30823.png")));
3767a32b0c8SAndre Fischer         setPropertyValue(
3777a32b0c8SAndre Fischer             maPropertyIdToNameMap[Image_Closer],
3787a32b0c8SAndre Fischer             Any(A2S("private:graphicrepository/sfx2/res/closedoc.png")));
3797a32b0c8SAndre Fischer         setPropertyValue(
38095a18594SAndre Fischer             maPropertyIdToNameMap[Image_ToolBoxItemSeparator],
38195a18594SAndre Fischer             Any(
38295a18594SAndre Fischer                 A2S("private:graphicrepository/sfx2/res/separator.png")));
38395a18594SAndre Fischer 
38495a18594SAndre Fischer         // ToolBox
385*8dcb2a10SAndre Fischer 
386*8dcb2a10SAndre Fischer         /*
387*8dcb2a10SAndre Fischer         // Separator style
388*8dcb2a10SAndre Fischer         setPropertyValue(
389*8dcb2a10SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBackground],
390*8dcb2a10SAndre Fischer             Any(sal_Int32(rStyle.GetMenuColor().GetRGBColor())));
391*8dcb2a10SAndre Fischer         setPropertyValue(
392*8dcb2a10SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBorderTopLeft],
393*8dcb2a10SAndre Fischer             Any());
394*8dcb2a10SAndre Fischer         setPropertyValue(
395*8dcb2a10SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBorderCenterCorners],
396*8dcb2a10SAndre Fischer             Any());
397*8dcb2a10SAndre Fischer         setPropertyValue(
398*8dcb2a10SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBorderBottomRight],
399*8dcb2a10SAndre Fischer             Any());
400*8dcb2a10SAndre Fischer         setPropertyValue(
401*8dcb2a10SAndre Fischer             maPropertyIdToNameMap[Rect_ToolBoxPadding],
402*8dcb2a10SAndre Fischer             Any(awt::Rectangle(2,2,2,2)));
403*8dcb2a10SAndre Fischer         setPropertyValue(
404*8dcb2a10SAndre Fischer             maPropertyIdToNameMap[Rect_ToolBoxBorder],
405*8dcb2a10SAndre Fischer             Any(awt::Rectangle(0,0,0,0)));
406*8dcb2a10SAndre Fischer         setPropertyValue(
407*8dcb2a10SAndre Fischer             maPropertyIdToNameMap[Bool_UseToolBoxItemSeparator],
408*8dcb2a10SAndre Fischer             Any(true));
409*8dcb2a10SAndre Fischer 
410*8dcb2a10SAndre Fischer         */
411*8dcb2a10SAndre Fischer 
412*8dcb2a10SAndre Fischer         // Gradient style
41395a18594SAndre Fischer         setPropertyValue(
41495a18594SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBackground],
41595a18594SAndre Fischer             Any(Tools::VclToAwtGradient(Gradient(
41695a18594SAndre Fischer                         GRADIENT_LINEAR,
41795a18594SAndre Fischer                         Color(0xf2f2f2),
41895a18594SAndre Fischer                         Color(0xfefefe)
41995a18594SAndre Fischer                         ))));
42095a18594SAndre Fischer         setPropertyValue(
42195a18594SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBorderTopLeft],
42295a18594SAndre Fischer             mbIsHighContrastMode
42395a18594SAndre Fischer                 ? Any(util::Color(sal_uInt32(0x00ff00)))
42495a18594SAndre Fischer                 : Any(util::Color(sal_uInt32(0xf2f2f2))));
42595a18594SAndre Fischer         setPropertyValue(
42695a18594SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBorderCenterCorners],
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_ToolBoxBorderBottomRight],
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[Rect_ToolBoxPadding],
43795a18594SAndre Fischer             Any(awt::Rectangle(2,2,2,2)));
43895a18594SAndre Fischer         setPropertyValue(
43995a18594SAndre Fischer             maPropertyIdToNameMap[Rect_ToolBoxBorder],
44095a18594SAndre Fischer             Any(awt::Rectangle(1,1,1,1)));
44195a18594SAndre Fischer         setPropertyValue(
44295a18594SAndre Fischer             maPropertyIdToNameMap[Bool_UseToolBoxItemSeparator],
44395a18594SAndre Fischer             Any(false));
444ff12d537SAndre Fischer     }
44595a18594SAndre Fischer     catch(beans::UnknownPropertyException& rException)
446b9e67834SAndre Fischer     {
44795a18594SAndre Fischer         OSL_TRACE("unknown property: %s",
44895a18594SAndre Fischer             OUStringToOString(
44995a18594SAndre Fischer                 rException.Message,
45095a18594SAndre Fischer                 RTL_TEXTENCODING_ASCII_US).getStr());
451b9e67834SAndre Fischer         OSL_ASSERT(false);
452b9e67834SAndre Fischer     }
453b9e67834SAndre Fischer }
454b9e67834SAndre Fischer 
455b9e67834SAndre Fischer 
456b9e67834SAndre Fischer 
457b9e67834SAndre Fischer 
458b9e67834SAndre Fischer void SAL_CALL Theme::disposing (void)
459b9e67834SAndre Fischer {
460b9e67834SAndre Fischer     ChangeListeners aListeners;
461b9e67834SAndre Fischer     maChangeListeners.swap(aListeners);
462b9e67834SAndre Fischer 
463b9e67834SAndre Fischer     const lang::EventObject aEvent (static_cast<XWeak*>(this));
464b9e67834SAndre Fischer 
465b9e67834SAndre Fischer     for (ChangeListeners::const_iterator
466b9e67834SAndre Fischer              iContainer(maChangeListeners.begin()),
467b9e67834SAndre Fischer              iContainerEnd(maChangeListeners.end());
468b9e67834SAndre Fischer          iContainerEnd!=iContainerEnd;
469b9e67834SAndre Fischer          ++iContainerEnd)
470b9e67834SAndre Fischer     {
471b9e67834SAndre Fischer         for (ChangeListenerContainer::const_iterator
472b9e67834SAndre Fischer                  iListener(iContainer->second.begin()),
473b9e67834SAndre Fischer                  iEnd(iContainer->second.end());
474b9e67834SAndre Fischer              iListener!=iEnd;
475b9e67834SAndre Fischer              ++iListener)
476b9e67834SAndre Fischer         {
477b9e67834SAndre Fischer             try
478b9e67834SAndre Fischer             {
479b9e67834SAndre Fischer                 (*iListener)->disposing(aEvent);
480b9e67834SAndre Fischer             }
481b9e67834SAndre Fischer             catch(const Exception&)
482b9e67834SAndre Fischer             {
483b9e67834SAndre Fischer             }
484b9e67834SAndre Fischer         }
485b9e67834SAndre Fischer     }
486b9e67834SAndre Fischer }
487b9e67834SAndre Fischer 
488b9e67834SAndre Fischer 
489b9e67834SAndre Fischer 
490b9e67834SAndre Fischer 
491b9e67834SAndre Fischer Reference<beans::XPropertySet> Theme::GetPropertySet (void)
492b9e67834SAndre Fischer {
493b9e67834SAndre Fischer     return Reference<beans::XPropertySet>(static_cast<XWeak*>(&GetCurrentTheme()), UNO_QUERY);
494b9e67834SAndre Fischer }
495b9e67834SAndre Fischer 
496b9e67834SAndre Fischer 
497b9e67834SAndre Fischer 
498b9e67834SAndre Fischer 
499b9e67834SAndre Fischer Reference<beans::XPropertySetInfo> SAL_CALL Theme::getPropertySetInfo (void)
500b9e67834SAndre Fischer     throw(cssu::RuntimeException)
501b9e67834SAndre Fischer {
50295a18594SAndre Fischer     return Reference<beans::XPropertySetInfo>(this);
503b9e67834SAndre Fischer }
504b9e67834SAndre Fischer 
505b9e67834SAndre Fischer 
506b9e67834SAndre Fischer 
507b9e67834SAndre Fischer 
508b9e67834SAndre Fischer void SAL_CALL Theme::setPropertyValue (
509b9e67834SAndre Fischer     const ::rtl::OUString& rsPropertyName,
510b9e67834SAndre Fischer     const cssu::Any& rValue)
511b9e67834SAndre Fischer     throw(cssu::RuntimeException)
512b9e67834SAndre Fischer {
513b9e67834SAndre Fischer     PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
514b9e67834SAndre Fischer     if (iId == maPropertyNameToIdMap.end())
51595a18594SAndre Fischer         throw beans::UnknownPropertyException(rsPropertyName, NULL);
516b9e67834SAndre Fischer 
517b9e67834SAndre Fischer     const PropertyType eType (GetPropertyType(iId->second));
518b9e67834SAndre Fischer     if (eType == PT_Invalid)
51995a18594SAndre Fischer         throw beans::UnknownPropertyException(rsPropertyName, NULL);
520b9e67834SAndre Fischer 
521b9e67834SAndre Fischer     const ThemeItem eItem (iId->second);
522b9e67834SAndre Fischer 
523b9e67834SAndre Fischer     if (rValue == maRawValues[eItem])
524b9e67834SAndre Fischer     {
525b9e67834SAndre Fischer         // Value is not different from the one in the property
526b9e67834SAndre Fischer         // set => nothing to do.
527b9e67834SAndre Fischer         return;
528b9e67834SAndre Fischer     }
529b9e67834SAndre Fischer 
530b9e67834SAndre Fischer     const Any aOldValue (maRawValues[eItem]);
531b9e67834SAndre Fischer 
532b9e67834SAndre Fischer     const beans::PropertyChangeEvent aEvent(
533b9e67834SAndre Fischer         static_cast<XWeak*>(this),
534b9e67834SAndre Fischer         rsPropertyName,
535b9e67834SAndre Fischer         sal_False,
536b9e67834SAndre Fischer         eItem,
537b9e67834SAndre Fischer         aOldValue,
538b9e67834SAndre Fischer         rValue);
539b9e67834SAndre Fischer 
540b9e67834SAndre Fischer     if (DoVetoableListenersVeto(GetVetoableListeners(__AnyItem, false), aEvent))
541b9e67834SAndre Fischer         return;
542b9e67834SAndre Fischer     if (DoVetoableListenersVeto(GetVetoableListeners(eItem, false), aEvent))
543b9e67834SAndre Fischer         return;
544b9e67834SAndre Fischer 
545b9e67834SAndre Fischer     maRawValues[eItem] = rValue;
546b9e67834SAndre Fischer     ProcessNewValue(rValue, eItem, eType);
547b9e67834SAndre Fischer 
548b9e67834SAndre Fischer     BroadcastPropertyChange(GetChangeListeners(__AnyItem, false), aEvent);
549b9e67834SAndre Fischer     BroadcastPropertyChange(GetChangeListeners(eItem, false), aEvent);
550b9e67834SAndre Fischer }
551b9e67834SAndre Fischer 
552b9e67834SAndre Fischer 
553b9e67834SAndre Fischer 
554b9e67834SAndre Fischer 
555b9e67834SAndre Fischer Any SAL_CALL Theme::getPropertyValue (
556b9e67834SAndre Fischer     const ::rtl::OUString& rsPropertyName)
557b9e67834SAndre Fischer     throw(css::beans::UnknownPropertyException,
558b9e67834SAndre Fischer         css::lang::WrappedTargetException,
559b9e67834SAndre Fischer         cssu::RuntimeException)
560b9e67834SAndre Fischer {
561b9e67834SAndre Fischer     PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
562b9e67834SAndre Fischer     if (iId == maPropertyNameToIdMap.end())
563b9e67834SAndre Fischer         throw beans::UnknownPropertyException();
564b9e67834SAndre Fischer 
565b9e67834SAndre Fischer     const PropertyType eType (GetPropertyType(iId->second));
566b9e67834SAndre Fischer     if (eType == PT_Invalid)
567b9e67834SAndre Fischer         throw beans::UnknownPropertyException();
568b9e67834SAndre Fischer 
569b9e67834SAndre Fischer     const ThemeItem eItem (iId->second);
570b9e67834SAndre Fischer 
571b9e67834SAndre Fischer     return maRawValues[eItem];
572b9e67834SAndre Fischer }
573b9e67834SAndre Fischer 
574b9e67834SAndre Fischer 
575b9e67834SAndre Fischer 
576b9e67834SAndre Fischer 
577b9e67834SAndre Fischer void SAL_CALL Theme::addPropertyChangeListener(
578b9e67834SAndre Fischer     const ::rtl::OUString& rsPropertyName,
579b9e67834SAndre Fischer     const cssu::Reference<css::beans::XPropertyChangeListener>& rxListener)
580b9e67834SAndre Fischer     throw(css::beans::UnknownPropertyException,
581b9e67834SAndre Fischer         css::lang::WrappedTargetException,
582b9e67834SAndre Fischer         cssu::RuntimeException)
583b9e67834SAndre Fischer {
584b9e67834SAndre Fischer     ThemeItem eItem (__AnyItem);
585b9e67834SAndre Fischer     if (rsPropertyName.getLength() > 0)
586b9e67834SAndre Fischer     {
587b9e67834SAndre Fischer         PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
588b9e67834SAndre Fischer         if (iId == maPropertyNameToIdMap.end())
589b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
590b9e67834SAndre Fischer 
591b9e67834SAndre Fischer         const PropertyType eType (GetPropertyType(iId->second));
592b9e67834SAndre Fischer         if (eType == PT_Invalid)
593b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
594b9e67834SAndre Fischer 
595b9e67834SAndre Fischer         eItem = iId->second;
596b9e67834SAndre Fischer     }
597b9e67834SAndre Fischer     ChangeListenerContainer* pListeners = GetChangeListeners(eItem, true);
598b9e67834SAndre Fischer     if (pListeners != NULL)
599b9e67834SAndre Fischer         pListeners->push_back(rxListener);
600b9e67834SAndre Fischer }
601b9e67834SAndre Fischer 
602b9e67834SAndre Fischer 
603b9e67834SAndre Fischer 
604b9e67834SAndre Fischer 
605b9e67834SAndre Fischer void SAL_CALL Theme::removePropertyChangeListener(
606b9e67834SAndre Fischer     const ::rtl::OUString& rsPropertyName,
607b9e67834SAndre Fischer     const cssu::Reference<css::beans::XPropertyChangeListener>& rxListener)
608b9e67834SAndre Fischer     throw(css::beans::UnknownPropertyException,
609b9e67834SAndre Fischer         css::lang::WrappedTargetException,
610b9e67834SAndre Fischer         cssu::RuntimeException)
611b9e67834SAndre Fischer {
612b9e67834SAndre Fischer     ThemeItem eItem (__AnyItem);
613b9e67834SAndre Fischer     if (rsPropertyName.getLength() > 0)
614b9e67834SAndre Fischer     {
615b9e67834SAndre Fischer         PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
616b9e67834SAndre Fischer         if (iId == maPropertyNameToIdMap.end())
617b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
618b9e67834SAndre Fischer 
619b9e67834SAndre Fischer         const PropertyType eType (GetPropertyType(iId->second));
620b9e67834SAndre Fischer         if (eType == PT_Invalid)
621b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
622b9e67834SAndre Fischer 
623b9e67834SAndre Fischer         eItem = iId->second;
624b9e67834SAndre Fischer     }
625b9e67834SAndre Fischer     ChangeListenerContainer* pContainer = GetChangeListeners(eItem, false);
626b9e67834SAndre Fischer     if (pContainer != NULL)
627b9e67834SAndre Fischer     {
628b9e67834SAndre Fischer         ChangeListenerContainer::iterator iListener (::std::find(pContainer->begin(), pContainer->end(), rxListener));
629b9e67834SAndre Fischer         if (iListener != pContainer->end())
630b9e67834SAndre Fischer         {
631b9e67834SAndre Fischer             pContainer->erase(iListener);
632b9e67834SAndre Fischer 
633b9e67834SAndre Fischer             // Remove the listener container when empty.
634b9e67834SAndre Fischer             if (pContainer->empty())
635b9e67834SAndre Fischer                 maChangeListeners.erase(eItem);
636b9e67834SAndre Fischer         }
637b9e67834SAndre Fischer     }
638b9e67834SAndre Fischer }
639b9e67834SAndre Fischer 
640b9e67834SAndre Fischer 
641b9e67834SAndre Fischer 
642b9e67834SAndre Fischer 
643b9e67834SAndre Fischer void SAL_CALL Theme::addVetoableChangeListener(
644b9e67834SAndre Fischer     const ::rtl::OUString& rsPropertyName,
645b9e67834SAndre Fischer     const cssu::Reference<css::beans::XVetoableChangeListener>& rxListener)
646b9e67834SAndre Fischer     throw(css::beans::UnknownPropertyException,
647b9e67834SAndre Fischer         css::lang::WrappedTargetException,
648b9e67834SAndre Fischer         cssu::RuntimeException)
649b9e67834SAndre Fischer {
650b9e67834SAndre Fischer     ThemeItem eItem (__AnyItem);
651b9e67834SAndre Fischer     if (rsPropertyName.getLength() > 0)
652b9e67834SAndre Fischer     {
653b9e67834SAndre Fischer         PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
654b9e67834SAndre Fischer         if (iId == maPropertyNameToIdMap.end())
655b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
656b9e67834SAndre Fischer 
657b9e67834SAndre Fischer         const PropertyType eType (GetPropertyType(iId->second));
658b9e67834SAndre Fischer         if (eType == PT_Invalid)
659b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
660b9e67834SAndre Fischer 
661b9e67834SAndre Fischer         eItem = iId->second;
662b9e67834SAndre Fischer     }
663b9e67834SAndre Fischer     VetoableListenerContainer* pListeners = GetVetoableListeners(eItem, true);
664b9e67834SAndre Fischer     if (pListeners != NULL)
665b9e67834SAndre Fischer         pListeners->push_back(rxListener);
666b9e67834SAndre Fischer }
667b9e67834SAndre Fischer 
668b9e67834SAndre Fischer 
669b9e67834SAndre Fischer 
670b9e67834SAndre Fischer 
671b9e67834SAndre Fischer void SAL_CALL Theme::removeVetoableChangeListener(
672b9e67834SAndre Fischer     const ::rtl::OUString& rsPropertyName,
673b9e67834SAndre Fischer     const cssu::Reference<css::beans::XVetoableChangeListener>& rxListener)
674b9e67834SAndre Fischer     throw(css::beans::UnknownPropertyException,
675b9e67834SAndre Fischer         css::lang::WrappedTargetException,
676b9e67834SAndre Fischer         cssu::RuntimeException)
677b9e67834SAndre Fischer {
678b9e67834SAndre Fischer     ThemeItem eItem (__AnyItem);
679b9e67834SAndre Fischer     if (rsPropertyName.getLength() > 0)
680b9e67834SAndre Fischer     {
681b9e67834SAndre Fischer         PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
682b9e67834SAndre Fischer         if (iId == maPropertyNameToIdMap.end())
683b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
684b9e67834SAndre Fischer 
685b9e67834SAndre Fischer         const PropertyType eType (GetPropertyType(iId->second));
686b9e67834SAndre Fischer         if (eType == PT_Invalid)
687b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
688b9e67834SAndre Fischer 
689b9e67834SAndre Fischer         eItem = iId->second;
690b9e67834SAndre Fischer     }
691b9e67834SAndre Fischer     VetoableListenerContainer* pContainer = GetVetoableListeners(eItem, false);
692b9e67834SAndre Fischer     if (pContainer != NULL)
693b9e67834SAndre Fischer     {
694b9e67834SAndre Fischer         VetoableListenerContainer::iterator iListener (::std::find(pContainer->begin(), pContainer->end(), rxListener));
695b9e67834SAndre Fischer         if (iListener != pContainer->end())
696b9e67834SAndre Fischer         {
697b9e67834SAndre Fischer             pContainer->erase(iListener);
698b9e67834SAndre Fischer             // Remove container when empty.
699b9e67834SAndre Fischer             if (pContainer->empty())
700b9e67834SAndre Fischer                 maVetoableListeners.erase(eItem);
701b9e67834SAndre Fischer         }
702b9e67834SAndre Fischer     }
703b9e67834SAndre Fischer }
704b9e67834SAndre Fischer 
705b9e67834SAndre Fischer 
706b9e67834SAndre Fischer 
707b9e67834SAndre Fischer 
70895a18594SAndre Fischer cssu::Sequence<css::beans::Property> SAL_CALL Theme::getProperties (void)
70995a18594SAndre Fischer     throw(cssu::RuntimeException)
71095a18594SAndre Fischer {
71195a18594SAndre Fischer     ::std::vector<beans::Property> aProperties;
71295a18594SAndre Fischer 
71395a18594SAndre Fischer     for (sal_Int32 nItem(__Begin),nEnd(__End); nItem!=nEnd; ++nItem)
71495a18594SAndre Fischer     {
71595a18594SAndre Fischer         const ThemeItem eItem (static_cast<ThemeItem>(nItem));
71695a18594SAndre Fischer         const PropertyType eType (GetPropertyType(eItem));
71795a18594SAndre Fischer         if (eType == PT_Invalid)
71895a18594SAndre Fischer             continue;
71995a18594SAndre Fischer 
72095a18594SAndre Fischer         const beans::Property aProperty(
72195a18594SAndre Fischer             maPropertyIdToNameMap[eItem],
72295a18594SAndre Fischer             eItem,
72395a18594SAndre Fischer             GetCppuType(eType),
72495a18594SAndre Fischer             0);
72595a18594SAndre Fischer         aProperties.push_back(aProperty);
72695a18594SAndre Fischer     }
72795a18594SAndre Fischer 
72895a18594SAndre Fischer     return cssu::Sequence<css::beans::Property>(
72995a18594SAndre Fischer         &aProperties.front(),
73095a18594SAndre Fischer         aProperties.size());
73195a18594SAndre Fischer }
73295a18594SAndre Fischer 
73395a18594SAndre Fischer 
73495a18594SAndre Fischer 
73595a18594SAndre Fischer 
73695a18594SAndre Fischer beans::Property SAL_CALL Theme::getPropertyByName (const ::rtl::OUString& rsPropertyName)
73795a18594SAndre Fischer     throw(css::beans::UnknownPropertyException,
73895a18594SAndre Fischer         cssu::RuntimeException)
73995a18594SAndre Fischer {
74095a18594SAndre Fischer     PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
74195a18594SAndre Fischer     if (iId == maPropertyNameToIdMap.end())
74295a18594SAndre Fischer         throw beans::UnknownPropertyException();
74395a18594SAndre Fischer 
74495a18594SAndre Fischer     const PropertyType eType (GetPropertyType(iId->second));
74595a18594SAndre Fischer     if (eType == PT_Invalid)
74695a18594SAndre Fischer         throw beans::UnknownPropertyException();
74795a18594SAndre Fischer 
74895a18594SAndre Fischer     const ThemeItem eItem (iId->second);
74995a18594SAndre Fischer 
75095a18594SAndre Fischer     return beans::Property(
75195a18594SAndre Fischer         rsPropertyName,
75295a18594SAndre Fischer         eItem,
75395a18594SAndre Fischer         GetCppuType(eType),
75495a18594SAndre Fischer         0);
75595a18594SAndre Fischer }
75695a18594SAndre Fischer 
75795a18594SAndre Fischer 
75895a18594SAndre Fischer 
75995a18594SAndre Fischer 
76095a18594SAndre Fischer sal_Bool SAL_CALL Theme::hasPropertyByName (const ::rtl::OUString& rsPropertyName)
76195a18594SAndre Fischer     throw(cssu::RuntimeException)
76295a18594SAndre Fischer {
76395a18594SAndre Fischer     PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
76495a18594SAndre Fischer     if (iId == maPropertyNameToIdMap.end())
76595a18594SAndre Fischer         return sal_False;
76695a18594SAndre Fischer 
76795a18594SAndre Fischer     const PropertyType eType (GetPropertyType(iId->second));
76895a18594SAndre Fischer     if (eType == PT_Invalid)
76995a18594SAndre Fischer         return sal_False;
77095a18594SAndre Fischer 
77195a18594SAndre Fischer     return sal_True;
77295a18594SAndre Fischer }
77395a18594SAndre Fischer 
77495a18594SAndre Fischer 
77595a18594SAndre Fischer 
77695a18594SAndre Fischer 
777b9e67834SAndre Fischer void Theme::SetupPropertyMaps (void)
778b9e67834SAndre Fischer {
77995a18594SAndre Fischer     maPropertyIdToNameMap.resize(__Post_Rect);
780b9e67834SAndre Fischer     maImages.resize(__Image_Color - __Pre_Image - 1);
781b9e67834SAndre Fischer     maColors.resize(__Color_Paint - __Image_Color - 1);
782b9e67834SAndre Fischer     maPaints.resize(__Paint_Int - __Color_Paint - 1);
783b9e67834SAndre Fischer     maIntegers.resize(__Int_Bool - __Paint_Int - 1);
78495a18594SAndre Fischer     maBooleans.resize(__Bool_Rect - __Int_Bool - 1);
78595a18594SAndre Fischer     maRectangles.resize(__Post_Rect - __Bool_Rect - 1);
786b9e67834SAndre Fischer 
787b9e67834SAndre Fischer     #define AddEntry(e) maPropertyNameToIdMap[A2S(#e)]=e; maPropertyIdToNameMap[e]=A2S(#e)
78895a18594SAndre Fischer 
789b9e67834SAndre Fischer     AddEntry(Image_Grip);
790b9e67834SAndre Fischer     AddEntry(Image_Expand);
791b9e67834SAndre Fischer     AddEntry(Image_Collapse);
7927a32b0c8SAndre Fischer     AddEntry(Image_TabBarMenu);
7937a32b0c8SAndre Fischer     AddEntry(Image_PanelMenu);
79495a18594SAndre Fischer     AddEntry(Image_ToolBoxItemSeparator);
7957a32b0c8SAndre Fischer     AddEntry(Image_Closer);
796b9e67834SAndre Fischer 
797b9e67834SAndre Fischer     AddEntry(Color_DeckTitleFont);
798b9e67834SAndre Fischer     AddEntry(Color_PanelTitleFont);
799b9e67834SAndre Fischer     AddEntry(Color_TabMenuSeparator);
800b9e67834SAndre Fischer     AddEntry(Color_TabItemBorder);
801*8dcb2a10SAndre Fischer     AddEntry(Color_DropDownBorder);
802b9e67834SAndre Fischer 
803b9e67834SAndre Fischer     AddEntry(Paint_DeckBackground);
804b9e67834SAndre Fischer     AddEntry(Paint_DeckTitleBarBackground);
805b9e67834SAndre Fischer     AddEntry(Paint_PanelBackground);
806b9e67834SAndre Fischer     AddEntry(Paint_PanelTitleBarBackground);
807b9e67834SAndre Fischer     AddEntry(Paint_TabBarBackground);
80895a18594SAndre Fischer     AddEntry(Paint_TabItemBackgroundNormal);
80995a18594SAndre Fischer     AddEntry(Paint_TabItemBackgroundHighlight);
810b9e67834SAndre Fischer     AddEntry(Paint_HorizontalBorder);
811b9e67834SAndre Fischer     AddEntry(Paint_VerticalBorder);
81295a18594SAndre Fischer     AddEntry(Paint_ToolBoxBackground);
81395a18594SAndre Fischer     AddEntry(Paint_ToolBoxBorderTopLeft);
81495a18594SAndre Fischer     AddEntry(Paint_ToolBoxBorderCenterCorners);
81595a18594SAndre Fischer     AddEntry(Paint_ToolBoxBorderBottomRight);
816*8dcb2a10SAndre Fischer     AddEntry(Paint_DropDownBackground);
817b9e67834SAndre Fischer 
818b9e67834SAndre Fischer     AddEntry(Int_DeckTitleBarHeight);
819b9e67834SAndre Fischer     AddEntry(Int_DeckBorderSize);
820b9e67834SAndre Fischer     AddEntry(Int_DeckSeparatorHeight);
821b9e67834SAndre Fischer     AddEntry(Int_PanelTitleBarHeight);
822b9e67834SAndre Fischer     AddEntry(Int_TabMenuPadding);
823b9e67834SAndre Fischer     AddEntry(Int_TabMenuSeparatorPadding);
824b9e67834SAndre Fischer     AddEntry(Int_TabItemWidth);
825b9e67834SAndre Fischer     AddEntry(Int_TabItemHeight);
826b9e67834SAndre Fischer     AddEntry(Int_DeckLeftPadding);
827b9e67834SAndre Fischer     AddEntry(Int_DeckTopPadding);
828b9e67834SAndre Fischer     AddEntry(Int_DeckRightPadding);
829b9e67834SAndre Fischer     AddEntry(Int_DeckBottomPadding);
830b9e67834SAndre Fischer     AddEntry(Int_TabBarLeftPadding);
831b9e67834SAndre Fischer     AddEntry(Int_TabBarTopPadding);
832b9e67834SAndre Fischer     AddEntry(Int_TabBarRightPadding);
833b9e67834SAndre Fischer     AddEntry(Int_TabBarBottomPadding);
834b9e67834SAndre Fischer 
835b9e67834SAndre Fischer     AddEntry(Bool_UseSymphonyIcons);
83695a18594SAndre Fischer     AddEntry(Bool_UseSystemColors);
83795a18594SAndre Fischer     AddEntry(Bool_UseToolBoxItemSeparator);
83895a18594SAndre Fischer     AddEntry(Bool_IsHighContrastModeActive);
83995a18594SAndre Fischer 
84095a18594SAndre Fischer     AddEntry(Rect_ToolBoxPadding);
84195a18594SAndre Fischer     AddEntry(Rect_ToolBoxBorder);
84295a18594SAndre Fischer 
843b9e67834SAndre Fischer     #undef AddEntry
844b9e67834SAndre Fischer 
845b9e67834SAndre Fischer     maRawValues.resize(maPropertyIdToNameMap.size());
846b9e67834SAndre Fischer }
847b9e67834SAndre Fischer 
848b9e67834SAndre Fischer 
849b9e67834SAndre Fischer 
850b9e67834SAndre Fischer 
851b9e67834SAndre Fischer Theme::PropertyType Theme::GetPropertyType (const ThemeItem eItem)
852b9e67834SAndre Fischer {
853b9e67834SAndre Fischer     switch(eItem)
854b9e67834SAndre Fischer     {
855b9e67834SAndre Fischer         case Image_Grip:
856b9e67834SAndre Fischer         case Image_Expand:
857b9e67834SAndre Fischer         case Image_Collapse:
8587a32b0c8SAndre Fischer         case Image_TabBarMenu:
8597a32b0c8SAndre Fischer         case Image_PanelMenu:
86095a18594SAndre Fischer         case Image_ToolBoxItemSeparator:
8617a32b0c8SAndre Fischer         case Image_Closer:
862b9e67834SAndre Fischer             return PT_Image;
863b9e67834SAndre Fischer 
864b9e67834SAndre Fischer         case Color_DeckTitleFont:
865b9e67834SAndre Fischer         case Color_PanelTitleFont:
866b9e67834SAndre Fischer         case Color_TabMenuSeparator:
867b9e67834SAndre Fischer         case Color_TabItemBorder:
868*8dcb2a10SAndre Fischer         case Color_DropDownBorder:
869b9e67834SAndre Fischer             return PT_Color;
870b9e67834SAndre Fischer 
871b9e67834SAndre Fischer         case Paint_DeckBackground:
872b9e67834SAndre Fischer         case Paint_DeckTitleBarBackground:
873b9e67834SAndre Fischer         case Paint_PanelBackground:
874b9e67834SAndre Fischer         case Paint_PanelTitleBarBackground:
875b9e67834SAndre Fischer         case Paint_TabBarBackground:
87695a18594SAndre Fischer         case Paint_TabItemBackgroundNormal:
87795a18594SAndre Fischer         case Paint_TabItemBackgroundHighlight:
878b9e67834SAndre Fischer         case Paint_HorizontalBorder:
879b9e67834SAndre Fischer         case Paint_VerticalBorder:
88095a18594SAndre Fischer         case Paint_ToolBoxBackground:
88195a18594SAndre Fischer         case Paint_ToolBoxBorderTopLeft:
88295a18594SAndre Fischer         case Paint_ToolBoxBorderCenterCorners:
88395a18594SAndre Fischer         case Paint_ToolBoxBorderBottomRight:
884*8dcb2a10SAndre Fischer         case Paint_DropDownBackground:
885b9e67834SAndre Fischer             return PT_Paint;
886b9e67834SAndre Fischer 
887b9e67834SAndre Fischer         case Int_DeckTitleBarHeight:
888b9e67834SAndre Fischer         case Int_DeckBorderSize:
889b9e67834SAndre Fischer         case Int_DeckSeparatorHeight:
890b9e67834SAndre Fischer         case Int_PanelTitleBarHeight:
891b9e67834SAndre Fischer         case Int_TabMenuPadding:
892b9e67834SAndre Fischer         case Int_TabMenuSeparatorPadding:
893b9e67834SAndre Fischer         case Int_TabItemWidth:
894b9e67834SAndre Fischer         case Int_TabItemHeight:
895b9e67834SAndre Fischer         case Int_DeckLeftPadding:
896b9e67834SAndre Fischer         case Int_DeckTopPadding:
897b9e67834SAndre Fischer         case Int_DeckRightPadding:
898b9e67834SAndre Fischer         case Int_DeckBottomPadding:
899b9e67834SAndre Fischer         case Int_TabBarLeftPadding:
900b9e67834SAndre Fischer         case Int_TabBarTopPadding:
901b9e67834SAndre Fischer         case Int_TabBarRightPadding:
902b9e67834SAndre Fischer         case Int_TabBarBottomPadding:
903b9e67834SAndre Fischer             return PT_Integer;
904b9e67834SAndre Fischer 
905b9e67834SAndre Fischer         case Bool_UseSymphonyIcons:
90695a18594SAndre Fischer         case Bool_UseSystemColors:
90795a18594SAndre Fischer         case Bool_UseToolBoxItemSeparator:
90895a18594SAndre Fischer         case Bool_IsHighContrastModeActive:
909b9e67834SAndre Fischer             return PT_Boolean;
910b9e67834SAndre Fischer 
91195a18594SAndre Fischer         case Rect_ToolBoxBorder:
91295a18594SAndre Fischer         case Rect_ToolBoxPadding:
91395a18594SAndre Fischer             return PT_Rectangle;
91495a18594SAndre Fischer 
915b9e67834SAndre Fischer         default:
916b9e67834SAndre Fischer             return PT_Invalid;
917b9e67834SAndre Fischer     }
918b9e67834SAndre Fischer }
919b9e67834SAndre Fischer 
920b9e67834SAndre Fischer 
921b9e67834SAndre Fischer 
922b9e67834SAndre Fischer 
92395a18594SAndre Fischer cssu::Type Theme::GetCppuType (const PropertyType eType)
92495a18594SAndre Fischer {
92595a18594SAndre Fischer     switch(eType)
92695a18594SAndre Fischer     {
92795a18594SAndre Fischer         case PT_Image:
92895a18594SAndre Fischer             return getCppuType((rtl::OUString*)NULL);
92995a18594SAndre Fischer 
93095a18594SAndre Fischer         case PT_Color:
93195a18594SAndre Fischer             return getCppuType((sal_uInt32*)NULL);
93295a18594SAndre Fischer 
93395a18594SAndre Fischer         case PT_Paint:
93495a18594SAndre Fischer             return getCppuVoidType();
93595a18594SAndre Fischer 
93695a18594SAndre Fischer         case PT_Integer:
93795a18594SAndre Fischer             return getCppuType((sal_Int32*)NULL);
93895a18594SAndre Fischer 
93995a18594SAndre Fischer         case PT_Boolean:
94095a18594SAndre Fischer             return getCppuType((sal_Bool*)NULL);
94195a18594SAndre Fischer 
94295a18594SAndre Fischer         case PT_Rectangle:
94395a18594SAndre Fischer             return getCppuType((awt::Rectangle*)NULL);
94495a18594SAndre Fischer 
94595a18594SAndre Fischer         case PT_Invalid:
94695a18594SAndre Fischer         default:
94795a18594SAndre Fischer             return getCppuVoidType();
94895a18594SAndre Fischer     }
94995a18594SAndre Fischer }
95095a18594SAndre Fischer 
95195a18594SAndre Fischer 
95295a18594SAndre Fischer 
95395a18594SAndre Fischer 
954b9e67834SAndre Fischer sal_Int32 Theme::GetIndex (const ThemeItem eItem, const PropertyType eType)
955b9e67834SAndre Fischer {
956b9e67834SAndre Fischer     switch(eType)
957b9e67834SAndre Fischer     {
958b9e67834SAndre Fischer         case PT_Image:
959b9e67834SAndre Fischer             return eItem - __Pre_Image-1;
960b9e67834SAndre Fischer         case PT_Color:
961b9e67834SAndre Fischer             return eItem - __Image_Color-1;
962b9e67834SAndre Fischer         case PT_Paint:
963b9e67834SAndre Fischer             return eItem - __Color_Paint-1;
964b9e67834SAndre Fischer         case PT_Integer:
965b9e67834SAndre Fischer             return eItem - __Paint_Int-1;
966b9e67834SAndre Fischer         case PT_Boolean:
967b9e67834SAndre Fischer             return eItem - __Int_Bool-1;
96895a18594SAndre Fischer         case PT_Rectangle:
96995a18594SAndre Fischer             return eItem - __Bool_Rect-1;
970b9e67834SAndre Fischer 
971b9e67834SAndre Fischer         default:
972b9e67834SAndre Fischer             OSL_ASSERT(false);
973b9e67834SAndre Fischer             return 0;
974b9e67834SAndre Fischer     }
975b9e67834SAndre Fischer }
976b9e67834SAndre Fischer 
977b9e67834SAndre Fischer 
978b9e67834SAndre Fischer 
979b9e67834SAndre Fischer 
980b9e67834SAndre Fischer Theme::VetoableListenerContainer* Theme::GetVetoableListeners (
981b9e67834SAndre Fischer     const ThemeItem eItem,
982b9e67834SAndre Fischer     const bool bCreate)
983b9e67834SAndre Fischer {
984b9e67834SAndre Fischer     VetoableListeners::iterator iContainer (maVetoableListeners.find(eItem));
985b9e67834SAndre Fischer     if (iContainer != maVetoableListeners.end())
986b9e67834SAndre Fischer         return &iContainer->second;
987b9e67834SAndre Fischer     else if (bCreate)
988b9e67834SAndre Fischer     {
989b9e67834SAndre Fischer         maVetoableListeners[eItem] = VetoableListenerContainer();
990b9e67834SAndre Fischer         return &maVetoableListeners[eItem];
991b9e67834SAndre Fischer     }
992b9e67834SAndre Fischer     else
993b9e67834SAndre Fischer         return NULL;
994b9e67834SAndre Fischer }
995b9e67834SAndre Fischer 
996b9e67834SAndre Fischer 
997b9e67834SAndre Fischer 
998b9e67834SAndre Fischer 
999b9e67834SAndre Fischer Theme::ChangeListenerContainer* Theme::GetChangeListeners (
1000b9e67834SAndre Fischer     const ThemeItem eItem,
1001b9e67834SAndre Fischer     const bool bCreate)
1002b9e67834SAndre Fischer {
1003b9e67834SAndre Fischer     ChangeListeners::iterator iContainer (maChangeListeners.find(eItem));
1004b9e67834SAndre Fischer     if (iContainer != maChangeListeners.end())
1005b9e67834SAndre Fischer         return &iContainer->second;
1006b9e67834SAndre Fischer     else if (bCreate)
1007b9e67834SAndre Fischer     {
1008b9e67834SAndre Fischer         maChangeListeners[eItem] = ChangeListenerContainer();
1009b9e67834SAndre Fischer         return &maChangeListeners[eItem];
1010b9e67834SAndre Fischer     }
1011b9e67834SAndre Fischer     else
1012b9e67834SAndre Fischer         return NULL;
1013b9e67834SAndre Fischer }
1014b9e67834SAndre Fischer 
1015b9e67834SAndre Fischer 
1016b9e67834SAndre Fischer 
1017b9e67834SAndre Fischer 
1018b9e67834SAndre Fischer bool Theme::DoVetoableListenersVeto (
1019b9e67834SAndre Fischer     const VetoableListenerContainer* pListeners,
1020b9e67834SAndre Fischer     const beans::PropertyChangeEvent& rEvent) const
1021b9e67834SAndre Fischer {
1022b9e67834SAndre Fischer     if (pListeners == NULL)
1023b9e67834SAndre Fischer         return false;
1024b9e67834SAndre Fischer 
1025b9e67834SAndre Fischer     VetoableListenerContainer aListeners (*pListeners);
1026b9e67834SAndre Fischer     try
1027b9e67834SAndre Fischer     {
1028b9e67834SAndre Fischer         for (VetoableListenerContainer::const_iterator
1029b9e67834SAndre Fischer                  iListener(aListeners.begin()),
1030b9e67834SAndre Fischer                  iEnd(aListeners.end());
1031b9e67834SAndre Fischer              iListener!=iEnd;
1032b9e67834SAndre Fischer              ++iListener)
1033b9e67834SAndre Fischer         {
1034b9e67834SAndre Fischer             (*iListener)->vetoableChange(rEvent);
1035b9e67834SAndre Fischer         }
1036b9e67834SAndre Fischer     }
1037b9e67834SAndre Fischer     catch(const beans::PropertyVetoException&)
1038b9e67834SAndre Fischer     {
1039b9e67834SAndre Fischer         return true;
1040b9e67834SAndre Fischer     }
1041b9e67834SAndre Fischer     catch(const Exception&)
1042b9e67834SAndre Fischer     {
1043b9e67834SAndre Fischer         // Ignore any other errors (such as disposed listeners).
1044b9e67834SAndre Fischer     }
1045b9e67834SAndre Fischer     return false;
1046b9e67834SAndre Fischer }
1047b9e67834SAndre Fischer 
1048b9e67834SAndre Fischer 
1049b9e67834SAndre Fischer 
1050b9e67834SAndre Fischer 
1051b9e67834SAndre Fischer void Theme::BroadcastPropertyChange (
1052b9e67834SAndre Fischer     const ChangeListenerContainer* pListeners,
1053b9e67834SAndre Fischer     const beans::PropertyChangeEvent& rEvent) const
1054b9e67834SAndre Fischer {
1055b9e67834SAndre Fischer     if (pListeners == NULL)
1056b9e67834SAndre Fischer         return;
1057b9e67834SAndre Fischer 
1058b9e67834SAndre Fischer     const ChangeListenerContainer aListeners (*pListeners);
1059b9e67834SAndre Fischer     try
1060b9e67834SAndre Fischer     {
1061b9e67834SAndre Fischer         for (ChangeListenerContainer::const_iterator
1062b9e67834SAndre Fischer                  iListener(aListeners.begin()),
1063b9e67834SAndre Fischer                  iEnd(aListeners.end());
1064b9e67834SAndre Fischer              iListener!=iEnd;
1065b9e67834SAndre Fischer              ++iListener)
1066b9e67834SAndre Fischer         {
1067b9e67834SAndre Fischer             (*iListener)->propertyChange(rEvent);
1068b9e67834SAndre Fischer         }
1069b9e67834SAndre Fischer     }
1070b9e67834SAndre Fischer     catch(const Exception&)
1071b9e67834SAndre Fischer     {
1072b9e67834SAndre Fischer         // Ignore any errors (such as disposed listeners).
1073b9e67834SAndre Fischer     }
1074b9e67834SAndre Fischer }
1075b9e67834SAndre Fischer 
1076b9e67834SAndre Fischer 
1077b9e67834SAndre Fischer 
1078b9e67834SAndre Fischer 
1079b9e67834SAndre Fischer void Theme::ProcessNewValue (
1080b9e67834SAndre Fischer     const Any& rValue,
1081b9e67834SAndre Fischer     const ThemeItem eItem,
1082b9e67834SAndre Fischer     const PropertyType eType)
1083b9e67834SAndre Fischer {
1084b9e67834SAndre Fischer     const sal_Int32 nIndex (GetIndex (eItem, eType));
1085b9e67834SAndre Fischer     switch (eType)
1086b9e67834SAndre Fischer     {
1087b9e67834SAndre Fischer         case PT_Image:
1088b9e67834SAndre Fischer         {
1089b9e67834SAndre Fischer             ::rtl::OUString sURL;
1090b9e67834SAndre Fischer             if (rValue >>= sURL)
1091b9e67834SAndre Fischer             {
1092b9e67834SAndre Fischer                 maImages[nIndex] = Tools::GetImage(sURL, NULL);
1093b9e67834SAndre Fischer             }
1094b9e67834SAndre Fischer             break;
1095b9e67834SAndre Fischer         }
1096b9e67834SAndre Fischer         case PT_Color:
1097b9e67834SAndre Fischer         {
109895a18594SAndre Fischer             sal_Int32 nColorValue (0);
1099b9e67834SAndre Fischer             if (rValue >>= nColorValue)
1100b9e67834SAndre Fischer             {
1101b9e67834SAndre Fischer                 maColors[nIndex] = Color(nColorValue);
1102b9e67834SAndre Fischer             }
1103b9e67834SAndre Fischer             break;
1104b9e67834SAndre Fischer         }
1105b9e67834SAndre Fischer         case PT_Paint:
1106b9e67834SAndre Fischer         {
110795a18594SAndre Fischer             maPaints[nIndex] = Paint::Create(rValue);
1108b9e67834SAndre Fischer             break;
1109b9e67834SAndre Fischer         }
1110b9e67834SAndre Fischer         case PT_Integer:
1111b9e67834SAndre Fischer         {
111295a18594SAndre Fischer             sal_Int32 nValue (0);
1113b9e67834SAndre Fischer             if (rValue >>= nValue)
1114b9e67834SAndre Fischer             {
1115b9e67834SAndre Fischer                 maIntegers[nIndex] = nValue;
1116b9e67834SAndre Fischer             }
1117b9e67834SAndre Fischer             break;
1118b9e67834SAndre Fischer         }
1119b9e67834SAndre Fischer         case PT_Boolean:
1120b9e67834SAndre Fischer         {
112195a18594SAndre Fischer             sal_Bool nValue (0);
1122b9e67834SAndre Fischer             if (rValue >>= nValue)
1123b9e67834SAndre Fischer             {
1124b9e67834SAndre Fischer                 maBooleans[nIndex] = (nValue==sal_True);
112595a18594SAndre Fischer                 if (eItem == Bool_IsHighContrastModeActive)
112695a18594SAndre Fischer                 {
112795a18594SAndre Fischer                     mbIsHighContrastModeSetManually = true;
112895a18594SAndre Fischer                     mbIsHighContrastMode = maBooleans[nIndex];
112995a18594SAndre Fischer                     HandleDataChange();
113095a18594SAndre Fischer                 }
113195a18594SAndre Fischer                 else if (eItem == Bool_UseSystemColors)
113295a18594SAndre Fischer                 {
113395a18594SAndre Fischer                     HandleDataChange();
113495a18594SAndre Fischer                 }
113595a18594SAndre Fischer             }
113695a18594SAndre Fischer             break;
113795a18594SAndre Fischer         }
113895a18594SAndre Fischer         case PT_Rectangle:
113995a18594SAndre Fischer         {
114095a18594SAndre Fischer             awt::Rectangle aBox;
114195a18594SAndre Fischer             if (rValue >>= aBox)
114295a18594SAndre Fischer             {
114395a18594SAndre Fischer                 maRectangles[nIndex] = Rectangle(
114495a18594SAndre Fischer                     aBox.X,
114595a18594SAndre Fischer                     aBox.Y,
114695a18594SAndre Fischer                     aBox.Width,
114795a18594SAndre Fischer                     aBox.Height);
1148b9e67834SAndre Fischer             }
1149b9e67834SAndre Fischer             break;
1150b9e67834SAndre Fischer         }
1151b9e67834SAndre Fischer         case PT_Invalid:
1152b9e67834SAndre Fischer             OSL_ASSERT(eType != PT_Invalid);
1153b9e67834SAndre Fischer             throw RuntimeException();
1154b9e67834SAndre Fischer     }
1155b9e67834SAndre Fischer }
1156b9e67834SAndre Fischer 
1157b9e67834SAndre Fischer 
1158b9e67834SAndre Fischer 
1159ff12d537SAndre Fischer 
1160ff12d537SAndre Fischer } } // end of namespace sfx2::sidebar
1161