bump product version to 7.6.3.2-android
[LibreOffice.git] / vcl / source / app / settings.cxx
bloba0385c4ff8f45b35e813226b896cc92f2451d724
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 <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>
57 #include <svdata.hxx>
59 struct ImplMouseData
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;
74 struct ImplStyleData
76 ImplStyleData();
77 ImplStyleData( const ImplStyleData& rData );
79 void SetStandardStyles();
81 Color maActiveBorderColor;
82 Color maActiveColor;
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;
105 Color maDialogColor;
106 Color maDialogTextColor;
107 Color maDisableColor;
108 Color maFaceColor;
109 Color maFieldColor;
110 Color maFieldTextColor;
111 Color maFieldRolloverTextColor;
112 Color maGroupTextColor;
113 Color maHelpColor;
114 Color maHelpTextColor;
115 Color maAccentColor;
116 Color maHighlightColor;
117 Color maHighlightTextColor;
118 Color maLabelTextColor;
119 Color maLightBorderColor;
120 Color maLightColor;
121 Color maLinkColor;
122 Color maMenuBarColor;
123 Color maMenuBarRolloverColor;
124 Color maMenuBorderColor;
125 Color maMenuColor;
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;
136 Color maMonoColor;
137 Color maRadioCheckTextColor;
138 Color maShadowColor;
139 Color maWarningColor;
140 Color maVisitedLinkColor;
141 Color maToolTextColor;
142 Color maWindowColor;
143 Color maWindowTextColor;
144 Color maWorkspaceColor;
145 Color maActiveTabColor;
146 Color maInactiveTabColor;
147 Color maTabTextColor;
148 Color maTabRolloverTextColor;
149 Color maTabHighlightTextColor;
150 vcl::Font maAppFont;
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;
161 vcl::Font maTabFont;
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;
174 bool mnUseFlatMenus;
175 StyleSettingsOptions mnOptions;
176 bool mbHighContrast;
177 bool mbUseSystemUIFonts;
179 * Disabling AA doesn't actually disable AA of fonts, instead it is taken
180 * from system settings.
182 bool mbUseFontAAFromSystem;
183 bool mbAutoMnemonic;
184 TriState meUseImagesInMenus;
185 bool mnUseFlatBorders;
186 bool mbPreferredUseImagesInMenus;
187 sal_Int32 mnMinThumbSize;
188 std::shared_ptr<vcl::IconThemeScanner>
189 mIconThemeScanner;
190 std::shared_ptr<vcl::IconThemeSelector>
191 mIconThemeSelector;
193 OUString mIconTheme;
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.
219 struct ImplMiscData
221 ImplMiscData();
222 TriState mnEnableATT;
223 bool mbEnableLocalizedDecimalSep;
224 TriState mnDisablePrinting;
227 struct ImplHelpData
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;
252 void
253 MouseSettings::SetOptions(MouseSettingsOptions nOptions)
255 CopyData();
256 mxData->mnOptions = nOptions;
259 MouseSettingsOptions
260 MouseSettings::GetOptions() const
262 return mxData->mnOptions;
265 void
266 MouseSettings::SetDoubleClickTime( sal_uInt64 nDoubleClkTime )
268 CopyData();
269 mxData->mnDoubleClkTime = nDoubleClkTime;
272 sal_uInt64
273 MouseSettings::GetDoubleClickTime() const
275 return mxData->mnDoubleClkTime;
278 void
279 MouseSettings::SetDoubleClickWidth( sal_Int32 nDoubleClkWidth )
281 CopyData();
282 mxData->mnDoubleClkWidth = nDoubleClkWidth;
285 sal_Int32
286 MouseSettings::GetDoubleClickWidth() const
288 return mxData->mnDoubleClkWidth;
291 void
292 MouseSettings::SetDoubleClickHeight( sal_Int32 nDoubleClkHeight )
294 CopyData();
295 mxData->mnDoubleClkHeight = nDoubleClkHeight;
298 sal_Int32
299 MouseSettings::GetDoubleClickHeight() const
301 return mxData->mnDoubleClkHeight;
304 void
305 MouseSettings::SetStartDragWidth( sal_Int32 nDragWidth )
307 CopyData();
308 mxData->mnStartDragWidth = nDragWidth;
311 sal_Int32
312 MouseSettings::GetStartDragWidth() const
314 return mxData->mnStartDragWidth;
317 void
318 MouseSettings::SetStartDragHeight( sal_Int32 nDragHeight )
320 CopyData();
321 mxData->mnStartDragHeight = nDragHeight;
324 sal_Int32
325 MouseSettings::GetStartDragHeight() const
327 return mxData->mnStartDragHeight;
330 sal_uInt16
331 MouseSettings::GetStartDragCode()
333 return MOUSE_LEFT;
336 sal_uInt16
337 MouseSettings::GetContextMenuCode()
339 return MOUSE_RIGHT;
342 sal_uInt16
343 MouseSettings::GetContextMenuClicks()
345 return 1;
348 sal_Int32
349 MouseSettings::GetScrollRepeat()
351 return 100;
354 sal_Int32
355 MouseSettings::GetButtonStartRepeat()
357 return 370;
360 void
361 MouseSettings::SetButtonRepeat( sal_Int32 nRepeat )
363 CopyData();
364 mxData->mnButtonRepeat = nRepeat;
367 sal_Int32
368 MouseSettings::GetButtonRepeat() const
370 return mxData->mnButtonRepeat;
373 sal_Int32
374 MouseSettings::GetActionDelay()
376 return 250;
379 void
380 MouseSettings::SetMenuDelay( sal_Int32 nDelay )
382 CopyData();
383 mxData->mnMenuDelay = nDelay;
386 sal_Int32
387 MouseSettings::GetMenuDelay() const
389 return mxData->mnMenuDelay;
392 void
393 MouseSettings::SetFollow( MouseFollowFlags nFollow )
395 CopyData();
396 mxData->mnFollow = nFollow;
399 MouseFollowFlags
400 MouseSettings::GetFollow() const
402 return mxData->mnFollow;
405 void
406 MouseSettings::SetMiddleButtonAction( MouseMiddleButtonAction nAction )
408 CopyData();
409 mxData->mnMiddleButtonAction = nAction;
412 MouseMiddleButtonAction
413 MouseSettings::GetMiddleButtonAction() const
415 return mxData->mnMiddleButtonAction;
418 void
419 MouseSettings::SetWheelBehavior( MouseWheelBehaviour nBehavior )
421 CopyData();
422 mxData->mnWheelBehavior = nBehavior;
425 MouseWheelBehaviour
426 MouseSettings::GetWheelBehavior() const
428 return mxData->mnWheelBehavior;
431 bool
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 )
454 return true;
456 return
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() :
471 mnScrollBarSize(16),
472 mnSpinSize(16),
473 mnCursorSize(2),
474 mnAntialiasedMin(0),
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),
483 mnMinThumbSize(16),
484 mIconThemeSelector(std::make_shared<vcl::IconThemeSelector>()),
485 meContextMenuShortcuts(TRISTATE_INDET),
486 mnEdgeBlending(35),
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),
494 #ifdef IOS
495 maListBoxPreviewDefaultLogicSize(Size(30, 30)),
496 #else
497 maListBoxPreviewDefaultLogicSize(Size(15, 7)),
498 #endif
499 maListBoxPreviewDefaultPixelSize(Size(0, 0)), // on-demand calculated in GetListBoxPreviewDefaultPixelSize(),
500 mbPreviewUsesCheckeredBackground(true)
502 SetStandardStyles();
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")));
641 else
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 );
733 mnTitleHeight = 18;
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>())
752 void
753 StyleSettings::SetFaceColor( const Color& rColor )
755 CopyData();
756 mxData->maFaceColor = rColor;
759 const Color&
760 StyleSettings::GetFaceColor() const
762 return mxData->maFaceColor;
765 void
766 StyleSettings::SetCheckedColor( const Color& rColor )
768 CopyData();
769 mxData->maCheckedColor = rColor;
772 const Color&
773 StyleSettings::GetCheckedColor() const
775 return mxData->maCheckedColor;
778 void
779 StyleSettings::SetLightColor( const Color& rColor )
781 CopyData();
782 mxData->maLightColor = rColor;
785 const Color&
786 StyleSettings::GetLightColor() const
788 return mxData->maLightColor;
791 void
792 StyleSettings::SetLightBorderColor( const Color& rColor )
794 CopyData();
795 mxData->maLightBorderColor = rColor;
798 const Color&
799 StyleSettings::GetLightBorderColor() const
801 return mxData->maLightBorderColor;
804 void
805 StyleSettings::SetWarningColor( const Color& rColor )
807 CopyData();
808 mxData->maWarningColor = rColor;
811 const Color&
812 StyleSettings::GetWarningColor() const
814 return mxData->maWarningColor;
817 void
818 StyleSettings::SetShadowColor( const Color& rColor )
820 CopyData();
821 mxData->maShadowColor = rColor;
824 const Color&
825 StyleSettings::GetShadowColor() const
827 return mxData->maShadowColor;
830 void
831 StyleSettings::SetDarkShadowColor( const Color& rColor )
833 CopyData();
834 mxData->maDarkShadowColor = rColor;
837 const Color&
838 StyleSettings::GetDarkShadowColor() const
840 return mxData->maDarkShadowColor;
843 void
844 StyleSettings::SetDefaultButtonTextColor( const Color& rColor )
846 CopyData();
847 mxData->maDefaultButtonTextColor = rColor;
850 const Color&
851 StyleSettings::GetDefaultButtonTextColor() const
853 return mxData->maDefaultButtonTextColor;
856 void
857 StyleSettings::SetButtonTextColor( const Color& rColor )
859 CopyData();
860 mxData->maButtonTextColor = rColor;
863 const Color&
864 StyleSettings::GetButtonTextColor() const
866 return mxData->maButtonTextColor;
869 void
870 StyleSettings::SetDefaultActionButtonTextColor( const Color& rColor )
872 CopyData();
873 mxData->maDefaultActionButtonTextColor = rColor;
876 const Color&
877 StyleSettings::GetDefaultActionButtonTextColor() const
879 return mxData->maDefaultActionButtonTextColor;
882 void
883 StyleSettings::SetActionButtonTextColor( const Color& rColor )
885 CopyData();
886 mxData->maActionButtonTextColor = rColor;
889 const Color&
890 StyleSettings::GetActionButtonTextColor() const
892 return mxData->maActionButtonTextColor;
895 void
896 StyleSettings::SetFlatButtonTextColor( const Color& rColor )
898 CopyData();
899 mxData->maFlatButtonTextColor = rColor;
902 const Color&
903 StyleSettings::GetFlatButtonTextColor() const
905 return mxData->maFlatButtonTextColor;
908 void
909 StyleSettings::SetDefaultButtonRolloverTextColor( const Color& rColor )
911 CopyData();
912 mxData->maDefaultButtonRolloverTextColor = rColor;
915 const Color&
916 StyleSettings::GetDefaultButtonRolloverTextColor() const
918 return mxData->maDefaultButtonRolloverTextColor;
921 void
922 StyleSettings::SetButtonRolloverTextColor( const Color& rColor )
924 CopyData();
925 mxData->maButtonRolloverTextColor = rColor;
928 const Color&
929 StyleSettings::GetButtonRolloverTextColor() const
931 return mxData->maButtonRolloverTextColor;
934 void
935 StyleSettings::SetDefaultActionButtonRolloverTextColor( const Color& rColor )
937 CopyData();
938 mxData->maDefaultActionButtonRolloverTextColor = rColor;
941 const Color&
942 StyleSettings::GetDefaultActionButtonRolloverTextColor() const
944 return mxData->maDefaultActionButtonRolloverTextColor;
947 void
948 StyleSettings::SetActionButtonRolloverTextColor( const Color& rColor )
950 CopyData();
951 mxData->maActionButtonRolloverTextColor = rColor;
954 const Color&
955 StyleSettings::GetActionButtonRolloverTextColor() const
957 return mxData->maActionButtonRolloverTextColor;
960 void
961 StyleSettings::SetFlatButtonRolloverTextColor( const Color& rColor )
963 CopyData();
964 mxData->maFlatButtonRolloverTextColor = rColor;
967 const Color&
968 StyleSettings::GetFlatButtonRolloverTextColor() const
970 return mxData->maFlatButtonRolloverTextColor;
973 void
974 StyleSettings::SetDefaultButtonPressedRolloverTextColor( const Color& rColor )
976 CopyData();
977 mxData->maDefaultButtonPressedRolloverTextColor = rColor;
980 const Color&
981 StyleSettings::GetDefaultButtonPressedRolloverTextColor() const
983 return mxData->maDefaultButtonPressedRolloverTextColor;
986 void
987 StyleSettings::SetButtonPressedRolloverTextColor( const Color& rColor )
989 CopyData();
990 mxData->maButtonPressedRolloverTextColor = rColor;
993 const Color&
994 StyleSettings::GetButtonPressedRolloverTextColor() const
996 return mxData->maButtonPressedRolloverTextColor;
999 void
1000 StyleSettings::SetDefaultActionButtonPressedRolloverTextColor( const Color& rColor )
1002 CopyData();
1003 mxData->maDefaultActionButtonPressedRolloverTextColor = rColor;
1006 const Color&
1007 StyleSettings::GetDefaultActionButtonPressedRolloverTextColor() const
1009 return mxData->maDefaultActionButtonPressedRolloverTextColor;
1012 void
1013 StyleSettings::SetActionButtonPressedRolloverTextColor( const Color& rColor )
1015 CopyData();
1016 mxData->maActionButtonPressedRolloverTextColor = rColor;
1019 const Color&
1020 StyleSettings::GetActionButtonPressedRolloverTextColor() const
1022 return mxData->maActionButtonPressedRolloverTextColor;
1025 void
1026 StyleSettings::SetFlatButtonPressedRolloverTextColor( const Color& rColor )
1028 CopyData();
1029 mxData->maFlatButtonPressedRolloverTextColor = rColor;
1032 const Color&
1033 StyleSettings::GetFlatButtonPressedRolloverTextColor() const
1035 return mxData->maFlatButtonPressedRolloverTextColor;
1038 void
1039 StyleSettings::SetRadioCheckTextColor( const Color& rColor )
1041 CopyData();
1042 mxData->maRadioCheckTextColor = rColor;
1045 const Color&
1046 StyleSettings::GetRadioCheckTextColor() const
1048 return mxData->maRadioCheckTextColor;
1051 void
1052 StyleSettings::SetGroupTextColor( const Color& rColor )
1054 CopyData();
1055 mxData->maGroupTextColor = rColor;
1058 const Color&
1059 StyleSettings::GetGroupTextColor() const
1061 return mxData->maGroupTextColor;
1064 void
1065 StyleSettings::SetLabelTextColor( const Color& rColor )
1067 CopyData();
1068 mxData->maLabelTextColor = rColor;
1071 const Color&
1072 StyleSettings::GetLabelTextColor() const
1074 return mxData->maLabelTextColor;
1077 void
1078 StyleSettings::SetWindowColor( const Color& rColor )
1080 CopyData();
1081 mxData->maWindowColor = rColor;
1084 const Color&
1085 StyleSettings::GetWindowColor() const
1087 return mxData->maWindowColor;
1090 void
1091 StyleSettings::SetWindowTextColor( const Color& rColor )
1093 CopyData();
1094 mxData->maWindowTextColor = rColor;
1097 const Color&
1098 StyleSettings::GetWindowTextColor() const
1100 return mxData->maWindowTextColor;
1103 void
1104 StyleSettings::SetDialogColor( const Color& rColor )
1106 CopyData();
1107 mxData->maDialogColor = rColor;
1110 const Color&
1111 StyleSettings::GetDialogColor() const
1113 return mxData->maDialogColor;
1116 void
1117 StyleSettings::SetDialogTextColor( const Color& rColor )
1119 CopyData();
1120 mxData->maDialogTextColor = rColor;
1123 const Color&
1124 StyleSettings::GetDialogTextColor() const
1126 return mxData->maDialogTextColor;
1129 void
1130 StyleSettings::SetWorkspaceColor( const Color& rColor )
1132 CopyData();
1133 mxData->maWorkspaceColor = rColor;
1136 const Color&
1137 StyleSettings::GetWorkspaceColor() const
1139 return mxData->maWorkspaceColor;
1142 void
1143 StyleSettings::SetFieldColor( const Color& rColor )
1145 CopyData();
1146 mxData->maFieldColor = rColor;
1149 const Color&
1150 StyleSettings::GetFieldColor() const
1152 return mxData->maFieldColor;
1155 void
1156 StyleSettings::SetFieldTextColor( const Color& rColor )
1158 CopyData();
1159 mxData->maFieldTextColor = rColor;
1162 const Color&
1163 StyleSettings::GetFieldTextColor() const
1165 return mxData->maFieldTextColor;
1168 void
1169 StyleSettings::SetFieldRolloverTextColor( const Color& rColor )
1171 CopyData();
1172 mxData->maFieldRolloverTextColor = rColor;
1175 const Color&
1176 StyleSettings::GetFieldRolloverTextColor() const
1178 return mxData->maFieldRolloverTextColor;
1181 void
1182 StyleSettings::SetActiveColor( const Color& rColor )
1184 CopyData();
1185 mxData->maActiveColor = rColor;
1188 const Color&
1189 StyleSettings::GetActiveColor() const
1191 return mxData->maActiveColor;
1194 void
1195 StyleSettings::SetActiveTextColor( const Color& rColor )
1197 CopyData();
1198 mxData->maActiveTextColor = rColor;
1201 const Color&
1202 StyleSettings::GetActiveTextColor() const
1204 return mxData->maActiveTextColor;
1207 void
1208 StyleSettings::SetActiveBorderColor( const Color& rColor )
1210 CopyData();
1211 mxData->maActiveBorderColor = rColor;
1214 const Color&
1215 StyleSettings::GetActiveBorderColor() const
1217 return mxData->maActiveBorderColor;
1220 void
1221 StyleSettings::SetDeactiveColor( const Color& rColor )
1223 CopyData();
1224 mxData->maDeactiveColor = rColor;
1227 const Color&
1228 StyleSettings::GetDeactiveColor() const
1230 return mxData->maDeactiveColor;
1233 void
1234 StyleSettings::SetDeactiveTextColor( const Color& rColor )
1236 CopyData();
1237 mxData->maDeactiveTextColor = rColor;
1240 const Color&
1241 StyleSettings::GetDeactiveTextColor() const
1243 return mxData->maDeactiveTextColor;
1246 void
1247 StyleSettings::SetDeactiveBorderColor( const Color& rColor )
1249 CopyData();
1250 mxData->maDeactiveBorderColor = rColor;
1253 const Color&
1254 StyleSettings::GetDeactiveBorderColor() const
1256 return mxData->maDeactiveBorderColor;
1259 void
1260 StyleSettings::SetAccentColor( const Color& rColor )
1262 CopyData();
1263 mxData->maAccentColor = rColor;
1266 const Color&
1267 StyleSettings::GetAccentColor() const
1269 return mxData->maAccentColor;
1272 void
1273 StyleSettings::SetHighlightColor( const Color& rColor )
1275 CopyData();
1276 mxData->maHighlightColor = rColor;
1279 const Color&
1280 StyleSettings::GetHighlightColor() const
1282 return mxData->maHighlightColor;
1285 void
1286 StyleSettings::SetHighlightTextColor( const Color& rColor )
1288 CopyData();
1289 mxData->maHighlightTextColor = rColor;
1292 const Color&
1293 StyleSettings::GetHighlightTextColor() const
1295 return mxData->maHighlightTextColor;
1298 void
1299 StyleSettings::SetDisableColor( const Color& rColor )
1301 CopyData();
1302 mxData->maDisableColor = rColor;
1305 const Color&
1306 StyleSettings::GetDisableColor() const
1308 return mxData->maDisableColor;
1311 void
1312 StyleSettings::SetHelpColor( const Color& rColor )
1314 CopyData();
1315 mxData->maHelpColor = rColor;
1318 const Color&
1319 StyleSettings::GetHelpColor() const
1321 return mxData->maHelpColor;
1324 void
1325 StyleSettings::SetHelpTextColor( const Color& rColor )
1327 CopyData();
1328 mxData->maHelpTextColor = rColor;
1331 const Color&
1332 StyleSettings::GetHelpTextColor() const
1334 return mxData->maHelpTextColor;
1337 void
1338 StyleSettings::SetMenuColor( const Color& rColor )
1340 CopyData();
1341 mxData->maMenuColor = rColor;
1344 const Color&
1345 StyleSettings::GetMenuColor() const
1347 return mxData->maMenuColor;
1350 void
1351 StyleSettings::SetMenuBarColor( const Color& rColor )
1353 CopyData();
1354 mxData->maMenuBarColor = rColor;
1357 const Color&
1358 StyleSettings::GetMenuBarColor() const
1360 return mxData->maMenuBarColor;
1363 void
1364 StyleSettings::SetMenuBarRolloverColor( const Color& rColor )
1366 CopyData();
1367 mxData->maMenuBarRolloverColor = rColor;
1370 const Color&
1371 StyleSettings::GetMenuBarRolloverColor() const
1373 return mxData->maMenuBarRolloverColor;
1376 void
1377 StyleSettings::SetMenuBorderColor( const Color& rColor )
1379 CopyData();
1380 mxData->maMenuBorderColor = rColor;
1383 const Color&
1384 StyleSettings::GetMenuBorderColor() const
1386 return mxData->maMenuBorderColor;
1389 void
1390 StyleSettings::SetMenuTextColor( const Color& rColor )
1392 CopyData();
1393 mxData->maMenuTextColor = rColor;
1396 const Color&
1397 StyleSettings::GetMenuTextColor() const
1399 return mxData->maMenuTextColor;
1402 void
1403 StyleSettings::SetMenuBarTextColor( const Color& rColor )
1405 CopyData();
1406 mxData->maMenuBarTextColor = rColor;
1409 const Color&
1410 StyleSettings::GetMenuBarTextColor() const
1412 return mxData->maMenuBarTextColor;
1415 void
1416 StyleSettings::SetMenuBarRolloverTextColor( const Color& rColor )
1418 CopyData();
1419 mxData->maMenuBarRolloverTextColor = rColor;
1422 const Color&
1423 StyleSettings::GetMenuBarRolloverTextColor() const
1425 return mxData->maMenuBarRolloverTextColor;
1428 void
1429 StyleSettings::SetMenuBarHighlightTextColor( const Color& rColor )
1431 CopyData();
1432 mxData->maMenuBarHighlightTextColor = rColor;
1435 const Color&
1436 StyleSettings::GetMenuBarHighlightTextColor() const
1438 return mxData->maMenuBarHighlightTextColor;
1441 void
1442 StyleSettings::SetMenuHighlightColor( const Color& rColor )
1444 CopyData();
1445 mxData->maMenuHighlightColor = rColor;
1448 const Color&
1449 StyleSettings::GetMenuHighlightColor() const
1451 return mxData->maMenuHighlightColor;
1454 void
1455 StyleSettings::SetMenuHighlightTextColor( const Color& rColor )
1457 CopyData();
1458 mxData->maMenuHighlightTextColor = rColor;
1461 const Color&
1462 StyleSettings::GetMenuHighlightTextColor() const
1464 return mxData->maMenuHighlightTextColor;
1467 void
1468 StyleSettings::SetListBoxWindowBackgroundColor( const Color& rColor )
1470 CopyData();
1471 mxData->maListBoxWindowBackgroundColor = rColor;
1474 const Color&
1475 StyleSettings::GetListBoxWindowBackgroundColor() const
1477 return mxData->maListBoxWindowBackgroundColor;
1480 void
1481 StyleSettings::SetListBoxWindowTextColor( const Color& rColor )
1483 CopyData();
1484 mxData->maListBoxWindowTextColor = rColor;
1487 const Color&
1488 StyleSettings::GetListBoxWindowTextColor() const
1490 return mxData->maListBoxWindowTextColor;
1493 void
1494 StyleSettings::SetListBoxWindowHighlightColor( const Color& rColor )
1496 CopyData();
1497 mxData->maListBoxWindowHighlightColor = rColor;
1500 const Color&
1501 StyleSettings::GetListBoxWindowHighlightColor() const
1503 return mxData->maListBoxWindowHighlightColor;
1506 void
1507 StyleSettings::SetListBoxWindowHighlightTextColor( const Color& rColor )
1509 CopyData();
1510 mxData->maListBoxWindowHighlightTextColor = rColor;
1513 const Color&
1514 StyleSettings::GetListBoxWindowHighlightTextColor() const
1516 return mxData->maListBoxWindowHighlightTextColor;
1519 void
1520 StyleSettings::SetTabTextColor( const Color& rColor )
1522 CopyData();
1523 mxData->maTabTextColor = rColor;
1526 const Color&
1527 StyleSettings::GetTabTextColor() const
1529 return mxData->maTabTextColor;
1532 void
1533 StyleSettings::SetTabRolloverTextColor( const Color& rColor )
1535 CopyData();
1536 mxData->maTabRolloverTextColor = rColor;
1539 const Color&
1540 StyleSettings::GetTabRolloverTextColor() const
1542 return mxData->maTabRolloverTextColor;
1545 void
1546 StyleSettings::SetTabHighlightTextColor( const Color& rColor )
1548 CopyData();
1549 mxData->maTabHighlightTextColor = rColor;
1552 const Color&
1553 StyleSettings::GetTabHighlightTextColor() const
1555 return mxData->maTabHighlightTextColor;
1558 void
1559 StyleSettings::SetLinkColor( const Color& rColor )
1561 CopyData();
1562 mxData->maLinkColor = rColor;
1565 const Color&
1566 StyleSettings::GetLinkColor() const
1568 return mxData->maLinkColor;
1571 void
1572 StyleSettings::SetVisitedLinkColor( const Color& rColor )
1574 CopyData();
1575 mxData->maVisitedLinkColor = rColor;
1578 const Color&
1579 StyleSettings::GetVisitedLinkColor() const
1581 return mxData->maVisitedLinkColor;
1584 void
1585 StyleSettings::SetToolTextColor( const Color& rColor )
1587 CopyData();
1588 mxData->maToolTextColor = rColor;
1591 const Color&
1592 StyleSettings::GetToolTextColor() const
1594 return mxData->maToolTextColor;
1597 void
1598 StyleSettings::SetMonoColor( const Color& rColor )
1600 CopyData();
1601 mxData->maMonoColor = rColor;
1604 const Color&
1605 StyleSettings::GetMonoColor() const
1607 return mxData->maMonoColor;
1610 void
1611 StyleSettings::SetActiveTabColor( const Color& rColor )
1613 CopyData();
1614 mxData->maActiveTabColor = rColor;
1617 const Color&
1618 StyleSettings::GetActiveTabColor() const
1620 return mxData->maActiveTabColor;
1623 void
1624 StyleSettings::SetInactiveTabColor( const Color& rColor )
1626 CopyData();
1627 mxData->maInactiveTabColor = rColor;
1630 const Color&
1631 StyleSettings::GetInactiveTabColor() const
1633 return mxData->maInactiveTabColor;
1636 void StyleSettings::SetAlternatingRowColor(const Color& rColor)
1638 CopyData();
1639 mxData->maAlternatingRowColor = rColor;
1642 const Color&
1643 StyleSettings::GetAlternatingRowColor() const
1645 return mxData->maAlternatingRowColor;
1648 void
1649 StyleSettings::SetUseSystemUIFonts( bool bUseSystemUIFonts )
1651 CopyData();
1652 mxData->mbUseSystemUIFonts = bUseSystemUIFonts;
1655 bool
1656 StyleSettings::GetUseSystemUIFonts() const
1658 return mxData->mbUseSystemUIFonts;
1661 void StyleSettings::SetUseFontAAFromSystem(bool bUseFontAAFromSystem)
1663 CopyData();
1664 mxData->mbUseFontAAFromSystem = bUseFontAAFromSystem;
1667 bool StyleSettings::GetUseFontAAFromSystem() const
1669 return mxData->mbUseFontAAFromSystem;
1672 void
1673 StyleSettings::SetUseFlatBorders( bool bUseFlatBorders )
1675 CopyData();
1676 mxData->mnUseFlatBorders = bUseFlatBorders;
1679 bool
1680 StyleSettings::GetUseFlatBorders() const
1682 return mxData->mnUseFlatBorders;
1685 void
1686 StyleSettings::SetUseFlatMenus( bool bUseFlatMenus )
1688 CopyData();
1689 mxData->mnUseFlatMenus = bUseFlatMenus;
1692 bool
1693 StyleSettings::GetUseFlatMenus() const
1695 return mxData->mnUseFlatMenus;
1698 void
1699 StyleSettings::SetUseImagesInMenus( TriState eUseImagesInMenus )
1701 CopyData();
1702 mxData->meUseImagesInMenus = eUseImagesInMenus;
1705 void
1706 StyleSettings::SetPreferredUseImagesInMenus( bool bPreferredUseImagesInMenus )
1708 CopyData();
1709 mxData->mbPreferredUseImagesInMenus = bPreferredUseImagesInMenus;
1712 bool
1713 StyleSettings::GetPreferredUseImagesInMenus() const
1715 return mxData->mbPreferredUseImagesInMenus;
1718 void
1719 StyleSettings::SetSkipDisabledInMenus( bool bSkipDisabledInMenus )
1721 CopyData();
1722 mxData->mbSkipDisabledInMenus = bSkipDisabledInMenus;
1725 bool
1726 StyleSettings::GetSkipDisabledInMenus() const
1728 return mxData->mbSkipDisabledInMenus;
1731 void
1732 StyleSettings::SetHideDisabledMenuItems( bool bHideDisabledMenuItems )
1734 CopyData();
1735 mxData->mbHideDisabledMenuItems = bHideDisabledMenuItems;
1738 bool
1739 StyleSettings::GetHideDisabledMenuItems() const
1741 return mxData->mbHideDisabledMenuItems;
1744 void
1745 StyleSettings::SetContextMenuShortcuts( TriState eContextMenuShortcuts )
1747 CopyData();
1748 mxData->meContextMenuShortcuts = eContextMenuShortcuts;
1751 bool
1752 StyleSettings::GetContextMenuShortcuts() const
1754 switch (mxData->meContextMenuShortcuts)
1756 case TRISTATE_FALSE:
1757 return false;
1758 case TRISTATE_TRUE:
1759 return true;
1760 default: // TRISTATE_INDET:
1761 return GetPreferredContextMenuShortcuts();
1765 void
1766 StyleSettings::SetPreferredContextMenuShortcuts( bool bContextMenuShortcuts )
1768 CopyData();
1769 mxData->mbPreferredContextMenuShortcuts = bContextMenuShortcuts;
1772 bool
1773 StyleSettings::GetPreferredContextMenuShortcuts() const
1775 return mxData->mbPreferredContextMenuShortcuts;
1778 void
1779 StyleSettings::SetPrimaryButtonWarpsSlider( bool bPrimaryButtonWarpsSlider )
1781 CopyData();
1782 mxData->mbPrimaryButtonWarpsSlider = bPrimaryButtonWarpsSlider;
1785 bool
1786 StyleSettings::GetPrimaryButtonWarpsSlider() const
1788 return mxData->mbPrimaryButtonWarpsSlider;
1791 void
1792 StyleSettings::SetAppFont( const vcl::Font& rFont )
1794 CopyData();
1795 mxData->maAppFont = rFont;
1798 const vcl::Font&
1799 StyleSettings::GetAppFont() const
1801 return mxData->maAppFont;
1804 void
1805 StyleSettings::SetHelpFont( const vcl::Font& rFont )
1807 CopyData();
1808 mxData->maHelpFont = rFont;
1811 const vcl::Font&
1812 StyleSettings::GetHelpFont() const
1814 return mxData->maHelpFont;
1817 void
1818 StyleSettings::SetTitleFont( const vcl::Font& rFont )
1820 CopyData();
1821 mxData->maTitleFont = rFont;
1824 const vcl::Font&
1825 StyleSettings::GetTitleFont() const
1827 return mxData->maTitleFont;
1830 void
1831 StyleSettings::SetFloatTitleFont( const vcl::Font& rFont )
1833 CopyData();
1834 mxData->maFloatTitleFont = rFont;
1837 const vcl::Font&
1838 StyleSettings::GetFloatTitleFont() const
1840 return mxData->maFloatTitleFont;
1843 void
1844 StyleSettings::SetMenuFont( const vcl::Font& rFont )
1846 CopyData();
1847 mxData->maMenuFont = rFont;
1850 const vcl::Font&
1851 StyleSettings::GetMenuFont() const
1853 return mxData->maMenuFont;
1856 void
1857 StyleSettings::SetToolFont( const vcl::Font& rFont )
1859 CopyData();
1860 mxData->maToolFont = rFont;
1863 const vcl::Font&
1864 StyleSettings::GetToolFont() const
1866 return mxData->maToolFont;
1869 void
1870 StyleSettings::SetGroupFont( const vcl::Font& rFont )
1872 CopyData();
1873 mxData->maGroupFont = rFont;
1876 const vcl::Font&
1877 StyleSettings::GetGroupFont() const
1879 return mxData->maGroupFont;
1882 void
1883 StyleSettings::SetLabelFont( const vcl::Font& rFont )
1885 CopyData();
1886 mxData->maLabelFont = rFont;
1889 const vcl::Font&
1890 StyleSettings::GetLabelFont() const
1892 return mxData->maLabelFont;
1895 void
1896 StyleSettings::SetRadioCheckFont( const vcl::Font& rFont )
1898 CopyData();
1899 mxData->maRadioCheckFont = rFont;
1902 const vcl::Font&
1903 StyleSettings::GetRadioCheckFont() const
1905 return mxData->maRadioCheckFont;
1908 void
1909 StyleSettings::SetPushButtonFont( const vcl::Font& rFont )
1911 CopyData();
1912 mxData->maPushButtonFont = rFont;
1915 const vcl::Font&
1916 StyleSettings::GetPushButtonFont() const
1918 return mxData->maPushButtonFont;
1921 void
1922 StyleSettings::SetFieldFont( const vcl::Font& rFont )
1924 CopyData();
1925 mxData->maFieldFont = rFont;
1928 const vcl::Font&
1929 StyleSettings::GetFieldFont() const
1931 return mxData->maFieldFont;
1934 void
1935 StyleSettings::SetIconFont( const vcl::Font& rFont )
1937 CopyData();
1938 mxData->maIconFont = rFont;
1941 const vcl::Font&
1942 StyleSettings::GetIconFont() const
1944 return mxData->maIconFont;
1947 void
1948 StyleSettings::SetTabFont( const vcl::Font& rFont )
1950 CopyData();
1951 mxData->maTabFont = rFont;
1954 const vcl::Font&
1955 StyleSettings::GetTabFont() const
1957 return mxData->maTabFont;
1960 sal_Int32
1961 StyleSettings::GetBorderSize()
1963 return 1;
1966 void
1967 StyleSettings::SetTitleHeight( sal_Int32 nSize )
1969 CopyData();
1970 mxData->mnTitleHeight = nSize;
1973 sal_Int32
1974 StyleSettings::GetTitleHeight() const
1976 return mxData->mnTitleHeight;
1979 void
1980 StyleSettings::SetFloatTitleHeight( sal_Int32 nSize )
1982 CopyData();
1983 mxData->mnFloatTitleHeight = nSize;
1986 sal_Int32
1987 StyleSettings::GetFloatTitleHeight() const
1989 return mxData->mnFloatTitleHeight;
1992 void
1993 StyleSettings::SetScrollBarSize( sal_Int32 nSize )
1995 CopyData();
1996 mxData->mnScrollBarSize = nSize;
1999 sal_Int32
2000 StyleSettings::GetScrollBarSize() const
2002 return mxData->mnScrollBarSize;
2005 void
2006 StyleSettings::SetMinThumbSize( sal_Int32 nSize )
2008 CopyData();
2009 mxData->mnMinThumbSize = nSize;
2012 sal_Int32
2013 StyleSettings::GetMinThumbSize() const
2015 return mxData->mnMinThumbSize;
2018 void
2019 StyleSettings::SetSpinSize( sal_Int32 nSize )
2021 CopyData();
2022 mxData->mnSpinSize = nSize;
2025 sal_Int32
2026 StyleSettings::GetSpinSize() const
2028 return mxData->mnSpinSize;
2031 sal_Int32
2032 StyleSettings::GetSplitSize()
2034 return 3;
2037 void
2038 StyleSettings::SetCursorSize( sal_Int32 nSize )
2040 CopyData();
2041 mxData->mnCursorSize = nSize;
2044 sal_Int32
2045 StyleSettings::GetCursorSize() const
2047 return mxData->mnCursorSize;
2050 void
2051 StyleSettings::SetCursorBlinkTime( sal_uInt64 nBlinkTime )
2053 CopyData();
2054 mxData->mnCursorBlinkTime = nBlinkTime;
2057 sal_uInt64
2058 StyleSettings::GetCursorBlinkTime() const
2060 return mxData->mnCursorBlinkTime;
2063 void
2064 StyleSettings::SetDragFullOptions( DragFullOptions nOptions )
2066 CopyData();
2067 mxData->mnDragFullOptions = nOptions;
2070 DragFullOptions
2071 StyleSettings::GetDragFullOptions() const
2073 return mxData->mnDragFullOptions;
2076 void
2077 StyleSettings::SetSelectionOptions( SelectionOptions nOptions )
2079 CopyData();
2080 mxData->mnSelectionOptions = nOptions;
2083 SelectionOptions
2084 StyleSettings::GetSelectionOptions() const
2086 return mxData->mnSelectionOptions;
2089 void
2090 StyleSettings::SetDisplayOptions( DisplayOptions nOptions )
2092 CopyData();
2093 mxData->mnDisplayOptions = nOptions;
2096 DisplayOptions
2097 StyleSettings::GetDisplayOptions() const
2099 return mxData->mnDisplayOptions;
2102 void
2103 StyleSettings::SetAntialiasingMinPixelHeight( sal_Int32 nMinPixel )
2105 CopyData();
2106 mxData->mnAntialiasedMin = nMinPixel;
2109 sal_Int32
2110 StyleSettings::GetAntialiasingMinPixelHeight() const
2112 return mxData->mnAntialiasedMin;
2115 void
2116 StyleSettings::SetOptions( StyleSettingsOptions nOptions )
2118 CopyData();
2119 mxData->mnOptions = nOptions;
2122 void
2123 StyleSettings::SetAutoMnemonic( bool bAutoMnemonic )
2125 CopyData();
2126 mxData->mbAutoMnemonic = bAutoMnemonic;
2129 bool
2130 StyleSettings::GetAutoMnemonic() const
2132 return mxData->mbAutoMnemonic;
2135 bool
2136 StyleSettings::GetDockingFloatsSupported()
2138 ImplSVData* pSVData = ImplGetSVData();
2139 return pSVData->maNWFData.mbCanDetermineWindowPosition;
2142 void
2143 StyleSettings::SetToolbarIconSize( ToolbarIconSize nSize )
2145 CopyData();
2146 mxData->mnToolbarIconSize = nSize;
2149 ToolbarIconSize
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:
2164 default:
2165 return Size(16, 16);
2169 const DialogStyle&
2170 StyleSettings::GetDialogStyle() const
2172 return mxData->maDialogStyle;
2175 void
2176 StyleSettings::SetEdgeBlending(sal_uInt16 nCount)
2178 CopyData();
2179 mxData->mnEdgeBlending = nCount;
2182 sal_uInt16
2183 StyleSettings::GetEdgeBlending() const
2185 return mxData->mnEdgeBlending;
2188 const Color&
2189 StyleSettings::GetEdgeBlendingTopLeftColor() const
2191 return mxData->maEdgeBlendingTopLeftColor;
2194 const Color&
2195 StyleSettings::GetEdgeBlendingBottomRightColor() const
2197 return mxData->maEdgeBlendingBottomRightColor;
2200 void
2201 StyleSettings::SetListBoxMaximumLineCount(sal_uInt16 nCount)
2203 CopyData();
2204 mxData->mnListBoxMaximumLineCount = nCount;
2207 sal_uInt16
2208 StyleSettings::GetListBoxMaximumLineCount() const
2210 return mxData->mnListBoxMaximumLineCount;
2213 void
2214 StyleSettings::SetColorValueSetColumnCount(sal_uInt16 nCount)
2216 CopyData();
2217 mxData->mnColorValueSetColumnCount = nCount;
2220 sal_uInt16
2221 StyleSettings::GetColorValueSetColumnCount() const
2223 return mxData->mnColorValueSetColumnCount;
2226 sal_uInt16
2227 StyleSettings::GetListBoxPreviewDefaultLineWidth()
2229 return 1;
2232 void
2233 StyleSettings::SetPreviewUsesCheckeredBackground(bool bNew)
2235 CopyData();
2236 mxData->mbPreviewUsesCheckeredBackground = bNew;
2239 bool
2240 StyleSettings::GetPreviewUsesCheckeredBackground() const
2242 return mxData->mbPreviewUsesCheckeredBackground;
2245 bool
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 )
2269 CopyData();
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);
2286 else
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);
2298 else
2300 mxData->maCheckedColor = Color( 0x99, 0x99, 0x99 );
2301 mxData->maLightColor = COL_WHITE;
2302 mxData->maShadowColor = COL_GRAY;
2306 void StyleSettings::SetCheckedColorSpecialCase( )
2308 CopyData();
2309 // Light gray checked color special case
2310 if ( GetFaceColor() == COL_LIGHTGRAY )
2311 mxData->maCheckedColor = Color( 0xCC, 0xCC, 0xCC );
2312 else
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:
2326 return false;
2327 case TRISTATE_TRUE:
2328 return true;
2329 default: // TRISTATE_INDET:
2330 return GetPreferredUseImagesInMenus();
2334 static BitmapEx readBitmapEx( const OUString& rPath )
2336 OUString aPath( rPath );
2337 rtl::Bootstrap::expandMacros( aPath );
2339 // import the image
2340 Graphic aGraphic;
2341 if ( GraphicFilter::LoadGraphic( aPath, OUString(), aGraphic ) != ERRCODE_NONE )
2342 return BitmapEx();
2343 return aGraphic.GetBitmapEx();
2346 namespace {
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() )
2357 return;
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 )
2367 return;
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 );
2382 if ( nIndex > 0 )
2383 aFooter = aPersonaSettings.getToken( 0, ';', nIndex );
2385 // change menu text color, advance nIndex to skip the '#'
2386 if ( nIndex > 0 )
2388 OUString aColor = aPersonaSettings.getToken( 0, ';', ++nIndex );
2389 rMenuBarTextColor = Color( ColorTransparency, aColor.toUInt32( 16 ) );
2393 OUString aName;
2394 switch ( eWhich ) {
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 );
2426 batch->commit();
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
2444 GetPersonaHeader();
2445 return mxData->maPersonaMenuBarTextColor;
2448 void StyleSettings::SetStandardStyles()
2450 CopyData();
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)
2459 sal_uInt16 h, s, b;
2460 GetFaceColor().RGBtoHSB( h, s, b );
2461 if( s > 1) s=1;
2462 if( b < 98) b=98;
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)
2469 sal_uInt16 h, s, b;
2470 GetShadowColor().RGBtoHSB( h, s, b );
2471 b += b/4;
2472 s -= s/4;
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 )
2488 return true;
2490 if (mxData->mIconTheme != rSet.mxData->mIconTheme) {
2491 return false;
2494 if (*mxData->mIconThemeSelector != *rSet.mxData->mIconThemeSelector) {
2495 return false;
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 )
2618 return true;
2620 return (mxData->mnEnableATT == rSet.mxData->mnEnableATT ) &&
2621 (mxData->mnDisablePrinting == rSet.mxData->mnDisablePrinting ) &&
2622 (mxData->mbEnableLocalizedDecimalSep == rSet.mxData->mbEnableLocalizedDecimalSep );
2625 bool
2626 MiscSettings::operator !=( const MiscSettings& rSet ) const
2628 return !(*this == rSet);
2631 bool MiscSettings::GetDisablePrinting() const
2633 if( mxData->mnDisablePrinting == TRISTATE_INDET )
2635 OUString aEnable =
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
2648 #ifdef _WIN32
2649 if( mxData->mnEnableATT == TRISTATE_INDET )
2651 // Check in the Windows registry if an AT tool wants Accessibility support to
2652 // be activated ..
2653 HKEY hkey;
2655 if( ERROR_SUCCESS == RegOpenKeyW(HKEY_CURRENT_USER,
2656 L"Software\\LibreOffice\\Accessibility\\AtToolSupport",
2657 &hkey) )
2659 DWORD dwType;
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) )
2666 switch (dwType)
2668 case REG_SZ:
2669 mxData->mnEnableATT = ((0 == wcsicmp(Data, L"1")) || (0 == wcsicmp(Data, L"true"))) ? TRISTATE_TRUE : TRISTATE_FALSE;
2670 break;
2671 case REG_DWORD:
2672 switch (reinterpret_cast<DWORD *>(Data)[0]) {
2673 case 0:
2674 mxData->mnEnableATT = TRISTATE_FALSE;
2675 break;
2676 case 1:
2677 mxData->mnEnableATT = TRISTATE_TRUE;
2678 break;
2679 default:
2680 mxData->mnEnableATT = TRISTATE_INDET;
2681 //TODO: or TRISTATE_TRUE?
2682 break;
2684 break;
2685 default:
2686 // Unsupported registry type
2687 break;
2691 RegCloseKey(hkey);
2694 #endif
2696 if( mxData->mnEnableATT == TRISTATE_INDET )
2698 static const char* pEnv = getenv("SAL_ACCESSIBILITY_ENABLED" );
2699 if( !pEnv || !*pEnv )
2701 OUString aEnable =
2702 vcl::SettingsConfigItem::get()->
2703 getValue( "Accessibility",
2704 "EnableATToolSupport" );
2705 mxData->mnEnableATT = aEnable.equalsIgnoreAsciiCase("true") ? TRISTATE_TRUE : TRISTATE_FALSE;
2707 else
2709 mxData->mnEnableATT = TRISTATE_TRUE;
2713 return mxData->mnEnableATT != TRISTATE_FALSE;
2716 #ifdef _WIN32
2717 void MiscSettings::SetEnableATToolSupport( bool bEnable )
2719 if ( (bEnable ? TRISTATE_TRUE : TRISTATE_FALSE) != mxData->mnEnableATT )
2721 if( bEnable && !ImplInitAccessBridge() )
2722 return;
2724 HKEY hkey;
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",
2729 &hkey) )
2731 DWORD dwType;
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) )
2738 switch (dwType)
2740 case REG_SZ:
2741 RegSetValueExW(hkey, L"SupportAssistiveTechnology",
2742 0, dwType,
2743 reinterpret_cast<const BYTE*>(bEnable ? L"true" : L"false"),
2744 bEnable ? sizeof(L"true") : sizeof(L"false"));
2745 break;
2746 case REG_DWORD:
2747 reinterpret_cast<DWORD *>(Data)[0] = bEnable ? 1 : 0;
2748 RegSetValueExW(hkey, L"SupportAssistiveTechnology",
2749 0, dwType, reinterpret_cast<const BYTE*>(Data), sizeof(DWORD));
2750 break;
2751 default:
2752 // Unsupported registry type
2753 break;
2757 RegCloseKey(hkey);
2760 vcl::SettingsConfigItem::get()->
2761 setValue( "Accessibility",
2762 "EnableATToolSupport",
2763 bEnable ? OUString("true") : OUString("false" ) );
2764 mxData->mnEnableATT = bEnable ? TRISTATE_TRUE : TRISTATE_FALSE;
2767 #endif
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);
2793 batch->commit();
2795 vcl::Window *pWin = Application::GetFirstTopLevelWindow();
2796 while (pWin)
2798 pWin->ImplGetFrame()->UpdateDarkMode();
2799 pWin = Application::GetNextTopLevelWindow(pWin);
2803 bool MiscSettings::GetUseDarkMode()
2805 vcl::Window* pDefWindow = ImplGetDefaultWindow();
2806 if (pDefWindow == nullptr)
2807 return false;
2808 return pDefWindow->ImplGetFrame()->GetUseDarkMode();
2811 int MiscSettings::GetAppColorMode()
2813 if (utl::ConfigManager::IsFuzzing())
2814 return 0;
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);
2822 batch->commit();
2825 bool MiscSettings::GetUseReducedAnimation()
2827 vcl::Window* pDefWindow = ImplGetDefaultWindow();
2828 if (pDefWindow == nullptr)
2829 return false;
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 )
2841 return true;
2843 return (mxData->mnTipTimeout == rSet.mxData->mnTipTimeout );
2846 sal_Int32
2847 HelpSettings::GetTipDelay()
2849 return 500;
2852 void
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;
2863 sal_Int32
2864 HelpSettings::GetTipTimeout() const
2866 return mxData->mnTipTimeout;
2869 sal_Int32
2870 HelpSettings::GetBalloonDelay()
2872 return 1500;
2875 bool
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 )
2934 CopyData();
2935 mxData->maMouseSettings = rSet.mxData->maMouseSettings;
2936 nChangeFlags |= AllSettingsFlags::MOUSE;
2940 if ( nFlags & AllSettingsFlags::STYLE )
2942 if ( mxData->maStyleSettings != rSet.mxData->maStyleSettings )
2944 CopyData();
2945 mxData->maStyleSettings = rSet.mxData->maStyleSettings;
2946 nChangeFlags |= AllSettingsFlags::STYLE;
2950 if ( nFlags & AllSettingsFlags::MISC )
2952 if ( mxData->maMiscSettings != rSet.mxData->maMiscSettings )
2954 CopyData();
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 )
2992 return true;
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) )
3000 return true;
3003 return false;
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)
3014 return;
3016 CopyData();
3018 mxData->maLocale = rLanguageTag;
3020 if ( mxData->mpLocaleDataWrapper )
3022 mxData->mpLocaleDataWrapper.reset();
3024 if ( mxData->mpI18nHelper )
3026 mxData->mpI18nHelper.reset();
3030 namespace
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
3038 if( pEnv )
3039 return true;
3041 bool bRTL = false;
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() )
3051 bool bTmp = bool();
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();
3064 if (bMath)
3065 bRTL = MsLangId::isRightToLeftMath( aLang );
3066 else
3067 bRTL = MsLangId::isRightToLeft( aLang );
3069 else
3070 bRTL = (nUIMirroring == 1);
3072 return bRTL;
3076 bool AllSettings::GetLayoutRTL()
3078 if (utl::ConfigManager::IsFuzzing())
3079 return false;
3080 return GetConfigLayoutRTL(false);
3083 bool AllSettings::GetMathLayoutRTL()
3085 if (utl::ConfigManager::IsFuzzing())
3086 return false;
3087 return GetConfigLayoutRTL(true);
3090 const LanguageTag& AllSettings::GetLanguageTag() const
3092 if (utl::ConfigManager::IsFuzzing())
3094 static LanguageTag aRet("en-US");
3095 return aRet;
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");
3113 return aRet;
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();
3209 /*static*/ OUString
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(),
3218 desktopEnvironment
3220 return themeName;
3223 void
3224 StyleSettings::SetIconTheme(const OUString& theme)
3226 CopyData();
3227 mxData->mIconTheme = theme;
3230 OUString
3231 StyleSettings::DetermineIconTheme() const
3233 OUString sTheme(mxData->mIconTheme);
3234 if (sTheme.isEmpty())
3236 if (utl::ConfigManager::IsFuzzing())
3237 sTheme = "colibre";
3238 else
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(),
3253 sTheme);
3254 return r;
3257 void
3258 StyleSettings::SetHighContrastMode(bool bHighContrast )
3260 if (mxData->mbHighContrast == bHighContrast) {
3261 return;
3264 CopyData();
3265 mxData->mbHighContrast = bHighContrast;
3266 mxData->mIconThemeSelector->SetUseHighContrastTheme(bHighContrast);
3269 bool
3270 StyleSettings::GetHighContrastMode() const
3272 return mxData->mbHighContrast;
3275 void
3276 StyleSettings::SetPreferredIconTheme(const OUString& theme, bool bDarkIconTheme)
3278 const bool bChanged = mxData->mIconThemeSelector->SetPreferredIconTheme(theme, bDarkIconTheme);
3279 if (bChanged)
3281 // clear this so it is recalculated if it was selected as the automatic theme
3282 mxData->mIconTheme.clear();
3286 void
3287 AllSettings::SetMouseSettings( const MouseSettings& rSet )
3289 CopyData();
3290 mxData->maMouseSettings = rSet;
3293 const MouseSettings&
3294 AllSettings::GetMouseSettings() const
3296 return mxData->maMouseSettings;
3299 void
3300 AllSettings::SetStyleSettings( const StyleSettings& rSet )
3302 CopyData();
3303 mxData->maStyleSettings = rSet;
3306 void
3307 AllSettings::SetMiscSettings( const MiscSettings& rSet )
3309 CopyData();
3310 mxData->maMiscSettings = rSet;
3313 const MiscSettings&
3314 AllSettings::GetMiscSettings() const
3316 return mxData->maMiscSettings;
3319 void
3320 AllSettings::SetHelpSettings( const HelpSettings& rSet )
3322 CopyData();
3323 mxData->maHelpSettings = rSet;
3326 const HelpSettings&
3327 AllSettings::GetHelpSettings() const
3329 return mxData->maHelpSettings;
3332 bool
3333 AllSettings::operator !=( const AllSettings& rSet ) const
3335 return !(*this == rSet);
3338 SvtSysLocale&
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: */