xref: /trunk/main/sfx2/source/sidebar/Theme.cxx (revision 38b885b74d08288e2136f990676957bd24aa340d)
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"
27f35c6d02SAndre Fischer #include "sfx2/sidebar/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 namespace sfx2 { namespace sidebar {
37ff12d537SAndre Fischer 
38b9e67834SAndre Fischer ::rtl::Reference<Theme> Theme::mpInstance;
39ff12d537SAndre Fischer 
GetCurrentTheme(void)40b9e67834SAndre Fischer Theme& Theme::GetCurrentTheme (void)
41ff12d537SAndre Fischer {
42b9e67834SAndre Fischer     if ( ! mpInstance.is())
43ff12d537SAndre Fischer     {
44b9e67834SAndre Fischer         mpInstance.set(new Theme());
45b9e67834SAndre Fischer         mpInstance->InitializeTheme();
46ff12d537SAndre Fischer     }
47b9e67834SAndre Fischer     return *mpInstance;
48ff12d537SAndre Fischer }
49ff12d537SAndre Fischer 
Theme(void)50b9e67834SAndre Fischer Theme::Theme (void)
51b9e67834SAndre Fischer     : ThemeInterfaceBase(m_aMutex),
52b9e67834SAndre Fischer       maImages(),
53b9e67834SAndre Fischer       maColors(),
54b9e67834SAndre Fischer       maPaints(),
55b9e67834SAndre Fischer       maIntegers(),
56b9e67834SAndre Fischer       maBooleans(),
57b9e67834SAndre Fischer       mbIsHighContrastMode(Application::GetSettings().GetStyleSettings().GetHighContrastMode()),
5895a18594SAndre Fischer       mbIsHighContrastModeSetManually(false),
59b9e67834SAndre Fischer       maPropertyNameToIdMap(),
60b9e67834SAndre Fischer       maPropertyIdToNameMap(),
61b9e67834SAndre Fischer       maRawValues(),
62b9e67834SAndre Fischer       maChangeListeners(),
63b9e67834SAndre Fischer       maVetoableListeners()
64b9e67834SAndre Fischer 
65ff12d537SAndre Fischer {
66b9e67834SAndre Fischer     SetupPropertyMaps();
67ff12d537SAndre Fischer }
68ff12d537SAndre Fischer 
~Theme(void)69b9e67834SAndre Fischer Theme::~Theme (void)
70ff12d537SAndre Fischer {
71ff12d537SAndre Fischer }
72ff12d537SAndre Fischer 
GetImage(const ThemeItem eItem)73b9e67834SAndre Fischer Image Theme::GetImage (const ThemeItem eItem)
74ff12d537SAndre Fischer {
75b9e67834SAndre Fischer     const PropertyType eType (GetPropertyType(eItem));
76b9e67834SAndre Fischer     OSL_ASSERT(eType==PT_Image);
77b9e67834SAndre Fischer     const sal_Int32 nIndex (GetIndex(eItem, eType));
78b9e67834SAndre Fischer     const Theme& rTheme (GetCurrentTheme());
79b9e67834SAndre Fischer     return rTheme.maImages[nIndex];
80ff12d537SAndre Fischer }
81ff12d537SAndre Fischer 
GetColor(const ThemeItem eItem)82b9e67834SAndre Fischer Color Theme::GetColor (const ThemeItem eItem)
83ff12d537SAndre Fischer {
84b9e67834SAndre Fischer     const PropertyType eType (GetPropertyType(eItem));
858dcb2a10SAndre Fischer     OSL_ASSERT(eType==PT_Color || eType==PT_Paint);
86b9e67834SAndre Fischer     const sal_Int32 nIndex (GetIndex(eItem, eType));
87b9e67834SAndre Fischer     const Theme& rTheme (GetCurrentTheme());
888dcb2a10SAndre Fischer     if (eType == PT_Color)
89b9e67834SAndre Fischer         return rTheme.maColors[nIndex];
908dcb2a10SAndre Fischer     else if (eType == PT_Paint)
918dcb2a10SAndre Fischer         return rTheme.maPaints[nIndex].GetColor();
92f120fe41SAndre Fischer     else
93f120fe41SAndre Fischer         return COL_WHITE;
94ff12d537SAndre Fischer }
95ff12d537SAndre Fischer 
GetPaint(const ThemeItem eItem)96b9e67834SAndre Fischer const Paint& Theme::GetPaint (const ThemeItem eItem)
97ff12d537SAndre Fischer {
98b9e67834SAndre Fischer     const PropertyType eType (GetPropertyType(eItem));
99b9e67834SAndre Fischer     OSL_ASSERT(eType==PT_Paint);
100b9e67834SAndre Fischer     const sal_Int32 nIndex (GetIndex(eItem, eType));
101b9e67834SAndre Fischer     const Theme& rTheme (GetCurrentTheme());
102b9e67834SAndre Fischer     return rTheme.maPaints[nIndex];
103ff12d537SAndre Fischer }
104ff12d537SAndre Fischer 
GetWallpaper(const ThemeItem eItem)1057a32b0c8SAndre Fischer const Wallpaper Theme::GetWallpaper (const ThemeItem eItem)
1067a32b0c8SAndre Fischer {
1077a32b0c8SAndre Fischer     return GetPaint(eItem).GetWallpaper();
1087a32b0c8SAndre Fischer }
1097a32b0c8SAndre Fischer 
GetInteger(const ThemeItem eItem)110b9e67834SAndre Fischer sal_Int32 Theme::GetInteger (const ThemeItem eItem)
111ff12d537SAndre Fischer {
112b9e67834SAndre Fischer     const PropertyType eType (GetPropertyType(eItem));
113b9e67834SAndre Fischer     OSL_ASSERT(eType==PT_Integer);
114b9e67834SAndre Fischer     const sal_Int32 nIndex (GetIndex(eItem, eType));
115b9e67834SAndre Fischer     const Theme& rTheme (GetCurrentTheme());
116b9e67834SAndre Fischer     return rTheme.maIntegers[nIndex];
117ff12d537SAndre Fischer }
118ff12d537SAndre Fischer 
GetBoolean(const ThemeItem eItem)119b9e67834SAndre Fischer bool Theme::GetBoolean (const ThemeItem eItem)
120ff12d537SAndre Fischer {
121b9e67834SAndre Fischer     const PropertyType eType (GetPropertyType(eItem));
122b9e67834SAndre Fischer     OSL_ASSERT(eType==PT_Boolean);
123b9e67834SAndre Fischer     const sal_Int32 nIndex (GetIndex(eItem, eType));
124b9e67834SAndre Fischer     const Theme& rTheme (GetCurrentTheme());
125b9e67834SAndre Fischer     return rTheme.maBooleans[nIndex];
126ff12d537SAndre Fischer }
127ff12d537SAndre Fischer 
GetRectangle(const ThemeItem eItem)12895a18594SAndre Fischer Rectangle Theme::GetRectangle (const ThemeItem eItem)
12995a18594SAndre Fischer {
13095a18594SAndre Fischer     const PropertyType eType (GetPropertyType(eItem));
13195a18594SAndre Fischer     OSL_ASSERT(eType==PT_Rectangle);
13295a18594SAndre Fischer     const sal_Int32 nIndex (GetIndex(eItem, eType));
13395a18594SAndre Fischer     const Theme& rTheme (GetCurrentTheme());
13495a18594SAndre Fischer     return rTheme.maRectangles[nIndex];
13595a18594SAndre Fischer }
13695a18594SAndre Fischer 
IsHighContrastMode(void)137ff12d537SAndre Fischer bool Theme::IsHighContrastMode (void)
138ff12d537SAndre Fischer {
139b9e67834SAndre Fischer     const Theme& rTheme (GetCurrentTheme());
140b9e67834SAndre Fischer     return rTheme.mbIsHighContrastMode;
141ff12d537SAndre Fischer }
142ff12d537SAndre Fischer 
HandleDataChange(void)143ff12d537SAndre Fischer void Theme::HandleDataChange (void)
144ff12d537SAndre Fischer {
14595a18594SAndre Fischer     Theme& rTheme (GetCurrentTheme());
14695a18594SAndre Fischer 
14795a18594SAndre Fischer     if ( ! rTheme.mbIsHighContrastModeSetManually)
14895a18594SAndre Fischer     {
14995a18594SAndre Fischer         // Do not modify mbIsHighContrastMode when it was manually set.
150b9e67834SAndre Fischer         GetCurrentTheme().mbIsHighContrastMode = Application::GetSettings().GetStyleSettings().GetHighContrastMode();
15195a18594SAndre Fischer         rTheme.maRawValues[Bool_IsHighContrastModeActive] = Any(GetCurrentTheme().mbIsHighContrastMode);
15295a18594SAndre Fischer     }
15395a18594SAndre Fischer 
15495a18594SAndre Fischer     GetCurrentTheme().UpdateTheme();
155ff12d537SAndre Fischer }
156ff12d537SAndre Fischer 
InitializeTheme(void)157b9e67834SAndre Fischer void Theme::InitializeTheme (void)
158ff12d537SAndre Fischer {
15995a18594SAndre Fischer     setPropertyValue(
16095a18594SAndre Fischer         maPropertyIdToNameMap[Bool_UseSymphonyIcons],
1610d805bddSAndre Fischer         Any(false));
16295a18594SAndre Fischer     setPropertyValue(
16395a18594SAndre Fischer         maPropertyIdToNameMap[Bool_UseSystemColors],
16495a18594SAndre Fischer         Any(false));
16595a18594SAndre Fischer }
16695a18594SAndre Fischer 
UpdateTheme(void)16795a18594SAndre Fischer void Theme::UpdateTheme (void)
16895a18594SAndre Fischer {
169ff12d537SAndre Fischer     SidebarResource aLocalResource;
170ff12d537SAndre Fischer 
171b9e67834SAndre Fischer     try
172b9e67834SAndre Fischer     {
17395a18594SAndre Fischer         const StyleSettings& rStyle (Application::GetSettings().GetStyleSettings());
17495a18594SAndre Fischer         const bool bUseSystemColors (GetBoolean(Bool_UseSystemColors));
17595a18594SAndre Fischer 
17695a18594SAndre Fischer #define Alternatives(n,hc,sys) (mbIsHighContrastMode ? hc : (bUseSystemColors ? sys : n))
17795a18594SAndre Fischer 
178df0345d7SAndre Fischer         Color aBaseBackgroundColor (rStyle.GetDialogColor());
179df0345d7SAndre Fischer         // UX says this should be a little brighter, but that looks off when compared to the other windows.
180df0345d7SAndre Fischer         //aBaseBackgroundColor.IncreaseLuminance(7);
1818dcb2a10SAndre Fischer         Color aBorderColor (aBaseBackgroundColor);
1825e7464b8Smseidel         aBorderColor.DecreaseLuminance(80);
1838dcb2a10SAndre Fischer         Color aSecondColor (aBaseBackgroundColor);
1845e7464b8Smseidel         aSecondColor.DecreaseLuminance(0);
1858dcb2a10SAndre Fischer 
186b9e67834SAndre Fischer         setPropertyValue(
187b9e67834SAndre Fischer             maPropertyIdToNameMap[Paint_DeckBackground],
188df0345d7SAndre Fischer             Any(sal_Int32(aBaseBackgroundColor.GetRGBColor())));
18995a18594SAndre Fischer 
190b9e67834SAndre Fischer         setPropertyValue(
191b9e67834SAndre Fischer             maPropertyIdToNameMap[Paint_DeckTitleBarBackground],
1928dcb2a10SAndre Fischer             Any(sal_Int32(aBaseBackgroundColor.GetRGBColor())));
193b9e67834SAndre Fischer         setPropertyValue(
194b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_DeckLeftPadding],
195b9e67834SAndre Fischer             Any(sal_Int32(2)));
196b9e67834SAndre Fischer         setPropertyValue(
197b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_DeckTopPadding],
198b9e67834SAndre Fischer             Any(sal_Int32(2)));
199b9e67834SAndre Fischer         setPropertyValue(
200b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_DeckRightPadding],
201b9e67834SAndre Fischer             Any(sal_Int32(2)));
202b9e67834SAndre Fischer         setPropertyValue(
203b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_DeckBottomPadding],
204b9e67834SAndre Fischer             Any(sal_Int32(2)));
205b9e67834SAndre Fischer         setPropertyValue(
206b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_DeckBorderSize],
207b9e67834SAndre Fischer             Any(sal_Int32(1)));
208b9e67834SAndre Fischer         setPropertyValue(
209b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_DeckSeparatorHeight],
210b9e67834SAndre Fischer             Any(sal_Int32(1)));
211b9e67834SAndre Fischer         setPropertyValue(
21237fee4fdSAndre Fischer             maPropertyIdToNameMap[Int_ButtonCornerRadius],
21337fee4fdSAndre Fischer             Any(sal_Int32(3)));
21437fee4fdSAndre Fischer         setPropertyValue(
215b9e67834SAndre Fischer             maPropertyIdToNameMap[Color_DeckTitleFont],
2166026f80cSmseidel             Any(sal_Int32(mbIsHighContrastMode ? 0xffffff : 0x262626)));
217b9e67834SAndre Fischer         setPropertyValue(
218b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_DeckTitleBarHeight],
21995a18594SAndre Fischer             Any(sal_Int32(Alternatives(
22095a18594SAndre Fischer                         26,
22195a18594SAndre Fischer                         26,
22295a18594SAndre Fischer                         rStyle.GetFloatTitleHeight()))));
223b9e67834SAndre Fischer         setPropertyValue(
224b9e67834SAndre Fischer             maPropertyIdToNameMap[Paint_PanelBackground],
225df0345d7SAndre Fischer             Any(sal_Int32(aBaseBackgroundColor.GetRGBColor())));
2268dcb2a10SAndre Fischer 
227b9e67834SAndre Fischer         setPropertyValue(
228b9e67834SAndre Fischer             maPropertyIdToNameMap[Paint_PanelTitleBarBackground],
2298dcb2a10SAndre Fischer             Any(Tools::VclToAwtGradient(Gradient(
2308dcb2a10SAndre Fischer                         GRADIENT_LINEAR,
2318dcb2a10SAndre Fischer                         aSecondColor.GetRGBColor(),
2328dcb2a10SAndre Fischer                         aBaseBackgroundColor.GetRGBColor()
2338dcb2a10SAndre Fischer                         ))));
234b9e67834SAndre Fischer         setPropertyValue(
235b9e67834SAndre Fischer             maPropertyIdToNameMap[Color_PanelTitleFont],
236b9e67834SAndre Fischer             Any(sal_Int32(mbIsHighContrastMode ? 0x00ff00 : 0x262626)));
237b9e67834SAndre Fischer         setPropertyValue(
238b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_PanelTitleBarHeight],
23995a18594SAndre Fischer             Any(sal_Int32(Alternatives(
24095a18594SAndre Fischer                         26,
24195a18594SAndre Fischer                         26,
24295a18594SAndre Fischer                         rStyle.GetTitleHeight()))));
243b9e67834SAndre Fischer         setPropertyValue(
244b9e67834SAndre Fischer             maPropertyIdToNameMap[Paint_TabBarBackground],
2458dcb2a10SAndre Fischer             Any(sal_Int32(aBaseBackgroundColor.GetRGBColor())));
246b9e67834SAndre Fischer         setPropertyValue(
247b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_TabBarLeftPadding],
248b9e67834SAndre Fischer             Any(sal_Int32(2)));
249b9e67834SAndre Fischer         setPropertyValue(
250b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_TabBarTopPadding],
251b9e67834SAndre Fischer             Any(sal_Int32(2)));
252b9e67834SAndre Fischer         setPropertyValue(
253b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_TabBarRightPadding],
254b9e67834SAndre Fischer             Any(sal_Int32(2)));
255b9e67834SAndre Fischer         setPropertyValue(
256b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_TabBarBottomPadding],
257b9e67834SAndre Fischer             Any(sal_Int32(2)));
258ff12d537SAndre Fischer 
259b9e67834SAndre Fischer         setPropertyValue(
260b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_TabMenuPadding],
261b9e67834SAndre Fischer             Any(sal_Int32(6)));
262b9e67834SAndre Fischer         setPropertyValue(
263b9e67834SAndre Fischer             maPropertyIdToNameMap[Color_TabMenuSeparator],
2648dcb2a10SAndre Fischer             Any(sal_Int32(aBorderColor.GetRGBColor())));
265b9e67834SAndre Fischer         setPropertyValue(
266b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_TabMenuSeparatorPadding],
267b9e67834SAndre Fischer             Any(sal_Int32(7)));
268ff12d537SAndre Fischer 
269b9e67834SAndre Fischer         setPropertyValue(
270b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_TabItemWidth],
271b9e67834SAndre Fischer             Any(sal_Int32(32)));
272b9e67834SAndre Fischer         setPropertyValue(
273b9e67834SAndre Fischer             maPropertyIdToNameMap[Int_TabItemHeight],
274b9e67834SAndre Fischer             Any(sal_Int32(32)));
275b9e67834SAndre Fischer         setPropertyValue(
276b9e67834SAndre Fischer             maPropertyIdToNameMap[Color_TabItemBorder],
2778dcb2a10SAndre Fischer             Any(sal_Int32(rStyle.GetActiveBorderColor().GetRGBColor())));
2788dcb2a10SAndre Fischer         //                  mbIsHighContrastMode ? 0x00ff00 : 0xbfbfbf)));
2798dcb2a10SAndre Fischer 
2808dcb2a10SAndre Fischer         setPropertyValue(
2818dcb2a10SAndre Fischer             maPropertyIdToNameMap[Paint_DropDownBackground],
2828dcb2a10SAndre Fischer             Any(sal_Int32(aBaseBackgroundColor.GetRGBColor())));
2838dcb2a10SAndre Fischer         setPropertyValue(
2848dcb2a10SAndre Fischer             maPropertyIdToNameMap[Color_DropDownBorder],
2858dcb2a10SAndre Fischer             Any(sal_Int32(rStyle.GetActiveBorderColor().GetRGBColor())));
2868dcb2a10SAndre Fischer 
287b9e67834SAndre Fischer         setPropertyValue(
2885f1c83ffSOliver-Rainer Wittmann             maPropertyIdToNameMap[Color_Highlight],
2895f1c83ffSOliver-Rainer Wittmann             Any(sal_Int32(rStyle.GetHighlightColor().GetRGBColor())));
2905f1c83ffSOliver-Rainer Wittmann         setPropertyValue(
2915f1c83ffSOliver-Rainer Wittmann             maPropertyIdToNameMap[Color_HighlightText],
2925f1c83ffSOliver-Rainer Wittmann             Any(sal_Int32(rStyle.GetHighlightTextColor().GetRGBColor())));
2935f1c83ffSOliver-Rainer Wittmann 
2945f1c83ffSOliver-Rainer Wittmann         setPropertyValue(
29595a18594SAndre Fischer             maPropertyIdToNameMap[Paint_TabItemBackgroundNormal],
29695a18594SAndre Fischer             Any());
29795a18594SAndre Fischer         setPropertyValue(
29895a18594SAndre Fischer             maPropertyIdToNameMap[Paint_TabItemBackgroundHighlight],
2998dcb2a10SAndre Fischer             Any(sal_Int32(rStyle.GetActiveTabColor().GetRGBColor())));
3008dcb2a10SAndre Fischer         //                  mbIsHighContrastMode ? 0x000000 : 0x00ffffff)));
301ff12d537SAndre Fischer 
302b9e67834SAndre Fischer         setPropertyValue(
303b9e67834SAndre Fischer             maPropertyIdToNameMap[Paint_HorizontalBorder],
3048dcb2a10SAndre Fischer             Any(sal_Int32(aBorderColor.GetRGBColor())));
3058dcb2a10SAndre Fischer         //                  mbIsHighContrastMode ? 0x00ff00 : 0xe4e4e4)));
306b9e67834SAndre Fischer         setPropertyValue(
307b9e67834SAndre Fischer             maPropertyIdToNameMap[Paint_VerticalBorder],
3088dcb2a10SAndre Fischer             Any(sal_Int32(aBorderColor.GetRGBColor())));
3098dcb2a10SAndre Fischer         //                  mbIsHighContrastMode ? 0x00ff00 : 0xe4e4e4)));
310ff12d537SAndre Fischer 
311b9e67834SAndre Fischer         setPropertyValue(
312b9e67834SAndre Fischer             maPropertyIdToNameMap[Image_Grip],
313b9e67834SAndre Fischer             Any(
314b9e67834SAndre Fischer                 mbIsHighContrastMode
315b9e67834SAndre Fischer                     ? A2S("private:graphicrepository/sfx2/res/grip_hc.png")
316b9e67834SAndre Fischer                     : A2S("private:graphicrepository/sfx2/res/grip.png")));
317b9e67834SAndre Fischer         setPropertyValue(
318b9e67834SAndre Fischer             maPropertyIdToNameMap[Image_Expand],
319b9e67834SAndre Fischer             Any(
320b9e67834SAndre Fischer                 mbIsHighContrastMode
3216e6252f3SAndre Fischer                     ? A2S("private:graphicrepository/res/plus_sch.png")
3226e6252f3SAndre Fischer                     : A2S("private:graphicrepository/res/plus.png")));
323b9e67834SAndre Fischer         setPropertyValue(
324b9e67834SAndre Fischer             maPropertyIdToNameMap[Image_Collapse],
325b9e67834SAndre Fischer             Any(
326b9e67834SAndre Fischer                 mbIsHighContrastMode
3276e6252f3SAndre Fischer                     ? A2S("private:graphicrepository/res/minus_sch.png")
3286e6252f3SAndre Fischer                     : A2S("private:graphicrepository/res/minus.png")));
329b9e67834SAndre Fischer         setPropertyValue(
3307a32b0c8SAndre Fischer             maPropertyIdToNameMap[Image_TabBarMenu],
331b9e67834SAndre Fischer             Any(
332b9e67834SAndre Fischer                 mbIsHighContrastMode
333*38b885b7SMatthias Seidel                     ? A2S("private:graphicrepository/sfx2/res/sidebar/open_more_hc.png")
334*38b885b7SMatthias Seidel                     : A2S("private:graphicrepository/sfx2/res/sidebar/open_more.png")));
335b9e67834SAndre Fischer         setPropertyValue(
3367a32b0c8SAndre Fischer             maPropertyIdToNameMap[Image_PanelMenu],
3377a32b0c8SAndre Fischer             Any(
3387a32b0c8SAndre Fischer                 mbIsHighContrastMode
339*38b885b7SMatthias Seidel                     ? A2S("private:graphicrepository/sfx2/res/sidebar/morebutton_h.png")
340*38b885b7SMatthias Seidel                     : A2S("private:graphicrepository/sfx2/res/sidebar/morebutton.png")));
3417a32b0c8SAndre Fischer         setPropertyValue(
3427a32b0c8SAndre Fischer             maPropertyIdToNameMap[Image_Closer],
3433b2139dbSMatthias Seidel             Any(
3443b2139dbSMatthias Seidel                 mbIsHighContrastMode
3453b2139dbSMatthias Seidel                     ? A2S("private:graphicrepository/sfx2/res/closedochc.png")
3463b2139dbSMatthias Seidel                     : A2S("private:graphicrepository/sfx2/res/closedoc.png")));
3477a32b0c8SAndre Fischer         setPropertyValue(
34813e1c3b4SAndre Fischer             maPropertyIdToNameMap[Image_CloseIndicator],
34913e1c3b4SAndre Fischer             Any(
35013e1c3b4SAndre Fischer                 mbIsHighContrastMode
35113e1c3b4SAndre Fischer                     ? A2S("private:graphicrepository/res/commandimagelist/lch_decrementlevel.png")
35213e1c3b4SAndre Fischer                     : A2S("private:graphicrepository/res/commandimagelist/lc_decrementlevel.png")));
35313e1c3b4SAndre Fischer         setPropertyValue(
35495a18594SAndre Fischer             maPropertyIdToNameMap[Image_ToolBoxItemSeparator],
35595a18594SAndre Fischer             Any(
35695a18594SAndre Fischer                 A2S("private:graphicrepository/sfx2/res/separator.png")));
35795a18594SAndre Fischer 
35895a18594SAndre Fischer         // ToolBox
3598dcb2a10SAndre Fischer 
3608dcb2a10SAndre Fischer         /*
3618dcb2a10SAndre Fischer         // Separator style
3628dcb2a10SAndre Fischer         setPropertyValue(
3638dcb2a10SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBackground],
3648dcb2a10SAndre Fischer             Any(sal_Int32(rStyle.GetMenuColor().GetRGBColor())));
3658dcb2a10SAndre Fischer         setPropertyValue(
3668dcb2a10SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBorderTopLeft],
3678dcb2a10SAndre Fischer             Any());
3688dcb2a10SAndre Fischer         setPropertyValue(
3698dcb2a10SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBorderCenterCorners],
3708dcb2a10SAndre Fischer             Any());
3718dcb2a10SAndre Fischer         setPropertyValue(
3728dcb2a10SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBorderBottomRight],
3738dcb2a10SAndre Fischer             Any());
3748dcb2a10SAndre Fischer         setPropertyValue(
3758dcb2a10SAndre Fischer             maPropertyIdToNameMap[Rect_ToolBoxPadding],
3768dcb2a10SAndre Fischer             Any(awt::Rectangle(2,2,2,2)));
3778dcb2a10SAndre Fischer         setPropertyValue(
3788dcb2a10SAndre Fischer             maPropertyIdToNameMap[Rect_ToolBoxBorder],
3798dcb2a10SAndre Fischer             Any(awt::Rectangle(0,0,0,0)));
3808dcb2a10SAndre Fischer         setPropertyValue(
3818dcb2a10SAndre Fischer             maPropertyIdToNameMap[Bool_UseToolBoxItemSeparator],
3828dcb2a10SAndre Fischer             Any(true));
3838dcb2a10SAndre Fischer 
3848dcb2a10SAndre Fischer         */
3858dcb2a10SAndre Fischer 
3868dcb2a10SAndre Fischer         // Gradient style
3872b6825c7SAndre Fischer         Color aGradientStop2 (aBaseBackgroundColor);
3880ccddc23Smseidel         aGradientStop2.IncreaseLuminance(0);
3892b6825c7SAndre Fischer         Color aToolBoxBorderColor (aBaseBackgroundColor);
390d7b11edfSmseidel         aToolBoxBorderColor.DecreaseLuminance(40);
39195a18594SAndre Fischer         setPropertyValue(
39295a18594SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBackground],
39395a18594SAndre Fischer             Any(Tools::VclToAwtGradient(Gradient(
39495a18594SAndre Fischer                         GRADIENT_LINEAR,
3952b6825c7SAndre Fischer                         aBaseBackgroundColor.GetRGBColor(),
3962b6825c7SAndre Fischer                         aGradientStop2.GetRGBColor()
39795a18594SAndre Fischer                         ))));
39895a18594SAndre Fischer         setPropertyValue(
39995a18594SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBorderTopLeft],
40095a18594SAndre Fischer             mbIsHighContrastMode
40195a18594SAndre Fischer                 ? Any(util::Color(sal_uInt32(0x00ff00)))
4022b6825c7SAndre Fischer                 : Any(util::Color(aToolBoxBorderColor.GetRGBColor())));
40395a18594SAndre Fischer         setPropertyValue(
40495a18594SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBorderCenterCorners],
40595a18594SAndre Fischer             mbIsHighContrastMode
40695a18594SAndre Fischer                 ? Any(util::Color(sal_uInt32(0x00ff00)))
4072b6825c7SAndre Fischer                 : Any(util::Color(aToolBoxBorderColor.GetRGBColor())));
40895a18594SAndre Fischer         setPropertyValue(
40995a18594SAndre Fischer             maPropertyIdToNameMap[Paint_ToolBoxBorderBottomRight],
41095a18594SAndre Fischer             mbIsHighContrastMode
41195a18594SAndre Fischer                 ? Any(util::Color(sal_uInt32(0x00ff00)))
4122b6825c7SAndre Fischer                 : Any(util::Color(aToolBoxBorderColor.GetRGBColor())));
41395a18594SAndre Fischer         setPropertyValue(
41495a18594SAndre Fischer             maPropertyIdToNameMap[Rect_ToolBoxPadding],
41595a18594SAndre Fischer             Any(awt::Rectangle(2,2,2,2)));
41695a18594SAndre Fischer         setPropertyValue(
41795a18594SAndre Fischer             maPropertyIdToNameMap[Rect_ToolBoxBorder],
41895a18594SAndre Fischer             Any(awt::Rectangle(1,1,1,1)));
41995a18594SAndre Fischer         setPropertyValue(
42095a18594SAndre Fischer             maPropertyIdToNameMap[Bool_UseToolBoxItemSeparator],
42195a18594SAndre Fischer             Any(false));
422ff12d537SAndre Fischer     }
42395a18594SAndre Fischer     catch(beans::UnknownPropertyException& rException)
424b9e67834SAndre Fischer     {
42595a18594SAndre Fischer         OSL_TRACE("unknown property: %s",
42695a18594SAndre Fischer             OUStringToOString(
42795a18594SAndre Fischer                 rException.Message,
42895a18594SAndre Fischer                 RTL_TEXTENCODING_ASCII_US).getStr());
429b9e67834SAndre Fischer         OSL_ASSERT(false);
430b9e67834SAndre Fischer     }
431b9e67834SAndre Fischer }
432b9e67834SAndre Fischer 
disposing(void)433b9e67834SAndre Fischer void SAL_CALL Theme::disposing (void)
434b9e67834SAndre Fischer {
435b9e67834SAndre Fischer     ChangeListeners aListeners;
436b9e67834SAndre Fischer     maChangeListeners.swap(aListeners);
437b9e67834SAndre Fischer 
438b9e67834SAndre Fischer     const lang::EventObject aEvent (static_cast<XWeak*>(this));
439b9e67834SAndre Fischer 
440b9e67834SAndre Fischer     for (ChangeListeners::const_iterator
441b9e67834SAndre Fischer              iContainer(maChangeListeners.begin()),
442b9e67834SAndre Fischer              iContainerEnd(maChangeListeners.end());
443b9e67834SAndre Fischer          iContainerEnd!=iContainerEnd;
444b9e67834SAndre Fischer          ++iContainerEnd)
445b9e67834SAndre Fischer     {
446b9e67834SAndre Fischer         for (ChangeListenerContainer::const_iterator
447b9e67834SAndre Fischer                  iListener(iContainer->second.begin()),
448b9e67834SAndre Fischer                  iEnd(iContainer->second.end());
449b9e67834SAndre Fischer              iListener!=iEnd;
450b9e67834SAndre Fischer              ++iListener)
451b9e67834SAndre Fischer         {
452b9e67834SAndre Fischer             try
453b9e67834SAndre Fischer             {
454b9e67834SAndre Fischer                 (*iListener)->disposing(aEvent);
455b9e67834SAndre Fischer             }
456b9e67834SAndre Fischer             catch(const Exception&)
457b9e67834SAndre Fischer             {
458b9e67834SAndre Fischer             }
459b9e67834SAndre Fischer         }
460b9e67834SAndre Fischer     }
461b9e67834SAndre Fischer }
462b9e67834SAndre Fischer 
GetPropertySet(void)463b9e67834SAndre Fischer Reference<beans::XPropertySet> Theme::GetPropertySet (void)
464b9e67834SAndre Fischer {
465b9e67834SAndre Fischer     return Reference<beans::XPropertySet>(static_cast<XWeak*>(&GetCurrentTheme()), UNO_QUERY);
466b9e67834SAndre Fischer }
467b9e67834SAndre Fischer 
getPropertySetInfo(void)468b9e67834SAndre Fischer Reference<beans::XPropertySetInfo> SAL_CALL Theme::getPropertySetInfo (void)
469b9e67834SAndre Fischer     throw(cssu::RuntimeException)
470b9e67834SAndre Fischer {
47195a18594SAndre Fischer     return Reference<beans::XPropertySetInfo>(this);
472b9e67834SAndre Fischer }
473b9e67834SAndre Fischer 
setPropertyValue(const::rtl::OUString & rsPropertyName,const cssu::Any & rValue)474b9e67834SAndre Fischer void SAL_CALL Theme::setPropertyValue (
475b9e67834SAndre Fischer     const ::rtl::OUString& rsPropertyName,
476b9e67834SAndre Fischer     const cssu::Any& rValue)
477b9e67834SAndre Fischer     throw(cssu::RuntimeException)
478b9e67834SAndre Fischer {
479b9e67834SAndre Fischer     PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
480b9e67834SAndre Fischer     if (iId == maPropertyNameToIdMap.end())
48195a18594SAndre Fischer         throw beans::UnknownPropertyException(rsPropertyName, NULL);
482b9e67834SAndre Fischer 
483b9e67834SAndre Fischer     const PropertyType eType (GetPropertyType(iId->second));
484b9e67834SAndre Fischer     if (eType == PT_Invalid)
48595a18594SAndre Fischer         throw beans::UnknownPropertyException(rsPropertyName, NULL);
486b9e67834SAndre Fischer 
487b9e67834SAndre Fischer     const ThemeItem eItem (iId->second);
488b9e67834SAndre Fischer 
489b9e67834SAndre Fischer     if (rValue == maRawValues[eItem])
490b9e67834SAndre Fischer     {
491b9e67834SAndre Fischer         // Value is not different from the one in the property
492b9e67834SAndre Fischer         // set => nothing to do.
493b9e67834SAndre Fischer         return;
494b9e67834SAndre Fischer     }
495b9e67834SAndre Fischer 
496b9e67834SAndre Fischer     const Any aOldValue (maRawValues[eItem]);
497b9e67834SAndre Fischer 
498b9e67834SAndre Fischer     const beans::PropertyChangeEvent aEvent(
499b9e67834SAndre Fischer         static_cast<XWeak*>(this),
500b9e67834SAndre Fischer         rsPropertyName,
501b9e67834SAndre Fischer         sal_False,
502b9e67834SAndre Fischer         eItem,
503b9e67834SAndre Fischer         aOldValue,
504b9e67834SAndre Fischer         rValue);
505b9e67834SAndre Fischer 
506b9e67834SAndre Fischer     if (DoVetoableListenersVeto(GetVetoableListeners(__AnyItem, false), aEvent))
507b9e67834SAndre Fischer         return;
508b9e67834SAndre Fischer     if (DoVetoableListenersVeto(GetVetoableListeners(eItem, false), aEvent))
509b9e67834SAndre Fischer         return;
510b9e67834SAndre Fischer 
511b9e67834SAndre Fischer     maRawValues[eItem] = rValue;
512b9e67834SAndre Fischer     ProcessNewValue(rValue, eItem, eType);
513b9e67834SAndre Fischer 
514b9e67834SAndre Fischer     BroadcastPropertyChange(GetChangeListeners(__AnyItem, false), aEvent);
515b9e67834SAndre Fischer     BroadcastPropertyChange(GetChangeListeners(eItem, false), aEvent);
516b9e67834SAndre Fischer }
517b9e67834SAndre Fischer 
getPropertyValue(const::rtl::OUString & rsPropertyName)518b9e67834SAndre Fischer Any SAL_CALL Theme::getPropertyValue (
519b9e67834SAndre Fischer     const ::rtl::OUString& rsPropertyName)
520b9e67834SAndre Fischer     throw(css::beans::UnknownPropertyException,
521b9e67834SAndre Fischer         css::lang::WrappedTargetException,
522b9e67834SAndre Fischer         cssu::RuntimeException)
523b9e67834SAndre Fischer {
524b9e67834SAndre Fischer     PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
525b9e67834SAndre Fischer     if (iId == maPropertyNameToIdMap.end())
526b9e67834SAndre Fischer         throw beans::UnknownPropertyException();
527b9e67834SAndre Fischer 
528b9e67834SAndre Fischer     const PropertyType eType (GetPropertyType(iId->second));
529b9e67834SAndre Fischer     if (eType == PT_Invalid)
530b9e67834SAndre Fischer         throw beans::UnknownPropertyException();
531b9e67834SAndre Fischer 
532b9e67834SAndre Fischer     const ThemeItem eItem (iId->second);
533b9e67834SAndre Fischer 
534b9e67834SAndre Fischer     return maRawValues[eItem];
535b9e67834SAndre Fischer }
536b9e67834SAndre Fischer 
addPropertyChangeListener(const::rtl::OUString & rsPropertyName,const cssu::Reference<css::beans::XPropertyChangeListener> & rxListener)537b9e67834SAndre Fischer void SAL_CALL Theme::addPropertyChangeListener(
538b9e67834SAndre Fischer     const ::rtl::OUString& rsPropertyName,
539b9e67834SAndre Fischer     const cssu::Reference<css::beans::XPropertyChangeListener>& rxListener)
540b9e67834SAndre Fischer     throw(css::beans::UnknownPropertyException,
541b9e67834SAndre Fischer         css::lang::WrappedTargetException,
542b9e67834SAndre Fischer         cssu::RuntimeException)
543b9e67834SAndre Fischer {
544b9e67834SAndre Fischer     ThemeItem eItem (__AnyItem);
545b9e67834SAndre Fischer     if (rsPropertyName.getLength() > 0)
546b9e67834SAndre Fischer     {
547b9e67834SAndre Fischer         PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
548b9e67834SAndre Fischer         if (iId == maPropertyNameToIdMap.end())
549b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
550b9e67834SAndre Fischer 
551b9e67834SAndre Fischer         const PropertyType eType (GetPropertyType(iId->second));
552b9e67834SAndre Fischer         if (eType == PT_Invalid)
553b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
554b9e67834SAndre Fischer 
555b9e67834SAndre Fischer         eItem = iId->second;
556b9e67834SAndre Fischer     }
557b9e67834SAndre Fischer     ChangeListenerContainer* pListeners = GetChangeListeners(eItem, true);
558b9e67834SAndre Fischer     if (pListeners != NULL)
559b9e67834SAndre Fischer         pListeners->push_back(rxListener);
560b9e67834SAndre Fischer }
561b9e67834SAndre Fischer 
removePropertyChangeListener(const::rtl::OUString & rsPropertyName,const cssu::Reference<css::beans::XPropertyChangeListener> & rxListener)562b9e67834SAndre Fischer void SAL_CALL Theme::removePropertyChangeListener(
563b9e67834SAndre Fischer     const ::rtl::OUString& rsPropertyName,
564b9e67834SAndre Fischer     const cssu::Reference<css::beans::XPropertyChangeListener>& rxListener)
565b9e67834SAndre Fischer     throw(css::beans::UnknownPropertyException,
566b9e67834SAndre Fischer         css::lang::WrappedTargetException,
567b9e67834SAndre Fischer         cssu::RuntimeException)
568b9e67834SAndre Fischer {
569b9e67834SAndre Fischer     ThemeItem eItem (__AnyItem);
570b9e67834SAndre Fischer     if (rsPropertyName.getLength() > 0)
571b9e67834SAndre Fischer     {
572b9e67834SAndre Fischer         PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
573b9e67834SAndre Fischer         if (iId == maPropertyNameToIdMap.end())
574b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
575b9e67834SAndre Fischer 
576b9e67834SAndre Fischer         const PropertyType eType (GetPropertyType(iId->second));
577b9e67834SAndre Fischer         if (eType == PT_Invalid)
578b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
579b9e67834SAndre Fischer 
580b9e67834SAndre Fischer         eItem = iId->second;
581b9e67834SAndre Fischer     }
582b9e67834SAndre Fischer     ChangeListenerContainer* pContainer = GetChangeListeners(eItem, false);
583b9e67834SAndre Fischer     if (pContainer != NULL)
584b9e67834SAndre Fischer     {
585b9e67834SAndre Fischer         ChangeListenerContainer::iterator iListener (::std::find(pContainer->begin(), pContainer->end(), rxListener));
586b9e67834SAndre Fischer         if (iListener != pContainer->end())
587b9e67834SAndre Fischer         {
588b9e67834SAndre Fischer             pContainer->erase(iListener);
589b9e67834SAndre Fischer 
590b9e67834SAndre Fischer             // Remove the listener container when empty.
591b9e67834SAndre Fischer             if (pContainer->empty())
592b9e67834SAndre Fischer                 maChangeListeners.erase(eItem);
593b9e67834SAndre Fischer         }
594b9e67834SAndre Fischer     }
595b9e67834SAndre Fischer }
596b9e67834SAndre Fischer 
addVetoableChangeListener(const::rtl::OUString & rsPropertyName,const cssu::Reference<css::beans::XVetoableChangeListener> & rxListener)597b9e67834SAndre Fischer void SAL_CALL Theme::addVetoableChangeListener(
598b9e67834SAndre Fischer     const ::rtl::OUString& rsPropertyName,
599b9e67834SAndre Fischer     const cssu::Reference<css::beans::XVetoableChangeListener>& rxListener)
600b9e67834SAndre Fischer     throw(css::beans::UnknownPropertyException,
601b9e67834SAndre Fischer         css::lang::WrappedTargetException,
602b9e67834SAndre Fischer         cssu::RuntimeException)
603b9e67834SAndre Fischer {
604b9e67834SAndre Fischer     ThemeItem eItem (__AnyItem);
605b9e67834SAndre Fischer     if (rsPropertyName.getLength() > 0)
606b9e67834SAndre Fischer     {
607b9e67834SAndre Fischer         PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
608b9e67834SAndre Fischer         if (iId == maPropertyNameToIdMap.end())
609b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
610b9e67834SAndre Fischer 
611b9e67834SAndre Fischer         const PropertyType eType (GetPropertyType(iId->second));
612b9e67834SAndre Fischer         if (eType == PT_Invalid)
613b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
614b9e67834SAndre Fischer 
615b9e67834SAndre Fischer         eItem = iId->second;
616b9e67834SAndre Fischer     }
617b9e67834SAndre Fischer     VetoableListenerContainer* pListeners = GetVetoableListeners(eItem, true);
618b9e67834SAndre Fischer     if (pListeners != NULL)
619b9e67834SAndre Fischer         pListeners->push_back(rxListener);
620b9e67834SAndre Fischer }
621b9e67834SAndre Fischer 
removeVetoableChangeListener(const::rtl::OUString & rsPropertyName,const cssu::Reference<css::beans::XVetoableChangeListener> & rxListener)622b9e67834SAndre Fischer void SAL_CALL Theme::removeVetoableChangeListener(
623b9e67834SAndre Fischer     const ::rtl::OUString& rsPropertyName,
624b9e67834SAndre Fischer     const cssu::Reference<css::beans::XVetoableChangeListener>& rxListener)
625b9e67834SAndre Fischer     throw(css::beans::UnknownPropertyException,
626b9e67834SAndre Fischer         css::lang::WrappedTargetException,
627b9e67834SAndre Fischer         cssu::RuntimeException)
628b9e67834SAndre Fischer {
629b9e67834SAndre Fischer     ThemeItem eItem (__AnyItem);
630b9e67834SAndre Fischer     if (rsPropertyName.getLength() > 0)
631b9e67834SAndre Fischer     {
632b9e67834SAndre Fischer         PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
633b9e67834SAndre Fischer         if (iId == maPropertyNameToIdMap.end())
634b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
635b9e67834SAndre Fischer 
636b9e67834SAndre Fischer         const PropertyType eType (GetPropertyType(iId->second));
637b9e67834SAndre Fischer         if (eType == PT_Invalid)
638b9e67834SAndre Fischer             throw beans::UnknownPropertyException();
639b9e67834SAndre Fischer 
640b9e67834SAndre Fischer         eItem = iId->second;
641b9e67834SAndre Fischer     }
642b9e67834SAndre Fischer     VetoableListenerContainer* pContainer = GetVetoableListeners(eItem, false);
643b9e67834SAndre Fischer     if (pContainer != NULL)
644b9e67834SAndre Fischer     {
645b9e67834SAndre Fischer         VetoableListenerContainer::iterator iListener (::std::find(pContainer->begin(), pContainer->end(), rxListener));
646b9e67834SAndre Fischer         if (iListener != pContainer->end())
647b9e67834SAndre Fischer         {
648b9e67834SAndre Fischer             pContainer->erase(iListener);
649b9e67834SAndre Fischer             // Remove container when empty.
650b9e67834SAndre Fischer             if (pContainer->empty())
651b9e67834SAndre Fischer                 maVetoableListeners.erase(eItem);
652b9e67834SAndre Fischer         }
653b9e67834SAndre Fischer     }
654b9e67834SAndre Fischer }
655b9e67834SAndre Fischer 
getProperties(void)65695a18594SAndre Fischer cssu::Sequence<css::beans::Property> SAL_CALL Theme::getProperties (void)
65795a18594SAndre Fischer     throw(cssu::RuntimeException)
65895a18594SAndre Fischer {
65995a18594SAndre Fischer     ::std::vector<beans::Property> aProperties;
66095a18594SAndre Fischer 
66195a18594SAndre Fischer     for (sal_Int32 nItem(__Begin),nEnd(__End); nItem!=nEnd; ++nItem)
66295a18594SAndre Fischer     {
66395a18594SAndre Fischer         const ThemeItem eItem (static_cast<ThemeItem>(nItem));
66495a18594SAndre Fischer         const PropertyType eType (GetPropertyType(eItem));
66595a18594SAndre Fischer         if (eType == PT_Invalid)
66695a18594SAndre Fischer             continue;
66795a18594SAndre Fischer 
66895a18594SAndre Fischer         const beans::Property aProperty(
66995a18594SAndre Fischer             maPropertyIdToNameMap[eItem],
67095a18594SAndre Fischer             eItem,
67195a18594SAndre Fischer             GetCppuType(eType),
67295a18594SAndre Fischer             0);
67395a18594SAndre Fischer         aProperties.push_back(aProperty);
67495a18594SAndre Fischer     }
67595a18594SAndre Fischer 
67695a18594SAndre Fischer     return cssu::Sequence<css::beans::Property>(
67795a18594SAndre Fischer         &aProperties.front(),
67895a18594SAndre Fischer         aProperties.size());
67995a18594SAndre Fischer }
68095a18594SAndre Fischer 
getPropertyByName(const::rtl::OUString & rsPropertyName)68195a18594SAndre Fischer beans::Property SAL_CALL Theme::getPropertyByName (const ::rtl::OUString& rsPropertyName)
68295a18594SAndre Fischer     throw(css::beans::UnknownPropertyException,
68395a18594SAndre Fischer         cssu::RuntimeException)
68495a18594SAndre Fischer {
68595a18594SAndre Fischer     PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
68695a18594SAndre Fischer     if (iId == maPropertyNameToIdMap.end())
68795a18594SAndre Fischer         throw beans::UnknownPropertyException();
68895a18594SAndre Fischer 
68995a18594SAndre Fischer     const PropertyType eType (GetPropertyType(iId->second));
69095a18594SAndre Fischer     if (eType == PT_Invalid)
69195a18594SAndre Fischer         throw beans::UnknownPropertyException();
69295a18594SAndre Fischer 
69395a18594SAndre Fischer     const ThemeItem eItem (iId->second);
69495a18594SAndre Fischer 
69595a18594SAndre Fischer     return beans::Property(
69695a18594SAndre Fischer         rsPropertyName,
69795a18594SAndre Fischer         eItem,
69895a18594SAndre Fischer         GetCppuType(eType),
69995a18594SAndre Fischer         0);
70095a18594SAndre Fischer }
70195a18594SAndre Fischer 
hasPropertyByName(const::rtl::OUString & rsPropertyName)70295a18594SAndre Fischer sal_Bool SAL_CALL Theme::hasPropertyByName (const ::rtl::OUString& rsPropertyName)
70395a18594SAndre Fischer     throw(cssu::RuntimeException)
70495a18594SAndre Fischer {
70595a18594SAndre Fischer     PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
70695a18594SAndre Fischer     if (iId == maPropertyNameToIdMap.end())
70795a18594SAndre Fischer         return sal_False;
70895a18594SAndre Fischer 
70995a18594SAndre Fischer     const PropertyType eType (GetPropertyType(iId->second));
71095a18594SAndre Fischer     if (eType == PT_Invalid)
71195a18594SAndre Fischer         return sal_False;
71295a18594SAndre Fischer 
71395a18594SAndre Fischer     return sal_True;
71495a18594SAndre Fischer }
71595a18594SAndre Fischer 
SetupPropertyMaps(void)716b9e67834SAndre Fischer void Theme::SetupPropertyMaps (void)
717b9e67834SAndre Fischer {
71895a18594SAndre Fischer     maPropertyIdToNameMap.resize(__Post_Rect);
719b9e67834SAndre Fischer     maImages.resize(__Image_Color - __Pre_Image - 1);
720b9e67834SAndre Fischer     maColors.resize(__Color_Paint - __Image_Color - 1);
721b9e67834SAndre Fischer     maPaints.resize(__Paint_Int - __Color_Paint - 1);
722b9e67834SAndre Fischer     maIntegers.resize(__Int_Bool - __Paint_Int - 1);
72395a18594SAndre Fischer     maBooleans.resize(__Bool_Rect - __Int_Bool - 1);
72495a18594SAndre Fischer     maRectangles.resize(__Post_Rect - __Bool_Rect - 1);
725b9e67834SAndre Fischer 
726b9e67834SAndre Fischer     #define AddEntry(e) maPropertyNameToIdMap[A2S(#e)]=e; maPropertyIdToNameMap[e]=A2S(#e)
72795a18594SAndre Fischer 
728b9e67834SAndre Fischer     AddEntry(Image_Grip);
729b9e67834SAndre Fischer     AddEntry(Image_Expand);
730b9e67834SAndre Fischer     AddEntry(Image_Collapse);
7317a32b0c8SAndre Fischer     AddEntry(Image_TabBarMenu);
7327a32b0c8SAndre Fischer     AddEntry(Image_PanelMenu);
73395a18594SAndre Fischer     AddEntry(Image_ToolBoxItemSeparator);
7347a32b0c8SAndre Fischer     AddEntry(Image_Closer);
73513e1c3b4SAndre Fischer     AddEntry(Image_CloseIndicator);
736b9e67834SAndre Fischer 
737b9e67834SAndre Fischer     AddEntry(Color_DeckTitleFont);
738b9e67834SAndre Fischer     AddEntry(Color_PanelTitleFont);
739b9e67834SAndre Fischer     AddEntry(Color_TabMenuSeparator);
740b9e67834SAndre Fischer     AddEntry(Color_TabItemBorder);
7418dcb2a10SAndre Fischer     AddEntry(Color_DropDownBorder);
7425f1c83ffSOliver-Rainer Wittmann     AddEntry(Color_Highlight);
7435f1c83ffSOliver-Rainer Wittmann     AddEntry(Color_HighlightText);
744b9e67834SAndre Fischer 
745b9e67834SAndre Fischer     AddEntry(Paint_DeckBackground);
746b9e67834SAndre Fischer     AddEntry(Paint_DeckTitleBarBackground);
747b9e67834SAndre Fischer     AddEntry(Paint_PanelBackground);
748b9e67834SAndre Fischer     AddEntry(Paint_PanelTitleBarBackground);
749b9e67834SAndre Fischer     AddEntry(Paint_TabBarBackground);
75095a18594SAndre Fischer     AddEntry(Paint_TabItemBackgroundNormal);
75195a18594SAndre Fischer     AddEntry(Paint_TabItemBackgroundHighlight);
752b9e67834SAndre Fischer     AddEntry(Paint_HorizontalBorder);
753b9e67834SAndre Fischer     AddEntry(Paint_VerticalBorder);
75495a18594SAndre Fischer     AddEntry(Paint_ToolBoxBackground);
75595a18594SAndre Fischer     AddEntry(Paint_ToolBoxBorderTopLeft);
75695a18594SAndre Fischer     AddEntry(Paint_ToolBoxBorderCenterCorners);
75795a18594SAndre Fischer     AddEntry(Paint_ToolBoxBorderBottomRight);
7588dcb2a10SAndre Fischer     AddEntry(Paint_DropDownBackground);
759b9e67834SAndre Fischer 
760b9e67834SAndre Fischer     AddEntry(Int_DeckTitleBarHeight);
761b9e67834SAndre Fischer     AddEntry(Int_DeckBorderSize);
762b9e67834SAndre Fischer     AddEntry(Int_DeckSeparatorHeight);
763b9e67834SAndre Fischer     AddEntry(Int_PanelTitleBarHeight);
764b9e67834SAndre Fischer     AddEntry(Int_TabMenuPadding);
765b9e67834SAndre Fischer     AddEntry(Int_TabMenuSeparatorPadding);
766b9e67834SAndre Fischer     AddEntry(Int_TabItemWidth);
767b9e67834SAndre Fischer     AddEntry(Int_TabItemHeight);
768b9e67834SAndre Fischer     AddEntry(Int_DeckLeftPadding);
769b9e67834SAndre Fischer     AddEntry(Int_DeckTopPadding);
770b9e67834SAndre Fischer     AddEntry(Int_DeckRightPadding);
771b9e67834SAndre Fischer     AddEntry(Int_DeckBottomPadding);
772b9e67834SAndre Fischer     AddEntry(Int_TabBarLeftPadding);
773b9e67834SAndre Fischer     AddEntry(Int_TabBarTopPadding);
774b9e67834SAndre Fischer     AddEntry(Int_TabBarRightPadding);
775b9e67834SAndre Fischer     AddEntry(Int_TabBarBottomPadding);
77637fee4fdSAndre Fischer     AddEntry(Int_ButtonCornerRadius);
777b9e67834SAndre Fischer 
778b9e67834SAndre Fischer     AddEntry(Bool_UseSymphonyIcons);
77995a18594SAndre Fischer     AddEntry(Bool_UseSystemColors);
78095a18594SAndre Fischer     AddEntry(Bool_UseToolBoxItemSeparator);
78195a18594SAndre Fischer     AddEntry(Bool_IsHighContrastModeActive);
78295a18594SAndre Fischer 
78395a18594SAndre Fischer     AddEntry(Rect_ToolBoxPadding);
78495a18594SAndre Fischer     AddEntry(Rect_ToolBoxBorder);
78595a18594SAndre Fischer 
786b9e67834SAndre Fischer     #undef AddEntry
787b9e67834SAndre Fischer 
788b9e67834SAndre Fischer     maRawValues.resize(maPropertyIdToNameMap.size());
789b9e67834SAndre Fischer }
790b9e67834SAndre Fischer 
GetPropertyType(const ThemeItem eItem)791b9e67834SAndre Fischer Theme::PropertyType Theme::GetPropertyType (const ThemeItem eItem)
792b9e67834SAndre Fischer {
793b9e67834SAndre Fischer     switch(eItem)
794b9e67834SAndre Fischer     {
795b9e67834SAndre Fischer         case Image_Grip:
796b9e67834SAndre Fischer         case Image_Expand:
797b9e67834SAndre Fischer         case Image_Collapse:
7987a32b0c8SAndre Fischer         case Image_TabBarMenu:
7997a32b0c8SAndre Fischer         case Image_PanelMenu:
80095a18594SAndre Fischer         case Image_ToolBoxItemSeparator:
8017a32b0c8SAndre Fischer         case Image_Closer:
80213e1c3b4SAndre Fischer         case Image_CloseIndicator:
803b9e67834SAndre Fischer             return PT_Image;
804b9e67834SAndre Fischer 
805b9e67834SAndre Fischer         case Color_DeckTitleFont:
806b9e67834SAndre Fischer         case Color_PanelTitleFont:
807b9e67834SAndre Fischer         case Color_TabMenuSeparator:
808b9e67834SAndre Fischer         case Color_TabItemBorder:
8098dcb2a10SAndre Fischer         case Color_DropDownBorder:
8105f1c83ffSOliver-Rainer Wittmann         case Color_Highlight:
8115f1c83ffSOliver-Rainer Wittmann         case Color_HighlightText:
812b9e67834SAndre Fischer             return PT_Color;
813b9e67834SAndre Fischer 
814b9e67834SAndre Fischer         case Paint_DeckBackground:
815b9e67834SAndre Fischer         case Paint_DeckTitleBarBackground:
816b9e67834SAndre Fischer         case Paint_PanelBackground:
817b9e67834SAndre Fischer         case Paint_PanelTitleBarBackground:
818b9e67834SAndre Fischer         case Paint_TabBarBackground:
81995a18594SAndre Fischer         case Paint_TabItemBackgroundNormal:
82095a18594SAndre Fischer         case Paint_TabItemBackgroundHighlight:
821b9e67834SAndre Fischer         case Paint_HorizontalBorder:
822b9e67834SAndre Fischer         case Paint_VerticalBorder:
82395a18594SAndre Fischer         case Paint_ToolBoxBackground:
82495a18594SAndre Fischer         case Paint_ToolBoxBorderTopLeft:
82595a18594SAndre Fischer         case Paint_ToolBoxBorderCenterCorners:
82695a18594SAndre Fischer         case Paint_ToolBoxBorderBottomRight:
8278dcb2a10SAndre Fischer         case Paint_DropDownBackground:
828b9e67834SAndre Fischer             return PT_Paint;
829b9e67834SAndre Fischer 
830b9e67834SAndre Fischer         case Int_DeckTitleBarHeight:
831b9e67834SAndre Fischer         case Int_DeckBorderSize:
832b9e67834SAndre Fischer         case Int_DeckSeparatorHeight:
833b9e67834SAndre Fischer         case Int_PanelTitleBarHeight:
834b9e67834SAndre Fischer         case Int_TabMenuPadding:
835b9e67834SAndre Fischer         case Int_TabMenuSeparatorPadding:
836b9e67834SAndre Fischer         case Int_TabItemWidth:
837b9e67834SAndre Fischer         case Int_TabItemHeight:
838b9e67834SAndre Fischer         case Int_DeckLeftPadding:
839b9e67834SAndre Fischer         case Int_DeckTopPadding:
840b9e67834SAndre Fischer         case Int_DeckRightPadding:
841b9e67834SAndre Fischer         case Int_DeckBottomPadding:
842b9e67834SAndre Fischer         case Int_TabBarLeftPadding:
843b9e67834SAndre Fischer         case Int_TabBarTopPadding:
844b9e67834SAndre Fischer         case Int_TabBarRightPadding:
845b9e67834SAndre Fischer         case Int_TabBarBottomPadding:
84637fee4fdSAndre Fischer         case Int_ButtonCornerRadius:
847b9e67834SAndre Fischer             return PT_Integer;
848b9e67834SAndre Fischer 
849b9e67834SAndre Fischer         case Bool_UseSymphonyIcons:
85095a18594SAndre Fischer         case Bool_UseSystemColors:
85195a18594SAndre Fischer         case Bool_UseToolBoxItemSeparator:
85295a18594SAndre Fischer         case Bool_IsHighContrastModeActive:
853b9e67834SAndre Fischer             return PT_Boolean;
854b9e67834SAndre Fischer 
85595a18594SAndre Fischer         case Rect_ToolBoxBorder:
85695a18594SAndre Fischer         case Rect_ToolBoxPadding:
85795a18594SAndre Fischer             return PT_Rectangle;
85895a18594SAndre Fischer 
859b9e67834SAndre Fischer         default:
860b9e67834SAndre Fischer             return PT_Invalid;
861b9e67834SAndre Fischer     }
862b9e67834SAndre Fischer }
863b9e67834SAndre Fischer 
GetCppuType(const PropertyType eType)86495a18594SAndre Fischer cssu::Type Theme::GetCppuType (const PropertyType eType)
86595a18594SAndre Fischer {
86695a18594SAndre Fischer     switch(eType)
86795a18594SAndre Fischer     {
86895a18594SAndre Fischer         case PT_Image:
86995a18594SAndre Fischer             return getCppuType((rtl::OUString*)NULL);
87095a18594SAndre Fischer 
87195a18594SAndre Fischer         case PT_Color:
87295a18594SAndre Fischer             return getCppuType((sal_uInt32*)NULL);
87395a18594SAndre Fischer 
87495a18594SAndre Fischer         case PT_Paint:
87595a18594SAndre Fischer             return getCppuVoidType();
87695a18594SAndre Fischer 
87795a18594SAndre Fischer         case PT_Integer:
87895a18594SAndre Fischer             return getCppuType((sal_Int32*)NULL);
87995a18594SAndre Fischer 
88095a18594SAndre Fischer         case PT_Boolean:
88195a18594SAndre Fischer             return getCppuType((sal_Bool*)NULL);
88295a18594SAndre Fischer 
88395a18594SAndre Fischer         case PT_Rectangle:
88495a18594SAndre Fischer             return getCppuType((awt::Rectangle*)NULL);
88595a18594SAndre Fischer 
88695a18594SAndre Fischer         case PT_Invalid:
88795a18594SAndre Fischer         default:
88895a18594SAndre Fischer             return getCppuVoidType();
88995a18594SAndre Fischer     }
89095a18594SAndre Fischer }
89195a18594SAndre Fischer 
GetIndex(const ThemeItem eItem,const PropertyType eType)892b9e67834SAndre Fischer sal_Int32 Theme::GetIndex (const ThemeItem eItem, const PropertyType eType)
893b9e67834SAndre Fischer {
894b9e67834SAndre Fischer     switch(eType)
895b9e67834SAndre Fischer     {
896b9e67834SAndre Fischer         case PT_Image:
897b9e67834SAndre Fischer             return eItem - __Pre_Image-1;
898b9e67834SAndre Fischer         case PT_Color:
899b9e67834SAndre Fischer             return eItem - __Image_Color-1;
900b9e67834SAndre Fischer         case PT_Paint:
901b9e67834SAndre Fischer             return eItem - __Color_Paint-1;
902b9e67834SAndre Fischer         case PT_Integer:
903b9e67834SAndre Fischer             return eItem - __Paint_Int-1;
904b9e67834SAndre Fischer         case PT_Boolean:
905b9e67834SAndre Fischer             return eItem - __Int_Bool-1;
90695a18594SAndre Fischer         case PT_Rectangle:
90795a18594SAndre Fischer             return eItem - __Bool_Rect-1;
908b9e67834SAndre Fischer 
909b9e67834SAndre Fischer         default:
910b9e67834SAndre Fischer             OSL_ASSERT(false);
911b9e67834SAndre Fischer             return 0;
912b9e67834SAndre Fischer     }
913b9e67834SAndre Fischer }
914b9e67834SAndre Fischer 
GetVetoableListeners(const ThemeItem eItem,const bool bCreate)915b9e67834SAndre Fischer Theme::VetoableListenerContainer* Theme::GetVetoableListeners (
916b9e67834SAndre Fischer     const ThemeItem eItem,
917b9e67834SAndre Fischer     const bool bCreate)
918b9e67834SAndre Fischer {
919b9e67834SAndre Fischer     VetoableListeners::iterator iContainer (maVetoableListeners.find(eItem));
920b9e67834SAndre Fischer     if (iContainer != maVetoableListeners.end())
921b9e67834SAndre Fischer         return &iContainer->second;
922b9e67834SAndre Fischer     else if (bCreate)
923b9e67834SAndre Fischer     {
924b9e67834SAndre Fischer         maVetoableListeners[eItem] = VetoableListenerContainer();
925b9e67834SAndre Fischer         return &maVetoableListeners[eItem];
926b9e67834SAndre Fischer     }
927b9e67834SAndre Fischer     else
928b9e67834SAndre Fischer         return NULL;
929b9e67834SAndre Fischer }
930b9e67834SAndre Fischer 
GetChangeListeners(const ThemeItem eItem,const bool bCreate)931b9e67834SAndre Fischer Theme::ChangeListenerContainer* Theme::GetChangeListeners (
932b9e67834SAndre Fischer     const ThemeItem eItem,
933b9e67834SAndre Fischer     const bool bCreate)
934b9e67834SAndre Fischer {
935b9e67834SAndre Fischer     ChangeListeners::iterator iContainer (maChangeListeners.find(eItem));
936b9e67834SAndre Fischer     if (iContainer != maChangeListeners.end())
937b9e67834SAndre Fischer         return &iContainer->second;
938b9e67834SAndre Fischer     else if (bCreate)
939b9e67834SAndre Fischer     {
940b9e67834SAndre Fischer         maChangeListeners[eItem] = ChangeListenerContainer();
941b9e67834SAndre Fischer         return &maChangeListeners[eItem];
942b9e67834SAndre Fischer     }
943b9e67834SAndre Fischer     else
944b9e67834SAndre Fischer         return NULL;
945b9e67834SAndre Fischer }
946b9e67834SAndre Fischer 
DoVetoableListenersVeto(const VetoableListenerContainer * pListeners,const beans::PropertyChangeEvent & rEvent) const947b9e67834SAndre Fischer bool Theme::DoVetoableListenersVeto (
948b9e67834SAndre Fischer     const VetoableListenerContainer* pListeners,
949b9e67834SAndre Fischer     const beans::PropertyChangeEvent& rEvent) const
950b9e67834SAndre Fischer {
951b9e67834SAndre Fischer     if (pListeners == NULL)
952b9e67834SAndre Fischer         return false;
953b9e67834SAndre Fischer 
954b9e67834SAndre Fischer     VetoableListenerContainer aListeners (*pListeners);
955b9e67834SAndre Fischer     try
956b9e67834SAndre Fischer     {
957b9e67834SAndre Fischer         for (VetoableListenerContainer::const_iterator
958b9e67834SAndre Fischer                  iListener(aListeners.begin()),
959b9e67834SAndre Fischer                  iEnd(aListeners.end());
960b9e67834SAndre Fischer              iListener!=iEnd;
961b9e67834SAndre Fischer              ++iListener)
962b9e67834SAndre Fischer         {
963b9e67834SAndre Fischer             (*iListener)->vetoableChange(rEvent);
964b9e67834SAndre Fischer         }
965b9e67834SAndre Fischer     }
966b9e67834SAndre Fischer     catch(const beans::PropertyVetoException&)
967b9e67834SAndre Fischer     {
968b9e67834SAndre Fischer         return true;
969b9e67834SAndre Fischer     }
970b9e67834SAndre Fischer     catch(const Exception&)
971b9e67834SAndre Fischer     {
972b9e67834SAndre Fischer         // Ignore any other errors (such as disposed listeners).
973b9e67834SAndre Fischer     }
974b9e67834SAndre Fischer     return false;
975b9e67834SAndre Fischer }
976b9e67834SAndre Fischer 
BroadcastPropertyChange(const ChangeListenerContainer * pListeners,const beans::PropertyChangeEvent & rEvent) const977b9e67834SAndre Fischer void Theme::BroadcastPropertyChange (
978b9e67834SAndre Fischer     const ChangeListenerContainer* pListeners,
979b9e67834SAndre Fischer     const beans::PropertyChangeEvent& rEvent) const
980b9e67834SAndre Fischer {
981b9e67834SAndre Fischer     if (pListeners == NULL)
982b9e67834SAndre Fischer         return;
983b9e67834SAndre Fischer 
984b9e67834SAndre Fischer     const ChangeListenerContainer aListeners (*pListeners);
985b9e67834SAndre Fischer     try
986b9e67834SAndre Fischer     {
987b9e67834SAndre Fischer         for (ChangeListenerContainer::const_iterator
988b9e67834SAndre Fischer                  iListener(aListeners.begin()),
989b9e67834SAndre Fischer                  iEnd(aListeners.end());
990b9e67834SAndre Fischer              iListener!=iEnd;
991b9e67834SAndre Fischer              ++iListener)
992b9e67834SAndre Fischer         {
993b9e67834SAndre Fischer             (*iListener)->propertyChange(rEvent);
994b9e67834SAndre Fischer         }
995b9e67834SAndre Fischer     }
996b9e67834SAndre Fischer     catch(const Exception&)
997b9e67834SAndre Fischer     {
998b9e67834SAndre Fischer         // Ignore any errors (such as disposed listeners).
999b9e67834SAndre Fischer     }
1000b9e67834SAndre Fischer }
1001b9e67834SAndre Fischer 
ProcessNewValue(const Any & rValue,const ThemeItem eItem,const PropertyType eType)1002b9e67834SAndre Fischer void Theme::ProcessNewValue (
1003b9e67834SAndre Fischer     const Any& rValue,
1004b9e67834SAndre Fischer     const ThemeItem eItem,
1005b9e67834SAndre Fischer     const PropertyType eType)
1006b9e67834SAndre Fischer {
1007b9e67834SAndre Fischer     const sal_Int32 nIndex (GetIndex (eItem, eType));
1008b9e67834SAndre Fischer     switch (eType)
1009b9e67834SAndre Fischer     {
1010b9e67834SAndre Fischer         case PT_Image:
1011b9e67834SAndre Fischer         {
1012b9e67834SAndre Fischer             ::rtl::OUString sURL;
1013b9e67834SAndre Fischer             if (rValue >>= sURL)
1014b9e67834SAndre Fischer             {
1015b9e67834SAndre Fischer                 maImages[nIndex] = Tools::GetImage(sURL, NULL);
1016b9e67834SAndre Fischer             }
1017b9e67834SAndre Fischer             break;
1018b9e67834SAndre Fischer         }
1019b9e67834SAndre Fischer         case PT_Color:
1020b9e67834SAndre Fischer         {
102195a18594SAndre Fischer             sal_Int32 nColorValue (0);
1022b9e67834SAndre Fischer             if (rValue >>= nColorValue)
1023b9e67834SAndre Fischer             {
1024b9e67834SAndre Fischer                 maColors[nIndex] = Color(nColorValue);
1025b9e67834SAndre Fischer             }
1026b9e67834SAndre Fischer             break;
1027b9e67834SAndre Fischer         }
1028b9e67834SAndre Fischer         case PT_Paint:
1029b9e67834SAndre Fischer         {
103095a18594SAndre Fischer             maPaints[nIndex] = Paint::Create(rValue);
1031b9e67834SAndre Fischer             break;
1032b9e67834SAndre Fischer         }
1033b9e67834SAndre Fischer         case PT_Integer:
1034b9e67834SAndre Fischer         {
103595a18594SAndre Fischer             sal_Int32 nValue (0);
1036b9e67834SAndre Fischer             if (rValue >>= nValue)
1037b9e67834SAndre Fischer             {
1038b9e67834SAndre Fischer                 maIntegers[nIndex] = nValue;
1039b9e67834SAndre Fischer             }
1040b9e67834SAndre Fischer             break;
1041b9e67834SAndre Fischer         }
1042b9e67834SAndre Fischer         case PT_Boolean:
1043b9e67834SAndre Fischer         {
104495a18594SAndre Fischer             sal_Bool nValue (0);
1045b9e67834SAndre Fischer             if (rValue >>= nValue)
1046b9e67834SAndre Fischer             {
1047b9e67834SAndre Fischer                 maBooleans[nIndex] = (nValue==sal_True);
104895a18594SAndre Fischer                 if (eItem == Bool_IsHighContrastModeActive)
104995a18594SAndre Fischer                 {
105095a18594SAndre Fischer                     mbIsHighContrastModeSetManually = true;
105195a18594SAndre Fischer                     mbIsHighContrastMode = maBooleans[nIndex];
105295a18594SAndre Fischer                     HandleDataChange();
105395a18594SAndre Fischer                 }
105495a18594SAndre Fischer                 else if (eItem == Bool_UseSystemColors)
105595a18594SAndre Fischer                 {
105695a18594SAndre Fischer                     HandleDataChange();
105795a18594SAndre Fischer                 }
105895a18594SAndre Fischer             }
105995a18594SAndre Fischer             break;
106095a18594SAndre Fischer         }
106195a18594SAndre Fischer         case PT_Rectangle:
106295a18594SAndre Fischer         {
106395a18594SAndre Fischer             awt::Rectangle aBox;
106495a18594SAndre Fischer             if (rValue >>= aBox)
106595a18594SAndre Fischer             {
106695a18594SAndre Fischer                 maRectangles[nIndex] = Rectangle(
106795a18594SAndre Fischer                     aBox.X,
106895a18594SAndre Fischer                     aBox.Y,
106995a18594SAndre Fischer                     aBox.Width,
107095a18594SAndre Fischer                     aBox.Height);
1071b9e67834SAndre Fischer             }
1072b9e67834SAndre Fischer             break;
1073b9e67834SAndre Fischer         }
1074b9e67834SAndre Fischer         case PT_Invalid:
1075b9e67834SAndre Fischer             OSL_ASSERT(eType != PT_Invalid);
1076b9e67834SAndre Fischer             throw RuntimeException();
1077b9e67834SAndre Fischer     }
1078b9e67834SAndre Fischer }
1079b9e67834SAndre Fischer 
1080ff12d537SAndre Fischer } } // end of namespace sfx2::sidebar
10816026f80cSmseidel 
10826026f80cSmseidel /* vim: set noet sw=4 ts=4: */
1083