1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include "stylesettings.hxx"
22 #include <toolkit/awt/vclxwindow.hxx>
23 #include <toolkit/helper/vclunohelper.hxx>
25 #include <com/sun/star/lang/DisposedException.hpp>
27 #include <cppuhelper/interfacecontainer.hxx>
28 #include <osl/mutex.hxx>
29 #include <vcl/window.hxx>
30 #include <vcl/settings.hxx>
31 #include <vcl/svapp.hxx>
38 using ::com::sun::star::uno::Reference
;
39 using ::com::sun::star::uno::XInterface
;
40 using ::com::sun::star::uno::UNO_QUERY
;
41 using ::com::sun::star::uno::UNO_QUERY_THROW
;
42 using ::com::sun::star::uno::UNO_SET_THROW
;
43 using ::com::sun::star::uno::Exception
;
44 using ::com::sun::star::uno::RuntimeException
;
45 using ::com::sun::star::uno::Any
;
46 using ::com::sun::star::uno::makeAny
;
47 using ::com::sun::star::uno::Sequence
;
48 using ::com::sun::star::uno::Type
;
49 using ::com::sun::star::lang::DisposedException
;
50 using ::com::sun::star::lang::EventObject
;
51 using ::com::sun::star::awt::FontDescriptor
;
52 using ::com::sun::star::awt::XStyleChangeListener
;
55 //= WindowStyleSettings_Data
57 struct WindowStyleSettings_Data
59 VCLXWindow
* pOwningWindow
;
60 ::cppu::OInterfaceContainerHelper aStyleChangeListeners
;
62 WindowStyleSettings_Data( ::osl::Mutex
& i_rListenerMutex
, VCLXWindow
& i_rOwningWindow
)
63 : pOwningWindow( &i_rOwningWindow
)
64 ,aStyleChangeListeners( i_rListenerMutex
)
68 DECL_LINK( OnWindowEvent
, const VclWindowEvent
* );
72 IMPL_LINK( WindowStyleSettings_Data
, OnWindowEvent
, const VclWindowEvent
*, i_pEvent
)
74 if ( !i_pEvent
|| ( i_pEvent
->GetId() != VCLEVENT_WINDOW_DATACHANGED
) )
76 const DataChangedEvent
* pDataChangedEvent
= static_cast< const DataChangedEvent
* >( i_pEvent
->GetData() );
77 if ( !pDataChangedEvent
|| ( pDataChangedEvent
->GetType() != DataChangedEventType::SETTINGS
) )
79 if ( !( pDataChangedEvent
->GetFlags() & AllSettingsFlags::STYLE
) )
82 EventObject
aEvent( *pOwningWindow
);
83 aStyleChangeListeners
.notifyEach( &XStyleChangeListener::styleSettingsChanged
, aEvent
);
90 class StyleMethodGuard
93 StyleMethodGuard( WindowStyleSettings_Data
& i_rData
)
95 if ( i_rData
.pOwningWindow
== NULL
)
96 throw DisposedException();
104 SolarMutexGuard m_aGuard
;
108 //= WindowStyleSettings
111 WindowStyleSettings::WindowStyleSettings(::osl::Mutex
& i_rListenerMutex
, VCLXWindow
& i_rOwningWindow
)
112 :m_pData( new WindowStyleSettings_Data(i_rListenerMutex
, i_rOwningWindow
) )
114 vcl::Window
* pWindow
= i_rOwningWindow
.GetWindow();
116 throw RuntimeException();
117 pWindow
->AddEventListener( LINK( m_pData
.get(), WindowStyleSettings_Data
, OnWindowEvent
) );
121 WindowStyleSettings::~WindowStyleSettings()
126 void WindowStyleSettings::dispose()
128 StyleMethodGuard
aGuard( *m_pData
);
130 vcl::Window
* pWindow
= m_pData
->pOwningWindow
->GetWindow();
131 OSL_ENSURE( pWindow
, "WindowStyleSettings::dispose: window has been reset before we could revoke the listener!" );
133 pWindow
->RemoveEventListener( LINK( m_pData
.get(), WindowStyleSettings_Data
, OnWindowEvent
) );
135 EventObject
aEvent( *this );
136 m_pData
->aStyleChangeListeners
.disposeAndClear( aEvent
);
138 m_pData
->pOwningWindow
= NULL
;
144 sal_Int32
lcl_getStyleColor( WindowStyleSettings_Data
& i_rData
, Color
const & (StyleSettings::*i_pGetter
)() const )
146 const vcl::Window
* pWindow
= i_rData
.pOwningWindow
->GetWindow();
147 const AllSettings aAllSettings
= pWindow
->GetSettings();
148 const StyleSettings aStyleSettings
= aAllSettings
.GetStyleSettings();
149 return (aStyleSettings
.*i_pGetter
)().GetColor();
152 void lcl_setStyleColor( WindowStyleSettings_Data
& i_rData
, void (StyleSettings::*i_pSetter
)( Color
const & ), const sal_Int32 i_nColor
)
154 vcl::Window
* pWindow
= i_rData
.pOwningWindow
->GetWindow();
155 AllSettings aAllSettings
= pWindow
->GetSettings();
156 StyleSettings aStyleSettings
= aAllSettings
.GetStyleSettings();
157 (aStyleSettings
.*i_pSetter
)( Color( i_nColor
) );
158 aAllSettings
.SetStyleSettings( aStyleSettings
);
159 pWindow
->SetSettings( aAllSettings
);
162 FontDescriptor
lcl_getStyleFont( WindowStyleSettings_Data
& i_rData
, vcl::Font
const & (StyleSettings::*i_pGetter
)() const )
164 const vcl::Window
* pWindow
= i_rData
.pOwningWindow
->GetWindow();
165 const AllSettings aAllSettings
= pWindow
->GetSettings();
166 const StyleSettings aStyleSettings
= aAllSettings
.GetStyleSettings();
167 return VCLUnoHelper::CreateFontDescriptor( (aStyleSettings
.*i_pGetter
)() );
170 void lcl_setStyleFont( WindowStyleSettings_Data
& i_rData
, void (StyleSettings::*i_pSetter
)( vcl::Font
const &),
171 vcl::Font
const & (StyleSettings::*i_pGetter
)() const, const FontDescriptor
& i_rFont
)
173 vcl::Window
* pWindow
= i_rData
.pOwningWindow
->GetWindow();
174 AllSettings aAllSettings
= pWindow
->GetSettings();
175 StyleSettings aStyleSettings
= aAllSettings
.GetStyleSettings();
176 const vcl::Font aNewFont
= VCLUnoHelper::CreateFont( i_rFont
, (aStyleSettings
.*i_pGetter
)() );
177 (aStyleSettings
.*i_pSetter
)( aNewFont
);
178 aAllSettings
.SetStyleSettings( aStyleSettings
);
179 pWindow
->SetSettings( aAllSettings
);
184 ::sal_Int32 SAL_CALL
WindowStyleSettings::getActiveBorderColor() throw (RuntimeException
, std::exception
)
186 StyleMethodGuard
aGuard( *m_pData
);
187 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetActiveBorderColor
);
191 void SAL_CALL
WindowStyleSettings::setActiveBorderColor( ::sal_Int32 _activebordercolor
) throw (RuntimeException
, std::exception
)
193 StyleMethodGuard
aGuard( *m_pData
);
194 lcl_setStyleColor( *m_pData
, &StyleSettings::SetActiveBorderColor
, _activebordercolor
);
198 ::sal_Int32 SAL_CALL
WindowStyleSettings::getActiveColor() throw (RuntimeException
, std::exception
)
200 StyleMethodGuard
aGuard( *m_pData
);
201 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetActiveColor
);
205 void SAL_CALL
WindowStyleSettings::setActiveColor( ::sal_Int32 _activecolor
) throw (RuntimeException
, std::exception
)
207 StyleMethodGuard
aGuard( *m_pData
);
208 lcl_setStyleColor( *m_pData
, &StyleSettings::SetActiveColor
, _activecolor
);
212 ::sal_Int32 SAL_CALL
WindowStyleSettings::getActiveTabColor() throw (RuntimeException
, std::exception
)
214 StyleMethodGuard
aGuard( *m_pData
);
215 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetActiveTabColor
);
219 void SAL_CALL
WindowStyleSettings::setActiveTabColor( ::sal_Int32 _activetabcolor
) throw (RuntimeException
, std::exception
)
221 StyleMethodGuard
aGuard( *m_pData
);
222 lcl_setStyleColor( *m_pData
, &StyleSettings::SetActiveTabColor
, _activetabcolor
);
226 ::sal_Int32 SAL_CALL
WindowStyleSettings::getActiveTextColor() throw (RuntimeException
, std::exception
)
228 StyleMethodGuard
aGuard( *m_pData
);
229 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetActiveTextColor
);
233 void SAL_CALL
WindowStyleSettings::setActiveTextColor( ::sal_Int32 _activetextcolor
) throw (RuntimeException
, std::exception
)
235 StyleMethodGuard
aGuard( *m_pData
);
236 lcl_setStyleColor( *m_pData
, &StyleSettings::SetActiveTextColor
, _activetextcolor
);
240 ::sal_Int32 SAL_CALL
WindowStyleSettings::getButtonRolloverTextColor() throw (RuntimeException
, std::exception
)
242 StyleMethodGuard
aGuard( *m_pData
);
243 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetButtonRolloverTextColor
);
247 void SAL_CALL
WindowStyleSettings::setButtonRolloverTextColor( ::sal_Int32 _buttonrollovertextcolor
) throw (RuntimeException
, std::exception
)
249 StyleMethodGuard
aGuard( *m_pData
);
250 lcl_setStyleColor( *m_pData
, &StyleSettings::SetButtonRolloverTextColor
, _buttonrollovertextcolor
);
254 ::sal_Int32 SAL_CALL
WindowStyleSettings::getButtonTextColor() throw (RuntimeException
, std::exception
)
256 StyleMethodGuard
aGuard( *m_pData
);
257 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetButtonTextColor
);
261 void SAL_CALL
WindowStyleSettings::setButtonTextColor( ::sal_Int32 _buttontextcolor
) throw (RuntimeException
, std::exception
)
263 StyleMethodGuard
aGuard( *m_pData
);
264 lcl_setStyleColor( *m_pData
, &StyleSettings::SetButtonTextColor
, _buttontextcolor
);
268 ::sal_Int32 SAL_CALL
WindowStyleSettings::getCheckedColor() throw (RuntimeException
, std::exception
)
270 StyleMethodGuard
aGuard( *m_pData
);
271 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetCheckedColor
);
275 void SAL_CALL
WindowStyleSettings::setCheckedColor( ::sal_Int32 _checkedcolor
) throw (RuntimeException
, std::exception
)
277 StyleMethodGuard
aGuard( *m_pData
);
278 lcl_setStyleColor( *m_pData
, &StyleSettings::SetCheckedColor
, _checkedcolor
);
282 ::sal_Int32 SAL_CALL
WindowStyleSettings::getDarkShadowColor() throw (RuntimeException
, std::exception
)
284 StyleMethodGuard
aGuard( *m_pData
);
285 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetDarkShadowColor
);
289 void SAL_CALL
WindowStyleSettings::setDarkShadowColor( ::sal_Int32 _darkshadowcolor
) throw (RuntimeException
, std::exception
)
291 StyleMethodGuard
aGuard( *m_pData
);
292 lcl_setStyleColor( *m_pData
, &StyleSettings::SetDarkShadowColor
, _darkshadowcolor
);
296 ::sal_Int32 SAL_CALL
WindowStyleSettings::getDeactiveBorderColor() throw (RuntimeException
, std::exception
)
298 StyleMethodGuard
aGuard( *m_pData
);
299 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetDeactiveBorderColor
);
303 void SAL_CALL
WindowStyleSettings::setDeactiveBorderColor( ::sal_Int32 _deactivebordercolor
) throw (RuntimeException
, std::exception
)
305 StyleMethodGuard
aGuard( *m_pData
);
306 lcl_setStyleColor( *m_pData
, &StyleSettings::SetDeactiveBorderColor
, _deactivebordercolor
);
310 ::sal_Int32 SAL_CALL
WindowStyleSettings::getDeactiveColor() throw (RuntimeException
, std::exception
)
312 StyleMethodGuard
aGuard( *m_pData
);
313 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetDeactiveColor
);
317 void SAL_CALL
WindowStyleSettings::setDeactiveColor( ::sal_Int32 _deactivecolor
) throw (RuntimeException
, std::exception
)
319 StyleMethodGuard
aGuard( *m_pData
);
320 lcl_setStyleColor( *m_pData
, &StyleSettings::SetDeactiveColor
, _deactivecolor
);
324 ::sal_Int32 SAL_CALL
WindowStyleSettings::getDeactiveTextColor() throw (RuntimeException
, std::exception
)
326 StyleMethodGuard
aGuard( *m_pData
);
327 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetDeactiveTextColor
);
331 void SAL_CALL
WindowStyleSettings::setDeactiveTextColor( ::sal_Int32 _deactivetextcolor
) throw (RuntimeException
, std::exception
)
333 StyleMethodGuard
aGuard( *m_pData
);
334 lcl_setStyleColor( *m_pData
, &StyleSettings::SetDeactiveTextColor
, _deactivetextcolor
);
338 ::sal_Int32 SAL_CALL
WindowStyleSettings::getDialogColor() throw (RuntimeException
, std::exception
)
340 StyleMethodGuard
aGuard( *m_pData
);
341 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetDialogColor
);
345 void SAL_CALL
WindowStyleSettings::setDialogColor( ::sal_Int32 _dialogcolor
) throw (RuntimeException
, std::exception
)
347 StyleMethodGuard
aGuard( *m_pData
);
348 lcl_setStyleColor( *m_pData
, &StyleSettings::SetDialogColor
, _dialogcolor
);
352 ::sal_Int32 SAL_CALL
WindowStyleSettings::getDialogTextColor() throw (RuntimeException
, std::exception
)
354 StyleMethodGuard
aGuard( *m_pData
);
355 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetDialogTextColor
);
359 void SAL_CALL
WindowStyleSettings::setDialogTextColor( ::sal_Int32 _dialogtextcolor
) throw (RuntimeException
, std::exception
)
361 StyleMethodGuard
aGuard( *m_pData
);
362 lcl_setStyleColor( *m_pData
, &StyleSettings::SetDialogTextColor
, _dialogtextcolor
);
366 ::sal_Int32 SAL_CALL
WindowStyleSettings::getDisableColor() throw (RuntimeException
, std::exception
)
368 StyleMethodGuard
aGuard( *m_pData
);
369 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetDisableColor
);
373 void SAL_CALL
WindowStyleSettings::setDisableColor( ::sal_Int32 _disablecolor
) throw (RuntimeException
, std::exception
)
375 StyleMethodGuard
aGuard( *m_pData
);
376 lcl_setStyleColor( *m_pData
, &StyleSettings::SetDisableColor
, _disablecolor
);
380 ::sal_Int32 SAL_CALL
WindowStyleSettings::getFaceColor() throw (RuntimeException
, std::exception
)
382 StyleMethodGuard
aGuard( *m_pData
);
383 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetFaceColor
);
387 void SAL_CALL
WindowStyleSettings::setFaceColor( ::sal_Int32 _facecolor
) throw (RuntimeException
, std::exception
)
389 StyleMethodGuard
aGuard( *m_pData
);
390 lcl_setStyleColor( *m_pData
, &StyleSettings::SetFaceColor
, _facecolor
);
394 ::sal_Int32 SAL_CALL
WindowStyleSettings::getFaceGradientColor() throw (RuntimeException
, std::exception
)
396 StyleMethodGuard
aGuard( *m_pData
);
397 const vcl::Window
* pWindow
= m_pData
->pOwningWindow
->GetWindow();
398 const AllSettings aAllSettings
= pWindow
->GetSettings();
399 const StyleSettings aStyleSettings
= aAllSettings
.GetStyleSettings();
400 return aStyleSettings
.GetFaceGradientColor().GetColor();
404 ::sal_Int32 SAL_CALL
WindowStyleSettings::getFieldColor() throw (RuntimeException
, std::exception
)
406 StyleMethodGuard
aGuard( *m_pData
);
407 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetFieldColor
);
411 void SAL_CALL
WindowStyleSettings::setFieldColor( ::sal_Int32 _fieldcolor
) throw (RuntimeException
, std::exception
)
413 StyleMethodGuard
aGuard( *m_pData
);
414 lcl_setStyleColor( *m_pData
, &StyleSettings::SetFieldColor
, _fieldcolor
);
418 ::sal_Int32 SAL_CALL
WindowStyleSettings::getFieldRolloverTextColor() throw (RuntimeException
, std::exception
)
420 StyleMethodGuard
aGuard( *m_pData
);
421 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetFieldRolloverTextColor
);
425 void SAL_CALL
WindowStyleSettings::setFieldRolloverTextColor( ::sal_Int32 _fieldrollovertextcolor
) throw (RuntimeException
, std::exception
)
427 StyleMethodGuard
aGuard( *m_pData
);
428 lcl_setStyleColor( *m_pData
, &StyleSettings::SetFieldRolloverTextColor
, _fieldrollovertextcolor
);
432 ::sal_Int32 SAL_CALL
WindowStyleSettings::getFieldTextColor() throw (RuntimeException
, std::exception
)
434 StyleMethodGuard
aGuard( *m_pData
);
435 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetFieldTextColor
);
439 void SAL_CALL
WindowStyleSettings::setFieldTextColor( ::sal_Int32 _fieldtextcolor
) throw (RuntimeException
, std::exception
)
441 StyleMethodGuard
aGuard( *m_pData
);
442 lcl_setStyleColor( *m_pData
, &StyleSettings::SetFieldTextColor
, _fieldtextcolor
);
446 ::sal_Int32 SAL_CALL
WindowStyleSettings::getGroupTextColor() throw (RuntimeException
, std::exception
)
448 StyleMethodGuard
aGuard( *m_pData
);
449 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetGroupTextColor
);
453 void SAL_CALL
WindowStyleSettings::setGroupTextColor( ::sal_Int32 _grouptextcolor
) throw (RuntimeException
, std::exception
)
455 StyleMethodGuard
aGuard( *m_pData
);
456 lcl_setStyleColor( *m_pData
, &StyleSettings::SetGroupTextColor
, _grouptextcolor
);
460 ::sal_Int32 SAL_CALL
WindowStyleSettings::getHelpColor() throw (RuntimeException
, std::exception
)
462 StyleMethodGuard
aGuard( *m_pData
);
463 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetHelpColor
);
467 void SAL_CALL
WindowStyleSettings::setHelpColor( ::sal_Int32 _helpcolor
) throw (RuntimeException
, std::exception
)
469 StyleMethodGuard
aGuard( *m_pData
);
470 lcl_setStyleColor( *m_pData
, &StyleSettings::SetHelpColor
, _helpcolor
);
474 ::sal_Int32 SAL_CALL
WindowStyleSettings::getHelpTextColor() throw (RuntimeException
, std::exception
)
476 StyleMethodGuard
aGuard( *m_pData
);
477 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetHelpTextColor
);
481 void SAL_CALL
WindowStyleSettings::setHelpTextColor( ::sal_Int32 _helptextcolor
) throw (RuntimeException
, std::exception
)
483 StyleMethodGuard
aGuard( *m_pData
);
484 lcl_setStyleColor( *m_pData
, &StyleSettings::SetHelpTextColor
, _helptextcolor
);
488 ::sal_Int32 SAL_CALL
WindowStyleSettings::getHighlightColor() throw (RuntimeException
, std::exception
)
490 StyleMethodGuard
aGuard( *m_pData
);
491 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetHighlightColor
);
495 void SAL_CALL
WindowStyleSettings::setHighlightColor( ::sal_Int32 _highlightcolor
) throw (RuntimeException
, std::exception
)
497 StyleMethodGuard
aGuard( *m_pData
);
498 lcl_setStyleColor( *m_pData
, &StyleSettings::SetHighlightColor
, _highlightcolor
);
502 ::sal_Int32 SAL_CALL
WindowStyleSettings::getHighlightTextColor() throw (RuntimeException
, std::exception
)
504 StyleMethodGuard
aGuard( *m_pData
);
505 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetHighlightTextColor
);
509 void SAL_CALL
WindowStyleSettings::setHighlightTextColor( ::sal_Int32 _highlighttextcolor
) throw (RuntimeException
, std::exception
)
511 StyleMethodGuard
aGuard( *m_pData
);
512 lcl_setStyleColor( *m_pData
, &StyleSettings::SetHighlightTextColor
, _highlighttextcolor
);
516 ::sal_Int32 SAL_CALL
WindowStyleSettings::getInactiveTabColor() throw (RuntimeException
, std::exception
)
518 StyleMethodGuard
aGuard( *m_pData
);
519 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetInactiveTabColor
);
523 void SAL_CALL
WindowStyleSettings::setInactiveTabColor( ::sal_Int32 _inactivetabcolor
) throw (RuntimeException
, std::exception
)
525 StyleMethodGuard
aGuard( *m_pData
);
526 lcl_setStyleColor( *m_pData
, &StyleSettings::SetInactiveTabColor
, _inactivetabcolor
);
530 ::sal_Int32 SAL_CALL
WindowStyleSettings::getInfoTextColor() throw (RuntimeException
, std::exception
)
532 StyleMethodGuard
aGuard( *m_pData
);
533 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetInfoTextColor
);
537 void SAL_CALL
WindowStyleSettings::setInfoTextColor( ::sal_Int32 _infotextcolor
) throw (RuntimeException
, std::exception
)
539 StyleMethodGuard
aGuard( *m_pData
);
540 lcl_setStyleColor( *m_pData
, &StyleSettings::SetInfoTextColor
, _infotextcolor
);
544 ::sal_Int32 SAL_CALL
WindowStyleSettings::getLabelTextColor() throw (RuntimeException
, std::exception
)
546 StyleMethodGuard
aGuard( *m_pData
);
547 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetLabelTextColor
);
551 void SAL_CALL
WindowStyleSettings::setLabelTextColor( ::sal_Int32 _labeltextcolor
) throw (RuntimeException
, std::exception
)
553 StyleMethodGuard
aGuard( *m_pData
);
554 lcl_setStyleColor( *m_pData
, &StyleSettings::SetLabelTextColor
, _labeltextcolor
);
558 ::sal_Int32 SAL_CALL
WindowStyleSettings::getLightColor() throw (RuntimeException
, std::exception
)
560 StyleMethodGuard
aGuard( *m_pData
);
561 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetLightColor
);
565 void SAL_CALL
WindowStyleSettings::setLightColor( ::sal_Int32 _lightcolor
) throw (RuntimeException
, std::exception
)
567 StyleMethodGuard
aGuard( *m_pData
);
568 lcl_setStyleColor( *m_pData
, &StyleSettings::SetLightColor
, _lightcolor
);
572 ::sal_Int32 SAL_CALL
WindowStyleSettings::getMenuBarColor() throw (RuntimeException
, std::exception
)
574 StyleMethodGuard
aGuard( *m_pData
);
575 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetMenuBarColor
);
579 void SAL_CALL
WindowStyleSettings::setMenuBarColor( ::sal_Int32 _menubarcolor
) throw (RuntimeException
, std::exception
)
581 StyleMethodGuard
aGuard( *m_pData
);
582 lcl_setStyleColor( *m_pData
, &StyleSettings::SetMenuBarColor
, _menubarcolor
);
586 ::sal_Int32 SAL_CALL
WindowStyleSettings::getMenuBarTextColor() throw (RuntimeException
, std::exception
)
588 StyleMethodGuard
aGuard( *m_pData
);
589 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetMenuBarTextColor
);
593 void SAL_CALL
WindowStyleSettings::setMenuBarTextColor( ::sal_Int32 _menubartextcolor
) throw (RuntimeException
, std::exception
)
595 StyleMethodGuard
aGuard( *m_pData
);
596 lcl_setStyleColor( *m_pData
, &StyleSettings::SetMenuBarTextColor
, _menubartextcolor
);
600 ::sal_Int32 SAL_CALL
WindowStyleSettings::getMenuBorderColor() throw (RuntimeException
, std::exception
)
602 StyleMethodGuard
aGuard( *m_pData
);
603 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetMenuBorderColor
);
607 void SAL_CALL
WindowStyleSettings::setMenuBorderColor( ::sal_Int32 _menubordercolor
) throw (RuntimeException
, std::exception
)
609 StyleMethodGuard
aGuard( *m_pData
);
610 lcl_setStyleColor( *m_pData
, &StyleSettings::SetMenuBorderColor
, _menubordercolor
);
614 ::sal_Int32 SAL_CALL
WindowStyleSettings::getMenuColor() throw (RuntimeException
, std::exception
)
616 StyleMethodGuard
aGuard( *m_pData
);
617 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetMenuColor
);
621 void SAL_CALL
WindowStyleSettings::setMenuColor( ::sal_Int32 _menucolor
) throw (RuntimeException
, std::exception
)
623 StyleMethodGuard
aGuard( *m_pData
);
624 lcl_setStyleColor( *m_pData
, &StyleSettings::SetMenuColor
, _menucolor
);
628 ::sal_Int32 SAL_CALL
WindowStyleSettings::getMenuHighlightColor() throw (RuntimeException
, std::exception
)
630 StyleMethodGuard
aGuard( *m_pData
);
631 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetMenuHighlightColor
);
635 void SAL_CALL
WindowStyleSettings::setMenuHighlightColor( ::sal_Int32 _menuhighlightcolor
) throw (RuntimeException
, std::exception
)
637 StyleMethodGuard
aGuard( *m_pData
);
638 lcl_setStyleColor( *m_pData
, &StyleSettings::SetMenuHighlightColor
, _menuhighlightcolor
);
642 ::sal_Int32 SAL_CALL
WindowStyleSettings::getMenuHighlightTextColor() throw (RuntimeException
, std::exception
)
644 StyleMethodGuard
aGuard( *m_pData
);
645 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetMenuHighlightTextColor
);
649 void SAL_CALL
WindowStyleSettings::setMenuHighlightTextColor( ::sal_Int32 _menuhighlighttextcolor
) throw (RuntimeException
, std::exception
)
651 StyleMethodGuard
aGuard( *m_pData
);
652 lcl_setStyleColor( *m_pData
, &StyleSettings::SetMenuHighlightTextColor
, _menuhighlighttextcolor
);
656 ::sal_Int32 SAL_CALL
WindowStyleSettings::getMenuTextColor() throw (RuntimeException
, std::exception
)
658 StyleMethodGuard
aGuard( *m_pData
);
659 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetMenuTextColor
);
663 void SAL_CALL
WindowStyleSettings::setMenuTextColor( ::sal_Int32 _menutextcolor
) throw (RuntimeException
, std::exception
)
665 StyleMethodGuard
aGuard( *m_pData
);
666 lcl_setStyleColor( *m_pData
, &StyleSettings::SetMenuTextColor
, _menutextcolor
);
670 ::sal_Int32 SAL_CALL
WindowStyleSettings::getMonoColor() throw (RuntimeException
, std::exception
)
672 StyleMethodGuard
aGuard( *m_pData
);
673 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetMonoColor
);
677 void SAL_CALL
WindowStyleSettings::setMonoColor( ::sal_Int32 _monocolor
) throw (RuntimeException
, std::exception
)
679 StyleMethodGuard
aGuard( *m_pData
);
680 lcl_setStyleColor( *m_pData
, &StyleSettings::SetMonoColor
, _monocolor
);
684 ::sal_Int32 SAL_CALL
WindowStyleSettings::getRadioCheckTextColor() throw (RuntimeException
, std::exception
)
686 StyleMethodGuard
aGuard( *m_pData
);
687 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetRadioCheckTextColor
);
691 void SAL_CALL
WindowStyleSettings::setRadioCheckTextColor( ::sal_Int32 _radiochecktextcolor
) throw (RuntimeException
, std::exception
)
693 StyleMethodGuard
aGuard( *m_pData
);
694 lcl_setStyleColor( *m_pData
, &StyleSettings::SetRadioCheckTextColor
, _radiochecktextcolor
);
698 ::sal_Int32 SAL_CALL
WindowStyleSettings::getSeparatorColor() throw (RuntimeException
, std::exception
)
700 StyleMethodGuard
aGuard( *m_pData
);
701 const vcl::Window
* pWindow
= m_pData
->pOwningWindow
->GetWindow();
702 const AllSettings aAllSettings
= pWindow
->GetSettings();
703 const StyleSettings aStyleSettings
= aAllSettings
.GetStyleSettings();
704 return aStyleSettings
.GetSeparatorColor().GetColor();
708 ::sal_Int32 SAL_CALL
WindowStyleSettings::getShadowColor() throw (RuntimeException
, std::exception
)
710 StyleMethodGuard
aGuard( *m_pData
);
711 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetShadowColor
);
715 void SAL_CALL
WindowStyleSettings::setShadowColor( ::sal_Int32 _shadowcolor
) throw (RuntimeException
, std::exception
)
717 StyleMethodGuard
aGuard( *m_pData
);
718 lcl_setStyleColor( *m_pData
, &StyleSettings::SetShadowColor
, _shadowcolor
);
722 ::sal_Int32 SAL_CALL
WindowStyleSettings::getWindowColor() throw (RuntimeException
, std::exception
)
724 StyleMethodGuard
aGuard( *m_pData
);
725 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetWindowColor
);
729 void SAL_CALL
WindowStyleSettings::setWindowColor( ::sal_Int32 _windowcolor
) throw (RuntimeException
, std::exception
)
731 StyleMethodGuard
aGuard( *m_pData
);
732 lcl_setStyleColor( *m_pData
, &StyleSettings::SetWindowColor
, _windowcolor
);
736 ::sal_Int32 SAL_CALL
WindowStyleSettings::getWindowTextColor() throw (RuntimeException
, std::exception
)
738 StyleMethodGuard
aGuard( *m_pData
);
739 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetWindowTextColor
);
743 void SAL_CALL
WindowStyleSettings::setWindowTextColor( ::sal_Int32 _windowtextcolor
) throw (RuntimeException
, std::exception
)
745 StyleMethodGuard
aGuard( *m_pData
);
746 lcl_setStyleColor( *m_pData
, &StyleSettings::SetWindowTextColor
, _windowtextcolor
);
750 ::sal_Int32 SAL_CALL
WindowStyleSettings::getWorkspaceColor() throw (RuntimeException
, std::exception
)
752 StyleMethodGuard
aGuard( *m_pData
);
753 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetWorkspaceColor
);
757 void SAL_CALL
WindowStyleSettings::setWorkspaceColor( ::sal_Int32 _workspacecolor
) throw (RuntimeException
, std::exception
)
759 StyleMethodGuard
aGuard( *m_pData
);
760 lcl_setStyleColor( *m_pData
, &StyleSettings::SetWorkspaceColor
, _workspacecolor
);
764 sal_Bool SAL_CALL
WindowStyleSettings::getHighContrastMode() throw (RuntimeException
, std::exception
)
766 StyleMethodGuard
aGuard( *m_pData
);
767 const vcl::Window
* pWindow
= m_pData
->pOwningWindow
->GetWindow();
768 const AllSettings aAllSettings
= pWindow
->GetSettings();
769 const StyleSettings aStyleSettings
= aAllSettings
.GetStyleSettings();
770 return aStyleSettings
.GetHighContrastMode();
774 void SAL_CALL
WindowStyleSettings::setHighContrastMode( sal_Bool _highcontrastmode
) throw (RuntimeException
, std::exception
)
776 StyleMethodGuard
aGuard( *m_pData
);
777 vcl::Window
* pWindow
= m_pData
->pOwningWindow
->GetWindow();
778 AllSettings aAllSettings
= pWindow
->GetSettings();
779 StyleSettings aStyleSettings
= aAllSettings
.GetStyleSettings();
780 aStyleSettings
.SetHighContrastMode( _highcontrastmode
);
781 aAllSettings
.SetStyleSettings( aStyleSettings
);
782 pWindow
->SetSettings( aAllSettings
);
786 FontDescriptor SAL_CALL
WindowStyleSettings::getApplicationFont() throw (RuntimeException
, std::exception
)
788 StyleMethodGuard
aGuard( *m_pData
);
789 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetAppFont
);
793 void SAL_CALL
WindowStyleSettings::setApplicationFont( const FontDescriptor
& _applicationfont
) throw (RuntimeException
, std::exception
)
795 StyleMethodGuard
aGuard( *m_pData
);
796 lcl_setStyleFont( *m_pData
, &StyleSettings::SetAppFont
, &StyleSettings::GetAppFont
, _applicationfont
);
800 FontDescriptor SAL_CALL
WindowStyleSettings::getHelpFont() throw (RuntimeException
, std::exception
)
802 StyleMethodGuard
aGuard( *m_pData
);
803 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetHelpFont
);
807 void SAL_CALL
WindowStyleSettings::setHelpFont( const FontDescriptor
& _helpfont
) throw (RuntimeException
, std::exception
)
809 StyleMethodGuard
aGuard( *m_pData
);
810 lcl_setStyleFont( *m_pData
, &StyleSettings::SetHelpFont
, &StyleSettings::GetHelpFont
, _helpfont
);
814 FontDescriptor SAL_CALL
WindowStyleSettings::getTitleFont() throw (RuntimeException
, std::exception
)
816 StyleMethodGuard
aGuard( *m_pData
);
817 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetTitleFont
);
821 void SAL_CALL
WindowStyleSettings::setTitleFont( const FontDescriptor
& _titlefont
) throw (RuntimeException
, std::exception
)
823 StyleMethodGuard
aGuard( *m_pData
);
824 lcl_setStyleFont( *m_pData
, &StyleSettings::SetTitleFont
, &StyleSettings::GetTitleFont
, _titlefont
);
828 FontDescriptor SAL_CALL
WindowStyleSettings::getFloatTitleFont() throw (RuntimeException
, std::exception
)
830 StyleMethodGuard
aGuard( *m_pData
);
831 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetFloatTitleFont
);
835 void SAL_CALL
WindowStyleSettings::setFloatTitleFont( const FontDescriptor
& _floattitlefont
) throw (RuntimeException
, std::exception
)
837 StyleMethodGuard
aGuard( *m_pData
);
838 lcl_setStyleFont( *m_pData
, &StyleSettings::SetFloatTitleFont
, &StyleSettings::GetFloatTitleFont
, _floattitlefont
);
842 FontDescriptor SAL_CALL
WindowStyleSettings::getMenuFont() throw (RuntimeException
, std::exception
)
844 StyleMethodGuard
aGuard( *m_pData
);
845 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetMenuFont
);
849 void SAL_CALL
WindowStyleSettings::setMenuFont( const FontDescriptor
& _menufont
) throw (RuntimeException
, std::exception
)
851 StyleMethodGuard
aGuard( *m_pData
);
852 lcl_setStyleFont( *m_pData
, &StyleSettings::SetMenuFont
, &StyleSettings::GetMenuFont
, _menufont
);
856 FontDescriptor SAL_CALL
WindowStyleSettings::getToolFont() throw (RuntimeException
, std::exception
)
858 StyleMethodGuard
aGuard( *m_pData
);
859 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetToolFont
);
863 void SAL_CALL
WindowStyleSettings::setToolFont( const FontDescriptor
& _toolfont
) throw (RuntimeException
, std::exception
)
865 StyleMethodGuard
aGuard( *m_pData
);
866 lcl_setStyleFont( *m_pData
, &StyleSettings::SetToolFont
, &StyleSettings::GetToolFont
, _toolfont
);
870 FontDescriptor SAL_CALL
WindowStyleSettings::getGroupFont() throw (RuntimeException
, std::exception
)
872 StyleMethodGuard
aGuard( *m_pData
);
873 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetGroupFont
);
877 void SAL_CALL
WindowStyleSettings::setGroupFont( const FontDescriptor
& _groupfont
) throw (RuntimeException
, std::exception
)
879 StyleMethodGuard
aGuard( *m_pData
);
880 lcl_setStyleFont( *m_pData
, &StyleSettings::SetGroupFont
, &StyleSettings::GetGroupFont
, _groupfont
);
884 FontDescriptor SAL_CALL
WindowStyleSettings::getLabelFont() throw (RuntimeException
, std::exception
)
886 StyleMethodGuard
aGuard( *m_pData
);
887 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetLabelFont
);
891 void SAL_CALL
WindowStyleSettings::setLabelFont( const FontDescriptor
& _labelfont
) throw (RuntimeException
, std::exception
)
893 StyleMethodGuard
aGuard( *m_pData
);
894 lcl_setStyleFont( *m_pData
, &StyleSettings::SetLabelFont
, &StyleSettings::GetLabelFont
, _labelfont
);
898 FontDescriptor SAL_CALL
WindowStyleSettings::getInfoFont() throw (RuntimeException
, std::exception
)
900 StyleMethodGuard
aGuard( *m_pData
);
901 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetInfoFont
);
905 void SAL_CALL
WindowStyleSettings::setInfoFont( const FontDescriptor
& _infofont
) throw (RuntimeException
, std::exception
)
907 StyleMethodGuard
aGuard( *m_pData
);
908 lcl_setStyleFont( *m_pData
, &StyleSettings::SetInfoFont
, &StyleSettings::GetInfoFont
, _infofont
);
912 FontDescriptor SAL_CALL
WindowStyleSettings::getRadioCheckFont() throw (RuntimeException
, std::exception
)
914 StyleMethodGuard
aGuard( *m_pData
);
915 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetRadioCheckFont
);
919 void SAL_CALL
WindowStyleSettings::setRadioCheckFont( const FontDescriptor
& _radiocheckfont
) throw (RuntimeException
, std::exception
)
921 StyleMethodGuard
aGuard( *m_pData
);
922 lcl_setStyleFont( *m_pData
, &StyleSettings::SetRadioCheckFont
, &StyleSettings::GetRadioCheckFont
, _radiocheckfont
);
926 FontDescriptor SAL_CALL
WindowStyleSettings::getPushButtonFont() throw (RuntimeException
, std::exception
)
928 StyleMethodGuard
aGuard( *m_pData
);
929 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetPushButtonFont
);
933 void SAL_CALL
WindowStyleSettings::setPushButtonFont( const FontDescriptor
& _pushbuttonfont
) throw (RuntimeException
, std::exception
)
935 StyleMethodGuard
aGuard( *m_pData
);
936 lcl_setStyleFont( *m_pData
, &StyleSettings::SetPushButtonFont
, &StyleSettings::GetPushButtonFont
, _pushbuttonfont
);
940 FontDescriptor SAL_CALL
WindowStyleSettings::getFieldFont() throw (RuntimeException
, std::exception
)
942 StyleMethodGuard
aGuard( *m_pData
);
943 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetFieldFont
);
947 void SAL_CALL
WindowStyleSettings::setFieldFont( const FontDescriptor
& _fieldfont
) throw (RuntimeException
, std::exception
)
949 StyleMethodGuard
aGuard( *m_pData
);
950 lcl_setStyleFont( *m_pData
, &StyleSettings::SetFieldFont
, &StyleSettings::GetFieldFont
, _fieldfont
);
954 void SAL_CALL
WindowStyleSettings::addStyleChangeListener( const Reference
< XStyleChangeListener
>& i_rListener
) throw (RuntimeException
, std::exception
)
956 StyleMethodGuard
aGuard( *m_pData
);
957 if ( i_rListener
.is() )
958 m_pData
->aStyleChangeListeners
.addInterface( i_rListener
);
962 void SAL_CALL
WindowStyleSettings::removeStyleChangeListener( const Reference
< XStyleChangeListener
>& i_rListener
) throw (RuntimeException
, std::exception
)
964 StyleMethodGuard
aGuard( *m_pData
);
965 if ( i_rListener
.is() )
966 m_pData
->aStyleChangeListeners
.removeInterface( i_rListener
);
970 } // namespace toolkit
973 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */