cURL: follow redirects
[LibreOffice.git] / toolkit / source / awt / stylesettings.cxx
blob86ab25ce80bb170163d1cd023086fc1f8a8df887
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
34 namespace toolkit
38 using ::com::sun::star::uno::Reference;
39 using ::com::sun::star::uno::RuntimeException;
40 using ::com::sun::star::lang::DisposedException;
41 using ::com::sun::star::lang::EventObject;
42 using ::com::sun::star::awt::FontDescriptor;
43 using ::com::sun::star::awt::XStyleChangeListener;
46 //= WindowStyleSettings_Data
48 struct WindowStyleSettings_Data
50 VCLXWindow* pOwningWindow;
51 ::comphelper::OInterfaceContainerHelper2 aStyleChangeListeners;
53 WindowStyleSettings_Data( ::osl::Mutex& i_rListenerMutex, VCLXWindow& i_rOwningWindow )
54 : pOwningWindow( &i_rOwningWindow )
55 ,aStyleChangeListeners( i_rListenerMutex )
59 DECL_LINK( OnWindowEvent, VclWindowEvent&, void );
63 IMPL_LINK( WindowStyleSettings_Data, OnWindowEvent, VclWindowEvent&, rEvent, void )
65 if ( rEvent.GetId() != VCLEVENT_WINDOW_DATACHANGED )
66 return;
67 const DataChangedEvent* pDataChangedEvent = static_cast< const DataChangedEvent* >( rEvent.GetData() );
68 if ( !pDataChangedEvent || ( pDataChangedEvent->GetType() != DataChangedEventType::SETTINGS ) )
69 return;
70 if ( !( pDataChangedEvent->GetFlags() & AllSettingsFlags::STYLE ) )
71 return;
73 EventObject aEvent( *pOwningWindow );
74 aStyleChangeListeners.notifyEach( &XStyleChangeListener::styleSettingsChanged, aEvent );
75 return;
79 //= StyleMethodGuard
81 class StyleMethodGuard
83 public:
84 explicit StyleMethodGuard( WindowStyleSettings_Data& i_rData )
86 if ( i_rData.pOwningWindow == nullptr )
87 throw DisposedException();
90 ~StyleMethodGuard()
94 private:
95 SolarMutexGuard m_aGuard;
99 //= WindowStyleSettings
102 WindowStyleSettings::WindowStyleSettings(::osl::Mutex& i_rListenerMutex, VCLXWindow& i_rOwningWindow )
103 :m_pData( new WindowStyleSettings_Data(i_rListenerMutex, i_rOwningWindow ) )
105 VclPtr<vcl::Window> pWindow = i_rOwningWindow.GetWindow();
106 if ( !pWindow )
107 throw RuntimeException();
108 pWindow->AddEventListener( LINK( m_pData.get(), WindowStyleSettings_Data, OnWindowEvent ) );
112 WindowStyleSettings::~WindowStyleSettings()
117 void WindowStyleSettings::dispose()
119 StyleMethodGuard aGuard( *m_pData );
121 VclPtr<vcl::Window> pWindow = m_pData->pOwningWindow->GetWindow();
122 OSL_ENSURE( pWindow, "WindowStyleSettings::dispose: window has been reset before we could revoke the listener!" );
123 if ( pWindow )
124 pWindow->RemoveEventListener( LINK( m_pData.get(), WindowStyleSettings_Data, OnWindowEvent ) );
126 EventObject aEvent( *this );
127 m_pData->aStyleChangeListeners.disposeAndClear( aEvent );
129 m_pData->pOwningWindow = nullptr;
133 namespace
135 sal_Int32 lcl_getStyleColor( WindowStyleSettings_Data& i_rData, Color const & (StyleSettings::*i_pGetter)() const )
137 const VclPtr<vcl::Window>& pWindow = i_rData.pOwningWindow->GetWindow();
138 const AllSettings aAllSettings = pWindow->GetSettings();
139 const StyleSettings& aStyleSettings = aAllSettings.GetStyleSettings();
140 return (aStyleSettings.*i_pGetter)().GetColor();
143 void lcl_setStyleColor( WindowStyleSettings_Data& i_rData, void (StyleSettings::*i_pSetter)( Color const & ), const sal_Int32 i_nColor )
145 VclPtr<vcl::Window> pWindow = i_rData.pOwningWindow->GetWindow();
146 AllSettings aAllSettings = pWindow->GetSettings();
147 StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
148 (aStyleSettings.*i_pSetter)( Color( i_nColor ) );
149 aAllSettings.SetStyleSettings( aStyleSettings );
150 pWindow->SetSettings( aAllSettings );
153 FontDescriptor lcl_getStyleFont( WindowStyleSettings_Data& i_rData, vcl::Font const & (StyleSettings::*i_pGetter)() const )
155 const VclPtr<vcl::Window>& pWindow = i_rData.pOwningWindow->GetWindow();
156 const AllSettings aAllSettings = pWindow->GetSettings();
157 const StyleSettings& aStyleSettings = aAllSettings.GetStyleSettings();
158 return VCLUnoHelper::CreateFontDescriptor( (aStyleSettings.*i_pGetter)() );
161 void lcl_setStyleFont( WindowStyleSettings_Data& i_rData, void (StyleSettings::*i_pSetter)( vcl::Font const &),
162 vcl::Font const & (StyleSettings::*i_pGetter)() const, const FontDescriptor& i_rFont )
164 VclPtr<vcl::Window> pWindow = i_rData.pOwningWindow->GetWindow();
165 AllSettings aAllSettings = pWindow->GetSettings();
166 StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
167 const vcl::Font aNewFont = VCLUnoHelper::CreateFont( i_rFont, (aStyleSettings.*i_pGetter)() );
168 (aStyleSettings.*i_pSetter)( aNewFont );
169 aAllSettings.SetStyleSettings( aStyleSettings );
170 pWindow->SetSettings( aAllSettings );
175 ::sal_Int32 SAL_CALL WindowStyleSettings::getActiveBorderColor() throw (RuntimeException, std::exception)
177 StyleMethodGuard aGuard( *m_pData );
178 return lcl_getStyleColor( *m_pData, &StyleSettings::GetActiveBorderColor );
182 void SAL_CALL WindowStyleSettings::setActiveBorderColor( ::sal_Int32 _activebordercolor ) throw (RuntimeException, std::exception)
184 StyleMethodGuard aGuard( *m_pData );
185 lcl_setStyleColor( *m_pData, &StyleSettings::SetActiveBorderColor, _activebordercolor );
189 ::sal_Int32 SAL_CALL WindowStyleSettings::getActiveColor() throw (RuntimeException, std::exception)
191 StyleMethodGuard aGuard( *m_pData );
192 return lcl_getStyleColor( *m_pData, &StyleSettings::GetActiveColor );
196 void SAL_CALL WindowStyleSettings::setActiveColor( ::sal_Int32 _activecolor ) throw (RuntimeException, std::exception)
198 StyleMethodGuard aGuard( *m_pData );
199 lcl_setStyleColor( *m_pData, &StyleSettings::SetActiveColor, _activecolor );
203 ::sal_Int32 SAL_CALL WindowStyleSettings::getActiveTabColor() throw (RuntimeException, std::exception)
205 StyleMethodGuard aGuard( *m_pData );
206 return lcl_getStyleColor( *m_pData, &StyleSettings::GetActiveTabColor );
210 void SAL_CALL WindowStyleSettings::setActiveTabColor( ::sal_Int32 _activetabcolor ) throw (RuntimeException, std::exception)
212 StyleMethodGuard aGuard( *m_pData );
213 lcl_setStyleColor( *m_pData, &StyleSettings::SetActiveTabColor, _activetabcolor );
217 ::sal_Int32 SAL_CALL WindowStyleSettings::getActiveTextColor() throw (RuntimeException, std::exception)
219 StyleMethodGuard aGuard( *m_pData );
220 return lcl_getStyleColor( *m_pData, &StyleSettings::GetActiveTextColor );
224 void SAL_CALL WindowStyleSettings::setActiveTextColor( ::sal_Int32 _activetextcolor ) throw (RuntimeException, std::exception)
226 StyleMethodGuard aGuard( *m_pData );
227 lcl_setStyleColor( *m_pData, &StyleSettings::SetActiveTextColor, _activetextcolor );
231 ::sal_Int32 SAL_CALL WindowStyleSettings::getButtonRolloverTextColor() throw (RuntimeException, std::exception)
233 StyleMethodGuard aGuard( *m_pData );
234 return lcl_getStyleColor( *m_pData, &StyleSettings::GetButtonRolloverTextColor );
238 void SAL_CALL WindowStyleSettings::setButtonRolloverTextColor( ::sal_Int32 _buttonrollovertextcolor ) throw (RuntimeException, std::exception)
240 StyleMethodGuard aGuard( *m_pData );
241 lcl_setStyleColor( *m_pData, &StyleSettings::SetButtonRolloverTextColor, _buttonrollovertextcolor );
245 ::sal_Int32 SAL_CALL WindowStyleSettings::getButtonTextColor() throw (RuntimeException, std::exception)
247 StyleMethodGuard aGuard( *m_pData );
248 return lcl_getStyleColor( *m_pData, &StyleSettings::GetButtonTextColor );
252 void SAL_CALL WindowStyleSettings::setButtonTextColor( ::sal_Int32 _buttontextcolor ) throw (RuntimeException, std::exception)
254 StyleMethodGuard aGuard( *m_pData );
255 lcl_setStyleColor( *m_pData, &StyleSettings::SetButtonTextColor, _buttontextcolor );
259 ::sal_Int32 SAL_CALL WindowStyleSettings::getCheckedColor() throw (RuntimeException, std::exception)
261 StyleMethodGuard aGuard( *m_pData );
262 return lcl_getStyleColor( *m_pData, &StyleSettings::GetCheckedColor );
266 void SAL_CALL WindowStyleSettings::setCheckedColor( ::sal_Int32 _checkedcolor ) throw (RuntimeException, std::exception)
268 StyleMethodGuard aGuard( *m_pData );
269 lcl_setStyleColor( *m_pData, &StyleSettings::SetCheckedColor, _checkedcolor );
273 ::sal_Int32 SAL_CALL WindowStyleSettings::getDarkShadowColor() throw (RuntimeException, std::exception)
275 StyleMethodGuard aGuard( *m_pData );
276 return lcl_getStyleColor( *m_pData, &StyleSettings::GetDarkShadowColor );
280 void SAL_CALL WindowStyleSettings::setDarkShadowColor( ::sal_Int32 _darkshadowcolor ) throw (RuntimeException, std::exception)
282 StyleMethodGuard aGuard( *m_pData );
283 lcl_setStyleColor( *m_pData, &StyleSettings::SetDarkShadowColor, _darkshadowcolor );
287 ::sal_Int32 SAL_CALL WindowStyleSettings::getDeactiveBorderColor() throw (RuntimeException, std::exception)
289 StyleMethodGuard aGuard( *m_pData );
290 return lcl_getStyleColor( *m_pData, &StyleSettings::GetDeactiveBorderColor );
294 void SAL_CALL WindowStyleSettings::setDeactiveBorderColor( ::sal_Int32 _deactivebordercolor ) throw (RuntimeException, std::exception)
296 StyleMethodGuard aGuard( *m_pData );
297 lcl_setStyleColor( *m_pData, &StyleSettings::SetDeactiveBorderColor, _deactivebordercolor );
301 ::sal_Int32 SAL_CALL WindowStyleSettings::getDeactiveColor() throw (RuntimeException, std::exception)
303 StyleMethodGuard aGuard( *m_pData );
304 return lcl_getStyleColor( *m_pData, &StyleSettings::GetDeactiveColor );
308 void SAL_CALL WindowStyleSettings::setDeactiveColor( ::sal_Int32 _deactivecolor ) throw (RuntimeException, std::exception)
310 StyleMethodGuard aGuard( *m_pData );
311 lcl_setStyleColor( *m_pData, &StyleSettings::SetDeactiveColor, _deactivecolor );
315 ::sal_Int32 SAL_CALL WindowStyleSettings::getDeactiveTextColor() throw (RuntimeException, std::exception)
317 StyleMethodGuard aGuard( *m_pData );
318 return lcl_getStyleColor( *m_pData, &StyleSettings::GetDeactiveTextColor );
322 void SAL_CALL WindowStyleSettings::setDeactiveTextColor( ::sal_Int32 _deactivetextcolor ) throw (RuntimeException, std::exception)
324 StyleMethodGuard aGuard( *m_pData );
325 lcl_setStyleColor( *m_pData, &StyleSettings::SetDeactiveTextColor, _deactivetextcolor );
329 ::sal_Int32 SAL_CALL WindowStyleSettings::getDialogColor() throw (RuntimeException, std::exception)
331 StyleMethodGuard aGuard( *m_pData );
332 return lcl_getStyleColor( *m_pData, &StyleSettings::GetDialogColor );
336 void SAL_CALL WindowStyleSettings::setDialogColor( ::sal_Int32 _dialogcolor ) throw (RuntimeException, std::exception)
338 StyleMethodGuard aGuard( *m_pData );
339 lcl_setStyleColor( *m_pData, &StyleSettings::SetDialogColor, _dialogcolor );
343 ::sal_Int32 SAL_CALL WindowStyleSettings::getDialogTextColor() throw (RuntimeException, std::exception)
345 StyleMethodGuard aGuard( *m_pData );
346 return lcl_getStyleColor( *m_pData, &StyleSettings::GetDialogTextColor );
350 void SAL_CALL WindowStyleSettings::setDialogTextColor( ::sal_Int32 _dialogtextcolor ) throw (RuntimeException, std::exception)
352 StyleMethodGuard aGuard( *m_pData );
353 lcl_setStyleColor( *m_pData, &StyleSettings::SetDialogTextColor, _dialogtextcolor );
357 ::sal_Int32 SAL_CALL WindowStyleSettings::getDisableColor() throw (RuntimeException, std::exception)
359 StyleMethodGuard aGuard( *m_pData );
360 return lcl_getStyleColor( *m_pData, &StyleSettings::GetDisableColor );
364 void SAL_CALL WindowStyleSettings::setDisableColor( ::sal_Int32 _disablecolor ) throw (RuntimeException, std::exception)
366 StyleMethodGuard aGuard( *m_pData );
367 lcl_setStyleColor( *m_pData, &StyleSettings::SetDisableColor, _disablecolor );
371 ::sal_Int32 SAL_CALL WindowStyleSettings::getFaceColor() throw (RuntimeException, std::exception)
373 StyleMethodGuard aGuard( *m_pData );
374 return lcl_getStyleColor( *m_pData, &StyleSettings::GetFaceColor );
378 void SAL_CALL WindowStyleSettings::setFaceColor( ::sal_Int32 _facecolor ) throw (RuntimeException, std::exception)
380 StyleMethodGuard aGuard( *m_pData );
381 lcl_setStyleColor( *m_pData, &StyleSettings::SetFaceColor, _facecolor );
385 ::sal_Int32 SAL_CALL WindowStyleSettings::getFaceGradientColor() throw (RuntimeException, std::exception)
387 StyleMethodGuard aGuard( *m_pData );
388 const VclPtr<vcl::Window>& pWindow = m_pData->pOwningWindow->GetWindow();
389 const AllSettings aAllSettings = pWindow->GetSettings();
390 const StyleSettings& aStyleSettings = aAllSettings.GetStyleSettings();
391 return aStyleSettings.GetFaceGradientColor().GetColor();
395 ::sal_Int32 SAL_CALL WindowStyleSettings::getFieldColor() throw (RuntimeException, std::exception)
397 StyleMethodGuard aGuard( *m_pData );
398 return lcl_getStyleColor( *m_pData, &StyleSettings::GetFieldColor );
402 void SAL_CALL WindowStyleSettings::setFieldColor( ::sal_Int32 _fieldcolor ) throw (RuntimeException, std::exception)
404 StyleMethodGuard aGuard( *m_pData );
405 lcl_setStyleColor( *m_pData, &StyleSettings::SetFieldColor, _fieldcolor );
409 ::sal_Int32 SAL_CALL WindowStyleSettings::getFieldRolloverTextColor() throw (RuntimeException, std::exception)
411 StyleMethodGuard aGuard( *m_pData );
412 return lcl_getStyleColor( *m_pData, &StyleSettings::GetFieldRolloverTextColor );
416 void SAL_CALL WindowStyleSettings::setFieldRolloverTextColor( ::sal_Int32 _fieldrollovertextcolor ) throw (RuntimeException, std::exception)
418 StyleMethodGuard aGuard( *m_pData );
419 lcl_setStyleColor( *m_pData, &StyleSettings::SetFieldRolloverTextColor, _fieldrollovertextcolor );
423 ::sal_Int32 SAL_CALL WindowStyleSettings::getFieldTextColor() throw (RuntimeException, std::exception)
425 StyleMethodGuard aGuard( *m_pData );
426 return lcl_getStyleColor( *m_pData, &StyleSettings::GetFieldTextColor );
430 void SAL_CALL WindowStyleSettings::setFieldTextColor( ::sal_Int32 _fieldtextcolor ) throw (RuntimeException, std::exception)
432 StyleMethodGuard aGuard( *m_pData );
433 lcl_setStyleColor( *m_pData, &StyleSettings::SetFieldTextColor, _fieldtextcolor );
437 ::sal_Int32 SAL_CALL WindowStyleSettings::getGroupTextColor() throw (RuntimeException, std::exception)
439 StyleMethodGuard aGuard( *m_pData );
440 return lcl_getStyleColor( *m_pData, &StyleSettings::GetGroupTextColor );
444 void SAL_CALL WindowStyleSettings::setGroupTextColor( ::sal_Int32 _grouptextcolor ) throw (RuntimeException, std::exception)
446 StyleMethodGuard aGuard( *m_pData );
447 lcl_setStyleColor( *m_pData, &StyleSettings::SetGroupTextColor, _grouptextcolor );
451 ::sal_Int32 SAL_CALL WindowStyleSettings::getHelpColor() throw (RuntimeException, std::exception)
453 StyleMethodGuard aGuard( *m_pData );
454 return lcl_getStyleColor( *m_pData, &StyleSettings::GetHelpColor );
458 void SAL_CALL WindowStyleSettings::setHelpColor( ::sal_Int32 _helpcolor ) throw (RuntimeException, std::exception)
460 StyleMethodGuard aGuard( *m_pData );
461 lcl_setStyleColor( *m_pData, &StyleSettings::SetHelpColor, _helpcolor );
465 ::sal_Int32 SAL_CALL WindowStyleSettings::getHelpTextColor() throw (RuntimeException, std::exception)
467 StyleMethodGuard aGuard( *m_pData );
468 return lcl_getStyleColor( *m_pData, &StyleSettings::GetHelpTextColor );
472 void SAL_CALL WindowStyleSettings::setHelpTextColor( ::sal_Int32 _helptextcolor ) throw (RuntimeException, std::exception)
474 StyleMethodGuard aGuard( *m_pData );
475 lcl_setStyleColor( *m_pData, &StyleSettings::SetHelpTextColor, _helptextcolor );
479 ::sal_Int32 SAL_CALL WindowStyleSettings::getHighlightColor() throw (RuntimeException, std::exception)
481 StyleMethodGuard aGuard( *m_pData );
482 return lcl_getStyleColor( *m_pData, &StyleSettings::GetHighlightColor );
486 void SAL_CALL WindowStyleSettings::setHighlightColor( ::sal_Int32 _highlightcolor ) throw (RuntimeException, std::exception)
488 StyleMethodGuard aGuard( *m_pData );
489 lcl_setStyleColor( *m_pData, &StyleSettings::SetHighlightColor, _highlightcolor );
493 ::sal_Int32 SAL_CALL WindowStyleSettings::getHighlightTextColor() throw (RuntimeException, std::exception)
495 StyleMethodGuard aGuard( *m_pData );
496 return lcl_getStyleColor( *m_pData, &StyleSettings::GetHighlightTextColor );
500 void SAL_CALL WindowStyleSettings::setHighlightTextColor( ::sal_Int32 _highlighttextcolor ) throw (RuntimeException, std::exception)
502 StyleMethodGuard aGuard( *m_pData );
503 lcl_setStyleColor( *m_pData, &StyleSettings::SetHighlightTextColor, _highlighttextcolor );
507 ::sal_Int32 SAL_CALL WindowStyleSettings::getInactiveTabColor() throw (RuntimeException, std::exception)
509 StyleMethodGuard aGuard( *m_pData );
510 return lcl_getStyleColor( *m_pData, &StyleSettings::GetInactiveTabColor );
514 void SAL_CALL WindowStyleSettings::setInactiveTabColor( ::sal_Int32 _inactivetabcolor ) throw (RuntimeException, std::exception)
516 StyleMethodGuard aGuard( *m_pData );
517 lcl_setStyleColor( *m_pData, &StyleSettings::SetInactiveTabColor, _inactivetabcolor );
521 ::sal_Int32 SAL_CALL WindowStyleSettings::getLabelTextColor() throw (RuntimeException, std::exception)
523 StyleMethodGuard aGuard( *m_pData );
524 return lcl_getStyleColor( *m_pData, &StyleSettings::GetLabelTextColor );
528 void SAL_CALL WindowStyleSettings::setLabelTextColor( ::sal_Int32 _labeltextcolor ) throw (RuntimeException, std::exception)
530 StyleMethodGuard aGuard( *m_pData );
531 lcl_setStyleColor( *m_pData, &StyleSettings::SetLabelTextColor, _labeltextcolor );
535 ::sal_Int32 SAL_CALL WindowStyleSettings::getLightColor() throw (RuntimeException, std::exception)
537 StyleMethodGuard aGuard( *m_pData );
538 return lcl_getStyleColor( *m_pData, &StyleSettings::GetLightColor );
542 void SAL_CALL WindowStyleSettings::setLightColor( ::sal_Int32 _lightcolor ) throw (RuntimeException, std::exception)
544 StyleMethodGuard aGuard( *m_pData );
545 lcl_setStyleColor( *m_pData, &StyleSettings::SetLightColor, _lightcolor );
549 ::sal_Int32 SAL_CALL WindowStyleSettings::getMenuBarColor() throw (RuntimeException, std::exception)
551 StyleMethodGuard aGuard( *m_pData );
552 return lcl_getStyleColor( *m_pData, &StyleSettings::GetMenuBarColor );
556 void SAL_CALL WindowStyleSettings::setMenuBarColor( ::sal_Int32 _menubarcolor ) throw (RuntimeException, std::exception)
558 StyleMethodGuard aGuard( *m_pData );
559 lcl_setStyleColor( *m_pData, &StyleSettings::SetMenuBarColor, _menubarcolor );
563 ::sal_Int32 SAL_CALL WindowStyleSettings::getMenuBarTextColor() throw (RuntimeException, std::exception)
565 StyleMethodGuard aGuard( *m_pData );
566 return lcl_getStyleColor( *m_pData, &StyleSettings::GetMenuBarTextColor );
570 void SAL_CALL WindowStyleSettings::setMenuBarTextColor( ::sal_Int32 _menubartextcolor ) throw (RuntimeException, std::exception)
572 StyleMethodGuard aGuard( *m_pData );
573 lcl_setStyleColor( *m_pData, &StyleSettings::SetMenuBarTextColor, _menubartextcolor );
577 ::sal_Int32 SAL_CALL WindowStyleSettings::getMenuBorderColor() throw (RuntimeException, std::exception)
579 StyleMethodGuard aGuard( *m_pData );
580 return lcl_getStyleColor( *m_pData, &StyleSettings::GetMenuBorderColor );
584 void SAL_CALL WindowStyleSettings::setMenuBorderColor( ::sal_Int32 _menubordercolor ) throw (RuntimeException, std::exception)
586 StyleMethodGuard aGuard( *m_pData );
587 lcl_setStyleColor( *m_pData, &StyleSettings::SetMenuBorderColor, _menubordercolor );
591 ::sal_Int32 SAL_CALL WindowStyleSettings::getMenuColor() throw (RuntimeException, std::exception)
593 StyleMethodGuard aGuard( *m_pData );
594 return lcl_getStyleColor( *m_pData, &StyleSettings::GetMenuColor );
598 void SAL_CALL WindowStyleSettings::setMenuColor( ::sal_Int32 _menucolor ) throw (RuntimeException, std::exception)
600 StyleMethodGuard aGuard( *m_pData );
601 lcl_setStyleColor( *m_pData, &StyleSettings::SetMenuColor, _menucolor );
605 ::sal_Int32 SAL_CALL WindowStyleSettings::getMenuHighlightColor() throw (RuntimeException, std::exception)
607 StyleMethodGuard aGuard( *m_pData );
608 return lcl_getStyleColor( *m_pData, &StyleSettings::GetMenuHighlightColor );
612 void SAL_CALL WindowStyleSettings::setMenuHighlightColor( ::sal_Int32 _menuhighlightcolor ) throw (RuntimeException, std::exception)
614 StyleMethodGuard aGuard( *m_pData );
615 lcl_setStyleColor( *m_pData, &StyleSettings::SetMenuHighlightColor, _menuhighlightcolor );
619 ::sal_Int32 SAL_CALL WindowStyleSettings::getMenuHighlightTextColor() throw (RuntimeException, std::exception)
621 StyleMethodGuard aGuard( *m_pData );
622 return lcl_getStyleColor( *m_pData, &StyleSettings::GetMenuHighlightTextColor );
626 void SAL_CALL WindowStyleSettings::setMenuHighlightTextColor( ::sal_Int32 _menuhighlighttextcolor ) throw (RuntimeException, std::exception)
628 StyleMethodGuard aGuard( *m_pData );
629 lcl_setStyleColor( *m_pData, &StyleSettings::SetMenuHighlightTextColor, _menuhighlighttextcolor );
633 ::sal_Int32 SAL_CALL WindowStyleSettings::getMenuTextColor() throw (RuntimeException, std::exception)
635 StyleMethodGuard aGuard( *m_pData );
636 return lcl_getStyleColor( *m_pData, &StyleSettings::GetMenuTextColor );
640 void SAL_CALL WindowStyleSettings::setMenuTextColor( ::sal_Int32 _menutextcolor ) throw (RuntimeException, std::exception)
642 StyleMethodGuard aGuard( *m_pData );
643 lcl_setStyleColor( *m_pData, &StyleSettings::SetMenuTextColor, _menutextcolor );
647 ::sal_Int32 SAL_CALL WindowStyleSettings::getMonoColor() throw (RuntimeException, std::exception)
649 StyleMethodGuard aGuard( *m_pData );
650 return lcl_getStyleColor( *m_pData, &StyleSettings::GetMonoColor );
654 void SAL_CALL WindowStyleSettings::setMonoColor( ::sal_Int32 _monocolor ) throw (RuntimeException, std::exception)
656 StyleMethodGuard aGuard( *m_pData );
657 lcl_setStyleColor( *m_pData, &StyleSettings::SetMonoColor, _monocolor );
661 ::sal_Int32 SAL_CALL WindowStyleSettings::getRadioCheckTextColor() throw (RuntimeException, std::exception)
663 StyleMethodGuard aGuard( *m_pData );
664 return lcl_getStyleColor( *m_pData, &StyleSettings::GetRadioCheckTextColor );
668 void SAL_CALL WindowStyleSettings::setRadioCheckTextColor( ::sal_Int32 _radiochecktextcolor ) throw (RuntimeException, std::exception)
670 StyleMethodGuard aGuard( *m_pData );
671 lcl_setStyleColor( *m_pData, &StyleSettings::SetRadioCheckTextColor, _radiochecktextcolor );
675 ::sal_Int32 SAL_CALL WindowStyleSettings::getSeparatorColor() throw (RuntimeException, std::exception)
677 StyleMethodGuard aGuard( *m_pData );
678 const VclPtr<vcl::Window>& pWindow = m_pData->pOwningWindow->GetWindow();
679 const AllSettings aAllSettings = pWindow->GetSettings();
680 const StyleSettings& aStyleSettings = aAllSettings.GetStyleSettings();
681 return aStyleSettings.GetSeparatorColor().GetColor();
685 ::sal_Int32 SAL_CALL WindowStyleSettings::getShadowColor() throw (RuntimeException, std::exception)
687 StyleMethodGuard aGuard( *m_pData );
688 return lcl_getStyleColor( *m_pData, &StyleSettings::GetShadowColor );
692 void SAL_CALL WindowStyleSettings::setShadowColor( ::sal_Int32 _shadowcolor ) throw (RuntimeException, std::exception)
694 StyleMethodGuard aGuard( *m_pData );
695 lcl_setStyleColor( *m_pData, &StyleSettings::SetShadowColor, _shadowcolor );
699 ::sal_Int32 SAL_CALL WindowStyleSettings::getWindowColor() throw (RuntimeException, std::exception)
701 StyleMethodGuard aGuard( *m_pData );
702 return lcl_getStyleColor( *m_pData, &StyleSettings::GetWindowColor );
706 void SAL_CALL WindowStyleSettings::setWindowColor( ::sal_Int32 _windowcolor ) throw (RuntimeException, std::exception)
708 StyleMethodGuard aGuard( *m_pData );
709 lcl_setStyleColor( *m_pData, &StyleSettings::SetWindowColor, _windowcolor );
713 ::sal_Int32 SAL_CALL WindowStyleSettings::getWindowTextColor() throw (RuntimeException, std::exception)
715 StyleMethodGuard aGuard( *m_pData );
716 return lcl_getStyleColor( *m_pData, &StyleSettings::GetWindowTextColor );
720 void SAL_CALL WindowStyleSettings::setWindowTextColor( ::sal_Int32 _windowtextcolor ) throw (RuntimeException, std::exception)
722 StyleMethodGuard aGuard( *m_pData );
723 lcl_setStyleColor( *m_pData, &StyleSettings::SetWindowTextColor, _windowtextcolor );
727 ::sal_Int32 SAL_CALL WindowStyleSettings::getWorkspaceColor() throw (RuntimeException, std::exception)
729 StyleMethodGuard aGuard( *m_pData );
730 return lcl_getStyleColor( *m_pData, &StyleSettings::GetWorkspaceColor );
734 void SAL_CALL WindowStyleSettings::setWorkspaceColor( ::sal_Int32 _workspacecolor ) throw (RuntimeException, std::exception)
736 StyleMethodGuard aGuard( *m_pData );
737 lcl_setStyleColor( *m_pData, &StyleSettings::SetWorkspaceColor, _workspacecolor );
741 sal_Bool SAL_CALL WindowStyleSettings::getHighContrastMode() throw (RuntimeException, std::exception)
743 StyleMethodGuard aGuard( *m_pData );
744 const VclPtr<vcl::Window>& pWindow = m_pData->pOwningWindow->GetWindow();
745 const AllSettings aAllSettings = pWindow->GetSettings();
746 const StyleSettings& aStyleSettings = aAllSettings.GetStyleSettings();
747 return aStyleSettings.GetHighContrastMode();
751 void SAL_CALL WindowStyleSettings::setHighContrastMode( sal_Bool _highcontrastmode ) throw (RuntimeException, std::exception)
753 StyleMethodGuard aGuard( *m_pData );
754 VclPtr<vcl::Window> pWindow = m_pData->pOwningWindow->GetWindow();
755 AllSettings aAllSettings = pWindow->GetSettings();
756 StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
757 aStyleSettings.SetHighContrastMode( _highcontrastmode );
758 aAllSettings.SetStyleSettings( aStyleSettings );
759 pWindow->SetSettings( aAllSettings );
763 FontDescriptor SAL_CALL WindowStyleSettings::getApplicationFont() throw (RuntimeException, std::exception)
765 StyleMethodGuard aGuard( *m_pData );
766 return lcl_getStyleFont( *m_pData, &StyleSettings::GetAppFont );
770 void SAL_CALL WindowStyleSettings::setApplicationFont( const FontDescriptor& _applicationfont ) throw (RuntimeException, std::exception)
772 StyleMethodGuard aGuard( *m_pData );
773 lcl_setStyleFont( *m_pData, &StyleSettings::SetAppFont, &StyleSettings::GetAppFont, _applicationfont );
777 FontDescriptor SAL_CALL WindowStyleSettings::getHelpFont() throw (RuntimeException, std::exception)
779 StyleMethodGuard aGuard( *m_pData );
780 return lcl_getStyleFont( *m_pData, &StyleSettings::GetHelpFont );
784 void SAL_CALL WindowStyleSettings::setHelpFont( const FontDescriptor& _helpfont ) throw (RuntimeException, std::exception)
786 StyleMethodGuard aGuard( *m_pData );
787 lcl_setStyleFont( *m_pData, &StyleSettings::SetHelpFont, &StyleSettings::GetHelpFont, _helpfont );
791 FontDescriptor SAL_CALL WindowStyleSettings::getTitleFont() throw (RuntimeException, std::exception)
793 StyleMethodGuard aGuard( *m_pData );
794 return lcl_getStyleFont( *m_pData, &StyleSettings::GetTitleFont );
798 void SAL_CALL WindowStyleSettings::setTitleFont( const FontDescriptor& _titlefont ) throw (RuntimeException, std::exception)
800 StyleMethodGuard aGuard( *m_pData );
801 lcl_setStyleFont( *m_pData, &StyleSettings::SetTitleFont, &StyleSettings::GetTitleFont, _titlefont );
805 FontDescriptor SAL_CALL WindowStyleSettings::getFloatTitleFont() throw (RuntimeException, std::exception)
807 StyleMethodGuard aGuard( *m_pData );
808 return lcl_getStyleFont( *m_pData, &StyleSettings::GetFloatTitleFont );
812 void SAL_CALL WindowStyleSettings::setFloatTitleFont( const FontDescriptor& _floattitlefont ) throw (RuntimeException, std::exception)
814 StyleMethodGuard aGuard( *m_pData );
815 lcl_setStyleFont( *m_pData, &StyleSettings::SetFloatTitleFont, &StyleSettings::GetFloatTitleFont, _floattitlefont );
819 FontDescriptor SAL_CALL WindowStyleSettings::getMenuFont() throw (RuntimeException, std::exception)
821 StyleMethodGuard aGuard( *m_pData );
822 return lcl_getStyleFont( *m_pData, &StyleSettings::GetMenuFont );
826 void SAL_CALL WindowStyleSettings::setMenuFont( const FontDescriptor& _menufont ) throw (RuntimeException, std::exception)
828 StyleMethodGuard aGuard( *m_pData );
829 lcl_setStyleFont( *m_pData, &StyleSettings::SetMenuFont, &StyleSettings::GetMenuFont, _menufont );
833 FontDescriptor SAL_CALL WindowStyleSettings::getToolFont() throw (RuntimeException, std::exception)
835 StyleMethodGuard aGuard( *m_pData );
836 return lcl_getStyleFont( *m_pData, &StyleSettings::GetToolFont );
840 void SAL_CALL WindowStyleSettings::setToolFont( const FontDescriptor& _toolfont ) throw (RuntimeException, std::exception)
842 StyleMethodGuard aGuard( *m_pData );
843 lcl_setStyleFont( *m_pData, &StyleSettings::SetToolFont, &StyleSettings::GetToolFont, _toolfont );
847 FontDescriptor SAL_CALL WindowStyleSettings::getGroupFont() throw (RuntimeException, std::exception)
849 StyleMethodGuard aGuard( *m_pData );
850 return lcl_getStyleFont( *m_pData, &StyleSettings::GetGroupFont );
854 void SAL_CALL WindowStyleSettings::setGroupFont( const FontDescriptor& _groupfont ) throw (RuntimeException, std::exception)
856 StyleMethodGuard aGuard( *m_pData );
857 lcl_setStyleFont( *m_pData, &StyleSettings::SetGroupFont, &StyleSettings::GetGroupFont, _groupfont );
861 FontDescriptor SAL_CALL WindowStyleSettings::getLabelFont() throw (RuntimeException, std::exception)
863 StyleMethodGuard aGuard( *m_pData );
864 return lcl_getStyleFont( *m_pData, &StyleSettings::GetLabelFont );
868 void SAL_CALL WindowStyleSettings::setLabelFont( const FontDescriptor& _labelfont ) throw (RuntimeException, std::exception)
870 StyleMethodGuard aGuard( *m_pData );
871 lcl_setStyleFont( *m_pData, &StyleSettings::SetLabelFont, &StyleSettings::GetLabelFont, _labelfont );
875 FontDescriptor SAL_CALL WindowStyleSettings::getRadioCheckFont() throw (RuntimeException, std::exception)
877 StyleMethodGuard aGuard( *m_pData );
878 return lcl_getStyleFont( *m_pData, &StyleSettings::GetRadioCheckFont );
882 void SAL_CALL WindowStyleSettings::setRadioCheckFont( const FontDescriptor& _radiocheckfont ) throw (RuntimeException, std::exception)
884 StyleMethodGuard aGuard( *m_pData );
885 lcl_setStyleFont( *m_pData, &StyleSettings::SetRadioCheckFont, &StyleSettings::GetRadioCheckFont, _radiocheckfont );
889 FontDescriptor SAL_CALL WindowStyleSettings::getPushButtonFont() throw (RuntimeException, std::exception)
891 StyleMethodGuard aGuard( *m_pData );
892 return lcl_getStyleFont( *m_pData, &StyleSettings::GetPushButtonFont );
896 void SAL_CALL WindowStyleSettings::setPushButtonFont( const FontDescriptor& _pushbuttonfont ) throw (RuntimeException, std::exception)
898 StyleMethodGuard aGuard( *m_pData );
899 lcl_setStyleFont( *m_pData, &StyleSettings::SetPushButtonFont, &StyleSettings::GetPushButtonFont, _pushbuttonfont );
903 FontDescriptor SAL_CALL WindowStyleSettings::getFieldFont() throw (RuntimeException, std::exception)
905 StyleMethodGuard aGuard( *m_pData );
906 return lcl_getStyleFont( *m_pData, &StyleSettings::GetFieldFont );
910 void SAL_CALL WindowStyleSettings::setFieldFont( const FontDescriptor& _fieldfont ) throw (RuntimeException, std::exception)
912 StyleMethodGuard aGuard( *m_pData );
913 lcl_setStyleFont( *m_pData, &StyleSettings::SetFieldFont, &StyleSettings::GetFieldFont, _fieldfont );
917 void SAL_CALL WindowStyleSettings::addStyleChangeListener( const Reference< XStyleChangeListener >& i_rListener ) throw (RuntimeException, std::exception)
919 StyleMethodGuard aGuard( *m_pData );
920 if ( i_rListener.is() )
921 m_pData->aStyleChangeListeners.addInterface( i_rListener );
925 void SAL_CALL WindowStyleSettings::removeStyleChangeListener( const Reference< XStyleChangeListener >& i_rListener ) throw (RuntimeException, std::exception)
927 StyleMethodGuard aGuard( *m_pData );
928 if ( i_rListener.is() )
929 m_pData->aStyleChangeListeners.removeInterface( i_rListener );
933 } // namespace toolkit
936 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */