1ff12d537SAndre Fischer /************************************************************** 2ff12d537SAndre Fischer * 3ff12d537SAndre Fischer * Licensed to the Apache Software Foundation (ASF) under one 4ff12d537SAndre Fischer * or more contributor license agreements. See the NOTICE file 5ff12d537SAndre Fischer * distributed with this work for additional information 6ff12d537SAndre Fischer * regarding copyright ownership. The ASF licenses this file 7ff12d537SAndre Fischer * to you under the Apache License, Version 2.0 (the 8ff12d537SAndre Fischer * "License"); you may not use this file except in compliance 9ff12d537SAndre Fischer * with the License. You may obtain a copy of the License at 10ff12d537SAndre Fischer * 11ff12d537SAndre Fischer * http://www.apache.org/licenses/LICENSE-2.0 12ff12d537SAndre Fischer * 13ff12d537SAndre Fischer * Unless required by applicable law or agreed to in writing, 14ff12d537SAndre Fischer * software distributed under the License is distributed on an 15ff12d537SAndre Fischer * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16ff12d537SAndre Fischer * KIND, either express or implied. See the License for the 17ff12d537SAndre Fischer * specific language governing permissions and limitations 18ff12d537SAndre Fischer * under the License. 19ff12d537SAndre Fischer * 20ff12d537SAndre Fischer *************************************************************/ 21ff12d537SAndre Fischer 22ff12d537SAndre Fischer #include "precompiled_sfx2.hxx" 23ff12d537SAndre Fischer 24b9e67834SAndre Fischer #include "sfx2/sidebar/Theme.hxx" 25ff12d537SAndre Fischer #include "Paint.hxx" 26ff12d537SAndre Fischer #include "SidebarResource.hxx" 27b9e67834SAndre Fischer #include "Tools.hxx" 28ff12d537SAndre Fischer 29b9e67834SAndre Fischer #include <tools/svborder.hxx> 30ff12d537SAndre Fischer #include <tools/rc.hxx> 31ff12d537SAndre Fischer #include <vcl/svapp.hxx> 32ff12d537SAndre Fischer 33b9e67834SAndre Fischer using namespace css; 34b9e67834SAndre Fischer using namespace cssu; 35b9e67834SAndre Fischer 36ff12d537SAndre Fischer 37ff12d537SAndre Fischer namespace sfx2 { namespace sidebar { 38ff12d537SAndre Fischer 39b9e67834SAndre Fischer ::rtl::Reference<Theme> Theme::mpInstance; 40ff12d537SAndre Fischer 41b9e67834SAndre Fischer 42b9e67834SAndre Fischer 43b9e67834SAndre Fischer 44b9e67834SAndre Fischer Theme& Theme::GetCurrentTheme (void) 45ff12d537SAndre Fischer { 46b9e67834SAndre Fischer if ( ! mpInstance.is()) 47ff12d537SAndre Fischer { 48b9e67834SAndre Fischer mpInstance.set(new Theme()); 49b9e67834SAndre Fischer mpInstance->InitializeTheme(); 50ff12d537SAndre Fischer } 51b9e67834SAndre Fischer return *mpInstance; 52ff12d537SAndre Fischer } 53ff12d537SAndre Fischer 54ff12d537SAndre Fischer 55ff12d537SAndre Fischer 56ff12d537SAndre Fischer 57b9e67834SAndre Fischer Theme::Theme (void) 58b9e67834SAndre Fischer : ThemeInterfaceBase(m_aMutex), 59b9e67834SAndre Fischer maImages(), 60b9e67834SAndre Fischer maColors(), 61b9e67834SAndre Fischer maPaints(), 62b9e67834SAndre Fischer maIntegers(), 63b9e67834SAndre Fischer maBooleans(), 64b9e67834SAndre Fischer mbIsHighContrastMode(Application::GetSettings().GetStyleSettings().GetHighContrastMode()), 6595a18594SAndre Fischer mbIsHighContrastModeSetManually(false), 66b9e67834SAndre Fischer maPropertyNameToIdMap(), 67b9e67834SAndre Fischer maPropertyIdToNameMap(), 68b9e67834SAndre Fischer maRawValues(), 69b9e67834SAndre Fischer maChangeListeners(), 70b9e67834SAndre Fischer maVetoableListeners() 71b9e67834SAndre Fischer 72ff12d537SAndre Fischer { 73b9e67834SAndre Fischer SetupPropertyMaps(); 74ff12d537SAndre Fischer } 75ff12d537SAndre Fischer 76ff12d537SAndre Fischer 77ff12d537SAndre Fischer 78ff12d537SAndre Fischer 79b9e67834SAndre Fischer Theme::~Theme (void) 80ff12d537SAndre Fischer { 81ff12d537SAndre Fischer } 82ff12d537SAndre Fischer 83ff12d537SAndre Fischer 84ff12d537SAndre Fischer 85ff12d537SAndre Fischer 86b9e67834SAndre Fischer Image Theme::GetImage (const ThemeItem eItem) 87ff12d537SAndre Fischer { 88b9e67834SAndre Fischer const PropertyType eType (GetPropertyType(eItem)); 89b9e67834SAndre Fischer OSL_ASSERT(eType==PT_Image); 90b9e67834SAndre Fischer const sal_Int32 nIndex (GetIndex(eItem, eType)); 91b9e67834SAndre Fischer const Theme& rTheme (GetCurrentTheme()); 92b9e67834SAndre Fischer return rTheme.maImages[nIndex]; 93ff12d537SAndre Fischer } 94ff12d537SAndre Fischer 95ff12d537SAndre Fischer 96ff12d537SAndre Fischer 97ff12d537SAndre Fischer 98b9e67834SAndre Fischer Color Theme::GetColor (const ThemeItem eItem) 99ff12d537SAndre Fischer { 100b9e67834SAndre Fischer const PropertyType eType (GetPropertyType(eItem)); 1018dcb2a10SAndre Fischer OSL_ASSERT(eType==PT_Color || eType==PT_Paint); 102b9e67834SAndre Fischer const sal_Int32 nIndex (GetIndex(eItem, eType)); 103b9e67834SAndre Fischer const Theme& rTheme (GetCurrentTheme()); 1048dcb2a10SAndre Fischer if (eType == PT_Color) 105b9e67834SAndre Fischer return rTheme.maColors[nIndex]; 1068dcb2a10SAndre Fischer else if (eType == PT_Paint) 1078dcb2a10SAndre Fischer return rTheme.maPaints[nIndex].GetColor(); 108f120fe41SAndre Fischer else 109f120fe41SAndre Fischer return COL_WHITE; 110ff12d537SAndre Fischer } 111ff12d537SAndre Fischer 112ff12d537SAndre Fischer 113ff12d537SAndre Fischer 114ff12d537SAndre Fischer 115b9e67834SAndre Fischer const Paint& Theme::GetPaint (const ThemeItem eItem) 116ff12d537SAndre Fischer { 117b9e67834SAndre Fischer const PropertyType eType (GetPropertyType(eItem)); 118b9e67834SAndre Fischer OSL_ASSERT(eType==PT_Paint); 119b9e67834SAndre Fischer const sal_Int32 nIndex (GetIndex(eItem, eType)); 120b9e67834SAndre Fischer const Theme& rTheme (GetCurrentTheme()); 121b9e67834SAndre Fischer return rTheme.maPaints[nIndex]; 122ff12d537SAndre Fischer } 123ff12d537SAndre Fischer 124ff12d537SAndre Fischer 125ff12d537SAndre Fischer 126ff12d537SAndre Fischer 1277a32b0c8SAndre Fischer const Wallpaper Theme::GetWallpaper (const ThemeItem eItem) 1287a32b0c8SAndre Fischer { 1297a32b0c8SAndre Fischer return GetPaint(eItem).GetWallpaper(); 1307a32b0c8SAndre Fischer } 1317a32b0c8SAndre Fischer 1327a32b0c8SAndre Fischer 1337a32b0c8SAndre Fischer 1347a32b0c8SAndre Fischer 135b9e67834SAndre Fischer sal_Int32 Theme::GetInteger (const ThemeItem eItem) 136ff12d537SAndre Fischer { 137b9e67834SAndre Fischer const PropertyType eType (GetPropertyType(eItem)); 138b9e67834SAndre Fischer OSL_ASSERT(eType==PT_Integer); 139b9e67834SAndre Fischer const sal_Int32 nIndex (GetIndex(eItem, eType)); 140b9e67834SAndre Fischer const Theme& rTheme (GetCurrentTheme()); 141b9e67834SAndre Fischer return rTheme.maIntegers[nIndex]; 142ff12d537SAndre Fischer } 143ff12d537SAndre Fischer 144ff12d537SAndre Fischer 145ff12d537SAndre Fischer 146ff12d537SAndre Fischer 147b9e67834SAndre Fischer bool Theme::GetBoolean (const ThemeItem eItem) 148ff12d537SAndre Fischer { 149b9e67834SAndre Fischer const PropertyType eType (GetPropertyType(eItem)); 150b9e67834SAndre Fischer OSL_ASSERT(eType==PT_Boolean); 151b9e67834SAndre Fischer const sal_Int32 nIndex (GetIndex(eItem, eType)); 152b9e67834SAndre Fischer const Theme& rTheme (GetCurrentTheme()); 153b9e67834SAndre Fischer return rTheme.maBooleans[nIndex]; 154ff12d537SAndre Fischer } 155ff12d537SAndre Fischer 156ff12d537SAndre Fischer 157ff12d537SAndre Fischer 158ff12d537SAndre Fischer 15995a18594SAndre Fischer Rectangle Theme::GetRectangle (const ThemeItem eItem) 16095a18594SAndre Fischer { 16195a18594SAndre Fischer const PropertyType eType (GetPropertyType(eItem)); 16295a18594SAndre Fischer OSL_ASSERT(eType==PT_Rectangle); 16395a18594SAndre Fischer const sal_Int32 nIndex (GetIndex(eItem, eType)); 16495a18594SAndre Fischer const Theme& rTheme (GetCurrentTheme()); 16595a18594SAndre Fischer return rTheme.maRectangles[nIndex]; 16695a18594SAndre Fischer } 16795a18594SAndre Fischer 16895a18594SAndre Fischer 16995a18594SAndre Fischer 17095a18594SAndre Fischer 171ff12d537SAndre Fischer bool Theme::IsHighContrastMode (void) 172ff12d537SAndre Fischer { 173b9e67834SAndre Fischer const Theme& rTheme (GetCurrentTheme()); 174b9e67834SAndre Fischer return rTheme.mbIsHighContrastMode; 175ff12d537SAndre Fischer } 176ff12d537SAndre Fischer 177ff12d537SAndre Fischer 178ff12d537SAndre Fischer 179ff12d537SAndre Fischer 180ff12d537SAndre Fischer void Theme::HandleDataChange (void) 181ff12d537SAndre Fischer { 18295a18594SAndre Fischer Theme& rTheme (GetCurrentTheme()); 18395a18594SAndre Fischer 18495a18594SAndre Fischer if ( ! rTheme.mbIsHighContrastModeSetManually) 18595a18594SAndre Fischer { 18695a18594SAndre Fischer // Do not modify mbIsHighContrastMode when it was manually set. 187b9e67834SAndre Fischer GetCurrentTheme().mbIsHighContrastMode = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); 18895a18594SAndre Fischer rTheme.maRawValues[Bool_IsHighContrastModeActive] = Any(GetCurrentTheme().mbIsHighContrastMode); 18995a18594SAndre Fischer } 19095a18594SAndre Fischer 19195a18594SAndre Fischer GetCurrentTheme().UpdateTheme(); 192ff12d537SAndre Fischer } 193ff12d537SAndre Fischer 194ff12d537SAndre Fischer 195ff12d537SAndre Fischer 196ff12d537SAndre Fischer 197b9e67834SAndre Fischer void Theme::InitializeTheme (void) 198ff12d537SAndre Fischer { 19995a18594SAndre Fischer setPropertyValue( 20095a18594SAndre Fischer maPropertyIdToNameMap[Bool_UseSymphonyIcons], 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) 21195a18594SAndre Fischer { 212ff12d537SAndre Fischer SidebarResource aLocalResource; 213ff12d537SAndre Fischer 214b9e67834SAndre Fischer try 215b9e67834SAndre Fischer { 21695a18594SAndre Fischer const StyleSettings& rStyle (Application::GetSettings().GetStyleSettings()); 21795a18594SAndre Fischer const bool bUseSystemColors (GetBoolean(Bool_UseSystemColors)); 21895a18594SAndre Fischer 21995a18594SAndre Fischer #define Alternatives(n,hc,sys) (mbIsHighContrastMode ? hc : (bUseSystemColors ? sys : n)) 22095a18594SAndre Fischer 221*df0345d7SAndre Fischer Color aBaseBackgroundColor (rStyle.GetDialogColor()); 222*df0345d7SAndre Fischer // UX says this should be a little brighter, but that looks off when compared to the other windows. 223*df0345d7SAndre 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], 231*df0345d7SAndre 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))); 254b9e67834SAndre Fischer setPropertyValue( 25537fee4fdSAndre Fischer maPropertyIdToNameMap[Int_ButtonCornerRadius], 25637fee4fdSAndre Fischer Any(sal_Int32(3))); 25737fee4fdSAndre 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], 268*df0345d7SAndre Fischer Any(sal_Int32(aBaseBackgroundColor.GetRGBColor()))); 2698dcb2a10SAndre 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))); 301ff12d537SAndre 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))); 311ff12d537SAndre 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 330b9e67834SAndre Fischer 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 3375f1c83ffSOliver-Rainer Wittmann 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))); 344ff12d537SAndre 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))); 353ff12d537SAndre 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"))); 378b9e67834SAndre 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"))); 3877a32b0c8SAndre Fischer setPropertyValue( 38895a18594SAndre Fischer maPropertyIdToNameMap[Image_ToolBoxItemSeparator], 38995a18594SAndre Fischer Any( 39095a18594SAndre Fischer A2S("private:graphicrepository/sfx2/res/separator.png"))); 39195a18594SAndre Fischer 39295a18594SAndre Fischer // ToolBox 3938dcb2a10SAndre Fischer 3948dcb2a10SAndre Fischer /* 3958dcb2a10SAndre Fischer // Separator style 3968dcb2a10SAndre Fischer setPropertyValue( 3978dcb2a10SAndre Fischer maPropertyIdToNameMap[Paint_ToolBoxBackground], 3988dcb2a10SAndre Fischer Any(sal_Int32(rStyle.GetMenuColor().GetRGBColor()))); 3998dcb2a10SAndre Fischer setPropertyValue( 4008dcb2a10SAndre Fischer maPropertyIdToNameMap[Paint_ToolBoxBorderTopLeft], 4018dcb2a10SAndre Fischer Any()); 4028dcb2a10SAndre Fischer setPropertyValue( 4038dcb2a10SAndre Fischer maPropertyIdToNameMap[Paint_ToolBoxBorderCenterCorners], 4048dcb2a10SAndre Fischer Any()); 4058dcb2a10SAndre Fischer setPropertyValue( 4068dcb2a10SAndre Fischer maPropertyIdToNameMap[Paint_ToolBoxBorderBottomRight], 4078dcb2a10SAndre Fischer Any()); 4088dcb2a10SAndre Fischer setPropertyValue( 4098dcb2a10SAndre Fischer maPropertyIdToNameMap[Rect_ToolBoxPadding], 4108dcb2a10SAndre Fischer Any(awt::Rectangle(2,2,2,2))); 4118dcb2a10SAndre Fischer setPropertyValue( 4128dcb2a10SAndre Fischer maPropertyIdToNameMap[Rect_ToolBoxBorder], 4138dcb2a10SAndre Fischer Any(awt::Rectangle(0,0,0,0))); 4148dcb2a10SAndre Fischer setPropertyValue( 4158dcb2a10SAndre Fischer maPropertyIdToNameMap[Bool_UseToolBoxItemSeparator], 4168dcb2a10SAndre Fischer Any(true)); 4178dcb2a10SAndre Fischer 4188dcb2a10SAndre Fischer */ 4198dcb2a10SAndre Fischer 4208dcb2a10SAndre Fischer // Gradient style 42195a18594SAndre Fischer setPropertyValue( 42295a18594SAndre Fischer maPropertyIdToNameMap[Paint_ToolBoxBackground], 42395a18594SAndre Fischer Any(Tools::VclToAwtGradient(Gradient( 42495a18594SAndre Fischer GRADIENT_LINEAR, 42595a18594SAndre Fischer Color(0xf2f2f2), 42695a18594SAndre Fischer Color(0xfefefe) 42795a18594SAndre Fischer )))); 42895a18594SAndre Fischer setPropertyValue( 42995a18594SAndre Fischer maPropertyIdToNameMap[Paint_ToolBoxBorderTopLeft], 43095a18594SAndre Fischer mbIsHighContrastMode 43195a18594SAndre Fischer ? Any(util::Color(sal_uInt32(0x00ff00))) 43295a18594SAndre Fischer : Any(util::Color(sal_uInt32(0xf2f2f2)))); 43395a18594SAndre Fischer setPropertyValue( 43495a18594SAndre Fischer maPropertyIdToNameMap[Paint_ToolBoxBorderCenterCorners], 43595a18594SAndre Fischer mbIsHighContrastMode 43695a18594SAndre Fischer ? Any(util::Color(sal_uInt32(0x00ff00))) 43795a18594SAndre Fischer : Any(util::Color(sal_uInt32(0xf2f2f2)))); 43895a18594SAndre Fischer setPropertyValue( 43995a18594SAndre Fischer maPropertyIdToNameMap[Paint_ToolBoxBorderBottomRight], 44095a18594SAndre Fischer mbIsHighContrastMode 44195a18594SAndre Fischer ? Any(util::Color(sal_uInt32(0x00ff00))) 44295a18594SAndre Fischer : Any(util::Color(sal_uInt32(0xf2f2f2)))); 44395a18594SAndre Fischer setPropertyValue( 44495a18594SAndre Fischer maPropertyIdToNameMap[Rect_ToolBoxPadding], 44595a18594SAndre Fischer Any(awt::Rectangle(2,2,2,2))); 44695a18594SAndre Fischer setPropertyValue( 44795a18594SAndre Fischer maPropertyIdToNameMap[Rect_ToolBoxBorder], 44895a18594SAndre Fischer Any(awt::Rectangle(1,1,1,1))); 44995a18594SAndre Fischer setPropertyValue( 45095a18594SAndre Fischer maPropertyIdToNameMap[Bool_UseToolBoxItemSeparator], 45195a18594SAndre Fischer Any(false)); 452ff12d537SAndre Fischer } 45395a18594SAndre Fischer catch(beans::UnknownPropertyException& rException) 454b9e67834SAndre Fischer { 45595a18594SAndre Fischer OSL_TRACE("unknown property: %s", 45695a18594SAndre Fischer OUStringToOString( 45795a18594SAndre Fischer rException.Message, 45895a18594SAndre Fischer RTL_TEXTENCODING_ASCII_US).getStr()); 459b9e67834SAndre Fischer OSL_ASSERT(false); 460b9e67834SAndre Fischer } 461b9e67834SAndre Fischer } 462b9e67834SAndre Fischer 463b9e67834SAndre Fischer 464b9e67834SAndre Fischer 465b9e67834SAndre Fischer 466b9e67834SAndre Fischer void SAL_CALL Theme::disposing (void) 467b9e67834SAndre Fischer { 468b9e67834SAndre Fischer ChangeListeners aListeners; 469b9e67834SAndre Fischer maChangeListeners.swap(aListeners); 470b9e67834SAndre Fischer 471b9e67834SAndre Fischer const lang::EventObject aEvent (static_cast<XWeak*>(this)); 472b9e67834SAndre Fischer 473b9e67834SAndre Fischer for (ChangeListeners::const_iterator 474b9e67834SAndre Fischer iContainer(maChangeListeners.begin()), 475b9e67834SAndre Fischer iContainerEnd(maChangeListeners.end()); 476b9e67834SAndre Fischer iContainerEnd!=iContainerEnd; 477b9e67834SAndre Fischer ++iContainerEnd) 478b9e67834SAndre Fischer { 479b9e67834SAndre Fischer for (ChangeListenerContainer::const_iterator 480b9e67834SAndre Fischer iListener(iContainer->second.begin()), 481b9e67834SAndre Fischer iEnd(iContainer->second.end()); 482b9e67834SAndre Fischer iListener!=iEnd; 483b9e67834SAndre Fischer ++iListener) 484b9e67834SAndre Fischer { 485b9e67834SAndre Fischer try 486b9e67834SAndre Fischer { 487b9e67834SAndre Fischer (*iListener)->disposing(aEvent); 488b9e67834SAndre Fischer } 489b9e67834SAndre Fischer catch(const Exception&) 490b9e67834SAndre Fischer { 491b9e67834SAndre Fischer } 492b9e67834SAndre Fischer } 493b9e67834SAndre Fischer } 494b9e67834SAndre Fischer } 495b9e67834SAndre Fischer 496b9e67834SAndre Fischer 497b9e67834SAndre Fischer 498b9e67834SAndre Fischer 499b9e67834SAndre Fischer Reference<beans::XPropertySet> Theme::GetPropertySet (void) 500b9e67834SAndre Fischer { 501b9e67834SAndre Fischer return Reference<beans::XPropertySet>(static_cast<XWeak*>(&GetCurrentTheme()), UNO_QUERY); 502b9e67834SAndre Fischer } 503b9e67834SAndre Fischer 504b9e67834SAndre Fischer 505b9e67834SAndre Fischer 506b9e67834SAndre Fischer 507b9e67834SAndre Fischer Reference<beans::XPropertySetInfo> SAL_CALL Theme::getPropertySetInfo (void) 508b9e67834SAndre Fischer throw(cssu::RuntimeException) 509b9e67834SAndre Fischer { 51095a18594SAndre Fischer return Reference<beans::XPropertySetInfo>(this); 511b9e67834SAndre Fischer } 512b9e67834SAndre Fischer 513b9e67834SAndre Fischer 514b9e67834SAndre Fischer 515b9e67834SAndre Fischer 516b9e67834SAndre Fischer void SAL_CALL Theme::setPropertyValue ( 517b9e67834SAndre Fischer const ::rtl::OUString& rsPropertyName, 518b9e67834SAndre Fischer const cssu::Any& rValue) 519b9e67834SAndre Fischer throw(cssu::RuntimeException) 520b9e67834SAndre Fischer { 521b9e67834SAndre Fischer PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName)); 522b9e67834SAndre Fischer if (iId == maPropertyNameToIdMap.end()) 52395a18594SAndre Fischer throw beans::UnknownPropertyException(rsPropertyName, NULL); 524b9e67834SAndre Fischer 525b9e67834SAndre Fischer const PropertyType eType (GetPropertyType(iId->second)); 526b9e67834SAndre Fischer if (eType == PT_Invalid) 52795a18594SAndre Fischer throw beans::UnknownPropertyException(rsPropertyName, NULL); 528b9e67834SAndre Fischer 529b9e67834SAndre Fischer const ThemeItem eItem (iId->second); 530b9e67834SAndre Fischer 531b9e67834SAndre Fischer if (rValue == maRawValues[eItem]) 532b9e67834SAndre Fischer { 533b9e67834SAndre Fischer // Value is not different from the one in the property 534b9e67834SAndre Fischer // set => nothing to do. 535b9e67834SAndre Fischer return; 536b9e67834SAndre Fischer } 537b9e67834SAndre Fischer 538b9e67834SAndre Fischer const Any aOldValue (maRawValues[eItem]); 539b9e67834SAndre Fischer 540b9e67834SAndre Fischer const beans::PropertyChangeEvent aEvent( 541b9e67834SAndre Fischer static_cast<XWeak*>(this), 542b9e67834SAndre Fischer rsPropertyName, 543b9e67834SAndre Fischer sal_False, 544b9e67834SAndre Fischer eItem, 545b9e67834SAndre Fischer aOldValue, 546b9e67834SAndre Fischer rValue); 547b9e67834SAndre Fischer 548b9e67834SAndre Fischer if (DoVetoableListenersVeto(GetVetoableListeners(__AnyItem, false), aEvent)) 549b9e67834SAndre Fischer return; 550b9e67834SAndre Fischer if (DoVetoableListenersVeto(GetVetoableListeners(eItem, false), aEvent)) 551b9e67834SAndre Fischer return; 552b9e67834SAndre Fischer 553b9e67834SAndre Fischer maRawValues[eItem] = rValue; 554b9e67834SAndre Fischer ProcessNewValue(rValue, eItem, eType); 555b9e67834SAndre Fischer 556b9e67834SAndre Fischer BroadcastPropertyChange(GetChangeListeners(__AnyItem, false), aEvent); 557b9e67834SAndre Fischer BroadcastPropertyChange(GetChangeListeners(eItem, false), aEvent); 558b9e67834SAndre Fischer } 559b9e67834SAndre Fischer 560b9e67834SAndre Fischer 561b9e67834SAndre Fischer 562b9e67834SAndre Fischer 563b9e67834SAndre Fischer Any SAL_CALL Theme::getPropertyValue ( 564b9e67834SAndre Fischer const ::rtl::OUString& rsPropertyName) 565b9e67834SAndre Fischer throw(css::beans::UnknownPropertyException, 566b9e67834SAndre Fischer css::lang::WrappedTargetException, 567b9e67834SAndre Fischer cssu::RuntimeException) 568b9e67834SAndre Fischer { 569b9e67834SAndre Fischer PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName)); 570b9e67834SAndre Fischer if (iId == maPropertyNameToIdMap.end()) 571b9e67834SAndre Fischer throw beans::UnknownPropertyException(); 572b9e67834SAndre Fischer 573b9e67834SAndre Fischer const PropertyType eType (GetPropertyType(iId->second)); 574b9e67834SAndre Fischer if (eType == PT_Invalid) 575b9e67834SAndre Fischer throw beans::UnknownPropertyException(); 576b9e67834SAndre Fischer 577b9e67834SAndre Fischer const ThemeItem eItem (iId->second); 578b9e67834SAndre Fischer 579b9e67834SAndre Fischer return maRawValues[eItem]; 580b9e67834SAndre Fischer } 581b9e67834SAndre Fischer 582b9e67834SAndre Fischer 583b9e67834SAndre Fischer 584b9e67834SAndre Fischer 585b9e67834SAndre Fischer void SAL_CALL Theme::addPropertyChangeListener( 586b9e67834SAndre Fischer const ::rtl::OUString& rsPropertyName, 587b9e67834SAndre Fischer const cssu::Reference<css::beans::XPropertyChangeListener>& rxListener) 588b9e67834SAndre Fischer throw(css::beans::UnknownPropertyException, 589b9e67834SAndre Fischer css::lang::WrappedTargetException, 590b9e67834SAndre Fischer cssu::RuntimeException) 591b9e67834SAndre Fischer { 592b9e67834SAndre Fischer ThemeItem eItem (__AnyItem); 593b9e67834SAndre Fischer if (rsPropertyName.getLength() > 0) 594b9e67834SAndre Fischer { 595b9e67834SAndre Fischer PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName)); 596b9e67834SAndre Fischer if (iId == maPropertyNameToIdMap.end()) 597b9e67834SAndre Fischer throw beans::UnknownPropertyException(); 598b9e67834SAndre Fischer 599b9e67834SAndre Fischer const PropertyType eType (GetPropertyType(iId->second)); 600b9e67834SAndre Fischer if (eType == PT_Invalid) 601b9e67834SAndre Fischer throw beans::UnknownPropertyException(); 602b9e67834SAndre Fischer 603b9e67834SAndre Fischer eItem = iId->second; 604b9e67834SAndre Fischer } 605b9e67834SAndre Fischer ChangeListenerContainer* pListeners = GetChangeListeners(eItem, true); 606b9e67834SAndre Fischer if (pListeners != NULL) 607b9e67834SAndre Fischer pListeners->push_back(rxListener); 608b9e67834SAndre Fischer } 609b9e67834SAndre Fischer 610b9e67834SAndre Fischer 611b9e67834SAndre Fischer 612b9e67834SAndre Fischer 613b9e67834SAndre Fischer void SAL_CALL Theme::removePropertyChangeListener( 614b9e67834SAndre Fischer const ::rtl::OUString& rsPropertyName, 615b9e67834SAndre Fischer const cssu::Reference<css::beans::XPropertyChangeListener>& rxListener) 616b9e67834SAndre Fischer throw(css::beans::UnknownPropertyException, 617b9e67834SAndre Fischer css::lang::WrappedTargetException, 618b9e67834SAndre Fischer cssu::RuntimeException) 619b9e67834SAndre Fischer { 620b9e67834SAndre Fischer ThemeItem eItem (__AnyItem); 621b9e67834SAndre Fischer if (rsPropertyName.getLength() > 0) 622b9e67834SAndre Fischer { 623b9e67834SAndre Fischer PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName)); 624b9e67834SAndre Fischer if (iId == maPropertyNameToIdMap.end()) 625b9e67834SAndre Fischer throw beans::UnknownPropertyException(); 626b9e67834SAndre Fischer 627b9e67834SAndre Fischer const PropertyType eType (GetPropertyType(iId->second)); 628b9e67834SAndre Fischer if (eType == PT_Invalid) 629b9e67834SAndre Fischer throw beans::UnknownPropertyException(); 630b9e67834SAndre Fischer 631b9e67834SAndre Fischer eItem = iId->second; 632b9e67834SAndre Fischer } 633b9e67834SAndre Fischer ChangeListenerContainer* pContainer = GetChangeListeners(eItem, false); 634b9e67834SAndre Fischer if (pContainer != NULL) 635b9e67834SAndre Fischer { 636b9e67834SAndre Fischer ChangeListenerContainer::iterator iListener (::std::find(pContainer->begin(), pContainer->end(), rxListener)); 637b9e67834SAndre Fischer if (iListener != pContainer->end()) 638b9e67834SAndre Fischer { 639b9e67834SAndre Fischer pContainer->erase(iListener); 640b9e67834SAndre Fischer 641b9e67834SAndre Fischer // Remove the listener container when empty. 642b9e67834SAndre Fischer if (pContainer->empty()) 643b9e67834SAndre Fischer maChangeListeners.erase(eItem); 644b9e67834SAndre Fischer } 645b9e67834SAndre Fischer } 646b9e67834SAndre Fischer } 647b9e67834SAndre Fischer 648b9e67834SAndre Fischer 649b9e67834SAndre Fischer 650b9e67834SAndre Fischer 651b9e67834SAndre Fischer void SAL_CALL Theme::addVetoableChangeListener( 652b9e67834SAndre Fischer const ::rtl::OUString& rsPropertyName, 653b9e67834SAndre Fischer const cssu::Reference<css::beans::XVetoableChangeListener>& rxListener) 654b9e67834SAndre Fischer throw(css::beans::UnknownPropertyException, 655b9e67834SAndre Fischer css::lang::WrappedTargetException, 656b9e67834SAndre Fischer cssu::RuntimeException) 657b9e67834SAndre Fischer { 658b9e67834SAndre Fischer ThemeItem eItem (__AnyItem); 659b9e67834SAndre Fischer if (rsPropertyName.getLength() > 0) 660b9e67834SAndre Fischer { 661b9e67834SAndre Fischer PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName)); 662b9e67834SAndre Fischer if (iId == maPropertyNameToIdMap.end()) 663b9e67834SAndre Fischer throw beans::UnknownPropertyException(); 664b9e67834SAndre Fischer 665b9e67834SAndre Fischer const PropertyType eType (GetPropertyType(iId->second)); 666b9e67834SAndre Fischer if (eType == PT_Invalid) 667b9e67834SAndre Fischer throw beans::UnknownPropertyException(); 668b9e67834SAndre Fischer 669b9e67834SAndre Fischer eItem = iId->second; 670b9e67834SAndre Fischer } 671b9e67834SAndre Fischer VetoableListenerContainer* pListeners = GetVetoableListeners(eItem, true); 672b9e67834SAndre Fischer if (pListeners != NULL) 673b9e67834SAndre Fischer pListeners->push_back(rxListener); 674b9e67834SAndre Fischer } 675b9e67834SAndre Fischer 676b9e67834SAndre Fischer 677b9e67834SAndre Fischer 678b9e67834SAndre Fischer 679b9e67834SAndre Fischer void SAL_CALL Theme::removeVetoableChangeListener( 680b9e67834SAndre Fischer const ::rtl::OUString& rsPropertyName, 681b9e67834SAndre Fischer const cssu::Reference<css::beans::XVetoableChangeListener>& rxListener) 682b9e67834SAndre Fischer throw(css::beans::UnknownPropertyException, 683b9e67834SAndre Fischer css::lang::WrappedTargetException, 684b9e67834SAndre Fischer cssu::RuntimeException) 685b9e67834SAndre Fischer { 686b9e67834SAndre Fischer ThemeItem eItem (__AnyItem); 687b9e67834SAndre Fischer if (rsPropertyName.getLength() > 0) 688b9e67834SAndre Fischer { 689b9e67834SAndre Fischer PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName)); 690b9e67834SAndre Fischer if (iId == maPropertyNameToIdMap.end()) 691b9e67834SAndre Fischer throw beans::UnknownPropertyException(); 692b9e67834SAndre Fischer 693b9e67834SAndre Fischer const PropertyType eType (GetPropertyType(iId->second)); 694b9e67834SAndre Fischer if (eType == PT_Invalid) 695b9e67834SAndre Fischer throw beans::UnknownPropertyException(); 696b9e67834SAndre Fischer 697b9e67834SAndre Fischer eItem = iId->second; 698b9e67834SAndre Fischer } 699b9e67834SAndre Fischer VetoableListenerContainer* pContainer = GetVetoableListeners(eItem, false); 700b9e67834SAndre Fischer if (pContainer != NULL) 701b9e67834SAndre Fischer { 702b9e67834SAndre Fischer VetoableListenerContainer::iterator iListener (::std::find(pContainer->begin(), pContainer->end(), rxListener)); 703b9e67834SAndre Fischer if (iListener != pContainer->end()) 704b9e67834SAndre Fischer { 705b9e67834SAndre Fischer pContainer->erase(iListener); 706b9e67834SAndre Fischer // Remove container when empty. 707b9e67834SAndre Fischer if (pContainer->empty()) 708b9e67834SAndre Fischer maVetoableListeners.erase(eItem); 709b9e67834SAndre Fischer } 710b9e67834SAndre Fischer } 711b9e67834SAndre Fischer } 712b9e67834SAndre Fischer 713b9e67834SAndre Fischer 714b9e67834SAndre Fischer 715b9e67834SAndre Fischer 71695a18594SAndre Fischer cssu::Sequence<css::beans::Property> SAL_CALL Theme::getProperties (void) 71795a18594SAndre Fischer throw(cssu::RuntimeException) 71895a18594SAndre Fischer { 71995a18594SAndre Fischer ::std::vector<beans::Property> aProperties; 72095a18594SAndre Fischer 72195a18594SAndre Fischer for (sal_Int32 nItem(__Begin),nEnd(__End); nItem!=nEnd; ++nItem) 72295a18594SAndre Fischer { 72395a18594SAndre Fischer const ThemeItem eItem (static_cast<ThemeItem>(nItem)); 72495a18594SAndre Fischer const PropertyType eType (GetPropertyType(eItem)); 72595a18594SAndre Fischer if (eType == PT_Invalid) 72695a18594SAndre Fischer continue; 72795a18594SAndre Fischer 72895a18594SAndre Fischer const beans::Property aProperty( 72995a18594SAndre Fischer maPropertyIdToNameMap[eItem], 73095a18594SAndre Fischer eItem, 73195a18594SAndre Fischer GetCppuType(eType), 73295a18594SAndre Fischer 0); 73395a18594SAndre Fischer aProperties.push_back(aProperty); 73495a18594SAndre Fischer } 73595a18594SAndre Fischer 73695a18594SAndre Fischer return cssu::Sequence<css::beans::Property>( 73795a18594SAndre Fischer &aProperties.front(), 73895a18594SAndre Fischer aProperties.size()); 73995a18594SAndre Fischer } 74095a18594SAndre Fischer 74195a18594SAndre Fischer 74295a18594SAndre Fischer 74395a18594SAndre Fischer 74495a18594SAndre Fischer beans::Property SAL_CALL Theme::getPropertyByName (const ::rtl::OUString& rsPropertyName) 74595a18594SAndre Fischer throw(css::beans::UnknownPropertyException, 74695a18594SAndre Fischer cssu::RuntimeException) 74795a18594SAndre Fischer { 74895a18594SAndre Fischer PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName)); 74995a18594SAndre Fischer if (iId == maPropertyNameToIdMap.end()) 75095a18594SAndre Fischer throw beans::UnknownPropertyException(); 75195a18594SAndre Fischer 75295a18594SAndre Fischer const PropertyType eType (GetPropertyType(iId->second)); 75395a18594SAndre Fischer if (eType == PT_Invalid) 75495a18594SAndre Fischer throw beans::UnknownPropertyException(); 75595a18594SAndre Fischer 75695a18594SAndre Fischer const ThemeItem eItem (iId->second); 75795a18594SAndre Fischer 75895a18594SAndre Fischer return beans::Property( 75995a18594SAndre Fischer rsPropertyName, 76095a18594SAndre Fischer eItem, 76195a18594SAndre Fischer GetCppuType(eType), 76295a18594SAndre Fischer 0); 76395a18594SAndre Fischer } 76495a18594SAndre Fischer 76595a18594SAndre Fischer 76695a18594SAndre Fischer 76795a18594SAndre Fischer 76895a18594SAndre Fischer sal_Bool SAL_CALL Theme::hasPropertyByName (const ::rtl::OUString& rsPropertyName) 76995a18594SAndre Fischer throw(cssu::RuntimeException) 77095a18594SAndre Fischer { 77195a18594SAndre Fischer PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName)); 77295a18594SAndre Fischer if (iId == maPropertyNameToIdMap.end()) 77395a18594SAndre Fischer return sal_False; 77495a18594SAndre Fischer 77595a18594SAndre Fischer const PropertyType eType (GetPropertyType(iId->second)); 77695a18594SAndre Fischer if (eType == PT_Invalid) 77795a18594SAndre Fischer return sal_False; 77895a18594SAndre Fischer 77995a18594SAndre Fischer return sal_True; 78095a18594SAndre Fischer } 78195a18594SAndre Fischer 78295a18594SAndre Fischer 78395a18594SAndre Fischer 78495a18594SAndre Fischer 785b9e67834SAndre Fischer void Theme::SetupPropertyMaps (void) 786b9e67834SAndre Fischer { 78795a18594SAndre Fischer maPropertyIdToNameMap.resize(__Post_Rect); 788b9e67834SAndre Fischer maImages.resize(__Image_Color - __Pre_Image - 1); 789b9e67834SAndre Fischer maColors.resize(__Color_Paint - __Image_Color - 1); 790b9e67834SAndre Fischer maPaints.resize(__Paint_Int - __Color_Paint - 1); 791b9e67834SAndre Fischer maIntegers.resize(__Int_Bool - __Paint_Int - 1); 79295a18594SAndre Fischer maBooleans.resize(__Bool_Rect - __Int_Bool - 1); 79395a18594SAndre Fischer maRectangles.resize(__Post_Rect - __Bool_Rect - 1); 794b9e67834SAndre Fischer 795b9e67834SAndre Fischer #define AddEntry(e) maPropertyNameToIdMap[A2S(#e)]=e; maPropertyIdToNameMap[e]=A2S(#e) 79695a18594SAndre Fischer 797b9e67834SAndre Fischer AddEntry(Image_Grip); 798b9e67834SAndre Fischer AddEntry(Image_Expand); 799b9e67834SAndre Fischer AddEntry(Image_Collapse); 8007a32b0c8SAndre Fischer AddEntry(Image_TabBarMenu); 8017a32b0c8SAndre Fischer AddEntry(Image_PanelMenu); 80295a18594SAndre Fischer AddEntry(Image_ToolBoxItemSeparator); 8037a32b0c8SAndre Fischer AddEntry(Image_Closer); 804b9e67834SAndre Fischer 805b9e67834SAndre Fischer AddEntry(Color_DeckTitleFont); 806b9e67834SAndre Fischer AddEntry(Color_PanelTitleFont); 807b9e67834SAndre Fischer AddEntry(Color_TabMenuSeparator); 808b9e67834SAndre Fischer AddEntry(Color_TabItemBorder); 8098dcb2a10SAndre Fischer AddEntry(Color_DropDownBorder); 8105f1c83ffSOliver-Rainer Wittmann AddEntry(Color_Highlight); 8115f1c83ffSOliver-Rainer Wittmann AddEntry(Color_HighlightText); 812b9e67834SAndre Fischer 813b9e67834SAndre Fischer AddEntry(Paint_DeckBackground); 814b9e67834SAndre Fischer AddEntry(Paint_DeckTitleBarBackground); 815b9e67834SAndre Fischer AddEntry(Paint_PanelBackground); 816b9e67834SAndre Fischer AddEntry(Paint_PanelTitleBarBackground); 817b9e67834SAndre Fischer AddEntry(Paint_TabBarBackground); 81895a18594SAndre Fischer AddEntry(Paint_TabItemBackgroundNormal); 81995a18594SAndre Fischer AddEntry(Paint_TabItemBackgroundHighlight); 820b9e67834SAndre Fischer AddEntry(Paint_HorizontalBorder); 821b9e67834SAndre Fischer AddEntry(Paint_VerticalBorder); 82295a18594SAndre Fischer AddEntry(Paint_ToolBoxBackground); 82395a18594SAndre Fischer AddEntry(Paint_ToolBoxBorderTopLeft); 82495a18594SAndre Fischer AddEntry(Paint_ToolBoxBorderCenterCorners); 82595a18594SAndre Fischer AddEntry(Paint_ToolBoxBorderBottomRight); 8268dcb2a10SAndre Fischer AddEntry(Paint_DropDownBackground); 827b9e67834SAndre Fischer 828b9e67834SAndre Fischer AddEntry(Int_DeckTitleBarHeight); 829b9e67834SAndre Fischer AddEntry(Int_DeckBorderSize); 830b9e67834SAndre Fischer AddEntry(Int_DeckSeparatorHeight); 831b9e67834SAndre Fischer AddEntry(Int_PanelTitleBarHeight); 832b9e67834SAndre Fischer AddEntry(Int_TabMenuPadding); 833b9e67834SAndre Fischer AddEntry(Int_TabMenuSeparatorPadding); 834b9e67834SAndre Fischer AddEntry(Int_TabItemWidth); 835b9e67834SAndre Fischer AddEntry(Int_TabItemHeight); 836b9e67834SAndre Fischer AddEntry(Int_DeckLeftPadding); 837b9e67834SAndre Fischer AddEntry(Int_DeckTopPadding); 838b9e67834SAndre Fischer AddEntry(Int_DeckRightPadding); 839b9e67834SAndre Fischer AddEntry(Int_DeckBottomPadding); 840b9e67834SAndre Fischer AddEntry(Int_TabBarLeftPadding); 841b9e67834SAndre Fischer AddEntry(Int_TabBarTopPadding); 842b9e67834SAndre Fischer AddEntry(Int_TabBarRightPadding); 843b9e67834SAndre Fischer AddEntry(Int_TabBarBottomPadding); 84437fee4fdSAndre Fischer AddEntry(Int_ButtonCornerRadius); 845b9e67834SAndre Fischer 846b9e67834SAndre Fischer AddEntry(Bool_UseSymphonyIcons); 84795a18594SAndre Fischer AddEntry(Bool_UseSystemColors); 84895a18594SAndre Fischer AddEntry(Bool_UseToolBoxItemSeparator); 84995a18594SAndre Fischer AddEntry(Bool_IsHighContrastModeActive); 85095a18594SAndre Fischer 85195a18594SAndre Fischer AddEntry(Rect_ToolBoxPadding); 85295a18594SAndre Fischer AddEntry(Rect_ToolBoxBorder); 85395a18594SAndre Fischer 854b9e67834SAndre Fischer #undef AddEntry 855b9e67834SAndre Fischer 856b9e67834SAndre Fischer maRawValues.resize(maPropertyIdToNameMap.size()); 857b9e67834SAndre Fischer } 858b9e67834SAndre Fischer 859b9e67834SAndre Fischer 860b9e67834SAndre Fischer 861b9e67834SAndre Fischer 862b9e67834SAndre Fischer Theme::PropertyType Theme::GetPropertyType (const ThemeItem eItem) 863b9e67834SAndre Fischer { 864b9e67834SAndre Fischer switch(eItem) 865b9e67834SAndre Fischer { 866b9e67834SAndre Fischer case Image_Grip: 867b9e67834SAndre Fischer case Image_Expand: 868b9e67834SAndre Fischer case Image_Collapse: 8697a32b0c8SAndre Fischer case Image_TabBarMenu: 8707a32b0c8SAndre Fischer case Image_PanelMenu: 87195a18594SAndre Fischer case Image_ToolBoxItemSeparator: 8727a32b0c8SAndre Fischer case Image_Closer: 873b9e67834SAndre Fischer return PT_Image; 874b9e67834SAndre Fischer 875b9e67834SAndre Fischer case Color_DeckTitleFont: 876b9e67834SAndre Fischer case Color_PanelTitleFont: 877b9e67834SAndre Fischer case Color_TabMenuSeparator: 878b9e67834SAndre Fischer case Color_TabItemBorder: 8798dcb2a10SAndre Fischer case Color_DropDownBorder: 8805f1c83ffSOliver-Rainer Wittmann case Color_Highlight: 8815f1c83ffSOliver-Rainer Wittmann case Color_HighlightText: 882b9e67834SAndre Fischer return PT_Color; 883b9e67834SAndre Fischer 884b9e67834SAndre Fischer case Paint_DeckBackground: 885b9e67834SAndre Fischer case Paint_DeckTitleBarBackground: 886b9e67834SAndre Fischer case Paint_PanelBackground: 887b9e67834SAndre Fischer case Paint_PanelTitleBarBackground: 888b9e67834SAndre Fischer case Paint_TabBarBackground: 88995a18594SAndre Fischer case Paint_TabItemBackgroundNormal: 89095a18594SAndre Fischer case Paint_TabItemBackgroundHighlight: 891b9e67834SAndre Fischer case Paint_HorizontalBorder: 892b9e67834SAndre Fischer case Paint_VerticalBorder: 89395a18594SAndre Fischer case Paint_ToolBoxBackground: 89495a18594SAndre Fischer case Paint_ToolBoxBorderTopLeft: 89595a18594SAndre Fischer case Paint_ToolBoxBorderCenterCorners: 89695a18594SAndre Fischer case Paint_ToolBoxBorderBottomRight: 8978dcb2a10SAndre Fischer case Paint_DropDownBackground: 898b9e67834SAndre Fischer return PT_Paint; 899b9e67834SAndre Fischer 900b9e67834SAndre Fischer case Int_DeckTitleBarHeight: 901b9e67834SAndre Fischer case Int_DeckBorderSize: 902b9e67834SAndre Fischer case Int_DeckSeparatorHeight: 903b9e67834SAndre Fischer case Int_PanelTitleBarHeight: 904b9e67834SAndre Fischer case Int_TabMenuPadding: 905b9e67834SAndre Fischer case Int_TabMenuSeparatorPadding: 906b9e67834SAndre Fischer case Int_TabItemWidth: 907b9e67834SAndre Fischer case Int_TabItemHeight: 908b9e67834SAndre Fischer case Int_DeckLeftPadding: 909b9e67834SAndre Fischer case Int_DeckTopPadding: 910b9e67834SAndre Fischer case Int_DeckRightPadding: 911b9e67834SAndre Fischer case Int_DeckBottomPadding: 912b9e67834SAndre Fischer case Int_TabBarLeftPadding: 913b9e67834SAndre Fischer case Int_TabBarTopPadding: 914b9e67834SAndre Fischer case Int_TabBarRightPadding: 915b9e67834SAndre Fischer case Int_TabBarBottomPadding: 91637fee4fdSAndre Fischer case Int_ButtonCornerRadius: 917b9e67834SAndre Fischer return PT_Integer; 918b9e67834SAndre Fischer 919b9e67834SAndre Fischer case Bool_UseSymphonyIcons: 92095a18594SAndre Fischer case Bool_UseSystemColors: 92195a18594SAndre Fischer case Bool_UseToolBoxItemSeparator: 92295a18594SAndre Fischer case Bool_IsHighContrastModeActive: 923b9e67834SAndre Fischer return PT_Boolean; 924b9e67834SAndre Fischer 92595a18594SAndre Fischer case Rect_ToolBoxBorder: 92695a18594SAndre Fischer case Rect_ToolBoxPadding: 92795a18594SAndre Fischer return PT_Rectangle; 92895a18594SAndre Fischer 929b9e67834SAndre Fischer default: 930b9e67834SAndre Fischer return PT_Invalid; 931b9e67834SAndre Fischer } 932b9e67834SAndre Fischer } 933b9e67834SAndre Fischer 934b9e67834SAndre Fischer 935b9e67834SAndre Fischer 936b9e67834SAndre Fischer 93795a18594SAndre Fischer cssu::Type Theme::GetCppuType (const PropertyType eType) 93895a18594SAndre Fischer { 93995a18594SAndre Fischer switch(eType) 94095a18594SAndre Fischer { 94195a18594SAndre Fischer case PT_Image: 94295a18594SAndre Fischer return getCppuType((rtl::OUString*)NULL); 94395a18594SAndre Fischer 94495a18594SAndre Fischer case PT_Color: 94595a18594SAndre Fischer return getCppuType((sal_uInt32*)NULL); 94695a18594SAndre Fischer 94795a18594SAndre Fischer case PT_Paint: 94895a18594SAndre Fischer return getCppuVoidType(); 94995a18594SAndre Fischer 95095a18594SAndre Fischer case PT_Integer: 95195a18594SAndre Fischer return getCppuType((sal_Int32*)NULL); 95295a18594SAndre Fischer 95395a18594SAndre Fischer case PT_Boolean: 95495a18594SAndre Fischer return getCppuType((sal_Bool*)NULL); 95595a18594SAndre Fischer 95695a18594SAndre Fischer case PT_Rectangle: 95795a18594SAndre Fischer return getCppuType((awt::Rectangle*)NULL); 95895a18594SAndre Fischer 95995a18594SAndre Fischer case PT_Invalid: 96095a18594SAndre Fischer default: 96195a18594SAndre Fischer return getCppuVoidType(); 96295a18594SAndre Fischer } 96395a18594SAndre Fischer } 96495a18594SAndre Fischer 96595a18594SAndre Fischer 96695a18594SAndre Fischer 96795a18594SAndre Fischer 968b9e67834SAndre Fischer sal_Int32 Theme::GetIndex (const ThemeItem eItem, const PropertyType eType) 969b9e67834SAndre Fischer { 970b9e67834SAndre Fischer switch(eType) 971b9e67834SAndre Fischer { 972b9e67834SAndre Fischer case PT_Image: 973b9e67834SAndre Fischer return eItem - __Pre_Image-1; 974b9e67834SAndre Fischer case PT_Color: 975b9e67834SAndre Fischer return eItem - __Image_Color-1; 976b9e67834SAndre Fischer case PT_Paint: 977b9e67834SAndre Fischer return eItem - __Color_Paint-1; 978b9e67834SAndre Fischer case PT_Integer: 979b9e67834SAndre Fischer return eItem - __Paint_Int-1; 980b9e67834SAndre Fischer case PT_Boolean: 981b9e67834SAndre Fischer return eItem - __Int_Bool-1; 98295a18594SAndre Fischer case PT_Rectangle: 98395a18594SAndre Fischer return eItem - __Bool_Rect-1; 984b9e67834SAndre Fischer 985b9e67834SAndre Fischer default: 986b9e67834SAndre Fischer OSL_ASSERT(false); 987b9e67834SAndre Fischer return 0; 988b9e67834SAndre Fischer } 989b9e67834SAndre Fischer } 990b9e67834SAndre Fischer 991b9e67834SAndre Fischer 992b9e67834SAndre Fischer 993b9e67834SAndre Fischer 994b9e67834SAndre Fischer Theme::VetoableListenerContainer* Theme::GetVetoableListeners ( 995b9e67834SAndre Fischer const ThemeItem eItem, 996b9e67834SAndre Fischer const bool bCreate) 997b9e67834SAndre Fischer { 998b9e67834SAndre Fischer VetoableListeners::iterator iContainer (maVetoableListeners.find(eItem)); 999b9e67834SAndre Fischer if (iContainer != maVetoableListeners.end()) 1000b9e67834SAndre Fischer return &iContainer->second; 1001b9e67834SAndre Fischer else if (bCreate) 1002b9e67834SAndre Fischer { 1003b9e67834SAndre Fischer maVetoableListeners[eItem] = VetoableListenerContainer(); 1004b9e67834SAndre Fischer return &maVetoableListeners[eItem]; 1005b9e67834SAndre Fischer } 1006b9e67834SAndre Fischer else 1007b9e67834SAndre Fischer return NULL; 1008b9e67834SAndre Fischer } 1009b9e67834SAndre Fischer 1010b9e67834SAndre Fischer 1011b9e67834SAndre Fischer 1012b9e67834SAndre Fischer 1013b9e67834SAndre Fischer Theme::ChangeListenerContainer* Theme::GetChangeListeners ( 1014b9e67834SAndre Fischer const ThemeItem eItem, 1015b9e67834SAndre Fischer const bool bCreate) 1016b9e67834SAndre Fischer { 1017b9e67834SAndre Fischer ChangeListeners::iterator iContainer (maChangeListeners.find(eItem)); 1018b9e67834SAndre Fischer if (iContainer != maChangeListeners.end()) 1019b9e67834SAndre Fischer return &iContainer->second; 1020b9e67834SAndre Fischer else if (bCreate) 1021b9e67834SAndre Fischer { 1022b9e67834SAndre Fischer maChangeListeners[eItem] = ChangeListenerContainer(); 1023b9e67834SAndre Fischer return &maChangeListeners[eItem]; 1024b9e67834SAndre Fischer } 1025b9e67834SAndre Fischer else 1026b9e67834SAndre Fischer return NULL; 1027b9e67834SAndre Fischer } 1028b9e67834SAndre Fischer 1029b9e67834SAndre Fischer 1030b9e67834SAndre Fischer 1031b9e67834SAndre Fischer 1032b9e67834SAndre Fischer bool Theme::DoVetoableListenersVeto ( 1033b9e67834SAndre Fischer const VetoableListenerContainer* pListeners, 1034b9e67834SAndre Fischer const beans::PropertyChangeEvent& rEvent) const 1035b9e67834SAndre Fischer { 1036b9e67834SAndre Fischer if (pListeners == NULL) 1037b9e67834SAndre Fischer return false; 1038b9e67834SAndre Fischer 1039b9e67834SAndre Fischer VetoableListenerContainer aListeners (*pListeners); 1040b9e67834SAndre Fischer try 1041b9e67834SAndre Fischer { 1042b9e67834SAndre Fischer for (VetoableListenerContainer::const_iterator 1043b9e67834SAndre Fischer iListener(aListeners.begin()), 1044b9e67834SAndre Fischer iEnd(aListeners.end()); 1045b9e67834SAndre Fischer iListener!=iEnd; 1046b9e67834SAndre Fischer ++iListener) 1047b9e67834SAndre Fischer { 1048b9e67834SAndre Fischer (*iListener)->vetoableChange(rEvent); 1049b9e67834SAndre Fischer } 1050b9e67834SAndre Fischer } 1051b9e67834SAndre Fischer catch(const beans::PropertyVetoException&) 1052b9e67834SAndre Fischer { 1053b9e67834SAndre Fischer return true; 1054b9e67834SAndre Fischer } 1055b9e67834SAndre Fischer catch(const Exception&) 1056b9e67834SAndre Fischer { 1057b9e67834SAndre Fischer // Ignore any other errors (such as disposed listeners). 1058b9e67834SAndre Fischer } 1059b9e67834SAndre Fischer return false; 1060b9e67834SAndre Fischer } 1061b9e67834SAndre Fischer 1062b9e67834SAndre Fischer 1063b9e67834SAndre Fischer 1064b9e67834SAndre Fischer 1065b9e67834SAndre Fischer void Theme::BroadcastPropertyChange ( 1066b9e67834SAndre Fischer const ChangeListenerContainer* pListeners, 1067b9e67834SAndre Fischer const beans::PropertyChangeEvent& rEvent) const 1068b9e67834SAndre Fischer { 1069b9e67834SAndre Fischer if (pListeners == NULL) 1070b9e67834SAndre Fischer return; 1071b9e67834SAndre Fischer 1072b9e67834SAndre Fischer const ChangeListenerContainer aListeners (*pListeners); 1073b9e67834SAndre Fischer try 1074b9e67834SAndre Fischer { 1075b9e67834SAndre Fischer for (ChangeListenerContainer::const_iterator 1076b9e67834SAndre Fischer iListener(aListeners.begin()), 1077b9e67834SAndre Fischer iEnd(aListeners.end()); 1078b9e67834SAndre Fischer iListener!=iEnd; 1079b9e67834SAndre Fischer ++iListener) 1080b9e67834SAndre Fischer { 1081b9e67834SAndre Fischer (*iListener)->propertyChange(rEvent); 1082b9e67834SAndre Fischer } 1083b9e67834SAndre Fischer } 1084b9e67834SAndre Fischer catch(const Exception&) 1085b9e67834SAndre Fischer { 1086b9e67834SAndre Fischer // Ignore any errors (such as disposed listeners). 1087b9e67834SAndre Fischer } 1088b9e67834SAndre Fischer } 1089b9e67834SAndre Fischer 1090b9e67834SAndre Fischer 1091b9e67834SAndre Fischer 1092b9e67834SAndre Fischer 1093b9e67834SAndre Fischer void Theme::ProcessNewValue ( 1094b9e67834SAndre Fischer const Any& rValue, 1095b9e67834SAndre Fischer const ThemeItem eItem, 1096b9e67834SAndre Fischer const PropertyType eType) 1097b9e67834SAndre Fischer { 1098b9e67834SAndre Fischer const sal_Int32 nIndex (GetIndex (eItem, eType)); 1099b9e67834SAndre Fischer switch (eType) 1100b9e67834SAndre Fischer { 1101b9e67834SAndre Fischer case PT_Image: 1102b9e67834SAndre Fischer { 1103b9e67834SAndre Fischer ::rtl::OUString sURL; 1104b9e67834SAndre Fischer if (rValue >>= sURL) 1105b9e67834SAndre Fischer { 1106b9e67834SAndre Fischer maImages[nIndex] = Tools::GetImage(sURL, NULL); 1107b9e67834SAndre Fischer } 1108b9e67834SAndre Fischer break; 1109b9e67834SAndre Fischer } 1110b9e67834SAndre Fischer case PT_Color: 1111b9e67834SAndre Fischer { 111295a18594SAndre Fischer sal_Int32 nColorValue (0); 1113b9e67834SAndre Fischer if (rValue >>= nColorValue) 1114b9e67834SAndre Fischer { 1115b9e67834SAndre Fischer maColors[nIndex] = Color(nColorValue); 1116b9e67834SAndre Fischer } 1117b9e67834SAndre Fischer break; 1118b9e67834SAndre Fischer } 1119b9e67834SAndre Fischer case PT_Paint: 1120b9e67834SAndre Fischer { 112195a18594SAndre Fischer maPaints[nIndex] = Paint::Create(rValue); 1122b9e67834SAndre Fischer break; 1123b9e67834SAndre Fischer } 1124b9e67834SAndre Fischer case PT_Integer: 1125b9e67834SAndre Fischer { 112695a18594SAndre Fischer sal_Int32 nValue (0); 1127b9e67834SAndre Fischer if (rValue >>= nValue) 1128b9e67834SAndre Fischer { 1129b9e67834SAndre Fischer maIntegers[nIndex] = nValue; 1130b9e67834SAndre Fischer } 1131b9e67834SAndre Fischer break; 1132b9e67834SAndre Fischer } 1133b9e67834SAndre Fischer case PT_Boolean: 1134b9e67834SAndre Fischer { 113595a18594SAndre Fischer sal_Bool nValue (0); 1136b9e67834SAndre Fischer if (rValue >>= nValue) 1137b9e67834SAndre Fischer { 1138b9e67834SAndre Fischer maBooleans[nIndex] = (nValue==sal_True); 113995a18594SAndre Fischer if (eItem == Bool_IsHighContrastModeActive) 114095a18594SAndre Fischer { 114195a18594SAndre Fischer mbIsHighContrastModeSetManually = true; 114295a18594SAndre Fischer mbIsHighContrastMode = maBooleans[nIndex]; 114395a18594SAndre Fischer HandleDataChange(); 114495a18594SAndre Fischer } 114595a18594SAndre Fischer else if (eItem == Bool_UseSystemColors) 114695a18594SAndre Fischer { 114795a18594SAndre Fischer HandleDataChange(); 114895a18594SAndre Fischer } 114995a18594SAndre Fischer } 115095a18594SAndre Fischer break; 115195a18594SAndre Fischer } 115295a18594SAndre Fischer case PT_Rectangle: 115395a18594SAndre Fischer { 115495a18594SAndre Fischer awt::Rectangle aBox; 115595a18594SAndre Fischer if (rValue >>= aBox) 115695a18594SAndre Fischer { 115795a18594SAndre Fischer maRectangles[nIndex] = Rectangle( 115895a18594SAndre Fischer aBox.X, 115995a18594SAndre Fischer aBox.Y, 116095a18594SAndre Fischer aBox.Width, 116195a18594SAndre Fischer aBox.Height); 1162b9e67834SAndre Fischer } 1163b9e67834SAndre Fischer break; 1164b9e67834SAndre Fischer } 1165b9e67834SAndre Fischer case PT_Invalid: 1166b9e67834SAndre Fischer OSL_ASSERT(eType != PT_Invalid); 1167b9e67834SAndre Fischer throw RuntimeException(); 1168b9e67834SAndre Fischer } 1169b9e67834SAndre Fischer } 1170b9e67834SAndre Fischer 1171b9e67834SAndre Fischer 1172b9e67834SAndre Fischer 1173ff12d537SAndre Fischer 1174ff12d537SAndre Fischer } } // end of namespace sfx2::sidebar 1175