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" 27*f35c6d02SAndre 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; 35ff12d537SAndre Fischer 36ff12d537SAndre Fischer 37b9e67834SAndre Fischer namespace sfx2 { namespace sidebar { 38ff12d537SAndre Fischer 39b9e67834SAndre Fischer ::rtl::Reference<Theme> Theme::mpInstance; 40ff12d537SAndre Fischer 41ff12d537SAndre Fischer 42ff12d537SAndre Fischer 43ff12d537SAndre Fischer 44b9e67834SAndre Fischer Theme& Theme::GetCurrentTheme (void) 45b9e67834SAndre Fischer { 46b9e67834SAndre Fischer if ( ! mpInstance.is()) 47b9e67834SAndre Fischer { 48b9e67834SAndre Fischer mpInstance.set(new Theme()); 49b9e67834SAndre Fischer mpInstance->InitializeTheme(); 50b9e67834SAndre Fischer } 51b9e67834SAndre Fischer return *mpInstance; 52b9e67834SAndre 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() 71ff12d537SAndre Fischer 72ff12d537SAndre Fischer { 73b9e67834SAndre Fischer SetupPropertyMaps(); 74ff12d537SAndre Fischer } 75ff12d537SAndre Fischer 76ff12d537SAndre Fischer 77ff12d537SAndre Fischer 78ff12d537SAndre Fischer 79b9e67834SAndre Fischer Theme::~Theme (void) 80ff12d537SAndre Fischer { 81ff12d537SAndre Fischer } 82ff12d537SAndre Fischer 83ff12d537SAndre Fischer 84ff12d537SAndre Fischer 85ff12d537SAndre Fischer 86b9e67834SAndre Fischer Image Theme::GetImage (const ThemeItem eItem) 87ff12d537SAndre Fischer { 88b9e67834SAndre Fischer const PropertyType eType (GetPropertyType(eItem)); 89b9e67834SAndre Fischer OSL_ASSERT(eType==PT_Image); 90b9e67834SAndre Fischer const sal_Int32 nIndex (GetIndex(eItem, eType)); 91b9e67834SAndre Fischer const Theme& rTheme (GetCurrentTheme()); 92b9e67834SAndre Fischer return rTheme.maImages[nIndex]; 93ff12d537SAndre Fischer } 94ff12d537SAndre Fischer 95ff12d537SAndre Fischer 96ff12d537SAndre Fischer 97ff12d537SAndre Fischer 98b9e67834SAndre Fischer Color Theme::GetColor (const ThemeItem eItem) 99ff12d537SAndre Fischer { 100b9e67834SAndre Fischer const PropertyType eType (GetPropertyType(eItem)); 1018dcb2a10SAndre Fischer OSL_ASSERT(eType==PT_Color || eType==PT_Paint); 102b9e67834SAndre Fischer const sal_Int32 nIndex (GetIndex(eItem, eType)); 103b9e67834SAndre Fischer const Theme& rTheme (GetCurrentTheme()); 1048dcb2a10SAndre Fischer if (eType == PT_Color) 1058dcb2a10SAndre Fischer return rTheme.maColors[nIndex]; 1068dcb2a10SAndre Fischer else if (eType == PT_Paint) 1078dcb2a10SAndre Fischer return rTheme.maPaints[nIndex].GetColor(); 108f120fe41SAndre Fischer else 109f120fe41SAndre Fischer return COL_WHITE; 110ff12d537SAndre Fischer } 111ff12d537SAndre Fischer 112ff12d537SAndre Fischer 113ff12d537SAndre Fischer 114ff12d537SAndre Fischer 115b9e67834SAndre Fischer const Paint& Theme::GetPaint (const ThemeItem eItem) 116ff12d537SAndre Fischer { 117b9e67834SAndre Fischer const PropertyType eType (GetPropertyType(eItem)); 118b9e67834SAndre Fischer OSL_ASSERT(eType==PT_Paint); 119b9e67834SAndre Fischer const sal_Int32 nIndex (GetIndex(eItem, eType)); 120b9e67834SAndre Fischer const Theme& rTheme (GetCurrentTheme()); 121b9e67834SAndre Fischer return rTheme.maPaints[nIndex]; 122ff12d537SAndre Fischer } 123ff12d537SAndre Fischer 124ff12d537SAndre Fischer 125ff12d537SAndre Fischer 126ff12d537SAndre Fischer 1277a32b0c8SAndre Fischer const Wallpaper Theme::GetWallpaper (const ThemeItem eItem) 1287a32b0c8SAndre Fischer { 1297a32b0c8SAndre Fischer return GetPaint(eItem).GetWallpaper(); 1307a32b0c8SAndre Fischer } 1317a32b0c8SAndre Fischer 1327a32b0c8SAndre Fischer 1337a32b0c8SAndre Fischer 1347a32b0c8SAndre Fischer 135b9e67834SAndre Fischer sal_Int32 Theme::GetInteger (const ThemeItem eItem) 136ff12d537SAndre Fischer { 137b9e67834SAndre Fischer const PropertyType eType (GetPropertyType(eItem)); 138b9e67834SAndre Fischer OSL_ASSERT(eType==PT_Integer); 139b9e67834SAndre Fischer const sal_Int32 nIndex (GetIndex(eItem, eType)); 140b9e67834SAndre Fischer const Theme& rTheme (GetCurrentTheme()); 141b9e67834SAndre Fischer return rTheme.maIntegers[nIndex]; 142ff12d537SAndre Fischer } 143ff12d537SAndre Fischer 144ff12d537SAndre Fischer 145ff12d537SAndre Fischer 146ff12d537SAndre Fischer 147b9e67834SAndre Fischer bool Theme::GetBoolean (const ThemeItem eItem) 148ff12d537SAndre Fischer { 149b9e67834SAndre Fischer const PropertyType eType (GetPropertyType(eItem)); 150b9e67834SAndre Fischer OSL_ASSERT(eType==PT_Boolean); 151b9e67834SAndre Fischer const sal_Int32 nIndex (GetIndex(eItem, eType)); 152b9e67834SAndre Fischer const Theme& rTheme (GetCurrentTheme()); 153b9e67834SAndre Fischer return rTheme.maBooleans[nIndex]; 154ff12d537SAndre Fischer } 155ff12d537SAndre Fischer 156ff12d537SAndre Fischer 157ff12d537SAndre Fischer 158ff12d537SAndre Fischer 15995a18594SAndre Fischer Rectangle Theme::GetRectangle (const ThemeItem eItem) 16095a18594SAndre Fischer { 16195a18594SAndre Fischer const PropertyType eType (GetPropertyType(eItem)); 16295a18594SAndre Fischer OSL_ASSERT(eType==PT_Rectangle); 16395a18594SAndre Fischer const sal_Int32 nIndex (GetIndex(eItem, eType)); 16495a18594SAndre Fischer const Theme& rTheme (GetCurrentTheme()); 16595a18594SAndre Fischer return rTheme.maRectangles[nIndex]; 16695a18594SAndre Fischer } 16795a18594SAndre Fischer 16895a18594SAndre Fischer 16995a18594SAndre Fischer 17095a18594SAndre Fischer 171b9e67834SAndre Fischer bool Theme::IsHighContrastMode (void) 172ff12d537SAndre Fischer { 173b9e67834SAndre Fischer const Theme& rTheme (GetCurrentTheme()); 174b9e67834SAndre Fischer return rTheme.mbIsHighContrastMode; 175ff12d537SAndre Fischer } 176ff12d537SAndre Fischer 177ff12d537SAndre Fischer 178ff12d537SAndre Fischer 179ff12d537SAndre Fischer 180b9e67834SAndre Fischer void Theme::HandleDataChange (void) 181ff12d537SAndre Fischer { 18295a18594SAndre Fischer Theme& rTheme (GetCurrentTheme()); 18395a18594SAndre Fischer 18495a18594SAndre Fischer if ( ! rTheme.mbIsHighContrastModeSetManually) 18595a18594SAndre Fischer { 18695a18594SAndre Fischer // Do not modify mbIsHighContrastMode when it was manually set. 18795a18594SAndre Fischer GetCurrentTheme().mbIsHighContrastMode = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); 18895a18594SAndre Fischer rTheme.maRawValues[Bool_IsHighContrastModeActive] = Any(GetCurrentTheme().mbIsHighContrastMode); 18995a18594SAndre Fischer } 19095a18594SAndre Fischer 19195a18594SAndre Fischer GetCurrentTheme().UpdateTheme(); 192ff12d537SAndre Fischer } 193ff12d537SAndre Fischer 194ff12d537SAndre Fischer 195ff12d537SAndre Fischer 196ff12d537SAndre Fischer 197b9e67834SAndre Fischer void Theme::InitializeTheme (void) 19895a18594SAndre Fischer { 19995a18594SAndre Fischer setPropertyValue( 20095a18594SAndre Fischer maPropertyIdToNameMap[Bool_UseSymphonyIcons], 2010d805bddSAndre Fischer Any(false)); 20295a18594SAndre Fischer setPropertyValue( 20395a18594SAndre Fischer maPropertyIdToNameMap[Bool_UseSystemColors], 20495a18594SAndre Fischer Any(false)); 20595a18594SAndre Fischer } 20695a18594SAndre Fischer 20795a18594SAndre Fischer 20895a18594SAndre Fischer 20995a18594SAndre Fischer 21095a18594SAndre Fischer void Theme::UpdateTheme (void) 211ff12d537SAndre Fischer { 212b9e67834SAndre Fischer SidebarResource aLocalResource; 213b9e67834SAndre Fischer 214b9e67834SAndre Fischer try 215b9e67834SAndre Fischer { 21695a18594SAndre Fischer const StyleSettings& rStyle (Application::GetSettings().GetStyleSettings()); 21795a18594SAndre Fischer const bool bUseSystemColors (GetBoolean(Bool_UseSystemColors)); 21895a18594SAndre Fischer 21995a18594SAndre Fischer #define Alternatives(n,hc,sys) (mbIsHighContrastMode ? hc : (bUseSystemColors ? sys : n)) 22095a18594SAndre Fischer 221df0345d7SAndre Fischer Color aBaseBackgroundColor (rStyle.GetDialogColor()); 222df0345d7SAndre Fischer // UX says this should be a little brighter, but that looks off when compared to the other windows. 223df0345d7SAndre Fischer //aBaseBackgroundColor.IncreaseLuminance(7); 2248dcb2a10SAndre Fischer Color aBorderColor (aBaseBackgroundColor); 2258dcb2a10SAndre Fischer aBorderColor.DecreaseLuminance(15); 2268dcb2a10SAndre Fischer Color aSecondColor (aBaseBackgroundColor); 2278dcb2a10SAndre Fischer aSecondColor.DecreaseLuminance(15); 2288dcb2a10SAndre Fischer 229b9e67834SAndre Fischer setPropertyValue( 230b9e67834SAndre Fischer maPropertyIdToNameMap[Paint_DeckBackground], 231df0345d7SAndre Fischer Any(sal_Int32(aBaseBackgroundColor.GetRGBColor()))); 23295a18594SAndre Fischer 233b9e67834SAndre Fischer setPropertyValue( 234b9e67834SAndre Fischer maPropertyIdToNameMap[Paint_DeckTitleBarBackground], 2358dcb2a10SAndre Fischer Any(sal_Int32(aBaseBackgroundColor.GetRGBColor()))); 236b9e67834SAndre Fischer setPropertyValue( 237b9e67834SAndre Fischer maPropertyIdToNameMap[Int_DeckLeftPadding], 238b9e67834SAndre Fischer Any(sal_Int32(2))); 239b9e67834SAndre Fischer setPropertyValue( 240b9e67834SAndre Fischer maPropertyIdToNameMap[Int_DeckTopPadding], 241b9e67834SAndre Fischer Any(sal_Int32(2))); 242b9e67834SAndre Fischer setPropertyValue( 243b9e67834SAndre Fischer maPropertyIdToNameMap[Int_DeckRightPadding], 244b9e67834SAndre Fischer Any(sal_Int32(2))); 245b9e67834SAndre Fischer setPropertyValue( 246b9e67834SAndre Fischer maPropertyIdToNameMap[Int_DeckBottomPadding], 247b9e67834SAndre Fischer Any(sal_Int32(2))); 248b9e67834SAndre Fischer setPropertyValue( 249b9e67834SAndre Fischer maPropertyIdToNameMap[Int_DeckBorderSize], 250b9e67834SAndre Fischer Any(sal_Int32(1))); 251b9e67834SAndre Fischer setPropertyValue( 252b9e67834SAndre Fischer maPropertyIdToNameMap[Int_DeckSeparatorHeight], 253b9e67834SAndre Fischer Any(sal_Int32(1))); 25437fee4fdSAndre Fischer setPropertyValue( 25537fee4fdSAndre Fischer maPropertyIdToNameMap[Int_ButtonCornerRadius], 25637fee4fdSAndre Fischer Any(sal_Int32(3))); 257b9e67834SAndre Fischer setPropertyValue( 258b9e67834SAndre Fischer maPropertyIdToNameMap[Color_DeckTitleFont], 2598dcb2a10SAndre Fischer Any(sal_Int32(rStyle.GetFontColor().GetRGBColor()))); 260b9e67834SAndre Fischer setPropertyValue( 261b9e67834SAndre Fischer maPropertyIdToNameMap[Int_DeckTitleBarHeight], 26295a18594SAndre Fischer Any(sal_Int32(Alternatives( 26395a18594SAndre Fischer 26, 26495a18594SAndre Fischer 26, 26595a18594SAndre Fischer rStyle.GetFloatTitleHeight())))); 266b9e67834SAndre Fischer setPropertyValue( 267b9e67834SAndre Fischer maPropertyIdToNameMap[Paint_PanelBackground], 268df0345d7SAndre Fischer Any(sal_Int32(aBaseBackgroundColor.GetRGBColor()))); 269df0345d7SAndre Fischer 270b9e67834SAndre Fischer setPropertyValue( 271b9e67834SAndre Fischer maPropertyIdToNameMap[Paint_PanelTitleBarBackground], 2728dcb2a10SAndre Fischer Any(Tools::VclToAwtGradient(Gradient( 2738dcb2a10SAndre Fischer GRADIENT_LINEAR, 2748dcb2a10SAndre Fischer aSecondColor.GetRGBColor(), 2758dcb2a10SAndre Fischer aBaseBackgroundColor.GetRGBColor() 2768dcb2a10SAndre Fischer )))); 277b9e67834SAndre Fischer setPropertyValue( 278b9e67834SAndre Fischer maPropertyIdToNameMap[Color_PanelTitleFont], 279b9e67834SAndre Fischer Any(sal_Int32(mbIsHighContrastMode ? 0x00ff00 : 0x262626))); 280b9e67834SAndre Fischer setPropertyValue( 281b9e67834SAndre Fischer maPropertyIdToNameMap[Int_PanelTitleBarHeight], 28295a18594SAndre Fischer Any(sal_Int32(Alternatives( 28395a18594SAndre Fischer 26, 28495a18594SAndre Fischer 26, 28595a18594SAndre Fischer rStyle.GetTitleHeight())))); 286b9e67834SAndre Fischer setPropertyValue( 287b9e67834SAndre Fischer maPropertyIdToNameMap[Paint_TabBarBackground], 2888dcb2a10SAndre Fischer Any(sal_Int32(aBaseBackgroundColor.GetRGBColor()))); 289b9e67834SAndre Fischer setPropertyValue( 290b9e67834SAndre Fischer maPropertyIdToNameMap[Int_TabBarLeftPadding], 291b9e67834SAndre Fischer Any(sal_Int32(2))); 292b9e67834SAndre Fischer setPropertyValue( 293b9e67834SAndre Fischer maPropertyIdToNameMap[Int_TabBarTopPadding], 294b9e67834SAndre Fischer Any(sal_Int32(2))); 295b9e67834SAndre Fischer setPropertyValue( 296b9e67834SAndre Fischer maPropertyIdToNameMap[Int_TabBarRightPadding], 297b9e67834SAndre Fischer Any(sal_Int32(2))); 298b9e67834SAndre Fischer setPropertyValue( 299b9e67834SAndre Fischer maPropertyIdToNameMap[Int_TabBarBottomPadding], 300b9e67834SAndre Fischer Any(sal_Int32(2))); 301b9e67834SAndre Fischer 302b9e67834SAndre Fischer setPropertyValue( 303b9e67834SAndre Fischer maPropertyIdToNameMap[Int_TabMenuPadding], 304b9e67834SAndre Fischer Any(sal_Int32(6))); 305b9e67834SAndre Fischer setPropertyValue( 306b9e67834SAndre Fischer maPropertyIdToNameMap[Color_TabMenuSeparator], 3078dcb2a10SAndre Fischer Any(sal_Int32(aBorderColor.GetRGBColor()))); 308b9e67834SAndre Fischer setPropertyValue( 309b9e67834SAndre Fischer maPropertyIdToNameMap[Int_TabMenuSeparatorPadding], 310b9e67834SAndre Fischer Any(sal_Int32(7))); 311b9e67834SAndre Fischer 312b9e67834SAndre Fischer setPropertyValue( 313b9e67834SAndre Fischer maPropertyIdToNameMap[Int_TabItemWidth], 314b9e67834SAndre Fischer Any(sal_Int32(32))); 315b9e67834SAndre Fischer setPropertyValue( 316b9e67834SAndre Fischer maPropertyIdToNameMap[Int_TabItemHeight], 317b9e67834SAndre Fischer Any(sal_Int32(32))); 318b9e67834SAndre Fischer setPropertyValue( 319b9e67834SAndre Fischer maPropertyIdToNameMap[Color_TabItemBorder], 3208dcb2a10SAndre Fischer Any(sal_Int32(rStyle.GetActiveBorderColor().GetRGBColor()))); 3218dcb2a10SAndre Fischer // mbIsHighContrastMode ? 0x00ff00 : 0xbfbfbf))); 3228dcb2a10SAndre Fischer 3238dcb2a10SAndre Fischer setPropertyValue( 3248dcb2a10SAndre Fischer maPropertyIdToNameMap[Paint_DropDownBackground], 3258dcb2a10SAndre Fischer Any(sal_Int32(aBaseBackgroundColor.GetRGBColor()))); 3268dcb2a10SAndre Fischer setPropertyValue( 3278dcb2a10SAndre Fischer maPropertyIdToNameMap[Color_DropDownBorder], 3288dcb2a10SAndre Fischer Any(sal_Int32(rStyle.GetActiveBorderColor().GetRGBColor()))); 3298dcb2a10SAndre Fischer 3305f1c83ffSOliver-Rainer Wittmann setPropertyValue( 3315f1c83ffSOliver-Rainer Wittmann maPropertyIdToNameMap[Color_Highlight], 3325f1c83ffSOliver-Rainer Wittmann Any(sal_Int32(rStyle.GetHighlightColor().GetRGBColor()))); 3335f1c83ffSOliver-Rainer Wittmann setPropertyValue( 3345f1c83ffSOliver-Rainer Wittmann maPropertyIdToNameMap[Color_HighlightText], 3355f1c83ffSOliver-Rainer Wittmann Any(sal_Int32(rStyle.GetHighlightTextColor().GetRGBColor()))); 3365f1c83ffSOliver-Rainer Wittmann 337b9e67834SAndre Fischer setPropertyValue( 33895a18594SAndre Fischer maPropertyIdToNameMap[Paint_TabItemBackgroundNormal], 33995a18594SAndre Fischer Any()); 34095a18594SAndre Fischer setPropertyValue( 34195a18594SAndre Fischer maPropertyIdToNameMap[Paint_TabItemBackgroundHighlight], 3428dcb2a10SAndre Fischer Any(sal_Int32(rStyle.GetActiveTabColor().GetRGBColor()))); 3438dcb2a10SAndre Fischer // mbIsHighContrastMode ? 0x000000 : 0x00ffffff))); 344b9e67834SAndre Fischer 345b9e67834SAndre Fischer setPropertyValue( 346b9e67834SAndre Fischer maPropertyIdToNameMap[Paint_HorizontalBorder], 3478dcb2a10SAndre Fischer Any(sal_Int32(aBorderColor.GetRGBColor()))); 3488dcb2a10SAndre Fischer // mbIsHighContrastMode ? 0x00ff00 : 0xe4e4e4))); 349b9e67834SAndre Fischer setPropertyValue( 350b9e67834SAndre Fischer maPropertyIdToNameMap[Paint_VerticalBorder], 3518dcb2a10SAndre Fischer Any(sal_Int32(aBorderColor.GetRGBColor()))); 3528dcb2a10SAndre Fischer // mbIsHighContrastMode ? 0x00ff00 : 0xe4e4e4))); 353b9e67834SAndre Fischer 354b9e67834SAndre Fischer setPropertyValue( 355b9e67834SAndre Fischer maPropertyIdToNameMap[Image_Grip], 356b9e67834SAndre Fischer Any( 357b9e67834SAndre Fischer mbIsHighContrastMode 358b9e67834SAndre Fischer ? A2S("private:graphicrepository/sfx2/res/grip_hc.png") 359b9e67834SAndre Fischer : A2S("private:graphicrepository/sfx2/res/grip.png"))); 360b9e67834SAndre Fischer setPropertyValue( 361b9e67834SAndre Fischer maPropertyIdToNameMap[Image_Expand], 362b9e67834SAndre Fischer Any( 363b9e67834SAndre Fischer mbIsHighContrastMode 3646e6252f3SAndre Fischer ? A2S("private:graphicrepository/res/plus_sch.png") 3656e6252f3SAndre Fischer : A2S("private:graphicrepository/res/plus.png"))); 366b9e67834SAndre Fischer setPropertyValue( 367b9e67834SAndre Fischer maPropertyIdToNameMap[Image_Collapse], 368b9e67834SAndre Fischer Any( 369b9e67834SAndre Fischer mbIsHighContrastMode 3706e6252f3SAndre Fischer ? A2S("private:graphicrepository/res/minus_sch.png") 3716e6252f3SAndre Fischer : A2S("private:graphicrepository/res/minus.png"))); 372b9e67834SAndre Fischer setPropertyValue( 3737a32b0c8SAndre Fischer maPropertyIdToNameMap[Image_TabBarMenu], 374b9e67834SAndre Fischer Any( 375b9e67834SAndre Fischer mbIsHighContrastMode 37695a18594SAndre Fischer ? A2S("private:graphicrepository/sfx2/res/menu_hc.png") 3776e6252f3SAndre Fischer : A2S("private:graphicrepository/sfx2/res/symphony/open_more.png"))); 3787a32b0c8SAndre Fischer setPropertyValue( 3797a32b0c8SAndre Fischer maPropertyIdToNameMap[Image_PanelMenu], 3807a32b0c8SAndre Fischer Any( 3817a32b0c8SAndre Fischer mbIsHighContrastMode 3826e6252f3SAndre Fischer ? A2S("private:graphicrepository/sfx2/res/symphony/morebutton.png") 3836e6252f3SAndre Fischer : A2S("private:graphicrepository/sfx2/res/symphony/morebutton_h.png"))); 3847a32b0c8SAndre Fischer setPropertyValue( 3857a32b0c8SAndre Fischer maPropertyIdToNameMap[Image_Closer], 3867a32b0c8SAndre Fischer Any(A2S("private:graphicrepository/sfx2/res/closedoc.png"))); 38713e1c3b4SAndre Fischer setPropertyValue( 38813e1c3b4SAndre Fischer maPropertyIdToNameMap[Image_CloseIndicator], 38913e1c3b4SAndre Fischer Any( 39013e1c3b4SAndre Fischer mbIsHighContrastMode 39113e1c3b4SAndre Fischer ? A2S("private:graphicrepository/res/commandimagelist/lch_decrementlevel.png") 39213e1c3b4SAndre Fischer : A2S("private:graphicrepository/res/commandimagelist/lc_decrementlevel.png"))); 39395a18594SAndre Fischer setPropertyValue( 39495a18594SAndre Fischer maPropertyIdToNameMap[Image_ToolBoxItemSeparator], 39595a18594SAndre Fischer Any( 39695a18594SAndre Fischer A2S("private:graphicrepository/sfx2/res/separator.png"))); 397b9e67834SAndre Fischer 39895a18594SAndre Fischer // ToolBox 3998dcb2a10SAndre Fischer 4008dcb2a10SAndre Fischer /* 4018dcb2a10SAndre Fischer // Separator style 4028dcb2a10SAndre Fischer setPropertyValue( 4038dcb2a10SAndre Fischer maPropertyIdToNameMap[Paint_ToolBoxBackground], 4048dcb2a10SAndre Fischer Any(sal_Int32(rStyle.GetMenuColor().GetRGBColor()))); 4058dcb2a10SAndre Fischer setPropertyValue( 4068dcb2a10SAndre Fischer maPropertyIdToNameMap[Paint_ToolBoxBorderTopLeft], 4078dcb2a10SAndre Fischer Any()); 4088dcb2a10SAndre Fischer setPropertyValue( 4098dcb2a10SAndre Fischer maPropertyIdToNameMap[Paint_ToolBoxBorderCenterCorners], 4108dcb2a10SAndre Fischer Any()); 4118dcb2a10SAndre Fischer setPropertyValue( 4128dcb2a10SAndre Fischer maPropertyIdToNameMap[Paint_ToolBoxBorderBottomRight], 4138dcb2a10SAndre Fischer Any()); 4148dcb2a10SAndre Fischer setPropertyValue( 4158dcb2a10SAndre Fischer maPropertyIdToNameMap[Rect_ToolBoxPadding], 4168dcb2a10SAndre Fischer Any(awt::Rectangle(2,2,2,2))); 4178dcb2a10SAndre Fischer setPropertyValue( 4188dcb2a10SAndre Fischer maPropertyIdToNameMap[Rect_ToolBoxBorder], 4198dcb2a10SAndre Fischer Any(awt::Rectangle(0,0,0,0))); 4208dcb2a10SAndre Fischer setPropertyValue( 4218dcb2a10SAndre Fischer maPropertyIdToNameMap[Bool_UseToolBoxItemSeparator], 4228dcb2a10SAndre Fischer Any(true)); 4238dcb2a10SAndre Fischer 4248dcb2a10SAndre Fischer */ 4258dcb2a10SAndre Fischer 4268dcb2a10SAndre Fischer // Gradient style 42795a18594SAndre Fischer setPropertyValue( 42895a18594SAndre Fischer maPropertyIdToNameMap[Paint_ToolBoxBackground], 42995a18594SAndre Fischer Any(Tools::VclToAwtGradient(Gradient( 43095a18594SAndre Fischer GRADIENT_LINEAR, 43195a18594SAndre Fischer Color(0xf2f2f2), 43295a18594SAndre Fischer Color(0xfefefe) 43395a18594SAndre Fischer )))); 43495a18594SAndre Fischer setPropertyValue( 43595a18594SAndre Fischer maPropertyIdToNameMap[Paint_ToolBoxBorderTopLeft], 43695a18594SAndre Fischer mbIsHighContrastMode 43795a18594SAndre Fischer ? Any(util::Color(sal_uInt32(0x00ff00))) 43895a18594SAndre Fischer : Any(util::Color(sal_uInt32(0xf2f2f2)))); 43995a18594SAndre Fischer setPropertyValue( 44095a18594SAndre Fischer maPropertyIdToNameMap[Paint_ToolBoxBorderCenterCorners], 44195a18594SAndre Fischer mbIsHighContrastMode 44295a18594SAndre Fischer ? Any(util::Color(sal_uInt32(0x00ff00))) 44395a18594SAndre Fischer : Any(util::Color(sal_uInt32(0xf2f2f2)))); 444b9e67834SAndre Fischer setPropertyValue( 44595a18594SAndre Fischer maPropertyIdToNameMap[Paint_ToolBoxBorderBottomRight], 44695a18594SAndre Fischer mbIsHighContrastMode 44795a18594SAndre Fischer ? Any(util::Color(sal_uInt32(0x00ff00))) 44895a18594SAndre Fischer : Any(util::Color(sal_uInt32(0xf2f2f2)))); 44995a18594SAndre Fischer setPropertyValue( 45095a18594SAndre Fischer maPropertyIdToNameMap[Rect_ToolBoxPadding], 45195a18594SAndre Fischer Any(awt::Rectangle(2,2,2,2))); 45295a18594SAndre Fischer setPropertyValue( 45395a18594SAndre Fischer maPropertyIdToNameMap[Rect_ToolBoxBorder], 45495a18594SAndre Fischer Any(awt::Rectangle(1,1,1,1))); 45595a18594SAndre Fischer setPropertyValue( 45695a18594SAndre Fischer maPropertyIdToNameMap[Bool_UseToolBoxItemSeparator], 45795a18594SAndre Fischer Any(false)); 458b9e67834SAndre Fischer } 45995a18594SAndre Fischer catch(beans::UnknownPropertyException& rException) 460b9e67834SAndre Fischer { 46195a18594SAndre Fischer OSL_TRACE("unknown property: %s", 46295a18594SAndre Fischer OUStringToOString( 46395a18594SAndre Fischer rException.Message, 46495a18594SAndre Fischer RTL_TEXTENCODING_ASCII_US).getStr()); 465b9e67834SAndre Fischer OSL_ASSERT(false); 466b9e67834SAndre Fischer } 467ff12d537SAndre Fischer } 468ff12d537SAndre Fischer 469ff12d537SAndre Fischer 470ff12d537SAndre Fischer 471ff12d537SAndre Fischer 472b9e67834SAndre Fischer void SAL_CALL Theme::disposing (void) 473ff12d537SAndre Fischer { 474b9e67834SAndre Fischer ChangeListeners aListeners; 475b9e67834SAndre Fischer maChangeListeners.swap(aListeners); 476b9e67834SAndre Fischer 477b9e67834SAndre Fischer const lang::EventObject aEvent (static_cast<XWeak*>(this)); 478b9e67834SAndre Fischer 479b9e67834SAndre Fischer for (ChangeListeners::const_iterator 480b9e67834SAndre Fischer iContainer(maChangeListeners.begin()), 481b9e67834SAndre Fischer iContainerEnd(maChangeListeners.end()); 482b9e67834SAndre Fischer iContainerEnd!=iContainerEnd; 483b9e67834SAndre Fischer ++iContainerEnd) 484b9e67834SAndre Fischer { 485b9e67834SAndre Fischer for (ChangeListenerContainer::const_iterator 486b9e67834SAndre Fischer iListener(iContainer->second.begin()), 487b9e67834SAndre Fischer iEnd(iContainer->second.end()); 488b9e67834SAndre Fischer iListener!=iEnd; 489b9e67834SAndre Fischer ++iListener) 490b9e67834SAndre Fischer { 491b9e67834SAndre Fischer try 492b9e67834SAndre Fischer { 493b9e67834SAndre Fischer (*iListener)->disposing(aEvent); 494b9e67834SAndre Fischer } 495b9e67834SAndre Fischer catch(const Exception&) 496b9e67834SAndre Fischer { 497b9e67834SAndre Fischer } 498b9e67834SAndre Fischer } 499b9e67834SAndre Fischer } 500ff12d537SAndre Fischer } 501ff12d537SAndre Fischer 502ff12d537SAndre Fischer 503ff12d537SAndre Fischer 504ff12d537SAndre Fischer 505b9e67834SAndre Fischer Reference<beans::XPropertySet> Theme::GetPropertySet (void) 506ff12d537SAndre Fischer { 507b9e67834SAndre Fischer return Reference<beans::XPropertySet>(static_cast<XWeak*>(&GetCurrentTheme()), UNO_QUERY); 508ff12d537SAndre Fischer } 509ff12d537SAndre Fischer 510ff12d537SAndre Fischer 511ff12d537SAndre Fischer 512ff12d537SAndre Fischer 513b9e67834SAndre Fischer Reference<beans::XPropertySetInfo> SAL_CALL Theme::getPropertySetInfo (void) 514b9e67834SAndre Fischer throw(cssu::RuntimeException) 515ff12d537SAndre Fischer { 51695a18594SAndre Fischer return Reference<beans::XPropertySetInfo>(this); 517ff12d537SAndre Fischer } 518ff12d537SAndre Fischer 519ff12d537SAndre Fischer 520ff12d537SAndre Fischer 521ff12d537SAndre Fischer 522b9e67834SAndre Fischer void SAL_CALL Theme::setPropertyValue ( 523b9e67834SAndre Fischer const ::rtl::OUString& rsPropertyName, 524b9e67834SAndre Fischer const cssu::Any& rValue) 525b9e67834SAndre Fischer throw(cssu::RuntimeException) 526ff12d537SAndre Fischer { 527b9e67834SAndre Fischer PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName)); 528b9e67834SAndre Fischer if (iId == maPropertyNameToIdMap.end()) 52995a18594SAndre Fischer throw beans::UnknownPropertyException(rsPropertyName, NULL); 530b9e67834SAndre Fischer 531b9e67834SAndre Fischer const PropertyType eType (GetPropertyType(iId->second)); 532b9e67834SAndre Fischer if (eType == PT_Invalid) 53395a18594SAndre Fischer throw beans::UnknownPropertyException(rsPropertyName, NULL); 534b9e67834SAndre Fischer 535b9e67834SAndre Fischer const ThemeItem eItem (iId->second); 536b9e67834SAndre Fischer 537b9e67834SAndre Fischer if (rValue == maRawValues[eItem]) 538b9e67834SAndre Fischer { 539b9e67834SAndre Fischer // Value is not different from the one in the property 540b9e67834SAndre Fischer // set => nothing to do. 541b9e67834SAndre Fischer return; 542b9e67834SAndre Fischer } 543b9e67834SAndre Fischer 544b9e67834SAndre Fischer const Any aOldValue (maRawValues[eItem]); 545b9e67834SAndre Fischer 546b9e67834SAndre Fischer const beans::PropertyChangeEvent aEvent( 547b9e67834SAndre Fischer static_cast<XWeak*>(this), 548b9e67834SAndre Fischer rsPropertyName, 549b9e67834SAndre Fischer sal_False, 550b9e67834SAndre Fischer eItem, 551b9e67834SAndre Fischer aOldValue, 552b9e67834SAndre Fischer rValue); 553b9e67834SAndre Fischer 554b9e67834SAndre Fischer if (DoVetoableListenersVeto(GetVetoableListeners(__AnyItem, false), aEvent)) 555b9e67834SAndre Fischer return; 556b9e67834SAndre Fischer if (DoVetoableListenersVeto(GetVetoableListeners(eItem, false), aEvent)) 557b9e67834SAndre Fischer return; 558b9e67834SAndre Fischer 559b9e67834SAndre Fischer maRawValues[eItem] = rValue; 560b9e67834SAndre Fischer ProcessNewValue(rValue, eItem, eType); 561b9e67834SAndre Fischer 562b9e67834SAndre Fischer BroadcastPropertyChange(GetChangeListeners(__AnyItem, false), aEvent); 563b9e67834SAndre Fischer BroadcastPropertyChange(GetChangeListeners(eItem, false), aEvent); 564ff12d537SAndre Fischer } 565ff12d537SAndre Fischer 566ff12d537SAndre Fischer 567ff12d537SAndre Fischer 568ff12d537SAndre Fischer 569b9e67834SAndre Fischer Any SAL_CALL Theme::getPropertyValue ( 570b9e67834SAndre Fischer const ::rtl::OUString& rsPropertyName) 571b9e67834SAndre Fischer throw(css::beans::UnknownPropertyException, 572b9e67834SAndre Fischer css::lang::WrappedTargetException, 573b9e67834SAndre Fischer cssu::RuntimeException) 574ff12d537SAndre Fischer { 575b9e67834SAndre Fischer PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName)); 576b9e67834SAndre Fischer if (iId == maPropertyNameToIdMap.end()) 577b9e67834SAndre Fischer throw beans::UnknownPropertyException(); 578b9e67834SAndre Fischer 579b9e67834SAndre Fischer const PropertyType eType (GetPropertyType(iId->second)); 580b9e67834SAndre Fischer if (eType == PT_Invalid) 581b9e67834SAndre Fischer throw beans::UnknownPropertyException(); 582b9e67834SAndre Fischer 583b9e67834SAndre Fischer const ThemeItem eItem (iId->second); 584b9e67834SAndre Fischer 585b9e67834SAndre Fischer return maRawValues[eItem]; 586ff12d537SAndre Fischer } 587ff12d537SAndre Fischer 588ff12d537SAndre Fischer 589ff12d537SAndre Fischer 590ff12d537SAndre Fischer 591b9e67834SAndre Fischer void SAL_CALL Theme::addPropertyChangeListener( 592b9e67834SAndre Fischer const ::rtl::OUString& rsPropertyName, 593b9e67834SAndre Fischer const cssu::Reference<css::beans::XPropertyChangeListener>& rxListener) 594b9e67834SAndre Fischer throw(css::beans::UnknownPropertyException, 595b9e67834SAndre Fischer css::lang::WrappedTargetException, 596b9e67834SAndre Fischer cssu::RuntimeException) 597ff12d537SAndre Fischer { 598b9e67834SAndre Fischer ThemeItem eItem (__AnyItem); 599b9e67834SAndre Fischer if (rsPropertyName.getLength() > 0) 600b9e67834SAndre Fischer { 601b9e67834SAndre Fischer PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName)); 602b9e67834SAndre Fischer if (iId == maPropertyNameToIdMap.end()) 603b9e67834SAndre Fischer throw beans::UnknownPropertyException(); 604b9e67834SAndre Fischer 605b9e67834SAndre Fischer const PropertyType eType (GetPropertyType(iId->second)); 606b9e67834SAndre Fischer if (eType == PT_Invalid) 607b9e67834SAndre Fischer throw beans::UnknownPropertyException(); 608b9e67834SAndre Fischer 609b9e67834SAndre Fischer eItem = iId->second; 610b9e67834SAndre Fischer } 611b9e67834SAndre Fischer ChangeListenerContainer* pListeners = GetChangeListeners(eItem, true); 612b9e67834SAndre Fischer if (pListeners != NULL) 613b9e67834SAndre Fischer pListeners->push_back(rxListener); 614ff12d537SAndre Fischer } 615ff12d537SAndre Fischer 616ff12d537SAndre Fischer 617ff12d537SAndre Fischer 618ff12d537SAndre Fischer 619b9e67834SAndre Fischer void SAL_CALL Theme::removePropertyChangeListener( 620b9e67834SAndre Fischer const ::rtl::OUString& rsPropertyName, 621b9e67834SAndre Fischer const cssu::Reference<css::beans::XPropertyChangeListener>& rxListener) 622b9e67834SAndre Fischer throw(css::beans::UnknownPropertyException, 623b9e67834SAndre Fischer css::lang::WrappedTargetException, 624b9e67834SAndre Fischer cssu::RuntimeException) 625ff12d537SAndre Fischer { 626b9e67834SAndre Fischer ThemeItem eItem (__AnyItem); 627b9e67834SAndre Fischer if (rsPropertyName.getLength() > 0) 628b9e67834SAndre Fischer { 629b9e67834SAndre Fischer PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName)); 630b9e67834SAndre Fischer if (iId == maPropertyNameToIdMap.end()) 631b9e67834SAndre Fischer throw beans::UnknownPropertyException(); 632b9e67834SAndre Fischer 633b9e67834SAndre Fischer const PropertyType eType (GetPropertyType(iId->second)); 634b9e67834SAndre Fischer if (eType == PT_Invalid) 635b9e67834SAndre Fischer throw beans::UnknownPropertyException(); 636b9e67834SAndre Fischer 637b9e67834SAndre Fischer eItem = iId->second; 638b9e67834SAndre Fischer } 639b9e67834SAndre Fischer ChangeListenerContainer* pContainer = GetChangeListeners(eItem, false); 640b9e67834SAndre Fischer if (pContainer != NULL) 641b9e67834SAndre Fischer { 642b9e67834SAndre Fischer ChangeListenerContainer::iterator iListener (::std::find(pContainer->begin(), pContainer->end(), rxListener)); 643b9e67834SAndre Fischer if (iListener != pContainer->end()) 644b9e67834SAndre Fischer { 645b9e67834SAndre Fischer pContainer->erase(iListener); 646b9e67834SAndre Fischer 647b9e67834SAndre Fischer // Remove the listener container when empty. 648b9e67834SAndre Fischer if (pContainer->empty()) 649b9e67834SAndre Fischer maChangeListeners.erase(eItem); 650b9e67834SAndre Fischer } 651b9e67834SAndre Fischer } 652ff12d537SAndre Fischer } 653ff12d537SAndre Fischer 654ff12d537SAndre Fischer 655ff12d537SAndre Fischer 656ff12d537SAndre Fischer 657b9e67834SAndre Fischer void SAL_CALL Theme::addVetoableChangeListener( 658b9e67834SAndre Fischer const ::rtl::OUString& rsPropertyName, 659b9e67834SAndre Fischer const cssu::Reference<css::beans::XVetoableChangeListener>& rxListener) 660b9e67834SAndre Fischer throw(css::beans::UnknownPropertyException, 661b9e67834SAndre Fischer css::lang::WrappedTargetException, 662b9e67834SAndre Fischer cssu::RuntimeException) 663ff12d537SAndre Fischer { 664b9e67834SAndre Fischer ThemeItem eItem (__AnyItem); 665b9e67834SAndre Fischer if (rsPropertyName.getLength() > 0) 666b9e67834SAndre Fischer { 667b9e67834SAndre Fischer PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName)); 668b9e67834SAndre Fischer if (iId == maPropertyNameToIdMap.end()) 669b9e67834SAndre Fischer throw beans::UnknownPropertyException(); 670b9e67834SAndre Fischer 671b9e67834SAndre Fischer const PropertyType eType (GetPropertyType(iId->second)); 672b9e67834SAndre Fischer if (eType == PT_Invalid) 673b9e67834SAndre Fischer throw beans::UnknownPropertyException(); 674b9e67834SAndre Fischer 675b9e67834SAndre Fischer eItem = iId->second; 676b9e67834SAndre Fischer } 677b9e67834SAndre Fischer VetoableListenerContainer* pListeners = GetVetoableListeners(eItem, true); 678b9e67834SAndre Fischer if (pListeners != NULL) 679b9e67834SAndre Fischer pListeners->push_back(rxListener); 680ff12d537SAndre Fischer } 681ff12d537SAndre Fischer 682ff12d537SAndre Fischer 683ff12d537SAndre Fischer 684ff12d537SAndre Fischer 685b9e67834SAndre Fischer void SAL_CALL Theme::removeVetoableChangeListener( 686b9e67834SAndre Fischer const ::rtl::OUString& rsPropertyName, 687b9e67834SAndre Fischer const cssu::Reference<css::beans::XVetoableChangeListener>& rxListener) 688b9e67834SAndre Fischer throw(css::beans::UnknownPropertyException, 689b9e67834SAndre Fischer css::lang::WrappedTargetException, 690b9e67834SAndre Fischer cssu::RuntimeException) 691ff12d537SAndre Fischer { 692b9e67834SAndre Fischer ThemeItem eItem (__AnyItem); 693b9e67834SAndre Fischer if (rsPropertyName.getLength() > 0) 694b9e67834SAndre Fischer { 695b9e67834SAndre Fischer PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName)); 696b9e67834SAndre Fischer if (iId == maPropertyNameToIdMap.end()) 697b9e67834SAndre Fischer throw beans::UnknownPropertyException(); 698b9e67834SAndre Fischer 699b9e67834SAndre Fischer const PropertyType eType (GetPropertyType(iId->second)); 700b9e67834SAndre Fischer if (eType == PT_Invalid) 701b9e67834SAndre Fischer throw beans::UnknownPropertyException(); 702b9e67834SAndre Fischer 703b9e67834SAndre Fischer eItem = iId->second; 704b9e67834SAndre Fischer } 705b9e67834SAndre Fischer VetoableListenerContainer* pContainer = GetVetoableListeners(eItem, false); 706b9e67834SAndre Fischer if (pContainer != NULL) 707b9e67834SAndre Fischer { 708b9e67834SAndre Fischer VetoableListenerContainer::iterator iListener (::std::find(pContainer->begin(), pContainer->end(), rxListener)); 709b9e67834SAndre Fischer if (iListener != pContainer->end()) 710b9e67834SAndre Fischer { 711b9e67834SAndre Fischer pContainer->erase(iListener); 712b9e67834SAndre Fischer // Remove container when empty. 713b9e67834SAndre Fischer if (pContainer->empty()) 714b9e67834SAndre Fischer maVetoableListeners.erase(eItem); 715b9e67834SAndre Fischer } 716b9e67834SAndre Fischer } 717ff12d537SAndre Fischer } 718ff12d537SAndre Fischer 719ff12d537SAndre Fischer 720ff12d537SAndre Fischer 721ff12d537SAndre Fischer 72295a18594SAndre Fischer cssu::Sequence<css::beans::Property> SAL_CALL Theme::getProperties (void) 72395a18594SAndre Fischer throw(cssu::RuntimeException) 72495a18594SAndre Fischer { 72595a18594SAndre Fischer ::std::vector<beans::Property> aProperties; 72695a18594SAndre Fischer 72795a18594SAndre Fischer for (sal_Int32 nItem(__Begin),nEnd(__End); nItem!=nEnd; ++nItem) 72895a18594SAndre Fischer { 72995a18594SAndre Fischer const ThemeItem eItem (static_cast<ThemeItem>(nItem)); 73095a18594SAndre Fischer const PropertyType eType (GetPropertyType(eItem)); 73195a18594SAndre Fischer if (eType == PT_Invalid) 73295a18594SAndre Fischer continue; 73395a18594SAndre Fischer 73495a18594SAndre Fischer const beans::Property aProperty( 73595a18594SAndre Fischer maPropertyIdToNameMap[eItem], 73695a18594SAndre Fischer eItem, 73795a18594SAndre Fischer GetCppuType(eType), 73895a18594SAndre Fischer 0); 73995a18594SAndre Fischer aProperties.push_back(aProperty); 74095a18594SAndre Fischer } 74195a18594SAndre Fischer 74295a18594SAndre Fischer return cssu::Sequence<css::beans::Property>( 74395a18594SAndre Fischer &aProperties.front(), 74495a18594SAndre Fischer aProperties.size()); 74595a18594SAndre Fischer } 74695a18594SAndre Fischer 74795a18594SAndre Fischer 74895a18594SAndre Fischer 74995a18594SAndre Fischer 75095a18594SAndre Fischer beans::Property SAL_CALL Theme::getPropertyByName (const ::rtl::OUString& rsPropertyName) 75195a18594SAndre Fischer throw(css::beans::UnknownPropertyException, 75295a18594SAndre Fischer cssu::RuntimeException) 75395a18594SAndre Fischer { 75495a18594SAndre Fischer PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName)); 75595a18594SAndre Fischer if (iId == maPropertyNameToIdMap.end()) 75695a18594SAndre Fischer throw beans::UnknownPropertyException(); 75795a18594SAndre Fischer 75895a18594SAndre Fischer const PropertyType eType (GetPropertyType(iId->second)); 75995a18594SAndre Fischer if (eType == PT_Invalid) 76095a18594SAndre Fischer throw beans::UnknownPropertyException(); 76195a18594SAndre Fischer 76295a18594SAndre Fischer const ThemeItem eItem (iId->second); 76395a18594SAndre Fischer 76495a18594SAndre Fischer return beans::Property( 76595a18594SAndre Fischer rsPropertyName, 76695a18594SAndre Fischer eItem, 76795a18594SAndre Fischer GetCppuType(eType), 76895a18594SAndre Fischer 0); 76995a18594SAndre Fischer } 77095a18594SAndre Fischer 77195a18594SAndre Fischer 77295a18594SAndre Fischer 77395a18594SAndre Fischer 77495a18594SAndre Fischer sal_Bool SAL_CALL Theme::hasPropertyByName (const ::rtl::OUString& rsPropertyName) 77595a18594SAndre Fischer throw(cssu::RuntimeException) 77695a18594SAndre Fischer { 77795a18594SAndre Fischer PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName)); 77895a18594SAndre Fischer if (iId == maPropertyNameToIdMap.end()) 77995a18594SAndre Fischer return sal_False; 78095a18594SAndre Fischer 78195a18594SAndre Fischer const PropertyType eType (GetPropertyType(iId->second)); 78295a18594SAndre Fischer if (eType == PT_Invalid) 78395a18594SAndre Fischer return sal_False; 78495a18594SAndre Fischer 78595a18594SAndre Fischer return sal_True; 78695a18594SAndre Fischer } 78795a18594SAndre Fischer 78895a18594SAndre Fischer 78995a18594SAndre Fischer 79095a18594SAndre Fischer 791b9e67834SAndre Fischer void Theme::SetupPropertyMaps (void) 792ff12d537SAndre Fischer { 79395a18594SAndre Fischer maPropertyIdToNameMap.resize(__Post_Rect); 794b9e67834SAndre Fischer maImages.resize(__Image_Color - __Pre_Image - 1); 795b9e67834SAndre Fischer maColors.resize(__Color_Paint - __Image_Color - 1); 796b9e67834SAndre Fischer maPaints.resize(__Paint_Int - __Color_Paint - 1); 797b9e67834SAndre Fischer maIntegers.resize(__Int_Bool - __Paint_Int - 1); 79895a18594SAndre Fischer maBooleans.resize(__Bool_Rect - __Int_Bool - 1); 79995a18594SAndre Fischer maRectangles.resize(__Post_Rect - __Bool_Rect - 1); 800b9e67834SAndre Fischer 801b9e67834SAndre Fischer #define AddEntry(e) maPropertyNameToIdMap[A2S(#e)]=e; maPropertyIdToNameMap[e]=A2S(#e) 80295a18594SAndre Fischer 803b9e67834SAndre Fischer AddEntry(Image_Grip); 804b9e67834SAndre Fischer AddEntry(Image_Expand); 805b9e67834SAndre Fischer AddEntry(Image_Collapse); 8067a32b0c8SAndre Fischer AddEntry(Image_TabBarMenu); 8077a32b0c8SAndre Fischer AddEntry(Image_PanelMenu); 80895a18594SAndre Fischer AddEntry(Image_ToolBoxItemSeparator); 8097a32b0c8SAndre Fischer AddEntry(Image_Closer); 81013e1c3b4SAndre Fischer AddEntry(Image_CloseIndicator); 811b9e67834SAndre Fischer 812b9e67834SAndre Fischer AddEntry(Color_DeckTitleFont); 813b9e67834SAndre Fischer AddEntry(Color_PanelTitleFont); 814b9e67834SAndre Fischer AddEntry(Color_TabMenuSeparator); 815b9e67834SAndre Fischer AddEntry(Color_TabItemBorder); 8168dcb2a10SAndre Fischer AddEntry(Color_DropDownBorder); 8175f1c83ffSOliver-Rainer Wittmann AddEntry(Color_Highlight); 8185f1c83ffSOliver-Rainer Wittmann AddEntry(Color_HighlightText); 819b9e67834SAndre Fischer 820b9e67834SAndre Fischer AddEntry(Paint_DeckBackground); 821b9e67834SAndre Fischer AddEntry(Paint_DeckTitleBarBackground); 822b9e67834SAndre Fischer AddEntry(Paint_PanelBackground); 823b9e67834SAndre Fischer AddEntry(Paint_PanelTitleBarBackground); 824b9e67834SAndre Fischer AddEntry(Paint_TabBarBackground); 82595a18594SAndre Fischer AddEntry(Paint_TabItemBackgroundNormal); 82695a18594SAndre Fischer AddEntry(Paint_TabItemBackgroundHighlight); 827b9e67834SAndre Fischer AddEntry(Paint_HorizontalBorder); 828b9e67834SAndre Fischer AddEntry(Paint_VerticalBorder); 82995a18594SAndre Fischer AddEntry(Paint_ToolBoxBackground); 83095a18594SAndre Fischer AddEntry(Paint_ToolBoxBorderTopLeft); 83195a18594SAndre Fischer AddEntry(Paint_ToolBoxBorderCenterCorners); 83295a18594SAndre Fischer AddEntry(Paint_ToolBoxBorderBottomRight); 8338dcb2a10SAndre Fischer AddEntry(Paint_DropDownBackground); 834b9e67834SAndre Fischer 835b9e67834SAndre Fischer AddEntry(Int_DeckTitleBarHeight); 836b9e67834SAndre Fischer AddEntry(Int_DeckBorderSize); 837b9e67834SAndre Fischer AddEntry(Int_DeckSeparatorHeight); 838b9e67834SAndre Fischer AddEntry(Int_PanelTitleBarHeight); 839b9e67834SAndre Fischer AddEntry(Int_TabMenuPadding); 840b9e67834SAndre Fischer AddEntry(Int_TabMenuSeparatorPadding); 841b9e67834SAndre Fischer AddEntry(Int_TabItemWidth); 842b9e67834SAndre Fischer AddEntry(Int_TabItemHeight); 843b9e67834SAndre Fischer AddEntry(Int_DeckLeftPadding); 844b9e67834SAndre Fischer AddEntry(Int_DeckTopPadding); 845b9e67834SAndre Fischer AddEntry(Int_DeckRightPadding); 846b9e67834SAndre Fischer AddEntry(Int_DeckBottomPadding); 847b9e67834SAndre Fischer AddEntry(Int_TabBarLeftPadding); 848b9e67834SAndre Fischer AddEntry(Int_TabBarTopPadding); 849b9e67834SAndre Fischer AddEntry(Int_TabBarRightPadding); 850b9e67834SAndre Fischer AddEntry(Int_TabBarBottomPadding); 85137fee4fdSAndre Fischer AddEntry(Int_ButtonCornerRadius); 852b9e67834SAndre Fischer 853b9e67834SAndre Fischer AddEntry(Bool_UseSymphonyIcons); 85495a18594SAndre Fischer AddEntry(Bool_UseSystemColors); 85595a18594SAndre Fischer AddEntry(Bool_UseToolBoxItemSeparator); 85695a18594SAndre Fischer AddEntry(Bool_IsHighContrastModeActive); 85795a18594SAndre Fischer 85895a18594SAndre Fischer AddEntry(Rect_ToolBoxPadding); 85995a18594SAndre Fischer AddEntry(Rect_ToolBoxBorder); 86095a18594SAndre Fischer 861b9e67834SAndre Fischer #undef AddEntry 862b9e67834SAndre Fischer 863b9e67834SAndre Fischer maRawValues.resize(maPropertyIdToNameMap.size()); 864ff12d537SAndre Fischer } 865ff12d537SAndre Fischer 866ff12d537SAndre Fischer 867ff12d537SAndre Fischer 868ff12d537SAndre Fischer 869b9e67834SAndre Fischer Theme::PropertyType Theme::GetPropertyType (const ThemeItem eItem) 870ff12d537SAndre Fischer { 871b9e67834SAndre Fischer switch(eItem) 872b9e67834SAndre Fischer { 873b9e67834SAndre Fischer case Image_Grip: 874b9e67834SAndre Fischer case Image_Expand: 875b9e67834SAndre Fischer case Image_Collapse: 8767a32b0c8SAndre Fischer case Image_TabBarMenu: 8777a32b0c8SAndre Fischer case Image_PanelMenu: 87895a18594SAndre Fischer case Image_ToolBoxItemSeparator: 8797a32b0c8SAndre Fischer case Image_Closer: 88013e1c3b4SAndre Fischer case Image_CloseIndicator: 881b9e67834SAndre Fischer return PT_Image; 882b9e67834SAndre Fischer 883b9e67834SAndre Fischer case Color_DeckTitleFont: 884b9e67834SAndre Fischer case Color_PanelTitleFont: 885b9e67834SAndre Fischer case Color_TabMenuSeparator: 886b9e67834SAndre Fischer case Color_TabItemBorder: 8878dcb2a10SAndre Fischer case Color_DropDownBorder: 8885f1c83ffSOliver-Rainer Wittmann case Color_Highlight: 8895f1c83ffSOliver-Rainer Wittmann case Color_HighlightText: 890b9e67834SAndre Fischer return PT_Color; 891b9e67834SAndre Fischer 892b9e67834SAndre Fischer case Paint_DeckBackground: 893b9e67834SAndre Fischer case Paint_DeckTitleBarBackground: 894b9e67834SAndre Fischer case Paint_PanelBackground: 895b9e67834SAndre Fischer case Paint_PanelTitleBarBackground: 896b9e67834SAndre Fischer case Paint_TabBarBackground: 89795a18594SAndre Fischer case Paint_TabItemBackgroundNormal: 89895a18594SAndre Fischer case Paint_TabItemBackgroundHighlight: 899b9e67834SAndre Fischer case Paint_HorizontalBorder: 900b9e67834SAndre Fischer case Paint_VerticalBorder: 90195a18594SAndre Fischer case Paint_ToolBoxBackground: 90295a18594SAndre Fischer case Paint_ToolBoxBorderTopLeft: 90395a18594SAndre Fischer case Paint_ToolBoxBorderCenterCorners: 90495a18594SAndre Fischer case Paint_ToolBoxBorderBottomRight: 9058dcb2a10SAndre Fischer case Paint_DropDownBackground: 906b9e67834SAndre Fischer return PT_Paint; 907b9e67834SAndre Fischer 908b9e67834SAndre Fischer case Int_DeckTitleBarHeight: 909b9e67834SAndre Fischer case Int_DeckBorderSize: 910b9e67834SAndre Fischer case Int_DeckSeparatorHeight: 911b9e67834SAndre Fischer case Int_PanelTitleBarHeight: 912b9e67834SAndre Fischer case Int_TabMenuPadding: 913b9e67834SAndre Fischer case Int_TabMenuSeparatorPadding: 914b9e67834SAndre Fischer case Int_TabItemWidth: 915b9e67834SAndre Fischer case Int_TabItemHeight: 916b9e67834SAndre Fischer case Int_DeckLeftPadding: 917b9e67834SAndre Fischer case Int_DeckTopPadding: 918b9e67834SAndre Fischer case Int_DeckRightPadding: 919b9e67834SAndre Fischer case Int_DeckBottomPadding: 920b9e67834SAndre Fischer case Int_TabBarLeftPadding: 921b9e67834SAndre Fischer case Int_TabBarTopPadding: 922b9e67834SAndre Fischer case Int_TabBarRightPadding: 923b9e67834SAndre Fischer case Int_TabBarBottomPadding: 92437fee4fdSAndre Fischer case Int_ButtonCornerRadius: 925b9e67834SAndre Fischer return PT_Integer; 926b9e67834SAndre Fischer 927b9e67834SAndre Fischer case Bool_UseSymphonyIcons: 92895a18594SAndre Fischer case Bool_UseSystemColors: 92995a18594SAndre Fischer case Bool_UseToolBoxItemSeparator: 93095a18594SAndre Fischer case Bool_IsHighContrastModeActive: 931b9e67834SAndre Fischer return PT_Boolean; 932b9e67834SAndre Fischer 93395a18594SAndre Fischer case Rect_ToolBoxBorder: 93495a18594SAndre Fischer case Rect_ToolBoxPadding: 93595a18594SAndre Fischer return PT_Rectangle; 93695a18594SAndre Fischer 937b9e67834SAndre Fischer default: 938b9e67834SAndre Fischer return PT_Invalid; 939b9e67834SAndre Fischer } 940ff12d537SAndre Fischer } 941ff12d537SAndre Fischer 942ff12d537SAndre Fischer 943ff12d537SAndre Fischer 944ff12d537SAndre Fischer 94595a18594SAndre Fischer cssu::Type Theme::GetCppuType (const PropertyType eType) 94695a18594SAndre Fischer { 94795a18594SAndre Fischer switch(eType) 94895a18594SAndre Fischer { 94995a18594SAndre Fischer case PT_Image: 95095a18594SAndre Fischer return getCppuType((rtl::OUString*)NULL); 95195a18594SAndre Fischer 95295a18594SAndre Fischer case PT_Color: 95395a18594SAndre Fischer return getCppuType((sal_uInt32*)NULL); 95495a18594SAndre Fischer 95595a18594SAndre Fischer case PT_Paint: 95695a18594SAndre Fischer return getCppuVoidType(); 95795a18594SAndre Fischer 95895a18594SAndre Fischer case PT_Integer: 95995a18594SAndre Fischer return getCppuType((sal_Int32*)NULL); 96095a18594SAndre Fischer 96195a18594SAndre Fischer case PT_Boolean: 96295a18594SAndre Fischer return getCppuType((sal_Bool*)NULL); 96395a18594SAndre Fischer 96495a18594SAndre Fischer case PT_Rectangle: 96595a18594SAndre Fischer return getCppuType((awt::Rectangle*)NULL); 96695a18594SAndre Fischer 96795a18594SAndre Fischer case PT_Invalid: 96895a18594SAndre Fischer default: 96995a18594SAndre Fischer return getCppuVoidType(); 97095a18594SAndre Fischer } 97195a18594SAndre Fischer } 97295a18594SAndre Fischer 97395a18594SAndre Fischer 97495a18594SAndre Fischer 97595a18594SAndre Fischer 976b9e67834SAndre Fischer sal_Int32 Theme::GetIndex (const ThemeItem eItem, const PropertyType eType) 977ff12d537SAndre Fischer { 978b9e67834SAndre Fischer switch(eType) 979b9e67834SAndre Fischer { 980b9e67834SAndre Fischer case PT_Image: 981b9e67834SAndre Fischer return eItem - __Pre_Image-1; 982b9e67834SAndre Fischer case PT_Color: 983b9e67834SAndre Fischer return eItem - __Image_Color-1; 984b9e67834SAndre Fischer case PT_Paint: 985b9e67834SAndre Fischer return eItem - __Color_Paint-1; 986b9e67834SAndre Fischer case PT_Integer: 987b9e67834SAndre Fischer return eItem - __Paint_Int-1; 988b9e67834SAndre Fischer case PT_Boolean: 989b9e67834SAndre Fischer return eItem - __Int_Bool-1; 99095a18594SAndre Fischer case PT_Rectangle: 99195a18594SAndre Fischer return eItem - __Bool_Rect-1; 992b9e67834SAndre Fischer 993b9e67834SAndre Fischer default: 994b9e67834SAndre Fischer OSL_ASSERT(false); 995b9e67834SAndre Fischer return 0; 996b9e67834SAndre Fischer } 997ff12d537SAndre Fischer } 998ff12d537SAndre Fischer 999ff12d537SAndre Fischer 1000ff12d537SAndre Fischer 1001ff12d537SAndre Fischer 1002b9e67834SAndre Fischer Theme::VetoableListenerContainer* Theme::GetVetoableListeners ( 1003b9e67834SAndre Fischer const ThemeItem eItem, 1004b9e67834SAndre Fischer const bool bCreate) 1005ff12d537SAndre Fischer { 1006b9e67834SAndre Fischer VetoableListeners::iterator iContainer (maVetoableListeners.find(eItem)); 1007b9e67834SAndre Fischer if (iContainer != maVetoableListeners.end()) 1008b9e67834SAndre Fischer return &iContainer->second; 1009b9e67834SAndre Fischer else if (bCreate) 1010b9e67834SAndre Fischer { 1011b9e67834SAndre Fischer maVetoableListeners[eItem] = VetoableListenerContainer(); 1012b9e67834SAndre Fischer return &maVetoableListeners[eItem]; 1013b9e67834SAndre Fischer } 1014b9e67834SAndre Fischer else 1015b9e67834SAndre Fischer return NULL; 1016ff12d537SAndre Fischer } 1017ff12d537SAndre Fischer 1018ff12d537SAndre Fischer 1019ff12d537SAndre Fischer 1020ff12d537SAndre Fischer 1021b9e67834SAndre Fischer Theme::ChangeListenerContainer* Theme::GetChangeListeners ( 1022b9e67834SAndre Fischer const ThemeItem eItem, 1023b9e67834SAndre Fischer const bool bCreate) 1024ff12d537SAndre Fischer { 1025b9e67834SAndre Fischer ChangeListeners::iterator iContainer (maChangeListeners.find(eItem)); 1026b9e67834SAndre Fischer if (iContainer != maChangeListeners.end()) 1027b9e67834SAndre Fischer return &iContainer->second; 1028b9e67834SAndre Fischer else if (bCreate) 1029b9e67834SAndre Fischer { 1030b9e67834SAndre Fischer maChangeListeners[eItem] = ChangeListenerContainer(); 1031b9e67834SAndre Fischer return &maChangeListeners[eItem]; 1032b9e67834SAndre Fischer } 1033b9e67834SAndre Fischer else 1034b9e67834SAndre Fischer return NULL; 1035ff12d537SAndre Fischer } 1036ff12d537SAndre Fischer 1037ff12d537SAndre Fischer 1038ff12d537SAndre Fischer 1039ff12d537SAndre Fischer 1040b9e67834SAndre Fischer bool Theme::DoVetoableListenersVeto ( 1041b9e67834SAndre Fischer const VetoableListenerContainer* pListeners, 1042b9e67834SAndre Fischer const beans::PropertyChangeEvent& rEvent) const 1043ff12d537SAndre Fischer { 1044b9e67834SAndre Fischer if (pListeners == NULL) 1045b9e67834SAndre Fischer return false; 1046b9e67834SAndre Fischer 1047b9e67834SAndre Fischer VetoableListenerContainer aListeners (*pListeners); 1048b9e67834SAndre Fischer try 1049b9e67834SAndre Fischer { 1050b9e67834SAndre Fischer for (VetoableListenerContainer::const_iterator 1051b9e67834SAndre Fischer iListener(aListeners.begin()), 1052b9e67834SAndre Fischer iEnd(aListeners.end()); 1053b9e67834SAndre Fischer iListener!=iEnd; 1054b9e67834SAndre Fischer ++iListener) 1055b9e67834SAndre Fischer { 1056b9e67834SAndre Fischer (*iListener)->vetoableChange(rEvent); 1057b9e67834SAndre Fischer } 1058b9e67834SAndre Fischer } 1059b9e67834SAndre Fischer catch(const beans::PropertyVetoException&) 1060b9e67834SAndre Fischer { 1061b9e67834SAndre Fischer return true; 1062b9e67834SAndre Fischer } 1063b9e67834SAndre Fischer catch(const Exception&) 1064b9e67834SAndre Fischer { 1065b9e67834SAndre Fischer // Ignore any other errors (such as disposed listeners). 1066b9e67834SAndre Fischer } 1067b9e67834SAndre Fischer return false; 1068ff12d537SAndre Fischer } 1069ff12d537SAndre Fischer 1070ff12d537SAndre Fischer 1071ff12d537SAndre Fischer 1072ff12d537SAndre Fischer 1073b9e67834SAndre Fischer void Theme::BroadcastPropertyChange ( 1074b9e67834SAndre Fischer const ChangeListenerContainer* pListeners, 1075b9e67834SAndre Fischer const beans::PropertyChangeEvent& rEvent) const 1076ff12d537SAndre Fischer { 1077b9e67834SAndre Fischer if (pListeners == NULL) 1078b9e67834SAndre Fischer return; 1079b9e67834SAndre Fischer 1080b9e67834SAndre Fischer const ChangeListenerContainer aListeners (*pListeners); 1081b9e67834SAndre Fischer try 1082b9e67834SAndre Fischer { 1083b9e67834SAndre Fischer for (ChangeListenerContainer::const_iterator 1084b9e67834SAndre Fischer iListener(aListeners.begin()), 1085b9e67834SAndre Fischer iEnd(aListeners.end()); 1086b9e67834SAndre Fischer iListener!=iEnd; 1087b9e67834SAndre Fischer ++iListener) 1088b9e67834SAndre Fischer { 1089b9e67834SAndre Fischer (*iListener)->propertyChange(rEvent); 1090b9e67834SAndre Fischer } 1091b9e67834SAndre Fischer } 1092b9e67834SAndre Fischer catch(const Exception&) 1093b9e67834SAndre Fischer { 1094b9e67834SAndre Fischer // Ignore any errors (such as disposed listeners). 1095b9e67834SAndre Fischer } 1096ff12d537SAndre Fischer } 1097ff12d537SAndre Fischer 1098ff12d537SAndre Fischer 1099ff12d537SAndre Fischer 1100ff12d537SAndre Fischer 1101b9e67834SAndre Fischer void Theme::ProcessNewValue ( 1102b9e67834SAndre Fischer const Any& rValue, 1103b9e67834SAndre Fischer const ThemeItem eItem, 1104b9e67834SAndre Fischer const PropertyType eType) 1105ff12d537SAndre Fischer { 1106b9e67834SAndre Fischer const sal_Int32 nIndex (GetIndex (eItem, eType)); 1107b9e67834SAndre Fischer switch (eType) 1108b9e67834SAndre Fischer { 1109b9e67834SAndre Fischer case PT_Image: 1110b9e67834SAndre Fischer { 1111b9e67834SAndre Fischer ::rtl::OUString sURL; 1112b9e67834SAndre Fischer if (rValue >>= sURL) 1113b9e67834SAndre Fischer { 1114b9e67834SAndre Fischer maImages[nIndex] = Tools::GetImage(sURL, NULL); 1115b9e67834SAndre Fischer } 1116b9e67834SAndre Fischer break; 1117b9e67834SAndre Fischer } 1118b9e67834SAndre Fischer case PT_Color: 1119b9e67834SAndre Fischer { 112095a18594SAndre Fischer sal_Int32 nColorValue (0); 1121b9e67834SAndre Fischer if (rValue >>= nColorValue) 1122b9e67834SAndre Fischer { 1123b9e67834SAndre Fischer maColors[nIndex] = Color(nColorValue); 1124b9e67834SAndre Fischer } 1125b9e67834SAndre Fischer break; 1126b9e67834SAndre Fischer } 1127b9e67834SAndre Fischer case PT_Paint: 1128b9e67834SAndre Fischer { 112995a18594SAndre Fischer maPaints[nIndex] = Paint::Create(rValue); 1130b9e67834SAndre Fischer break; 1131b9e67834SAndre Fischer } 1132b9e67834SAndre Fischer case PT_Integer: 1133b9e67834SAndre Fischer { 113495a18594SAndre Fischer sal_Int32 nValue (0); 1135b9e67834SAndre Fischer if (rValue >>= nValue) 1136b9e67834SAndre Fischer { 1137b9e67834SAndre Fischer maIntegers[nIndex] = nValue; 1138b9e67834SAndre Fischer } 1139b9e67834SAndre Fischer break; 1140b9e67834SAndre Fischer } 1141b9e67834SAndre Fischer case PT_Boolean: 1142b9e67834SAndre Fischer { 114395a18594SAndre Fischer sal_Bool nValue (0); 1144b9e67834SAndre Fischer if (rValue >>= nValue) 1145b9e67834SAndre Fischer { 1146b9e67834SAndre Fischer maBooleans[nIndex] = (nValue==sal_True); 114795a18594SAndre Fischer if (eItem == Bool_IsHighContrastModeActive) 114895a18594SAndre Fischer { 114995a18594SAndre Fischer mbIsHighContrastModeSetManually = true; 115095a18594SAndre Fischer mbIsHighContrastMode = maBooleans[nIndex]; 115195a18594SAndre Fischer HandleDataChange(); 115295a18594SAndre Fischer } 115395a18594SAndre Fischer else if (eItem == Bool_UseSystemColors) 115495a18594SAndre Fischer { 115595a18594SAndre Fischer HandleDataChange(); 115695a18594SAndre Fischer } 115795a18594SAndre Fischer } 115895a18594SAndre Fischer break; 115995a18594SAndre Fischer } 116095a18594SAndre Fischer case PT_Rectangle: 116195a18594SAndre Fischer { 116295a18594SAndre Fischer awt::Rectangle aBox; 116395a18594SAndre Fischer if (rValue >>= aBox) 116495a18594SAndre Fischer { 116595a18594SAndre Fischer maRectangles[nIndex] = Rectangle( 116695a18594SAndre Fischer aBox.X, 116795a18594SAndre Fischer aBox.Y, 116895a18594SAndre Fischer aBox.Width, 116995a18594SAndre Fischer aBox.Height); 1170b9e67834SAndre Fischer } 1171b9e67834SAndre Fischer break; 1172b9e67834SAndre Fischer } 1173b9e67834SAndre Fischer case PT_Invalid: 1174b9e67834SAndre Fischer OSL_ASSERT(eType != PT_Invalid); 1175b9e67834SAndre Fischer throw RuntimeException(); 1176b9e67834SAndre Fischer } 1177ff12d537SAndre Fischer } 1178ff12d537SAndre Fischer 1179b9e67834SAndre Fischer 1180b9e67834SAndre Fischer 1181b9e67834SAndre Fischer 1182ff12d537SAndre Fischer } } // end of namespace sfx2::sidebar 1183