sw a11y: clang-format SidebarWinAccessible code
[LibreOffice.git] / vcl / source / app / settings.cxx
blob7d807a7bdae0ca9a727843fbebe884edb30bdfb1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <config_folders.h>
22 #include <officecfg/Office/Common.hxx>
24 #ifdef _WIN32
25 #include <win/svsys.h>
26 #endif
28 #include <comphelper/processfactory.hxx>
29 #include <o3tl/test_info.hxx>
30 #include <rtl/bootstrap.hxx>
32 #include <i18nlangtag/mslangid.hxx>
33 #include <i18nlangtag/languagetag.hxx>
35 #include <comphelper/lok.hxx>
37 #include <vcl/graphicfilter.hxx>
38 #include <IconThemeScanner.hxx>
39 #include <IconThemeSelector.hxx>
40 #include <vcl/IconThemeInfo.hxx>
41 #include <vcl/svapp.hxx>
42 #include <vcl/event.hxx>
43 #include <vcl/settings.hxx>
44 #include <vcl/i18nhelp.hxx>
45 #include <configsettings.hxx>
46 #include <vcl/outdev.hxx>
48 #include <unotools/fontcfg.hxx>
49 #include <unotools/localedatawrapper.hxx>
50 #include <unotools/confignode.hxx>
51 #include <unotools/configmgr.hxx>
52 #include <unotools/syslocale.hxx>
53 #include <unotools/syslocaleoptions.hxx>
55 #include <salframe.hxx>
56 #include <svdata.hxx>
58 using namespace ::com::sun::star;
60 struct ImplMouseData
62 MouseSettingsOptions mnOptions = MouseSettingsOptions::NONE;
63 sal_uInt64 mnDoubleClkTime = 500;
64 sal_Int32 mnDoubleClkWidth = 2;
65 sal_Int32 mnDoubleClkHeight = 2;
66 sal_Int32 mnStartDragWidth = 2 ;
67 sal_Int32 mnStartDragHeight = 2;
68 sal_Int32 mnButtonRepeat = 90;
69 sal_Int32 mnMenuDelay = 150;
70 MouseFollowFlags mnFollow = MouseFollowFlags::Menu;
71 MouseMiddleButtonAction mnMiddleButtonAction= MouseMiddleButtonAction::AutoScroll;
72 MouseWheelBehaviour mnWheelBehavior = MouseWheelBehaviour::FocusOnly;
74 bool operator==(const ImplMouseData& rSet) const = default;
77 namespace
79 constexpr Size getInitListBoxPreviewDefaultLogicSize()
81 #ifdef IOS
82 return Size(30, 30);
83 #else
84 return Size(15, 7);
85 #endif
88 // Structures simplifying comparison in StyleSettings::operator ==, where for some reason
89 // not all members of ImplStyleData are compared. Adding elements here would automatically
90 // participate in the default comparison methods.
92 struct ColorSet
94 Color maActiveBorderColor;
95 Color maActiveColor;
96 Color maActiveTextColor;
97 Color maAlternatingRowColor;
98 Color maDefaultButtonTextColor;
99 Color maButtonTextColor;
100 Color maDefaultActionButtonTextColor;
101 Color maActionButtonTextColor;
102 Color maFlatButtonTextColor;
103 Color maDefaultButtonRolloverTextColor;
104 Color maButtonRolloverTextColor;
105 Color maDefaultActionButtonRolloverTextColor;
106 Color maActionButtonRolloverTextColor;
107 Color maFlatButtonRolloverTextColor;
108 Color maDefaultButtonPressedRolloverTextColor;
109 Color maButtonPressedRolloverTextColor;
110 Color maDefaultActionButtonPressedRolloverTextColor;
111 Color maActionButtonPressedRolloverTextColor;
112 Color maFlatButtonPressedRolloverTextColor;
113 Color maCheckedColor;
114 Color maDarkShadowColor;
115 Color maDeactiveBorderColor;
116 Color maDeactiveColor;
117 Color maDeactiveTextColor;
118 Color maDialogColor;
119 Color maDialogTextColor;
120 Color maDisableColor;
121 Color maFaceColor;
122 Color maFieldColor;
123 Color maFieldTextColor;
124 Color maFieldRolloverTextColor;
125 Color maGroupTextColor;
126 Color maHelpColor;
127 Color maHelpTextColor;
128 Color maAccentColor;
129 Color maHighlightColor;
130 Color maHighlightTextColor;
131 Color maLabelTextColor;
132 Color maLightBorderColor;
133 Color maLightColor;
134 Color maLinkColor;
135 Color maMenuBarColor;
136 Color maMenuBarRolloverColor;
137 Color maMenuBorderColor;
138 Color maMenuColor;
139 Color maMenuHighlightColor;
140 Color maMenuHighlightTextColor;
141 Color maMenuTextColor;
142 Color maListBoxWindowBackgroundColor;
143 Color maListBoxWindowTextColor;
144 Color maListBoxWindowHighlightColor;
145 Color maListBoxWindowHighlightTextColor;
146 Color maMenuBarTextColor;
147 Color maMenuBarRolloverTextColor;
148 Color maMenuBarHighlightTextColor;
149 Color maMonoColor;
150 Color maRadioCheckTextColor;
151 Color maShadowColor;
152 Color maWarningColor;
153 Color maWarningTextColor;
154 Color maErrorColor;
155 Color maErrorTextColor;
156 Color maVisitedLinkColor;
157 Color maToolTextColor;
158 Color maWindowColor;
159 Color maWindowTextColor;
160 Color maWorkspaceColor;
161 Color maActiveTabColor;
162 Color maInactiveTabColor;
163 Color maTabTextColor;
164 Color maTabRolloverTextColor;
165 Color maTabHighlightTextColor;
167 bool operator==(const ColorSet&) const = default;
170 struct FontSet
172 vcl::Font maAppFont;
173 vcl::Font maHelpFont;
174 vcl::Font maTitleFont;
175 vcl::Font maFloatTitleFont;
176 vcl::Font maMenuFont;
177 vcl::Font maToolFont;
178 vcl::Font maLabelFont;
179 vcl::Font maRadioCheckFont;
180 vcl::Font maPushButtonFont;
181 vcl::Font maFieldFont;
182 vcl::Font maIconFont;
183 vcl::Font maTabFont;
184 vcl::Font maGroupFont;
186 bool operator==(const FontSet&) const = default;
190 struct ImplStyleData
192 ImplStyleData();
194 void SetStandardStyles();
196 ColorSet maColors;
197 FontSet maFonts;
198 sal_Int32 mnTitleHeight;
199 sal_Int32 mnFloatTitleHeight;
200 sal_Int32 mnScrollBarSize = 16;
201 sal_Int32 mnSpinSize = 16;
202 sal_Int32 mnCursorSize = 2;
203 sal_Int32 mnAntialiasedMin = 0;
204 sal_uInt64 mnCursorBlinkTime = STYLE_CURSOR_NOBLINKTIME;
205 DragFullOptions mnDragFullOptions = DragFullOptions::All;
206 SelectionOptions mnSelectionOptions = SelectionOptions::NONE;
207 DisplayOptions mnDisplayOptions = DisplayOptions::NONE;
208 ToolbarIconSize mnToolbarIconSize = ToolbarIconSize::Unknown;
209 StyleSettingsOptions mnOptions = StyleSettingsOptions::NONE;
210 TriState meUseImagesInMenus = TRISTATE_INDET;
211 std::optional<vcl::IconThemeScanner> mutable
212 mIconThemeScanner;
213 vcl::IconThemeSelector mIconThemeSelector;
215 OUString mIconTheme;
216 sal_Int32 mnMinThumbSize = 16;
217 TriState meContextMenuShortcuts = TRISTATE_INDET;
218 DialogStyle maDialogStyle;
220 bool mnUseFlatMenus : 1;
221 bool mbHighContrast : 1;
222 bool mbUseSystemUIFonts : 1;
224 * Disabling AA doesn't actually disable AA of fonts, instead it is taken
225 * from system settings.
227 bool mbUseFontAAFromSystem : 1;
228 bool mbUseSubpixelAA : 1;
229 bool mbAutoMnemonic : 1 = true;
230 bool mnUseFlatBorders : 1;
231 bool mbPreferredUseImagesInMenus : 1;
232 bool mbSkipDisabledInMenus : 1;
233 bool mbHideDisabledMenuItems : 1;
234 bool mbPreferredContextMenuShortcuts : 1;
235 //mbPrimaryButtonWarpsSlider == true for "jump to here" behavior for primary button, otherwise
236 //primary means scroll by single page. Secondary button takes the alternative behaviour
237 bool mbPrimaryButtonWarpsSlider : 1;
238 bool mbPreviewUsesCheckeredBackground : 1 = true;
240 sal_uInt16 mnEdgeBlending = 35;
241 Color maEdgeBlendingTopLeftColor = Color(0xC0, 0xC0, 0xC0);
242 Color maEdgeBlendingBottomRightColor = Color(0x40, 0x40, 0x40);
243 sal_uInt16 mnListBoxMaximumLineCount = 25;
245 // For some reason this isn't actually the column count that gets used, at least on iOS, but
246 // instead what SvtAccessibilityOptions_Impl::GetColorValueSetColumnCount() in
247 // svtools/source/config/accessibilityoptions.cxx returns.
248 sal_uInt16 mnColorValueSetColumnCount = 12;
249 ComboBoxTextSelectionMode meComboBoxTextSelectionMode = ComboBoxTextSelectionMode::SelectText;
250 Size maListBoxPreviewDefaultLogicSize = getInitListBoxPreviewDefaultLogicSize();
251 // on-demand calculated in GetListBoxPreviewDefaultPixelSize()
252 Size mutable maListBoxPreviewDefaultPixelSize;
254 OUString mutable maPersonaHeaderFooter; ///< Cache the settings to detect changes.
256 BitmapEx mutable maPersonaHeaderBitmap; ///< Cache the header bitmap.
257 BitmapEx mutable maPersonaFooterBitmap; ///< Cache the footer bitmap.
258 std::optional<Color> mutable maPersonaMenuBarTextColor; ///< Cache the menubar color.
260 bool operator==(const ImplStyleData& rSet) const;
263 struct ImplMiscData
265 ImplMiscData();
266 bool mbEnableLocalizedDecimalSep;
267 TriState mnDisablePrinting;
270 struct ImplHelpData
272 sal_Int32 mnTipTimeout = 3000;
275 struct ImplAllSettingsData
277 ImplAllSettingsData();
278 ImplAllSettingsData( const ImplAllSettingsData& rData );
279 ~ImplAllSettingsData();
281 MouseSettings maMouseSettings;
282 StyleSettings maStyleSettings;
283 MiscSettings maMiscSettings;
284 HelpSettings maHelpSettings;
285 SvtSysLocale maSysLocale;
286 LanguageTag maLocale;
287 LanguageTag maUILocale;
288 mutable std::unique_ptr<LocaleDataWrapper> mpLocaleDataWrapper;
289 mutable std::unique_ptr<LocaleDataWrapper> mpUILocaleDataWrapper;
290 mutable std::unique_ptr<LocaleDataWrapper> mpNeutralLocaleDataWrapper;
291 mutable std::unique_ptr<vcl::I18nHelper> mpI18nHelper;
292 mutable std::unique_ptr<vcl::I18nHelper> mpUII18nHelper;
294 bool operator==(const ImplAllSettingsData& rSet) const;
297 void
298 MouseSettings::SetOptions(MouseSettingsOptions nOptions)
300 mxData->mnOptions = nOptions;
303 MouseSettingsOptions
304 MouseSettings::GetOptions() const
306 return mxData->mnOptions;
309 void
310 MouseSettings::SetDoubleClickTime( sal_uInt64 nDoubleClkTime )
312 mxData->mnDoubleClkTime = nDoubleClkTime;
315 sal_uInt64
316 MouseSettings::GetDoubleClickTime() const
318 return mxData->mnDoubleClkTime;
321 void
322 MouseSettings::SetDoubleClickWidth( sal_Int32 nDoubleClkWidth )
324 mxData->mnDoubleClkWidth = nDoubleClkWidth;
327 sal_Int32
328 MouseSettings::GetDoubleClickWidth() const
330 return mxData->mnDoubleClkWidth;
333 void
334 MouseSettings::SetDoubleClickHeight( sal_Int32 nDoubleClkHeight )
336 mxData->mnDoubleClkHeight = nDoubleClkHeight;
339 sal_Int32
340 MouseSettings::GetDoubleClickHeight() const
342 return mxData->mnDoubleClkHeight;
345 void
346 MouseSettings::SetStartDragWidth( sal_Int32 nDragWidth )
348 mxData->mnStartDragWidth = nDragWidth;
351 sal_Int32
352 MouseSettings::GetStartDragWidth() const
354 return mxData->mnStartDragWidth;
357 void
358 MouseSettings::SetStartDragHeight( sal_Int32 nDragHeight )
360 mxData->mnStartDragHeight = nDragHeight;
363 sal_Int32
364 MouseSettings::GetStartDragHeight() const
366 return mxData->mnStartDragHeight;
369 sal_uInt16
370 MouseSettings::GetStartDragCode()
372 return MOUSE_LEFT;
375 sal_uInt16
376 MouseSettings::GetContextMenuCode()
378 return MOUSE_RIGHT;
381 sal_uInt16
382 MouseSettings::GetContextMenuClicks()
384 return 1;
387 sal_Int32
388 MouseSettings::GetScrollRepeat()
390 return 100;
393 sal_Int32
394 MouseSettings::GetButtonStartRepeat()
396 return 370;
399 void
400 MouseSettings::SetButtonRepeat( sal_Int32 nRepeat )
402 mxData->mnButtonRepeat = nRepeat;
405 sal_Int32
406 MouseSettings::GetButtonRepeat() const
408 return mxData->mnButtonRepeat;
411 sal_Int32
412 MouseSettings::GetActionDelay()
414 return 250;
417 void
418 MouseSettings::SetMenuDelay( sal_Int32 nDelay )
420 mxData->mnMenuDelay = nDelay;
423 sal_Int32
424 MouseSettings::GetMenuDelay() const
426 return mxData->mnMenuDelay;
429 void
430 MouseSettings::SetFollow( MouseFollowFlags nFollow )
432 mxData->mnFollow = nFollow;
435 MouseFollowFlags
436 MouseSettings::GetFollow() const
438 return mxData->mnFollow;
441 void
442 MouseSettings::SetMiddleButtonAction( MouseMiddleButtonAction nAction )
444 mxData->mnMiddleButtonAction = nAction;
447 MouseMiddleButtonAction
448 MouseSettings::GetMiddleButtonAction() const
450 return mxData->mnMiddleButtonAction;
453 void
454 MouseSettings::SetWheelBehavior( MouseWheelBehaviour nBehavior )
456 mxData->mnWheelBehavior = nBehavior;
459 MouseWheelBehaviour
460 MouseSettings::GetWheelBehavior() const
462 return mxData->mnWheelBehavior;
465 MouseSettings::MouseSettings() = default;
466 MouseSettings::MouseSettings(const MouseSettings&) = default;
467 MouseSettings::~MouseSettings() = default;
468 MouseSettings& MouseSettings::operator=(const MouseSettings&) = default;
470 // Until Clang 14, P2085R0 is unsupported, and the operator can't be default outside of declaration
471 bool MouseSettings::operator ==( const MouseSettings& rSet ) const
473 return mxData == rSet.mxData;
476 ImplStyleData::ImplStyleData()
478 SetStandardStyles();
481 void ImplStyleData::SetStandardStyles()
483 vcl::Font aStdFont( FAMILY_SWISS, Size( 0, 8 ) );
484 aStdFont.SetCharSet( osl_getThreadTextEncoding() );
485 aStdFont.SetWeight( WEIGHT_NORMAL );
486 if (!comphelper::IsFuzzing())
487 aStdFont.SetFamilyName(utl::DefaultFontConfiguration::get().getUserInterfaceFont(LanguageTag(u"en"_ustr)));
488 else
489 aStdFont.SetFamilyName(u"Liberation Sans"_ustr);
490 maFonts.maAppFont = aStdFont;
491 maFonts.maHelpFont = aStdFont;
492 maFonts.maMenuFont = aStdFont;
493 maFonts.maToolFont = aStdFont;
494 maFonts.maGroupFont = aStdFont;
495 maFonts.maLabelFont = aStdFont;
496 maFonts.maRadioCheckFont = aStdFont;
497 maFonts.maPushButtonFont = aStdFont;
498 maFonts.maFieldFont = aStdFont;
499 maFonts.maIconFont = aStdFont;
500 maFonts.maTabFont = aStdFont;
502 aStdFont.SetWeight( WEIGHT_BOLD );
503 maFonts.maFloatTitleFont = maFonts.maTitleFont = std::move(aStdFont);
505 maColors.maFaceColor = COL_LIGHTGRAY;
506 maColors.maCheckedColor = Color( 0xCC, 0xCC, 0xCC );
507 maColors.maLightColor = COL_WHITE;
508 maColors.maLightBorderColor = COL_LIGHTGRAY;
509 maColors.maShadowColor = COL_GRAY;
510 maColors.maDarkShadowColor = COL_BLACK;
512 maColors.maWarningColor = Color(0xFE, 0xEF, 0xB3); // tdf#105829
513 maColors.maWarningTextColor = Color(0x70, 0x43, 0x00);
514 maColors.maErrorColor = Color(0xFF, 0xBA, 0xBA);
515 maColors.maErrorTextColor = Color(0x7A, 0x00, 0x06);
517 maColors.maDefaultButtonTextColor = COL_BLACK;
518 maColors.maButtonTextColor = COL_BLACK;
519 maColors.maDefaultActionButtonTextColor = COL_BLACK;
520 maColors.maActionButtonTextColor = COL_BLACK;
521 maColors.maFlatButtonTextColor = COL_BLACK;
522 maColors.maDefaultButtonRolloverTextColor = COL_BLACK;
523 maColors.maButtonRolloverTextColor = COL_BLACK;
524 maColors.maDefaultActionButtonRolloverTextColor = COL_BLACK;
525 maColors.maActionButtonRolloverTextColor = COL_BLACK;
526 maColors.maFlatButtonRolloverTextColor = COL_BLACK;
527 maColors.maDefaultButtonPressedRolloverTextColor = COL_BLACK;
528 maColors.maButtonPressedRolloverTextColor = COL_BLACK;
529 maColors.maDefaultActionButtonPressedRolloverTextColor = COL_BLACK;
530 maColors.maActionButtonPressedRolloverTextColor = COL_BLACK;
531 maColors.maFlatButtonPressedRolloverTextColor = COL_BLACK;
533 maColors.maRadioCheckTextColor = COL_BLACK;
534 maColors.maGroupTextColor = COL_BLACK;
535 maColors.maLabelTextColor = COL_BLACK;
536 maColors.maWindowColor = COL_WHITE;
537 maColors.maWindowTextColor = COL_BLACK;
538 maColors.maDialogColor = COL_LIGHTGRAY;
539 maColors.maDialogTextColor = COL_BLACK;
540 maColors.maWorkspaceColor = Color( 0xDF, 0xDF, 0xDE );
541 maColors.maMonoColor = COL_BLACK;
542 maColors.maFieldColor = COL_WHITE;
543 maColors.maFieldTextColor = COL_BLACK;
544 maColors.maFieldRolloverTextColor = COL_BLACK;
545 maColors.maActiveBorderColor = COL_LIGHTGRAY;
546 maColors.maDeactiveColor = COL_GRAY;
547 maColors.maDeactiveTextColor = COL_LIGHTGRAY;
548 maColors.maDeactiveBorderColor = COL_LIGHTGRAY;
549 maColors.maMenuColor = COL_LIGHTGRAY;
550 maColors.maMenuBarColor = COL_LIGHTGRAY;
551 maColors.maMenuBarRolloverColor = COL_BLUE;
552 maColors.maMenuBorderColor = COL_LIGHTGRAY;
553 maColors.maMenuTextColor = COL_BLACK;
554 maColors.maListBoxWindowBackgroundColor = COL_WHITE;
555 maColors.maListBoxWindowTextColor = COL_BLACK;
556 maColors.maListBoxWindowHighlightColor = COL_BLUE;
557 maColors.maListBoxWindowHighlightTextColor = COL_WHITE;
558 maColors.maMenuBarTextColor = COL_BLACK;
559 maColors.maMenuBarRolloverTextColor = COL_WHITE;
560 maColors.maMenuBarHighlightTextColor = COL_WHITE;
561 maColors.maMenuHighlightColor = COL_BLUE;
562 maColors.maMenuHighlightTextColor = COL_WHITE;
563 maColors.maAccentColor = COL_RED;
564 maColors.maHighlightColor = COL_BLUE;
565 maColors.maHighlightTextColor = COL_WHITE;
566 // make active like highlight, except with a small contrast
567 maColors.maActiveColor = maColors.maHighlightColor;
568 maColors.maActiveColor.IncreaseLuminance(32);
569 maColors.maActiveTextColor = maColors.maHighlightTextColor;
570 maColors.maActiveTabColor = COL_WHITE;
571 maColors.maInactiveTabColor = COL_LIGHTGRAY;
572 maColors.maTabTextColor = COL_BLACK;
573 maColors.maTabRolloverTextColor = COL_BLACK;
574 maColors.maTabHighlightTextColor = COL_BLACK;
575 maColors.maDisableColor = COL_GRAY;
576 maColors.maHelpColor = Color( 0xFF, 0xFF, 0xE0 );
577 maColors.maHelpTextColor = COL_BLACK;
578 maColors.maLinkColor = COL_BLUE;
579 maColors.maVisitedLinkColor = Color( 0x00, 0x00, 0xCC );
580 maColors.maToolTextColor = COL_BLACK;
581 maColors.maAlternatingRowColor = Color( 0xEE, 0xEE, 0xEE );
583 mnTitleHeight = 18;
584 mnFloatTitleHeight = 13;
585 mbHighContrast = false;
586 mbUseSystemUIFonts = true;
587 mbUseFontAAFromSystem = true;
588 mbUseSubpixelAA = true;
589 mnUseFlatBorders = false;
590 mnUseFlatMenus = false;
591 mbPreferredUseImagesInMenus = true;
592 mbSkipDisabledInMenus = false;
593 mbHideDisabledMenuItems = false;
594 mbPreferredContextMenuShortcuts = true;
595 mbPrimaryButtonWarpsSlider = false;
598 StyleSettings::StyleSettings() = default;
599 StyleSettings::StyleSettings(const StyleSettings&) = default;
600 StyleSettings::~StyleSettings() = default;
601 StyleSettings& StyleSettings::operator=(const StyleSettings&) = default;
603 void
604 StyleSettings::SetFaceColor( const Color& rColor )
606 mxData->maColors.maFaceColor = rColor;
609 const Color&
610 StyleSettings::GetFaceColor() const
612 return mxData->maColors.maFaceColor;
615 void
616 StyleSettings::SetCheckedColor( const Color& rColor )
618 mxData->maColors.maCheckedColor = rColor;
621 const Color&
622 StyleSettings::GetCheckedColor() const
624 return mxData->maColors.maCheckedColor;
627 void
628 StyleSettings::SetLightColor( const Color& rColor )
630 mxData->maColors.maLightColor = rColor;
633 const Color&
634 StyleSettings::GetLightColor() const
636 return mxData->maColors.maLightColor;
639 void
640 StyleSettings::SetLightBorderColor( const Color& rColor )
642 mxData->maColors.maLightBorderColor = rColor;
645 const Color&
646 StyleSettings::GetLightBorderColor() const
648 return mxData->maColors.maLightBorderColor;
651 void
652 StyleSettings::SetWarningColor( const Color& rColor )
654 mxData->maColors.maWarningColor = rColor;
657 const Color&
658 StyleSettings::GetWarningColor() const
660 return mxData->maColors.maWarningColor;
663 void
664 StyleSettings::SetWarningTextColor( const Color& rColor )
666 mxData->maColors.maWarningTextColor = rColor;
669 const Color&
670 StyleSettings::GetWarningTextColor() const
672 return mxData->maColors.maWarningTextColor;
675 void
676 StyleSettings::SetErrorColor( const Color& rColor )
678 mxData->maColors.maErrorColor = rColor;
681 const Color&
682 StyleSettings::GetErrorColor() const
684 return mxData->maColors.maErrorColor;
687 void
688 StyleSettings::SetErrorTextColor( const Color& rColor )
690 mxData->maColors.maErrorTextColor = rColor;
693 const Color&
694 StyleSettings::GetErrorTextColor() const
696 return mxData->maColors.maErrorTextColor;
699 void
700 StyleSettings::SetShadowColor( const Color& rColor )
702 mxData->maColors.maShadowColor = rColor;
705 const Color&
706 StyleSettings::GetShadowColor() const
708 return mxData->maColors.maShadowColor;
711 void
712 StyleSettings::SetDarkShadowColor( const Color& rColor )
714 mxData->maColors.maDarkShadowColor = rColor;
717 const Color&
718 StyleSettings::GetDarkShadowColor() const
720 return mxData->maColors.maDarkShadowColor;
723 void
724 StyleSettings::SetDefaultButtonTextColor( const Color& rColor )
726 mxData->maColors.maDefaultButtonTextColor = rColor;
729 const Color&
730 StyleSettings::GetDefaultButtonTextColor() const
732 return mxData->maColors.maDefaultButtonTextColor;
735 void
736 StyleSettings::SetButtonTextColor( const Color& rColor )
738 mxData->maColors.maButtonTextColor = rColor;
741 const Color&
742 StyleSettings::GetButtonTextColor() const
744 return mxData->maColors.maButtonTextColor;
747 void
748 StyleSettings::SetDefaultActionButtonTextColor( const Color& rColor )
750 mxData->maColors.maDefaultActionButtonTextColor = rColor;
753 const Color&
754 StyleSettings::GetDefaultActionButtonTextColor() const
756 return mxData->maColors.maDefaultActionButtonTextColor;
759 void
760 StyleSettings::SetActionButtonTextColor( const Color& rColor )
762 mxData->maColors.maActionButtonTextColor = rColor;
765 const Color&
766 StyleSettings::GetActionButtonTextColor() const
768 return mxData->maColors.maActionButtonTextColor;
771 void
772 StyleSettings::SetFlatButtonTextColor( const Color& rColor )
774 mxData->maColors.maFlatButtonTextColor = rColor;
777 const Color&
778 StyleSettings::GetFlatButtonTextColor() const
780 return mxData->maColors.maFlatButtonTextColor;
783 void
784 StyleSettings::SetDefaultButtonRolloverTextColor( const Color& rColor )
786 mxData->maColors.maDefaultButtonRolloverTextColor = rColor;
789 const Color&
790 StyleSettings::GetDefaultButtonRolloverTextColor() const
792 return mxData->maColors.maDefaultButtonRolloverTextColor;
795 void
796 StyleSettings::SetButtonRolloverTextColor( const Color& rColor )
798 mxData->maColors.maButtonRolloverTextColor = rColor;
801 const Color&
802 StyleSettings::GetButtonRolloverTextColor() const
804 return mxData->maColors.maButtonRolloverTextColor;
807 void
808 StyleSettings::SetDefaultActionButtonRolloverTextColor( const Color& rColor )
810 mxData->maColors.maDefaultActionButtonRolloverTextColor = rColor;
813 const Color&
814 StyleSettings::GetDefaultActionButtonRolloverTextColor() const
816 return mxData->maColors.maDefaultActionButtonRolloverTextColor;
819 void
820 StyleSettings::SetActionButtonRolloverTextColor( const Color& rColor )
822 mxData->maColors.maActionButtonRolloverTextColor = rColor;
825 const Color&
826 StyleSettings::GetActionButtonRolloverTextColor() const
828 return mxData->maColors.maActionButtonRolloverTextColor;
831 void
832 StyleSettings::SetFlatButtonRolloverTextColor( const Color& rColor )
834 mxData->maColors.maFlatButtonRolloverTextColor = rColor;
837 const Color&
838 StyleSettings::GetFlatButtonRolloverTextColor() const
840 return mxData->maColors.maFlatButtonRolloverTextColor;
843 void
844 StyleSettings::SetDefaultButtonPressedRolloverTextColor( const Color& rColor )
846 mxData->maColors.maDefaultButtonPressedRolloverTextColor = rColor;
849 const Color&
850 StyleSettings::GetDefaultButtonPressedRolloverTextColor() const
852 return mxData->maColors.maDefaultButtonPressedRolloverTextColor;
855 void
856 StyleSettings::SetButtonPressedRolloverTextColor( const Color& rColor )
858 mxData->maColors.maButtonPressedRolloverTextColor = rColor;
861 const Color&
862 StyleSettings::GetButtonPressedRolloverTextColor() const
864 return mxData->maColors.maButtonPressedRolloverTextColor;
867 void
868 StyleSettings::SetDefaultActionButtonPressedRolloverTextColor( const Color& rColor )
870 mxData->maColors.maDefaultActionButtonPressedRolloverTextColor = rColor;
873 const Color&
874 StyleSettings::GetDefaultActionButtonPressedRolloverTextColor() const
876 return mxData->maColors.maDefaultActionButtonPressedRolloverTextColor;
879 void
880 StyleSettings::SetActionButtonPressedRolloverTextColor( const Color& rColor )
882 mxData->maColors.maActionButtonPressedRolloverTextColor = rColor;
885 const Color&
886 StyleSettings::GetActionButtonPressedRolloverTextColor() const
888 return mxData->maColors.maActionButtonPressedRolloverTextColor;
891 void
892 StyleSettings::SetFlatButtonPressedRolloverTextColor( const Color& rColor )
894 mxData->maColors.maFlatButtonPressedRolloverTextColor = rColor;
897 const Color&
898 StyleSettings::GetFlatButtonPressedRolloverTextColor() const
900 return mxData->maColors.maFlatButtonPressedRolloverTextColor;
903 void
904 StyleSettings::SetRadioCheckTextColor( const Color& rColor )
906 mxData->maColors.maRadioCheckTextColor = rColor;
909 const Color&
910 StyleSettings::GetRadioCheckTextColor() const
912 return mxData->maColors.maRadioCheckTextColor;
915 void
916 StyleSettings::SetGroupTextColor( const Color& rColor )
918 mxData->maColors.maGroupTextColor = rColor;
921 const Color&
922 StyleSettings::GetGroupTextColor() const
924 return mxData->maColors.maGroupTextColor;
927 void
928 StyleSettings::SetLabelTextColor( const Color& rColor )
930 mxData->maColors.maLabelTextColor = rColor;
933 const Color&
934 StyleSettings::GetLabelTextColor() const
936 return mxData->maColors.maLabelTextColor;
939 void
940 StyleSettings::SetWindowColor( const Color& rColor )
942 mxData->maColors.maWindowColor = rColor;
945 const Color&
946 StyleSettings::GetWindowColor() const
948 return mxData->maColors.maWindowColor;
951 void
952 StyleSettings::SetWindowTextColor( const Color& rColor )
954 mxData->maColors.maWindowTextColor = rColor;
957 const Color&
958 StyleSettings::GetWindowTextColor() const
960 return mxData->maColors.maWindowTextColor;
963 void
964 StyleSettings::SetDialogColor( const Color& rColor )
966 mxData->maColors.maDialogColor = rColor;
969 const Color&
970 StyleSettings::GetDialogColor() const
972 return mxData->maColors.maDialogColor;
975 void
976 StyleSettings::SetDialogTextColor( const Color& rColor )
978 mxData->maColors.maDialogTextColor = rColor;
981 const Color&
982 StyleSettings::GetDialogTextColor() const
984 return mxData->maColors.maDialogTextColor;
987 void
988 StyleSettings::SetWorkspaceColor( const Color& rColor )
990 mxData->maColors.maWorkspaceColor = rColor;
993 const Color&
994 StyleSettings::GetWorkspaceColor() const
996 return mxData->maColors.maWorkspaceColor;
999 void
1000 StyleSettings::SetFieldColor( const Color& rColor )
1002 mxData->maColors.maFieldColor = rColor;
1005 const Color&
1006 StyleSettings::GetFieldColor() const
1008 return mxData->maColors.maFieldColor;
1011 void
1012 StyleSettings::SetFieldTextColor( const Color& rColor )
1014 mxData->maColors.maFieldTextColor = rColor;
1017 const Color&
1018 StyleSettings::GetFieldTextColor() const
1020 return mxData->maColors.maFieldTextColor;
1023 void
1024 StyleSettings::SetFieldRolloverTextColor( const Color& rColor )
1026 mxData->maColors.maFieldRolloverTextColor = rColor;
1029 const Color&
1030 StyleSettings::GetFieldRolloverTextColor() const
1032 return mxData->maColors.maFieldRolloverTextColor;
1035 void
1036 StyleSettings::SetActiveColor( const Color& rColor )
1038 mxData->maColors.maActiveColor = rColor;
1041 const Color&
1042 StyleSettings::GetActiveColor() const
1044 return mxData->maColors.maActiveColor;
1047 void
1048 StyleSettings::SetActiveTextColor( const Color& rColor )
1050 mxData->maColors.maActiveTextColor = rColor;
1053 const Color&
1054 StyleSettings::GetActiveTextColor() const
1056 return mxData->maColors.maActiveTextColor;
1059 void
1060 StyleSettings::SetActiveBorderColor( const Color& rColor )
1062 mxData->maColors.maActiveBorderColor = rColor;
1065 const Color&
1066 StyleSettings::GetActiveBorderColor() const
1068 return mxData->maColors.maActiveBorderColor;
1071 void
1072 StyleSettings::SetDeactiveColor( const Color& rColor )
1074 mxData->maColors.maDeactiveColor = rColor;
1077 const Color&
1078 StyleSettings::GetDeactiveColor() const
1080 return mxData->maColors.maDeactiveColor;
1083 void
1084 StyleSettings::SetDeactiveTextColor( const Color& rColor )
1086 mxData->maColors.maDeactiveTextColor = rColor;
1089 const Color&
1090 StyleSettings::GetDeactiveTextColor() const
1092 return mxData->maColors.maDeactiveTextColor;
1095 void
1096 StyleSettings::SetDeactiveBorderColor( const Color& rColor )
1098 mxData->maColors.maDeactiveBorderColor = rColor;
1101 const Color&
1102 StyleSettings::GetDeactiveBorderColor() const
1104 return mxData->maColors.maDeactiveBorderColor;
1107 void
1108 StyleSettings::SetAccentColor( const Color& rColor )
1110 mxData->maColors.maAccentColor = rColor;
1113 const Color&
1114 StyleSettings::GetAccentColor() const
1116 return mxData->maColors.maAccentColor;
1119 void
1120 StyleSettings::SetHighlightColor( const Color& rColor )
1122 mxData->maColors.maHighlightColor = rColor;
1125 const Color&
1126 StyleSettings::GetHighlightColor() const
1128 return mxData->maColors.maHighlightColor;
1131 void
1132 StyleSettings::SetHighlightTextColor( const Color& rColor )
1134 mxData->maColors.maHighlightTextColor = rColor;
1137 const Color&
1138 StyleSettings::GetHighlightTextColor() const
1140 return mxData->maColors.maHighlightTextColor;
1143 void
1144 StyleSettings::SetDisableColor( const Color& rColor )
1146 mxData->maColors.maDisableColor = rColor;
1149 const Color&
1150 StyleSettings::GetDisableColor() const
1152 return mxData->maColors.maDisableColor;
1155 void
1156 StyleSettings::SetHelpColor( const Color& rColor )
1158 mxData->maColors.maHelpColor = rColor;
1161 const Color&
1162 StyleSettings::GetHelpColor() const
1164 return mxData->maColors.maHelpColor;
1167 void
1168 StyleSettings::SetHelpTextColor( const Color& rColor )
1170 mxData->maColors.maHelpTextColor = rColor;
1173 const Color&
1174 StyleSettings::GetHelpTextColor() const
1176 return mxData->maColors.maHelpTextColor;
1179 void
1180 StyleSettings::SetMenuColor( const Color& rColor )
1182 mxData->maColors.maMenuColor = rColor;
1185 const Color&
1186 StyleSettings::GetMenuColor() const
1188 return mxData->maColors.maMenuColor;
1191 void
1192 StyleSettings::SetMenuBarColor( const Color& rColor )
1194 mxData->maColors.maMenuBarColor = rColor;
1197 const Color&
1198 StyleSettings::GetMenuBarColor() const
1200 return mxData->maColors.maMenuBarColor;
1203 void
1204 StyleSettings::SetMenuBarRolloverColor( const Color& rColor )
1206 mxData->maColors.maMenuBarRolloverColor = rColor;
1209 const Color&
1210 StyleSettings::GetMenuBarRolloverColor() const
1212 return mxData->maColors.maMenuBarRolloverColor;
1215 void
1216 StyleSettings::SetMenuBorderColor( const Color& rColor )
1218 mxData->maColors.maMenuBorderColor = rColor;
1221 const Color&
1222 StyleSettings::GetMenuBorderColor() const
1224 return mxData->maColors.maMenuBorderColor;
1227 void
1228 StyleSettings::SetMenuTextColor( const Color& rColor )
1230 mxData->maColors.maMenuTextColor = rColor;
1233 const Color&
1234 StyleSettings::GetMenuTextColor() const
1236 return mxData->maColors.maMenuTextColor;
1239 void
1240 StyleSettings::SetMenuBarTextColor( const Color& rColor )
1242 mxData->maColors.maMenuBarTextColor = rColor;
1245 const Color&
1246 StyleSettings::GetMenuBarTextColor() const
1248 return mxData->maColors.maMenuBarTextColor;
1251 void
1252 StyleSettings::SetMenuBarRolloverTextColor( const Color& rColor )
1254 mxData->maColors.maMenuBarRolloverTextColor = rColor;
1257 const Color&
1258 StyleSettings::GetMenuBarRolloverTextColor() const
1260 return mxData->maColors.maMenuBarRolloverTextColor;
1263 void
1264 StyleSettings::SetMenuBarHighlightTextColor( const Color& rColor )
1266 mxData->maColors.maMenuBarHighlightTextColor = rColor;
1269 const Color&
1270 StyleSettings::GetMenuBarHighlightTextColor() const
1272 return mxData->maColors.maMenuBarHighlightTextColor;
1275 void
1276 StyleSettings::SetMenuHighlightColor( const Color& rColor )
1278 mxData->maColors.maMenuHighlightColor = rColor;
1281 const Color&
1282 StyleSettings::GetMenuHighlightColor() const
1284 return mxData->maColors.maMenuHighlightColor;
1287 void
1288 StyleSettings::SetMenuHighlightTextColor( const Color& rColor )
1290 mxData->maColors.maMenuHighlightTextColor = rColor;
1293 const Color&
1294 StyleSettings::GetMenuHighlightTextColor() const
1296 return mxData->maColors.maMenuHighlightTextColor;
1299 void
1300 StyleSettings::SetListBoxWindowBackgroundColor( const Color& rColor )
1302 mxData->maColors.maListBoxWindowBackgroundColor = rColor;
1305 const Color&
1306 StyleSettings::GetListBoxWindowBackgroundColor() const
1308 return mxData->maColors.maListBoxWindowBackgroundColor;
1311 void
1312 StyleSettings::SetListBoxWindowTextColor( const Color& rColor )
1314 mxData->maColors.maListBoxWindowTextColor = rColor;
1317 const Color&
1318 StyleSettings::GetListBoxWindowTextColor() const
1320 return mxData->maColors.maListBoxWindowTextColor;
1323 void
1324 StyleSettings::SetListBoxWindowHighlightColor( const Color& rColor )
1326 mxData->maColors.maListBoxWindowHighlightColor = rColor;
1329 const Color&
1330 StyleSettings::GetListBoxWindowHighlightColor() const
1332 return mxData->maColors.maListBoxWindowHighlightColor;
1335 void
1336 StyleSettings::SetListBoxWindowHighlightTextColor( const Color& rColor )
1338 mxData->maColors.maListBoxWindowHighlightTextColor = rColor;
1341 const Color&
1342 StyleSettings::GetListBoxWindowHighlightTextColor() const
1344 return mxData->maColors.maListBoxWindowHighlightTextColor;
1347 void
1348 StyleSettings::SetTabTextColor( const Color& rColor )
1350 mxData->maColors.maTabTextColor = rColor;
1353 const Color&
1354 StyleSettings::GetTabTextColor() const
1356 return mxData->maColors.maTabTextColor;
1359 void
1360 StyleSettings::SetTabRolloverTextColor( const Color& rColor )
1362 mxData->maColors.maTabRolloverTextColor = rColor;
1365 const Color&
1366 StyleSettings::GetTabRolloverTextColor() const
1368 return mxData->maColors.maTabRolloverTextColor;
1371 void
1372 StyleSettings::SetTabHighlightTextColor( const Color& rColor )
1374 mxData->maColors.maTabHighlightTextColor = rColor;
1377 const Color&
1378 StyleSettings::GetTabHighlightTextColor() const
1380 return mxData->maColors.maTabHighlightTextColor;
1383 void
1384 StyleSettings::SetLinkColor( const Color& rColor )
1386 mxData->maColors.maLinkColor = rColor;
1389 const Color&
1390 StyleSettings::GetLinkColor() const
1392 return mxData->maColors.maLinkColor;
1395 void
1396 StyleSettings::SetVisitedLinkColor( const Color& rColor )
1398 mxData->maColors.maVisitedLinkColor = rColor;
1401 const Color&
1402 StyleSettings::GetVisitedLinkColor() const
1404 return mxData->maColors.maVisitedLinkColor;
1407 void
1408 StyleSettings::SetToolTextColor( const Color& rColor )
1410 mxData->maColors.maToolTextColor = rColor;
1413 const Color&
1414 StyleSettings::GetToolTextColor() const
1416 return mxData->maColors.maToolTextColor;
1419 void
1420 StyleSettings::SetMonoColor( const Color& rColor )
1422 mxData->maColors.maMonoColor = rColor;
1425 const Color&
1426 StyleSettings::GetMonoColor() const
1428 return mxData->maColors.maMonoColor;
1431 void
1432 StyleSettings::SetActiveTabColor( const Color& rColor )
1434 mxData->maColors.maActiveTabColor = rColor;
1437 const Color&
1438 StyleSettings::GetActiveTabColor() const
1440 return mxData->maColors.maActiveTabColor;
1443 void
1444 StyleSettings::SetInactiveTabColor( const Color& rColor )
1446 mxData->maColors.maInactiveTabColor = rColor;
1449 const Color&
1450 StyleSettings::GetInactiveTabColor() const
1452 return mxData->maColors.maInactiveTabColor;
1455 void StyleSettings::SetAlternatingRowColor(const Color& rColor)
1457 mxData->maColors.maAlternatingRowColor = rColor;
1460 const Color&
1461 StyleSettings::GetAlternatingRowColor() const
1463 return mxData->maColors.maAlternatingRowColor;
1466 void
1467 StyleSettings::SetUseSystemUIFonts( bool bUseSystemUIFonts )
1469 mxData->mbUseSystemUIFonts = bUseSystemUIFonts;
1472 bool
1473 StyleSettings::GetUseSystemUIFonts() const
1475 return mxData->mbUseSystemUIFonts;
1478 void StyleSettings::SetUseFontAAFromSystem(bool bUseFontAAFromSystem)
1480 mxData->mbUseFontAAFromSystem = bUseFontAAFromSystem;
1483 bool StyleSettings::GetUseFontAAFromSystem() const
1485 return mxData->mbUseFontAAFromSystem;
1488 void StyleSettings::SetUseSubpixelAA(bool val)
1490 mxData->mbUseSubpixelAA = val;
1493 bool StyleSettings::GetUseSubpixelAA() const
1495 return mxData->mbUseSubpixelAA;
1498 void
1499 StyleSettings::SetUseFlatBorders( bool bUseFlatBorders )
1501 mxData->mnUseFlatBorders = bUseFlatBorders;
1504 bool
1505 StyleSettings::GetUseFlatBorders() const
1507 return mxData->mnUseFlatBorders;
1510 void
1511 StyleSettings::SetUseFlatMenus( bool bUseFlatMenus )
1513 mxData->mnUseFlatMenus = bUseFlatMenus;
1516 bool
1517 StyleSettings::GetUseFlatMenus() const
1519 return mxData->mnUseFlatMenus;
1522 void
1523 StyleSettings::SetUseImagesInMenus( TriState eUseImagesInMenus )
1525 mxData->meUseImagesInMenus = eUseImagesInMenus;
1528 void
1529 StyleSettings::SetPreferredUseImagesInMenus( bool bPreferredUseImagesInMenus )
1531 mxData->mbPreferredUseImagesInMenus = bPreferredUseImagesInMenus;
1534 bool
1535 StyleSettings::GetPreferredUseImagesInMenus() const
1537 return mxData->mbPreferredUseImagesInMenus;
1540 void
1541 StyleSettings::SetSkipDisabledInMenus( bool bSkipDisabledInMenus )
1543 mxData->mbSkipDisabledInMenus = bSkipDisabledInMenus;
1546 bool
1547 StyleSettings::GetSkipDisabledInMenus() const
1549 return mxData->mbSkipDisabledInMenus;
1552 void
1553 StyleSettings::SetHideDisabledMenuItems( bool bHideDisabledMenuItems )
1555 mxData->mbHideDisabledMenuItems = bHideDisabledMenuItems;
1558 bool
1559 StyleSettings::GetHideDisabledMenuItems() const
1561 return mxData->mbHideDisabledMenuItems;
1564 void
1565 StyleSettings::SetContextMenuShortcuts( TriState eContextMenuShortcuts )
1567 mxData->meContextMenuShortcuts = eContextMenuShortcuts;
1570 bool
1571 StyleSettings::GetContextMenuShortcuts() const
1573 switch (mxData->meContextMenuShortcuts)
1575 case TRISTATE_FALSE:
1576 return false;
1577 case TRISTATE_TRUE:
1578 return true;
1579 default: // TRISTATE_INDET:
1580 return GetPreferredContextMenuShortcuts();
1584 void
1585 StyleSettings::SetPreferredContextMenuShortcuts( bool bContextMenuShortcuts )
1587 mxData->mbPreferredContextMenuShortcuts = bContextMenuShortcuts;
1590 bool
1591 StyleSettings::GetPreferredContextMenuShortcuts() const
1593 return mxData->mbPreferredContextMenuShortcuts;
1596 void
1597 StyleSettings::SetPrimaryButtonWarpsSlider( bool bPrimaryButtonWarpsSlider )
1599 mxData->mbPrimaryButtonWarpsSlider = bPrimaryButtonWarpsSlider;
1602 bool
1603 StyleSettings::GetPrimaryButtonWarpsSlider() const
1605 return mxData->mbPrimaryButtonWarpsSlider;
1608 void
1609 StyleSettings::SetAppFont( const vcl::Font& rFont )
1611 mxData->maFonts.maAppFont = rFont;
1614 const vcl::Font&
1615 StyleSettings::GetAppFont() const
1617 return mxData->maFonts.maAppFont;
1620 void
1621 StyleSettings::SetHelpFont( const vcl::Font& rFont )
1623 mxData->maFonts.maHelpFont = rFont;
1626 const vcl::Font&
1627 StyleSettings::GetHelpFont() const
1629 return mxData->maFonts.maHelpFont;
1632 void
1633 StyleSettings::SetTitleFont( const vcl::Font& rFont )
1635 mxData->maFonts.maTitleFont = rFont;
1638 const vcl::Font&
1639 StyleSettings::GetTitleFont() const
1641 return mxData->maFonts.maTitleFont;
1644 void
1645 StyleSettings::SetFloatTitleFont( const vcl::Font& rFont )
1647 mxData->maFonts.maFloatTitleFont = rFont;
1650 const vcl::Font&
1651 StyleSettings::GetFloatTitleFont() const
1653 return mxData->maFonts.maFloatTitleFont;
1656 void
1657 StyleSettings::SetMenuFont( const vcl::Font& rFont )
1659 mxData->maFonts.maMenuFont = rFont;
1662 const vcl::Font&
1663 StyleSettings::GetMenuFont() const
1665 return mxData->maFonts.maMenuFont;
1668 void
1669 StyleSettings::SetToolFont( const vcl::Font& rFont )
1671 mxData->maFonts.maToolFont = rFont;
1674 const vcl::Font&
1675 StyleSettings::GetToolFont() const
1677 return mxData->maFonts.maToolFont;
1680 void
1681 StyleSettings::SetGroupFont( const vcl::Font& rFont )
1683 mxData->maFonts.maGroupFont = rFont;
1686 const vcl::Font&
1687 StyleSettings::GetGroupFont() const
1689 return mxData->maFonts.maGroupFont;
1692 void
1693 StyleSettings::SetLabelFont( const vcl::Font& rFont )
1695 mxData->maFonts.maLabelFont = rFont;
1698 const vcl::Font&
1699 StyleSettings::GetLabelFont() const
1701 return mxData->maFonts.maLabelFont;
1704 void
1705 StyleSettings::SetRadioCheckFont( const vcl::Font& rFont )
1707 mxData->maFonts.maRadioCheckFont = rFont;
1710 const vcl::Font&
1711 StyleSettings::GetRadioCheckFont() const
1713 return mxData->maFonts.maRadioCheckFont;
1716 void
1717 StyleSettings::SetPushButtonFont( const vcl::Font& rFont )
1719 mxData->maFonts.maPushButtonFont = rFont;
1722 const vcl::Font&
1723 StyleSettings::GetPushButtonFont() const
1725 return mxData->maFonts.maPushButtonFont;
1728 void
1729 StyleSettings::SetFieldFont( const vcl::Font& rFont )
1731 mxData->maFonts.maFieldFont = rFont;
1734 const vcl::Font&
1735 StyleSettings::GetFieldFont() const
1737 return mxData->maFonts.maFieldFont;
1740 void
1741 StyleSettings::SetIconFont( const vcl::Font& rFont )
1743 mxData->maFonts.maIconFont = rFont;
1746 const vcl::Font&
1747 StyleSettings::GetIconFont() const
1749 return mxData->maFonts.maIconFont;
1752 void
1753 StyleSettings::SetTabFont( const vcl::Font& rFont )
1755 mxData->maFonts.maTabFont = rFont;
1758 const vcl::Font&
1759 StyleSettings::GetTabFont() const
1761 return mxData->maFonts.maTabFont;
1764 sal_Int32
1765 StyleSettings::GetBorderSize()
1767 return 1;
1770 void
1771 StyleSettings::SetTitleHeight( sal_Int32 nSize )
1773 mxData->mnTitleHeight = nSize;
1776 sal_Int32
1777 StyleSettings::GetTitleHeight() const
1779 return mxData->mnTitleHeight;
1782 void
1783 StyleSettings::SetFloatTitleHeight( sal_Int32 nSize )
1785 mxData->mnFloatTitleHeight = nSize;
1788 sal_Int32
1789 StyleSettings::GetFloatTitleHeight() const
1791 return mxData->mnFloatTitleHeight;
1794 void
1795 StyleSettings::SetScrollBarSize( sal_Int32 nSize )
1797 mxData->mnScrollBarSize = nSize;
1800 sal_Int32
1801 StyleSettings::GetScrollBarSize() const
1803 return mxData->mnScrollBarSize;
1806 void
1807 StyleSettings::SetMinThumbSize( sal_Int32 nSize )
1809 mxData->mnMinThumbSize = nSize;
1812 sal_Int32
1813 StyleSettings::GetMinThumbSize() const
1815 return mxData->mnMinThumbSize;
1818 void
1819 StyleSettings::SetSpinSize( sal_Int32 nSize )
1821 mxData->mnSpinSize = nSize;
1824 sal_Int32
1825 StyleSettings::GetSpinSize() const
1827 return mxData->mnSpinSize;
1830 sal_Int32
1831 StyleSettings::GetSplitSize()
1833 return 3;
1836 void
1837 StyleSettings::SetCursorSize( sal_Int32 nSize )
1839 mxData->mnCursorSize = nSize;
1842 sal_Int32
1843 StyleSettings::GetCursorSize() const
1845 return mxData->mnCursorSize;
1848 void
1849 StyleSettings::SetCursorBlinkTime( sal_uInt64 nBlinkTime )
1851 mxData->mnCursorBlinkTime = nBlinkTime;
1854 sal_uInt64
1855 StyleSettings::GetCursorBlinkTime() const
1857 return mxData->mnCursorBlinkTime;
1860 void
1861 StyleSettings::SetDragFullOptions( DragFullOptions nOptions )
1863 mxData->mnDragFullOptions = nOptions;
1866 DragFullOptions
1867 StyleSettings::GetDragFullOptions() const
1869 return mxData->mnDragFullOptions;
1872 void
1873 StyleSettings::SetSelectionOptions( SelectionOptions nOptions )
1875 mxData->mnSelectionOptions = nOptions;
1878 SelectionOptions
1879 StyleSettings::GetSelectionOptions() const
1881 return mxData->mnSelectionOptions;
1884 void
1885 StyleSettings::SetDisplayOptions( DisplayOptions nOptions )
1887 mxData->mnDisplayOptions = nOptions;
1890 DisplayOptions
1891 StyleSettings::GetDisplayOptions() const
1893 return mxData->mnDisplayOptions;
1896 void
1897 StyleSettings::SetAntialiasingMinPixelHeight( sal_Int32 nMinPixel )
1899 mxData->mnAntialiasedMin = nMinPixel;
1902 sal_Int32
1903 StyleSettings::GetAntialiasingMinPixelHeight() const
1905 return mxData->mnAntialiasedMin;
1908 void
1909 StyleSettings::SetOptions( StyleSettingsOptions nOptions )
1911 mxData->mnOptions = nOptions;
1914 void
1915 StyleSettings::SetAutoMnemonic( bool bAutoMnemonic )
1917 mxData->mbAutoMnemonic = bAutoMnemonic;
1920 bool
1921 StyleSettings::GetAutoMnemonic() const
1923 return mxData->mbAutoMnemonic;
1926 bool
1927 StyleSettings::GetDockingFloatsSupported()
1929 ImplSVData* pSVData = ImplGetSVData();
1930 return pSVData->maNWFData.mbCanDetermineWindowPosition;
1933 void
1934 StyleSettings::SetToolbarIconSize( ToolbarIconSize nSize )
1936 mxData->mnToolbarIconSize = nSize;
1939 ToolbarIconSize
1940 StyleSettings::GetToolbarIconSize() const
1942 return mxData->mnToolbarIconSize;
1945 Size StyleSettings::GetToolbarIconSizePixel() const
1947 switch (GetToolbarIconSize())
1949 case ToolbarIconSize::Large:
1950 return Size(24, 24);
1951 case ToolbarIconSize::Size32:
1952 return Size(32, 32);
1953 case ToolbarIconSize::Small:
1954 default:
1955 return Size(16, 16);
1959 const DialogStyle&
1960 StyleSettings::GetDialogStyle() const
1962 return mxData->maDialogStyle;
1965 void
1966 StyleSettings::SetEdgeBlending(sal_uInt16 nCount)
1968 mxData->mnEdgeBlending = nCount;
1971 sal_uInt16
1972 StyleSettings::GetEdgeBlending() const
1974 return mxData->mnEdgeBlending;
1977 const Color&
1978 StyleSettings::GetEdgeBlendingTopLeftColor() const
1980 return mxData->maEdgeBlendingTopLeftColor;
1983 const Color&
1984 StyleSettings::GetEdgeBlendingBottomRightColor() const
1986 return mxData->maEdgeBlendingBottomRightColor;
1989 void
1990 StyleSettings::SetListBoxMaximumLineCount(sal_uInt16 nCount)
1992 mxData->mnListBoxMaximumLineCount = nCount;
1995 sal_uInt16
1996 StyleSettings::GetListBoxMaximumLineCount() const
1998 return mxData->mnListBoxMaximumLineCount;
2001 void
2002 StyleSettings::SetColorValueSetColumnCount(sal_uInt16 nCount)
2004 mxData->mnColorValueSetColumnCount = nCount;
2007 sal_uInt16
2008 StyleSettings::GetColorValueSetColumnCount() const
2010 return mxData->mnColorValueSetColumnCount;
2013 sal_uInt16
2014 StyleSettings::GetListBoxPreviewDefaultLineWidth()
2016 return 1;
2019 void StyleSettings::SetComboBoxTextSelectionMode(
2020 ComboBoxTextSelectionMode eMode)
2022 mxData->meComboBoxTextSelectionMode = eMode;
2025 ComboBoxTextSelectionMode StyleSettings::GetComboBoxTextSelectionMode() const
2027 return mxData->meComboBoxTextSelectionMode;
2030 void
2031 StyleSettings::SetPreviewUsesCheckeredBackground(bool bNew)
2033 mxData->mbPreviewUsesCheckeredBackground = bNew;
2036 bool
2037 StyleSettings::GetPreviewUsesCheckeredBackground() const
2039 return mxData->mbPreviewUsesCheckeredBackground;
2042 void StyleSettings::SetListBoxPreviewDefaultLogicSize(Size const& rSize)
2044 auto* myData = mxData.get();
2045 myData->maListBoxPreviewDefaultLogicSize = rSize;
2046 mxData->maListBoxPreviewDefaultPixelSize = {}; // recalc
2049 const Size& StyleSettings::GetListBoxPreviewDefaultPixelSize() const
2051 if(0 == mxData->maListBoxPreviewDefaultPixelSize.Width() || 0 == mxData->maListBoxPreviewDefaultPixelSize.Height())
2053 mxData->maListBoxPreviewDefaultPixelSize =
2054 Application::GetDefaultDevice()->LogicToPixel(mxData->maListBoxPreviewDefaultLogicSize, MapMode(MapUnit::MapAppFont));
2057 return mxData->maListBoxPreviewDefaultPixelSize;
2060 void StyleSettings::Set3DColors( const Color& rColor )
2062 auto* myData = mxData.get();
2063 myData->maColors.maFaceColor = rColor;
2064 myData->maColors.maLightBorderColor = rColor;
2065 myData->maColors.maMenuBorderColor = rColor;
2066 myData->maColors.maDarkShadowColor = COL_BLACK;
2067 if ( rColor != COL_LIGHTGRAY )
2069 myData->maColors.maLightColor = rColor;
2070 myData->maColors.maShadowColor = rColor;
2071 myData->maColors.maDarkShadowColor = rColor;
2073 if (!rColor.IsDark())
2075 myData->maColors.maLightColor.IncreaseLuminance(64);
2076 myData->maColors.maShadowColor.DecreaseLuminance(64);
2077 myData->maColors.maDarkShadowColor.DecreaseLuminance(100);
2079 else
2081 myData->maColors.maLightColor.DecreaseLuminance(64);
2082 myData->maColors.maShadowColor.IncreaseLuminance(64);
2083 myData->maColors.maDarkShadowColor.IncreaseLuminance(100);
2086 sal_uInt8 nRed = (myData->maColors.maLightColor.GetRed() + myData->maColors.maShadowColor.GetRed()) / 2;
2087 sal_uInt8 nGreen = (myData->maColors.maLightColor.GetGreen() + myData->maColors.maShadowColor.GetGreen()) / 2;
2088 sal_uInt8 nBlue = (myData->maColors.maLightColor.GetBlue() + myData->maColors.maShadowColor.GetBlue()) / 2;
2089 myData->maColors.maCheckedColor = Color(nRed, nGreen, nBlue);
2091 else
2093 myData->maColors.maCheckedColor = Color( 0x99, 0x99, 0x99 );
2094 myData->maColors.maLightColor = COL_WHITE;
2095 myData->maColors.maShadowColor = COL_GRAY;
2099 void StyleSettings::SetCheckedColorSpecialCase( )
2101 auto* myData = mxData.get();
2102 // Light gray checked color special case
2103 if ( GetFaceColor() == COL_LIGHTGRAY )
2104 myData->maColors.maCheckedColor = Color(0xCC, 0xCC, 0xCC);
2105 else
2107 sal_uInt8 nRed = static_cast<sal_uInt8>((static_cast<sal_uInt16>(myData->maColors.maFaceColor.GetRed()) + static_cast<sal_uInt16>(myData->maColors.maLightColor.GetRed()))/2);
2108 sal_uInt8 nGreen = static_cast<sal_uInt8>((static_cast<sal_uInt16>(myData->maColors.maFaceColor.GetGreen()) + static_cast<sal_uInt16>(myData->maColors.maLightColor.GetGreen()))/2);
2109 sal_uInt8 nBlue = static_cast<sal_uInt8>((static_cast<sal_uInt16>(myData->maColors.maFaceColor.GetBlue()) + static_cast<sal_uInt16>(myData->maColors.maLightColor.GetBlue()))/2);
2110 myData->maColors.maCheckedColor = Color(nRed, nGreen, nBlue);
2114 bool StyleSettings::GetUseImagesInMenus() const
2116 // icon mode selected in Tools -> Options... -> OpenOffice.org -> View
2117 switch (mxData->meUseImagesInMenus) {
2118 case TRISTATE_FALSE:
2119 return false;
2120 case TRISTATE_TRUE:
2121 return true;
2122 default: // TRISTATE_INDET:
2123 return GetPreferredUseImagesInMenus();
2127 static BitmapEx readBitmapEx( const OUString& rPath )
2129 OUString aPath( rPath );
2130 rtl::Bootstrap::expandMacros( aPath );
2132 // import the image
2133 Graphic aGraphic;
2134 if ( GraphicFilter::LoadGraphic( aPath, OUString(), aGraphic ) != ERRCODE_NONE )
2135 return BitmapEx();
2136 return aGraphic.GetBitmapEx();
2139 namespace {
2141 enum WhichPersona { PERSONA_HEADER, PERSONA_FOOTER };
2145 /** Update the setting of the Persona header / footer in ImplStyleData */
2146 static void setupPersonaHeaderFooter( WhichPersona eWhich, OUString& rHeaderFooter, BitmapEx& rHeaderFooterBitmap, std::optional<Color>& rMenuBarTextColor )
2148 // don't burn time loading images we don't need.
2149 if ( Application::IsHeadlessModeEnabled() )
2150 return;
2152 // read from the configuration
2153 OUString aPersona( officecfg::Office::Common::Misc::Persona::get() );
2154 OUString aPersonaSettings( officecfg::Office::Common::Misc::PersonaSettings::get() );
2156 // have the settings changed? marks if header /footer prepared before
2157 //should maybe extended to a flag that marks if header /footer /both are loaded
2158 OUString aOldValue= eWhich==PERSONA_HEADER?OUString(aPersona + ";" + aPersonaSettings+";h" ):OUString(aPersona + ";" + aPersonaSettings+";f" );
2159 if ( rHeaderFooter == aOldValue )
2160 return;
2162 rHeaderFooter = aOldValue;
2163 rHeaderFooterBitmap = BitmapEx();
2164 rMenuBarTextColor.reset();
2166 // now read the new values and setup bitmaps
2167 OUString aHeader, aFooter;
2168 if ( aPersona == "own" || aPersona == "default" )
2170 sal_Int32 nIndex = 0;
2172 // Skip the persona slug, name, and preview
2173 aHeader = aPersonaSettings.getToken( 3, ';', nIndex );
2175 if ( nIndex > 0 )
2176 aFooter = aPersonaSettings.getToken( 0, ';', nIndex );
2178 // change menu text color, advance nIndex to skip the '#'
2179 if ( nIndex > 0 )
2181 OUString aColor = aPersonaSettings.getToken( 0, ';', ++nIndex );
2182 rMenuBarTextColor = Color( ColorTransparency, aColor.toUInt32( 16 ) );
2186 OUString aName;
2187 switch ( eWhich ) {
2188 case PERSONA_HEADER: aName = aHeader; break;
2189 case PERSONA_FOOTER: aName = aFooter; break;
2192 if ( !aName.isEmpty() )
2194 OUString gallery(u""_ustr);
2195 // try the gallery first, then the program path:
2196 if ( aPersona == "own" && !aPersonaSettings.startsWith( "vnd.sun.star.expand" ) )
2198 gallery = "${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE( "bootstrap") "::UserInstallation}";
2199 rtl::Bootstrap::expandMacros( gallery );
2200 gallery += "/user/gallery/personas/";
2202 else if ( aPersona == "default" )
2204 gallery = "$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER "/gallery/personas/";
2206 rHeaderFooterBitmap = readBitmapEx( gallery + aName );
2208 if ( rHeaderFooterBitmap.IsEmpty() )
2209 rHeaderFooterBitmap = readBitmapEx( "$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" + aName );
2212 // Something went wrong. Probably, the images are missing. Clear the persona properties in the registry.
2214 if( rHeaderFooterBitmap.IsEmpty() )
2216 std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
2217 officecfg::Office::Common::Misc::Persona::set( u"no"_ustr, batch );
2218 officecfg::Office::Common::Misc::PersonaSettings::set( u""_ustr, batch );
2219 batch->commit();
2223 BitmapEx const & StyleSettings::GetPersonaHeader() const
2225 setupPersonaHeaderFooter( PERSONA_HEADER, mxData->maPersonaHeaderFooter, mxData->maPersonaHeaderBitmap, mxData->maPersonaMenuBarTextColor );
2226 return mxData->maPersonaHeaderBitmap;
2229 BitmapEx const & StyleSettings::GetPersonaFooter() const
2231 setupPersonaHeaderFooter( PERSONA_FOOTER, mxData->maPersonaHeaderFooter, mxData->maPersonaFooterBitmap, mxData->maPersonaMenuBarTextColor );
2232 return mxData->maPersonaFooterBitmap;
2235 const std::optional<Color>& StyleSettings::GetPersonaMenuBarTextColor() const
2237 GetPersonaHeader();
2238 return mxData->maPersonaMenuBarTextColor;
2241 void StyleSettings::SetStandardStyles()
2243 mxData->SetStandardStyles();
2246 Color StyleSettings::GetFaceGradientColor() const
2248 // compute a brighter face color that can be used in gradients
2249 // for a convex look (eg toolbars)
2251 sal_uInt16 h, s, b;
2252 GetFaceColor().RGBtoHSB( h, s, b );
2253 if( s > 1) s=1;
2254 if( b < 98) b=98;
2255 return Color::HSBtoRGB( h, s, b );
2258 Color StyleSettings::GetSeparatorColor() const
2260 // compute a brighter shadow color for separators (used in toolbars or between menubar and toolbars on Windows XP)
2261 sal_uInt16 h, s, b;
2262 GetShadowColor().RGBtoHSB( h, s, b );
2263 b += b/4;
2264 s -= s/4;
2265 return Color::HSBtoRGB( h, s, b );
2268 // Until Clang 14, P2085R0 is unsupported, and the operator can't be default outside of declaration
2269 bool StyleSettings::operator ==( const StyleSettings& rSet ) const
2271 return mxData == rSet.mxData;
2274 bool ImplStyleData::operator==(const ImplStyleData& rSet) const
2276 if (mIconTheme != rSet.mIconTheme) {
2277 return false;
2280 if (mIconThemeSelector != rSet.mIconThemeSelector) {
2281 return false;
2284 return (mnOptions == rSet.mnOptions) &&
2285 (mbAutoMnemonic == rSet.mbAutoMnemonic) &&
2286 (mnDragFullOptions == rSet.mnDragFullOptions) &&
2287 (mnSelectionOptions == rSet.mnSelectionOptions) &&
2288 (mnDisplayOptions == rSet.mnDisplayOptions) &&
2289 (mnCursorSize == rSet.mnCursorSize) &&
2290 (mnCursorBlinkTime == rSet.mnCursorBlinkTime) &&
2291 (mnTitleHeight == rSet.mnTitleHeight) &&
2292 (mnFloatTitleHeight == rSet.mnFloatTitleHeight) &&
2293 (mnScrollBarSize == rSet.mnScrollBarSize) &&
2294 (mnMinThumbSize == rSet.mnMinThumbSize) &&
2295 (mnSpinSize == rSet.mnSpinSize) &&
2296 (mnAntialiasedMin == rSet.mnAntialiasedMin) &&
2297 (mbHighContrast == rSet.mbHighContrast) &&
2298 (mbUseSystemUIFonts == rSet.mbUseSystemUIFonts) &&
2299 (mbUseFontAAFromSystem == rSet.mbUseFontAAFromSystem) &&
2300 (mbUseSubpixelAA == rSet.mbUseSubpixelAA) &&
2301 (mnUseFlatBorders == rSet.mnUseFlatBorders) &&
2302 (mnUseFlatMenus == rSet.mnUseFlatMenus) &&
2303 (maColors == rSet.maColors) &&
2304 (maFonts == rSet.maFonts) &&
2305 (meUseImagesInMenus == rSet.meUseImagesInMenus) &&
2306 (mbPreferredUseImagesInMenus == rSet.mbPreferredUseImagesInMenus) &&
2307 (mbSkipDisabledInMenus == rSet.mbSkipDisabledInMenus) &&
2308 (mbHideDisabledMenuItems == rSet.mbHideDisabledMenuItems) &&
2309 (mbPreferredContextMenuShortcuts == rSet.mbPreferredContextMenuShortcuts) &&
2310 (meContextMenuShortcuts == rSet.meContextMenuShortcuts) &&
2311 (mbPrimaryButtonWarpsSlider == rSet.mbPrimaryButtonWarpsSlider) &&
2312 (mnEdgeBlending == rSet.mnEdgeBlending) &&
2313 (maEdgeBlendingTopLeftColor == rSet.maEdgeBlendingTopLeftColor) &&
2314 (maEdgeBlendingBottomRightColor == rSet.maEdgeBlendingBottomRightColor) &&
2315 (mnListBoxMaximumLineCount == rSet.mnListBoxMaximumLineCount) &&
2316 (mnColorValueSetColumnCount == rSet.mnColorValueSetColumnCount) &&
2317 (maListBoxPreviewDefaultLogicSize == rSet.maListBoxPreviewDefaultLogicSize) &&
2318 (mbPreviewUsesCheckeredBackground == rSet.mbPreviewUsesCheckeredBackground);
2321 ImplMiscData::ImplMiscData() :
2322 mnDisablePrinting(TRISTATE_INDET)
2324 static const char* pEnv = getenv("SAL_DECIMALSEP_ENABLED" ); // set default without UI
2325 mbEnableLocalizedDecimalSep = (pEnv != nullptr);
2328 MiscSettings::MiscSettings()
2329 : mxData(std::make_shared<ImplMiscData>())
2333 bool MiscSettings::operator ==( const MiscSettings& rSet ) const
2335 if ( mxData == rSet.mxData )
2336 return true;
2338 return (mxData->mnDisablePrinting == rSet.mxData->mnDisablePrinting ) &&
2339 (mxData->mbEnableLocalizedDecimalSep == rSet.mxData->mbEnableLocalizedDecimalSep );
2342 bool
2343 MiscSettings::operator !=( const MiscSettings& rSet ) const
2345 return !(*this == rSet);
2348 bool MiscSettings::GetDisablePrinting() const
2350 if( mxData->mnDisablePrinting == TRISTATE_INDET )
2352 OUString aEnable =
2353 vcl::SettingsConfigItem::get()->
2354 getValue( u"DesktopManagement"_ustr,
2355 u"DisablePrinting"_ustr );
2356 mxData->mnDisablePrinting = aEnable.equalsIgnoreAsciiCase("true") ? TRISTATE_TRUE : TRISTATE_FALSE;
2359 return mxData->mnDisablePrinting != TRISTATE_FALSE;
2362 bool MiscSettings::GetEnableATToolSupport()
2364 static const char* pEnv = getenv("SAL_ACCESSIBILITY_ENABLED");
2365 if (pEnv && *pEnv)
2366 return pEnv[0] != '0';
2368 ImplSVData* pSVData = ImplGetSVData();
2369 return pSVData->mxAccessBridge.is();
2372 void MiscSettings::SetEnableLocalizedDecimalSep( bool bEnable )
2374 // copy if other references exist
2375 if (mxData.use_count() > 1)
2377 mxData = std::make_shared<ImplMiscData>(*mxData);
2379 mxData->mbEnableLocalizedDecimalSep = bEnable;
2382 bool MiscSettings::GetEnableLocalizedDecimalSep() const
2384 return mxData->mbEnableLocalizedDecimalSep;
2387 int MiscSettings::GetDarkMode()
2389 return officecfg::Office::Common::Misc::Appearance::get();
2392 void MiscSettings::SetDarkMode(int nMode)
2394 std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
2395 officecfg::Office::Common::Misc::Appearance::set(nMode, batch);
2396 batch->commit();
2398 vcl::Window *pWin = Application::GetFirstTopLevelWindow();
2399 while (pWin)
2401 pWin->ImplGetFrame()->UpdateDarkMode();
2402 pWin = Application::GetNextTopLevelWindow(pWin);
2406 bool MiscSettings::GetUseDarkMode()
2408 vcl::Window* pDefWindow = ImplGetDefaultWindow();
2409 if (pDefWindow == nullptr)
2410 return false;
2411 return pDefWindow->ImplGetFrame()->GetUseDarkMode();
2414 int MiscSettings::GetAppColorMode()
2416 if (comphelper::IsFuzzing())
2417 return 0;
2418 return officecfg::Office::Common::Misc::ApplicationAppearance::get();
2421 void MiscSettings::SetAppColorMode(int nMode)
2423 std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
2424 officecfg::Office::Common::Misc::ApplicationAppearance::set(nMode, batch);
2425 batch->commit();
2428 bool MiscSettings::GetUseReducedAnimation()
2430 vcl::Window* pDefWindow = ImplGetDefaultWindow();
2431 if (pDefWindow == nullptr)
2432 return false;
2433 return pDefWindow->ImplGetFrame()->GetUseReducedAnimation();
2436 // tdf#115688: Let the user choose in the accessibility option page ("Tools" --> "Options" --> "Accessibility --> "Allow other animations") if the "marching ants" animation is allowed.
2437 // tdf#161765: Let the user choose which animation settings to use: OS's / LO's
2438 // New options: "System"/"No"/"Yes".
2439 // Do respect OS's animation setting if the user has selected the option "System"
2440 bool MiscSettings::IsAnimatedOthersAllowed()
2442 sal_Int16 nAllowAnimatedOthers = officecfg::Office::Common::Accessibility::AllowAnimatedOthers::get();
2443 bool bIsAllowed = false; // false is the default value, if someone sets the enum to other values than the allowed ones.
2444 switch (nAllowAnimatedOthers)
2446 case 0: // "System": Use OS's setting
2447 bIsAllowed = ! MiscSettings::GetUseReducedAnimation();
2448 break;
2449 case 1: // "No": Disallow animation
2450 bIsAllowed = false;
2451 break;
2452 case 2: // "Yes": Allow animation
2453 bIsAllowed = true;
2454 break;
2455 default:
2456 SAL_WARN( "accessibility", "Invalid value of AllowAnimatedOthers: 0x" << std::hex << nAllowAnimatedOthers << std::dec);
2457 break;
2459 return bIsAllowed;
2462 // tdf#161765: Let the user choose which animation settings to use: OS's / LO's
2463 // New options: "System"/"No"/"Yes".
2464 // Do respect OS's animation setting if the user has selected the option "System"
2465 bool MiscSettings::IsAnimatedGraphicAllowed()
2467 sal_Int16 nAllowAnimatedGraphic = officecfg::Office::Common::Accessibility::AllowAnimatedGraphic::get();
2468 bool bIsAllowed = false; // false is the default value, if someone sets the enum to other values than the allowed ones.
2469 switch (nAllowAnimatedGraphic)
2471 case 0: // "System": Use OS's setting
2472 bIsAllowed = ! MiscSettings::GetUseReducedAnimation();
2473 break;
2474 case 1: // "No": Disallow animation
2475 bIsAllowed = false;
2476 break;
2477 case 2: // "Yes": Allow animation
2478 bIsAllowed = true;
2479 break;
2480 default:
2481 SAL_WARN( "accessibility", "Invalid value of officecfg::Office::Common::Accessibility::AllowAnimatedGraphic: 0x" << std::hex << nAllowAnimatedGraphic << std::dec);
2482 break;
2484 return bIsAllowed;
2487 // tdf#161765: Let the user choose which animation settings to use: OS's / LO's
2488 // New options: "System"/"No"/"Yes".
2489 // Do respect OS's animation setting if the user has selected the option "System"
2490 bool MiscSettings::IsAnimatedTextAllowed()
2492 sal_Int16 nAllowAnimatedText = officecfg::Office::Common::Accessibility::AllowAnimatedText::get();
2493 bool bIsAllowed = false; // false is the default value, if someone sets the enum to other values than the allowed ones.
2494 switch (nAllowAnimatedText)
2496 case 0: // "System": Use OS's setting
2497 bIsAllowed = ! MiscSettings::GetUseReducedAnimation();
2498 break;
2499 case 1: // "No": Disallow animation
2500 bIsAllowed = false;
2501 break;
2502 case 2: // "Yes": Allow animation
2503 bIsAllowed = true;
2504 break;
2505 default:
2506 SAL_WARN( "accessibility", "Invalid value of officecfg::Office::Common::Accessibility::AllowAnimatedText: 0x" << std::hex << nAllowAnimatedText << std::dec);
2507 break;
2509 return bIsAllowed;
2512 HelpSettings::HelpSettings()
2513 : mxData(std::make_shared<ImplHelpData>())
2517 bool HelpSettings::operator ==( const HelpSettings& rSet ) const
2519 if ( mxData == rSet.mxData )
2520 return true;
2522 return (mxData->mnTipTimeout == rSet.mxData->mnTipTimeout );
2525 sal_Int32
2526 HelpSettings::GetTipDelay()
2528 return 500;
2531 void
2532 HelpSettings::SetTipTimeout( sal_Int32 nTipTimeout )
2534 // copy if other references exist
2535 if (mxData.use_count() > 1)
2537 mxData = std::make_shared<ImplHelpData>(*mxData);
2539 mxData->mnTipTimeout = nTipTimeout;
2542 sal_Int32
2543 HelpSettings::GetTipTimeout() const
2545 return mxData->mnTipTimeout;
2548 sal_Int32
2549 HelpSettings::GetBalloonDelay()
2551 return 1500;
2554 bool
2555 HelpSettings::operator !=( const HelpSettings& rSet ) const
2557 return !(*this == rSet);
2560 ImplAllSettingsData::ImplAllSettingsData()
2562 maLocale( maSysLocale.GetLanguageTag() ),
2563 maUILocale( maSysLocale.GetUILanguageTag() )
2565 if (!comphelper::IsFuzzing())
2566 maMiscSettings.SetEnableLocalizedDecimalSep( maSysLocale.GetOptions().IsDecimalSeparatorAsLocale() );
2569 ImplAllSettingsData::ImplAllSettingsData( const ImplAllSettingsData& rData ) :
2570 maMouseSettings( rData.maMouseSettings ),
2571 maStyleSettings( rData.maStyleSettings ),
2572 maMiscSettings( rData.maMiscSettings ),
2573 maHelpSettings( rData.maHelpSettings ),
2574 maLocale( rData.maLocale ),
2575 maUILocale( rData.maUILocale )
2577 // Create the cache objects new when their getter is called.
2580 ImplAllSettingsData::~ImplAllSettingsData()
2582 mpLocaleDataWrapper.reset();
2583 mpUILocaleDataWrapper.reset();
2584 mpNeutralLocaleDataWrapper.reset();
2585 mpI18nHelper.reset();
2586 mpUII18nHelper.reset();
2589 AllSettings::AllSettings() = default;
2590 AllSettings::AllSettings(const AllSettings&) = default;
2591 AllSettings::~AllSettings() = default;
2592 AllSettings& AllSettings::operator=(const AllSettings&) = default;
2594 AllSettingsFlags AllSettings::Update( AllSettingsFlags nFlags, const AllSettings& rSet )
2596 const auto* constData = std::as_const(mxData).get();
2597 AllSettingsFlags nChangeFlags = AllSettingsFlags::NONE;
2599 if ( nFlags & AllSettingsFlags::MOUSE )
2601 if (constData->maMouseSettings != rSet.mxData->maMouseSettings)
2603 mxData->maMouseSettings = rSet.mxData->maMouseSettings;
2604 nChangeFlags |= AllSettingsFlags::MOUSE;
2608 if ( nFlags & AllSettingsFlags::STYLE )
2610 if (constData->maStyleSettings != rSet.mxData->maStyleSettings)
2612 mxData->maStyleSettings = rSet.mxData->maStyleSettings;
2613 nChangeFlags |= AllSettingsFlags::STYLE;
2617 if ( nFlags & AllSettingsFlags::MISC )
2619 if (constData->maMiscSettings != rSet.mxData->maMiscSettings)
2621 mxData->maMiscSettings = rSet.mxData->maMiscSettings;
2622 nChangeFlags |= AllSettingsFlags::MISC;
2626 if ( nFlags & AllSettingsFlags::LOCALE )
2628 if (constData->maLocale != rSet.mxData->maLocale)
2630 SetLanguageTag( rSet.mxData->maLocale );
2631 nChangeFlags |= AllSettingsFlags::LOCALE;
2635 return nChangeFlags;
2638 AllSettingsFlags AllSettings::GetChangeFlags( const AllSettings& rSet ) const
2641 AllSettingsFlags nChangeFlags = AllSettingsFlags::NONE;
2643 if ( mxData->maStyleSettings != rSet.mxData->maStyleSettings )
2644 nChangeFlags |= AllSettingsFlags::STYLE;
2646 if ( mxData->maMiscSettings != rSet.mxData->maMiscSettings )
2647 nChangeFlags |= AllSettingsFlags::MISC;
2649 if ( mxData->maLocale != rSet.mxData->maLocale )
2650 nChangeFlags |= AllSettingsFlags::LOCALE;
2652 return nChangeFlags;
2655 // Until Clang 14, P2085R0 is unsupported, and the operator can't be default outside of declaration
2656 bool AllSettings::operator ==( const AllSettings& rSet ) const
2658 return mxData == rSet.mxData;
2661 bool ImplAllSettingsData::operator==(const ImplAllSettingsData& rSet) const
2663 return (maMouseSettings == rSet.maMouseSettings) &&
2664 (maStyleSettings == rSet.maStyleSettings) &&
2665 (maMiscSettings == rSet.maMiscSettings) &&
2666 (maHelpSettings == rSet.maHelpSettings) &&
2667 (maLocale == rSet.maLocale);
2670 void AllSettings::SetLanguageTag(const OUString& rLanguage, bool bCanonicalize)
2672 SetLanguageTag(LanguageTag(rLanguage, bCanonicalize));
2675 void AllSettings::SetLanguageTag( const LanguageTag& rLanguageTag )
2677 if (std::as_const(mxData)->maLocale == rLanguageTag)
2678 return;
2680 auto* myData = mxData.get();
2682 myData->maLocale
2683 = rLanguageTag.isSystemLocale() ? GetSysLocale().GetLanguageTag() : rLanguageTag;
2685 if ( myData->mpLocaleDataWrapper )
2687 myData->mpLocaleDataWrapper.reset();
2689 if ( myData->mpI18nHelper )
2691 myData->mpI18nHelper.reset();
2695 namespace
2697 bool GetConfigLayoutRTL(bool bMath)
2699 static const char* pEnv = getenv("SAL_RTL_ENABLED" );
2700 static int nUIMirroring = -1; // -1: undef, 0: auto, 1: on 2: off
2702 // environment always overrides
2703 if( pEnv )
2704 return true;
2706 bool bRTL = false;
2708 if( nUIMirroring == -1 )
2710 nUIMirroring = 0; // ask configuration only once
2711 utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithComponentContext(
2712 comphelper::getProcessComponentContext(),
2713 u"org.openoffice.Office.Common/I18N/CTL"_ustr ); // note: case sensitive !
2714 if ( aNode.isValid() )
2716 bool bTmp = bool();
2717 css::uno::Any aValue = aNode.getNodeValue( u"UIMirroring"_ustr );
2718 if( aValue >>= bTmp )
2720 // found true or false; if it was nil, nothing is changed
2721 nUIMirroring = bTmp ? 1 : 2;
2726 if( nUIMirroring == 0 ) // no config found (eg, setup) or default (nil) was set: check language
2728 LanguageType aLang = SvtSysLocaleOptions().GetRealUILanguageTag().getLanguageType();
2729 if (bMath)
2730 bRTL = MsLangId::isRightToLeftMath( aLang );
2731 else
2732 bRTL = MsLangId::isRightToLeft( aLang );
2734 else
2735 bRTL = (nUIMirroring == 1);
2737 return bRTL;
2741 bool AllSettings::GetLayoutRTL()
2743 if (comphelper::IsFuzzing())
2744 return false;
2745 return GetConfigLayoutRTL(false);
2748 bool AllSettings::GetMathLayoutRTL()
2750 if (comphelper::IsFuzzing())
2751 return false;
2752 return GetConfigLayoutRTL(true);
2755 const LanguageTag& AllSettings::GetLanguageTag() const
2757 if (comphelper::IsFuzzing())
2759 static LanguageTag aRet(u"en-US"_ustr);
2760 return aRet;
2763 if (comphelper::LibreOfficeKit::isActive())
2764 return comphelper::LibreOfficeKit::getLanguageTag();
2766 assert(!mxData->maLocale.isSystemLocale());
2768 return mxData->maLocale;
2771 const LanguageTag& AllSettings::GetUILanguageTag() const
2773 if (comphelper::IsFuzzing())
2775 static LanguageTag aRet(u"en-US"_ustr);
2776 return aRet;
2779 if (comphelper::LibreOfficeKit::isActive())
2780 return comphelper::LibreOfficeKit::getLanguageTag();
2782 assert(!mxData->maUILocale.isSystemLocale());
2784 return mxData->maUILocale;
2787 const LocaleDataWrapper& AllSettings::GetLocaleDataWrapper() const
2789 if ( !mxData->mpLocaleDataWrapper )
2790 mxData->mpLocaleDataWrapper.reset( new LocaleDataWrapper(
2791 comphelper::getProcessComponentContext(), GetLanguageTag() ) );
2792 return *mxData->mpLocaleDataWrapper;
2795 const LocaleDataWrapper& AllSettings::GetUILocaleDataWrapper() const
2797 if ( !mxData->mpUILocaleDataWrapper )
2798 mxData->mpUILocaleDataWrapper.reset( new LocaleDataWrapper(
2799 comphelper::getProcessComponentContext(), GetUILanguageTag() ) );
2800 return *mxData->mpUILocaleDataWrapper;
2803 const LocaleDataWrapper& AllSettings::GetNeutralLocaleDataWrapper() const
2805 if ( !mxData->mpNeutralLocaleDataWrapper )
2806 mxData->mpNeutralLocaleDataWrapper.reset( new LocaleDataWrapper(
2807 comphelper::getProcessComponentContext(), LanguageTag(u"en-US"_ustr) ) );
2808 return *mxData->mpNeutralLocaleDataWrapper;
2811 const vcl::I18nHelper& AllSettings::GetLocaleI18nHelper() const
2813 if ( !mxData->mpI18nHelper ) {
2814 mxData->mpI18nHelper.reset( new vcl::I18nHelper(
2815 comphelper::getProcessComponentContext(), GetLanguageTag() ) );
2817 return *mxData->mpI18nHelper;
2820 const vcl::I18nHelper& AllSettings::GetUILocaleI18nHelper() const
2822 if ( !mxData->mpUII18nHelper ) {
2823 mxData->mpUII18nHelper.reset( new vcl::I18nHelper(
2824 comphelper::getProcessComponentContext(), GetUILanguageTag() ) );
2826 return *mxData->mpUII18nHelper;
2829 void AllSettings::LocaleSettingsChanged( ConfigurationHints nHint )
2831 AllSettings aAllSettings( Application::GetSettings() );
2832 if ( nHint & ConfigurationHints::DecSep )
2834 MiscSettings aMiscSettings = aAllSettings.GetMiscSettings();
2835 bool bIsDecSepAsLocale = aAllSettings.GetSysLocale().GetOptions().IsDecimalSeparatorAsLocale();
2836 if ( aMiscSettings.GetEnableLocalizedDecimalSep() != bIsDecSepAsLocale )
2838 aMiscSettings.SetEnableLocalizedDecimalSep( bIsDecSepAsLocale );
2839 aAllSettings.SetMiscSettings( aMiscSettings );
2843 if ( nHint & ConfigurationHints::Locale )
2844 aAllSettings.SetLanguageTag(aAllSettings.GetSysLocale().GetOptions().GetLanguageTag());
2846 Application::SetSettings( aAllSettings );
2849 const StyleSettings&
2850 AllSettings::GetStyleSettings() const
2852 return mxData->maStyleSettings;
2855 StyleSettingsOptions
2856 StyleSettings::GetOptions() const
2858 return mxData->mnOptions;
2861 std::vector<vcl::IconThemeInfo> const &
2862 StyleSettings::GetInstalledIconThemes() const
2864 if (!mxData->mIconThemeScanner) {
2865 mxData->mIconThemeScanner.emplace(vcl::IconThemeScanner::GetStandardIconThemePath());
2867 return mxData->mIconThemeScanner->GetFoundIconThemes();
2870 OUString
2871 StyleSettings::GetAutomaticallyChosenIconTheme() const
2873 return mxData->mIconThemeSelector.SelectIconThemeForDesktopEnvironment(
2874 GetInstalledIconThemes(),
2875 Application::GetDesktopEnvironment());
2878 void
2879 StyleSettings::SetIconTheme(const OUString& theme)
2881 mxData->mIconTheme = theme;
2884 OUString
2885 StyleSettings::DetermineIconTheme() const
2887 OUString sTheme(mxData->mIconTheme);
2888 if (sTheme.isEmpty())
2890 if (comphelper::IsFuzzing())
2891 sTheme = "colibre";
2892 else
2894 // read from the configuration, or fallback to what the desktop wants
2895 sTheme = officecfg::Office::Common::Misc::SymbolStyle::get();
2897 if (sTheme.isEmpty() || sTheme == "auto")
2898 sTheme = GetAutomaticallyChosenIconTheme();
2902 return mxData->mIconThemeSelector.SelectIconTheme(
2903 GetInstalledIconThemes(),
2904 sTheme);
2907 void
2908 StyleSettings::SetHighContrastMode(bool bHighContrast )
2910 if (std::as_const(mxData)->mbHighContrast == bHighContrast) {
2911 return;
2914 auto* myData = mxData.get();
2915 myData->mbHighContrast = bHighContrast;
2916 myData->mIconThemeSelector.SetUseHighContrastTheme(bHighContrast);
2919 bool
2920 StyleSettings::GetHighContrastMode() const
2922 return mxData->mbHighContrast;
2925 void
2926 StyleSettings::SetPreferredIconTheme(const OUString& theme, bool bDarkIconTheme)
2928 auto* myData = mxData.get();
2929 const bool bChanged = myData->mIconThemeSelector.SetPreferredIconTheme(theme, bDarkIconTheme);
2930 if (bChanged)
2932 // clear this so it is recalculated if it was selected as the automatic theme
2933 myData->mIconTheme.clear();
2937 void
2938 AllSettings::SetMouseSettings( const MouseSettings& rSet )
2940 mxData->maMouseSettings = rSet;
2943 const MouseSettings&
2944 AllSettings::GetMouseSettings() const
2946 return mxData->maMouseSettings;
2949 void
2950 AllSettings::SetStyleSettings( const StyleSettings& rSet )
2952 mxData->maStyleSettings = rSet;
2955 void
2956 AllSettings::SetMiscSettings( const MiscSettings& rSet )
2958 mxData->maMiscSettings = rSet;
2961 const MiscSettings&
2962 AllSettings::GetMiscSettings() const
2964 return mxData->maMiscSettings;
2967 void
2968 AllSettings::SetHelpSettings( const HelpSettings& rSet )
2970 mxData->maHelpSettings = rSet;
2973 const HelpSettings&
2974 AllSettings::GetHelpSettings() const
2976 return mxData->maHelpSettings;
2979 const SvtSysLocale&
2980 AllSettings::GetSysLocale() const
2982 return mxData->maSysLocale;
2986 void StyleSettings::BatchSetBackgrounds( const Color &aBackColor,
2987 bool bCheckedColorSpecialCase )
2989 Set3DColors( aBackColor );
2990 SetFaceColor( aBackColor );
2991 SetDialogColor( aBackColor );
2992 SetWorkspaceColor( aBackColor );
2994 if (bCheckedColorSpecialCase)
2995 SetCheckedColorSpecialCase();
2998 void StyleSettings::BatchSetFonts( const vcl::Font& aAppFont,
2999 const vcl::Font& aLabelFont )
3001 SetAppFont( aAppFont );
3002 SetPushButtonFont( aAppFont );
3003 SetToolFont( aAppFont );
3004 SetHelpFont( aAppFont );
3006 SetMenuFont( aLabelFont );
3007 SetTabFont( aLabelFont );
3008 SetLabelFont( aLabelFont );
3009 SetRadioCheckFont( aLabelFont );
3010 SetFieldFont( aLabelFont );
3011 SetGroupFont( aLabelFont );
3012 SetIconFont( aLabelFont );
3015 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */