1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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 .
20 #include <config_folders.h>
22 #include <officecfg/Office/Common.hxx>
25 #include <win/svsys.h>
28 #include <comphelper/processfactory.hxx>
29 #include <rtl/bootstrap.hxx>
31 #include <i18nlangtag/mslangid.hxx>
32 #include <i18nlangtag/languagetag.hxx>
34 #include <comphelper/lok.hxx>
36 #include <vcl/graphicfilter.hxx>
37 #include <IconThemeScanner.hxx>
38 #include <IconThemeSelector.hxx>
39 #include <vcl/IconThemeInfo.hxx>
40 #include <vcl/svapp.hxx>
41 #include <vcl/event.hxx>
42 #include <vcl/settings.hxx>
43 #include <vcl/i18nhelp.hxx>
44 #include <configsettings.hxx>
45 #include <vcl/outdev.hxx>
47 #include <unotools/fontcfg.hxx>
48 #include <unotools/localedatawrapper.hxx>
49 #include <unotools/confignode.hxx>
50 #include <unotools/configmgr.hxx>
51 #include <unotools/syslocale.hxx>
52 #include <unotools/syslocaleoptions.hxx>
54 using namespace ::com::sun::star
;
56 #include <salframe.hxx>
61 MouseSettingsOptions mnOptions
= MouseSettingsOptions::NONE
;
62 sal_uInt64 mnDoubleClkTime
= 500;
63 sal_Int32 mnDoubleClkWidth
= 2;
64 sal_Int32 mnDoubleClkHeight
= 2;
65 sal_Int32 mnStartDragWidth
= 2 ;
66 sal_Int32 mnStartDragHeight
= 2;
67 sal_Int32 mnButtonRepeat
= 90;
68 sal_Int32 mnMenuDelay
= 150;
69 MouseFollowFlags mnFollow
= MouseFollowFlags::Menu
;
70 MouseMiddleButtonAction mnMiddleButtonAction
= MouseMiddleButtonAction::AutoScroll
;
71 MouseWheelBehaviour mnWheelBehavior
= MouseWheelBehaviour::FocusOnly
;
77 ImplStyleData( const ImplStyleData
& rData
);
79 void SetStandardStyles();
81 Color maActiveBorderColor
;
83 Color maActiveTextColor
;
84 Color maAlternatingRowColor
;
85 Color maDefaultButtonTextColor
;
86 Color maButtonTextColor
;
87 Color maDefaultActionButtonTextColor
;
88 Color maActionButtonTextColor
;
89 Color maFlatButtonTextColor
;
90 Color maDefaultButtonRolloverTextColor
;
91 Color maButtonRolloverTextColor
;
92 Color maDefaultActionButtonRolloverTextColor
;
93 Color maActionButtonRolloverTextColor
;
94 Color maFlatButtonRolloverTextColor
;
95 Color maDefaultButtonPressedRolloverTextColor
;
96 Color maButtonPressedRolloverTextColor
;
97 Color maDefaultActionButtonPressedRolloverTextColor
;
98 Color maActionButtonPressedRolloverTextColor
;
99 Color maFlatButtonPressedRolloverTextColor
;
100 Color maCheckedColor
;
101 Color maDarkShadowColor
;
102 Color maDeactiveBorderColor
;
103 Color maDeactiveColor
;
104 Color maDeactiveTextColor
;
106 Color maDialogTextColor
;
107 Color maDisableColor
;
110 Color maFieldTextColor
;
111 Color maFieldRolloverTextColor
;
112 Color maGroupTextColor
;
114 Color maHelpTextColor
;
116 Color maHighlightColor
;
117 Color maHighlightTextColor
;
118 Color maLabelTextColor
;
119 Color maLightBorderColor
;
122 Color maMenuBarColor
;
123 Color maMenuBarRolloverColor
;
124 Color maMenuBorderColor
;
126 Color maMenuHighlightColor
;
127 Color maMenuHighlightTextColor
;
128 Color maMenuTextColor
;
129 Color maListBoxWindowBackgroundColor
;
130 Color maListBoxWindowTextColor
;
131 Color maListBoxWindowHighlightColor
;
132 Color maListBoxWindowHighlightTextColor
;
133 Color maMenuBarTextColor
;
134 Color maMenuBarRolloverTextColor
;
135 Color maMenuBarHighlightTextColor
;
137 Color maRadioCheckTextColor
;
139 Color maWarningColor
;
140 Color maVisitedLinkColor
;
141 Color maToolTextColor
;
143 Color maWindowTextColor
;
144 Color maWorkspaceColor
;
145 Color maActiveTabColor
;
146 Color maInactiveTabColor
;
147 Color maTabTextColor
;
148 Color maTabRolloverTextColor
;
149 Color maTabHighlightTextColor
;
151 vcl::Font maHelpFont
;
152 vcl::Font maTitleFont
;
153 vcl::Font maFloatTitleFont
;
154 vcl::Font maMenuFont
;
155 vcl::Font maToolFont
;
156 vcl::Font maLabelFont
;
157 vcl::Font maRadioCheckFont
;
158 vcl::Font maPushButtonFont
;
159 vcl::Font maFieldFont
;
160 vcl::Font maIconFont
;
162 vcl::Font maGroupFont
;
163 sal_Int32 mnTitleHeight
;
164 sal_Int32 mnFloatTitleHeight
;
165 sal_Int32 mnScrollBarSize
;
166 sal_Int32 mnSpinSize
;
167 sal_Int32 mnCursorSize
;
168 sal_Int32 mnAntialiasedMin
;
169 sal_uInt64 mnCursorBlinkTime
;
170 DragFullOptions mnDragFullOptions
;
171 SelectionOptions mnSelectionOptions
;
172 DisplayOptions mnDisplayOptions
;
173 ToolbarIconSize mnToolbarIconSize
;
175 StyleSettingsOptions mnOptions
;
177 bool mbUseSystemUIFonts
;
179 * Disabling AA doesn't actually disable AA of fonts, instead it is taken
180 * from system settings.
182 bool mbUseFontAAFromSystem
;
184 TriState meUseImagesInMenus
;
185 bool mnUseFlatBorders
;
186 bool mbPreferredUseImagesInMenus
;
187 sal_Int32 mnMinThumbSize
;
188 std::shared_ptr
<vcl::IconThemeScanner
>
190 std::shared_ptr
<vcl::IconThemeSelector
>
194 bool mbSkipDisabledInMenus
;
195 bool mbHideDisabledMenuItems
;
196 bool mbPreferredContextMenuShortcuts
;
197 TriState meContextMenuShortcuts
;
198 //mbPrimaryButtonWarpsSlider == true for "jump to here" behavior for primary button, otherwise
199 //primary means scroll by single page. Secondary button takes the alternative behaviour
200 bool mbPrimaryButtonWarpsSlider
;
201 DialogStyle maDialogStyle
;
203 sal_uInt16 mnEdgeBlending
;
204 Color maEdgeBlendingTopLeftColor
;
205 Color maEdgeBlendingBottomRightColor
;
206 sal_uInt16 mnListBoxMaximumLineCount
;
207 sal_uInt16 mnColorValueSetColumnCount
;
208 Size maListBoxPreviewDefaultLogicSize
;
209 Size maListBoxPreviewDefaultPixelSize
;
210 bool mbPreviewUsesCheckeredBackground
;
212 OUString maPersonaHeaderFooter
; ///< Cache the settings to detect changes.
214 BitmapEx maPersonaHeaderBitmap
; ///< Cache the header bitmap.
215 BitmapEx maPersonaFooterBitmap
; ///< Cache the footer bitmap.
216 std::optional
<Color
> maPersonaMenuBarTextColor
; ///< Cache the menubar color.
222 TriState mnEnableATT
;
223 bool mbEnableLocalizedDecimalSep
;
224 TriState mnDisablePrinting
;
229 sal_Int32 mnTipTimeout
= 3000;
232 struct ImplAllSettingsData
234 ImplAllSettingsData();
235 ImplAllSettingsData( const ImplAllSettingsData
& rData
);
236 ~ImplAllSettingsData();
238 MouseSettings maMouseSettings
;
239 StyleSettings maStyleSettings
;
240 MiscSettings maMiscSettings
;
241 HelpSettings maHelpSettings
;
242 LanguageTag maLocale
;
243 LanguageTag maUILocale
;
244 std::unique_ptr
<LocaleDataWrapper
> mpLocaleDataWrapper
;
245 std::unique_ptr
<LocaleDataWrapper
> mpUILocaleDataWrapper
;
246 std::unique_ptr
<LocaleDataWrapper
> mpNeutralLocaleDataWrapper
;
247 std::unique_ptr
<vcl::I18nHelper
> mpI18nHelper
;
248 std::unique_ptr
<vcl::I18nHelper
> mpUII18nHelper
;
249 SvtSysLocale maSysLocale
;
253 MouseSettings::SetOptions(MouseSettingsOptions nOptions
)
256 mxData
->mnOptions
= nOptions
;
260 MouseSettings::GetOptions() const
262 return mxData
->mnOptions
;
266 MouseSettings::SetDoubleClickTime( sal_uInt64 nDoubleClkTime
)
269 mxData
->mnDoubleClkTime
= nDoubleClkTime
;
273 MouseSettings::GetDoubleClickTime() const
275 return mxData
->mnDoubleClkTime
;
279 MouseSettings::SetDoubleClickWidth( sal_Int32 nDoubleClkWidth
)
282 mxData
->mnDoubleClkWidth
= nDoubleClkWidth
;
286 MouseSettings::GetDoubleClickWidth() const
288 return mxData
->mnDoubleClkWidth
;
292 MouseSettings::SetDoubleClickHeight( sal_Int32 nDoubleClkHeight
)
295 mxData
->mnDoubleClkHeight
= nDoubleClkHeight
;
299 MouseSettings::GetDoubleClickHeight() const
301 return mxData
->mnDoubleClkHeight
;
305 MouseSettings::SetStartDragWidth( sal_Int32 nDragWidth
)
308 mxData
->mnStartDragWidth
= nDragWidth
;
312 MouseSettings::GetStartDragWidth() const
314 return mxData
->mnStartDragWidth
;
318 MouseSettings::SetStartDragHeight( sal_Int32 nDragHeight
)
321 mxData
->mnStartDragHeight
= nDragHeight
;
325 MouseSettings::GetStartDragHeight() const
327 return mxData
->mnStartDragHeight
;
331 MouseSettings::GetStartDragCode()
337 MouseSettings::GetContextMenuCode()
343 MouseSettings::GetContextMenuClicks()
349 MouseSettings::GetScrollRepeat()
355 MouseSettings::GetButtonStartRepeat()
361 MouseSettings::SetButtonRepeat( sal_Int32 nRepeat
)
364 mxData
->mnButtonRepeat
= nRepeat
;
368 MouseSettings::GetButtonRepeat() const
370 return mxData
->mnButtonRepeat
;
374 MouseSettings::GetActionDelay()
380 MouseSettings::SetMenuDelay( sal_Int32 nDelay
)
383 mxData
->mnMenuDelay
= nDelay
;
387 MouseSettings::GetMenuDelay() const
389 return mxData
->mnMenuDelay
;
393 MouseSettings::SetFollow( MouseFollowFlags nFollow
)
396 mxData
->mnFollow
= nFollow
;
400 MouseSettings::GetFollow() const
402 return mxData
->mnFollow
;
406 MouseSettings::SetMiddleButtonAction( MouseMiddleButtonAction nAction
)
409 mxData
->mnMiddleButtonAction
= nAction
;
412 MouseMiddleButtonAction
413 MouseSettings::GetMiddleButtonAction() const
415 return mxData
->mnMiddleButtonAction
;
419 MouseSettings::SetWheelBehavior( MouseWheelBehaviour nBehavior
)
422 mxData
->mnWheelBehavior
= nBehavior
;
426 MouseSettings::GetWheelBehavior() const
428 return mxData
->mnWheelBehavior
;
432 MouseSettings::operator !=( const MouseSettings
& rSet
) const
434 return !(*this == rSet
);
437 MouseSettings::MouseSettings()
438 : mxData(std::make_shared
<ImplMouseData
>())
442 void MouseSettings::CopyData()
444 // copy if other references exist
445 if (mxData
.use_count() > 1)
447 mxData
= std::make_shared
<ImplMouseData
>(*mxData
);
451 bool MouseSettings::operator ==( const MouseSettings
& rSet
) const
453 if ( mxData
== rSet
.mxData
)
457 (mxData
->mnOptions
== rSet
.mxData
->mnOptions
) &&
458 (mxData
->mnDoubleClkTime
== rSet
.mxData
->mnDoubleClkTime
) &&
459 (mxData
->mnDoubleClkWidth
== rSet
.mxData
->mnDoubleClkWidth
) &&
460 (mxData
->mnDoubleClkHeight
== rSet
.mxData
->mnDoubleClkHeight
) &&
461 (mxData
->mnStartDragWidth
== rSet
.mxData
->mnStartDragWidth
) &&
462 (mxData
->mnStartDragHeight
== rSet
.mxData
->mnStartDragHeight
) &&
463 (mxData
->mnMiddleButtonAction
== rSet
.mxData
->mnMiddleButtonAction
) &&
464 (mxData
->mnButtonRepeat
== rSet
.mxData
->mnButtonRepeat
) &&
465 (mxData
->mnMenuDelay
== rSet
.mxData
->mnMenuDelay
) &&
466 (mxData
->mnFollow
== rSet
.mxData
->mnFollow
) &&
467 (mxData
->mnWheelBehavior
== rSet
.mxData
->mnWheelBehavior
);
470 ImplStyleData::ImplStyleData() :
475 mnCursorBlinkTime(STYLE_CURSOR_NOBLINKTIME
),
476 mnDragFullOptions(DragFullOptions::All
),
477 mnSelectionOptions(SelectionOptions::NONE
),
478 mnDisplayOptions(DisplayOptions::NONE
),
479 mnToolbarIconSize(ToolbarIconSize::Unknown
),
480 mnOptions(StyleSettingsOptions::NONE
),
481 mbAutoMnemonic(true),
482 meUseImagesInMenus(TRISTATE_INDET
),
484 mIconThemeSelector(std::make_shared
<vcl::IconThemeSelector
>()),
485 meContextMenuShortcuts(TRISTATE_INDET
),
487 maEdgeBlendingTopLeftColor(Color(0xC0, 0xC0, 0xC0)),
488 maEdgeBlendingBottomRightColor(Color(0x40, 0x40, 0x40)),
489 mnListBoxMaximumLineCount(25),
490 // For some reason this isn't actually the column count that gets used, at least on iOS, but
491 // instead what SvtAccessibilityOptions_Impl::GetColorValueSetColumnCount() in
492 // svtools/source/config/accessibilityoptions.cxx returns.
493 mnColorValueSetColumnCount(12),
495 maListBoxPreviewDefaultLogicSize(Size(30, 30)),
497 maListBoxPreviewDefaultLogicSize(Size(15, 7)),
499 maListBoxPreviewDefaultPixelSize(Size(0, 0)), // on-demand calculated in GetListBoxPreviewDefaultPixelSize(),
500 mbPreviewUsesCheckeredBackground(true)
505 ImplStyleData::ImplStyleData( const ImplStyleData
& rData
) :
506 maActiveBorderColor( rData
.maActiveBorderColor
),
507 maActiveColor( rData
.maActiveColor
),
508 maActiveTextColor( rData
.maActiveTextColor
),
509 maAlternatingRowColor( rData
.maAlternatingRowColor
),
510 maDefaultButtonTextColor( rData
.maDefaultButtonTextColor
),
511 maButtonTextColor( rData
.maButtonTextColor
),
512 maDefaultActionButtonTextColor( rData
.maDefaultActionButtonTextColor
),
513 maActionButtonTextColor( rData
.maActionButtonTextColor
),
514 maFlatButtonTextColor( rData
.maFlatButtonTextColor
),
515 maDefaultButtonRolloverTextColor( rData
.maDefaultButtonRolloverTextColor
),
516 maButtonRolloverTextColor( rData
.maButtonRolloverTextColor
),
517 maDefaultActionButtonRolloverTextColor( rData
.maDefaultActionButtonRolloverTextColor
),
518 maActionButtonRolloverTextColor( rData
.maActionButtonRolloverTextColor
),
519 maFlatButtonRolloverTextColor( rData
.maFlatButtonRolloverTextColor
),
520 maDefaultButtonPressedRolloverTextColor( rData
.maDefaultButtonPressedRolloverTextColor
),
521 maButtonPressedRolloverTextColor( rData
.maButtonPressedRolloverTextColor
),
522 maDefaultActionButtonPressedRolloverTextColor( rData
.maDefaultActionButtonPressedRolloverTextColor
),
523 maActionButtonPressedRolloverTextColor( rData
.maActionButtonPressedRolloverTextColor
),
524 maFlatButtonPressedRolloverTextColor( rData
.maFlatButtonPressedRolloverTextColor
),
525 maCheckedColor( rData
.maCheckedColor
),
526 maDarkShadowColor( rData
.maDarkShadowColor
),
527 maDeactiveBorderColor( rData
.maDeactiveBorderColor
),
528 maDeactiveColor( rData
.maDeactiveColor
),
529 maDeactiveTextColor( rData
.maDeactiveTextColor
),
530 maDialogColor( rData
.maDialogColor
),
531 maDialogTextColor( rData
.maDialogTextColor
),
532 maDisableColor( rData
.maDisableColor
),
533 maFaceColor( rData
.maFaceColor
),
534 maFieldColor( rData
.maFieldColor
),
535 maFieldTextColor( rData
.maFieldTextColor
),
536 maFieldRolloverTextColor( rData
.maFieldRolloverTextColor
),
537 maGroupTextColor( rData
.maGroupTextColor
),
538 maHelpColor( rData
.maHelpColor
),
539 maHelpTextColor( rData
.maHelpTextColor
),
540 maAccentColor( rData
.maAccentColor
),
541 maHighlightColor( rData
.maHighlightColor
),
542 maHighlightTextColor( rData
.maHighlightTextColor
),
543 maLabelTextColor( rData
.maLabelTextColor
),
544 maLightBorderColor( rData
.maLightBorderColor
),
545 maLightColor( rData
.maLightColor
),
546 maLinkColor( rData
.maLinkColor
),
547 maMenuBarColor( rData
.maMenuBarColor
),
548 maMenuBarRolloverColor( rData
.maMenuBarRolloverColor
),
549 maMenuBorderColor( rData
.maMenuBorderColor
),
550 maMenuColor( rData
.maMenuColor
),
551 maMenuHighlightColor( rData
.maMenuHighlightColor
),
552 maMenuHighlightTextColor( rData
.maMenuHighlightTextColor
),
553 maMenuTextColor( rData
.maMenuTextColor
),
554 maListBoxWindowBackgroundColor( rData
.maListBoxWindowBackgroundColor
),
555 maListBoxWindowTextColor( rData
.maListBoxWindowTextColor
),
556 maListBoxWindowHighlightColor( rData
.maListBoxWindowHighlightColor
),
557 maListBoxWindowHighlightTextColor( rData
.maListBoxWindowHighlightTextColor
),
558 maMenuBarTextColor( rData
.maMenuBarTextColor
),
559 maMenuBarRolloverTextColor( rData
.maMenuBarRolloverTextColor
),
560 maMenuBarHighlightTextColor( rData
.maMenuBarHighlightTextColor
),
561 maMonoColor( rData
.maMonoColor
),
562 maRadioCheckTextColor( rData
.maRadioCheckTextColor
),
563 maShadowColor( rData
.maShadowColor
),
564 maWarningColor( rData
.maWarningColor
),
565 maVisitedLinkColor( rData
.maVisitedLinkColor
),
566 maToolTextColor( rData
.maToolTextColor
),
567 maWindowColor( rData
.maWindowColor
),
568 maWindowTextColor( rData
.maWindowTextColor
),
569 maWorkspaceColor( rData
.maWorkspaceColor
),
570 maActiveTabColor( rData
.maActiveTabColor
),
571 maInactiveTabColor( rData
.maInactiveTabColor
),
572 maTabTextColor( rData
.maTabTextColor
),
573 maTabRolloverTextColor( rData
.maTabRolloverTextColor
),
574 maTabHighlightTextColor( rData
.maTabHighlightTextColor
),
575 maAppFont( rData
.maAppFont
),
576 maHelpFont( rData
.maAppFont
),
577 maTitleFont( rData
.maTitleFont
),
578 maFloatTitleFont( rData
.maFloatTitleFont
),
579 maMenuFont( rData
.maMenuFont
),
580 maToolFont( rData
.maToolFont
),
581 maLabelFont( rData
.maLabelFont
),
582 maRadioCheckFont( rData
.maRadioCheckFont
),
583 maPushButtonFont( rData
.maPushButtonFont
),
584 maFieldFont( rData
.maFieldFont
),
585 maIconFont( rData
.maIconFont
),
586 maTabFont( rData
.maTabFont
),
587 maGroupFont( rData
.maGroupFont
),
588 mnTitleHeight(rData
.mnTitleHeight
),
589 mnFloatTitleHeight(rData
.mnFloatTitleHeight
),
590 mnScrollBarSize(rData
.mnScrollBarSize
),
591 mnSpinSize(rData
.mnSpinSize
),
592 mnCursorSize(rData
.mnCursorSize
),
593 mnAntialiasedMin(rData
.mnAntialiasedMin
),
594 mnCursorBlinkTime(rData
.mnCursorBlinkTime
),
595 mnDragFullOptions(rData
.mnDragFullOptions
),
596 mnSelectionOptions(rData
.mnSelectionOptions
),
597 mnDisplayOptions(rData
.mnDisplayOptions
),
598 mnToolbarIconSize(rData
.mnToolbarIconSize
),
599 mnUseFlatMenus(rData
.mnUseFlatMenus
),
600 mnOptions(rData
.mnOptions
),
601 mbHighContrast(rData
.mbHighContrast
),
602 mbUseSystemUIFonts(rData
.mbUseSystemUIFonts
),
603 mbUseFontAAFromSystem(rData
.mbUseFontAAFromSystem
),
604 mbAutoMnemonic(rData
.mbAutoMnemonic
),
605 meUseImagesInMenus(rData
.meUseImagesInMenus
),
606 mnUseFlatBorders(rData
.mnUseFlatBorders
),
607 mbPreferredUseImagesInMenus(rData
.mbPreferredUseImagesInMenus
),
608 mnMinThumbSize(rData
.mnMinThumbSize
),
609 mIconThemeSelector(std::make_shared
<vcl::IconThemeSelector
>(*rData
.mIconThemeSelector
)),
610 mIconTheme(rData
.mIconTheme
),
611 mbSkipDisabledInMenus(rData
.mbSkipDisabledInMenus
),
612 mbHideDisabledMenuItems(rData
.mbHideDisabledMenuItems
),
613 mbPreferredContextMenuShortcuts(rData
.mbPreferredContextMenuShortcuts
),
614 meContextMenuShortcuts(rData
.meContextMenuShortcuts
),
615 mbPrimaryButtonWarpsSlider(rData
.mbPrimaryButtonWarpsSlider
),
616 maDialogStyle( rData
.maDialogStyle
),
617 mnEdgeBlending(rData
.mnEdgeBlending
),
618 maEdgeBlendingTopLeftColor(rData
.maEdgeBlendingTopLeftColor
),
619 maEdgeBlendingBottomRightColor(rData
.maEdgeBlendingBottomRightColor
),
620 mnListBoxMaximumLineCount(rData
.mnListBoxMaximumLineCount
),
621 mnColorValueSetColumnCount(rData
.mnColorValueSetColumnCount
),
622 maListBoxPreviewDefaultLogicSize(rData
.maListBoxPreviewDefaultLogicSize
),
623 maListBoxPreviewDefaultPixelSize(rData
.maListBoxPreviewDefaultPixelSize
),
624 mbPreviewUsesCheckeredBackground(rData
.mbPreviewUsesCheckeredBackground
),
625 maPersonaHeaderFooter( rData
.maPersonaHeaderFooter
),
626 maPersonaHeaderBitmap( rData
.maPersonaHeaderBitmap
),
627 maPersonaFooterBitmap( rData
.maPersonaFooterBitmap
),
628 maPersonaMenuBarTextColor( rData
.maPersonaMenuBarTextColor
)
630 if (rData
.mIconThemeScanner
)
631 mIconThemeScanner
= std::make_shared
<vcl::IconThemeScanner
>(*rData
.mIconThemeScanner
);
634 void ImplStyleData::SetStandardStyles()
636 vcl::Font
aStdFont( FAMILY_SWISS
, Size( 0, 8 ) );
637 aStdFont
.SetCharSet( osl_getThreadTextEncoding() );
638 aStdFont
.SetWeight( WEIGHT_NORMAL
);
639 if (!utl::ConfigManager::IsFuzzing())
640 aStdFont
.SetFamilyName(utl::DefaultFontConfiguration::get().getUserInterfaceFont(LanguageTag("en")));
642 aStdFont
.SetFamilyName("Liberation Sans");
643 maAppFont
= aStdFont
;
644 maHelpFont
= aStdFont
;
645 maMenuFont
= aStdFont
;
646 maToolFont
= aStdFont
;
647 maGroupFont
= aStdFont
;
648 maLabelFont
= aStdFont
;
649 maRadioCheckFont
= aStdFont
;
650 maPushButtonFont
= aStdFont
;
651 maFieldFont
= aStdFont
;
652 maIconFont
= aStdFont
;
653 maTabFont
= aStdFont
;
654 aStdFont
.SetWeight( WEIGHT_BOLD
);
655 maFloatTitleFont
= aStdFont
;
656 maTitleFont
= aStdFont
;
658 maFaceColor
= COL_LIGHTGRAY
;
659 maCheckedColor
= Color( 0xCC, 0xCC, 0xCC );
660 maLightColor
= COL_WHITE
;
661 maLightBorderColor
= COL_LIGHTGRAY
;
662 maShadowColor
= COL_GRAY
;
663 maDarkShadowColor
= COL_BLACK
;
665 maWarningColor
= COL_YELLOW
;
667 maDefaultButtonTextColor
= COL_BLACK
;
668 maButtonTextColor
= COL_BLACK
;
669 maDefaultActionButtonTextColor
= COL_BLACK
;
670 maActionButtonTextColor
= COL_BLACK
;
671 maFlatButtonTextColor
= COL_BLACK
;
672 maDefaultButtonRolloverTextColor
= COL_BLACK
;
673 maButtonRolloverTextColor
= COL_BLACK
;
674 maDefaultActionButtonRolloverTextColor
= COL_BLACK
;
675 maActionButtonRolloverTextColor
= COL_BLACK
;
676 maFlatButtonRolloverTextColor
= COL_BLACK
;
677 maDefaultButtonPressedRolloverTextColor
= COL_BLACK
;
678 maButtonPressedRolloverTextColor
= COL_BLACK
;
679 maDefaultActionButtonPressedRolloverTextColor
= COL_BLACK
;
680 maActionButtonPressedRolloverTextColor
= COL_BLACK
;
681 maFlatButtonPressedRolloverTextColor
= COL_BLACK
;
683 maRadioCheckTextColor
= COL_BLACK
;
684 maGroupTextColor
= COL_BLACK
;
685 maLabelTextColor
= COL_BLACK
;
686 maWindowColor
= COL_WHITE
;
687 maWindowTextColor
= COL_BLACK
;
688 maDialogColor
= COL_LIGHTGRAY
;
689 maDialogTextColor
= COL_BLACK
;
690 maWorkspaceColor
= Color( 0xDF, 0xDF, 0xDE );
691 maMonoColor
= COL_BLACK
;
692 maFieldColor
= COL_WHITE
;
693 maFieldTextColor
= COL_BLACK
;
694 maFieldRolloverTextColor
= COL_BLACK
;
695 maActiveBorderColor
= COL_LIGHTGRAY
;
696 maDeactiveColor
= COL_GRAY
;
697 maDeactiveTextColor
= COL_LIGHTGRAY
;
698 maDeactiveBorderColor
= COL_LIGHTGRAY
;
699 maMenuColor
= COL_LIGHTGRAY
;
700 maMenuBarColor
= COL_LIGHTGRAY
;
701 maMenuBarRolloverColor
= COL_BLUE
;
702 maMenuBorderColor
= COL_LIGHTGRAY
;
703 maMenuTextColor
= COL_BLACK
;
704 maListBoxWindowBackgroundColor
= COL_WHITE
;
705 maListBoxWindowTextColor
= COL_BLACK
;
706 maListBoxWindowHighlightColor
= COL_BLUE
;
707 maListBoxWindowHighlightTextColor
= COL_WHITE
;
708 maMenuBarTextColor
= COL_BLACK
;
709 maMenuBarRolloverTextColor
= COL_WHITE
;
710 maMenuBarHighlightTextColor
= COL_WHITE
;
711 maMenuHighlightColor
= COL_BLUE
;
712 maMenuHighlightTextColor
= COL_WHITE
;
713 maAccentColor
= COL_RED
;
714 maHighlightColor
= COL_BLUE
;
715 maHighlightTextColor
= COL_WHITE
;
716 // make active like highlight, except with a small contrast
717 maActiveColor
= maHighlightColor
;
718 maActiveColor
.IncreaseLuminance(32);
719 maActiveTextColor
= maHighlightTextColor
;
720 maActiveTabColor
= COL_WHITE
;
721 maInactiveTabColor
= COL_LIGHTGRAY
;
722 maTabTextColor
= COL_BLACK
;
723 maTabRolloverTextColor
= COL_BLACK
;
724 maTabHighlightTextColor
= COL_BLACK
;
725 maDisableColor
= COL_GRAY
;
726 maHelpColor
= Color( 0xFF, 0xFF, 0xE0 );
727 maHelpTextColor
= COL_BLACK
;
728 maLinkColor
= COL_BLUE
;
729 maVisitedLinkColor
= Color( 0x00, 0x00, 0xCC );
730 maToolTextColor
= COL_BLACK
;
731 maAlternatingRowColor
= Color( 0xEE, 0xEE, 0xEE );
734 mnFloatTitleHeight
= 13;
735 mbHighContrast
= false;
736 mbUseSystemUIFonts
= true;
737 mbUseFontAAFromSystem
= true;
738 mnUseFlatBorders
= false;
739 mnUseFlatMenus
= false;
740 mbPreferredUseImagesInMenus
= true;
741 mbSkipDisabledInMenus
= false;
742 mbHideDisabledMenuItems
= false;
743 mbPreferredContextMenuShortcuts
= true;
744 mbPrimaryButtonWarpsSlider
= false;
747 StyleSettings::StyleSettings()
748 : mxData(std::make_shared
<ImplStyleData
>())
753 StyleSettings::SetFaceColor( const Color
& rColor
)
756 mxData
->maFaceColor
= rColor
;
760 StyleSettings::GetFaceColor() const
762 return mxData
->maFaceColor
;
766 StyleSettings::SetCheckedColor( const Color
& rColor
)
769 mxData
->maCheckedColor
= rColor
;
773 StyleSettings::GetCheckedColor() const
775 return mxData
->maCheckedColor
;
779 StyleSettings::SetLightColor( const Color
& rColor
)
782 mxData
->maLightColor
= rColor
;
786 StyleSettings::GetLightColor() const
788 return mxData
->maLightColor
;
792 StyleSettings::SetLightBorderColor( const Color
& rColor
)
795 mxData
->maLightBorderColor
= rColor
;
799 StyleSettings::GetLightBorderColor() const
801 return mxData
->maLightBorderColor
;
805 StyleSettings::SetWarningColor( const Color
& rColor
)
808 mxData
->maWarningColor
= rColor
;
812 StyleSettings::GetWarningColor() const
814 return mxData
->maWarningColor
;
818 StyleSettings::SetShadowColor( const Color
& rColor
)
821 mxData
->maShadowColor
= rColor
;
825 StyleSettings::GetShadowColor() const
827 return mxData
->maShadowColor
;
831 StyleSettings::SetDarkShadowColor( const Color
& rColor
)
834 mxData
->maDarkShadowColor
= rColor
;
838 StyleSettings::GetDarkShadowColor() const
840 return mxData
->maDarkShadowColor
;
844 StyleSettings::SetDefaultButtonTextColor( const Color
& rColor
)
847 mxData
->maDefaultButtonTextColor
= rColor
;
851 StyleSettings::GetDefaultButtonTextColor() const
853 return mxData
->maDefaultButtonTextColor
;
857 StyleSettings::SetButtonTextColor( const Color
& rColor
)
860 mxData
->maButtonTextColor
= rColor
;
864 StyleSettings::GetButtonTextColor() const
866 return mxData
->maButtonTextColor
;
870 StyleSettings::SetDefaultActionButtonTextColor( const Color
& rColor
)
873 mxData
->maDefaultActionButtonTextColor
= rColor
;
877 StyleSettings::GetDefaultActionButtonTextColor() const
879 return mxData
->maDefaultActionButtonTextColor
;
883 StyleSettings::SetActionButtonTextColor( const Color
& rColor
)
886 mxData
->maActionButtonTextColor
= rColor
;
890 StyleSettings::GetActionButtonTextColor() const
892 return mxData
->maActionButtonTextColor
;
896 StyleSettings::SetFlatButtonTextColor( const Color
& rColor
)
899 mxData
->maFlatButtonTextColor
= rColor
;
903 StyleSettings::GetFlatButtonTextColor() const
905 return mxData
->maFlatButtonTextColor
;
909 StyleSettings::SetDefaultButtonRolloverTextColor( const Color
& rColor
)
912 mxData
->maDefaultButtonRolloverTextColor
= rColor
;
916 StyleSettings::GetDefaultButtonRolloverTextColor() const
918 return mxData
->maDefaultButtonRolloverTextColor
;
922 StyleSettings::SetButtonRolloverTextColor( const Color
& rColor
)
925 mxData
->maButtonRolloverTextColor
= rColor
;
929 StyleSettings::GetButtonRolloverTextColor() const
931 return mxData
->maButtonRolloverTextColor
;
935 StyleSettings::SetDefaultActionButtonRolloverTextColor( const Color
& rColor
)
938 mxData
->maDefaultActionButtonRolloverTextColor
= rColor
;
942 StyleSettings::GetDefaultActionButtonRolloverTextColor() const
944 return mxData
->maDefaultActionButtonRolloverTextColor
;
948 StyleSettings::SetActionButtonRolloverTextColor( const Color
& rColor
)
951 mxData
->maActionButtonRolloverTextColor
= rColor
;
955 StyleSettings::GetActionButtonRolloverTextColor() const
957 return mxData
->maActionButtonRolloverTextColor
;
961 StyleSettings::SetFlatButtonRolloverTextColor( const Color
& rColor
)
964 mxData
->maFlatButtonRolloverTextColor
= rColor
;
968 StyleSettings::GetFlatButtonRolloverTextColor() const
970 return mxData
->maFlatButtonRolloverTextColor
;
974 StyleSettings::SetDefaultButtonPressedRolloverTextColor( const Color
& rColor
)
977 mxData
->maDefaultButtonPressedRolloverTextColor
= rColor
;
981 StyleSettings::GetDefaultButtonPressedRolloverTextColor() const
983 return mxData
->maDefaultButtonPressedRolloverTextColor
;
987 StyleSettings::SetButtonPressedRolloverTextColor( const Color
& rColor
)
990 mxData
->maButtonPressedRolloverTextColor
= rColor
;
994 StyleSettings::GetButtonPressedRolloverTextColor() const
996 return mxData
->maButtonPressedRolloverTextColor
;
1000 StyleSettings::SetDefaultActionButtonPressedRolloverTextColor( const Color
& rColor
)
1003 mxData
->maDefaultActionButtonPressedRolloverTextColor
= rColor
;
1007 StyleSettings::GetDefaultActionButtonPressedRolloverTextColor() const
1009 return mxData
->maDefaultActionButtonPressedRolloverTextColor
;
1013 StyleSettings::SetActionButtonPressedRolloverTextColor( const Color
& rColor
)
1016 mxData
->maActionButtonPressedRolloverTextColor
= rColor
;
1020 StyleSettings::GetActionButtonPressedRolloverTextColor() const
1022 return mxData
->maActionButtonPressedRolloverTextColor
;
1026 StyleSettings::SetFlatButtonPressedRolloverTextColor( const Color
& rColor
)
1029 mxData
->maFlatButtonPressedRolloverTextColor
= rColor
;
1033 StyleSettings::GetFlatButtonPressedRolloverTextColor() const
1035 return mxData
->maFlatButtonPressedRolloverTextColor
;
1039 StyleSettings::SetRadioCheckTextColor( const Color
& rColor
)
1042 mxData
->maRadioCheckTextColor
= rColor
;
1046 StyleSettings::GetRadioCheckTextColor() const
1048 return mxData
->maRadioCheckTextColor
;
1052 StyleSettings::SetGroupTextColor( const Color
& rColor
)
1055 mxData
->maGroupTextColor
= rColor
;
1059 StyleSettings::GetGroupTextColor() const
1061 return mxData
->maGroupTextColor
;
1065 StyleSettings::SetLabelTextColor( const Color
& rColor
)
1068 mxData
->maLabelTextColor
= rColor
;
1072 StyleSettings::GetLabelTextColor() const
1074 return mxData
->maLabelTextColor
;
1078 StyleSettings::SetWindowColor( const Color
& rColor
)
1081 mxData
->maWindowColor
= rColor
;
1085 StyleSettings::GetWindowColor() const
1087 return mxData
->maWindowColor
;
1091 StyleSettings::SetWindowTextColor( const Color
& rColor
)
1094 mxData
->maWindowTextColor
= rColor
;
1098 StyleSettings::GetWindowTextColor() const
1100 return mxData
->maWindowTextColor
;
1104 StyleSettings::SetDialogColor( const Color
& rColor
)
1107 mxData
->maDialogColor
= rColor
;
1111 StyleSettings::GetDialogColor() const
1113 return mxData
->maDialogColor
;
1117 StyleSettings::SetDialogTextColor( const Color
& rColor
)
1120 mxData
->maDialogTextColor
= rColor
;
1124 StyleSettings::GetDialogTextColor() const
1126 return mxData
->maDialogTextColor
;
1130 StyleSettings::SetWorkspaceColor( const Color
& rColor
)
1133 mxData
->maWorkspaceColor
= rColor
;
1137 StyleSettings::GetWorkspaceColor() const
1139 return mxData
->maWorkspaceColor
;
1143 StyleSettings::SetFieldColor( const Color
& rColor
)
1146 mxData
->maFieldColor
= rColor
;
1150 StyleSettings::GetFieldColor() const
1152 return mxData
->maFieldColor
;
1156 StyleSettings::SetFieldTextColor( const Color
& rColor
)
1159 mxData
->maFieldTextColor
= rColor
;
1163 StyleSettings::GetFieldTextColor() const
1165 return mxData
->maFieldTextColor
;
1169 StyleSettings::SetFieldRolloverTextColor( const Color
& rColor
)
1172 mxData
->maFieldRolloverTextColor
= rColor
;
1176 StyleSettings::GetFieldRolloverTextColor() const
1178 return mxData
->maFieldRolloverTextColor
;
1182 StyleSettings::SetActiveColor( const Color
& rColor
)
1185 mxData
->maActiveColor
= rColor
;
1189 StyleSettings::GetActiveColor() const
1191 return mxData
->maActiveColor
;
1195 StyleSettings::SetActiveTextColor( const Color
& rColor
)
1198 mxData
->maActiveTextColor
= rColor
;
1202 StyleSettings::GetActiveTextColor() const
1204 return mxData
->maActiveTextColor
;
1208 StyleSettings::SetActiveBorderColor( const Color
& rColor
)
1211 mxData
->maActiveBorderColor
= rColor
;
1215 StyleSettings::GetActiveBorderColor() const
1217 return mxData
->maActiveBorderColor
;
1221 StyleSettings::SetDeactiveColor( const Color
& rColor
)
1224 mxData
->maDeactiveColor
= rColor
;
1228 StyleSettings::GetDeactiveColor() const
1230 return mxData
->maDeactiveColor
;
1234 StyleSettings::SetDeactiveTextColor( const Color
& rColor
)
1237 mxData
->maDeactiveTextColor
= rColor
;
1241 StyleSettings::GetDeactiveTextColor() const
1243 return mxData
->maDeactiveTextColor
;
1247 StyleSettings::SetDeactiveBorderColor( const Color
& rColor
)
1250 mxData
->maDeactiveBorderColor
= rColor
;
1254 StyleSettings::GetDeactiveBorderColor() const
1256 return mxData
->maDeactiveBorderColor
;
1260 StyleSettings::SetAccentColor( const Color
& rColor
)
1263 mxData
->maAccentColor
= rColor
;
1267 StyleSettings::GetAccentColor() const
1269 return mxData
->maAccentColor
;
1273 StyleSettings::SetHighlightColor( const Color
& rColor
)
1276 mxData
->maHighlightColor
= rColor
;
1280 StyleSettings::GetHighlightColor() const
1282 return mxData
->maHighlightColor
;
1286 StyleSettings::SetHighlightTextColor( const Color
& rColor
)
1289 mxData
->maHighlightTextColor
= rColor
;
1293 StyleSettings::GetHighlightTextColor() const
1295 return mxData
->maHighlightTextColor
;
1299 StyleSettings::SetDisableColor( const Color
& rColor
)
1302 mxData
->maDisableColor
= rColor
;
1306 StyleSettings::GetDisableColor() const
1308 return mxData
->maDisableColor
;
1312 StyleSettings::SetHelpColor( const Color
& rColor
)
1315 mxData
->maHelpColor
= rColor
;
1319 StyleSettings::GetHelpColor() const
1321 return mxData
->maHelpColor
;
1325 StyleSettings::SetHelpTextColor( const Color
& rColor
)
1328 mxData
->maHelpTextColor
= rColor
;
1332 StyleSettings::GetHelpTextColor() const
1334 return mxData
->maHelpTextColor
;
1338 StyleSettings::SetMenuColor( const Color
& rColor
)
1341 mxData
->maMenuColor
= rColor
;
1345 StyleSettings::GetMenuColor() const
1347 return mxData
->maMenuColor
;
1351 StyleSettings::SetMenuBarColor( const Color
& rColor
)
1354 mxData
->maMenuBarColor
= rColor
;
1358 StyleSettings::GetMenuBarColor() const
1360 return mxData
->maMenuBarColor
;
1364 StyleSettings::SetMenuBarRolloverColor( const Color
& rColor
)
1367 mxData
->maMenuBarRolloverColor
= rColor
;
1371 StyleSettings::GetMenuBarRolloverColor() const
1373 return mxData
->maMenuBarRolloverColor
;
1377 StyleSettings::SetMenuBorderColor( const Color
& rColor
)
1380 mxData
->maMenuBorderColor
= rColor
;
1384 StyleSettings::GetMenuBorderColor() const
1386 return mxData
->maMenuBorderColor
;
1390 StyleSettings::SetMenuTextColor( const Color
& rColor
)
1393 mxData
->maMenuTextColor
= rColor
;
1397 StyleSettings::GetMenuTextColor() const
1399 return mxData
->maMenuTextColor
;
1403 StyleSettings::SetMenuBarTextColor( const Color
& rColor
)
1406 mxData
->maMenuBarTextColor
= rColor
;
1410 StyleSettings::GetMenuBarTextColor() const
1412 return mxData
->maMenuBarTextColor
;
1416 StyleSettings::SetMenuBarRolloverTextColor( const Color
& rColor
)
1419 mxData
->maMenuBarRolloverTextColor
= rColor
;
1423 StyleSettings::GetMenuBarRolloverTextColor() const
1425 return mxData
->maMenuBarRolloverTextColor
;
1429 StyleSettings::SetMenuBarHighlightTextColor( const Color
& rColor
)
1432 mxData
->maMenuBarHighlightTextColor
= rColor
;
1436 StyleSettings::GetMenuBarHighlightTextColor() const
1438 return mxData
->maMenuBarHighlightTextColor
;
1442 StyleSettings::SetMenuHighlightColor( const Color
& rColor
)
1445 mxData
->maMenuHighlightColor
= rColor
;
1449 StyleSettings::GetMenuHighlightColor() const
1451 return mxData
->maMenuHighlightColor
;
1455 StyleSettings::SetMenuHighlightTextColor( const Color
& rColor
)
1458 mxData
->maMenuHighlightTextColor
= rColor
;
1462 StyleSettings::GetMenuHighlightTextColor() const
1464 return mxData
->maMenuHighlightTextColor
;
1468 StyleSettings::SetListBoxWindowBackgroundColor( const Color
& rColor
)
1471 mxData
->maListBoxWindowBackgroundColor
= rColor
;
1475 StyleSettings::GetListBoxWindowBackgroundColor() const
1477 return mxData
->maListBoxWindowBackgroundColor
;
1481 StyleSettings::SetListBoxWindowTextColor( const Color
& rColor
)
1484 mxData
->maListBoxWindowTextColor
= rColor
;
1488 StyleSettings::GetListBoxWindowTextColor() const
1490 return mxData
->maListBoxWindowTextColor
;
1494 StyleSettings::SetListBoxWindowHighlightColor( const Color
& rColor
)
1497 mxData
->maListBoxWindowHighlightColor
= rColor
;
1501 StyleSettings::GetListBoxWindowHighlightColor() const
1503 return mxData
->maListBoxWindowHighlightColor
;
1507 StyleSettings::SetListBoxWindowHighlightTextColor( const Color
& rColor
)
1510 mxData
->maListBoxWindowHighlightTextColor
= rColor
;
1514 StyleSettings::GetListBoxWindowHighlightTextColor() const
1516 return mxData
->maListBoxWindowHighlightTextColor
;
1520 StyleSettings::SetTabTextColor( const Color
& rColor
)
1523 mxData
->maTabTextColor
= rColor
;
1527 StyleSettings::GetTabTextColor() const
1529 return mxData
->maTabTextColor
;
1533 StyleSettings::SetTabRolloverTextColor( const Color
& rColor
)
1536 mxData
->maTabRolloverTextColor
= rColor
;
1540 StyleSettings::GetTabRolloverTextColor() const
1542 return mxData
->maTabRolloverTextColor
;
1546 StyleSettings::SetTabHighlightTextColor( const Color
& rColor
)
1549 mxData
->maTabHighlightTextColor
= rColor
;
1553 StyleSettings::GetTabHighlightTextColor() const
1555 return mxData
->maTabHighlightTextColor
;
1559 StyleSettings::SetLinkColor( const Color
& rColor
)
1562 mxData
->maLinkColor
= rColor
;
1566 StyleSettings::GetLinkColor() const
1568 return mxData
->maLinkColor
;
1572 StyleSettings::SetVisitedLinkColor( const Color
& rColor
)
1575 mxData
->maVisitedLinkColor
= rColor
;
1579 StyleSettings::GetVisitedLinkColor() const
1581 return mxData
->maVisitedLinkColor
;
1585 StyleSettings::SetToolTextColor( const Color
& rColor
)
1588 mxData
->maToolTextColor
= rColor
;
1592 StyleSettings::GetToolTextColor() const
1594 return mxData
->maToolTextColor
;
1598 StyleSettings::SetMonoColor( const Color
& rColor
)
1601 mxData
->maMonoColor
= rColor
;
1605 StyleSettings::GetMonoColor() const
1607 return mxData
->maMonoColor
;
1611 StyleSettings::SetActiveTabColor( const Color
& rColor
)
1614 mxData
->maActiveTabColor
= rColor
;
1618 StyleSettings::GetActiveTabColor() const
1620 return mxData
->maActiveTabColor
;
1624 StyleSettings::SetInactiveTabColor( const Color
& rColor
)
1627 mxData
->maInactiveTabColor
= rColor
;
1631 StyleSettings::GetInactiveTabColor() const
1633 return mxData
->maInactiveTabColor
;
1636 void StyleSettings::SetAlternatingRowColor(const Color
& rColor
)
1639 mxData
->maAlternatingRowColor
= rColor
;
1643 StyleSettings::GetAlternatingRowColor() const
1645 return mxData
->maAlternatingRowColor
;
1649 StyleSettings::SetUseSystemUIFonts( bool bUseSystemUIFonts
)
1652 mxData
->mbUseSystemUIFonts
= bUseSystemUIFonts
;
1656 StyleSettings::GetUseSystemUIFonts() const
1658 return mxData
->mbUseSystemUIFonts
;
1661 void StyleSettings::SetUseFontAAFromSystem(bool bUseFontAAFromSystem
)
1664 mxData
->mbUseFontAAFromSystem
= bUseFontAAFromSystem
;
1667 bool StyleSettings::GetUseFontAAFromSystem() const
1669 return mxData
->mbUseFontAAFromSystem
;
1673 StyleSettings::SetUseFlatBorders( bool bUseFlatBorders
)
1676 mxData
->mnUseFlatBorders
= bUseFlatBorders
;
1680 StyleSettings::GetUseFlatBorders() const
1682 return mxData
->mnUseFlatBorders
;
1686 StyleSettings::SetUseFlatMenus( bool bUseFlatMenus
)
1689 mxData
->mnUseFlatMenus
= bUseFlatMenus
;
1693 StyleSettings::GetUseFlatMenus() const
1695 return mxData
->mnUseFlatMenus
;
1699 StyleSettings::SetUseImagesInMenus( TriState eUseImagesInMenus
)
1702 mxData
->meUseImagesInMenus
= eUseImagesInMenus
;
1706 StyleSettings::SetPreferredUseImagesInMenus( bool bPreferredUseImagesInMenus
)
1709 mxData
->mbPreferredUseImagesInMenus
= bPreferredUseImagesInMenus
;
1713 StyleSettings::GetPreferredUseImagesInMenus() const
1715 return mxData
->mbPreferredUseImagesInMenus
;
1719 StyleSettings::SetSkipDisabledInMenus( bool bSkipDisabledInMenus
)
1722 mxData
->mbSkipDisabledInMenus
= bSkipDisabledInMenus
;
1726 StyleSettings::GetSkipDisabledInMenus() const
1728 return mxData
->mbSkipDisabledInMenus
;
1732 StyleSettings::SetHideDisabledMenuItems( bool bHideDisabledMenuItems
)
1735 mxData
->mbHideDisabledMenuItems
= bHideDisabledMenuItems
;
1739 StyleSettings::GetHideDisabledMenuItems() const
1741 return mxData
->mbHideDisabledMenuItems
;
1745 StyleSettings::SetContextMenuShortcuts( TriState eContextMenuShortcuts
)
1748 mxData
->meContextMenuShortcuts
= eContextMenuShortcuts
;
1752 StyleSettings::GetContextMenuShortcuts() const
1754 switch (mxData
->meContextMenuShortcuts
)
1756 case TRISTATE_FALSE
:
1760 default: // TRISTATE_INDET:
1761 return GetPreferredContextMenuShortcuts();
1766 StyleSettings::SetPreferredContextMenuShortcuts( bool bContextMenuShortcuts
)
1769 mxData
->mbPreferredContextMenuShortcuts
= bContextMenuShortcuts
;
1773 StyleSettings::GetPreferredContextMenuShortcuts() const
1775 return mxData
->mbPreferredContextMenuShortcuts
;
1779 StyleSettings::SetPrimaryButtonWarpsSlider( bool bPrimaryButtonWarpsSlider
)
1782 mxData
->mbPrimaryButtonWarpsSlider
= bPrimaryButtonWarpsSlider
;
1786 StyleSettings::GetPrimaryButtonWarpsSlider() const
1788 return mxData
->mbPrimaryButtonWarpsSlider
;
1792 StyleSettings::SetAppFont( const vcl::Font
& rFont
)
1795 mxData
->maAppFont
= rFont
;
1799 StyleSettings::GetAppFont() const
1801 return mxData
->maAppFont
;
1805 StyleSettings::SetHelpFont( const vcl::Font
& rFont
)
1808 mxData
->maHelpFont
= rFont
;
1812 StyleSettings::GetHelpFont() const
1814 return mxData
->maHelpFont
;
1818 StyleSettings::SetTitleFont( const vcl::Font
& rFont
)
1821 mxData
->maTitleFont
= rFont
;
1825 StyleSettings::GetTitleFont() const
1827 return mxData
->maTitleFont
;
1831 StyleSettings::SetFloatTitleFont( const vcl::Font
& rFont
)
1834 mxData
->maFloatTitleFont
= rFont
;
1838 StyleSettings::GetFloatTitleFont() const
1840 return mxData
->maFloatTitleFont
;
1844 StyleSettings::SetMenuFont( const vcl::Font
& rFont
)
1847 mxData
->maMenuFont
= rFont
;
1851 StyleSettings::GetMenuFont() const
1853 return mxData
->maMenuFont
;
1857 StyleSettings::SetToolFont( const vcl::Font
& rFont
)
1860 mxData
->maToolFont
= rFont
;
1864 StyleSettings::GetToolFont() const
1866 return mxData
->maToolFont
;
1870 StyleSettings::SetGroupFont( const vcl::Font
& rFont
)
1873 mxData
->maGroupFont
= rFont
;
1877 StyleSettings::GetGroupFont() const
1879 return mxData
->maGroupFont
;
1883 StyleSettings::SetLabelFont( const vcl::Font
& rFont
)
1886 mxData
->maLabelFont
= rFont
;
1890 StyleSettings::GetLabelFont() const
1892 return mxData
->maLabelFont
;
1896 StyleSettings::SetRadioCheckFont( const vcl::Font
& rFont
)
1899 mxData
->maRadioCheckFont
= rFont
;
1903 StyleSettings::GetRadioCheckFont() const
1905 return mxData
->maRadioCheckFont
;
1909 StyleSettings::SetPushButtonFont( const vcl::Font
& rFont
)
1912 mxData
->maPushButtonFont
= rFont
;
1916 StyleSettings::GetPushButtonFont() const
1918 return mxData
->maPushButtonFont
;
1922 StyleSettings::SetFieldFont( const vcl::Font
& rFont
)
1925 mxData
->maFieldFont
= rFont
;
1929 StyleSettings::GetFieldFont() const
1931 return mxData
->maFieldFont
;
1935 StyleSettings::SetIconFont( const vcl::Font
& rFont
)
1938 mxData
->maIconFont
= rFont
;
1942 StyleSettings::GetIconFont() const
1944 return mxData
->maIconFont
;
1948 StyleSettings::SetTabFont( const vcl::Font
& rFont
)
1951 mxData
->maTabFont
= rFont
;
1955 StyleSettings::GetTabFont() const
1957 return mxData
->maTabFont
;
1961 StyleSettings::GetBorderSize()
1967 StyleSettings::SetTitleHeight( sal_Int32 nSize
)
1970 mxData
->mnTitleHeight
= nSize
;
1974 StyleSettings::GetTitleHeight() const
1976 return mxData
->mnTitleHeight
;
1980 StyleSettings::SetFloatTitleHeight( sal_Int32 nSize
)
1983 mxData
->mnFloatTitleHeight
= nSize
;
1987 StyleSettings::GetFloatTitleHeight() const
1989 return mxData
->mnFloatTitleHeight
;
1993 StyleSettings::SetScrollBarSize( sal_Int32 nSize
)
1996 mxData
->mnScrollBarSize
= nSize
;
2000 StyleSettings::GetScrollBarSize() const
2002 return mxData
->mnScrollBarSize
;
2006 StyleSettings::SetMinThumbSize( sal_Int32 nSize
)
2009 mxData
->mnMinThumbSize
= nSize
;
2013 StyleSettings::GetMinThumbSize() const
2015 return mxData
->mnMinThumbSize
;
2019 StyleSettings::SetSpinSize( sal_Int32 nSize
)
2022 mxData
->mnSpinSize
= nSize
;
2026 StyleSettings::GetSpinSize() const
2028 return mxData
->mnSpinSize
;
2032 StyleSettings::GetSplitSize()
2038 StyleSettings::SetCursorSize( sal_Int32 nSize
)
2041 mxData
->mnCursorSize
= nSize
;
2045 StyleSettings::GetCursorSize() const
2047 return mxData
->mnCursorSize
;
2051 StyleSettings::SetCursorBlinkTime( sal_uInt64 nBlinkTime
)
2054 mxData
->mnCursorBlinkTime
= nBlinkTime
;
2058 StyleSettings::GetCursorBlinkTime() const
2060 return mxData
->mnCursorBlinkTime
;
2064 StyleSettings::SetDragFullOptions( DragFullOptions nOptions
)
2067 mxData
->mnDragFullOptions
= nOptions
;
2071 StyleSettings::GetDragFullOptions() const
2073 return mxData
->mnDragFullOptions
;
2077 StyleSettings::SetSelectionOptions( SelectionOptions nOptions
)
2080 mxData
->mnSelectionOptions
= nOptions
;
2084 StyleSettings::GetSelectionOptions() const
2086 return mxData
->mnSelectionOptions
;
2090 StyleSettings::SetDisplayOptions( DisplayOptions nOptions
)
2093 mxData
->mnDisplayOptions
= nOptions
;
2097 StyleSettings::GetDisplayOptions() const
2099 return mxData
->mnDisplayOptions
;
2103 StyleSettings::SetAntialiasingMinPixelHeight( sal_Int32 nMinPixel
)
2106 mxData
->mnAntialiasedMin
= nMinPixel
;
2110 StyleSettings::GetAntialiasingMinPixelHeight() const
2112 return mxData
->mnAntialiasedMin
;
2116 StyleSettings::SetOptions( StyleSettingsOptions nOptions
)
2119 mxData
->mnOptions
= nOptions
;
2123 StyleSettings::SetAutoMnemonic( bool bAutoMnemonic
)
2126 mxData
->mbAutoMnemonic
= bAutoMnemonic
;
2130 StyleSettings::GetAutoMnemonic() const
2132 return mxData
->mbAutoMnemonic
;
2136 StyleSettings::GetDockingFloatsSupported()
2138 ImplSVData
* pSVData
= ImplGetSVData();
2139 return pSVData
->maNWFData
.mbCanDetermineWindowPosition
;
2143 StyleSettings::SetToolbarIconSize( ToolbarIconSize nSize
)
2146 mxData
->mnToolbarIconSize
= nSize
;
2150 StyleSettings::GetToolbarIconSize() const
2152 return mxData
->mnToolbarIconSize
;
2155 Size
StyleSettings::GetToolbarIconSizePixel() const
2157 switch (GetToolbarIconSize())
2159 case ToolbarIconSize::Large
:
2160 return Size(24, 24);
2161 case ToolbarIconSize::Size32
:
2162 return Size(32, 32);
2163 case ToolbarIconSize::Small
:
2165 return Size(16, 16);
2170 StyleSettings::GetDialogStyle() const
2172 return mxData
->maDialogStyle
;
2176 StyleSettings::SetEdgeBlending(sal_uInt16 nCount
)
2179 mxData
->mnEdgeBlending
= nCount
;
2183 StyleSettings::GetEdgeBlending() const
2185 return mxData
->mnEdgeBlending
;
2189 StyleSettings::GetEdgeBlendingTopLeftColor() const
2191 return mxData
->maEdgeBlendingTopLeftColor
;
2195 StyleSettings::GetEdgeBlendingBottomRightColor() const
2197 return mxData
->maEdgeBlendingBottomRightColor
;
2201 StyleSettings::SetListBoxMaximumLineCount(sal_uInt16 nCount
)
2204 mxData
->mnListBoxMaximumLineCount
= nCount
;
2208 StyleSettings::GetListBoxMaximumLineCount() const
2210 return mxData
->mnListBoxMaximumLineCount
;
2214 StyleSettings::SetColorValueSetColumnCount(sal_uInt16 nCount
)
2217 mxData
->mnColorValueSetColumnCount
= nCount
;
2221 StyleSettings::GetColorValueSetColumnCount() const
2223 return mxData
->mnColorValueSetColumnCount
;
2227 StyleSettings::GetListBoxPreviewDefaultLineWidth()
2233 StyleSettings::SetPreviewUsesCheckeredBackground(bool bNew
)
2236 mxData
->mbPreviewUsesCheckeredBackground
= bNew
;
2240 StyleSettings::GetPreviewUsesCheckeredBackground() const
2242 return mxData
->mbPreviewUsesCheckeredBackground
;
2246 StyleSettings::operator !=( const StyleSettings
& rSet
) const
2248 return !(*this == rSet
);
2251 void StyleSettings::SetListBoxPreviewDefaultLogicSize(Size
const& rSize
)
2253 mxData
->maListBoxPreviewDefaultLogicSize
= rSize
;
2256 const Size
& StyleSettings::GetListBoxPreviewDefaultPixelSize() const
2258 if(0 == mxData
->maListBoxPreviewDefaultPixelSize
.Width() || 0 == mxData
->maListBoxPreviewDefaultPixelSize
.Height())
2260 const_cast< StyleSettings
* >(this)->mxData
->maListBoxPreviewDefaultPixelSize
=
2261 Application::GetDefaultDevice()->LogicToPixel(mxData
->maListBoxPreviewDefaultLogicSize
, MapMode(MapUnit::MapAppFont
));
2264 return mxData
->maListBoxPreviewDefaultPixelSize
;
2267 void StyleSettings::Set3DColors( const Color
& rColor
)
2270 mxData
->maFaceColor
= rColor
;
2271 mxData
->maLightBorderColor
= rColor
;
2272 mxData
->maMenuBorderColor
= rColor
;
2273 mxData
->maDarkShadowColor
= COL_BLACK
;
2274 if ( rColor
!= COL_LIGHTGRAY
)
2276 mxData
->maLightColor
= rColor
;
2277 mxData
->maShadowColor
= rColor
;
2278 mxData
->maDarkShadowColor
= rColor
;
2280 if (!rColor
.IsDark())
2282 mxData
->maLightColor
.IncreaseLuminance(64);
2283 mxData
->maShadowColor
.DecreaseLuminance(64);
2284 mxData
->maDarkShadowColor
.DecreaseLuminance(100);
2288 mxData
->maLightColor
.DecreaseLuminance(64);
2289 mxData
->maShadowColor
.IncreaseLuminance(64);
2290 mxData
->maDarkShadowColor
.IncreaseLuminance(100);
2293 sal_uInt8 nRed
= (mxData
->maLightColor
.GetRed() + mxData
->maShadowColor
.GetRed()) / 2;
2294 sal_uInt8 nGreen
= (mxData
->maLightColor
.GetGreen() + mxData
->maShadowColor
.GetGreen()) / 2;
2295 sal_uInt8 nBlue
= (mxData
->maLightColor
.GetBlue() + mxData
->maShadowColor
.GetBlue()) / 2;
2296 mxData
->maCheckedColor
= Color(nRed
, nGreen
, nBlue
);
2300 mxData
->maCheckedColor
= Color( 0x99, 0x99, 0x99 );
2301 mxData
->maLightColor
= COL_WHITE
;
2302 mxData
->maShadowColor
= COL_GRAY
;
2306 void StyleSettings::SetCheckedColorSpecialCase( )
2309 // Light gray checked color special case
2310 if ( GetFaceColor() == COL_LIGHTGRAY
)
2311 mxData
->maCheckedColor
= Color( 0xCC, 0xCC, 0xCC );
2314 sal_uInt8 nRed
= static_cast<sal_uInt8
>((static_cast<sal_uInt16
>(mxData
->maFaceColor
.GetRed()) + static_cast<sal_uInt16
>(mxData
->maLightColor
.GetRed()))/2);
2315 sal_uInt8 nGreen
= static_cast<sal_uInt8
>((static_cast<sal_uInt16
>(mxData
->maFaceColor
.GetGreen()) + static_cast<sal_uInt16
>(mxData
->maLightColor
.GetGreen()))/2);
2316 sal_uInt8 nBlue
= static_cast<sal_uInt8
>((static_cast<sal_uInt16
>(mxData
->maFaceColor
.GetBlue()) + static_cast<sal_uInt16
>(mxData
->maLightColor
.GetBlue()))/2);
2317 mxData
->maCheckedColor
= Color( nRed
, nGreen
, nBlue
);
2321 bool StyleSettings::GetUseImagesInMenus() const
2323 // icon mode selected in Tools -> Options... -> OpenOffice.org -> View
2324 switch (mxData
->meUseImagesInMenus
) {
2325 case TRISTATE_FALSE
:
2329 default: // TRISTATE_INDET:
2330 return GetPreferredUseImagesInMenus();
2334 static BitmapEx
readBitmapEx( const OUString
& rPath
)
2336 OUString
aPath( rPath
);
2337 rtl::Bootstrap::expandMacros( aPath
);
2341 if ( GraphicFilter::LoadGraphic( aPath
, OUString(), aGraphic
) != ERRCODE_NONE
)
2343 return aGraphic
.GetBitmapEx();
2348 enum WhichPersona
{ PERSONA_HEADER
, PERSONA_FOOTER
};
2352 /** Update the setting of the Persona header / footer in ImplStyleData */
2353 static void setupPersonaHeaderFooter( WhichPersona eWhich
, OUString
& rHeaderFooter
, BitmapEx
& rHeaderFooterBitmap
, std::optional
<Color
>& rMenuBarTextColor
)
2355 // don't burn time loading images we don't need.
2356 if ( Application::IsHeadlessModeEnabled() )
2359 // read from the configuration
2360 OUString
aPersona( officecfg::Office::Common::Misc::Persona::get() );
2361 OUString
aPersonaSettings( officecfg::Office::Common::Misc::PersonaSettings::get() );
2363 // have the settings changed? marks if header /footer prepared before
2364 //should maybe extended to a flag that marks if header /footer /both are loaded
2365 OUString aOldValue
= eWhich
==PERSONA_HEADER
?OUString(aPersona
+ ";" + aPersonaSettings
+";h" ):OUString(aPersona
+ ";" + aPersonaSettings
+";f" );
2366 if ( rHeaderFooter
== aOldValue
)
2369 rHeaderFooter
= aOldValue
;
2370 rHeaderFooterBitmap
= BitmapEx();
2371 rMenuBarTextColor
.reset();
2373 // now read the new values and setup bitmaps
2374 OUString aHeader
, aFooter
;
2375 if ( aPersona
== "own" || aPersona
== "default" )
2377 sal_Int32 nIndex
= 0;
2379 // Skip the persona slug, name, and preview
2380 aHeader
= aPersonaSettings
.getToken( 3, ';', nIndex
);
2383 aFooter
= aPersonaSettings
.getToken( 0, ';', nIndex
);
2385 // change menu text color, advance nIndex to skip the '#'
2388 OUString aColor
= aPersonaSettings
.getToken( 0, ';', ++nIndex
);
2389 rMenuBarTextColor
= Color( ColorTransparency
, aColor
.toUInt32( 16 ) );
2395 case PERSONA_HEADER
: aName
= aHeader
; break;
2396 case PERSONA_FOOTER
: aName
= aFooter
; break;
2399 if ( !aName
.isEmpty() )
2401 OUString
gallery("");
2402 // try the gallery first, then the program path:
2403 if ( aPersona
== "own" && !aPersonaSettings
.startsWith( "vnd.sun.star.expand" ) )
2405 gallery
= "${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER
"/" SAL_CONFIGFILE( "bootstrap") "::UserInstallation}";
2406 rtl::Bootstrap::expandMacros( gallery
);
2407 gallery
+= "/user/gallery/personas/";
2409 else if ( aPersona
== "default" )
2411 gallery
= "$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER
"/gallery/personas/";
2413 rHeaderFooterBitmap
= readBitmapEx( gallery
+ aName
);
2415 if ( rHeaderFooterBitmap
.IsEmpty() )
2416 rHeaderFooterBitmap
= readBitmapEx( "$BRAND_BASE_DIR/" LIBO_ETC_FOLDER
"/" + aName
);
2419 // Something went wrong. Probably, the images are missing. Clear the persona properties in the registry.
2421 if( rHeaderFooterBitmap
.IsEmpty() )
2423 std::shared_ptr
<comphelper::ConfigurationChanges
> batch(comphelper::ConfigurationChanges::create());
2424 officecfg::Office::Common::Misc::Persona::set( "no", batch
);
2425 officecfg::Office::Common::Misc::PersonaSettings::set( "", batch
);
2430 BitmapEx
const & StyleSettings::GetPersonaHeader() const
2432 setupPersonaHeaderFooter( PERSONA_HEADER
, mxData
->maPersonaHeaderFooter
, mxData
->maPersonaHeaderBitmap
, mxData
->maPersonaMenuBarTextColor
);
2433 return mxData
->maPersonaHeaderBitmap
;
2436 BitmapEx
const & StyleSettings::GetPersonaFooter() const
2438 setupPersonaHeaderFooter( PERSONA_FOOTER
, mxData
->maPersonaHeaderFooter
, mxData
->maPersonaFooterBitmap
, mxData
->maPersonaMenuBarTextColor
);
2439 return mxData
->maPersonaFooterBitmap
;
2442 const std::optional
<Color
>& StyleSettings::GetPersonaMenuBarTextColor() const
2445 return mxData
->maPersonaMenuBarTextColor
;
2448 void StyleSettings::SetStandardStyles()
2451 mxData
->SetStandardStyles();
2454 Color
StyleSettings::GetFaceGradientColor() const
2456 // compute a brighter face color that can be used in gradients
2457 // for a convex look (eg toolbars)
2460 GetFaceColor().RGBtoHSB( h
, s
, b
);
2463 return Color::HSBtoRGB( h
, s
, b
);
2466 Color
StyleSettings::GetSeparatorColor() const
2468 // compute a brighter shadow color for separators (used in toolbars or between menubar and toolbars on Windows XP)
2470 GetShadowColor().RGBtoHSB( h
, s
, b
);
2473 return Color::HSBtoRGB( h
, s
, b
);
2476 void StyleSettings::CopyData()
2478 // copy if other references exist
2479 if (mxData
.use_count() > 1)
2481 mxData
= std::make_shared
<ImplStyleData
>(*mxData
);
2485 bool StyleSettings::operator ==( const StyleSettings
& rSet
) const
2487 if ( mxData
== rSet
.mxData
)
2490 if (mxData
->mIconTheme
!= rSet
.mxData
->mIconTheme
) {
2494 if (*mxData
->mIconThemeSelector
!= *rSet
.mxData
->mIconThemeSelector
) {
2498 return (mxData
->mnOptions
== rSet
.mxData
->mnOptions
) &&
2499 (mxData
->mbAutoMnemonic
== rSet
.mxData
->mbAutoMnemonic
) &&
2500 (mxData
->mnDragFullOptions
== rSet
.mxData
->mnDragFullOptions
) &&
2501 (mxData
->mnSelectionOptions
== rSet
.mxData
->mnSelectionOptions
) &&
2502 (mxData
->mnDisplayOptions
== rSet
.mxData
->mnDisplayOptions
) &&
2503 (mxData
->mnCursorSize
== rSet
.mxData
->mnCursorSize
) &&
2504 (mxData
->mnCursorBlinkTime
== rSet
.mxData
->mnCursorBlinkTime
) &&
2505 (mxData
->mnTitleHeight
== rSet
.mxData
->mnTitleHeight
) &&
2506 (mxData
->mnFloatTitleHeight
== rSet
.mxData
->mnFloatTitleHeight
) &&
2507 (mxData
->mnScrollBarSize
== rSet
.mxData
->mnScrollBarSize
) &&
2508 (mxData
->mnMinThumbSize
== rSet
.mxData
->mnMinThumbSize
) &&
2509 (mxData
->mnSpinSize
== rSet
.mxData
->mnSpinSize
) &&
2510 (mxData
->mnAntialiasedMin
== rSet
.mxData
->mnAntialiasedMin
) &&
2511 (mxData
->mbHighContrast
== rSet
.mxData
->mbHighContrast
) &&
2512 (mxData
->mbUseSystemUIFonts
== rSet
.mxData
->mbUseSystemUIFonts
) &&
2513 (mxData
->mbUseFontAAFromSystem
== rSet
.mxData
->mbUseFontAAFromSystem
) &&
2514 (mxData
->mnUseFlatBorders
== rSet
.mxData
->mnUseFlatBorders
) &&
2515 (mxData
->mnUseFlatMenus
== rSet
.mxData
->mnUseFlatMenus
) &&
2516 (mxData
->maFaceColor
== rSet
.mxData
->maFaceColor
) &&
2517 (mxData
->maCheckedColor
== rSet
.mxData
->maCheckedColor
) &&
2518 (mxData
->maLightColor
== rSet
.mxData
->maLightColor
) &&
2519 (mxData
->maLightBorderColor
== rSet
.mxData
->maLightBorderColor
) &&
2520 (mxData
->maShadowColor
== rSet
.mxData
->maShadowColor
) &&
2521 (mxData
->maDarkShadowColor
== rSet
.mxData
->maDarkShadowColor
) &&
2522 (mxData
->maWarningColor
== rSet
.mxData
->maWarningColor
) &&
2523 (mxData
->maButtonTextColor
== rSet
.mxData
->maButtonTextColor
) &&
2524 (mxData
->maDefaultActionButtonTextColor
== rSet
.mxData
->maDefaultActionButtonTextColor
) &&
2525 (mxData
->maActionButtonTextColor
== rSet
.mxData
->maActionButtonTextColor
) &&
2526 (mxData
->maButtonRolloverTextColor
== rSet
.mxData
->maButtonRolloverTextColor
) &&
2527 (mxData
->maActionButtonRolloverTextColor
== rSet
.mxData
->maActionButtonRolloverTextColor
) &&
2528 (mxData
->maRadioCheckTextColor
== rSet
.mxData
->maRadioCheckTextColor
) &&
2529 (mxData
->maGroupTextColor
== rSet
.mxData
->maGroupTextColor
) &&
2530 (mxData
->maLabelTextColor
== rSet
.mxData
->maLabelTextColor
) &&
2531 (mxData
->maWindowColor
== rSet
.mxData
->maWindowColor
) &&
2532 (mxData
->maWindowTextColor
== rSet
.mxData
->maWindowTextColor
) &&
2533 (mxData
->maDialogColor
== rSet
.mxData
->maDialogColor
) &&
2534 (mxData
->maDialogTextColor
== rSet
.mxData
->maDialogTextColor
) &&
2535 (mxData
->maWorkspaceColor
== rSet
.mxData
->maWorkspaceColor
) &&
2536 (mxData
->maMonoColor
== rSet
.mxData
->maMonoColor
) &&
2537 (mxData
->maFieldColor
== rSet
.mxData
->maFieldColor
) &&
2538 (mxData
->maFieldTextColor
== rSet
.mxData
->maFieldTextColor
) &&
2539 (mxData
->maActiveColor
== rSet
.mxData
->maActiveColor
) &&
2540 (mxData
->maActiveTextColor
== rSet
.mxData
->maActiveTextColor
) &&
2541 (mxData
->maActiveBorderColor
== rSet
.mxData
->maActiveBorderColor
) &&
2542 (mxData
->maDeactiveColor
== rSet
.mxData
->maDeactiveColor
) &&
2543 (mxData
->maDeactiveTextColor
== rSet
.mxData
->maDeactiveTextColor
) &&
2544 (mxData
->maDeactiveBorderColor
== rSet
.mxData
->maDeactiveBorderColor
) &&
2545 (mxData
->maMenuColor
== rSet
.mxData
->maMenuColor
) &&
2546 (mxData
->maMenuBarColor
== rSet
.mxData
->maMenuBarColor
) &&
2547 (mxData
->maMenuBarRolloverColor
== rSet
.mxData
->maMenuBarRolloverColor
) &&
2548 (mxData
->maMenuBorderColor
== rSet
.mxData
->maMenuBorderColor
) &&
2549 (mxData
->maMenuTextColor
== rSet
.mxData
->maMenuTextColor
) &&
2550 (mxData
->maListBoxWindowBackgroundColor
== rSet
.mxData
->maListBoxWindowBackgroundColor
) &&
2551 (mxData
->maListBoxWindowTextColor
== rSet
.mxData
->maListBoxWindowTextColor
) &&
2552 (mxData
->maListBoxWindowHighlightColor
== rSet
.mxData
->maListBoxWindowHighlightColor
) &&
2553 (mxData
->maListBoxWindowHighlightTextColor
== rSet
.mxData
->maListBoxWindowHighlightTextColor
) &&
2554 (mxData
->maMenuBarTextColor
== rSet
.mxData
->maMenuBarTextColor
) &&
2555 (mxData
->maMenuBarRolloverTextColor
== rSet
.mxData
->maMenuBarRolloverTextColor
) &&
2556 (mxData
->maMenuHighlightColor
== rSet
.mxData
->maMenuHighlightColor
) &&
2557 (mxData
->maMenuHighlightTextColor
== rSet
.mxData
->maMenuHighlightTextColor
) &&
2558 (mxData
->maAccentColor
== rSet
.mxData
->maAccentColor
) &&
2559 (mxData
->maHighlightColor
== rSet
.mxData
->maHighlightColor
) &&
2560 (mxData
->maHighlightTextColor
== rSet
.mxData
->maHighlightTextColor
) &&
2561 (mxData
->maTabTextColor
== rSet
.mxData
->maTabTextColor
) &&
2562 (mxData
->maTabRolloverTextColor
== rSet
.mxData
->maTabRolloverTextColor
) &&
2563 (mxData
->maTabHighlightTextColor
== rSet
.mxData
->maTabHighlightTextColor
) &&
2564 (mxData
->maActiveTabColor
== rSet
.mxData
->maActiveTabColor
) &&
2565 (mxData
->maInactiveTabColor
== rSet
.mxData
->maInactiveTabColor
) &&
2566 (mxData
->maDisableColor
== rSet
.mxData
->maDisableColor
) &&
2567 (mxData
->maHelpColor
== rSet
.mxData
->maHelpColor
) &&
2568 (mxData
->maHelpTextColor
== rSet
.mxData
->maHelpTextColor
) &&
2569 (mxData
->maLinkColor
== rSet
.mxData
->maLinkColor
) &&
2570 (mxData
->maVisitedLinkColor
== rSet
.mxData
->maVisitedLinkColor
) &&
2571 (mxData
->maToolTextColor
== rSet
.mxData
->maToolTextColor
) &&
2572 (mxData
->maAppFont
== rSet
.mxData
->maAppFont
) &&
2573 (mxData
->maHelpFont
== rSet
.mxData
->maHelpFont
) &&
2574 (mxData
->maTitleFont
== rSet
.mxData
->maTitleFont
) &&
2575 (mxData
->maFloatTitleFont
== rSet
.mxData
->maFloatTitleFont
) &&
2576 (mxData
->maMenuFont
== rSet
.mxData
->maMenuFont
) &&
2577 (mxData
->maToolFont
== rSet
.mxData
->maToolFont
) &&
2578 (mxData
->maGroupFont
== rSet
.mxData
->maGroupFont
) &&
2579 (mxData
->maLabelFont
== rSet
.mxData
->maLabelFont
) &&
2580 (mxData
->maRadioCheckFont
== rSet
.mxData
->maRadioCheckFont
) &&
2581 (mxData
->maPushButtonFont
== rSet
.mxData
->maPushButtonFont
) &&
2582 (mxData
->maFieldFont
== rSet
.mxData
->maFieldFont
) &&
2583 (mxData
->maIconFont
== rSet
.mxData
->maIconFont
) &&
2584 (mxData
->maTabFont
== rSet
.mxData
->maTabFont
) &&
2585 (mxData
->meUseImagesInMenus
== rSet
.mxData
->meUseImagesInMenus
) &&
2586 (mxData
->mbPreferredUseImagesInMenus
== rSet
.mxData
->mbPreferredUseImagesInMenus
) &&
2587 (mxData
->mbSkipDisabledInMenus
== rSet
.mxData
->mbSkipDisabledInMenus
) &&
2588 (mxData
->mbHideDisabledMenuItems
== rSet
.mxData
->mbHideDisabledMenuItems
) &&
2589 (mxData
->mbPreferredContextMenuShortcuts
== rSet
.mxData
->mbPreferredContextMenuShortcuts
)&&
2590 (mxData
->meContextMenuShortcuts
== rSet
.mxData
->meContextMenuShortcuts
) &&
2591 (mxData
->mbPrimaryButtonWarpsSlider
== rSet
.mxData
->mbPrimaryButtonWarpsSlider
) &&
2592 (mxData
->mnEdgeBlending
== rSet
.mxData
->mnEdgeBlending
) &&
2593 (mxData
->maEdgeBlendingTopLeftColor
== rSet
.mxData
->maEdgeBlendingTopLeftColor
) &&
2594 (mxData
->maEdgeBlendingBottomRightColor
== rSet
.mxData
->maEdgeBlendingBottomRightColor
) &&
2595 (mxData
->mnListBoxMaximumLineCount
== rSet
.mxData
->mnListBoxMaximumLineCount
) &&
2596 (mxData
->mnColorValueSetColumnCount
== rSet
.mxData
->mnColorValueSetColumnCount
) &&
2597 (mxData
->maListBoxPreviewDefaultLogicSize
== rSet
.mxData
->maListBoxPreviewDefaultLogicSize
) &&
2598 (mxData
->maListBoxPreviewDefaultPixelSize
== rSet
.mxData
->maListBoxPreviewDefaultPixelSize
) &&
2599 (mxData
->mbPreviewUsesCheckeredBackground
== rSet
.mxData
->mbPreviewUsesCheckeredBackground
);
2602 ImplMiscData::ImplMiscData() :
2603 mnEnableATT(TRISTATE_INDET
),
2604 mnDisablePrinting(TRISTATE_INDET
)
2606 static const char* pEnv
= getenv("SAL_DECIMALSEP_ENABLED" ); // set default without UI
2607 mbEnableLocalizedDecimalSep
= (pEnv
!= nullptr);
2610 MiscSettings::MiscSettings()
2611 : mxData(std::make_shared
<ImplMiscData
>())
2615 bool MiscSettings::operator ==( const MiscSettings
& rSet
) const
2617 if ( mxData
== rSet
.mxData
)
2620 return (mxData
->mnEnableATT
== rSet
.mxData
->mnEnableATT
) &&
2621 (mxData
->mnDisablePrinting
== rSet
.mxData
->mnDisablePrinting
) &&
2622 (mxData
->mbEnableLocalizedDecimalSep
== rSet
.mxData
->mbEnableLocalizedDecimalSep
);
2626 MiscSettings::operator !=( const MiscSettings
& rSet
) const
2628 return !(*this == rSet
);
2631 bool MiscSettings::GetDisablePrinting() const
2633 if( mxData
->mnDisablePrinting
== TRISTATE_INDET
)
2636 vcl::SettingsConfigItem::get()->
2637 getValue( "DesktopManagement",
2638 "DisablePrinting" );
2639 mxData
->mnDisablePrinting
= aEnable
.equalsIgnoreAsciiCase("true") ? TRISTATE_TRUE
: TRISTATE_FALSE
;
2642 return mxData
->mnDisablePrinting
!= TRISTATE_FALSE
;
2645 bool MiscSettings::GetEnableATToolSupport() const
2649 if( mxData
->mnEnableATT
== TRISTATE_INDET
)
2651 // Check in the Windows registry if an AT tool wants Accessibility support to
2655 if( ERROR_SUCCESS
== RegOpenKeyW(HKEY_CURRENT_USER
,
2656 L
"Software\\LibreOffice\\Accessibility\\AtToolSupport",
2660 wchar_t Data
[6]; // possible values: "true", "false", "1", "0", DWORD
2661 DWORD cbData
= sizeof(Data
);
2663 if( ERROR_SUCCESS
== RegQueryValueExW(hkey
, L
"SupportAssistiveTechnology",
2664 nullptr, &dwType
, reinterpret_cast<LPBYTE
>(Data
), &cbData
) )
2669 mxData
->mnEnableATT
= ((0 == wcsicmp(Data
, L
"1")) || (0 == wcsicmp(Data
, L
"true"))) ? TRISTATE_TRUE
: TRISTATE_FALSE
;
2672 switch (reinterpret_cast<DWORD
*>(Data
)[0]) {
2674 mxData
->mnEnableATT
= TRISTATE_FALSE
;
2677 mxData
->mnEnableATT
= TRISTATE_TRUE
;
2680 mxData
->mnEnableATT
= TRISTATE_INDET
;
2681 //TODO: or TRISTATE_TRUE?
2686 // Unsupported registry type
2696 if( mxData
->mnEnableATT
== TRISTATE_INDET
)
2698 static const char* pEnv
= getenv("SAL_ACCESSIBILITY_ENABLED" );
2699 if( !pEnv
|| !*pEnv
)
2702 vcl::SettingsConfigItem::get()->
2703 getValue( "Accessibility",
2704 "EnableATToolSupport" );
2705 mxData
->mnEnableATT
= aEnable
.equalsIgnoreAsciiCase("true") ? TRISTATE_TRUE
: TRISTATE_FALSE
;
2709 mxData
->mnEnableATT
= TRISTATE_TRUE
;
2713 return mxData
->mnEnableATT
!= TRISTATE_FALSE
;
2717 void MiscSettings::SetEnableATToolSupport( bool bEnable
)
2719 if ( (bEnable
? TRISTATE_TRUE
: TRISTATE_FALSE
) != mxData
->mnEnableATT
)
2721 if( bEnable
&& !ImplInitAccessBridge() )
2726 // If the accessibility key in the Windows registry exists, change it synchronously
2727 if( ERROR_SUCCESS
== RegOpenKeyW(HKEY_CURRENT_USER
,
2728 L
"Software\\LibreOffice\\Accessibility\\AtToolSupport",
2732 wchar_t Data
[6]; // possible values: "true", "false", 1, 0
2733 DWORD cbData
= sizeof(Data
);
2735 if( ERROR_SUCCESS
== RegQueryValueExW(hkey
, L
"SupportAssistiveTechnology",
2736 nullptr, &dwType
, reinterpret_cast<LPBYTE
>(Data
), &cbData
) )
2741 RegSetValueExW(hkey
, L
"SupportAssistiveTechnology",
2743 reinterpret_cast<const BYTE
*>(bEnable
? L
"true" : L
"false"),
2744 bEnable
? sizeof(L
"true") : sizeof(L
"false"));
2747 reinterpret_cast<DWORD
*>(Data
)[0] = bEnable
? 1 : 0;
2748 RegSetValueExW(hkey
, L
"SupportAssistiveTechnology",
2749 0, dwType
, reinterpret_cast<const BYTE
*>(Data
), sizeof(DWORD
));
2752 // Unsupported registry type
2760 vcl::SettingsConfigItem::get()->
2761 setValue( "Accessibility",
2762 "EnableATToolSupport",
2763 bEnable
? OUString("true") : OUString("false" ) );
2764 mxData
->mnEnableATT
= bEnable
? TRISTATE_TRUE
: TRISTATE_FALSE
;
2769 void MiscSettings::SetEnableLocalizedDecimalSep( bool bEnable
)
2771 // copy if other references exist
2772 if (mxData
.use_count() > 1)
2774 mxData
= std::make_shared
<ImplMiscData
>(*mxData
);
2776 mxData
->mbEnableLocalizedDecimalSep
= bEnable
;
2779 bool MiscSettings::GetEnableLocalizedDecimalSep() const
2781 return mxData
->mbEnableLocalizedDecimalSep
;
2784 int MiscSettings::GetDarkMode()
2786 return officecfg::Office::Common::Misc::Appearance::get();
2789 void MiscSettings::SetDarkMode(int nMode
)
2791 std::shared_ptr
<comphelper::ConfigurationChanges
> batch(comphelper::ConfigurationChanges::create());
2792 officecfg::Office::Common::Misc::Appearance::set(nMode
, batch
);
2795 vcl::Window
*pWin
= Application::GetFirstTopLevelWindow();
2798 pWin
->ImplGetFrame()->UpdateDarkMode();
2799 pWin
= Application::GetNextTopLevelWindow(pWin
);
2803 bool MiscSettings::GetUseDarkMode()
2805 vcl::Window
* pDefWindow
= ImplGetDefaultWindow();
2806 if (pDefWindow
== nullptr)
2808 return pDefWindow
->ImplGetFrame()->GetUseDarkMode();
2811 int MiscSettings::GetAppColorMode()
2813 if (utl::ConfigManager::IsFuzzing())
2815 return officecfg::Office::Common::Misc::ApplicationAppearance::get();
2818 void MiscSettings::SetAppColorMode(int nMode
)
2820 std::shared_ptr
<comphelper::ConfigurationChanges
> batch(comphelper::ConfigurationChanges::create());
2821 officecfg::Office::Common::Misc::ApplicationAppearance::set(nMode
, batch
);
2825 bool MiscSettings::GetUseReducedAnimation()
2827 vcl::Window
* pDefWindow
= ImplGetDefaultWindow();
2828 if (pDefWindow
== nullptr)
2830 return pDefWindow
->ImplGetFrame()->GetUseReducedAnimation();
2833 HelpSettings::HelpSettings()
2834 : mxData(std::make_shared
<ImplHelpData
>())
2838 bool HelpSettings::operator ==( const HelpSettings
& rSet
) const
2840 if ( mxData
== rSet
.mxData
)
2843 return (mxData
->mnTipTimeout
== rSet
.mxData
->mnTipTimeout
);
2847 HelpSettings::GetTipDelay()
2853 HelpSettings::SetTipTimeout( sal_Int32 nTipTimeout
)
2855 // copy if other references exist
2856 if (mxData
.use_count() > 1)
2858 mxData
= std::make_shared
<ImplHelpData
>(*mxData
);
2860 mxData
->mnTipTimeout
= nTipTimeout
;
2864 HelpSettings::GetTipTimeout() const
2866 return mxData
->mnTipTimeout
;
2870 HelpSettings::GetBalloonDelay()
2876 HelpSettings::operator !=( const HelpSettings
& rSet
) const
2878 return !(*this == rSet
);
2881 ImplAllSettingsData::ImplAllSettingsData()
2883 maLocale( LANGUAGE_SYSTEM
),
2884 maUILocale( LANGUAGE_SYSTEM
)
2886 if (!utl::ConfigManager::IsFuzzing())
2887 maMiscSettings
.SetEnableLocalizedDecimalSep( maSysLocale
.GetOptions().IsDecimalSeparatorAsLocale() );
2890 ImplAllSettingsData::ImplAllSettingsData( const ImplAllSettingsData
& rData
) :
2891 maMouseSettings( rData
.maMouseSettings
),
2892 maStyleSettings( rData
.maStyleSettings
),
2893 maMiscSettings( rData
.maMiscSettings
),
2894 maHelpSettings( rData
.maHelpSettings
),
2895 maLocale( rData
.maLocale
),
2896 maUILocale( rData
.maUILocale
)
2898 // Create the cache objects new when their getter is called.
2901 ImplAllSettingsData::~ImplAllSettingsData()
2903 mpLocaleDataWrapper
.reset();
2904 mpUILocaleDataWrapper
.reset();
2905 mpNeutralLocaleDataWrapper
.reset();
2906 mpI18nHelper
.reset();
2907 mpUII18nHelper
.reset();
2910 AllSettings::AllSettings()
2911 : mxData(std::make_shared
<ImplAllSettingsData
>())
2915 void AllSettings::CopyData()
2917 // copy if other references exist
2918 if (mxData
.use_count() > 1)
2920 mxData
= std::make_shared
<ImplAllSettingsData
>(*mxData
);
2925 AllSettingsFlags
AllSettings::Update( AllSettingsFlags nFlags
, const AllSettings
& rSet
)
2928 AllSettingsFlags nChangeFlags
= AllSettingsFlags::NONE
;
2930 if ( nFlags
& AllSettingsFlags::MOUSE
)
2932 if ( mxData
->maMouseSettings
!= rSet
.mxData
->maMouseSettings
)
2935 mxData
->maMouseSettings
= rSet
.mxData
->maMouseSettings
;
2936 nChangeFlags
|= AllSettingsFlags::MOUSE
;
2940 if ( nFlags
& AllSettingsFlags::STYLE
)
2942 if ( mxData
->maStyleSettings
!= rSet
.mxData
->maStyleSettings
)
2945 mxData
->maStyleSettings
= rSet
.mxData
->maStyleSettings
;
2946 nChangeFlags
|= AllSettingsFlags::STYLE
;
2950 if ( nFlags
& AllSettingsFlags::MISC
)
2952 if ( mxData
->maMiscSettings
!= rSet
.mxData
->maMiscSettings
)
2955 mxData
->maMiscSettings
= rSet
.mxData
->maMiscSettings
;
2956 nChangeFlags
|= AllSettingsFlags::MISC
;
2960 if ( nFlags
& AllSettingsFlags::LOCALE
)
2962 if ( mxData
->maLocale
!= rSet
.mxData
->maLocale
)
2964 SetLanguageTag( rSet
.mxData
->maLocale
);
2965 nChangeFlags
|= AllSettingsFlags::LOCALE
;
2969 return nChangeFlags
;
2972 AllSettingsFlags
AllSettings::GetChangeFlags( const AllSettings
& rSet
) const
2975 AllSettingsFlags nChangeFlags
= AllSettingsFlags::NONE
;
2977 if ( mxData
->maStyleSettings
!= rSet
.mxData
->maStyleSettings
)
2978 nChangeFlags
|= AllSettingsFlags::STYLE
;
2980 if ( mxData
->maMiscSettings
!= rSet
.mxData
->maMiscSettings
)
2981 nChangeFlags
|= AllSettingsFlags::MISC
;
2983 if ( mxData
->maLocale
!= rSet
.mxData
->maLocale
)
2984 nChangeFlags
|= AllSettingsFlags::LOCALE
;
2986 return nChangeFlags
;
2989 bool AllSettings::operator ==( const AllSettings
& rSet
) const
2991 if ( mxData
== rSet
.mxData
)
2994 if ( (mxData
->maMouseSettings
== rSet
.mxData
->maMouseSettings
) &&
2995 (mxData
->maStyleSettings
== rSet
.mxData
->maStyleSettings
) &&
2996 (mxData
->maMiscSettings
== rSet
.mxData
->maMiscSettings
) &&
2997 (mxData
->maHelpSettings
== rSet
.mxData
->maHelpSettings
) &&
2998 (mxData
->maLocale
== rSet
.mxData
->maLocale
) )
3006 void AllSettings::SetLanguageTag(const OUString
& rLanguage
, bool bCanonicalize
)
3008 SetLanguageTag(LanguageTag(rLanguage
, bCanonicalize
));
3011 void AllSettings::SetLanguageTag( const LanguageTag
& rLanguageTag
)
3013 if (mxData
->maLocale
== rLanguageTag
)
3018 mxData
->maLocale
= rLanguageTag
;
3020 if ( mxData
->mpLocaleDataWrapper
)
3022 mxData
->mpLocaleDataWrapper
.reset();
3024 if ( mxData
->mpI18nHelper
)
3026 mxData
->mpI18nHelper
.reset();
3032 bool GetConfigLayoutRTL(bool bMath
)
3034 static const char* pEnv
= getenv("SAL_RTL_ENABLED" );
3035 static int nUIMirroring
= -1; // -1: undef, 0: auto, 1: on 2: off
3037 // environment always overrides
3043 if( nUIMirroring
== -1 )
3045 nUIMirroring
= 0; // ask configuration only once
3046 utl::OConfigurationNode aNode
= utl::OConfigurationTreeRoot::tryCreateWithComponentContext(
3047 comphelper::getProcessComponentContext(),
3048 "org.openoffice.Office.Common/I18N/CTL" ); // note: case sensitive !
3049 if ( aNode
.isValid() )
3052 css::uno::Any aValue
= aNode
.getNodeValue( "UIMirroring" );
3053 if( aValue
>>= bTmp
)
3055 // found true or false; if it was nil, nothing is changed
3056 nUIMirroring
= bTmp
? 1 : 2;
3061 if( nUIMirroring
== 0 ) // no config found (eg, setup) or default (nil) was set: check language
3063 LanguageType aLang
= SvtSysLocaleOptions().GetRealUILanguageTag().getLanguageType();
3065 bRTL
= MsLangId::isRightToLeftMath( aLang
);
3067 bRTL
= MsLangId::isRightToLeft( aLang
);
3070 bRTL
= (nUIMirroring
== 1);
3076 bool AllSettings::GetLayoutRTL()
3078 if (utl::ConfigManager::IsFuzzing())
3080 return GetConfigLayoutRTL(false);
3083 bool AllSettings::GetMathLayoutRTL()
3085 if (utl::ConfigManager::IsFuzzing())
3087 return GetConfigLayoutRTL(true);
3090 const LanguageTag
& AllSettings::GetLanguageTag() const
3092 if (utl::ConfigManager::IsFuzzing())
3094 static LanguageTag
aRet("en-US");
3098 if (comphelper::LibreOfficeKit::isActive())
3099 return comphelper::LibreOfficeKit::getLanguageTag();
3101 // SYSTEM locale means: use settings from SvtSysLocale that is resolved
3102 if ( mxData
->maLocale
.isSystemLocale() )
3103 mxData
->maLocale
= mxData
->maSysLocale
.GetLanguageTag();
3105 return mxData
->maLocale
;
3108 const LanguageTag
& AllSettings::GetUILanguageTag() const
3110 if (utl::ConfigManager::IsFuzzing())
3112 static LanguageTag
aRet("en-US");
3116 if (comphelper::LibreOfficeKit::isActive())
3117 return comphelper::LibreOfficeKit::getLanguageTag();
3119 // the UILocale is never changed
3120 if ( mxData
->maUILocale
.isSystemLocale() )
3121 mxData
->maUILocale
= mxData
->maSysLocale
.GetUILanguageTag();
3123 return mxData
->maUILocale
;
3126 const LocaleDataWrapper
& AllSettings::GetLocaleDataWrapper() const
3128 if ( !mxData
->mpLocaleDataWrapper
)
3129 const_cast<AllSettings
*>(this)->mxData
->mpLocaleDataWrapper
.reset( new LocaleDataWrapper(
3130 comphelper::getProcessComponentContext(), GetLanguageTag() ) );
3131 return *mxData
->mpLocaleDataWrapper
;
3134 const LocaleDataWrapper
& AllSettings::GetUILocaleDataWrapper() const
3136 if ( !mxData
->mpUILocaleDataWrapper
)
3137 const_cast<AllSettings
*>(this)->mxData
->mpUILocaleDataWrapper
.reset( new LocaleDataWrapper(
3138 comphelper::getProcessComponentContext(), GetUILanguageTag() ) );
3139 return *mxData
->mpUILocaleDataWrapper
;
3142 const LocaleDataWrapper
& AllSettings::GetNeutralLocaleDataWrapper() const
3144 if ( !mxData
->mpNeutralLocaleDataWrapper
)
3145 const_cast<AllSettings
*>(this)->mxData
->mpNeutralLocaleDataWrapper
.reset( new LocaleDataWrapper(
3146 comphelper::getProcessComponentContext(), LanguageTag("en-US") ) );
3147 return *mxData
->mpNeutralLocaleDataWrapper
;
3150 const vcl::I18nHelper
& AllSettings::GetLocaleI18nHelper() const
3152 if ( !mxData
->mpI18nHelper
) {
3153 const_cast<AllSettings
*>(this)->mxData
->mpI18nHelper
.reset( new vcl::I18nHelper(
3154 comphelper::getProcessComponentContext(), GetLanguageTag() ) );
3156 return *mxData
->mpI18nHelper
;
3159 const vcl::I18nHelper
& AllSettings::GetUILocaleI18nHelper() const
3161 if ( !mxData
->mpUII18nHelper
) {
3162 const_cast<AllSettings
*>(this)->mxData
->mpUII18nHelper
.reset( new vcl::I18nHelper(
3163 comphelper::getProcessComponentContext(), GetUILanguageTag() ) );
3165 return *mxData
->mpUII18nHelper
;
3168 void AllSettings::LocaleSettingsChanged( ConfigurationHints nHint
)
3170 AllSettings
aAllSettings( Application::GetSettings() );
3171 if ( nHint
& ConfigurationHints::DecSep
)
3173 MiscSettings aMiscSettings
= aAllSettings
.GetMiscSettings();
3174 bool bIsDecSepAsLocale
= aAllSettings
.mxData
->maSysLocale
.GetOptions().IsDecimalSeparatorAsLocale();
3175 if ( aMiscSettings
.GetEnableLocalizedDecimalSep() != bIsDecSepAsLocale
)
3177 aMiscSettings
.SetEnableLocalizedDecimalSep( bIsDecSepAsLocale
);
3178 aAllSettings
.SetMiscSettings( aMiscSettings
);
3182 if ( nHint
& ConfigurationHints::Locale
)
3183 aAllSettings
.SetLanguageTag( aAllSettings
.mxData
->maSysLocale
.GetOptions().GetLanguageTag() );
3185 Application::SetSettings( aAllSettings
);
3188 const StyleSettings
&
3189 AllSettings::GetStyleSettings() const
3191 return mxData
->maStyleSettings
;
3194 StyleSettingsOptions
3195 StyleSettings::GetOptions() const
3197 return mxData
->mnOptions
;
3200 std::vector
<vcl::IconThemeInfo
> const &
3201 StyleSettings::GetInstalledIconThemes() const
3203 if (!mxData
->mIconThemeScanner
) {
3204 const_cast<StyleSettings
*>(this)->mxData
->mIconThemeScanner
= vcl::IconThemeScanner::Create(vcl::IconThemeScanner::GetStandardIconThemePath());
3206 return mxData
->mIconThemeScanner
->GetFoundIconThemes();
3210 StyleSettings::GetAutomaticallyChosenIconTheme() const
3212 OUString desktopEnvironment
= Application::GetDesktopEnvironment();
3213 if (!mxData
->mIconThemeScanner
) {
3214 const_cast<StyleSettings
*>(this)->mxData
->mIconThemeScanner
= vcl::IconThemeScanner::Create(vcl::IconThemeScanner::GetStandardIconThemePath());
3216 OUString themeName
= mxData
->mIconThemeSelector
->SelectIconThemeForDesktopEnvironment(
3217 mxData
->mIconThemeScanner
->GetFoundIconThemes(),
3224 StyleSettings::SetIconTheme(const OUString
& theme
)
3227 mxData
->mIconTheme
= theme
;
3231 StyleSettings::DetermineIconTheme() const
3233 OUString
sTheme(mxData
->mIconTheme
);
3234 if (sTheme
.isEmpty())
3236 if (utl::ConfigManager::IsFuzzing())
3240 // read from the configuration, or fallback to what the desktop wants
3241 sTheme
= officecfg::Office::Common::Misc::SymbolStyle::get();
3243 if (sTheme
.isEmpty() || sTheme
== "auto")
3244 sTheme
= GetAutomaticallyChosenIconTheme();
3248 if (!mxData
->mIconThemeScanner
) {
3249 const_cast<StyleSettings
*>(this)->mxData
->mIconThemeScanner
= vcl::IconThemeScanner::Create(vcl::IconThemeScanner::GetStandardIconThemePath());
3251 OUString r
= mxData
->mIconThemeSelector
->SelectIconTheme(
3252 mxData
->mIconThemeScanner
->GetFoundIconThemes(),
3258 StyleSettings::SetHighContrastMode(bool bHighContrast
)
3260 if (mxData
->mbHighContrast
== bHighContrast
) {
3265 mxData
->mbHighContrast
= bHighContrast
;
3266 mxData
->mIconThemeSelector
->SetUseHighContrastTheme(bHighContrast
);
3270 StyleSettings::GetHighContrastMode() const
3272 return mxData
->mbHighContrast
;
3276 StyleSettings::SetPreferredIconTheme(const OUString
& theme
, bool bDarkIconTheme
)
3278 const bool bChanged
= mxData
->mIconThemeSelector
->SetPreferredIconTheme(theme
, bDarkIconTheme
);
3281 // clear this so it is recalculated if it was selected as the automatic theme
3282 mxData
->mIconTheme
.clear();
3287 AllSettings::SetMouseSettings( const MouseSettings
& rSet
)
3290 mxData
->maMouseSettings
= rSet
;
3293 const MouseSettings
&
3294 AllSettings::GetMouseSettings() const
3296 return mxData
->maMouseSettings
;
3300 AllSettings::SetStyleSettings( const StyleSettings
& rSet
)
3303 mxData
->maStyleSettings
= rSet
;
3307 AllSettings::SetMiscSettings( const MiscSettings
& rSet
)
3310 mxData
->maMiscSettings
= rSet
;
3314 AllSettings::GetMiscSettings() const
3316 return mxData
->maMiscSettings
;
3320 AllSettings::SetHelpSettings( const HelpSettings
& rSet
)
3323 mxData
->maHelpSettings
= rSet
;
3327 AllSettings::GetHelpSettings() const
3329 return mxData
->maHelpSettings
;
3333 AllSettings::operator !=( const AllSettings
& rSet
) const
3335 return !(*this == rSet
);
3339 AllSettings::GetSysLocale()
3341 return mxData
->maSysLocale
;
3345 void StyleSettings::BatchSetBackgrounds( const Color
&aBackColor
,
3346 bool bCheckedColorSpecialCase
)
3348 Set3DColors( aBackColor
);
3349 SetFaceColor( aBackColor
);
3350 SetDialogColor( aBackColor
);
3351 SetWorkspaceColor( aBackColor
);
3353 if (bCheckedColorSpecialCase
)
3354 SetCheckedColorSpecialCase();
3357 void StyleSettings::BatchSetFonts( const vcl::Font
& aAppFont
,
3358 const vcl::Font
& aLabelFont
)
3360 SetAppFont( aAppFont
);
3361 SetPushButtonFont( aAppFont
);
3362 SetToolFont( aAppFont
);
3363 SetHelpFont( aAppFont
);
3365 SetMenuFont( aLabelFont
);
3366 SetTabFont( aLabelFont
);
3367 SetLabelFont( aLabelFont
);
3368 SetRadioCheckFont( aLabelFont
);
3369 SetFieldFont( aLabelFont
);
3370 SetGroupFont( aLabelFont
);
3371 SetIconFont( aLabelFont
);
3374 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */