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.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #include <config_folders.h>
21 
22 #include <officecfg/Office/Common.hxx>
23 
24 #ifdef _WIN32
25 #include <win/svsys.h>
26 #endif
27 
28 #include <comphelper/processfactory.hxx>
29 #include <rtl/bootstrap.hxx>
30 
31 #include <i18nlangtag/mslangid.hxx>
32 #include <i18nlangtag/languagetag.hxx>
33 
34 #include <comphelper/lok.hxx>
35 
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>
46 
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>
53 
54 using namespace ::com::sun::star;
55 
56 #include <svdata.hxx>
57 
58 struct ImplMouseData
59 {
60     MouseSettingsOptions            mnOptions           = MouseSettingsOptions::NONE;
61     sal_uInt64                      mnDoubleClkTime     = 500;
62     sal_Int32                       mnDoubleClkWidth    = 2;
63     sal_Int32                       mnDoubleClkHeight   = 2;
64     sal_Int32                       mnStartDragWidth    = 2 ;
65     sal_Int32                       mnStartDragHeight   = 2;
66     sal_Int32                       mnButtonRepeat      = 90;
67     sal_Int32                       mnMenuDelay         = 150;
68     MouseFollowFlags                mnFollow            = MouseFollowFlags::Menu;
69     MouseMiddleButtonAction         mnMiddleButtonAction= MouseMiddleButtonAction::AutoScroll;
70     MouseWheelBehaviour             mnWheelBehavior     = MouseWheelBehaviour::ALWAYS;
71 };
72 
73 struct ImplStyleData
74 {
75                                     ImplStyleData();
76                                     ImplStyleData( const ImplStyleData& rData );
77 
78     void                            SetStandardStyles();
79 
80     Color                           maActiveBorderColor;
81     Color                           maActiveColor;
82     Color                           maActiveTextColor;
83     Color                           maAlternatingRowColor;
84     Color                           maDefaultButtonTextColor;
85     Color                           maButtonTextColor;
86     Color                           maDefaultActionButtonTextColor;
87     Color                           maActionButtonTextColor;
88     Color                           maFlatButtonTextColor;
89     Color                           maDefaultButtonRolloverTextColor;
90     Color                           maButtonRolloverTextColor;
91     Color                           maDefaultActionButtonRolloverTextColor;
92     Color                           maActionButtonRolloverTextColor;
93     Color                           maFlatButtonRolloverTextColor;
94     Color                           maDefaultButtonPressedRolloverTextColor;
95     Color                           maButtonPressedRolloverTextColor;
96     Color                           maDefaultActionButtonPressedRolloverTextColor;
97     Color                           maActionButtonPressedRolloverTextColor;
98     Color                           maFlatButtonPressedRolloverTextColor;
99     Color                           maCheckedColor;
100     Color                           maDarkShadowColor;
101     Color                           maDeactiveBorderColor;
102     Color                           maDeactiveColor;
103     Color                           maDeactiveTextColor;
104     Color                           maDialogColor;
105     Color                           maDialogTextColor;
106     Color                           maDisableColor;
107     Color                           maFaceColor;
108     Color                           maFieldColor;
109     Color                           maFieldTextColor;
110     Color                           maFieldRolloverTextColor;
111     Color                           maFontColor;
112     Color                           maGroupTextColor;
113     Color                           maHelpColor;
114     Color                           maHelpTextColor;
115     Color                           maHighlightColor;
116     Color                           maHighlightTextColor;
117     Color                           maLabelTextColor;
118     Color                           maLightBorderColor;
119     Color                           maLightColor;
120     Color                           maLinkColor;
121     Color                           maMenuBarColor;
122     Color                           maMenuBarRolloverColor;
123     Color                           maMenuBorderColor;
124     Color                           maMenuColor;
125     Color                           maMenuHighlightColor;
126     Color                           maMenuHighlightTextColor;
127     Color                           maMenuTextColor;
128     Color                           maMenuBarTextColor;
129     Color                           maMenuBarRolloverTextColor;
130     Color                           maMenuBarHighlightTextColor;
131     Color                           maMonoColor;
132     Color                           maRadioCheckTextColor;
133     Color                           maShadowColor;
134     Color                           maVisitedLinkColor;
135     Color                           maToolTextColor;
136     Color                           maWindowColor;
137     Color                           maWindowTextColor;
138     Color                           maWorkspaceColor;
139     Color                           maActiveTabColor;
140     Color                           maInactiveTabColor;
141     Color                           maTabTextColor;
142     Color                           maTabRolloverTextColor;
143     Color                           maTabHighlightTextColor;
144     vcl::Font                       maAppFont;
145     vcl::Font                       maHelpFont;
146     vcl::Font                       maTitleFont;
147     vcl::Font                       maFloatTitleFont;
148     vcl::Font                       maMenuFont;
149     vcl::Font                       maToolFont;
150     vcl::Font                       maLabelFont;
151     vcl::Font                       maRadioCheckFont;
152     vcl::Font                       maPushButtonFont;
153     vcl::Font                       maFieldFont;
154     vcl::Font                       maIconFont;
155     vcl::Font                       maTabFont;
156     vcl::Font                       maGroupFont;
157     sal_Int32                       mnTitleHeight;
158     sal_Int32                       mnFloatTitleHeight;
159     sal_Int32                       mnScrollBarSize;
160     sal_Int32                       mnSpinSize;
161     sal_Int32                       mnCursorSize;
162     sal_Int32                       mnAntialiasedMin;
163     sal_uInt64                      mnCursorBlinkTime;
164     DragFullOptions                 mnDragFullOptions;
165     SelectionOptions                mnSelectionOptions;
166     DisplayOptions                  mnDisplayOptions;
167     ToolbarIconSize                 mnToolbarIconSize;
168     bool                            mnUseFlatMenus;
169     StyleSettingsOptions            mnOptions;
170     bool                            mbHighContrast;
171     bool                            mbUseSystemUIFonts;
172     /**
173      * Disabling AA doesn't actually disable AA of fonts, instead it is taken
174      * from system settings.
175      */
176     bool mbUseFontAAFromSystem;
177     bool                            mbAutoMnemonic;
178     TriState                        meUseImagesInMenus;
179     bool                            mnUseFlatBorders;
180     bool                            mbPreferredUseImagesInMenus;
181     sal_Int32                       mnMinThumbSize;
182     std::shared_ptr<vcl::IconThemeScanner>
183                                     mIconThemeScanner;
184     std::shared_ptr<vcl::IconThemeSelector>
185                                     mIconThemeSelector;
186 
187     OUString                   mIconTheme;
188     bool                            mbSkipDisabledInMenus;
189     bool                            mbHideDisabledMenuItems;
190     bool                            mbPreferredContextMenuShortcuts;
191     TriState                        meContextMenuShortcuts;
192     //mbPrimaryButtonWarpsSlider == true for "jump to here" behavior for primary button, otherwise
193     //primary means scroll by single page. Secondary button takes the alternative behaviour
194     bool                            mbPrimaryButtonWarpsSlider;
195     DialogStyle                     maDialogStyle;
196 
197     sal_uInt16                      mnEdgeBlending;
198     Color                           maEdgeBlendingTopLeftColor;
199     Color                           maEdgeBlendingBottomRightColor;
200     sal_uInt16                      mnListBoxMaximumLineCount;
201     sal_uInt16                      mnColorValueSetColumnCount;
202     Size                            maListBoxPreviewDefaultLogicSize;
203     Size                            maListBoxPreviewDefaultPixelSize;
204     bool                            mbPreviewUsesCheckeredBackground;
205 
206     OUString                        maPersonaHeaderFooter; ///< Cache the settings to detect changes.
207 
208     BitmapEx                        maPersonaHeaderBitmap; ///< Cache the header bitmap.
209     BitmapEx                        maPersonaFooterBitmap; ///< Cache the footer bitmap.
210     std::optional<Color>          maPersonaMenuBarTextColor; ///< Cache the menubar color.
211 };
212 
213 struct ImplMiscData
214 {
215                                     ImplMiscData();
216     TriState                        mnEnableATT;
217     bool                            mbEnableLocalizedDecimalSep;
218     TriState                        mnDisablePrinting;
219 };
220 
221 struct ImplHelpData
222 {
223     sal_Int32                       mnTipTimeout = 3000;
224 };
225 
226 struct ImplAllSettingsData
227 {
228     ImplAllSettingsData();
229     ImplAllSettingsData( const ImplAllSettingsData& rData );
230     ~ImplAllSettingsData();
231 
232     MouseSettings                           maMouseSettings;
233     StyleSettings                           maStyleSettings;
234     MiscSettings                            maMiscSettings;
235     HelpSettings                            maHelpSettings;
236     LanguageTag                             maLocale;
237     LanguageTag                             maUILocale;
238     std::unique_ptr<LocaleDataWrapper>      mpLocaleDataWrapper;
239     std::unique_ptr<LocaleDataWrapper>      mpUILocaleDataWrapper;
240     std::unique_ptr<LocaleDataWrapper>      mpNeutralLocaleDataWrapper;
241     std::unique_ptr<vcl::I18nHelper>        mpI18nHelper;
242     std::unique_ptr<vcl::I18nHelper>        mpUII18nHelper;
243     SvtSysLocale                            maSysLocale;
244 };
245 
246 void
SetOptions(MouseSettingsOptions nOptions)247 MouseSettings::SetOptions(MouseSettingsOptions nOptions)
248 {
249     CopyData();
250     mxData->mnOptions = nOptions;
251 }
252 
253 MouseSettingsOptions
GetOptions() const254 MouseSettings::GetOptions() const
255 {
256     return mxData->mnOptions;
257 }
258 
259 void
SetDoubleClickTime(sal_uInt64 nDoubleClkTime)260 MouseSettings::SetDoubleClickTime( sal_uInt64 nDoubleClkTime )
261 {
262     CopyData();
263     mxData->mnDoubleClkTime = nDoubleClkTime;
264 }
265 
266 sal_uInt64
GetDoubleClickTime() const267 MouseSettings::GetDoubleClickTime() const
268 {
269     return mxData->mnDoubleClkTime;
270 }
271 
272 void
SetDoubleClickWidth(sal_Int32 nDoubleClkWidth)273 MouseSettings::SetDoubleClickWidth( sal_Int32 nDoubleClkWidth )
274 {
275     CopyData();
276     mxData->mnDoubleClkWidth = nDoubleClkWidth;
277 }
278 
279 sal_Int32
GetDoubleClickWidth() const280 MouseSettings::GetDoubleClickWidth() const
281 {
282     return mxData->mnDoubleClkWidth;
283 }
284 
285 void
SetDoubleClickHeight(sal_Int32 nDoubleClkHeight)286 MouseSettings::SetDoubleClickHeight( sal_Int32 nDoubleClkHeight )
287 {
288     CopyData();
289     mxData->mnDoubleClkHeight = nDoubleClkHeight;
290 }
291 
292 sal_Int32
GetDoubleClickHeight() const293 MouseSettings::GetDoubleClickHeight() const
294 {
295     return mxData->mnDoubleClkHeight;
296 }
297 
298 void
SetStartDragWidth(sal_Int32 nDragWidth)299 MouseSettings::SetStartDragWidth( sal_Int32 nDragWidth )
300 {
301     CopyData();
302     mxData->mnStartDragWidth = nDragWidth;
303 }
304 
305 sal_Int32
GetStartDragWidth() const306 MouseSettings::GetStartDragWidth() const
307 {
308     return mxData->mnStartDragWidth;
309 }
310 
311 void
SetStartDragHeight(sal_Int32 nDragHeight)312 MouseSettings::SetStartDragHeight( sal_Int32 nDragHeight )
313 {
314     CopyData();
315     mxData->mnStartDragHeight = nDragHeight;
316 }
317 
318 sal_Int32
GetStartDragHeight() const319 MouseSettings::GetStartDragHeight() const
320 {
321     return mxData->mnStartDragHeight;
322 }
323 
324 sal_uInt16
GetStartDragCode()325 MouseSettings::GetStartDragCode()
326 {
327     return MOUSE_LEFT;
328 }
329 
330 sal_uInt16
GetContextMenuCode()331 MouseSettings::GetContextMenuCode()
332 {
333     return MOUSE_RIGHT;
334 }
335 
336 sal_uInt16
GetContextMenuClicks()337 MouseSettings::GetContextMenuClicks()
338 {
339     return 1;
340 }
341 
342 sal_Int32
GetScrollRepeat()343 MouseSettings::GetScrollRepeat()
344 {
345     return 100;
346 }
347 
348 sal_Int32
GetButtonStartRepeat()349 MouseSettings::GetButtonStartRepeat()
350 {
351     return 370;
352 }
353 
354 void
SetButtonRepeat(sal_Int32 nRepeat)355 MouseSettings::SetButtonRepeat( sal_Int32 nRepeat )
356 {
357     CopyData();
358     mxData->mnButtonRepeat = nRepeat;
359 }
360 
361 sal_Int32
GetButtonRepeat() const362 MouseSettings::GetButtonRepeat() const
363 {
364     return mxData->mnButtonRepeat;
365 }
366 
367 sal_Int32
GetActionDelay()368 MouseSettings::GetActionDelay()
369 {
370     return 250;
371 }
372 
373 void
SetMenuDelay(sal_Int32 nDelay)374 MouseSettings::SetMenuDelay( sal_Int32 nDelay )
375 {
376     CopyData();
377     mxData->mnMenuDelay = nDelay;
378 }
379 
380 sal_Int32
GetMenuDelay() const381 MouseSettings::GetMenuDelay() const
382 {
383     return mxData->mnMenuDelay;
384 }
385 
386 void
SetFollow(MouseFollowFlags nFollow)387 MouseSettings::SetFollow( MouseFollowFlags nFollow )
388 {
389     CopyData();
390     mxData->mnFollow = nFollow;
391 }
392 
393 MouseFollowFlags
GetFollow() const394 MouseSettings::GetFollow() const
395 {
396     return mxData->mnFollow;
397 }
398 
399 void
SetMiddleButtonAction(MouseMiddleButtonAction nAction)400 MouseSettings::SetMiddleButtonAction( MouseMiddleButtonAction nAction )
401 {
402     CopyData();
403     mxData->mnMiddleButtonAction = nAction;
404 }
405 
406 MouseMiddleButtonAction
GetMiddleButtonAction() const407 MouseSettings::GetMiddleButtonAction() const
408 {
409     return mxData->mnMiddleButtonAction;
410 }
411 
412 void
SetWheelBehavior(MouseWheelBehaviour nBehavior)413 MouseSettings::SetWheelBehavior( MouseWheelBehaviour nBehavior )
414 {
415     CopyData();
416     mxData->mnWheelBehavior = nBehavior;
417 }
418 
419 MouseWheelBehaviour
GetWheelBehavior() const420 MouseSettings::GetWheelBehavior() const
421 {
422     return mxData->mnWheelBehavior;
423 }
424 
425 bool
operator !=(const MouseSettings & rSet) const426 MouseSettings::operator !=( const MouseSettings& rSet ) const
427 {
428     return !(*this == rSet);
429 }
430 
MouseSettings()431 MouseSettings::MouseSettings()
432     : mxData(std::make_shared<ImplMouseData>())
433 {
434 }
435 
CopyData()436 void MouseSettings::CopyData()
437 {
438     // copy if other references exist
439     if (mxData.use_count() > 1)
440     {
441         mxData = std::make_shared<ImplMouseData>(*mxData);
442     }
443 }
444 
operator ==(const MouseSettings & rSet) const445 bool MouseSettings::operator ==( const MouseSettings& rSet ) const
446 {
447     if ( mxData == rSet.mxData )
448         return true;
449 
450     return
451          (mxData->mnOptions             == rSet.mxData->mnOptions)              &&
452          (mxData->mnDoubleClkTime       == rSet.mxData->mnDoubleClkTime)        &&
453          (mxData->mnDoubleClkWidth      == rSet.mxData->mnDoubleClkWidth)       &&
454          (mxData->mnDoubleClkHeight     == rSet.mxData->mnDoubleClkHeight)      &&
455          (mxData->mnStartDragWidth      == rSet.mxData->mnStartDragWidth)       &&
456          (mxData->mnStartDragHeight     == rSet.mxData->mnStartDragHeight)      &&
457          (mxData->mnMiddleButtonAction  == rSet.mxData->mnMiddleButtonAction)   &&
458          (mxData->mnButtonRepeat        == rSet.mxData->mnButtonRepeat)         &&
459          (mxData->mnMenuDelay           == rSet.mxData->mnMenuDelay)            &&
460          (mxData->mnFollow              == rSet.mxData->mnFollow)               &&
461          (mxData->mnWheelBehavior       == rSet.mxData->mnWheelBehavior );
462 }
463 
ImplStyleData()464 ImplStyleData::ImplStyleData() :
465     mnScrollBarSize(16),
466     mnSpinSize(16),
467     mnCursorSize(2),
468     mnAntialiasedMin(0),
469     mnCursorBlinkTime(STYLE_CURSOR_NOBLINKTIME),
470     mnDragFullOptions(DragFullOptions::All),
471     mnSelectionOptions(SelectionOptions::NONE),
472     mnDisplayOptions(DisplayOptions::NONE),
473     mnToolbarIconSize(ToolbarIconSize::Unknown),
474     mnOptions(StyleSettingsOptions::NONE),
475     mbAutoMnemonic(true),
476     meUseImagesInMenus(TRISTATE_INDET),
477     mnMinThumbSize(16),
478     mIconThemeSelector(std::make_shared<vcl::IconThemeSelector>()),
479     meContextMenuShortcuts(TRISTATE_INDET),
480     mnEdgeBlending(35),
481     maEdgeBlendingTopLeftColor(Color(0xC0, 0xC0, 0xC0)),
482     maEdgeBlendingBottomRightColor(Color(0x40, 0x40, 0x40)),
483     mnListBoxMaximumLineCount(25),
484     // For some reason this isn't actually the column count that gets used, at least on iOS, but
485     // instead what SvtAccessibilityOptions_Impl::GetColorValueSetColumnCount() in
486     // svtools/source/config/accessibilityoptions.cxx returns.
487     mnColorValueSetColumnCount(12),
488 #ifdef IOS
489     maListBoxPreviewDefaultLogicSize(Size(30, 30)),
490 #else
491     maListBoxPreviewDefaultLogicSize(Size(15, 7)),
492 #endif
493     maListBoxPreviewDefaultPixelSize(Size(0, 0)), // on-demand calculated in GetListBoxPreviewDefaultPixelSize(),
494     mbPreviewUsesCheckeredBackground(true)
495 {
496     SetStandardStyles();
497 }
498 
ImplStyleData(const ImplStyleData & rData)499 ImplStyleData::ImplStyleData( const ImplStyleData& rData ) :
500     maActiveBorderColor( rData.maActiveBorderColor ),
501     maActiveColor( rData.maActiveColor ),
502     maActiveTextColor( rData.maActiveTextColor ),
503     maAlternatingRowColor( rData.maAlternatingRowColor ),
504     maDefaultButtonTextColor( rData.maDefaultButtonTextColor ),
505     maButtonTextColor( rData.maButtonTextColor ),
506     maDefaultActionButtonTextColor( rData.maDefaultActionButtonTextColor ),
507     maActionButtonTextColor( rData.maActionButtonTextColor ),
508     maFlatButtonTextColor( rData.maFlatButtonTextColor ),
509     maDefaultButtonRolloverTextColor( rData.maDefaultButtonRolloverTextColor ),
510     maButtonRolloverTextColor( rData.maButtonRolloverTextColor ),
511     maDefaultActionButtonRolloverTextColor( rData.maDefaultActionButtonRolloverTextColor ),
512     maActionButtonRolloverTextColor( rData.maActionButtonRolloverTextColor ),
513     maFlatButtonRolloverTextColor( rData.maFlatButtonRolloverTextColor ),
514     maDefaultButtonPressedRolloverTextColor( rData.maDefaultButtonPressedRolloverTextColor ),
515     maButtonPressedRolloverTextColor( rData.maButtonPressedRolloverTextColor ),
516     maDefaultActionButtonPressedRolloverTextColor( rData.maDefaultActionButtonPressedRolloverTextColor ),
517     maActionButtonPressedRolloverTextColor( rData.maActionButtonPressedRolloverTextColor ),
518     maFlatButtonPressedRolloverTextColor( rData.maFlatButtonPressedRolloverTextColor ),
519     maCheckedColor( rData.maCheckedColor ),
520     maDarkShadowColor( rData.maDarkShadowColor ),
521     maDeactiveBorderColor( rData.maDeactiveBorderColor ),
522     maDeactiveColor( rData.maDeactiveColor ),
523     maDeactiveTextColor( rData.maDeactiveTextColor ),
524     maDialogColor( rData.maDialogColor ),
525     maDialogTextColor( rData.maDialogTextColor ),
526     maDisableColor( rData.maDisableColor ),
527     maFaceColor( rData.maFaceColor ),
528     maFieldColor( rData.maFieldColor ),
529     maFieldTextColor( rData.maFieldTextColor ),
530     maFieldRolloverTextColor( rData.maFieldRolloverTextColor ),
531     maFontColor( rData.maFontColor ),
532     maGroupTextColor( rData.maGroupTextColor ),
533     maHelpColor( rData.maHelpColor ),
534     maHelpTextColor( rData.maHelpTextColor ),
535     maHighlightColor( rData.maHighlightColor ),
536     maHighlightTextColor( rData.maHighlightTextColor ),
537     maLabelTextColor( rData.maLabelTextColor ),
538     maLightBorderColor( rData.maLightBorderColor ),
539     maLightColor( rData.maLightColor ),
540     maLinkColor( rData.maLinkColor ),
541     maMenuBarColor( rData.maMenuBarColor ),
542     maMenuBarRolloverColor( rData.maMenuBarRolloverColor ),
543     maMenuBorderColor( rData.maMenuBorderColor ),
544     maMenuColor( rData.maMenuColor ),
545     maMenuHighlightColor( rData.maMenuHighlightColor ),
546     maMenuHighlightTextColor( rData.maMenuHighlightTextColor ),
547     maMenuTextColor( rData.maMenuTextColor ),
548     maMenuBarTextColor( rData.maMenuBarTextColor ),
549     maMenuBarRolloverTextColor( rData.maMenuBarRolloverTextColor ),
550     maMenuBarHighlightTextColor( rData.maMenuBarHighlightTextColor ),
551     maMonoColor( rData.maMonoColor ),
552     maRadioCheckTextColor( rData.maRadioCheckTextColor ),
553     maShadowColor( rData.maShadowColor ),
554     maVisitedLinkColor( rData.maVisitedLinkColor ),
555     maToolTextColor( rData.maToolTextColor ),
556     maWindowColor( rData.maWindowColor ),
557     maWindowTextColor( rData.maWindowTextColor ),
558     maWorkspaceColor( rData.maWorkspaceColor ),
559     maActiveTabColor( rData.maActiveTabColor ),
560     maInactiveTabColor( rData.maInactiveTabColor ),
561     maTabTextColor( rData.maTabTextColor ),
562     maTabRolloverTextColor( rData.maTabRolloverTextColor ),
563     maTabHighlightTextColor( rData.maTabHighlightTextColor ),
564     maAppFont( rData.maAppFont ),
565     maHelpFont( rData.maAppFont ),
566     maTitleFont( rData.maTitleFont ),
567     maFloatTitleFont( rData.maFloatTitleFont ),
568     maMenuFont( rData.maMenuFont ),
569     maToolFont( rData.maToolFont ),
570     maLabelFont( rData.maLabelFont ),
571     maRadioCheckFont( rData.maRadioCheckFont ),
572     maPushButtonFont( rData.maPushButtonFont ),
573     maFieldFont( rData.maFieldFont ),
574     maIconFont( rData.maIconFont ),
575     maTabFont( rData.maTabFont ),
576     maGroupFont( rData.maGroupFont ),
577     mnTitleHeight(rData.mnTitleHeight),
578     mnFloatTitleHeight(rData.mnFloatTitleHeight),
579     mnScrollBarSize(rData.mnScrollBarSize),
580     mnSpinSize(rData.mnSpinSize),
581     mnCursorSize(rData.mnCursorSize),
582     mnAntialiasedMin(rData.mnAntialiasedMin),
583     mnCursorBlinkTime(rData.mnCursorBlinkTime),
584     mnDragFullOptions(rData.mnDragFullOptions),
585     mnSelectionOptions(rData.mnSelectionOptions),
586     mnDisplayOptions(rData.mnDisplayOptions),
587     mnToolbarIconSize(rData.mnToolbarIconSize),
588     mnUseFlatMenus(rData.mnUseFlatMenus),
589     mnOptions(rData.mnOptions),
590     mbHighContrast(rData.mbHighContrast),
591     mbUseSystemUIFonts(rData.mbUseSystemUIFonts),
592     mbUseFontAAFromSystem(rData.mbUseFontAAFromSystem),
593     mbAutoMnemonic(rData.mbAutoMnemonic),
594     meUseImagesInMenus(rData.meUseImagesInMenus),
595     mnUseFlatBorders(rData.mnUseFlatBorders),
596     mbPreferredUseImagesInMenus(rData.mbPreferredUseImagesInMenus),
597     mnMinThumbSize(rData.mnMinThumbSize),
598     mIconThemeSelector(std::make_shared<vcl::IconThemeSelector>(*rData.mIconThemeSelector)),
599     mIconTheme(rData.mIconTheme),
600     mbSkipDisabledInMenus(rData.mbSkipDisabledInMenus),
601     mbHideDisabledMenuItems(rData.mbHideDisabledMenuItems),
602     mbPreferredContextMenuShortcuts(rData.mbPreferredContextMenuShortcuts),
603     meContextMenuShortcuts(rData.meContextMenuShortcuts),
604     mbPrimaryButtonWarpsSlider(rData.mbPrimaryButtonWarpsSlider),
605     maDialogStyle( rData.maDialogStyle ),
606     mnEdgeBlending(rData.mnEdgeBlending),
607     maEdgeBlendingTopLeftColor(rData.maEdgeBlendingTopLeftColor),
608     maEdgeBlendingBottomRightColor(rData.maEdgeBlendingBottomRightColor),
609     mnListBoxMaximumLineCount(rData.mnListBoxMaximumLineCount),
610     mnColorValueSetColumnCount(rData.mnColorValueSetColumnCount),
611     maListBoxPreviewDefaultLogicSize(rData.maListBoxPreviewDefaultLogicSize),
612     maListBoxPreviewDefaultPixelSize(rData.maListBoxPreviewDefaultPixelSize),
613     mbPreviewUsesCheckeredBackground(rData.mbPreviewUsesCheckeredBackground),
614     maPersonaHeaderFooter( rData.maPersonaHeaderFooter ),
615     maPersonaHeaderBitmap( rData.maPersonaHeaderBitmap ),
616     maPersonaFooterBitmap( rData.maPersonaFooterBitmap ),
617     maPersonaMenuBarTextColor( rData.maPersonaMenuBarTextColor )
618 {
619     if (rData.mIconThemeScanner)
620         mIconThemeScanner = std::make_shared<vcl::IconThemeScanner>(*rData.mIconThemeScanner);
621 }
622 
SetStandardStyles()623 void ImplStyleData::SetStandardStyles()
624 {
625     vcl::Font aStdFont( FAMILY_SWISS, Size( 0, 8 ) );
626     aStdFont.SetCharSet( osl_getThreadTextEncoding() );
627     aStdFont.SetWeight( WEIGHT_NORMAL );
628     if (!utl::ConfigManager::IsFuzzing())
629         aStdFont.SetFamilyName(utl::DefaultFontConfiguration::get().getUserInterfaceFont(LanguageTag("en")));
630     else
631         aStdFont.SetFamilyName("Liberation Sans");
632     maAppFont                   = aStdFont;
633     maHelpFont                  = aStdFont;
634     maMenuFont                  = aStdFont;
635     maToolFont                  = aStdFont;
636     maGroupFont                 = aStdFont;
637     maLabelFont                 = aStdFont;
638     maRadioCheckFont            = aStdFont;
639     maPushButtonFont            = aStdFont;
640     maFieldFont                 = aStdFont;
641     maIconFont                  = aStdFont;
642     maTabFont                   = aStdFont;
643     aStdFont.SetWeight( WEIGHT_BOLD );
644     maFloatTitleFont            = aStdFont;
645     maTitleFont                 = aStdFont;
646 
647     maFaceColor                 = COL_LIGHTGRAY;
648     maCheckedColor              = Color( 0xCC, 0xCC, 0xCC );
649     maLightColor                = COL_WHITE;
650     maLightBorderColor          = COL_LIGHTGRAY;
651     maShadowColor               = COL_GRAY;
652     maDarkShadowColor           = COL_BLACK;
653 
654     maDefaultButtonTextColor                      = COL_BLACK;
655     maButtonTextColor                             = COL_BLACK;
656     maDefaultActionButtonTextColor                = COL_BLACK;
657     maActionButtonTextColor                       = COL_BLACK;
658     maFlatButtonTextColor                         = COL_BLACK;
659     maDefaultButtonRolloverTextColor              = COL_BLACK;
660     maButtonRolloverTextColor                     = COL_BLACK;
661     maDefaultActionButtonRolloverTextColor        = COL_BLACK;
662     maActionButtonRolloverTextColor               = COL_BLACK;
663     maFlatButtonRolloverTextColor                 = COL_BLACK;
664     maDefaultButtonPressedRolloverTextColor       = COL_BLACK;
665     maButtonPressedRolloverTextColor              = COL_BLACK;
666     maDefaultActionButtonPressedRolloverTextColor = COL_BLACK;
667     maActionButtonPressedRolloverTextColor        = COL_BLACK;
668     maFlatButtonPressedRolloverTextColor          = COL_BLACK;
669 
670     maRadioCheckTextColor       = COL_BLACK;
671     maGroupTextColor            = COL_BLACK;
672     maLabelTextColor            = COL_BLACK;
673     maWindowColor               = COL_WHITE;
674     maWindowTextColor           = COL_BLACK;
675     maDialogColor               = COL_LIGHTGRAY;
676     maDialogTextColor           = COL_BLACK;
677     maWorkspaceColor            = Color( 0xDF, 0xDF, 0xDE );
678     maMonoColor                 = COL_BLACK;
679     maFieldColor                = COL_WHITE;
680     maFieldTextColor            = COL_BLACK;
681     maFieldRolloverTextColor    = COL_BLACK;
682     maActiveBorderColor         = COL_LIGHTGRAY;
683     maDeactiveColor             = COL_GRAY;
684     maDeactiveTextColor         = COL_LIGHTGRAY;
685     maDeactiveBorderColor       = COL_LIGHTGRAY;
686     maMenuColor                 = COL_LIGHTGRAY;
687     maMenuBarColor              = COL_LIGHTGRAY;
688     maMenuBarRolloverColor      = COL_BLUE;
689     maMenuBorderColor           = COL_LIGHTGRAY;
690     maMenuTextColor             = COL_BLACK;
691     maMenuBarTextColor          = COL_BLACK;
692     maMenuBarRolloverTextColor  = COL_WHITE;
693     maMenuBarHighlightTextColor = COL_WHITE;
694     maMenuHighlightColor        = COL_BLUE;
695     maMenuHighlightTextColor    = COL_WHITE;
696     maHighlightColor            = COL_BLUE;
697     maHighlightTextColor        = COL_WHITE;
698     // make active like highlight, except with a small contrast
699     maActiveColor               = maHighlightColor;
700     maActiveColor.IncreaseLuminance(32);
701     maActiveTextColor           = maHighlightTextColor;
702     maActiveTabColor            = COL_WHITE;
703     maInactiveTabColor          = COL_LIGHTGRAY;
704     maTabTextColor              = COL_BLACK;
705     maTabRolloverTextColor      = COL_BLACK;
706     maTabHighlightTextColor     = COL_BLACK;
707     maDisableColor              = COL_GRAY;
708     maHelpColor                 = Color( 0xFF, 0xFF, 0xE0 );
709     maHelpTextColor             = COL_BLACK;
710     maLinkColor                 = COL_BLUE;
711     maVisitedLinkColor          = Color( 0x00, 0x00, 0xCC );
712     maToolTextColor             = COL_BLACK;
713     maFontColor                 = COL_BLACK;
714     maAlternatingRowColor       = Color( 0xEE, 0xEE, 0xEE );
715 
716     mnTitleHeight                   = 18;
717     mnFloatTitleHeight              = 13;
718     mbHighContrast                  = false;
719     mbUseSystemUIFonts              = true;
720     mbUseFontAAFromSystem           = true;
721     mnUseFlatBorders                = false;
722     mnUseFlatMenus                  = false;
723     mbPreferredUseImagesInMenus     = true;
724     mbSkipDisabledInMenus           = false;
725     mbHideDisabledMenuItems         = false;
726     mbPreferredContextMenuShortcuts = true;
727     mbPrimaryButtonWarpsSlider      = false;
728 }
729 
StyleSettings()730 StyleSettings::StyleSettings()
731     : mxData(std::make_shared<ImplStyleData>())
732 {
733 }
734 
735 void
SetFaceColor(const Color & rColor)736 StyleSettings::SetFaceColor( const Color& rColor )
737 {
738     CopyData();
739     mxData->maFaceColor = rColor;
740 }
741 
742 const Color&
GetFaceColor() const743 StyleSettings::GetFaceColor() const
744 {
745     return mxData->maFaceColor;
746 }
747 
748 void
SetCheckedColor(const Color & rColor)749 StyleSettings::SetCheckedColor( const Color& rColor )
750 {
751     CopyData();
752     mxData->maCheckedColor = rColor;
753 }
754 
755 const Color&
GetCheckedColor() const756 StyleSettings::GetCheckedColor() const
757 {
758     return mxData->maCheckedColor;
759 }
760 
761 void
SetLightColor(const Color & rColor)762 StyleSettings::SetLightColor( const Color& rColor )
763 {
764     CopyData();
765     mxData->maLightColor = rColor;
766 }
767 
768 const Color&
GetLightColor() const769 StyleSettings::GetLightColor() const
770 {
771     return mxData->maLightColor;
772 }
773 
774 void
SetLightBorderColor(const Color & rColor)775 StyleSettings::SetLightBorderColor( const Color& rColor )
776 {
777     CopyData();
778     mxData->maLightBorderColor = rColor;
779 }
780 
781 const Color&
GetLightBorderColor() const782 StyleSettings::GetLightBorderColor() const
783 {
784     return mxData->maLightBorderColor;
785 }
786 
787 void
SetShadowColor(const Color & rColor)788 StyleSettings::SetShadowColor( const Color& rColor )
789 {
790     CopyData();
791     mxData->maShadowColor = rColor;
792 }
793 
794 const Color&
GetShadowColor() const795 StyleSettings::GetShadowColor() const
796 {
797     return mxData->maShadowColor;
798 }
799 
800 void
SetDarkShadowColor(const Color & rColor)801 StyleSettings::SetDarkShadowColor( const Color& rColor )
802 {
803     CopyData();
804     mxData->maDarkShadowColor = rColor;
805 }
806 
807 const Color&
GetDarkShadowColor() const808 StyleSettings::GetDarkShadowColor() const
809 {
810     return mxData->maDarkShadowColor;
811 }
812 
813 void
SetDefaultButtonTextColor(const Color & rColor)814 StyleSettings::SetDefaultButtonTextColor( const Color& rColor )
815 {
816     CopyData();
817     mxData->maDefaultButtonTextColor = rColor;
818 }
819 
820 const Color&
GetDefaultButtonTextColor() const821 StyleSettings::GetDefaultButtonTextColor() const
822 {
823     return mxData->maDefaultButtonTextColor;
824 }
825 
826 void
SetButtonTextColor(const Color & rColor)827 StyleSettings::SetButtonTextColor( const Color& rColor )
828 {
829     CopyData();
830     mxData->maButtonTextColor = rColor;
831 }
832 
833 const Color&
GetButtonTextColor() const834 StyleSettings::GetButtonTextColor() const
835 {
836     return mxData->maButtonTextColor;
837 }
838 
839 void
SetDefaultActionButtonTextColor(const Color & rColor)840 StyleSettings::SetDefaultActionButtonTextColor( const Color& rColor )
841 {
842     CopyData();
843     mxData->maDefaultActionButtonTextColor = rColor;
844 }
845 
846 const Color&
GetDefaultActionButtonTextColor() const847 StyleSettings::GetDefaultActionButtonTextColor() const
848 {
849     return mxData->maDefaultActionButtonTextColor;
850 }
851 
852 void
SetActionButtonTextColor(const Color & rColor)853 StyleSettings::SetActionButtonTextColor( const Color& rColor )
854 {
855     CopyData();
856     mxData->maActionButtonTextColor = rColor;
857 }
858 
859 const Color&
GetActionButtonTextColor() const860 StyleSettings::GetActionButtonTextColor() const
861 {
862     return mxData->maActionButtonTextColor;
863 }
864 
865 void
SetFlatButtonTextColor(const Color & rColor)866 StyleSettings::SetFlatButtonTextColor( const Color& rColor )
867 {
868     CopyData();
869     mxData->maFlatButtonTextColor = rColor;
870 }
871 
872 const Color&
GetFlatButtonTextColor() const873 StyleSettings::GetFlatButtonTextColor() const
874 {
875     return mxData->maFlatButtonTextColor;
876 }
877 
878 void
SetDefaultButtonRolloverTextColor(const Color & rColor)879 StyleSettings::SetDefaultButtonRolloverTextColor( const Color& rColor )
880 {
881     CopyData();
882     mxData->maDefaultButtonRolloverTextColor = rColor;
883 }
884 
885 const Color&
GetDefaultButtonRolloverTextColor() const886 StyleSettings::GetDefaultButtonRolloverTextColor() const
887 {
888     return mxData->maDefaultButtonRolloverTextColor;
889 }
890 
891 void
SetButtonRolloverTextColor(const Color & rColor)892 StyleSettings::SetButtonRolloverTextColor( const Color& rColor )
893 {
894     CopyData();
895     mxData->maButtonRolloverTextColor = rColor;
896 }
897 
898 const Color&
GetButtonRolloverTextColor() const899 StyleSettings::GetButtonRolloverTextColor() const
900 {
901     return mxData->maButtonRolloverTextColor;
902 }
903 
904 void
SetDefaultActionButtonRolloverTextColor(const Color & rColor)905 StyleSettings::SetDefaultActionButtonRolloverTextColor( const Color& rColor )
906 {
907     CopyData();
908     mxData->maDefaultActionButtonRolloverTextColor = rColor;
909 }
910 
911 const Color&
GetDefaultActionButtonRolloverTextColor() const912 StyleSettings::GetDefaultActionButtonRolloverTextColor() const
913 {
914     return mxData->maDefaultActionButtonRolloverTextColor;
915 }
916 
917 void
SetActionButtonRolloverTextColor(const Color & rColor)918 StyleSettings::SetActionButtonRolloverTextColor( const Color& rColor )
919 {
920     CopyData();
921     mxData->maActionButtonRolloverTextColor = rColor;
922 }
923 
924 const Color&
GetActionButtonRolloverTextColor() const925 StyleSettings::GetActionButtonRolloverTextColor() const
926 {
927     return mxData->maActionButtonRolloverTextColor;
928 }
929 
930 void
SetFlatButtonRolloverTextColor(const Color & rColor)931 StyleSettings::SetFlatButtonRolloverTextColor( const Color& rColor )
932 {
933     CopyData();
934     mxData->maFlatButtonRolloverTextColor = rColor;
935 }
936 
937 const Color&
GetFlatButtonRolloverTextColor() const938 StyleSettings::GetFlatButtonRolloverTextColor() const
939 {
940     return mxData->maFlatButtonRolloverTextColor;
941 }
942 
943 void
SetDefaultButtonPressedRolloverTextColor(const Color & rColor)944 StyleSettings::SetDefaultButtonPressedRolloverTextColor( const Color& rColor )
945 {
946     CopyData();
947     mxData->maDefaultButtonPressedRolloverTextColor = rColor;
948 }
949 
950 const Color&
GetDefaultButtonPressedRolloverTextColor() const951 StyleSettings::GetDefaultButtonPressedRolloverTextColor() const
952 {
953     return mxData->maDefaultButtonPressedRolloverTextColor;
954 }
955 
956 void
SetButtonPressedRolloverTextColor(const Color & rColor)957 StyleSettings::SetButtonPressedRolloverTextColor( const Color& rColor )
958 {
959     CopyData();
960     mxData->maButtonPressedRolloverTextColor = rColor;
961 }
962 
963 const Color&
GetButtonPressedRolloverTextColor() const964 StyleSettings::GetButtonPressedRolloverTextColor() const
965 {
966     return mxData->maButtonPressedRolloverTextColor;
967 }
968 
969 void
SetDefaultActionButtonPressedRolloverTextColor(const Color & rColor)970 StyleSettings::SetDefaultActionButtonPressedRolloverTextColor( const Color& rColor )
971 {
972     CopyData();
973     mxData->maDefaultActionButtonPressedRolloverTextColor = rColor;
974 }
975 
976 const Color&
GetDefaultActionButtonPressedRolloverTextColor() const977 StyleSettings::GetDefaultActionButtonPressedRolloverTextColor() const
978 {
979     return mxData->maDefaultActionButtonPressedRolloverTextColor;
980 }
981 
982 void
SetActionButtonPressedRolloverTextColor(const Color & rColor)983 StyleSettings::SetActionButtonPressedRolloverTextColor( const Color& rColor )
984 {
985     CopyData();
986     mxData->maActionButtonPressedRolloverTextColor = rColor;
987 }
988 
989 const Color&
GetActionButtonPressedRolloverTextColor() const990 StyleSettings::GetActionButtonPressedRolloverTextColor() const
991 {
992     return mxData->maActionButtonPressedRolloverTextColor;
993 }
994 
995 void
SetFlatButtonPressedRolloverTextColor(const Color & rColor)996 StyleSettings::SetFlatButtonPressedRolloverTextColor( const Color& rColor )
997 {
998     CopyData();
999     mxData->maFlatButtonPressedRolloverTextColor = rColor;
1000 }
1001 
1002 const Color&
GetFlatButtonPressedRolloverTextColor() const1003 StyleSettings::GetFlatButtonPressedRolloverTextColor() const
1004 {
1005     return mxData->maFlatButtonPressedRolloverTextColor;
1006 }
1007 
1008 void
SetRadioCheckTextColor(const Color & rColor)1009 StyleSettings::SetRadioCheckTextColor( const Color& rColor )
1010 {
1011     CopyData();
1012     mxData->maRadioCheckTextColor = rColor;
1013 }
1014 
1015 const Color&
GetRadioCheckTextColor() const1016 StyleSettings::GetRadioCheckTextColor() const
1017 {
1018     return mxData->maRadioCheckTextColor;
1019 }
1020 
1021 void
SetGroupTextColor(const Color & rColor)1022 StyleSettings::SetGroupTextColor( const Color& rColor )
1023 {
1024     CopyData();
1025     mxData->maGroupTextColor = rColor;
1026 }
1027 
1028 const Color&
GetGroupTextColor() const1029 StyleSettings::GetGroupTextColor() const
1030 {
1031     return mxData->maGroupTextColor;
1032 }
1033 
1034 void
SetLabelTextColor(const Color & rColor)1035 StyleSettings::SetLabelTextColor( const Color& rColor )
1036 {
1037     CopyData();
1038     mxData->maLabelTextColor = rColor;
1039 }
1040 
1041 const Color&
GetLabelTextColor() const1042 StyleSettings::GetLabelTextColor() const
1043 {
1044     return mxData->maLabelTextColor;
1045 }
1046 
1047 void
SetWindowColor(const Color & rColor)1048 StyleSettings::SetWindowColor( const Color& rColor )
1049 {
1050     CopyData();
1051     mxData->maWindowColor = rColor;
1052 }
1053 
1054 const Color&
GetWindowColor() const1055 StyleSettings::GetWindowColor() const
1056 {
1057     return mxData->maWindowColor;
1058 }
1059 
1060 void
SetWindowTextColor(const Color & rColor)1061 StyleSettings::SetWindowTextColor( const Color& rColor )
1062 {
1063     CopyData();
1064     mxData->maWindowTextColor = rColor;
1065 }
1066 
1067 const Color&
GetWindowTextColor() const1068 StyleSettings::GetWindowTextColor() const
1069 {
1070     return mxData->maWindowTextColor;
1071 }
1072 
1073 void
SetDialogColor(const Color & rColor)1074 StyleSettings::SetDialogColor( const Color& rColor )
1075 {
1076     CopyData();
1077     mxData->maDialogColor = rColor;
1078 }
1079 
1080 const Color&
GetDialogColor() const1081 StyleSettings::GetDialogColor() const
1082 {
1083     return mxData->maDialogColor;
1084 }
1085 
1086 void
SetDialogTextColor(const Color & rColor)1087 StyleSettings::SetDialogTextColor( const Color& rColor )
1088 {
1089     CopyData();
1090     mxData->maDialogTextColor = rColor;
1091 }
1092 
1093 const Color&
GetDialogTextColor() const1094 StyleSettings::GetDialogTextColor() const
1095 {
1096     return mxData->maDialogTextColor;
1097 }
1098 
1099 void
SetWorkspaceColor(const Color & rColor)1100 StyleSettings::SetWorkspaceColor( const Color& rColor )
1101 {
1102     CopyData();
1103     mxData->maWorkspaceColor = rColor;
1104 }
1105 
1106 const Color&
GetWorkspaceColor() const1107 StyleSettings::GetWorkspaceColor() const
1108 {
1109     return mxData->maWorkspaceColor;
1110 }
1111 
1112 void
SetFieldColor(const Color & rColor)1113 StyleSettings::SetFieldColor( const Color& rColor )
1114 {
1115     CopyData();
1116     mxData->maFieldColor = rColor;
1117 }
1118 
1119 const Color&
GetFieldColor() const1120 StyleSettings::GetFieldColor() const
1121 {
1122     return mxData->maFieldColor;
1123 }
1124 
1125 void
SetFieldTextColor(const Color & rColor)1126 StyleSettings::SetFieldTextColor( const Color& rColor )
1127 {
1128     CopyData();
1129     mxData->maFieldTextColor = rColor;
1130 }
1131 
1132 const Color&
GetFieldTextColor() const1133 StyleSettings::GetFieldTextColor() const
1134 {
1135     return mxData->maFieldTextColor;
1136 }
1137 
1138 void
SetFieldRolloverTextColor(const Color & rColor)1139 StyleSettings::SetFieldRolloverTextColor( const Color& rColor )
1140 {
1141     CopyData();
1142     mxData->maFieldRolloverTextColor = rColor;
1143 }
1144 
1145 const Color&
GetFieldRolloverTextColor() const1146 StyleSettings::GetFieldRolloverTextColor() const
1147 {
1148     return mxData->maFieldRolloverTextColor;
1149 }
1150 
1151 void
SetActiveColor(const Color & rColor)1152 StyleSettings::SetActiveColor( const Color& rColor )
1153 {
1154     CopyData();
1155     mxData->maActiveColor = rColor;
1156 }
1157 
1158 const Color&
GetActiveColor() const1159 StyleSettings::GetActiveColor() const
1160 {
1161     return mxData->maActiveColor;
1162 }
1163 
1164 void
SetActiveTextColor(const Color & rColor)1165 StyleSettings::SetActiveTextColor( const Color& rColor )
1166 {
1167     CopyData();
1168     mxData->maActiveTextColor = rColor;
1169 }
1170 
1171 const Color&
GetActiveTextColor() const1172 StyleSettings::GetActiveTextColor() const
1173 {
1174     return mxData->maActiveTextColor;
1175 }
1176 
1177 void
SetActiveBorderColor(const Color & rColor)1178 StyleSettings::SetActiveBorderColor( const Color& rColor )
1179 {
1180     CopyData();
1181     mxData->maActiveBorderColor = rColor;
1182 }
1183 
1184 const Color&
GetActiveBorderColor() const1185 StyleSettings::GetActiveBorderColor() const
1186 {
1187     return mxData->maActiveBorderColor;
1188 }
1189 
1190 void
SetDeactiveColor(const Color & rColor)1191 StyleSettings::SetDeactiveColor( const Color& rColor )
1192 {
1193     CopyData();
1194     mxData->maDeactiveColor = rColor;
1195 }
1196 
1197 const Color&
GetDeactiveColor() const1198 StyleSettings::GetDeactiveColor() const
1199 {
1200     return mxData->maDeactiveColor;
1201 }
1202 
1203 void
SetDeactiveTextColor(const Color & rColor)1204 StyleSettings::SetDeactiveTextColor( const Color& rColor )
1205 {
1206     CopyData();
1207     mxData->maDeactiveTextColor = rColor;
1208 }
1209 
1210 const Color&
GetDeactiveTextColor() const1211 StyleSettings::GetDeactiveTextColor() const
1212 {
1213     return mxData->maDeactiveTextColor;
1214 }
1215 
1216 void
SetDeactiveBorderColor(const Color & rColor)1217 StyleSettings::SetDeactiveBorderColor( const Color& rColor )
1218 {
1219     CopyData();
1220     mxData->maDeactiveBorderColor = rColor;
1221 }
1222 
1223 const Color&
GetDeactiveBorderColor() const1224 StyleSettings::GetDeactiveBorderColor() const
1225 {
1226     return mxData->maDeactiveBorderColor;
1227 }
1228 
1229 void
SetHighlightColor(const Color & rColor)1230 StyleSettings::SetHighlightColor( const Color& rColor )
1231 {
1232     CopyData();
1233     mxData->maHighlightColor = rColor;
1234 }
1235 
1236 const Color&
GetHighlightColor() const1237 StyleSettings::GetHighlightColor() const
1238 {
1239     return mxData->maHighlightColor;
1240 }
1241 
1242 void
SetHighlightTextColor(const Color & rColor)1243 StyleSettings::SetHighlightTextColor( const Color& rColor )
1244 {
1245     CopyData();
1246     mxData->maHighlightTextColor = rColor;
1247 }
1248 
1249 const Color&
GetHighlightTextColor() const1250 StyleSettings::GetHighlightTextColor() const
1251 {
1252     return mxData->maHighlightTextColor;
1253 }
1254 
1255 void
SetDisableColor(const Color & rColor)1256 StyleSettings::SetDisableColor( const Color& rColor )
1257 {
1258     CopyData();
1259     mxData->maDisableColor = rColor;
1260 }
1261 
1262 const Color&
GetDisableColor() const1263 StyleSettings::GetDisableColor() const
1264 {
1265     return mxData->maDisableColor;
1266 }
1267 
1268 void
SetHelpColor(const Color & rColor)1269 StyleSettings::SetHelpColor( const Color& rColor )
1270 {
1271     CopyData();
1272     mxData->maHelpColor = rColor;
1273 }
1274 
1275 const Color&
GetHelpColor() const1276 StyleSettings::GetHelpColor() const
1277 {
1278     return mxData->maHelpColor;
1279 }
1280 
1281 void
SetHelpTextColor(const Color & rColor)1282 StyleSettings::SetHelpTextColor( const Color& rColor )
1283 {
1284     CopyData();
1285     mxData->maHelpTextColor = rColor;
1286 }
1287 
1288 const Color&
GetHelpTextColor() const1289 StyleSettings::GetHelpTextColor() const
1290 {
1291     return mxData->maHelpTextColor;
1292 }
1293 
1294 void
SetMenuColor(const Color & rColor)1295 StyleSettings::SetMenuColor( const Color& rColor )
1296 {
1297     CopyData();
1298     mxData->maMenuColor = rColor;
1299 }
1300 
1301 const Color&
GetMenuColor() const1302 StyleSettings::GetMenuColor() const
1303 {
1304     return mxData->maMenuColor;
1305 }
1306 
1307 void
SetMenuBarColor(const Color & rColor)1308 StyleSettings::SetMenuBarColor( const Color& rColor )
1309 {
1310     CopyData();
1311     mxData->maMenuBarColor = rColor;
1312 }
1313 
1314 const Color&
GetMenuBarColor() const1315 StyleSettings::GetMenuBarColor() const
1316 {
1317     return mxData->maMenuBarColor;
1318 }
1319 
1320 void
SetMenuBarRolloverColor(const Color & rColor)1321 StyleSettings::SetMenuBarRolloverColor( const Color& rColor )
1322 {
1323     CopyData();
1324     mxData->maMenuBarRolloverColor = rColor;
1325 }
1326 
1327 const Color&
GetMenuBarRolloverColor() const1328 StyleSettings::GetMenuBarRolloverColor() const
1329 {
1330     return mxData->maMenuBarRolloverColor;
1331 }
1332 
1333 void
SetMenuBorderColor(const Color & rColor)1334 StyleSettings::SetMenuBorderColor( const Color& rColor )
1335 {
1336     CopyData();
1337     mxData->maMenuBorderColor = rColor;
1338 }
1339 
1340 const Color&
GetMenuBorderColor() const1341 StyleSettings::GetMenuBorderColor() const
1342 {
1343     return mxData->maMenuBorderColor;
1344 }
1345 
1346 void
SetMenuTextColor(const Color & rColor)1347 StyleSettings::SetMenuTextColor( const Color& rColor )
1348 {
1349     CopyData();
1350     mxData->maMenuTextColor = rColor;
1351 }
1352 
1353 const Color&
GetMenuTextColor() const1354 StyleSettings::GetMenuTextColor() const
1355 {
1356     return mxData->maMenuTextColor;
1357 }
1358 
1359 void
SetMenuBarTextColor(const Color & rColor)1360 StyleSettings::SetMenuBarTextColor( const Color& rColor )
1361 {
1362     CopyData();
1363     mxData->maMenuBarTextColor = rColor;
1364 }
1365 
1366 const Color&
GetMenuBarTextColor() const1367 StyleSettings::GetMenuBarTextColor() const
1368 {
1369     return mxData->maMenuBarTextColor;
1370 }
1371 
1372 void
SetMenuBarRolloverTextColor(const Color & rColor)1373 StyleSettings::SetMenuBarRolloverTextColor( const Color& rColor )
1374 {
1375     CopyData();
1376     mxData->maMenuBarRolloverTextColor = rColor;
1377 }
1378 
1379 const Color&
GetMenuBarRolloverTextColor() const1380 StyleSettings::GetMenuBarRolloverTextColor() const
1381 {
1382     return mxData->maMenuBarRolloverTextColor;
1383 }
1384 
1385 void
SetMenuBarHighlightTextColor(const Color & rColor)1386 StyleSettings::SetMenuBarHighlightTextColor( const Color& rColor )
1387 {
1388     CopyData();
1389     mxData->maMenuBarHighlightTextColor = rColor;
1390 }
1391 
1392 const Color&
GetMenuBarHighlightTextColor() const1393 StyleSettings::GetMenuBarHighlightTextColor() const
1394 {
1395     return mxData->maMenuBarHighlightTextColor;
1396 }
1397 
1398 void
SetMenuHighlightColor(const Color & rColor)1399 StyleSettings::SetMenuHighlightColor( const Color& rColor )
1400 {
1401     CopyData();
1402     mxData->maMenuHighlightColor = rColor;
1403 }
1404 
1405 const Color&
GetMenuHighlightColor() const1406 StyleSettings::GetMenuHighlightColor() const
1407 {
1408     return mxData->maMenuHighlightColor;
1409 }
1410 
1411 void
SetMenuHighlightTextColor(const Color & rColor)1412 StyleSettings::SetMenuHighlightTextColor( const Color& rColor )
1413 {
1414     CopyData();
1415     mxData->maMenuHighlightTextColor = rColor;
1416 }
1417 
1418 const Color&
GetMenuHighlightTextColor() const1419 StyleSettings::GetMenuHighlightTextColor() const
1420 {
1421     return mxData->maMenuHighlightTextColor;
1422 }
1423 
1424 void
SetTabTextColor(const Color & rColor)1425 StyleSettings::SetTabTextColor( const Color& rColor )
1426 {
1427     CopyData();
1428     mxData->maTabTextColor = rColor;
1429 }
1430 
1431 const Color&
GetTabTextColor() const1432 StyleSettings::GetTabTextColor() const
1433 {
1434     return mxData->maTabTextColor;
1435 }
1436 
1437 void
SetTabRolloverTextColor(const Color & rColor)1438 StyleSettings::SetTabRolloverTextColor( const Color& rColor )
1439 {
1440     CopyData();
1441     mxData->maTabRolloverTextColor = rColor;
1442 }
1443 
1444 const Color&
GetTabRolloverTextColor() const1445 StyleSettings::GetTabRolloverTextColor() const
1446 {
1447     return mxData->maTabRolloverTextColor;
1448 }
1449 
1450 void
SetTabHighlightTextColor(const Color & rColor)1451 StyleSettings::SetTabHighlightTextColor( const Color& rColor )
1452 {
1453     CopyData();
1454     mxData->maTabHighlightTextColor = rColor;
1455 }
1456 
1457 const Color&
GetTabHighlightTextColor() const1458 StyleSettings::GetTabHighlightTextColor() const
1459 {
1460     return mxData->maTabHighlightTextColor;
1461 }
1462 
1463 void
SetLinkColor(const Color & rColor)1464 StyleSettings::SetLinkColor( const Color& rColor )
1465 {
1466     CopyData();
1467     mxData->maLinkColor = rColor;
1468 }
1469 
1470 const Color&
GetLinkColor() const1471 StyleSettings::GetLinkColor() const
1472 {
1473     return mxData->maLinkColor;
1474 }
1475 
1476 void
SetVisitedLinkColor(const Color & rColor)1477 StyleSettings::SetVisitedLinkColor( const Color& rColor )
1478 {
1479     CopyData();
1480     mxData->maVisitedLinkColor = rColor;
1481 }
1482 
1483 const Color&
GetVisitedLinkColor() const1484 StyleSettings::GetVisitedLinkColor() const
1485 {
1486     return mxData->maVisitedLinkColor;
1487 }
1488 
1489 void
SetToolTextColor(const Color & rColor)1490 StyleSettings::SetToolTextColor( const Color& rColor )
1491 {
1492     CopyData();
1493     mxData->maToolTextColor = rColor;
1494 }
1495 
1496 const Color&
GetToolTextColor() const1497 StyleSettings::GetToolTextColor() const
1498 {
1499     return mxData->maToolTextColor;
1500 }
1501 
1502 void
SetMonoColor(const Color & rColor)1503 StyleSettings::SetMonoColor( const Color& rColor )
1504 {
1505     CopyData();
1506     mxData->maMonoColor = rColor;
1507 }
1508 
1509 const Color&
GetMonoColor() const1510 StyleSettings::GetMonoColor() const
1511 {
1512     return mxData->maMonoColor;
1513 }
1514 
1515 void
SetActiveTabColor(const Color & rColor)1516 StyleSettings::SetActiveTabColor( const Color& rColor )
1517 {
1518     CopyData();
1519     mxData->maActiveTabColor = rColor;
1520 }
1521 
1522 const Color&
GetActiveTabColor() const1523 StyleSettings::GetActiveTabColor() const
1524 {
1525     return mxData->maActiveTabColor;
1526 }
1527 
1528 void
SetInactiveTabColor(const Color & rColor)1529 StyleSettings::SetInactiveTabColor( const Color& rColor )
1530 {
1531     CopyData();
1532     mxData->maInactiveTabColor = rColor;
1533 }
1534 
1535 const Color&
GetInactiveTabColor() const1536 StyleSettings::GetInactiveTabColor() const
1537 {
1538     return mxData->maInactiveTabColor;
1539 }
1540 
SetAlternatingRowColor(const Color & rColor)1541 void StyleSettings::SetAlternatingRowColor(const Color& rColor)
1542 {
1543     CopyData();
1544     mxData->maAlternatingRowColor = rColor;
1545 }
1546 
1547 const Color&
GetAlternatingRowColor() const1548 StyleSettings::GetAlternatingRowColor() const
1549 {
1550     return mxData->maAlternatingRowColor;
1551 }
1552 
1553 void
SetUseSystemUIFonts(bool bUseSystemUIFonts)1554 StyleSettings::SetUseSystemUIFonts( bool bUseSystemUIFonts )
1555 {
1556     CopyData();
1557     mxData->mbUseSystemUIFonts = bUseSystemUIFonts;
1558 }
1559 
1560 bool
GetUseSystemUIFonts() const1561 StyleSettings::GetUseSystemUIFonts() const
1562 {
1563     return mxData->mbUseSystemUIFonts;
1564 }
1565 
SetUseFontAAFromSystem(bool bUseFontAAFromSystem)1566 void StyleSettings::SetUseFontAAFromSystem(bool bUseFontAAFromSystem)
1567 {
1568     CopyData();
1569     mxData->mbUseFontAAFromSystem = bUseFontAAFromSystem;
1570 }
1571 
GetUseFontAAFromSystem() const1572 bool StyleSettings::GetUseFontAAFromSystem() const
1573 {
1574     return mxData->mbUseFontAAFromSystem;
1575 }
1576 
1577 void
SetUseFlatBorders(bool bUseFlatBorders)1578 StyleSettings::SetUseFlatBorders( bool bUseFlatBorders )
1579 {
1580     CopyData();
1581     mxData->mnUseFlatBorders = bUseFlatBorders;
1582 }
1583 
1584 bool
GetUseFlatBorders() const1585 StyleSettings::GetUseFlatBorders() const
1586 {
1587     return mxData->mnUseFlatBorders;
1588 }
1589 
1590 void
SetUseFlatMenus(bool bUseFlatMenus)1591 StyleSettings::SetUseFlatMenus( bool bUseFlatMenus )
1592 {
1593     CopyData();
1594     mxData->mnUseFlatMenus = bUseFlatMenus;
1595 }
1596 
1597 bool
GetUseFlatMenus() const1598 StyleSettings::GetUseFlatMenus() const
1599 {
1600     return mxData->mnUseFlatMenus;
1601 }
1602 
1603 void
SetUseImagesInMenus(TriState eUseImagesInMenus)1604 StyleSettings::SetUseImagesInMenus( TriState eUseImagesInMenus )
1605 {
1606     CopyData();
1607     mxData->meUseImagesInMenus = eUseImagesInMenus;
1608 }
1609 
1610 void
SetPreferredUseImagesInMenus(bool bPreferredUseImagesInMenus)1611 StyleSettings::SetPreferredUseImagesInMenus( bool bPreferredUseImagesInMenus )
1612 {
1613     CopyData();
1614     mxData->mbPreferredUseImagesInMenus = bPreferredUseImagesInMenus;
1615 }
1616 
1617 bool
GetPreferredUseImagesInMenus() const1618 StyleSettings::GetPreferredUseImagesInMenus() const
1619 {
1620     return mxData->mbPreferredUseImagesInMenus;
1621 }
1622 
1623 void
SetSkipDisabledInMenus(bool bSkipDisabledInMenus)1624 StyleSettings::SetSkipDisabledInMenus( bool bSkipDisabledInMenus )
1625 {
1626     CopyData();
1627     mxData->mbSkipDisabledInMenus = bSkipDisabledInMenus;
1628 }
1629 
1630 bool
GetSkipDisabledInMenus() const1631 StyleSettings::GetSkipDisabledInMenus() const
1632 {
1633     return mxData->mbSkipDisabledInMenus;
1634 }
1635 
1636 void
SetHideDisabledMenuItems(bool bHideDisabledMenuItems)1637 StyleSettings::SetHideDisabledMenuItems( bool bHideDisabledMenuItems )
1638 {
1639     CopyData();
1640     mxData->mbHideDisabledMenuItems = bHideDisabledMenuItems;
1641 }
1642 
1643 bool
GetHideDisabledMenuItems() const1644 StyleSettings::GetHideDisabledMenuItems() const
1645 {
1646     return mxData->mbHideDisabledMenuItems;
1647 }
1648 
1649 void
SetContextMenuShortcuts(TriState eContextMenuShortcuts)1650 StyleSettings::SetContextMenuShortcuts( TriState eContextMenuShortcuts )
1651 {
1652     CopyData();
1653     mxData->meContextMenuShortcuts = eContextMenuShortcuts;
1654 }
1655 
1656 bool
GetContextMenuShortcuts() const1657 StyleSettings::GetContextMenuShortcuts() const
1658 {
1659     switch (mxData->meContextMenuShortcuts)
1660     {
1661     case TRISTATE_FALSE:
1662         return false;
1663     case TRISTATE_TRUE:
1664         return true;
1665     default: // TRISTATE_INDET:
1666         return GetPreferredContextMenuShortcuts();
1667     }
1668 }
1669 
1670 void
SetPreferredContextMenuShortcuts(bool bContextMenuShortcuts)1671 StyleSettings::SetPreferredContextMenuShortcuts( bool bContextMenuShortcuts )
1672 {
1673     CopyData();
1674     mxData->mbPreferredContextMenuShortcuts = bContextMenuShortcuts;
1675 }
1676 
1677 bool
GetPreferredContextMenuShortcuts() const1678 StyleSettings::GetPreferredContextMenuShortcuts() const
1679 {
1680     return mxData->mbPreferredContextMenuShortcuts;
1681 }
1682 
1683 void
SetPrimaryButtonWarpsSlider(bool bPrimaryButtonWarpsSlider)1684 StyleSettings::SetPrimaryButtonWarpsSlider( bool bPrimaryButtonWarpsSlider )
1685 {
1686     CopyData();
1687     mxData->mbPrimaryButtonWarpsSlider = bPrimaryButtonWarpsSlider;
1688 }
1689 
1690 bool
GetPrimaryButtonWarpsSlider() const1691 StyleSettings::GetPrimaryButtonWarpsSlider() const
1692 {
1693     return mxData->mbPrimaryButtonWarpsSlider;
1694 }
1695 
1696 void
SetAppFont(const vcl::Font & rFont)1697 StyleSettings::SetAppFont( const vcl::Font& rFont )
1698 {
1699     CopyData();
1700     mxData->maAppFont = rFont;
1701 }
1702 
1703 const vcl::Font&
GetAppFont() const1704 StyleSettings::GetAppFont() const
1705 {
1706     return mxData->maAppFont;
1707 }
1708 
1709 void
SetHelpFont(const vcl::Font & rFont)1710 StyleSettings::SetHelpFont( const vcl::Font& rFont )
1711 {
1712     CopyData();
1713     mxData->maHelpFont = rFont;
1714 }
1715 
1716 const vcl::Font&
GetHelpFont() const1717 StyleSettings::GetHelpFont() const
1718 {
1719     return mxData->maHelpFont;
1720 }
1721 
1722 void
SetTitleFont(const vcl::Font & rFont)1723 StyleSettings::SetTitleFont( const vcl::Font& rFont )
1724 {
1725     CopyData();
1726     mxData->maTitleFont = rFont;
1727 }
1728 
1729 const vcl::Font&
GetTitleFont() const1730 StyleSettings::GetTitleFont() const
1731 {
1732     return mxData->maTitleFont;
1733 }
1734 
1735 void
SetFloatTitleFont(const vcl::Font & rFont)1736 StyleSettings::SetFloatTitleFont( const vcl::Font& rFont )
1737 {
1738     CopyData();
1739     mxData->maFloatTitleFont = rFont;
1740 }
1741 
1742 const vcl::Font&
GetFloatTitleFont() const1743 StyleSettings::GetFloatTitleFont() const
1744 {
1745     return mxData->maFloatTitleFont;
1746 }
1747 
1748 void
SetMenuFont(const vcl::Font & rFont)1749 StyleSettings::SetMenuFont( const vcl::Font& rFont )
1750 {
1751     CopyData();
1752     mxData->maMenuFont = rFont;
1753 }
1754 
1755 const vcl::Font&
GetMenuFont() const1756 StyleSettings::GetMenuFont() const
1757 {
1758     return mxData->maMenuFont;
1759 }
1760 
1761 void
SetToolFont(const vcl::Font & rFont)1762 StyleSettings::SetToolFont( const vcl::Font& rFont )
1763 {
1764     CopyData();
1765     mxData->maToolFont = rFont;
1766 }
1767 
1768 const vcl::Font&
GetToolFont() const1769 StyleSettings::GetToolFont() const
1770 {
1771     return mxData->maToolFont;
1772 }
1773 
1774 void
SetGroupFont(const vcl::Font & rFont)1775 StyleSettings::SetGroupFont( const vcl::Font& rFont )
1776 {
1777     CopyData();
1778     mxData->maGroupFont = rFont;
1779 }
1780 
1781 const vcl::Font&
GetGroupFont() const1782 StyleSettings::GetGroupFont() const
1783 {
1784     return mxData->maGroupFont;
1785 }
1786 
1787 void
SetLabelFont(const vcl::Font & rFont)1788 StyleSettings::SetLabelFont( const vcl::Font& rFont )
1789 {
1790     CopyData();
1791     mxData->maLabelFont = rFont;
1792 }
1793 
1794 const vcl::Font&
GetLabelFont() const1795 StyleSettings::GetLabelFont() const
1796 {
1797     return mxData->maLabelFont;
1798 }
1799 
1800 void
SetRadioCheckFont(const vcl::Font & rFont)1801 StyleSettings::SetRadioCheckFont( const vcl::Font& rFont )
1802 {
1803     CopyData();
1804     mxData->maRadioCheckFont = rFont;
1805 }
1806 
1807 const vcl::Font&
GetRadioCheckFont() const1808 StyleSettings::GetRadioCheckFont() const
1809 {
1810     return mxData->maRadioCheckFont;
1811 }
1812 
1813 void
SetPushButtonFont(const vcl::Font & rFont)1814 StyleSettings::SetPushButtonFont( const vcl::Font& rFont )
1815 {
1816     CopyData();
1817     mxData->maPushButtonFont = rFont;
1818 }
1819 
1820 const vcl::Font&
GetPushButtonFont() const1821 StyleSettings::GetPushButtonFont() const
1822 {
1823     return mxData->maPushButtonFont;
1824 }
1825 
1826 void
SetFieldFont(const vcl::Font & rFont)1827 StyleSettings::SetFieldFont( const vcl::Font& rFont )
1828 {
1829     CopyData();
1830     mxData->maFieldFont = rFont;
1831 }
1832 
1833 const vcl::Font&
GetFieldFont() const1834 StyleSettings::GetFieldFont() const
1835 {
1836     return mxData->maFieldFont;
1837 }
1838 
1839 void
SetIconFont(const vcl::Font & rFont)1840 StyleSettings::SetIconFont( const vcl::Font& rFont )
1841 {
1842     CopyData();
1843     mxData->maIconFont = rFont;
1844 }
1845 
1846 const vcl::Font&
GetIconFont() const1847 StyleSettings::GetIconFont() const
1848 {
1849     return mxData->maIconFont;
1850 }
1851 
1852 void
SetTabFont(const vcl::Font & rFont)1853 StyleSettings::SetTabFont( const vcl::Font& rFont )
1854 {
1855     CopyData();
1856     mxData->maTabFont = rFont;
1857 }
1858 
1859 const vcl::Font&
GetTabFont() const1860 StyleSettings::GetTabFont() const
1861 {
1862     return mxData->maTabFont;
1863 }
1864 
1865 sal_Int32
GetBorderSize()1866 StyleSettings::GetBorderSize()
1867 {
1868     return 1;
1869 }
1870 
1871 void
SetTitleHeight(sal_Int32 nSize)1872 StyleSettings::SetTitleHeight( sal_Int32 nSize )
1873 {
1874     CopyData();
1875     mxData->mnTitleHeight = nSize;
1876 }
1877 
1878 sal_Int32
GetTitleHeight() const1879 StyleSettings::GetTitleHeight() const
1880 {
1881     return mxData->mnTitleHeight;
1882 }
1883 
1884 void
SetFloatTitleHeight(sal_Int32 nSize)1885 StyleSettings::SetFloatTitleHeight( sal_Int32 nSize )
1886 {
1887     CopyData();
1888     mxData->mnFloatTitleHeight = nSize;
1889 }
1890 
1891 sal_Int32
GetFloatTitleHeight() const1892 StyleSettings::GetFloatTitleHeight() const
1893 {
1894     return mxData->mnFloatTitleHeight;
1895 }
1896 
1897 void
SetScrollBarSize(sal_Int32 nSize)1898 StyleSettings::SetScrollBarSize( sal_Int32 nSize )
1899 {
1900     CopyData();
1901     mxData->mnScrollBarSize = nSize;
1902 }
1903 
1904 sal_Int32
GetScrollBarSize() const1905 StyleSettings::GetScrollBarSize() const
1906 {
1907     return mxData->mnScrollBarSize;
1908 }
1909 
1910 void
SetMinThumbSize(sal_Int32 nSize)1911 StyleSettings::SetMinThumbSize( sal_Int32 nSize )
1912 {
1913     CopyData();
1914     mxData->mnMinThumbSize = nSize;
1915 }
1916 
1917 sal_Int32
GetMinThumbSize() const1918 StyleSettings::GetMinThumbSize() const
1919 {
1920     return mxData->mnMinThumbSize;
1921 }
1922 
1923 void
SetSpinSize(sal_Int32 nSize)1924 StyleSettings::SetSpinSize( sal_Int32 nSize )
1925 {
1926     CopyData();
1927     mxData->mnSpinSize = nSize;
1928 }
1929 
1930 sal_Int32
GetSpinSize() const1931 StyleSettings::GetSpinSize() const
1932 {
1933     return mxData->mnSpinSize;
1934 }
1935 
1936 sal_Int32
GetSplitSize()1937 StyleSettings::GetSplitSize()
1938 {
1939     return 3;
1940 }
1941 
1942 void
SetCursorSize(sal_Int32 nSize)1943 StyleSettings::SetCursorSize( sal_Int32 nSize )
1944 {
1945     CopyData();
1946     mxData->mnCursorSize = nSize;
1947 }
1948 
1949 sal_Int32
GetCursorSize() const1950 StyleSettings::GetCursorSize() const
1951 {
1952     return mxData->mnCursorSize;
1953 }
1954 
1955 void
SetCursorBlinkTime(sal_uInt64 nBlinkTime)1956 StyleSettings::SetCursorBlinkTime( sal_uInt64 nBlinkTime )
1957 {
1958     CopyData();
1959     mxData->mnCursorBlinkTime = nBlinkTime;
1960 }
1961 
1962 sal_uInt64
GetCursorBlinkTime() const1963 StyleSettings::GetCursorBlinkTime() const
1964 {
1965     return mxData->mnCursorBlinkTime;
1966 }
1967 
1968 void
SetDragFullOptions(DragFullOptions nOptions)1969 StyleSettings::SetDragFullOptions( DragFullOptions nOptions )
1970 {
1971     CopyData();
1972     mxData->mnDragFullOptions = nOptions;
1973 }
1974 
1975 DragFullOptions
GetDragFullOptions() const1976 StyleSettings::GetDragFullOptions() const
1977 {
1978     return mxData->mnDragFullOptions;
1979 }
1980 
1981 void
SetSelectionOptions(SelectionOptions nOptions)1982 StyleSettings::SetSelectionOptions( SelectionOptions nOptions )
1983 {
1984     CopyData();
1985     mxData->mnSelectionOptions = nOptions;
1986 }
1987 
1988 SelectionOptions
GetSelectionOptions() const1989 StyleSettings::GetSelectionOptions() const
1990 {
1991     return mxData->mnSelectionOptions;
1992 }
1993 
1994 void
SetDisplayOptions(DisplayOptions nOptions)1995 StyleSettings::SetDisplayOptions( DisplayOptions nOptions )
1996 {
1997     CopyData();
1998     mxData->mnDisplayOptions = nOptions;
1999 }
2000 
2001 DisplayOptions
GetDisplayOptions() const2002 StyleSettings::GetDisplayOptions() const
2003 {
2004     return mxData->mnDisplayOptions;
2005 }
2006 
2007 void
SetAntialiasingMinPixelHeight(sal_Int32 nMinPixel)2008 StyleSettings::SetAntialiasingMinPixelHeight( sal_Int32 nMinPixel )
2009 {
2010     CopyData();
2011     mxData->mnAntialiasedMin = nMinPixel;
2012 }
2013 
2014 sal_Int32
GetAntialiasingMinPixelHeight() const2015 StyleSettings::GetAntialiasingMinPixelHeight() const
2016 {
2017     return mxData->mnAntialiasedMin;
2018 }
2019 
2020 void
SetOptions(StyleSettingsOptions nOptions)2021 StyleSettings::SetOptions( StyleSettingsOptions nOptions )
2022 {
2023     CopyData();
2024     mxData->mnOptions = nOptions;
2025 }
2026 
2027 void
SetAutoMnemonic(bool bAutoMnemonic)2028 StyleSettings::SetAutoMnemonic( bool bAutoMnemonic )
2029 {
2030     CopyData();
2031     mxData->mbAutoMnemonic = bAutoMnemonic;
2032 }
2033 
2034 bool
GetAutoMnemonic() const2035 StyleSettings::GetAutoMnemonic() const
2036 {
2037     return mxData->mbAutoMnemonic;
2038 }
2039 
2040 bool
GetDockingFloatsSupported()2041 StyleSettings::GetDockingFloatsSupported()
2042 {
2043     ImplSVData* pSVData = ImplGetSVData();
2044     return pSVData->maNWFData.mbCanDetermineWindowPosition;
2045 }
2046 
2047 void
SetFontColor(const Color & rColor)2048 StyleSettings::SetFontColor( const Color& rColor )
2049 {
2050     CopyData();
2051     mxData->maFontColor = rColor;
2052 }
2053 
2054 const Color&
GetFontColor() const2055 StyleSettings::GetFontColor() const
2056 {
2057     return mxData->maFontColor;
2058 }
2059 
2060 void
SetToolbarIconSize(ToolbarIconSize nSize)2061 StyleSettings::SetToolbarIconSize( ToolbarIconSize nSize )
2062 {
2063     CopyData();
2064     mxData->mnToolbarIconSize = nSize;
2065 }
2066 
2067 ToolbarIconSize
GetToolbarIconSize() const2068 StyleSettings::GetToolbarIconSize() const
2069 {
2070     return mxData->mnToolbarIconSize;
2071 }
2072 
GetToolbarIconSizePixel() const2073 Size StyleSettings::GetToolbarIconSizePixel() const
2074 {
2075     switch (GetToolbarIconSize())
2076     {
2077         case ToolbarIconSize::Large:
2078             return Size(24, 24);
2079         case ToolbarIconSize::Size32:
2080             return Size(32, 32);
2081         case ToolbarIconSize::Small:
2082         default:
2083             return Size(16, 16);
2084     }
2085 }
2086 
2087 const DialogStyle&
GetDialogStyle() const2088 StyleSettings::GetDialogStyle() const
2089 {
2090     return mxData->maDialogStyle;
2091 }
2092 
2093 void
SetEdgeBlending(sal_uInt16 nCount)2094 StyleSettings::SetEdgeBlending(sal_uInt16 nCount)
2095 {
2096     CopyData();
2097     mxData->mnEdgeBlending = nCount;
2098 }
2099 
2100 sal_uInt16
GetEdgeBlending() const2101 StyleSettings::GetEdgeBlending() const
2102 {
2103     return mxData->mnEdgeBlending;
2104 }
2105 
2106 const Color&
GetEdgeBlendingTopLeftColor() const2107 StyleSettings::GetEdgeBlendingTopLeftColor() const
2108 {
2109     return mxData->maEdgeBlendingTopLeftColor;
2110 }
2111 
2112 const Color&
GetEdgeBlendingBottomRightColor() const2113 StyleSettings::GetEdgeBlendingBottomRightColor() const
2114 {
2115     return mxData->maEdgeBlendingBottomRightColor;
2116 }
2117 
2118 void
SetListBoxMaximumLineCount(sal_uInt16 nCount)2119 StyleSettings::SetListBoxMaximumLineCount(sal_uInt16 nCount)
2120 {
2121     CopyData();
2122     mxData->mnListBoxMaximumLineCount = nCount;
2123 }
2124 
2125 sal_uInt16
GetListBoxMaximumLineCount() const2126 StyleSettings::GetListBoxMaximumLineCount() const
2127 {
2128     return mxData->mnListBoxMaximumLineCount;
2129 }
2130 
2131 void
SetColorValueSetColumnCount(sal_uInt16 nCount)2132 StyleSettings::SetColorValueSetColumnCount(sal_uInt16 nCount)
2133 {
2134     CopyData();
2135     mxData->mnColorValueSetColumnCount = nCount;
2136 }
2137 
2138 sal_uInt16
GetColorValueSetColumnCount() const2139 StyleSettings::GetColorValueSetColumnCount() const
2140 {
2141     return mxData->mnColorValueSetColumnCount;
2142 }
2143 
2144 sal_uInt16
GetListBoxPreviewDefaultLineWidth()2145 StyleSettings::GetListBoxPreviewDefaultLineWidth()
2146 {
2147     return 1;
2148 }
2149 
2150 void
SetPreviewUsesCheckeredBackground(bool bNew)2151 StyleSettings::SetPreviewUsesCheckeredBackground(bool bNew)
2152 {
2153     CopyData();
2154     mxData->mbPreviewUsesCheckeredBackground = bNew;
2155 }
2156 
2157 bool
GetPreviewUsesCheckeredBackground() const2158 StyleSettings::GetPreviewUsesCheckeredBackground() const
2159 {
2160     return mxData->mbPreviewUsesCheckeredBackground;
2161 }
2162 
2163 bool
operator !=(const StyleSettings & rSet) const2164 StyleSettings::operator !=( const StyleSettings& rSet ) const
2165 {
2166     return !(*this == rSet);
2167 }
2168 
SetListBoxPreviewDefaultLogicSize(Size const & rSize)2169 void StyleSettings::SetListBoxPreviewDefaultLogicSize(Size const& rSize)
2170 {
2171     mxData->maListBoxPreviewDefaultLogicSize = rSize;
2172 }
2173 
GetListBoxPreviewDefaultPixelSize() const2174 const Size& StyleSettings::GetListBoxPreviewDefaultPixelSize() const
2175 {
2176     if(0 == mxData->maListBoxPreviewDefaultPixelSize.Width() || 0 == mxData->maListBoxPreviewDefaultPixelSize.Height())
2177     {
2178         const_cast< StyleSettings* >(this)->mxData->maListBoxPreviewDefaultPixelSize =
2179             Application::GetDefaultDevice()->LogicToPixel(mxData->maListBoxPreviewDefaultLogicSize, MapMode(MapUnit::MapAppFont));
2180     }
2181 
2182     return mxData->maListBoxPreviewDefaultPixelSize;
2183 }
2184 
Set3DColors(const Color & rColor)2185 void StyleSettings::Set3DColors( const Color& rColor )
2186 {
2187     CopyData();
2188     mxData->maFaceColor         = rColor;
2189     mxData->maLightBorderColor  = rColor;
2190     mxData->maMenuBorderColor   = rColor;
2191     mxData->maDarkShadowColor   = COL_BLACK;
2192     if ( rColor != COL_LIGHTGRAY )
2193     {
2194         mxData->maLightColor    = rColor;
2195         mxData->maShadowColor   = rColor;
2196         mxData->maDarkShadowColor=rColor;
2197         mxData->maLightColor.IncreaseLuminance( 64 );
2198         mxData->maShadowColor.DecreaseLuminance( 64 );
2199         mxData->maDarkShadowColor.DecreaseLuminance( 100 );
2200         sal_uLong   nRed    = mxData->maLightColor.GetRed();
2201         sal_uLong   nGreen  = mxData->maLightColor.GetGreen();
2202         sal_uLong   nBlue   = mxData->maLightColor.GetBlue();
2203         nRed   += static_cast<sal_uLong>(mxData->maShadowColor.GetRed());
2204         nGreen += static_cast<sal_uLong>(mxData->maShadowColor.GetGreen());
2205         nBlue  += static_cast<sal_uLong>(mxData->maShadowColor.GetBlue());
2206         mxData->maCheckedColor = Color( static_cast<sal_uInt8>(nRed/2), static_cast<sal_uInt8>(nGreen/2), static_cast<sal_uInt8>(nBlue/2) );
2207     }
2208     else
2209     {
2210         mxData->maCheckedColor  = Color( 0x99, 0x99, 0x99 );
2211         mxData->maLightColor    = COL_WHITE;
2212         mxData->maShadowColor   = COL_GRAY;
2213     }
2214 }
2215 
SetCheckedColorSpecialCase()2216 void StyleSettings::SetCheckedColorSpecialCase( )
2217 {
2218     CopyData();
2219     // Light gray checked color special case
2220     if ( GetFaceColor() == COL_LIGHTGRAY )
2221         mxData->maCheckedColor = Color( 0xCC, 0xCC, 0xCC );
2222     else
2223     {
2224         sal_uInt8 nRed   = static_cast<sal_uInt8>((static_cast<sal_uInt16>(mxData->maFaceColor.GetRed())   + static_cast<sal_uInt16>(mxData->maLightColor.GetRed()))/2);
2225         sal_uInt8 nGreen = static_cast<sal_uInt8>((static_cast<sal_uInt16>(mxData->maFaceColor.GetGreen()) + static_cast<sal_uInt16>(mxData->maLightColor.GetGreen()))/2);
2226         sal_uInt8 nBlue  = static_cast<sal_uInt8>((static_cast<sal_uInt16>(mxData->maFaceColor.GetBlue())  + static_cast<sal_uInt16>(mxData->maLightColor.GetBlue()))/2);
2227         mxData->maCheckedColor = Color( nRed, nGreen, nBlue );
2228     }
2229 }
2230 
GetUseImagesInMenus() const2231 bool StyleSettings::GetUseImagesInMenus() const
2232 {
2233     // icon mode selected in Tools -> Options... -> OpenOffice.org -> View
2234     switch (mxData->meUseImagesInMenus) {
2235     case TRISTATE_FALSE:
2236         return false;
2237     case TRISTATE_TRUE:
2238         return true;
2239     default: // TRISTATE_INDET:
2240         return GetPreferredUseImagesInMenus();
2241     }
2242 }
2243 
readBitmapEx(const OUString & rPath)2244 static BitmapEx readBitmapEx( const OUString& rPath )
2245 {
2246     OUString aPath( rPath );
2247     rtl::Bootstrap::expandMacros( aPath );
2248 
2249     // import the image
2250     Graphic aGraphic;
2251     if ( GraphicFilter::LoadGraphic( aPath, OUString(), aGraphic ) != ERRCODE_NONE )
2252         return BitmapEx();
2253     return aGraphic.GetBitmapEx();
2254 }
2255 
2256 namespace {
2257 
2258 enum WhichPersona { PERSONA_HEADER, PERSONA_FOOTER };
2259 
2260 }
2261 
2262 /** Update the setting of the Persona header / footer in ImplStyleData */
setupPersonaHeaderFooter(WhichPersona eWhich,OUString & rHeaderFooter,BitmapEx & rHeaderFooterBitmap,std::optional<Color> & rMenuBarTextColor)2263 static void setupPersonaHeaderFooter( WhichPersona eWhich, OUString& rHeaderFooter, BitmapEx& rHeaderFooterBitmap, std::optional<Color>& rMenuBarTextColor )
2264 {
2265     uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
2266     if ( !xContext.is() )
2267         return;
2268 
2269     // don't burn time loading images we don't need.
2270     if ( Application::IsHeadlessModeEnabled() )
2271         return;
2272 
2273     // read from the configuration
2274     OUString aPersona( officecfg::Office::Common::Misc::Persona::get( xContext ) );
2275     OUString aPersonaSettings( officecfg::Office::Common::Misc::PersonaSettings::get( xContext ) );
2276 
2277     // have the settings changed? marks if header /footer prepared before
2278     //should maybe extended to a flag that marks if header /footer /both are loaded
2279     OUString  aOldValue= eWhich==PERSONA_HEADER?OUString(aPersona + ";" + aPersonaSettings+";h" ):OUString(aPersona + ";" + aPersonaSettings+";f" );
2280     if ( rHeaderFooter == aOldValue )
2281         return;
2282 
2283     rHeaderFooter = aOldValue;
2284     rHeaderFooterBitmap = BitmapEx();
2285     rMenuBarTextColor.reset();
2286 
2287     // now read the new values and setup bitmaps
2288     OUString aHeader, aFooter;
2289     if ( aPersona == "own" || aPersona == "default" )
2290     {
2291         sal_Int32 nIndex = 0;
2292 
2293         // Skip the persona slug, name, and preview
2294         aHeader = aPersonaSettings.getToken( 3, ';', nIndex );
2295 
2296         if ( nIndex > 0 )
2297             aFooter = aPersonaSettings.getToken( 0, ';', nIndex );
2298 
2299         // change menu text color, advance nIndex to skip the '#'
2300         if ( nIndex > 0 )
2301         {
2302             OUString aColor = aPersonaSettings.getToken( 0, ';', ++nIndex );
2303             rMenuBarTextColor = Color( ColorTransparency, aColor.toUInt32( 16 ) );
2304         }
2305     }
2306 
2307     OUString aName;
2308     switch ( eWhich ) {
2309         case PERSONA_HEADER: aName = aHeader; break;
2310         case PERSONA_FOOTER: aName = aFooter; break;
2311     }
2312 
2313     if ( !aName.isEmpty() )
2314     {
2315         OUString gallery("");
2316         // try the gallery first, then the program path:
2317         if ( aPersona == "own" && !aPersonaSettings.startsWith( "vnd.sun.star.expand" ) )
2318         {
2319             gallery = "${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE( "bootstrap") "::UserInstallation}";
2320             rtl::Bootstrap::expandMacros( gallery );
2321             gallery += "/user/gallery/personas/";
2322         }
2323         else if ( aPersona == "default" )
2324         {
2325             gallery = "$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER "/gallery/personas/";
2326         }
2327         rHeaderFooterBitmap = readBitmapEx( gallery + aName );
2328 
2329         if ( rHeaderFooterBitmap.IsEmpty() )
2330             rHeaderFooterBitmap = readBitmapEx( "$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" + aName );
2331     }
2332 
2333     // Something went wrong. Probably, the images are missing. Clear the persona properties in the registry.
2334 
2335     if( rHeaderFooterBitmap.IsEmpty() )
2336     {
2337         std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
2338         officecfg::Office::Common::Misc::Persona::set( "no", batch );
2339         officecfg::Office::Common::Misc::PersonaSettings::set( "", batch );
2340         batch->commit();
2341     }
2342 }
2343 
GetPersonaHeader() const2344 BitmapEx const & StyleSettings::GetPersonaHeader() const
2345 {
2346     setupPersonaHeaderFooter( PERSONA_HEADER, mxData->maPersonaHeaderFooter, mxData->maPersonaHeaderBitmap, mxData->maPersonaMenuBarTextColor );
2347     return mxData->maPersonaHeaderBitmap;
2348 }
2349 
GetPersonaFooter() const2350 BitmapEx const & StyleSettings::GetPersonaFooter() const
2351 {
2352     setupPersonaHeaderFooter( PERSONA_FOOTER, mxData->maPersonaHeaderFooter, mxData->maPersonaFooterBitmap, mxData->maPersonaMenuBarTextColor );
2353     return mxData->maPersonaFooterBitmap;
2354 }
2355 
GetPersonaMenuBarTextColor() const2356 const std::optional<Color>& StyleSettings::GetPersonaMenuBarTextColor() const
2357 {
2358     GetPersonaHeader();
2359     return mxData->maPersonaMenuBarTextColor;
2360 }
2361 
SetStandardStyles()2362 void StyleSettings::SetStandardStyles()
2363 {
2364     CopyData();
2365     mxData->SetStandardStyles();
2366 }
2367 
GetFaceGradientColor() const2368 Color StyleSettings::GetFaceGradientColor() const
2369 {
2370     // compute a brighter face color that can be used in gradients
2371     // for a convex look (eg toolbars)
2372 
2373     sal_uInt16 h, s, b;
2374     GetFaceColor().RGBtoHSB( h, s, b );
2375     if( s > 1) s=1;
2376     if( b < 98) b=98;
2377     return Color::HSBtoRGB( h, s, b );
2378 }
2379 
GetSeparatorColor() const2380 Color StyleSettings::GetSeparatorColor() const
2381 {
2382     // compute a brighter shadow color for separators (used in toolbars or between menubar and toolbars on Windows XP)
2383     sal_uInt16 h, s, b;
2384     GetShadowColor().RGBtoHSB( h, s, b );
2385     b += b/4;
2386     s -= s/4;
2387     return Color::HSBtoRGB( h, s, b );
2388 }
2389 
CopyData()2390 void StyleSettings::CopyData()
2391 {
2392     // copy if other references exist
2393     if (mxData.use_count() > 1)
2394     {
2395         mxData = std::make_shared<ImplStyleData>(*mxData);
2396     }
2397 }
2398 
operator ==(const StyleSettings & rSet) const2399 bool StyleSettings::operator ==( const StyleSettings& rSet ) const
2400 {
2401     if ( mxData == rSet.mxData )
2402         return true;
2403 
2404     if (mxData->mIconTheme != rSet.mxData->mIconTheme) {
2405         return false;
2406     }
2407 
2408     if (*mxData->mIconThemeSelector != *rSet.mxData->mIconThemeSelector) {
2409         return false;
2410     }
2411 
2412     return (mxData->mnOptions                 == rSet.mxData->mnOptions)                  &&
2413          (mxData->mbAutoMnemonic            == rSet.mxData->mbAutoMnemonic)             &&
2414          (mxData->mnDragFullOptions         == rSet.mxData->mnDragFullOptions)          &&
2415          (mxData->mnSelectionOptions        == rSet.mxData->mnSelectionOptions)         &&
2416          (mxData->mnDisplayOptions          == rSet.mxData->mnDisplayOptions)           &&
2417          (mxData->mnCursorSize              == rSet.mxData->mnCursorSize)               &&
2418          (mxData->mnCursorBlinkTime         == rSet.mxData->mnCursorBlinkTime)          &&
2419          (mxData->mnTitleHeight             == rSet.mxData->mnTitleHeight)              &&
2420          (mxData->mnFloatTitleHeight        == rSet.mxData->mnFloatTitleHeight)         &&
2421          (mxData->mnScrollBarSize           == rSet.mxData->mnScrollBarSize)            &&
2422          (mxData->mnMinThumbSize            == rSet.mxData->mnMinThumbSize)             &&
2423          (mxData->mnSpinSize                == rSet.mxData->mnSpinSize)                 &&
2424          (mxData->mnAntialiasedMin          == rSet.mxData->mnAntialiasedMin)           &&
2425          (mxData->mbHighContrast            == rSet.mxData->mbHighContrast)             &&
2426          (mxData->mbUseSystemUIFonts        == rSet.mxData->mbUseSystemUIFonts)         &&
2427          (mxData->mbUseFontAAFromSystem     == rSet.mxData->mbUseFontAAFromSystem)      &&
2428          (mxData->mnUseFlatBorders          == rSet.mxData->mnUseFlatBorders)           &&
2429          (mxData->mnUseFlatMenus            == rSet.mxData->mnUseFlatMenus)             &&
2430          (mxData->maFaceColor               == rSet.mxData->maFaceColor)                &&
2431          (mxData->maCheckedColor            == rSet.mxData->maCheckedColor)             &&
2432          (mxData->maLightColor              == rSet.mxData->maLightColor)               &&
2433          (mxData->maLightBorderColor        == rSet.mxData->maLightBorderColor)         &&
2434          (mxData->maShadowColor             == rSet.mxData->maShadowColor)              &&
2435          (mxData->maDarkShadowColor         == rSet.mxData->maDarkShadowColor)          &&
2436          (mxData->maButtonTextColor         == rSet.mxData->maButtonTextColor)          &&
2437          (mxData->maDefaultActionButtonTextColor == rSet.mxData->maDefaultActionButtonTextColor) &&
2438          (mxData->maActionButtonTextColor   == rSet.mxData->maActionButtonTextColor)    &&
2439          (mxData->maButtonRolloverTextColor == rSet.mxData->maButtonRolloverTextColor)  &&
2440          (mxData->maActionButtonRolloverTextColor == rSet.mxData->maActionButtonRolloverTextColor) &&
2441          (mxData->maRadioCheckTextColor     == rSet.mxData->maRadioCheckTextColor)      &&
2442          (mxData->maGroupTextColor          == rSet.mxData->maGroupTextColor)           &&
2443          (mxData->maLabelTextColor          == rSet.mxData->maLabelTextColor)           &&
2444          (mxData->maWindowColor             == rSet.mxData->maWindowColor)              &&
2445          (mxData->maWindowTextColor         == rSet.mxData->maWindowTextColor)          &&
2446          (mxData->maDialogColor             == rSet.mxData->maDialogColor)              &&
2447          (mxData->maDialogTextColor         == rSet.mxData->maDialogTextColor)          &&
2448          (mxData->maWorkspaceColor          == rSet.mxData->maWorkspaceColor)           &&
2449          (mxData->maMonoColor               == rSet.mxData->maMonoColor)                &&
2450          (mxData->maFieldColor              == rSet.mxData->maFieldColor)               &&
2451          (mxData->maFieldTextColor          == rSet.mxData->maFieldTextColor)           &&
2452          (mxData->maActiveColor             == rSet.mxData->maActiveColor)              &&
2453          (mxData->maActiveTextColor         == rSet.mxData->maActiveTextColor)          &&
2454          (mxData->maActiveBorderColor       == rSet.mxData->maActiveBorderColor)        &&
2455          (mxData->maDeactiveColor           == rSet.mxData->maDeactiveColor)            &&
2456          (mxData->maDeactiveTextColor       == rSet.mxData->maDeactiveTextColor)        &&
2457          (mxData->maDeactiveBorderColor     == rSet.mxData->maDeactiveBorderColor)      &&
2458          (mxData->maMenuColor               == rSet.mxData->maMenuColor)                &&
2459          (mxData->maMenuBarColor            == rSet.mxData->maMenuBarColor)             &&
2460          (mxData->maMenuBarRolloverColor    == rSet.mxData->maMenuBarRolloverColor)     &&
2461          (mxData->maMenuBorderColor         == rSet.mxData->maMenuBorderColor)          &&
2462          (mxData->maMenuTextColor           == rSet.mxData->maMenuTextColor)            &&
2463          (mxData->maMenuBarTextColor        == rSet.mxData->maMenuBarTextColor)         &&
2464          (mxData->maMenuBarRolloverTextColor == rSet.mxData->maMenuBarRolloverTextColor) &&
2465          (mxData->maMenuHighlightColor      == rSet.mxData->maMenuHighlightColor)       &&
2466          (mxData->maMenuHighlightTextColor  == rSet.mxData->maMenuHighlightTextColor)   &&
2467          (mxData->maHighlightColor          == rSet.mxData->maHighlightColor)           &&
2468          (mxData->maHighlightTextColor      == rSet.mxData->maHighlightTextColor)       &&
2469          (mxData->maTabTextColor            == rSet.mxData->maTabTextColor)             &&
2470          (mxData->maTabRolloverTextColor    == rSet.mxData->maTabRolloverTextColor)     &&
2471          (mxData->maTabHighlightTextColor   == rSet.mxData->maTabHighlightTextColor)    &&
2472          (mxData->maActiveTabColor          == rSet.mxData->maActiveTabColor)           &&
2473          (mxData->maInactiveTabColor        == rSet.mxData->maInactiveTabColor)         &&
2474          (mxData->maDisableColor            == rSet.mxData->maDisableColor)             &&
2475          (mxData->maHelpColor               == rSet.mxData->maHelpColor)                &&
2476          (mxData->maHelpTextColor           == rSet.mxData->maHelpTextColor)            &&
2477          (mxData->maLinkColor               == rSet.mxData->maLinkColor)                &&
2478          (mxData->maVisitedLinkColor        == rSet.mxData->maVisitedLinkColor)         &&
2479          (mxData->maToolTextColor           == rSet.mxData->maToolTextColor)            &&
2480          (mxData->maAppFont                 == rSet.mxData->maAppFont)                  &&
2481          (mxData->maHelpFont                == rSet.mxData->maHelpFont)                 &&
2482          (mxData->maTitleFont               == rSet.mxData->maTitleFont)                &&
2483          (mxData->maFloatTitleFont          == rSet.mxData->maFloatTitleFont)           &&
2484          (mxData->maMenuFont                == rSet.mxData->maMenuFont)                 &&
2485          (mxData->maToolFont                == rSet.mxData->maToolFont)                 &&
2486          (mxData->maGroupFont               == rSet.mxData->maGroupFont)                &&
2487          (mxData->maLabelFont               == rSet.mxData->maLabelFont)                &&
2488          (mxData->maRadioCheckFont          == rSet.mxData->maRadioCheckFont)           &&
2489          (mxData->maPushButtonFont          == rSet.mxData->maPushButtonFont)           &&
2490          (mxData->maFieldFont               == rSet.mxData->maFieldFont)                &&
2491          (mxData->maIconFont                == rSet.mxData->maIconFont)                 &&
2492          (mxData->maTabFont                 == rSet.mxData->maTabFont)                  &&
2493          (mxData->meUseImagesInMenus        == rSet.mxData->meUseImagesInMenus)         &&
2494          (mxData->mbPreferredUseImagesInMenus == rSet.mxData->mbPreferredUseImagesInMenus) &&
2495          (mxData->mbSkipDisabledInMenus     == rSet.mxData->mbSkipDisabledInMenus)      &&
2496          (mxData->mbHideDisabledMenuItems   == rSet.mxData->mbHideDisabledMenuItems)    &&
2497          (mxData->mbPreferredContextMenuShortcuts  == rSet.mxData->mbPreferredContextMenuShortcuts)&&
2498          (mxData->meContextMenuShortcuts    == rSet.mxData->meContextMenuShortcuts)     &&
2499          (mxData->mbPrimaryButtonWarpsSlider == rSet.mxData->mbPrimaryButtonWarpsSlider) &&
2500          (mxData->maFontColor               == rSet.mxData->maFontColor)                &&
2501          (mxData->mnEdgeBlending                    == rSet.mxData->mnEdgeBlending)                     &&
2502          (mxData->maEdgeBlendingTopLeftColor        == rSet.mxData->maEdgeBlendingTopLeftColor)         &&
2503          (mxData->maEdgeBlendingBottomRightColor    == rSet.mxData->maEdgeBlendingBottomRightColor)     &&
2504          (mxData->mnListBoxMaximumLineCount         == rSet.mxData->mnListBoxMaximumLineCount)          &&
2505          (mxData->mnColorValueSetColumnCount        == rSet.mxData->mnColorValueSetColumnCount)         &&
2506          (mxData->maListBoxPreviewDefaultLogicSize  == rSet.mxData->maListBoxPreviewDefaultLogicSize)   &&
2507          (mxData->maListBoxPreviewDefaultPixelSize  == rSet.mxData->maListBoxPreviewDefaultPixelSize)   &&
2508          (mxData->mbPreviewUsesCheckeredBackground == rSet.mxData->mbPreviewUsesCheckeredBackground);
2509 }
2510 
ImplMiscData()2511 ImplMiscData::ImplMiscData() :
2512     mnEnableATT(TRISTATE_INDET),
2513     mnDisablePrinting(TRISTATE_INDET)
2514 {
2515     static const char* pEnv = getenv("SAL_DECIMALSEP_ENABLED" ); // set default without UI
2516     mbEnableLocalizedDecimalSep = (pEnv != nullptr);
2517 }
2518 
MiscSettings()2519 MiscSettings::MiscSettings()
2520     : mxData(std::make_shared<ImplMiscData>())
2521 {
2522 }
2523 
operator ==(const MiscSettings & rSet) const2524 bool MiscSettings::operator ==( const MiscSettings& rSet ) const
2525 {
2526     if ( mxData == rSet.mxData )
2527         return true;
2528 
2529     return (mxData->mnEnableATT           == rSet.mxData->mnEnableATT ) &&
2530          (mxData->mnDisablePrinting     == rSet.mxData->mnDisablePrinting ) &&
2531          (mxData->mbEnableLocalizedDecimalSep == rSet.mxData->mbEnableLocalizedDecimalSep );
2532 }
2533 
2534 bool
operator !=(const MiscSettings & rSet) const2535 MiscSettings::operator !=( const MiscSettings& rSet ) const
2536 {
2537     return !(*this == rSet);
2538 }
2539 
GetDisablePrinting() const2540 bool MiscSettings::GetDisablePrinting() const
2541 {
2542     if( mxData->mnDisablePrinting == TRISTATE_INDET )
2543     {
2544         OUString aEnable =
2545             vcl::SettingsConfigItem::get()->
2546             getValue( "DesktopManagement",
2547                       "DisablePrinting" );
2548         mxData->mnDisablePrinting = aEnable.equalsIgnoreAsciiCase("true") ? TRISTATE_TRUE : TRISTATE_FALSE;
2549     }
2550 
2551     return mxData->mnDisablePrinting != TRISTATE_FALSE;
2552 }
2553 
GetEnableATToolSupport() const2554 bool MiscSettings::GetEnableATToolSupport() const
2555 {
2556 
2557 #ifdef _WIN32
2558     if( mxData->mnEnableATT == TRISTATE_INDET )
2559     {
2560         // Check in the Windows registry if an AT tool wants Accessibility support to
2561         // be activated ..
2562         HKEY hkey;
2563 
2564         if( ERROR_SUCCESS == RegOpenKeyW(HKEY_CURRENT_USER,
2565             L"Software\\LibreOffice\\Accessibility\\AtToolSupport",
2566             &hkey) )
2567         {
2568             DWORD dwType;
2569             wchar_t Data[6]; // possible values: "true", "false", "1", "0", DWORD
2570             DWORD cbData = sizeof(Data);
2571 
2572             if( ERROR_SUCCESS == RegQueryValueExW(hkey, L"SupportAssistiveTechnology",
2573                 nullptr, &dwType, reinterpret_cast<LPBYTE>(Data), &cbData) )
2574             {
2575                 switch (dwType)
2576                 {
2577                     case REG_SZ:
2578                         mxData->mnEnableATT = ((0 == wcsicmp(Data, L"1")) || (0 == wcsicmp(Data, L"true"))) ? TRISTATE_TRUE : TRISTATE_FALSE;
2579                         break;
2580                     case REG_DWORD:
2581                         switch (reinterpret_cast<DWORD *>(Data)[0]) {
2582                         case 0:
2583                             mxData->mnEnableATT = TRISTATE_FALSE;
2584                             break;
2585                         case 1:
2586                             mxData->mnEnableATT = TRISTATE_TRUE;
2587                             break;
2588                         default:
2589                             mxData->mnEnableATT = TRISTATE_INDET;
2590                                 //TODO: or TRISTATE_TRUE?
2591                             break;
2592                         }
2593                         break;
2594                     default:
2595                         // Unsupported registry type
2596                         break;
2597                 }
2598             }
2599 
2600             RegCloseKey(hkey);
2601         }
2602     }
2603 #endif
2604 
2605     if( mxData->mnEnableATT == TRISTATE_INDET )
2606     {
2607         static const char* pEnv = getenv("SAL_ACCESSIBILITY_ENABLED" );
2608         if( !pEnv || !*pEnv )
2609         {
2610             OUString aEnable =
2611                 vcl::SettingsConfigItem::get()->
2612                 getValue( "Accessibility",
2613                           "EnableATToolSupport" );
2614             mxData->mnEnableATT = aEnable.equalsIgnoreAsciiCase("true") ? TRISTATE_TRUE : TRISTATE_FALSE;
2615         }
2616         else
2617         {
2618             mxData->mnEnableATT = TRISTATE_TRUE;
2619         }
2620     }
2621 
2622     return mxData->mnEnableATT != TRISTATE_FALSE;
2623 }
2624 
2625 #ifdef _WIN32
SetEnableATToolSupport(bool bEnable)2626 void MiscSettings::SetEnableATToolSupport( bool bEnable )
2627 {
2628     if ( (bEnable ? TRISTATE_TRUE : TRISTATE_FALSE) != mxData->mnEnableATT )
2629     {
2630         if( bEnable && !ImplInitAccessBridge() )
2631             return;
2632 
2633         HKEY hkey;
2634 
2635         // If the accessibility key in the Windows registry exists, change it synchronously
2636         if( ERROR_SUCCESS == RegOpenKeyW(HKEY_CURRENT_USER,
2637             L"Software\\LibreOffice\\Accessibility\\AtToolSupport",
2638             &hkey) )
2639         {
2640             DWORD dwType;
2641             wchar_t Data[6]; // possible values: "true", "false", 1, 0
2642             DWORD cbData = sizeof(Data);
2643 
2644             if( ERROR_SUCCESS == RegQueryValueExW(hkey, L"SupportAssistiveTechnology",
2645                 nullptr,   &dwType, reinterpret_cast<LPBYTE>(Data), &cbData) )
2646             {
2647                 switch (dwType)
2648                 {
2649                     case REG_SZ:
2650                         RegSetValueExW(hkey, L"SupportAssistiveTechnology",
2651                             0, dwType,
2652                             reinterpret_cast<const BYTE*>(bEnable ? L"true" : L"false"),
2653                             bEnable ? sizeof(L"true") : sizeof(L"false"));
2654                         break;
2655                     case REG_DWORD:
2656                         reinterpret_cast<DWORD *>(Data)[0] = bEnable ? 1 : 0;
2657                         RegSetValueExW(hkey, L"SupportAssistiveTechnology",
2658                             0, dwType, reinterpret_cast<const BYTE*>(Data), sizeof(DWORD));
2659                         break;
2660                     default:
2661                         // Unsupported registry type
2662                         break;
2663                 }
2664             }
2665 
2666             RegCloseKey(hkey);
2667         }
2668 
2669         vcl::SettingsConfigItem::get()->
2670             setValue( "Accessibility",
2671                       "EnableATToolSupport",
2672                       bEnable ? OUString("true") : OUString("false" ) );
2673         mxData->mnEnableATT = bEnable ? TRISTATE_TRUE : TRISTATE_FALSE;
2674     }
2675 }
2676 #endif
2677 
SetEnableLocalizedDecimalSep(bool bEnable)2678 void MiscSettings::SetEnableLocalizedDecimalSep( bool bEnable )
2679 {
2680     // copy if other references exist
2681     if (mxData.use_count() > 1)
2682     {
2683         mxData = std::make_shared<ImplMiscData>(*mxData);
2684     }
2685     mxData->mbEnableLocalizedDecimalSep = bEnable;
2686 }
2687 
GetEnableLocalizedDecimalSep() const2688 bool MiscSettings::GetEnableLocalizedDecimalSep() const
2689 {
2690     return mxData->mbEnableLocalizedDecimalSep;
2691 }
2692 
HelpSettings()2693 HelpSettings::HelpSettings()
2694     : mxData(std::make_shared<ImplHelpData>())
2695 {
2696 }
2697 
operator ==(const HelpSettings & rSet) const2698 bool HelpSettings::operator ==( const HelpSettings& rSet ) const
2699 {
2700     if ( mxData == rSet.mxData )
2701         return true;
2702 
2703     return (mxData->mnTipTimeout      == rSet.mxData->mnTipTimeout );
2704 }
2705 
2706 sal_Int32
GetTipDelay()2707 HelpSettings::GetTipDelay()
2708 {
2709     return 500;
2710 }
2711 
2712 void
SetTipTimeout(sal_Int32 nTipTimeout)2713 HelpSettings::SetTipTimeout( sal_Int32 nTipTimeout )
2714 {
2715     // copy if other references exist
2716     if (mxData.use_count() > 1)
2717     {
2718         mxData = std::make_shared<ImplHelpData>(*mxData);
2719     }
2720     mxData->mnTipTimeout = nTipTimeout;
2721 }
2722 
2723 sal_Int32
GetTipTimeout() const2724 HelpSettings::GetTipTimeout() const
2725 {
2726     return mxData->mnTipTimeout;
2727 }
2728 
2729 sal_Int32
GetBalloonDelay()2730 HelpSettings::GetBalloonDelay()
2731 {
2732     return 1500;
2733 }
2734 
2735 bool
operator !=(const HelpSettings & rSet) const2736 HelpSettings::operator !=( const HelpSettings& rSet ) const
2737 {
2738     return !(*this == rSet);
2739 }
2740 
ImplAllSettingsData()2741 ImplAllSettingsData::ImplAllSettingsData()
2742     :
2743         maLocale( LANGUAGE_SYSTEM ),
2744         maUILocale( LANGUAGE_SYSTEM )
2745 {
2746     if (!utl::ConfigManager::IsFuzzing())
2747         maMiscSettings.SetEnableLocalizedDecimalSep( maSysLocale.GetOptions().IsDecimalSeparatorAsLocale() );
2748 }
2749 
ImplAllSettingsData(const ImplAllSettingsData & rData)2750 ImplAllSettingsData::ImplAllSettingsData( const ImplAllSettingsData& rData ) :
2751     maMouseSettings( rData.maMouseSettings ),
2752     maStyleSettings( rData.maStyleSettings ),
2753     maMiscSettings( rData.maMiscSettings ),
2754     maHelpSettings( rData.maHelpSettings ),
2755     maLocale( rData.maLocale ),
2756     maUILocale( rData.maUILocale )
2757 {
2758     // Create the cache objects new when their getter is called.
2759 }
2760 
~ImplAllSettingsData()2761 ImplAllSettingsData::~ImplAllSettingsData()
2762 {
2763     mpLocaleDataWrapper.reset();
2764     mpUILocaleDataWrapper.reset();
2765     mpNeutralLocaleDataWrapper.reset();
2766     mpI18nHelper.reset();
2767     mpUII18nHelper.reset();
2768 }
2769 
AllSettings()2770 AllSettings::AllSettings()
2771     : mxData(std::make_shared<ImplAllSettingsData>())
2772 {
2773 }
2774 
CopyData()2775 void AllSettings::CopyData()
2776 {
2777     // copy if other references exist
2778     if (mxData.use_count() > 1)
2779     {
2780         mxData = std::make_shared<ImplAllSettingsData>(*mxData);
2781     }
2782 
2783 }
2784 
Update(AllSettingsFlags nFlags,const AllSettings & rSet)2785 AllSettingsFlags AllSettings::Update( AllSettingsFlags nFlags, const AllSettings& rSet )
2786 {
2787 
2788     AllSettingsFlags nChangeFlags = AllSettingsFlags::NONE;
2789 
2790     if ( nFlags & AllSettingsFlags::MOUSE )
2791     {
2792         if ( mxData->maMouseSettings != rSet.mxData->maMouseSettings )
2793         {
2794             CopyData();
2795             mxData->maMouseSettings = rSet.mxData->maMouseSettings;
2796             nChangeFlags |= AllSettingsFlags::MOUSE;
2797         }
2798     }
2799 
2800     if ( nFlags & AllSettingsFlags::STYLE )
2801     {
2802         if ( mxData->maStyleSettings != rSet.mxData->maStyleSettings )
2803         {
2804             CopyData();
2805             mxData->maStyleSettings = rSet.mxData->maStyleSettings;
2806             nChangeFlags |= AllSettingsFlags::STYLE;
2807         }
2808     }
2809 
2810     if ( nFlags & AllSettingsFlags::MISC )
2811     {
2812         if ( mxData->maMiscSettings != rSet.mxData->maMiscSettings )
2813         {
2814             CopyData();
2815             mxData->maMiscSettings = rSet.mxData->maMiscSettings;
2816             nChangeFlags |= AllSettingsFlags::MISC;
2817         }
2818     }
2819 
2820     if ( nFlags & AllSettingsFlags::LOCALE )
2821     {
2822         if ( mxData->maLocale != rSet.mxData->maLocale )
2823         {
2824             SetLanguageTag( rSet.mxData->maLocale );
2825             nChangeFlags |= AllSettingsFlags::LOCALE;
2826         }
2827     }
2828 
2829     return nChangeFlags;
2830 }
2831 
GetChangeFlags(const AllSettings & rSet) const2832 AllSettingsFlags AllSettings::GetChangeFlags( const AllSettings& rSet ) const
2833 {
2834 
2835     AllSettingsFlags nChangeFlags = AllSettingsFlags::NONE;
2836 
2837     if ( mxData->maStyleSettings != rSet.mxData->maStyleSettings )
2838         nChangeFlags |= AllSettingsFlags::STYLE;
2839 
2840     if ( mxData->maMiscSettings != rSet.mxData->maMiscSettings )
2841         nChangeFlags |= AllSettingsFlags::MISC;
2842 
2843     if ( mxData->maLocale != rSet.mxData->maLocale )
2844         nChangeFlags |= AllSettingsFlags::LOCALE;
2845 
2846     return nChangeFlags;
2847 }
2848 
operator ==(const AllSettings & rSet) const2849 bool AllSettings::operator ==( const AllSettings& rSet ) const
2850 {
2851     if ( mxData == rSet.mxData )
2852         return true;
2853 
2854     if ( (mxData->maMouseSettings           == rSet.mxData->maMouseSettings)        &&
2855          (mxData->maStyleSettings           == rSet.mxData->maStyleSettings)        &&
2856          (mxData->maMiscSettings            == rSet.mxData->maMiscSettings)         &&
2857          (mxData->maHelpSettings            == rSet.mxData->maHelpSettings)         &&
2858          (mxData->maLocale                  == rSet.mxData->maLocale) )
2859     {
2860         return true;
2861     }
2862 
2863     return false;
2864 }
2865 
SetLanguageTag(const OUString & rLanguage,bool bCanonicalize)2866 void AllSettings::SetLanguageTag(const OUString& rLanguage, bool bCanonicalize)
2867 {
2868     SetLanguageTag(LanguageTag(rLanguage, bCanonicalize));
2869 }
2870 
SetLanguageTag(const LanguageTag & rLanguageTag)2871 void AllSettings::SetLanguageTag( const LanguageTag& rLanguageTag )
2872 {
2873     if (mxData->maLocale == rLanguageTag)
2874         return;
2875 
2876     CopyData();
2877 
2878     mxData->maLocale = rLanguageTag;
2879 
2880     if ( mxData->mpLocaleDataWrapper )
2881     {
2882         mxData->mpLocaleDataWrapper.reset();
2883     }
2884     if ( mxData->mpI18nHelper )
2885     {
2886         mxData->mpI18nHelper.reset();
2887     }
2888 }
2889 
2890 namespace
2891 {
GetConfigLayoutRTL(bool bMath)2892     bool GetConfigLayoutRTL(bool bMath)
2893     {
2894         static const char* pEnv = getenv("SAL_RTL_ENABLED" );
2895         static int  nUIMirroring = -1;   // -1: undef, 0: auto, 1: on 2: off
2896 
2897         // environment always overrides
2898         if( pEnv )
2899             return true;
2900 
2901         bool bRTL = false;
2902 
2903         if( nUIMirroring == -1 )
2904         {
2905             nUIMirroring = 0; // ask configuration only once
2906             utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithComponentContext(
2907                 comphelper::getProcessComponentContext(),
2908                 "org.openoffice.Office.Common/I18N/CTL" );    // note: case sensitive !
2909             if ( aNode.isValid() )
2910             {
2911                 bool bTmp = bool();
2912                 css::uno::Any aValue = aNode.getNodeValue( "UIMirroring" );
2913                 if( aValue >>= bTmp )
2914                 {
2915                     // found true or false; if it was nil, nothing is changed
2916                     nUIMirroring = bTmp ? 1 : 2;
2917                 }
2918             }
2919         }
2920 
2921         if( nUIMirroring == 0 )  // no config found (eg, setup) or default (nil) was set: check language
2922         {
2923             LanguageType aLang = SvtSysLocaleOptions().GetRealUILanguageTag().getLanguageType();
2924             if (bMath)
2925                 bRTL = MsLangId::isRightToLeftMath( aLang );
2926             else
2927                 bRTL = MsLangId::isRightToLeft( aLang );
2928         }
2929         else
2930             bRTL = (nUIMirroring == 1);
2931 
2932         return bRTL;
2933     }
2934 }
2935 
GetLayoutRTL()2936 bool AllSettings::GetLayoutRTL()
2937 {
2938     if (utl::ConfigManager::IsFuzzing())
2939         return false;
2940     return GetConfigLayoutRTL(false);
2941 }
2942 
GetMathLayoutRTL()2943 bool AllSettings::GetMathLayoutRTL()
2944 {
2945     if (utl::ConfigManager::IsFuzzing())
2946         return false;
2947     return GetConfigLayoutRTL(true);
2948 }
2949 
GetLanguageTag() const2950 const LanguageTag& AllSettings::GetLanguageTag() const
2951 {
2952     if (utl::ConfigManager::IsFuzzing())
2953     {
2954         static LanguageTag aRet("en-US");
2955         return aRet;
2956     }
2957 
2958     if (comphelper::LibreOfficeKit::isActive())
2959         return comphelper::LibreOfficeKit::getLanguageTag();
2960 
2961     // SYSTEM locale means: use settings from SvtSysLocale that is resolved
2962     if ( mxData->maLocale.isSystemLocale() )
2963         mxData->maLocale = mxData->maSysLocale.GetLanguageTag();
2964 
2965     return mxData->maLocale;
2966 }
2967 
GetUILanguageTag() const2968 const LanguageTag& AllSettings::GetUILanguageTag() const
2969 {
2970     if (utl::ConfigManager::IsFuzzing())
2971     {
2972         static LanguageTag aRet("en-US");
2973         return aRet;
2974     }
2975 
2976     if (comphelper::LibreOfficeKit::isActive())
2977         return comphelper::LibreOfficeKit::getLanguageTag();
2978 
2979     // the UILocale is never changed
2980     if ( mxData->maUILocale.isSystemLocale() )
2981         mxData->maUILocale = mxData->maSysLocale.GetUILanguageTag();
2982 
2983     return mxData->maUILocale;
2984 }
2985 
GetLocaleDataWrapper() const2986 const LocaleDataWrapper& AllSettings::GetLocaleDataWrapper() const
2987 {
2988     if ( !mxData->mpLocaleDataWrapper )
2989         const_cast<AllSettings*>(this)->mxData->mpLocaleDataWrapper.reset( new LocaleDataWrapper(
2990             comphelper::getProcessComponentContext(), GetLanguageTag() ) );
2991     return *mxData->mpLocaleDataWrapper;
2992 }
2993 
GetUILocaleDataWrapper() const2994 const LocaleDataWrapper& AllSettings::GetUILocaleDataWrapper() const
2995 {
2996     if ( !mxData->mpUILocaleDataWrapper )
2997         const_cast<AllSettings*>(this)->mxData->mpUILocaleDataWrapper.reset( new LocaleDataWrapper(
2998             comphelper::getProcessComponentContext(), GetUILanguageTag() ) );
2999     return *mxData->mpUILocaleDataWrapper;
3000 }
3001 
GetNeutralLocaleDataWrapper() const3002 const LocaleDataWrapper& AllSettings::GetNeutralLocaleDataWrapper() const
3003 {
3004     if ( !mxData->mpNeutralLocaleDataWrapper )
3005         const_cast<AllSettings*>(this)->mxData->mpNeutralLocaleDataWrapper.reset( new LocaleDataWrapper(
3006             comphelper::getProcessComponentContext(), LanguageTag("en-US") ) );
3007     return *mxData->mpNeutralLocaleDataWrapper;
3008 }
3009 
GetLocaleI18nHelper() const3010 const vcl::I18nHelper& AllSettings::GetLocaleI18nHelper() const
3011 {
3012     if ( !mxData->mpI18nHelper ) {
3013         const_cast<AllSettings*>(this)->mxData->mpI18nHelper.reset( new vcl::I18nHelper(
3014             comphelper::getProcessComponentContext(), GetLanguageTag() ) );
3015     }
3016     return *mxData->mpI18nHelper;
3017 }
3018 
GetUILocaleI18nHelper() const3019 const vcl::I18nHelper& AllSettings::GetUILocaleI18nHelper() const
3020 {
3021     if ( !mxData->mpUII18nHelper ) {
3022         const_cast<AllSettings*>(this)->mxData->mpUII18nHelper.reset( new vcl::I18nHelper(
3023             comphelper::getProcessComponentContext(), GetUILanguageTag() ) );
3024     }
3025     return *mxData->mpUII18nHelper;
3026 }
3027 
LocaleSettingsChanged(ConfigurationHints nHint)3028 void AllSettings::LocaleSettingsChanged( ConfigurationHints nHint )
3029 {
3030     AllSettings aAllSettings( Application::GetSettings() );
3031     if ( nHint & ConfigurationHints::DecSep )
3032     {
3033         MiscSettings aMiscSettings = aAllSettings.GetMiscSettings();
3034         bool bIsDecSepAsLocale = aAllSettings.mxData->maSysLocale.GetOptions().IsDecimalSeparatorAsLocale();
3035         if ( aMiscSettings.GetEnableLocalizedDecimalSep() != bIsDecSepAsLocale )
3036         {
3037             aMiscSettings.SetEnableLocalizedDecimalSep( bIsDecSepAsLocale );
3038             aAllSettings.SetMiscSettings( aMiscSettings );
3039         }
3040     }
3041 
3042     if ( nHint & ConfigurationHints::Locale )
3043         aAllSettings.SetLanguageTag( aAllSettings.mxData->maSysLocale.GetOptions().GetLanguageTag() );
3044 
3045     Application::SetSettings( aAllSettings );
3046 }
3047 
3048 const StyleSettings&
GetStyleSettings() const3049 AllSettings::GetStyleSettings() const
3050 {
3051     return mxData->maStyleSettings;
3052 }
3053 
3054 StyleSettingsOptions
GetOptions() const3055 StyleSettings::GetOptions() const
3056 {
3057     return mxData->mnOptions;
3058 }
3059 
3060 std::vector<vcl::IconThemeInfo> const &
GetInstalledIconThemes() const3061 StyleSettings::GetInstalledIconThemes() const
3062 {
3063     if (!mxData->mIconThemeScanner) {
3064         const_cast<StyleSettings*>(this)->mxData->mIconThemeScanner = vcl::IconThemeScanner::Create(vcl::IconThemeScanner::GetStandardIconThemePath());
3065     }
3066     return mxData->mIconThemeScanner->GetFoundIconThemes();
3067 }
3068 
3069 /*static*/ OUString
GetAutomaticallyChosenIconTheme() const3070 StyleSettings::GetAutomaticallyChosenIconTheme() const
3071 {
3072     OUString desktopEnvironment = Application::GetDesktopEnvironment();
3073     if (!mxData->mIconThemeScanner) {
3074         const_cast<StyleSettings*>(this)->mxData->mIconThemeScanner = vcl::IconThemeScanner::Create(vcl::IconThemeScanner::GetStandardIconThemePath());
3075     }
3076     OUString themeName = mxData->mIconThemeSelector->SelectIconThemeForDesktopEnvironment(
3077             mxData->mIconThemeScanner->GetFoundIconThemes(),
3078             desktopEnvironment
3079             );
3080     return themeName;
3081 }
3082 
3083 void
SetIconTheme(const OUString & theme)3084 StyleSettings::SetIconTheme(const OUString& theme)
3085 {
3086     CopyData();
3087     mxData->mIconTheme = theme;
3088 }
3089 
3090 OUString
DetermineIconTheme() const3091 StyleSettings::DetermineIconTheme() const
3092 {
3093     OUString sTheme(mxData->mIconTheme);
3094     if (sTheme.isEmpty())
3095     {
3096         if (utl::ConfigManager::IsFuzzing())
3097             sTheme = "colibre";
3098         else
3099         {
3100             // read from the configuration, or fallback to what the desktop wants
3101             uno::Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext());
3102             if (xContext.is())
3103             {
3104                 sTheme = officecfg::Office::Common::Misc::SymbolStyle::get(xContext);
3105 
3106                 if (sTheme.isEmpty() || sTheme == "auto")
3107                     sTheme = GetAutomaticallyChosenIconTheme();
3108             }
3109         }
3110     }
3111 
3112     if (!mxData->mIconThemeScanner) {
3113         const_cast<StyleSettings*>(this)->mxData->mIconThemeScanner = vcl::IconThemeScanner::Create(vcl::IconThemeScanner::GetStandardIconThemePath());
3114     }
3115     OUString r = mxData->mIconThemeSelector->SelectIconTheme(
3116                         mxData->mIconThemeScanner->GetFoundIconThemes(),
3117                         sTheme);
3118     return r;
3119 }
3120 
3121 void
SetHighContrastMode(bool bHighContrast)3122 StyleSettings::SetHighContrastMode(bool bHighContrast )
3123 {
3124     if (mxData->mbHighContrast == bHighContrast) {
3125         return;
3126     }
3127 
3128     CopyData();
3129     mxData->mbHighContrast = bHighContrast;
3130     mxData->mIconThemeSelector->SetUseHighContrastTheme(bHighContrast);
3131 }
3132 
3133 bool
GetHighContrastMode() const3134 StyleSettings::GetHighContrastMode() const
3135 {
3136     return mxData->mbHighContrast;
3137 }
3138 
3139 void
SetPreferredIconTheme(const OUString & theme,bool bDarkIconTheme)3140 StyleSettings::SetPreferredIconTheme(const OUString& theme, bool bDarkIconTheme)
3141 {
3142     mxData->mIconThemeSelector->SetPreferredIconTheme(theme, bDarkIconTheme);
3143 }
3144 
3145 void
SetMouseSettings(const MouseSettings & rSet)3146 AllSettings::SetMouseSettings( const MouseSettings& rSet )
3147 {
3148     CopyData();
3149     mxData->maMouseSettings = rSet;
3150 }
3151 
3152 const MouseSettings&
GetMouseSettings() const3153 AllSettings::GetMouseSettings() const
3154 {
3155     return mxData->maMouseSettings;
3156 }
3157 
3158 void
SetStyleSettings(const StyleSettings & rSet)3159 AllSettings::SetStyleSettings( const StyleSettings& rSet )
3160 {
3161     CopyData();
3162     mxData->maStyleSettings = rSet;
3163 }
3164 
3165 void
SetMiscSettings(const MiscSettings & rSet)3166 AllSettings::SetMiscSettings( const MiscSettings& rSet )
3167 {
3168     CopyData();
3169     mxData->maMiscSettings = rSet;
3170 }
3171 
3172 const MiscSettings&
GetMiscSettings() const3173 AllSettings::GetMiscSettings() const
3174 {
3175     return mxData->maMiscSettings;
3176 }
3177 
3178 void
SetHelpSettings(const HelpSettings & rSet)3179 AllSettings::SetHelpSettings( const HelpSettings& rSet )
3180 {
3181     CopyData();
3182     mxData->maHelpSettings = rSet;
3183 }
3184 
3185 const HelpSettings&
GetHelpSettings() const3186 AllSettings::GetHelpSettings() const
3187 {
3188     return mxData->maHelpSettings;
3189 }
3190 
3191 bool
operator !=(const AllSettings & rSet) const3192 AllSettings::operator !=( const AllSettings& rSet ) const
3193 {
3194     return !(*this == rSet);
3195 }
3196 
3197 SvtSysLocale&
GetSysLocale()3198 AllSettings::GetSysLocale()
3199 {
3200     return mxData->maSysLocale;
3201 }
3202 
3203 
BatchSetBackgrounds(const Color & aBackColor,bool bCheckedColorSpecialCase)3204 void StyleSettings::BatchSetBackgrounds( const Color &aBackColor,
3205                                          bool bCheckedColorSpecialCase )
3206 {
3207     Set3DColors( aBackColor );
3208     SetFaceColor( aBackColor );
3209     SetDialogColor( aBackColor );
3210     SetWorkspaceColor( aBackColor );
3211 
3212     if (bCheckedColorSpecialCase)
3213         SetCheckedColorSpecialCase();
3214 }
3215 
BatchSetFonts(const vcl::Font & aAppFont,const vcl::Font & aLabelFont)3216 void StyleSettings::BatchSetFonts( const vcl::Font& aAppFont,
3217                                    const vcl::Font& aLabelFont )
3218 {
3219     SetAppFont( aAppFont );
3220     SetPushButtonFont( aAppFont );
3221     SetToolFont( aAppFont );
3222     SetHelpFont( aAppFont );
3223 
3224     SetMenuFont( aLabelFont );
3225     SetTabFont( aLabelFont );
3226     SetLabelFont( aLabelFont );
3227     SetRadioCheckFont( aLabelFont );
3228     SetFieldFont( aLabelFont );
3229     SetGroupFont( aLabelFont );
3230     SetIconFont( aLabelFont );
3231 }
3232 
3233 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
3234