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 /** === begin UNO using === **/
39 using ::com::sun::star::uno::Reference
;
40 using ::com::sun::star::uno::XInterface
;
41 using ::com::sun::star::uno::UNO_QUERY
;
42 using ::com::sun::star::uno::UNO_QUERY_THROW
;
43 using ::com::sun::star::uno::UNO_SET_THROW
;
44 using ::com::sun::star::uno::Exception
;
45 using ::com::sun::star::uno::RuntimeException
;
46 using ::com::sun::star::uno::Any
;
47 using ::com::sun::star::uno::makeAny
;
48 using ::com::sun::star::uno::Sequence
;
49 using ::com::sun::star::uno::Type
;
50 using ::com::sun::star::lang::DisposedException
;
51 using ::com::sun::star::lang::EventObject
;
52 using ::com::sun::star::awt::FontDescriptor
;
53 using ::com::sun::star::awt::XStyleChangeListener
;
54 using ::com::sun::star::awt::FontDescriptor
;
55 /** === end UNO using === **/
57 //==================================================================================================================
58 //= WindowStyleSettings_Data
59 //==================================================================================================================
60 struct WindowStyleSettings_Data
62 VCLXWindow
* pOwningWindow
;
63 ::cppu::OInterfaceContainerHelper aStyleChangeListeners
;
65 WindowStyleSettings_Data( ::osl::Mutex
& i_rListenerMutex
, VCLXWindow
& i_rOwningWindow
)
66 : pOwningWindow( &i_rOwningWindow
)
67 ,aStyleChangeListeners( i_rListenerMutex
)
71 DECL_LINK( OnWindowEvent
, const VclWindowEvent
* );
74 //------------------------------------------------------------------------------------------------------------------
75 IMPL_LINK( WindowStyleSettings_Data
, OnWindowEvent
, const VclWindowEvent
*, i_pEvent
)
77 if ( !i_pEvent
|| ( i_pEvent
->GetId() != VCLEVENT_WINDOW_DATACHANGED
) )
79 const DataChangedEvent
* pDataChangedEvent
= static_cast< const DataChangedEvent
* >( i_pEvent
->GetData() );
80 if ( !pDataChangedEvent
|| ( pDataChangedEvent
->GetType() != DATACHANGED_SETTINGS
) )
82 if ( ( pDataChangedEvent
->GetFlags() & SETTINGS_STYLE
) == 0 )
85 EventObject
aEvent( *pOwningWindow
);
86 aStyleChangeListeners
.notifyEach( &XStyleChangeListener::styleSettingsChanged
, aEvent
);
90 //==================================================================================================================
92 //==================================================================================================================
93 class StyleMethodGuard
96 StyleMethodGuard( WindowStyleSettings_Data
& i_rData
)
98 if ( i_rData
.pOwningWindow
== NULL
)
99 throw DisposedException();
107 SolarMutexGuard m_aGuard
;
110 //==================================================================================================================
111 //= WindowStyleSettings
112 //==================================================================================================================
113 //------------------------------------------------------------------------------------------------------------------
114 WindowStyleSettings::WindowStyleSettings(::osl::Mutex
& i_rListenerMutex
, VCLXWindow
& i_rOwningWindow
)
115 :m_pData( new WindowStyleSettings_Data(i_rListenerMutex
, i_rOwningWindow
) )
117 Window
* pWindow
= i_rOwningWindow
.GetWindow();
119 throw new RuntimeException();
120 pWindow
->AddEventListener( LINK( m_pData
.get(), WindowStyleSettings_Data
, OnWindowEvent
) );
123 //------------------------------------------------------------------------------------------------------------------
124 WindowStyleSettings::~WindowStyleSettings()
128 //------------------------------------------------------------------------------------------------------------------
129 void WindowStyleSettings::dispose()
131 StyleMethodGuard
aGuard( *m_pData
);
133 Window
* pWindow
= m_pData
->pOwningWindow
->GetWindow();
134 OSL_ENSURE( pWindow
, "WindowStyleSettings::dispose: window has been reset before we could revoke the listener!" );
136 pWindow
->RemoveEventListener( LINK( m_pData
.get(), WindowStyleSettings_Data
, OnWindowEvent
) );
138 EventObject
aEvent( *this );
139 m_pData
->aStyleChangeListeners
.disposeAndClear( aEvent
);
141 m_pData
->pOwningWindow
= NULL
;
144 //------------------------------------------------------------------------------------------------------------------
147 sal_Int32
lcl_getStyleColor( WindowStyleSettings_Data
& i_rData
, Color
const & (StyleSettings::*i_pGetter
)() const )
149 const Window
* pWindow
= i_rData
.pOwningWindow
->GetWindow();
150 const AllSettings aAllSettings
= pWindow
->GetSettings();
151 const StyleSettings aStyleSettings
= aAllSettings
.GetStyleSettings();
152 return (aStyleSettings
.*i_pGetter
)().GetColor();
155 void lcl_setStyleColor( WindowStyleSettings_Data
& i_rData
, void (StyleSettings::*i_pSetter
)( Color
const & ), const sal_Int32 i_nColor
)
157 Window
* pWindow
= i_rData
.pOwningWindow
->GetWindow();
158 AllSettings aAllSettings
= pWindow
->GetSettings();
159 StyleSettings aStyleSettings
= aAllSettings
.GetStyleSettings();
160 (aStyleSettings
.*i_pSetter
)( Color( i_nColor
) );
161 aAllSettings
.SetStyleSettings( aStyleSettings
);
162 pWindow
->SetSettings( aAllSettings
);
165 FontDescriptor
lcl_getStyleFont( WindowStyleSettings_Data
& i_rData
, Font
const & (StyleSettings::*i_pGetter
)() const )
167 const Window
* pWindow
= i_rData
.pOwningWindow
->GetWindow();
168 const AllSettings aAllSettings
= pWindow
->GetSettings();
169 const StyleSettings aStyleSettings
= aAllSettings
.GetStyleSettings();
170 return VCLUnoHelper::CreateFontDescriptor( (aStyleSettings
.*i_pGetter
)() );
173 void lcl_setStyleFont( WindowStyleSettings_Data
& i_rData
, void (StyleSettings::*i_pSetter
)( Font
const &),
174 Font
const & (StyleSettings::*i_pGetter
)() const, const FontDescriptor
& i_rFont
)
176 Window
* pWindow
= i_rData
.pOwningWindow
->GetWindow();
177 AllSettings aAllSettings
= pWindow
->GetSettings();
178 StyleSettings aStyleSettings
= aAllSettings
.GetStyleSettings();
179 const Font aNewFont
= VCLUnoHelper::CreateFont( i_rFont
, (aStyleSettings
.*i_pGetter
)() );
180 (aStyleSettings
.*i_pSetter
)( aNewFont
);
181 aAllSettings
.SetStyleSettings( aStyleSettings
);
182 pWindow
->SetSettings( aAllSettings
);
186 //------------------------------------------------------------------------------------------------------------------
187 ::sal_Int32 SAL_CALL
WindowStyleSettings::getActiveBorderColor() throw (RuntimeException
)
189 StyleMethodGuard
aGuard( *m_pData
);
190 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetActiveBorderColor
);
193 //------------------------------------------------------------------------------------------------------------------
194 void SAL_CALL
WindowStyleSettings::setActiveBorderColor( ::sal_Int32 _activebordercolor
) throw (RuntimeException
)
196 StyleMethodGuard
aGuard( *m_pData
);
197 lcl_setStyleColor( *m_pData
, &StyleSettings::SetActiveBorderColor
, _activebordercolor
);
200 //------------------------------------------------------------------------------------------------------------------
201 ::sal_Int32 SAL_CALL
WindowStyleSettings::getActiveColor() throw (RuntimeException
)
203 StyleMethodGuard
aGuard( *m_pData
);
204 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetActiveColor
);
207 //------------------------------------------------------------------------------------------------------------------
208 void SAL_CALL
WindowStyleSettings::setActiveColor( ::sal_Int32 _activecolor
) throw (RuntimeException
)
210 StyleMethodGuard
aGuard( *m_pData
);
211 lcl_setStyleColor( *m_pData
, &StyleSettings::SetActiveColor
, _activecolor
);
214 //------------------------------------------------------------------------------------------------------------------
215 ::sal_Int32 SAL_CALL
WindowStyleSettings::getActiveTabColor() throw (RuntimeException
)
217 StyleMethodGuard
aGuard( *m_pData
);
218 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetActiveTabColor
);
221 //------------------------------------------------------------------------------------------------------------------
222 void SAL_CALL
WindowStyleSettings::setActiveTabColor( ::sal_Int32 _activetabcolor
) throw (RuntimeException
)
224 StyleMethodGuard
aGuard( *m_pData
);
225 lcl_setStyleColor( *m_pData
, &StyleSettings::SetActiveTabColor
, _activetabcolor
);
228 //------------------------------------------------------------------------------------------------------------------
229 ::sal_Int32 SAL_CALL
WindowStyleSettings::getActiveTextColor() throw (RuntimeException
)
231 StyleMethodGuard
aGuard( *m_pData
);
232 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetActiveTextColor
);
235 //------------------------------------------------------------------------------------------------------------------
236 void SAL_CALL
WindowStyleSettings::setActiveTextColor( ::sal_Int32 _activetextcolor
) throw (RuntimeException
)
238 StyleMethodGuard
aGuard( *m_pData
);
239 lcl_setStyleColor( *m_pData
, &StyleSettings::SetActiveTextColor
, _activetextcolor
);
242 //------------------------------------------------------------------------------------------------------------------
243 ::sal_Int32 SAL_CALL
WindowStyleSettings::getButtonRolloverTextColor() throw (RuntimeException
)
245 StyleMethodGuard
aGuard( *m_pData
);
246 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetButtonRolloverTextColor
);
249 //------------------------------------------------------------------------------------------------------------------
250 void SAL_CALL
WindowStyleSettings::setButtonRolloverTextColor( ::sal_Int32 _buttonrollovertextcolor
) throw (RuntimeException
)
252 StyleMethodGuard
aGuard( *m_pData
);
253 lcl_setStyleColor( *m_pData
, &StyleSettings::SetButtonRolloverTextColor
, _buttonrollovertextcolor
);
256 //------------------------------------------------------------------------------------------------------------------
257 ::sal_Int32 SAL_CALL
WindowStyleSettings::getButtonTextColor() throw (RuntimeException
)
259 StyleMethodGuard
aGuard( *m_pData
);
260 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetButtonTextColor
);
263 //------------------------------------------------------------------------------------------------------------------
264 void SAL_CALL
WindowStyleSettings::setButtonTextColor( ::sal_Int32 _buttontextcolor
) throw (RuntimeException
)
266 StyleMethodGuard
aGuard( *m_pData
);
267 lcl_setStyleColor( *m_pData
, &StyleSettings::SetButtonTextColor
, _buttontextcolor
);
270 //------------------------------------------------------------------------------------------------------------------
271 ::sal_Int32 SAL_CALL
WindowStyleSettings::getCheckedColor() throw (RuntimeException
)
273 StyleMethodGuard
aGuard( *m_pData
);
274 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetCheckedColor
);
277 //------------------------------------------------------------------------------------------------------------------
278 void SAL_CALL
WindowStyleSettings::setCheckedColor( ::sal_Int32 _checkedcolor
) throw (RuntimeException
)
280 StyleMethodGuard
aGuard( *m_pData
);
281 lcl_setStyleColor( *m_pData
, &StyleSettings::SetCheckedColor
, _checkedcolor
);
284 //------------------------------------------------------------------------------------------------------------------
285 ::sal_Int32 SAL_CALL
WindowStyleSettings::getDarkShadowColor() throw (RuntimeException
)
287 StyleMethodGuard
aGuard( *m_pData
);
288 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetDarkShadowColor
);
291 //------------------------------------------------------------------------------------------------------------------
292 void SAL_CALL
WindowStyleSettings::setDarkShadowColor( ::sal_Int32 _darkshadowcolor
) throw (RuntimeException
)
294 StyleMethodGuard
aGuard( *m_pData
);
295 lcl_setStyleColor( *m_pData
, &StyleSettings::SetDarkShadowColor
, _darkshadowcolor
);
298 //------------------------------------------------------------------------------------------------------------------
299 ::sal_Int32 SAL_CALL
WindowStyleSettings::getDeactiveBorderColor() throw (RuntimeException
)
301 StyleMethodGuard
aGuard( *m_pData
);
302 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetDeactiveBorderColor
);
305 //------------------------------------------------------------------------------------------------------------------
306 void SAL_CALL
WindowStyleSettings::setDeactiveBorderColor( ::sal_Int32 _deactivebordercolor
) throw (RuntimeException
)
308 StyleMethodGuard
aGuard( *m_pData
);
309 lcl_setStyleColor( *m_pData
, &StyleSettings::SetDeactiveBorderColor
, _deactivebordercolor
);
312 //------------------------------------------------------------------------------------------------------------------
313 ::sal_Int32 SAL_CALL
WindowStyleSettings::getDeactiveColor() throw (RuntimeException
)
315 StyleMethodGuard
aGuard( *m_pData
);
316 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetDeactiveColor
);
319 //------------------------------------------------------------------------------------------------------------------
320 void SAL_CALL
WindowStyleSettings::setDeactiveColor( ::sal_Int32 _deactivecolor
) throw (RuntimeException
)
322 StyleMethodGuard
aGuard( *m_pData
);
323 lcl_setStyleColor( *m_pData
, &StyleSettings::SetDeactiveColor
, _deactivecolor
);
326 //------------------------------------------------------------------------------------------------------------------
327 ::sal_Int32 SAL_CALL
WindowStyleSettings::getDeactiveTextColor() throw (RuntimeException
)
329 StyleMethodGuard
aGuard( *m_pData
);
330 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetDeactiveTextColor
);
333 //------------------------------------------------------------------------------------------------------------------
334 void SAL_CALL
WindowStyleSettings::setDeactiveTextColor( ::sal_Int32 _deactivetextcolor
) throw (RuntimeException
)
336 StyleMethodGuard
aGuard( *m_pData
);
337 lcl_setStyleColor( *m_pData
, &StyleSettings::SetDeactiveTextColor
, _deactivetextcolor
);
340 //------------------------------------------------------------------------------------------------------------------
341 ::sal_Int32 SAL_CALL
WindowStyleSettings::getDialogColor() throw (RuntimeException
)
343 StyleMethodGuard
aGuard( *m_pData
);
344 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetDialogColor
);
347 //------------------------------------------------------------------------------------------------------------------
348 void SAL_CALL
WindowStyleSettings::setDialogColor( ::sal_Int32 _dialogcolor
) throw (RuntimeException
)
350 StyleMethodGuard
aGuard( *m_pData
);
351 lcl_setStyleColor( *m_pData
, &StyleSettings::SetDialogColor
, _dialogcolor
);
354 //------------------------------------------------------------------------------------------------------------------
355 ::sal_Int32 SAL_CALL
WindowStyleSettings::getDialogTextColor() throw (RuntimeException
)
357 StyleMethodGuard
aGuard( *m_pData
);
358 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetDialogTextColor
);
361 //------------------------------------------------------------------------------------------------------------------
362 void SAL_CALL
WindowStyleSettings::setDialogTextColor( ::sal_Int32 _dialogtextcolor
) throw (RuntimeException
)
364 StyleMethodGuard
aGuard( *m_pData
);
365 lcl_setStyleColor( *m_pData
, &StyleSettings::SetDialogTextColor
, _dialogtextcolor
);
368 //------------------------------------------------------------------------------------------------------------------
369 ::sal_Int32 SAL_CALL
WindowStyleSettings::getDisableColor() throw (RuntimeException
)
371 StyleMethodGuard
aGuard( *m_pData
);
372 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetDisableColor
);
375 //------------------------------------------------------------------------------------------------------------------
376 void SAL_CALL
WindowStyleSettings::setDisableColor( ::sal_Int32 _disablecolor
) throw (RuntimeException
)
378 StyleMethodGuard
aGuard( *m_pData
);
379 lcl_setStyleColor( *m_pData
, &StyleSettings::SetDisableColor
, _disablecolor
);
382 //------------------------------------------------------------------------------------------------------------------
383 ::sal_Int32 SAL_CALL
WindowStyleSettings::getFaceColor() throw (RuntimeException
)
385 StyleMethodGuard
aGuard( *m_pData
);
386 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetFaceColor
);
389 //------------------------------------------------------------------------------------------------------------------
390 void SAL_CALL
WindowStyleSettings::setFaceColor( ::sal_Int32 _facecolor
) throw (RuntimeException
)
392 StyleMethodGuard
aGuard( *m_pData
);
393 lcl_setStyleColor( *m_pData
, &StyleSettings::SetFaceColor
, _facecolor
);
396 //------------------------------------------------------------------------------------------------------------------
397 ::sal_Int32 SAL_CALL
WindowStyleSettings::getFaceGradientColor() throw (RuntimeException
)
399 StyleMethodGuard
aGuard( *m_pData
);
400 const Window
* pWindow
= m_pData
->pOwningWindow
->GetWindow();
401 const AllSettings aAllSettings
= pWindow
->GetSettings();
402 const StyleSettings aStyleSettings
= aAllSettings
.GetStyleSettings();
403 return aStyleSettings
.GetFaceGradientColor().GetColor();
406 //------------------------------------------------------------------------------------------------------------------
407 ::sal_Int32 SAL_CALL
WindowStyleSettings::getFieldColor() throw (RuntimeException
)
409 StyleMethodGuard
aGuard( *m_pData
);
410 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetFieldColor
);
413 //------------------------------------------------------------------------------------------------------------------
414 void SAL_CALL
WindowStyleSettings::setFieldColor( ::sal_Int32 _fieldcolor
) throw (RuntimeException
)
416 StyleMethodGuard
aGuard( *m_pData
);
417 lcl_setStyleColor( *m_pData
, &StyleSettings::SetFieldColor
, _fieldcolor
);
420 //------------------------------------------------------------------------------------------------------------------
421 ::sal_Int32 SAL_CALL
WindowStyleSettings::getFieldRolloverTextColor() throw (RuntimeException
)
423 StyleMethodGuard
aGuard( *m_pData
);
424 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetFieldRolloverTextColor
);
427 //------------------------------------------------------------------------------------------------------------------
428 void SAL_CALL
WindowStyleSettings::setFieldRolloverTextColor( ::sal_Int32 _fieldrollovertextcolor
) throw (RuntimeException
)
430 StyleMethodGuard
aGuard( *m_pData
);
431 lcl_setStyleColor( *m_pData
, &StyleSettings::SetFieldRolloverTextColor
, _fieldrollovertextcolor
);
434 //------------------------------------------------------------------------------------------------------------------
435 ::sal_Int32 SAL_CALL
WindowStyleSettings::getFieldTextColor() throw (RuntimeException
)
437 StyleMethodGuard
aGuard( *m_pData
);
438 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetFieldTextColor
);
441 //------------------------------------------------------------------------------------------------------------------
442 void SAL_CALL
WindowStyleSettings::setFieldTextColor( ::sal_Int32 _fieldtextcolor
) throw (RuntimeException
)
444 StyleMethodGuard
aGuard( *m_pData
);
445 lcl_setStyleColor( *m_pData
, &StyleSettings::SetFieldTextColor
, _fieldtextcolor
);
448 //------------------------------------------------------------------------------------------------------------------
449 ::sal_Int32 SAL_CALL
WindowStyleSettings::getGroupTextColor() throw (RuntimeException
)
451 StyleMethodGuard
aGuard( *m_pData
);
452 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetGroupTextColor
);
455 //------------------------------------------------------------------------------------------------------------------
456 void SAL_CALL
WindowStyleSettings::setGroupTextColor( ::sal_Int32 _grouptextcolor
) throw (RuntimeException
)
458 StyleMethodGuard
aGuard( *m_pData
);
459 lcl_setStyleColor( *m_pData
, &StyleSettings::SetGroupTextColor
, _grouptextcolor
);
462 //------------------------------------------------------------------------------------------------------------------
463 ::sal_Int32 SAL_CALL
WindowStyleSettings::getHelpColor() throw (RuntimeException
)
465 StyleMethodGuard
aGuard( *m_pData
);
466 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetHelpColor
);
469 //------------------------------------------------------------------------------------------------------------------
470 void SAL_CALL
WindowStyleSettings::setHelpColor( ::sal_Int32 _helpcolor
) throw (RuntimeException
)
472 StyleMethodGuard
aGuard( *m_pData
);
473 lcl_setStyleColor( *m_pData
, &StyleSettings::SetHelpColor
, _helpcolor
);
476 //------------------------------------------------------------------------------------------------------------------
477 ::sal_Int32 SAL_CALL
WindowStyleSettings::getHelpTextColor() throw (RuntimeException
)
479 StyleMethodGuard
aGuard( *m_pData
);
480 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetHelpTextColor
);
483 //------------------------------------------------------------------------------------------------------------------
484 void SAL_CALL
WindowStyleSettings::setHelpTextColor( ::sal_Int32 _helptextcolor
) throw (RuntimeException
)
486 StyleMethodGuard
aGuard( *m_pData
);
487 lcl_setStyleColor( *m_pData
, &StyleSettings::SetHelpTextColor
, _helptextcolor
);
490 //------------------------------------------------------------------------------------------------------------------
491 ::sal_Int32 SAL_CALL
WindowStyleSettings::getHighlightColor() throw (RuntimeException
)
493 StyleMethodGuard
aGuard( *m_pData
);
494 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetHighlightColor
);
497 //------------------------------------------------------------------------------------------------------------------
498 void SAL_CALL
WindowStyleSettings::setHighlightColor( ::sal_Int32 _highlightcolor
) throw (RuntimeException
)
500 StyleMethodGuard
aGuard( *m_pData
);
501 lcl_setStyleColor( *m_pData
, &StyleSettings::SetHighlightColor
, _highlightcolor
);
504 //------------------------------------------------------------------------------------------------------------------
505 ::sal_Int32 SAL_CALL
WindowStyleSettings::getHighlightTextColor() throw (RuntimeException
)
507 StyleMethodGuard
aGuard( *m_pData
);
508 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetHighlightTextColor
);
511 //------------------------------------------------------------------------------------------------------------------
512 void SAL_CALL
WindowStyleSettings::setHighlightTextColor( ::sal_Int32 _highlighttextcolor
) throw (RuntimeException
)
514 StyleMethodGuard
aGuard( *m_pData
);
515 lcl_setStyleColor( *m_pData
, &StyleSettings::SetHighlightTextColor
, _highlighttextcolor
);
518 //------------------------------------------------------------------------------------------------------------------
519 ::sal_Int32 SAL_CALL
WindowStyleSettings::getInactiveTabColor() throw (RuntimeException
)
521 StyleMethodGuard
aGuard( *m_pData
);
522 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetInactiveTabColor
);
525 //------------------------------------------------------------------------------------------------------------------
526 void SAL_CALL
WindowStyleSettings::setInactiveTabColor( ::sal_Int32 _inactivetabcolor
) throw (RuntimeException
)
528 StyleMethodGuard
aGuard( *m_pData
);
529 lcl_setStyleColor( *m_pData
, &StyleSettings::SetInactiveTabColor
, _inactivetabcolor
);
532 //------------------------------------------------------------------------------------------------------------------
533 ::sal_Int32 SAL_CALL
WindowStyleSettings::getInfoTextColor() throw (RuntimeException
)
535 StyleMethodGuard
aGuard( *m_pData
);
536 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetInfoTextColor
);
539 //------------------------------------------------------------------------------------------------------------------
540 void SAL_CALL
WindowStyleSettings::setInfoTextColor( ::sal_Int32 _infotextcolor
) throw (RuntimeException
)
542 StyleMethodGuard
aGuard( *m_pData
);
543 lcl_setStyleColor( *m_pData
, &StyleSettings::SetInfoTextColor
, _infotextcolor
);
546 //------------------------------------------------------------------------------------------------------------------
547 ::sal_Int32 SAL_CALL
WindowStyleSettings::getLabelTextColor() throw (RuntimeException
)
549 StyleMethodGuard
aGuard( *m_pData
);
550 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetLabelTextColor
);
553 //------------------------------------------------------------------------------------------------------------------
554 void SAL_CALL
WindowStyleSettings::setLabelTextColor( ::sal_Int32 _labeltextcolor
) throw (RuntimeException
)
556 StyleMethodGuard
aGuard( *m_pData
);
557 lcl_setStyleColor( *m_pData
, &StyleSettings::SetLabelTextColor
, _labeltextcolor
);
560 //------------------------------------------------------------------------------------------------------------------
561 ::sal_Int32 SAL_CALL
WindowStyleSettings::getLightColor() throw (RuntimeException
)
563 StyleMethodGuard
aGuard( *m_pData
);
564 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetLightColor
);
567 //------------------------------------------------------------------------------------------------------------------
568 void SAL_CALL
WindowStyleSettings::setLightColor( ::sal_Int32 _lightcolor
) throw (RuntimeException
)
570 StyleMethodGuard
aGuard( *m_pData
);
571 lcl_setStyleColor( *m_pData
, &StyleSettings::SetLightColor
, _lightcolor
);
574 //------------------------------------------------------------------------------------------------------------------
575 ::sal_Int32 SAL_CALL
WindowStyleSettings::getMenuBarColor() throw (RuntimeException
)
577 StyleMethodGuard
aGuard( *m_pData
);
578 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetMenuBarColor
);
581 //------------------------------------------------------------------------------------------------------------------
582 void SAL_CALL
WindowStyleSettings::setMenuBarColor( ::sal_Int32 _menubarcolor
) throw (RuntimeException
)
584 StyleMethodGuard
aGuard( *m_pData
);
585 lcl_setStyleColor( *m_pData
, &StyleSettings::SetMenuBarColor
, _menubarcolor
);
588 //------------------------------------------------------------------------------------------------------------------
589 ::sal_Int32 SAL_CALL
WindowStyleSettings::getMenuBarTextColor() throw (RuntimeException
)
591 StyleMethodGuard
aGuard( *m_pData
);
592 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetMenuBarTextColor
);
595 //------------------------------------------------------------------------------------------------------------------
596 void SAL_CALL
WindowStyleSettings::setMenuBarTextColor( ::sal_Int32 _menubartextcolor
) throw (RuntimeException
)
598 StyleMethodGuard
aGuard( *m_pData
);
599 lcl_setStyleColor( *m_pData
, &StyleSettings::SetMenuBarTextColor
, _menubartextcolor
);
602 //------------------------------------------------------------------------------------------------------------------
603 ::sal_Int32 SAL_CALL
WindowStyleSettings::getMenuBorderColor() throw (RuntimeException
)
605 StyleMethodGuard
aGuard( *m_pData
);
606 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetMenuBorderColor
);
609 //------------------------------------------------------------------------------------------------------------------
610 void SAL_CALL
WindowStyleSettings::setMenuBorderColor( ::sal_Int32 _menubordercolor
) throw (RuntimeException
)
612 StyleMethodGuard
aGuard( *m_pData
);
613 lcl_setStyleColor( *m_pData
, &StyleSettings::SetMenuBorderColor
, _menubordercolor
);
616 //------------------------------------------------------------------------------------------------------------------
617 ::sal_Int32 SAL_CALL
WindowStyleSettings::getMenuColor() throw (RuntimeException
)
619 StyleMethodGuard
aGuard( *m_pData
);
620 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetMenuColor
);
623 //------------------------------------------------------------------------------------------------------------------
624 void SAL_CALL
WindowStyleSettings::setMenuColor( ::sal_Int32 _menucolor
) throw (RuntimeException
)
626 StyleMethodGuard
aGuard( *m_pData
);
627 lcl_setStyleColor( *m_pData
, &StyleSettings::SetMenuColor
, _menucolor
);
630 //------------------------------------------------------------------------------------------------------------------
631 ::sal_Int32 SAL_CALL
WindowStyleSettings::getMenuHighlightColor() throw (RuntimeException
)
633 StyleMethodGuard
aGuard( *m_pData
);
634 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetMenuHighlightColor
);
637 //------------------------------------------------------------------------------------------------------------------
638 void SAL_CALL
WindowStyleSettings::setMenuHighlightColor( ::sal_Int32 _menuhighlightcolor
) throw (RuntimeException
)
640 StyleMethodGuard
aGuard( *m_pData
);
641 lcl_setStyleColor( *m_pData
, &StyleSettings::SetMenuHighlightColor
, _menuhighlightcolor
);
644 //------------------------------------------------------------------------------------------------------------------
645 ::sal_Int32 SAL_CALL
WindowStyleSettings::getMenuHighlightTextColor() throw (RuntimeException
)
647 StyleMethodGuard
aGuard( *m_pData
);
648 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetMenuHighlightTextColor
);
651 //------------------------------------------------------------------------------------------------------------------
652 void SAL_CALL
WindowStyleSettings::setMenuHighlightTextColor( ::sal_Int32 _menuhighlighttextcolor
) throw (RuntimeException
)
654 StyleMethodGuard
aGuard( *m_pData
);
655 lcl_setStyleColor( *m_pData
, &StyleSettings::SetMenuHighlightTextColor
, _menuhighlighttextcolor
);
658 //------------------------------------------------------------------------------------------------------------------
659 ::sal_Int32 SAL_CALL
WindowStyleSettings::getMenuTextColor() throw (RuntimeException
)
661 StyleMethodGuard
aGuard( *m_pData
);
662 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetMenuTextColor
);
665 //------------------------------------------------------------------------------------------------------------------
666 void SAL_CALL
WindowStyleSettings::setMenuTextColor( ::sal_Int32 _menutextcolor
) throw (RuntimeException
)
668 StyleMethodGuard
aGuard( *m_pData
);
669 lcl_setStyleColor( *m_pData
, &StyleSettings::SetMenuTextColor
, _menutextcolor
);
672 //------------------------------------------------------------------------------------------------------------------
673 ::sal_Int32 SAL_CALL
WindowStyleSettings::getMonoColor() throw (RuntimeException
)
675 StyleMethodGuard
aGuard( *m_pData
);
676 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetMonoColor
);
679 //------------------------------------------------------------------------------------------------------------------
680 void SAL_CALL
WindowStyleSettings::setMonoColor( ::sal_Int32 _monocolor
) throw (RuntimeException
)
682 StyleMethodGuard
aGuard( *m_pData
);
683 lcl_setStyleColor( *m_pData
, &StyleSettings::SetMonoColor
, _monocolor
);
686 //------------------------------------------------------------------------------------------------------------------
687 ::sal_Int32 SAL_CALL
WindowStyleSettings::getRadioCheckTextColor() throw (RuntimeException
)
689 StyleMethodGuard
aGuard( *m_pData
);
690 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetRadioCheckTextColor
);
693 //------------------------------------------------------------------------------------------------------------------
694 void SAL_CALL
WindowStyleSettings::setRadioCheckTextColor( ::sal_Int32 _radiochecktextcolor
) throw (RuntimeException
)
696 StyleMethodGuard
aGuard( *m_pData
);
697 lcl_setStyleColor( *m_pData
, &StyleSettings::SetRadioCheckTextColor
, _radiochecktextcolor
);
700 //------------------------------------------------------------------------------------------------------------------
701 ::sal_Int32 SAL_CALL
WindowStyleSettings::getSeparatorColor() throw (RuntimeException
)
703 StyleMethodGuard
aGuard( *m_pData
);
704 const Window
* pWindow
= m_pData
->pOwningWindow
->GetWindow();
705 const AllSettings aAllSettings
= pWindow
->GetSettings();
706 const StyleSettings aStyleSettings
= aAllSettings
.GetStyleSettings();
707 return aStyleSettings
.GetSeparatorColor().GetColor();
710 //------------------------------------------------------------------------------------------------------------------
711 ::sal_Int32 SAL_CALL
WindowStyleSettings::getShadowColor() throw (RuntimeException
)
713 StyleMethodGuard
aGuard( *m_pData
);
714 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetShadowColor
);
717 //------------------------------------------------------------------------------------------------------------------
718 void SAL_CALL
WindowStyleSettings::setShadowColor( ::sal_Int32 _shadowcolor
) throw (RuntimeException
)
720 StyleMethodGuard
aGuard( *m_pData
);
721 lcl_setStyleColor( *m_pData
, &StyleSettings::SetShadowColor
, _shadowcolor
);
724 //------------------------------------------------------------------------------------------------------------------
725 ::sal_Int32 SAL_CALL
WindowStyleSettings::getWindowColor() throw (RuntimeException
)
727 StyleMethodGuard
aGuard( *m_pData
);
728 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetWindowColor
);
731 //------------------------------------------------------------------------------------------------------------------
732 void SAL_CALL
WindowStyleSettings::setWindowColor( ::sal_Int32 _windowcolor
) throw (RuntimeException
)
734 StyleMethodGuard
aGuard( *m_pData
);
735 lcl_setStyleColor( *m_pData
, &StyleSettings::SetWindowColor
, _windowcolor
);
738 //------------------------------------------------------------------------------------------------------------------
739 ::sal_Int32 SAL_CALL
WindowStyleSettings::getWindowTextColor() throw (RuntimeException
)
741 StyleMethodGuard
aGuard( *m_pData
);
742 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetWindowTextColor
);
745 //------------------------------------------------------------------------------------------------------------------
746 void SAL_CALL
WindowStyleSettings::setWindowTextColor( ::sal_Int32 _windowtextcolor
) throw (RuntimeException
)
748 StyleMethodGuard
aGuard( *m_pData
);
749 lcl_setStyleColor( *m_pData
, &StyleSettings::SetWindowTextColor
, _windowtextcolor
);
752 //------------------------------------------------------------------------------------------------------------------
753 ::sal_Int32 SAL_CALL
WindowStyleSettings::getWorkspaceColor() throw (RuntimeException
)
755 StyleMethodGuard
aGuard( *m_pData
);
756 return lcl_getStyleColor( *m_pData
, &StyleSettings::GetWorkspaceColor
);
759 //------------------------------------------------------------------------------------------------------------------
760 void SAL_CALL
WindowStyleSettings::setWorkspaceColor( ::sal_Int32 _workspacecolor
) throw (RuntimeException
)
762 StyleMethodGuard
aGuard( *m_pData
);
763 lcl_setStyleColor( *m_pData
, &StyleSettings::SetWorkspaceColor
, _workspacecolor
);
766 //------------------------------------------------------------------------------------------------------------------
767 ::sal_Bool SAL_CALL
WindowStyleSettings::getHighContrastMode() throw (RuntimeException
)
769 StyleMethodGuard
aGuard( *m_pData
);
770 const Window
* pWindow
= m_pData
->pOwningWindow
->GetWindow();
771 const AllSettings aAllSettings
= pWindow
->GetSettings();
772 const StyleSettings aStyleSettings
= aAllSettings
.GetStyleSettings();
773 return aStyleSettings
.GetHighContrastMode();
776 //------------------------------------------------------------------------------------------------------------------
777 void SAL_CALL
WindowStyleSettings::setHighContrastMode( ::sal_Bool _highcontrastmode
) throw (RuntimeException
)
779 StyleMethodGuard
aGuard( *m_pData
);
780 Window
* pWindow
= m_pData
->pOwningWindow
->GetWindow();
781 AllSettings aAllSettings
= pWindow
->GetSettings();
782 StyleSettings aStyleSettings
= aAllSettings
.GetStyleSettings();
783 aStyleSettings
.SetHighContrastMode( _highcontrastmode
);
784 aAllSettings
.SetStyleSettings( aStyleSettings
);
785 pWindow
->SetSettings( aAllSettings
);
788 //------------------------------------------------------------------------------------------------------------------
789 FontDescriptor SAL_CALL
WindowStyleSettings::getApplicationFont() throw (RuntimeException
)
791 StyleMethodGuard
aGuard( *m_pData
);
792 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetAppFont
);
795 //------------------------------------------------------------------------------------------------------------------
796 void SAL_CALL
WindowStyleSettings::setApplicationFont( const FontDescriptor
& _applicationfont
) throw (RuntimeException
)
798 StyleMethodGuard
aGuard( *m_pData
);
799 lcl_setStyleFont( *m_pData
, &StyleSettings::SetAppFont
, &StyleSettings::GetAppFont
, _applicationfont
);
802 //------------------------------------------------------------------------------------------------------------------
803 FontDescriptor SAL_CALL
WindowStyleSettings::getHelpFont() throw (RuntimeException
)
805 StyleMethodGuard
aGuard( *m_pData
);
806 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetHelpFont
);
809 //------------------------------------------------------------------------------------------------------------------
810 void SAL_CALL
WindowStyleSettings::setHelpFont( const FontDescriptor
& _helpfont
) throw (RuntimeException
)
812 StyleMethodGuard
aGuard( *m_pData
);
813 lcl_setStyleFont( *m_pData
, &StyleSettings::SetHelpFont
, &StyleSettings::GetHelpFont
, _helpfont
);
816 //------------------------------------------------------------------------------------------------------------------
817 FontDescriptor SAL_CALL
WindowStyleSettings::getTitleFont() throw (RuntimeException
)
819 StyleMethodGuard
aGuard( *m_pData
);
820 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetTitleFont
);
823 //------------------------------------------------------------------------------------------------------------------
824 void SAL_CALL
WindowStyleSettings::setTitleFont( const FontDescriptor
& _titlefont
) throw (RuntimeException
)
826 StyleMethodGuard
aGuard( *m_pData
);
827 lcl_setStyleFont( *m_pData
, &StyleSettings::SetTitleFont
, &StyleSettings::GetTitleFont
, _titlefont
);
830 //------------------------------------------------------------------------------------------------------------------
831 FontDescriptor SAL_CALL
WindowStyleSettings::getFloatTitleFont() throw (RuntimeException
)
833 StyleMethodGuard
aGuard( *m_pData
);
834 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetFloatTitleFont
);
837 //------------------------------------------------------------------------------------------------------------------
838 void SAL_CALL
WindowStyleSettings::setFloatTitleFont( const FontDescriptor
& _floattitlefont
) throw (RuntimeException
)
840 StyleMethodGuard
aGuard( *m_pData
);
841 lcl_setStyleFont( *m_pData
, &StyleSettings::SetFloatTitleFont
, &StyleSettings::GetFloatTitleFont
, _floattitlefont
);
844 //------------------------------------------------------------------------------------------------------------------
845 FontDescriptor SAL_CALL
WindowStyleSettings::getMenuFont() throw (RuntimeException
)
847 StyleMethodGuard
aGuard( *m_pData
);
848 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetMenuFont
);
851 //------------------------------------------------------------------------------------------------------------------
852 void SAL_CALL
WindowStyleSettings::setMenuFont( const FontDescriptor
& _menufont
) throw (RuntimeException
)
854 StyleMethodGuard
aGuard( *m_pData
);
855 lcl_setStyleFont( *m_pData
, &StyleSettings::SetMenuFont
, &StyleSettings::GetMenuFont
, _menufont
);
858 //------------------------------------------------------------------------------------------------------------------
859 FontDescriptor SAL_CALL
WindowStyleSettings::getToolFont() throw (RuntimeException
)
861 StyleMethodGuard
aGuard( *m_pData
);
862 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetToolFont
);
865 //------------------------------------------------------------------------------------------------------------------
866 void SAL_CALL
WindowStyleSettings::setToolFont( const FontDescriptor
& _toolfont
) throw (RuntimeException
)
868 StyleMethodGuard
aGuard( *m_pData
);
869 lcl_setStyleFont( *m_pData
, &StyleSettings::SetToolFont
, &StyleSettings::GetToolFont
, _toolfont
);
872 //------------------------------------------------------------------------------------------------------------------
873 FontDescriptor SAL_CALL
WindowStyleSettings::getGroupFont() throw (RuntimeException
)
875 StyleMethodGuard
aGuard( *m_pData
);
876 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetGroupFont
);
879 //------------------------------------------------------------------------------------------------------------------
880 void SAL_CALL
WindowStyleSettings::setGroupFont( const FontDescriptor
& _groupfont
) throw (RuntimeException
)
882 StyleMethodGuard
aGuard( *m_pData
);
883 lcl_setStyleFont( *m_pData
, &StyleSettings::SetGroupFont
, &StyleSettings::GetGroupFont
, _groupfont
);
886 //------------------------------------------------------------------------------------------------------------------
887 FontDescriptor SAL_CALL
WindowStyleSettings::getLabelFont() throw (RuntimeException
)
889 StyleMethodGuard
aGuard( *m_pData
);
890 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetLabelFont
);
893 //------------------------------------------------------------------------------------------------------------------
894 void SAL_CALL
WindowStyleSettings::setLabelFont( const FontDescriptor
& _labelfont
) throw (RuntimeException
)
896 StyleMethodGuard
aGuard( *m_pData
);
897 lcl_setStyleFont( *m_pData
, &StyleSettings::SetLabelFont
, &StyleSettings::GetLabelFont
, _labelfont
);
900 //------------------------------------------------------------------------------------------------------------------
901 FontDescriptor SAL_CALL
WindowStyleSettings::getInfoFont() throw (RuntimeException
)
903 StyleMethodGuard
aGuard( *m_pData
);
904 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetInfoFont
);
907 //------------------------------------------------------------------------------------------------------------------
908 void SAL_CALL
WindowStyleSettings::setInfoFont( const FontDescriptor
& _infofont
) throw (RuntimeException
)
910 StyleMethodGuard
aGuard( *m_pData
);
911 lcl_setStyleFont( *m_pData
, &StyleSettings::SetInfoFont
, &StyleSettings::GetInfoFont
, _infofont
);
914 //------------------------------------------------------------------------------------------------------------------
915 FontDescriptor SAL_CALL
WindowStyleSettings::getRadioCheckFont() throw (RuntimeException
)
917 StyleMethodGuard
aGuard( *m_pData
);
918 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetRadioCheckFont
);
921 //------------------------------------------------------------------------------------------------------------------
922 void SAL_CALL
WindowStyleSettings::setRadioCheckFont( const FontDescriptor
& _radiocheckfont
) throw (RuntimeException
)
924 StyleMethodGuard
aGuard( *m_pData
);
925 lcl_setStyleFont( *m_pData
, &StyleSettings::SetRadioCheckFont
, &StyleSettings::GetRadioCheckFont
, _radiocheckfont
);
928 //------------------------------------------------------------------------------------------------------------------
929 FontDescriptor SAL_CALL
WindowStyleSettings::getPushButtonFont() throw (RuntimeException
)
931 StyleMethodGuard
aGuard( *m_pData
);
932 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetPushButtonFont
);
935 //------------------------------------------------------------------------------------------------------------------
936 void SAL_CALL
WindowStyleSettings::setPushButtonFont( const FontDescriptor
& _pushbuttonfont
) throw (RuntimeException
)
938 StyleMethodGuard
aGuard( *m_pData
);
939 lcl_setStyleFont( *m_pData
, &StyleSettings::SetPushButtonFont
, &StyleSettings::GetPushButtonFont
, _pushbuttonfont
);
942 //------------------------------------------------------------------------------------------------------------------
943 FontDescriptor SAL_CALL
WindowStyleSettings::getFieldFont() throw (RuntimeException
)
945 StyleMethodGuard
aGuard( *m_pData
);
946 return lcl_getStyleFont( *m_pData
, &StyleSettings::GetFieldFont
);
949 //------------------------------------------------------------------------------------------------------------------
950 void SAL_CALL
WindowStyleSettings::setFieldFont( const FontDescriptor
& _fieldfont
) throw (RuntimeException
)
952 StyleMethodGuard
aGuard( *m_pData
);
953 lcl_setStyleFont( *m_pData
, &StyleSettings::SetFieldFont
, &StyleSettings::GetFieldFont
, _fieldfont
);
956 //------------------------------------------------------------------------------------------------------------------
957 void SAL_CALL
WindowStyleSettings::addStyleChangeListener( const Reference
< XStyleChangeListener
>& i_rListener
) throw (RuntimeException
)
959 StyleMethodGuard
aGuard( *m_pData
);
960 if ( i_rListener
.is() )
961 m_pData
->aStyleChangeListeners
.addInterface( i_rListener
);
964 //------------------------------------------------------------------------------------------------------------------
965 void SAL_CALL
WindowStyleSettings::removeStyleChangeListener( const Reference
< XStyleChangeListener
>& i_rListener
) throw (RuntimeException
)
967 StyleMethodGuard
aGuard( *m_pData
);
968 if ( i_rListener
.is() )
969 m_pData
->aStyleChangeListeners
.removeInterface( i_rListener
);
972 //......................................................................................................................
973 } // namespace toolkit
974 //......................................................................................................................
976 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */