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>
33 //......................................................................................................................
36 //......................................................................................................................
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
;
54 //==================================================================================================================
55 //= WindowStyleSettings_Data
56 //==================================================================================================================
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
* );
71 //------------------------------------------------------------------------------------------------------------------
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() != DATACHANGED_SETTINGS
) )
79 if ( ( pDataChangedEvent
->GetFlags() & SETTINGS_STYLE
) == 0 )
82 EventObject
aEvent( *pOwningWindow
);
83 aStyleChangeListeners
.notifyEach( &XStyleChangeListener::styleSettingsChanged
, aEvent
);
87 //==================================================================================================================
89 //==================================================================================================================
90 class StyleMethodGuard
93 StyleMethodGuard( WindowStyleSettings_Data
& i_rData
)
95 if ( i_rData
.pOwningWindow
== NULL
)
96 throw DisposedException();
104 SolarMutexGuard m_aGuard
;
107 //==================================================================================================================
108 //= WindowStyleSettings
109 //==================================================================================================================
110 //------------------------------------------------------------------------------------------------------------------
111 WindowStyleSettings::WindowStyleSettings(::osl::Mutex
& i_rListenerMutex
, VCLXWindow
& i_rOwningWindow
)
112 :m_pData( new WindowStyleSettings_Data(i_rListenerMutex
, i_rOwningWindow
) )
114 Window
* pWindow
= i_rOwningWindow
.GetWindow();
116 throw RuntimeException();
117 pWindow
->AddEventListener( LINK( m_pData
.get(), WindowStyleSettings_Data
, OnWindowEvent
) );
120 //------------------------------------------------------------------------------------------------------------------
121 WindowStyleSettings::~WindowStyleSettings()
125 //------------------------------------------------------------------------------------------------------------------
126 void WindowStyleSettings::dispose()
128 StyleMethodGuard
aGuard( *m_pData
);
130 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
;
141 //------------------------------------------------------------------------------------------------------------------
144 sal_Int32
lcl_getStyleColor( WindowStyleSettings_Data
& i_rData
, Color
const & (StyleSettings::*i_pGetter
)() const )
146 const 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 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
, Font
const & (StyleSettings::*i_pGetter
)() const )
164 const 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
)( Font
const &),
171 Font
const & (StyleSettings::*i_pGetter
)() const, const FontDescriptor
& i_rFont
)
173 Window
* pWindow
= i_rData
.pOwningWindow
->GetWindow();
174 AllSettings aAllSettings
= pWindow
->GetSettings();
175 StyleSettings aStyleSettings
= aAllSettings
.GetStyleSettings();
176 const Font aNewFont
= VCLUnoHelper::CreateFont( i_rFont
, (aStyleSettings
.*i_pGetter
)() );
177 (aStyleSettings
.*i_pSetter
)( aNewFont
);
178 aAllSettings
.SetStyleSettings( aStyleSettings
);
179 pWindow
->SetSettings( aAllSettings
);
183 //------------------------------------------------------------------------------------------------------------------
184 ::sal_Int32 SAL_CALL
WindowStyleSettings::getActiveBorderColor() throw (RuntimeException
)
186 StyleMethodGuard
aGuard( *m_pData
);
187 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetActiveBorderColor
);
190 //------------------------------------------------------------------------------------------------------------------
191 void SAL_CALL
WindowStyleSettings::setActiveBorderColor( ::sal_Int32 _activebordercolor
) throw (RuntimeException
)
193 StyleMethodGuard
aGuard( *m_pData
);
194 lcl_setStyleColor( *m_pData
, &StyleSettings::SetActiveBorderColor
, _activebordercolor
);
197 //------------------------------------------------------------------------------------------------------------------
198 ::sal_Int32 SAL_CALL
WindowStyleSettings::getActiveColor() throw (RuntimeException
)
200 StyleMethodGuard
aGuard( *m_pData
);
201 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetActiveColor
);
204 //------------------------------------------------------------------------------------------------------------------
205 void SAL_CALL
WindowStyleSettings::setActiveColor( ::sal_Int32 _activecolor
) throw (RuntimeException
)
207 StyleMethodGuard
aGuard( *m_pData
);
208 lcl_setStyleColor( *m_pData
, &StyleSettings::SetActiveColor
, _activecolor
);
211 //------------------------------------------------------------------------------------------------------------------
212 ::sal_Int32 SAL_CALL
WindowStyleSettings::getActiveTabColor() throw (RuntimeException
)
214 StyleMethodGuard
aGuard( *m_pData
);
215 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetActiveTabColor
);
218 //------------------------------------------------------------------------------------------------------------------
219 void SAL_CALL
WindowStyleSettings::setActiveTabColor( ::sal_Int32 _activetabcolor
) throw (RuntimeException
)
221 StyleMethodGuard
aGuard( *m_pData
);
222 lcl_setStyleColor( *m_pData
, &StyleSettings::SetActiveTabColor
, _activetabcolor
);
225 //------------------------------------------------------------------------------------------------------------------
226 ::sal_Int32 SAL_CALL
WindowStyleSettings::getActiveTextColor() throw (RuntimeException
)
228 StyleMethodGuard
aGuard( *m_pData
);
229 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetActiveTextColor
);
232 //------------------------------------------------------------------------------------------------------------------
233 void SAL_CALL
WindowStyleSettings::setActiveTextColor( ::sal_Int32 _activetextcolor
) throw (RuntimeException
)
235 StyleMethodGuard
aGuard( *m_pData
);
236 lcl_setStyleColor( *m_pData
, &StyleSettings::SetActiveTextColor
, _activetextcolor
);
239 //------------------------------------------------------------------------------------------------------------------
240 ::sal_Int32 SAL_CALL
WindowStyleSettings::getButtonRolloverTextColor() throw (RuntimeException
)
242 StyleMethodGuard
aGuard( *m_pData
);
243 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetButtonRolloverTextColor
);
246 //------------------------------------------------------------------------------------------------------------------
247 void SAL_CALL
WindowStyleSettings::setButtonRolloverTextColor( ::sal_Int32 _buttonrollovertextcolor
) throw (RuntimeException
)
249 StyleMethodGuard
aGuard( *m_pData
);
250 lcl_setStyleColor( *m_pData
, &StyleSettings::SetButtonRolloverTextColor
, _buttonrollovertextcolor
);
253 //------------------------------------------------------------------------------------------------------------------
254 ::sal_Int32 SAL_CALL
WindowStyleSettings::getButtonTextColor() throw (RuntimeException
)
256 StyleMethodGuard
aGuard( *m_pData
);
257 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetButtonTextColor
);
260 //------------------------------------------------------------------------------------------------------------------
261 void SAL_CALL
WindowStyleSettings::setButtonTextColor( ::sal_Int32 _buttontextcolor
) throw (RuntimeException
)
263 StyleMethodGuard
aGuard( *m_pData
);
264 lcl_setStyleColor( *m_pData
, &StyleSettings::SetButtonTextColor
, _buttontextcolor
);
267 //------------------------------------------------------------------------------------------------------------------
268 ::sal_Int32 SAL_CALL
WindowStyleSettings::getCheckedColor() throw (RuntimeException
)
270 StyleMethodGuard
aGuard( *m_pData
);
271 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetCheckedColor
);
274 //------------------------------------------------------------------------------------------------------------------
275 void SAL_CALL
WindowStyleSettings::setCheckedColor( ::sal_Int32 _checkedcolor
) throw (RuntimeException
)
277 StyleMethodGuard
aGuard( *m_pData
);
278 lcl_setStyleColor( *m_pData
, &StyleSettings::SetCheckedColor
, _checkedcolor
);
281 //------------------------------------------------------------------------------------------------------------------
282 ::sal_Int32 SAL_CALL
WindowStyleSettings::getDarkShadowColor() throw (RuntimeException
)
284 StyleMethodGuard
aGuard( *m_pData
);
285 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetDarkShadowColor
);
288 //------------------------------------------------------------------------------------------------------------------
289 void SAL_CALL
WindowStyleSettings::setDarkShadowColor( ::sal_Int32 _darkshadowcolor
) throw (RuntimeException
)
291 StyleMethodGuard
aGuard( *m_pData
);
292 lcl_setStyleColor( *m_pData
, &StyleSettings::SetDarkShadowColor
, _darkshadowcolor
);
295 //------------------------------------------------------------------------------------------------------------------
296 ::sal_Int32 SAL_CALL
WindowStyleSettings::getDeactiveBorderColor() throw (RuntimeException
)
298 StyleMethodGuard
aGuard( *m_pData
);
299 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetDeactiveBorderColor
);
302 //------------------------------------------------------------------------------------------------------------------
303 void SAL_CALL
WindowStyleSettings::setDeactiveBorderColor( ::sal_Int32 _deactivebordercolor
) throw (RuntimeException
)
305 StyleMethodGuard
aGuard( *m_pData
);
306 lcl_setStyleColor( *m_pData
, &StyleSettings::SetDeactiveBorderColor
, _deactivebordercolor
);
309 //------------------------------------------------------------------------------------------------------------------
310 ::sal_Int32 SAL_CALL
WindowStyleSettings::getDeactiveColor() throw (RuntimeException
)
312 StyleMethodGuard
aGuard( *m_pData
);
313 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetDeactiveColor
);
316 //------------------------------------------------------------------------------------------------------------------
317 void SAL_CALL
WindowStyleSettings::setDeactiveColor( ::sal_Int32 _deactivecolor
) throw (RuntimeException
)
319 StyleMethodGuard
aGuard( *m_pData
);
320 lcl_setStyleColor( *m_pData
, &StyleSettings::SetDeactiveColor
, _deactivecolor
);
323 //------------------------------------------------------------------------------------------------------------------
324 ::sal_Int32 SAL_CALL
WindowStyleSettings::getDeactiveTextColor() throw (RuntimeException
)
326 StyleMethodGuard
aGuard( *m_pData
);
327 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetDeactiveTextColor
);
330 //------------------------------------------------------------------------------------------------------------------
331 void SAL_CALL
WindowStyleSettings::setDeactiveTextColor( ::sal_Int32 _deactivetextcolor
) throw (RuntimeException
)
333 StyleMethodGuard
aGuard( *m_pData
);
334 lcl_setStyleColor( *m_pData
, &StyleSettings::SetDeactiveTextColor
, _deactivetextcolor
);
337 //------------------------------------------------------------------------------------------------------------------
338 ::sal_Int32 SAL_CALL
WindowStyleSettings::getDialogColor() throw (RuntimeException
)
340 StyleMethodGuard
aGuard( *m_pData
);
341 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetDialogColor
);
344 //------------------------------------------------------------------------------------------------------------------
345 void SAL_CALL
WindowStyleSettings::setDialogColor( ::sal_Int32 _dialogcolor
) throw (RuntimeException
)
347 StyleMethodGuard
aGuard( *m_pData
);
348 lcl_setStyleColor( *m_pData
, &StyleSettings::SetDialogColor
, _dialogcolor
);
351 //------------------------------------------------------------------------------------------------------------------
352 ::sal_Int32 SAL_CALL
WindowStyleSettings::getDialogTextColor() throw (RuntimeException
)
354 StyleMethodGuard
aGuard( *m_pData
);
355 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetDialogTextColor
);
358 //------------------------------------------------------------------------------------------------------------------
359 void SAL_CALL
WindowStyleSettings::setDialogTextColor( ::sal_Int32 _dialogtextcolor
) throw (RuntimeException
)
361 StyleMethodGuard
aGuard( *m_pData
);
362 lcl_setStyleColor( *m_pData
, &StyleSettings::SetDialogTextColor
, _dialogtextcolor
);
365 //------------------------------------------------------------------------------------------------------------------
366 ::sal_Int32 SAL_CALL
WindowStyleSettings::getDisableColor() throw (RuntimeException
)
368 StyleMethodGuard
aGuard( *m_pData
);
369 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetDisableColor
);
372 //------------------------------------------------------------------------------------------------------------------
373 void SAL_CALL
WindowStyleSettings::setDisableColor( ::sal_Int32 _disablecolor
) throw (RuntimeException
)
375 StyleMethodGuard
aGuard( *m_pData
);
376 lcl_setStyleColor( *m_pData
, &StyleSettings::SetDisableColor
, _disablecolor
);
379 //------------------------------------------------------------------------------------------------------------------
380 ::sal_Int32 SAL_CALL
WindowStyleSettings::getFaceColor() throw (RuntimeException
)
382 StyleMethodGuard
aGuard( *m_pData
);
383 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetFaceColor
);
386 //------------------------------------------------------------------------------------------------------------------
387 void SAL_CALL
WindowStyleSettings::setFaceColor( ::sal_Int32 _facecolor
) throw (RuntimeException
)
389 StyleMethodGuard
aGuard( *m_pData
);
390 lcl_setStyleColor( *m_pData
, &StyleSettings::SetFaceColor
, _facecolor
);
393 //------------------------------------------------------------------------------------------------------------------
394 ::sal_Int32 SAL_CALL
WindowStyleSettings::getFaceGradientColor() throw (RuntimeException
)
396 StyleMethodGuard
aGuard( *m_pData
);
397 const Window
* pWindow
= m_pData
->pOwningWindow
->GetWindow();
398 const AllSettings aAllSettings
= pWindow
->GetSettings();
399 const StyleSettings aStyleSettings
= aAllSettings
.GetStyleSettings();
400 return aStyleSettings
.GetFaceGradientColor().GetColor();
403 //------------------------------------------------------------------------------------------------------------------
404 ::sal_Int32 SAL_CALL
WindowStyleSettings::getFieldColor() throw (RuntimeException
)
406 StyleMethodGuard
aGuard( *m_pData
);
407 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetFieldColor
);
410 //------------------------------------------------------------------------------------------------------------------
411 void SAL_CALL
WindowStyleSettings::setFieldColor( ::sal_Int32 _fieldcolor
) throw (RuntimeException
)
413 StyleMethodGuard
aGuard( *m_pData
);
414 lcl_setStyleColor( *m_pData
, &StyleSettings::SetFieldColor
, _fieldcolor
);
417 //------------------------------------------------------------------------------------------------------------------
418 ::sal_Int32 SAL_CALL
WindowStyleSettings::getFieldRolloverTextColor() throw (RuntimeException
)
420 StyleMethodGuard
aGuard( *m_pData
);
421 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetFieldRolloverTextColor
);
424 //------------------------------------------------------------------------------------------------------------------
425 void SAL_CALL
WindowStyleSettings::setFieldRolloverTextColor( ::sal_Int32 _fieldrollovertextcolor
) throw (RuntimeException
)
427 StyleMethodGuard
aGuard( *m_pData
);
428 lcl_setStyleColor( *m_pData
, &StyleSettings::SetFieldRolloverTextColor
, _fieldrollovertextcolor
);
431 //------------------------------------------------------------------------------------------------------------------
432 ::sal_Int32 SAL_CALL
WindowStyleSettings::getFieldTextColor() throw (RuntimeException
)
434 StyleMethodGuard
aGuard( *m_pData
);
435 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetFieldTextColor
);
438 //------------------------------------------------------------------------------------------------------------------
439 void SAL_CALL
WindowStyleSettings::setFieldTextColor( ::sal_Int32 _fieldtextcolor
) throw (RuntimeException
)
441 StyleMethodGuard
aGuard( *m_pData
);
442 lcl_setStyleColor( *m_pData
, &StyleSettings::SetFieldTextColor
, _fieldtextcolor
);
445 //------------------------------------------------------------------------------------------------------------------
446 ::sal_Int32 SAL_CALL
WindowStyleSettings::getGroupTextColor() throw (RuntimeException
)
448 StyleMethodGuard
aGuard( *m_pData
);
449 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetGroupTextColor
);
452 //------------------------------------------------------------------------------------------------------------------
453 void SAL_CALL
WindowStyleSettings::setGroupTextColor( ::sal_Int32 _grouptextcolor
) throw (RuntimeException
)
455 StyleMethodGuard
aGuard( *m_pData
);
456 lcl_setStyleColor( *m_pData
, &StyleSettings::SetGroupTextColor
, _grouptextcolor
);
459 //------------------------------------------------------------------------------------------------------------------
460 ::sal_Int32 SAL_CALL
WindowStyleSettings::getHelpColor() throw (RuntimeException
)
462 StyleMethodGuard
aGuard( *m_pData
);
463 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetHelpColor
);
466 //------------------------------------------------------------------------------------------------------------------
467 void SAL_CALL
WindowStyleSettings::setHelpColor( ::sal_Int32 _helpcolor
) throw (RuntimeException
)
469 StyleMethodGuard
aGuard( *m_pData
);
470 lcl_setStyleColor( *m_pData
, &StyleSettings::SetHelpColor
, _helpcolor
);
473 //------------------------------------------------------------------------------------------------------------------
474 ::sal_Int32 SAL_CALL
WindowStyleSettings::getHelpTextColor() throw (RuntimeException
)
476 StyleMethodGuard
aGuard( *m_pData
);
477 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetHelpTextColor
);
480 //------------------------------------------------------------------------------------------------------------------
481 void SAL_CALL
WindowStyleSettings::setHelpTextColor( ::sal_Int32 _helptextcolor
) throw (RuntimeException
)
483 StyleMethodGuard
aGuard( *m_pData
);
484 lcl_setStyleColor( *m_pData
, &StyleSettings::SetHelpTextColor
, _helptextcolor
);
487 //------------------------------------------------------------------------------------------------------------------
488 ::sal_Int32 SAL_CALL
WindowStyleSettings::getHighlightColor() throw (RuntimeException
)
490 StyleMethodGuard
aGuard( *m_pData
);
491 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetHighlightColor
);
494 //------------------------------------------------------------------------------------------------------------------
495 void SAL_CALL
WindowStyleSettings::setHighlightColor( ::sal_Int32 _highlightcolor
) throw (RuntimeException
)
497 StyleMethodGuard
aGuard( *m_pData
);
498 lcl_setStyleColor( *m_pData
, &StyleSettings::SetHighlightColor
, _highlightcolor
);
501 //------------------------------------------------------------------------------------------------------------------
502 ::sal_Int32 SAL_CALL
WindowStyleSettings::getHighlightTextColor() throw (RuntimeException
)
504 StyleMethodGuard
aGuard( *m_pData
);
505 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetHighlightTextColor
);
508 //------------------------------------------------------------------------------------------------------------------
509 void SAL_CALL
WindowStyleSettings::setHighlightTextColor( ::sal_Int32 _highlighttextcolor
) throw (RuntimeException
)
511 StyleMethodGuard
aGuard( *m_pData
);
512 lcl_setStyleColor( *m_pData
, &StyleSettings::SetHighlightTextColor
, _highlighttextcolor
);
515 //------------------------------------------------------------------------------------------------------------------
516 ::sal_Int32 SAL_CALL
WindowStyleSettings::getInactiveTabColor() throw (RuntimeException
)
518 StyleMethodGuard
aGuard( *m_pData
);
519 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetInactiveTabColor
);
522 //------------------------------------------------------------------------------------------------------------------
523 void SAL_CALL
WindowStyleSettings::setInactiveTabColor( ::sal_Int32 _inactivetabcolor
) throw (RuntimeException
)
525 StyleMethodGuard
aGuard( *m_pData
);
526 lcl_setStyleColor( *m_pData
, &StyleSettings::SetInactiveTabColor
, _inactivetabcolor
);
529 //------------------------------------------------------------------------------------------------------------------
530 ::sal_Int32 SAL_CALL
WindowStyleSettings::getInfoTextColor() throw (RuntimeException
)
532 StyleMethodGuard
aGuard( *m_pData
);
533 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetInfoTextColor
);
536 //------------------------------------------------------------------------------------------------------------------
537 void SAL_CALL
WindowStyleSettings::setInfoTextColor( ::sal_Int32 _infotextcolor
) throw (RuntimeException
)
539 StyleMethodGuard
aGuard( *m_pData
);
540 lcl_setStyleColor( *m_pData
, &StyleSettings::SetInfoTextColor
, _infotextcolor
);
543 //------------------------------------------------------------------------------------------------------------------
544 ::sal_Int32 SAL_CALL
WindowStyleSettings::getLabelTextColor() throw (RuntimeException
)
546 StyleMethodGuard
aGuard( *m_pData
);
547 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetLabelTextColor
);
550 //------------------------------------------------------------------------------------------------------------------
551 void SAL_CALL
WindowStyleSettings::setLabelTextColor( ::sal_Int32 _labeltextcolor
) throw (RuntimeException
)
553 StyleMethodGuard
aGuard( *m_pData
);
554 lcl_setStyleColor( *m_pData
, &StyleSettings::SetLabelTextColor
, _labeltextcolor
);
557 //------------------------------------------------------------------------------------------------------------------
558 ::sal_Int32 SAL_CALL
WindowStyleSettings::getLightColor() throw (RuntimeException
)
560 StyleMethodGuard
aGuard( *m_pData
);
561 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetLightColor
);
564 //------------------------------------------------------------------------------------------------------------------
565 void SAL_CALL
WindowStyleSettings::setLightColor( ::sal_Int32 _lightcolor
) throw (RuntimeException
)
567 StyleMethodGuard
aGuard( *m_pData
);
568 lcl_setStyleColor( *m_pData
, &StyleSettings::SetLightColor
, _lightcolor
);
571 //------------------------------------------------------------------------------------------------------------------
572 ::sal_Int32 SAL_CALL
WindowStyleSettings::getMenuBarColor() throw (RuntimeException
)
574 StyleMethodGuard
aGuard( *m_pData
);
575 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetMenuBarColor
);
578 //------------------------------------------------------------------------------------------------------------------
579 void SAL_CALL
WindowStyleSettings::setMenuBarColor( ::sal_Int32 _menubarcolor
) throw (RuntimeException
)
581 StyleMethodGuard
aGuard( *m_pData
);
582 lcl_setStyleColor( *m_pData
, &StyleSettings::SetMenuBarColor
, _menubarcolor
);
585 //------------------------------------------------------------------------------------------------------------------
586 ::sal_Int32 SAL_CALL
WindowStyleSettings::getMenuBarTextColor() throw (RuntimeException
)
588 StyleMethodGuard
aGuard( *m_pData
);
589 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetMenuBarTextColor
);
592 //------------------------------------------------------------------------------------------------------------------
593 void SAL_CALL
WindowStyleSettings::setMenuBarTextColor( ::sal_Int32 _menubartextcolor
) throw (RuntimeException
)
595 StyleMethodGuard
aGuard( *m_pData
);
596 lcl_setStyleColor( *m_pData
, &StyleSettings::SetMenuBarTextColor
, _menubartextcolor
);
599 //------------------------------------------------------------------------------------------------------------------
600 ::sal_Int32 SAL_CALL
WindowStyleSettings::getMenuBorderColor() throw (RuntimeException
)
602 StyleMethodGuard
aGuard( *m_pData
);
603 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetMenuBorderColor
);
606 //------------------------------------------------------------------------------------------------------------------
607 void SAL_CALL
WindowStyleSettings::setMenuBorderColor( ::sal_Int32 _menubordercolor
) throw (RuntimeException
)
609 StyleMethodGuard
aGuard( *m_pData
);
610 lcl_setStyleColor( *m_pData
, &StyleSettings::SetMenuBorderColor
, _menubordercolor
);
613 //------------------------------------------------------------------------------------------------------------------
614 ::sal_Int32 SAL_CALL
WindowStyleSettings::getMenuColor() throw (RuntimeException
)
616 StyleMethodGuard
aGuard( *m_pData
);
617 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetMenuColor
);
620 //------------------------------------------------------------------------------------------------------------------
621 void SAL_CALL
WindowStyleSettings::setMenuColor( ::sal_Int32 _menucolor
) throw (RuntimeException
)
623 StyleMethodGuard
aGuard( *m_pData
);
624 lcl_setStyleColor( *m_pData
, &StyleSettings::SetMenuColor
, _menucolor
);
627 //------------------------------------------------------------------------------------------------------------------
628 ::sal_Int32 SAL_CALL
WindowStyleSettings::getMenuHighlightColor() throw (RuntimeException
)
630 StyleMethodGuard
aGuard( *m_pData
);
631 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetMenuHighlightColor
);
634 //------------------------------------------------------------------------------------------------------------------
635 void SAL_CALL
WindowStyleSettings::setMenuHighlightColor( ::sal_Int32 _menuhighlightcolor
) throw (RuntimeException
)
637 StyleMethodGuard
aGuard( *m_pData
);
638 lcl_setStyleColor( *m_pData
, &StyleSettings::SetMenuHighlightColor
, _menuhighlightcolor
);
641 //------------------------------------------------------------------------------------------------------------------
642 ::sal_Int32 SAL_CALL
WindowStyleSettings::getMenuHighlightTextColor() throw (RuntimeException
)
644 StyleMethodGuard
aGuard( *m_pData
);
645 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetMenuHighlightTextColor
);
648 //------------------------------------------------------------------------------------------------------------------
649 void SAL_CALL
WindowStyleSettings::setMenuHighlightTextColor( ::sal_Int32 _menuhighlighttextcolor
) throw (RuntimeException
)
651 StyleMethodGuard
aGuard( *m_pData
);
652 lcl_setStyleColor( *m_pData
, &StyleSettings::SetMenuHighlightTextColor
, _menuhighlighttextcolor
);
655 //------------------------------------------------------------------------------------------------------------------
656 ::sal_Int32 SAL_CALL
WindowStyleSettings::getMenuTextColor() throw (RuntimeException
)
658 StyleMethodGuard
aGuard( *m_pData
);
659 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetMenuTextColor
);
662 //------------------------------------------------------------------------------------------------------------------
663 void SAL_CALL
WindowStyleSettings::setMenuTextColor( ::sal_Int32 _menutextcolor
) throw (RuntimeException
)
665 StyleMethodGuard
aGuard( *m_pData
);
666 lcl_setStyleColor( *m_pData
, &StyleSettings::SetMenuTextColor
, _menutextcolor
);
669 //------------------------------------------------------------------------------------------------------------------
670 ::sal_Int32 SAL_CALL
WindowStyleSettings::getMonoColor() throw (RuntimeException
)
672 StyleMethodGuard
aGuard( *m_pData
);
673 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetMonoColor
);
676 //------------------------------------------------------------------------------------------------------------------
677 void SAL_CALL
WindowStyleSettings::setMonoColor( ::sal_Int32 _monocolor
) throw (RuntimeException
)
679 StyleMethodGuard
aGuard( *m_pData
);
680 lcl_setStyleColor( *m_pData
, &StyleSettings::SetMonoColor
, _monocolor
);
683 //------------------------------------------------------------------------------------------------------------------
684 ::sal_Int32 SAL_CALL
WindowStyleSettings::getRadioCheckTextColor() throw (RuntimeException
)
686 StyleMethodGuard
aGuard( *m_pData
);
687 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetRadioCheckTextColor
);
690 //------------------------------------------------------------------------------------------------------------------
691 void SAL_CALL
WindowStyleSettings::setRadioCheckTextColor( ::sal_Int32 _radiochecktextcolor
) throw (RuntimeException
)
693 StyleMethodGuard
aGuard( *m_pData
);
694 lcl_setStyleColor( *m_pData
, &StyleSettings::SetRadioCheckTextColor
, _radiochecktextcolor
);
697 //------------------------------------------------------------------------------------------------------------------
698 ::sal_Int32 SAL_CALL
WindowStyleSettings::getSeparatorColor() throw (RuntimeException
)
700 StyleMethodGuard
aGuard( *m_pData
);
701 const Window
* pWindow
= m_pData
->pOwningWindow
->GetWindow();
702 const AllSettings aAllSettings
= pWindow
->GetSettings();
703 const StyleSettings aStyleSettings
= aAllSettings
.GetStyleSettings();
704 return aStyleSettings
.GetSeparatorColor().GetColor();
707 //------------------------------------------------------------------------------------------------------------------
708 ::sal_Int32 SAL_CALL
WindowStyleSettings::getShadowColor() throw (RuntimeException
)
710 StyleMethodGuard
aGuard( *m_pData
);
711 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetShadowColor
);
714 //------------------------------------------------------------------------------------------------------------------
715 void SAL_CALL
WindowStyleSettings::setShadowColor( ::sal_Int32 _shadowcolor
) throw (RuntimeException
)
717 StyleMethodGuard
aGuard( *m_pData
);
718 lcl_setStyleColor( *m_pData
, &StyleSettings::SetShadowColor
, _shadowcolor
);
721 //------------------------------------------------------------------------------------------------------------------
722 ::sal_Int32 SAL_CALL
WindowStyleSettings::getWindowColor() throw (RuntimeException
)
724 StyleMethodGuard
aGuard( *m_pData
);
725 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetWindowColor
);
728 //------------------------------------------------------------------------------------------------------------------
729 void SAL_CALL
WindowStyleSettings::setWindowColor( ::sal_Int32 _windowcolor
) throw (RuntimeException
)
731 StyleMethodGuard
aGuard( *m_pData
);
732 lcl_setStyleColor( *m_pData
, &StyleSettings::SetWindowColor
, _windowcolor
);
735 //------------------------------------------------------------------------------------------------------------------
736 ::sal_Int32 SAL_CALL
WindowStyleSettings::getWindowTextColor() throw (RuntimeException
)
738 StyleMethodGuard
aGuard( *m_pData
);
739 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetWindowTextColor
);
742 //------------------------------------------------------------------------------------------------------------------
743 void SAL_CALL
WindowStyleSettings::setWindowTextColor( ::sal_Int32 _windowtextcolor
) throw (RuntimeException
)
745 StyleMethodGuard
aGuard( *m_pData
);
746 lcl_setStyleColor( *m_pData
, &StyleSettings::SetWindowTextColor
, _windowtextcolor
);
749 //------------------------------------------------------------------------------------------------------------------
750 ::sal_Int32 SAL_CALL
WindowStyleSettings::getWorkspaceColor() throw (RuntimeException
)
752 StyleMethodGuard
aGuard( *m_pData
);
753 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetWorkspaceColor
);
756 //------------------------------------------------------------------------------------------------------------------
757 void SAL_CALL
WindowStyleSettings::setWorkspaceColor( ::sal_Int32 _workspacecolor
) throw (RuntimeException
)
759 StyleMethodGuard
aGuard( *m_pData
);
760 lcl_setStyleColor( *m_pData
, &StyleSettings::SetWorkspaceColor
, _workspacecolor
);
763 //------------------------------------------------------------------------------------------------------------------
764 ::sal_Bool SAL_CALL
WindowStyleSettings::getHighContrastMode() throw (RuntimeException
)
766 StyleMethodGuard
aGuard( *m_pData
);
767 const Window
* pWindow
= m_pData
->pOwningWindow
->GetWindow();
768 const AllSettings aAllSettings
= pWindow
->GetSettings();
769 const StyleSettings aStyleSettings
= aAllSettings
.GetStyleSettings();
770 return aStyleSettings
.GetHighContrastMode();
773 //------------------------------------------------------------------------------------------------------------------
774 void SAL_CALL
WindowStyleSettings::setHighContrastMode( ::sal_Bool _highcontrastmode
) throw (RuntimeException
)
776 StyleMethodGuard
aGuard( *m_pData
);
777 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
);
785 //------------------------------------------------------------------------------------------------------------------
786 FontDescriptor SAL_CALL
WindowStyleSettings::getApplicationFont() throw (RuntimeException
)
788 StyleMethodGuard
aGuard( *m_pData
);
789 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetAppFont
);
792 //------------------------------------------------------------------------------------------------------------------
793 void SAL_CALL
WindowStyleSettings::setApplicationFont( const FontDescriptor
& _applicationfont
) throw (RuntimeException
)
795 StyleMethodGuard
aGuard( *m_pData
);
796 lcl_setStyleFont( *m_pData
, &StyleSettings::SetAppFont
, &StyleSettings::GetAppFont
, _applicationfont
);
799 //------------------------------------------------------------------------------------------------------------------
800 FontDescriptor SAL_CALL
WindowStyleSettings::getHelpFont() throw (RuntimeException
)
802 StyleMethodGuard
aGuard( *m_pData
);
803 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetHelpFont
);
806 //------------------------------------------------------------------------------------------------------------------
807 void SAL_CALL
WindowStyleSettings::setHelpFont( const FontDescriptor
& _helpfont
) throw (RuntimeException
)
809 StyleMethodGuard
aGuard( *m_pData
);
810 lcl_setStyleFont( *m_pData
, &StyleSettings::SetHelpFont
, &StyleSettings::GetHelpFont
, _helpfont
);
813 //------------------------------------------------------------------------------------------------------------------
814 FontDescriptor SAL_CALL
WindowStyleSettings::getTitleFont() throw (RuntimeException
)
816 StyleMethodGuard
aGuard( *m_pData
);
817 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetTitleFont
);
820 //------------------------------------------------------------------------------------------------------------------
821 void SAL_CALL
WindowStyleSettings::setTitleFont( const FontDescriptor
& _titlefont
) throw (RuntimeException
)
823 StyleMethodGuard
aGuard( *m_pData
);
824 lcl_setStyleFont( *m_pData
, &StyleSettings::SetTitleFont
, &StyleSettings::GetTitleFont
, _titlefont
);
827 //------------------------------------------------------------------------------------------------------------------
828 FontDescriptor SAL_CALL
WindowStyleSettings::getFloatTitleFont() throw (RuntimeException
)
830 StyleMethodGuard
aGuard( *m_pData
);
831 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetFloatTitleFont
);
834 //------------------------------------------------------------------------------------------------------------------
835 void SAL_CALL
WindowStyleSettings::setFloatTitleFont( const FontDescriptor
& _floattitlefont
) throw (RuntimeException
)
837 StyleMethodGuard
aGuard( *m_pData
);
838 lcl_setStyleFont( *m_pData
, &StyleSettings::SetFloatTitleFont
, &StyleSettings::GetFloatTitleFont
, _floattitlefont
);
841 //------------------------------------------------------------------------------------------------------------------
842 FontDescriptor SAL_CALL
WindowStyleSettings::getMenuFont() throw (RuntimeException
)
844 StyleMethodGuard
aGuard( *m_pData
);
845 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetMenuFont
);
848 //------------------------------------------------------------------------------------------------------------------
849 void SAL_CALL
WindowStyleSettings::setMenuFont( const FontDescriptor
& _menufont
) throw (RuntimeException
)
851 StyleMethodGuard
aGuard( *m_pData
);
852 lcl_setStyleFont( *m_pData
, &StyleSettings::SetMenuFont
, &StyleSettings::GetMenuFont
, _menufont
);
855 //------------------------------------------------------------------------------------------------------------------
856 FontDescriptor SAL_CALL
WindowStyleSettings::getToolFont() throw (RuntimeException
)
858 StyleMethodGuard
aGuard( *m_pData
);
859 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetToolFont
);
862 //------------------------------------------------------------------------------------------------------------------
863 void SAL_CALL
WindowStyleSettings::setToolFont( const FontDescriptor
& _toolfont
) throw (RuntimeException
)
865 StyleMethodGuard
aGuard( *m_pData
);
866 lcl_setStyleFont( *m_pData
, &StyleSettings::SetToolFont
, &StyleSettings::GetToolFont
, _toolfont
);
869 //------------------------------------------------------------------------------------------------------------------
870 FontDescriptor SAL_CALL
WindowStyleSettings::getGroupFont() throw (RuntimeException
)
872 StyleMethodGuard
aGuard( *m_pData
);
873 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetGroupFont
);
876 //------------------------------------------------------------------------------------------------------------------
877 void SAL_CALL
WindowStyleSettings::setGroupFont( const FontDescriptor
& _groupfont
) throw (RuntimeException
)
879 StyleMethodGuard
aGuard( *m_pData
);
880 lcl_setStyleFont( *m_pData
, &StyleSettings::SetGroupFont
, &StyleSettings::GetGroupFont
, _groupfont
);
883 //------------------------------------------------------------------------------------------------------------------
884 FontDescriptor SAL_CALL
WindowStyleSettings::getLabelFont() throw (RuntimeException
)
886 StyleMethodGuard
aGuard( *m_pData
);
887 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetLabelFont
);
890 //------------------------------------------------------------------------------------------------------------------
891 void SAL_CALL
WindowStyleSettings::setLabelFont( const FontDescriptor
& _labelfont
) throw (RuntimeException
)
893 StyleMethodGuard
aGuard( *m_pData
);
894 lcl_setStyleFont( *m_pData
, &StyleSettings::SetLabelFont
, &StyleSettings::GetLabelFont
, _labelfont
);
897 //------------------------------------------------------------------------------------------------------------------
898 FontDescriptor SAL_CALL
WindowStyleSettings::getInfoFont() throw (RuntimeException
)
900 StyleMethodGuard
aGuard( *m_pData
);
901 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetInfoFont
);
904 //------------------------------------------------------------------------------------------------------------------
905 void SAL_CALL
WindowStyleSettings::setInfoFont( const FontDescriptor
& _infofont
) throw (RuntimeException
)
907 StyleMethodGuard
aGuard( *m_pData
);
908 lcl_setStyleFont( *m_pData
, &StyleSettings::SetInfoFont
, &StyleSettings::GetInfoFont
, _infofont
);
911 //------------------------------------------------------------------------------------------------------------------
912 FontDescriptor SAL_CALL
WindowStyleSettings::getRadioCheckFont() throw (RuntimeException
)
914 StyleMethodGuard
aGuard( *m_pData
);
915 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetRadioCheckFont
);
918 //------------------------------------------------------------------------------------------------------------------
919 void SAL_CALL
WindowStyleSettings::setRadioCheckFont( const FontDescriptor
& _radiocheckfont
) throw (RuntimeException
)
921 StyleMethodGuard
aGuard( *m_pData
);
922 lcl_setStyleFont( *m_pData
, &StyleSettings::SetRadioCheckFont
, &StyleSettings::GetRadioCheckFont
, _radiocheckfont
);
925 //------------------------------------------------------------------------------------------------------------------
926 FontDescriptor SAL_CALL
WindowStyleSettings::getPushButtonFont() throw (RuntimeException
)
928 StyleMethodGuard
aGuard( *m_pData
);
929 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetPushButtonFont
);
932 //------------------------------------------------------------------------------------------------------------------
933 void SAL_CALL
WindowStyleSettings::setPushButtonFont( const FontDescriptor
& _pushbuttonfont
) throw (RuntimeException
)
935 StyleMethodGuard
aGuard( *m_pData
);
936 lcl_setStyleFont( *m_pData
, &StyleSettings::SetPushButtonFont
, &StyleSettings::GetPushButtonFont
, _pushbuttonfont
);
939 //------------------------------------------------------------------------------------------------------------------
940 FontDescriptor SAL_CALL
WindowStyleSettings::getFieldFont() throw (RuntimeException
)
942 StyleMethodGuard
aGuard( *m_pData
);
943 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetFieldFont
);
946 //------------------------------------------------------------------------------------------------------------------
947 void SAL_CALL
WindowStyleSettings::setFieldFont( const FontDescriptor
& _fieldfont
) throw (RuntimeException
)
949 StyleMethodGuard
aGuard( *m_pData
);
950 lcl_setStyleFont( *m_pData
, &StyleSettings::SetFieldFont
, &StyleSettings::GetFieldFont
, _fieldfont
);
953 //------------------------------------------------------------------------------------------------------------------
954 void SAL_CALL
WindowStyleSettings::addStyleChangeListener( const Reference
< XStyleChangeListener
>& i_rListener
) throw (RuntimeException
)
956 StyleMethodGuard
aGuard( *m_pData
);
957 if ( i_rListener
.is() )
958 m_pData
->aStyleChangeListeners
.addInterface( i_rListener
);
961 //------------------------------------------------------------------------------------------------------------------
962 void SAL_CALL
WindowStyleSettings::removeStyleChangeListener( const Reference
< XStyleChangeListener
>& i_rListener
) throw (RuntimeException
)
964 StyleMethodGuard
aGuard( *m_pData
);
965 if ( i_rListener
.is() )
966 m_pData
->aStyleChangeListeners
.removeInterface( i_rListener
);
969 //......................................................................................................................
970 } // namespace toolkit
971 //......................................................................................................................
973 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */