build fix: no comphelper/profilezone.hxx in this branch
[LibreOffice.git] / vcl / source / app / settings.cxx
blob8340ac86ee06749b13e4c6c00c5e4c3db4805b49
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <config_folders.h>
22 #include <officecfg/Office/Common.hxx>
24 #ifdef _WIN32
25 #include "win/svsys.h"
26 #endif
28 #include "comphelper/processfactory.hxx"
29 #include <rtl/bootstrap.hxx>
30 #include "tools/debug.hxx"
32 #include "i18nlangtag/mslangid.hxx"
33 #include "i18nlangtag/languagetag.hxx"
35 #include <comphelper/lok.hxx>
37 #include <vcl/graphicfilter.hxx>
38 #include <vcl/IconThemeScanner.hxx>
39 #include <vcl/IconThemeSelector.hxx>
40 #include <vcl/IconThemeInfo.hxx>
41 #include <vcl/svapp.hxx>
42 #include <vcl/event.hxx>
43 #include <vcl/settings.hxx>
44 #include <vcl/i18nhelp.hxx>
45 #include <vcl/ImageTree.hxx>
46 #include <vcl/configsettings.hxx>
47 #include <vcl/gradient.hxx>
48 #include <vcl/outdev.hxx>
50 #include "unotools/fontcfg.hxx"
51 #include "unotools/localedatawrapper.hxx"
52 #include "unotools/collatorwrapper.hxx"
53 #include "unotools/confignode.hxx"
54 #include "unotools/configmgr.hxx"
55 #include "unotools/syslocaleoptions.hxx"
57 using namespace ::com::sun::star;
59 #include "svdata.hxx"
61 struct ImplMouseData
63 ImplMouseData();
64 ImplMouseData( const ImplMouseData& rData );
66 MouseSettingsOptions mnOptions;
67 sal_uInt64 mnDoubleClkTime;
68 long mnDoubleClkWidth;
69 long mnDoubleClkHeight;
70 long mnStartDragWidth;
71 long mnStartDragHeight;
72 sal_uInt16 mnStartDragCode;
73 sal_uInt16 mnContextMenuCode;
74 sal_uInt16 mnContextMenuClicks;
75 sal_uLong mnScrollRepeat;
76 sal_uLong mnButtonStartRepeat;
77 sal_uLong mnButtonRepeat;
78 sal_uLong mnActionDelay;
79 sal_uLong mnMenuDelay;
80 MouseFollowFlags mnFollow;
81 MouseMiddleButtonAction mnMiddleButtonAction;
82 MouseWheelBehaviour mnWheelBehavior;
85 struct ImplStyleData
87 ImplStyleData();
88 ImplStyleData( const ImplStyleData& rData );
90 void SetStandardStyles();
92 Color maActiveBorderColor;
93 Color maActiveColor;
94 Color maActiveTextColor;
95 Color maAlternatingRowColor;
96 Color maButtonTextColor;
97 Color maButtonRolloverTextColor;
98 Color maCheckedColor;
99 Color maDarkShadowColor;
100 Color maDeactiveBorderColor;
101 Color maDeactiveColor;
102 Color maDeactiveTextColor;
103 Color maDialogColor;
104 Color maDialogTextColor;
105 Color maDisableColor;
106 Color maFaceColor;
107 Color maFieldColor;
108 Color maFieldTextColor;
109 Color maFieldRolloverTextColor;
110 Color maFontColor;
111 Color maGroupTextColor;
112 Color maHelpColor;
113 Color maHelpTextColor;
114 Color maHighlightColor;
115 Color maHighlightLinkColor;
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 long mnBorderSize;
158 long mnTitleHeight;
159 long mnFloatTitleHeight;
160 long mnTearOffTitleHeight;
161 long mnScrollBarSize;
162 long mnSplitSize;
163 long mnSpinSize;
164 long mnCursorSize;
165 long mnAntialiasedMin;
166 sal_uInt64 mnCursorBlinkTime;
167 DragFullOptions mnDragFullOptions;
168 SelectionOptions mnSelectionOptions;
169 DisplayOptions mnDisplayOptions;
170 ToolbarIconSize mnToolbarIconSize;
171 bool mnUseFlatMenus;
172 StyleSettingsOptions mnOptions;
173 bool mbHighContrast;
174 bool mbUseSystemUIFonts;
175 bool mbAutoMnemonic;
176 TriState meUseImagesInMenus;
177 bool mnUseFlatBorders;
178 bool mbPreferredUseImagesInMenus;
179 long mnMinThumbSize;
180 std::shared_ptr<vcl::IconThemeScanner>
181 mIconThemeScanner;
182 std::shared_ptr<vcl::IconThemeSelector>
183 mIconThemeSelector;
185 rtl::OUString mIconTheme;
186 bool mbSkipDisabledInMenus;
187 bool mbHideDisabledMenuItems;
188 bool mbPreferredContextMenuShortcuts;
189 TriState meContextMenuShortcuts;
190 //mbPrimaryButtonWarpsSlider == true for "jump to here" behavior for primary button, otherwise
191 //primary means scroll by single page. Secondary button takes the alternative behaviour
192 bool mbPrimaryButtonWarpsSlider;
193 DialogStyle maDialogStyle;
194 FrameStyle maFrameStyle;
196 sal_uInt16 mnEdgeBlending;
197 Color maEdgeBlendingTopLeftColor;
198 Color maEdgeBlendingBottomRightColor;
199 sal_uInt16 mnListBoxMaximumLineCount;
200 sal_uInt16 mnColorValueSetColumnCount;
201 sal_uInt16 mnColorValueSetMaximumRowCount;
202 Size maListBoxPreviewDefaultLogicSize;
203 Size maListBoxPreviewDefaultPixelSize;
204 sal_uInt16 mnListBoxPreviewDefaultLineWidth;
205 bool mbPreviewUsesCheckeredBackground;
207 OUString maPersonaHeaderFooter; ///< Cache the settings to detect changes.
209 BitmapEx maPersonaHeaderBitmap; ///< Cache the header bitmap.
210 BitmapEx maPersonaFooterBitmap; ///< Cache the footer bitmap.
211 boost::optional<Color> maPersonaMenuBarTextColor; ///< Cache the menubar color.
214 struct ImplMiscData
216 ImplMiscData();
217 ImplMiscData( const ImplMiscData& rData );
218 TriState mnEnableATT;
219 bool mbEnableLocalizedDecimalSep;
220 TriState mnDisablePrinting;
221 bool mbPseudoHeadless;
224 struct ImplHelpData
226 ImplHelpData();
227 ImplHelpData( const ImplHelpData& rData );
229 sal_uLong mnTipDelay;
230 sal_uLong mnTipTimeout;
231 sal_uLong mnBalloonDelay;
234 struct ImplAllSettingsData
236 ImplAllSettingsData();
237 ImplAllSettingsData( const ImplAllSettingsData& rData );
238 ~ImplAllSettingsData();
240 MouseSettings maMouseSettings;
241 StyleSettings maStyleSettings;
242 MiscSettings maMiscSettings;
243 HelpSettings maHelpSettings;
244 LanguageTag maLocale;
245 AllSettingsFlags mnWindowUpdate;
246 LanguageTag maUILocale;
247 LocaleDataWrapper* mpLocaleDataWrapper;
248 LocaleDataWrapper* mpUILocaleDataWrapper;
249 vcl::I18nHelper* mpI18nHelper;
250 vcl::I18nHelper* mpUII18nHelper;
251 SvtSysLocale maSysLocale;
254 ImplMouseData::ImplMouseData()
256 mnOptions = MouseSettingsOptions::NONE;
257 mnDoubleClkTime = 500;
258 mnDoubleClkWidth = 2;
259 mnDoubleClkHeight = 2;
260 mnStartDragWidth = 2;
261 mnStartDragHeight = 2;
262 mnStartDragCode = MOUSE_LEFT;
263 mnContextMenuCode = MOUSE_RIGHT;
264 mnContextMenuClicks = 1;
265 mnMiddleButtonAction = MouseMiddleButtonAction::AutoScroll;
266 mnScrollRepeat = 100;
267 mnButtonStartRepeat = 370;
268 mnButtonRepeat = 90;
269 mnActionDelay = 250;
270 mnMenuDelay = 150;
271 mnFollow = MouseFollowFlags::Menu | MouseFollowFlags::DDList;
272 mnWheelBehavior = MouseWheelBehaviour::ALWAYS;
275 ImplMouseData::ImplMouseData( const ImplMouseData& rData )
277 mnOptions = rData.mnOptions;
278 mnDoubleClkTime = rData.mnDoubleClkTime;
279 mnDoubleClkWidth = rData.mnDoubleClkWidth;
280 mnDoubleClkHeight = rData.mnDoubleClkHeight;
281 mnStartDragWidth = rData.mnStartDragWidth;
282 mnStartDragHeight = rData.mnStartDragHeight;
283 mnStartDragCode = rData.mnStartDragCode;
284 mnContextMenuCode = rData.mnContextMenuCode;
285 mnContextMenuClicks = rData.mnContextMenuClicks;
286 mnMiddleButtonAction = rData.mnMiddleButtonAction;
287 mnScrollRepeat = rData.mnScrollRepeat;
288 mnButtonStartRepeat = rData.mnButtonStartRepeat;
289 mnButtonRepeat = rData.mnButtonRepeat;
290 mnActionDelay = rData.mnActionDelay;
291 mnMenuDelay = rData.mnMenuDelay;
292 mnFollow = rData.mnFollow;
293 mnWheelBehavior = rData.mnWheelBehavior;
296 void
297 MouseSettings::SetOptions(MouseSettingsOptions nOptions)
299 CopyData();
300 mxData->mnOptions = nOptions;
303 MouseSettingsOptions
304 MouseSettings::GetOptions() const
306 return mxData->mnOptions;
309 void
310 MouseSettings::SetDoubleClickTime( sal_uInt64 nDoubleClkTime )
312 CopyData();
313 mxData->mnDoubleClkTime = nDoubleClkTime;
316 sal_uInt64
317 MouseSettings::GetDoubleClickTime() const
319 return mxData->mnDoubleClkTime;
322 void
323 MouseSettings::SetDoubleClickWidth( long nDoubleClkWidth )
325 CopyData();
326 mxData->mnDoubleClkWidth = nDoubleClkWidth;
329 long
330 MouseSettings::GetDoubleClickWidth() const
332 return mxData->mnDoubleClkWidth;
335 void
336 MouseSettings::SetDoubleClickHeight( long nDoubleClkHeight )
338 CopyData();
339 mxData->mnDoubleClkHeight = nDoubleClkHeight;
342 long
343 MouseSettings::GetDoubleClickHeight() const
345 return mxData->mnDoubleClkHeight;
348 void
349 MouseSettings::SetStartDragWidth( long nDragWidth )
351 CopyData();
352 mxData->mnStartDragWidth = nDragWidth;
355 long
356 MouseSettings::GetStartDragWidth() const
358 return mxData->mnStartDragWidth;
361 void
362 MouseSettings::SetStartDragHeight( long nDragHeight )
364 CopyData();
365 mxData->mnStartDragHeight = nDragHeight;
368 long
369 MouseSettings::GetStartDragHeight() const
371 return mxData->mnStartDragHeight;
374 sal_uInt16
375 MouseSettings::GetStartDragCode() const
377 return mxData->mnStartDragCode;
380 sal_uInt16
381 MouseSettings::GetContextMenuCode() const
383 return mxData->mnContextMenuCode;
386 sal_uInt16
387 MouseSettings::GetContextMenuClicks() const
389 return mxData->mnContextMenuClicks;
392 sal_uLong
393 MouseSettings::GetScrollRepeat() const
395 return mxData->mnScrollRepeat;
398 sal_uLong
399 MouseSettings::GetButtonStartRepeat() const
401 return mxData->mnButtonStartRepeat;
404 void
405 MouseSettings::SetButtonRepeat( sal_uLong nRepeat )
407 CopyData();
408 mxData->mnButtonRepeat = nRepeat;
411 sal_uLong
412 MouseSettings::GetButtonRepeat() const
414 return mxData->mnButtonRepeat;
417 sal_uLong
418 MouseSettings::GetActionDelay() const
420 return mxData->mnActionDelay;
423 void
424 MouseSettings::SetMenuDelay( sal_uLong nDelay )
426 CopyData();
427 mxData->mnMenuDelay = nDelay;
430 sal_uLong
431 MouseSettings::GetMenuDelay() const
433 return mxData->mnMenuDelay;
436 void
437 MouseSettings::SetFollow( MouseFollowFlags nFollow )
439 CopyData();
440 mxData->mnFollow = nFollow;
443 MouseFollowFlags
444 MouseSettings::GetFollow() const
446 return mxData->mnFollow;
449 void
450 MouseSettings::SetMiddleButtonAction( MouseMiddleButtonAction nAction )
452 CopyData();
453 mxData->mnMiddleButtonAction = nAction;
456 MouseMiddleButtonAction
457 MouseSettings::GetMiddleButtonAction() const
459 return mxData->mnMiddleButtonAction;
462 void
463 MouseSettings::SetWheelBehavior( MouseWheelBehaviour nBehavior )
465 CopyData();
466 mxData->mnWheelBehavior = nBehavior;
469 MouseWheelBehaviour
470 MouseSettings::GetWheelBehavior() const
472 return mxData->mnWheelBehavior;
475 bool
476 MouseSettings::operator !=( const MouseSettings& rSet ) const
478 return !(*this == rSet);
481 MouseSettings::MouseSettings()
482 : mxData(std::make_shared<ImplMouseData>())
486 MouseSettings::~MouseSettings()
490 void MouseSettings::CopyData()
492 // copy if other references exist
493 if ( ! mxData.unique() ) {
494 mxData = std::make_shared<ImplMouseData>(*mxData);
498 bool MouseSettings::operator ==( const MouseSettings& rSet ) const
500 if ( mxData == rSet.mxData )
501 return true;
503 if ( (mxData->mnOptions == rSet.mxData->mnOptions) &&
504 (mxData->mnDoubleClkTime == rSet.mxData->mnDoubleClkTime) &&
505 (mxData->mnDoubleClkWidth == rSet.mxData->mnDoubleClkWidth) &&
506 (mxData->mnDoubleClkHeight == rSet.mxData->mnDoubleClkHeight) &&
507 (mxData->mnStartDragWidth == rSet.mxData->mnStartDragWidth) &&
508 (mxData->mnStartDragHeight == rSet.mxData->mnStartDragHeight) &&
509 (mxData->mnStartDragCode == rSet.mxData->mnStartDragCode) &&
510 (mxData->mnContextMenuCode == rSet.mxData->mnContextMenuCode) &&
511 (mxData->mnContextMenuClicks == rSet.mxData->mnContextMenuClicks) &&
512 (mxData->mnMiddleButtonAction == rSet.mxData->mnMiddleButtonAction) &&
513 (mxData->mnScrollRepeat == rSet.mxData->mnScrollRepeat) &&
514 (mxData->mnButtonStartRepeat == rSet.mxData->mnButtonStartRepeat) &&
515 (mxData->mnButtonRepeat == rSet.mxData->mnButtonRepeat) &&
516 (mxData->mnActionDelay == rSet.mxData->mnActionDelay) &&
517 (mxData->mnMenuDelay == rSet.mxData->mnMenuDelay) &&
518 (mxData->mnFollow == rSet.mxData->mnFollow) &&
519 (mxData->mnWheelBehavior == rSet.mxData->mnWheelBehavior ) )
520 return true;
521 else
522 return false;
525 ImplStyleData::ImplStyleData() :
526 mIconThemeScanner(vcl::IconThemeScanner::Create(vcl::IconThemeScanner::GetStandardIconThemePath())),
527 mIconThemeSelector(new vcl::IconThemeSelector()),
528 maPersonaHeaderFooter(),
529 maPersonaHeaderBitmap(),
530 maPersonaFooterBitmap(),
531 maPersonaMenuBarTextColor()
533 mnScrollBarSize = 16;
534 mnMinThumbSize = 16;
535 mnSplitSize = 3;
536 mnSpinSize = 16;
537 mnAntialiasedMin = 0;
538 mnCursorSize = 2;
539 mnCursorBlinkTime = STYLE_CURSOR_NOBLINKTIME;
540 mnDragFullOptions = DragFullOptions::All;
541 mnSelectionOptions = SelectionOptions::NONE;
542 mnDisplayOptions = DisplayOptions::NONE;
543 mnOptions = StyleSettingsOptions::NONE;
544 mbAutoMnemonic = true;
545 mnToolbarIconSize = ToolbarIconSize::Unknown;
546 meUseImagesInMenus = TRISTATE_INDET;
547 meContextMenuShortcuts = TRISTATE_INDET;
548 mnEdgeBlending = 35;
549 maEdgeBlendingTopLeftColor = RGB_COLORDATA(0xC0, 0xC0, 0xC0);
550 maEdgeBlendingBottomRightColor = RGB_COLORDATA(0x40, 0x40, 0x40);
551 mnListBoxMaximumLineCount = 25;
552 mnColorValueSetColumnCount = 12;
553 mnColorValueSetMaximumRowCount = 20;
554 maListBoxPreviewDefaultLogicSize = Size(15, 7);
555 maListBoxPreviewDefaultPixelSize = Size(0, 0); // on-demand calculated in GetListBoxPreviewDefaultPixelSize()
556 mnListBoxPreviewDefaultLineWidth = 1;
557 mbPreviewUsesCheckeredBackground = true;
559 SetStandardStyles();
562 ImplStyleData::ImplStyleData( const ImplStyleData& rData ) :
563 maActiveBorderColor( rData.maActiveBorderColor ),
564 maActiveColor( rData.maActiveColor ),
565 maActiveTextColor( rData.maActiveTextColor ),
566 maAlternatingRowColor( rData.maAlternatingRowColor ),
567 maButtonTextColor( rData.maButtonTextColor ),
568 maButtonRolloverTextColor( rData.maButtonRolloverTextColor ),
569 maCheckedColor( rData.maCheckedColor ),
570 maDarkShadowColor( rData.maDarkShadowColor ),
571 maDeactiveBorderColor( rData.maDeactiveBorderColor ),
572 maDeactiveColor( rData.maDeactiveColor ),
573 maDeactiveTextColor( rData.maDeactiveTextColor ),
574 maDialogColor( rData.maDialogColor ),
575 maDialogTextColor( rData.maDialogTextColor ),
576 maDisableColor( rData.maDisableColor ),
577 maFaceColor( rData.maFaceColor ),
578 maFieldColor( rData.maFieldColor ),
579 maFieldTextColor( rData.maFieldTextColor ),
580 maFieldRolloverTextColor( rData.maFieldRolloverTextColor ),
581 maFontColor( rData.maFontColor ),
582 maGroupTextColor( rData.maGroupTextColor ),
583 maHelpColor( rData.maHelpColor ),
584 maHelpTextColor( rData.maHelpTextColor ),
585 maHighlightColor( rData.maHighlightColor ),
586 maHighlightLinkColor( rData.maHighlightLinkColor ),
587 maHighlightTextColor( rData.maHighlightTextColor ),
588 maLabelTextColor( rData.maLabelTextColor ),
589 maLightBorderColor( rData.maLightBorderColor ),
590 maLightColor( rData.maLightColor ),
591 maLinkColor( rData.maLinkColor ),
592 maMenuBarColor( rData.maMenuBarColor ),
593 maMenuBarRolloverColor( rData.maMenuBarRolloverColor ),
594 maMenuBorderColor( rData.maMenuBorderColor ),
595 maMenuColor( rData.maMenuColor ),
596 maMenuHighlightColor( rData.maMenuHighlightColor ),
597 maMenuHighlightTextColor( rData.maMenuHighlightTextColor ),
598 maMenuTextColor( rData.maMenuTextColor ),
599 maMenuBarTextColor( rData.maMenuBarTextColor ),
600 maMenuBarRolloverTextColor( rData.maMenuBarRolloverTextColor ),
601 maMenuBarHighlightTextColor( rData.maMenuBarHighlightTextColor ),
602 maMonoColor( rData.maMonoColor ),
603 maRadioCheckTextColor( rData.maRadioCheckTextColor ),
604 maShadowColor( rData.maShadowColor ),
605 maVisitedLinkColor( rData.maVisitedLinkColor ),
606 maToolTextColor( rData.maToolTextColor ),
607 maWindowColor( rData.maWindowColor ),
608 maWindowTextColor( rData.maWindowTextColor ),
609 maWorkspaceColor( rData.maWorkspaceColor ),
610 maActiveTabColor( rData.maActiveTabColor ),
611 maInactiveTabColor( rData.maInactiveTabColor ),
612 maTabTextColor( rData.maTabTextColor ),
613 maTabRolloverTextColor( rData.maTabRolloverTextColor ),
614 maTabHighlightTextColor( rData.maTabHighlightTextColor ),
615 maAppFont( rData.maAppFont ),
616 maHelpFont( rData.maAppFont ),
617 maTitleFont( rData.maTitleFont ),
618 maFloatTitleFont( rData.maFloatTitleFont ),
619 maMenuFont( rData.maMenuFont ),
620 maToolFont( rData.maToolFont ),
621 maLabelFont( rData.maLabelFont ),
622 maRadioCheckFont( rData.maRadioCheckFont ),
623 maPushButtonFont( rData.maPushButtonFont ),
624 maFieldFont( rData.maFieldFont ),
625 maIconFont( rData.maIconFont ),
626 maTabFont( rData.maTabFont ),
627 maGroupFont( rData.maGroupFont ),
628 mIconTheme(rData.mIconTheme),
629 maDialogStyle( rData.maDialogStyle ),
630 maFrameStyle( rData.maFrameStyle ),
631 maPersonaHeaderFooter( rData.maPersonaHeaderFooter ),
632 maPersonaHeaderBitmap( rData.maPersonaHeaderBitmap ),
633 maPersonaFooterBitmap( rData.maPersonaFooterBitmap ),
634 maPersonaMenuBarTextColor( rData.maPersonaMenuBarTextColor )
636 mnBorderSize = rData.mnBorderSize;
637 mnTitleHeight = rData.mnTitleHeight;
638 mnFloatTitleHeight = rData.mnFloatTitleHeight;
639 mnTearOffTitleHeight = rData.mnTearOffTitleHeight;
640 mnScrollBarSize = rData.mnScrollBarSize;
641 mnMinThumbSize = rData.mnMinThumbSize;
642 mnSplitSize = rData.mnSplitSize;
643 mnSpinSize = rData.mnSpinSize;
644 mnAntialiasedMin = rData.mnAntialiasedMin;
645 mnCursorSize = rData.mnCursorSize;
646 mnCursorBlinkTime = rData.mnCursorBlinkTime;
647 mnDragFullOptions = rData.mnDragFullOptions;
648 mnSelectionOptions = rData.mnSelectionOptions;
649 mnDisplayOptions = rData.mnDisplayOptions;
650 mnOptions = rData.mnOptions;
651 mbHighContrast = rData.mbHighContrast;
652 mbUseSystemUIFonts = rData.mbUseSystemUIFonts;
653 mnUseFlatBorders = rData.mnUseFlatBorders;
654 mnUseFlatMenus = rData.mnUseFlatMenus;
655 mbAutoMnemonic = rData.mbAutoMnemonic;
656 meUseImagesInMenus = rData.meUseImagesInMenus;
657 mbPreferredUseImagesInMenus = rData.mbPreferredUseImagesInMenus;
658 mbSkipDisabledInMenus = rData.mbSkipDisabledInMenus;
659 mbHideDisabledMenuItems = rData.mbHideDisabledMenuItems;
660 mbPreferredContextMenuShortcuts = rData.mbPreferredContextMenuShortcuts;
661 meContextMenuShortcuts = rData.meContextMenuShortcuts;
662 mbPrimaryButtonWarpsSlider = rData.mbPrimaryButtonWarpsSlider;
663 mnToolbarIconSize = rData.mnToolbarIconSize;
664 mIconThemeScanner.reset(new vcl::IconThemeScanner(*rData.mIconThemeScanner));
665 mIconThemeSelector.reset(new vcl::IconThemeSelector(*rData.mIconThemeSelector));
666 mnEdgeBlending = rData.mnEdgeBlending;
667 maEdgeBlendingTopLeftColor = rData.maEdgeBlendingTopLeftColor;
668 maEdgeBlendingBottomRightColor = rData.maEdgeBlendingBottomRightColor;
669 mnListBoxMaximumLineCount = rData.mnListBoxMaximumLineCount;
670 mnColorValueSetColumnCount = rData.mnColorValueSetColumnCount;
671 mnColorValueSetMaximumRowCount = rData.mnColorValueSetMaximumRowCount;
672 maListBoxPreviewDefaultLogicSize = rData.maListBoxPreviewDefaultLogicSize;
673 maListBoxPreviewDefaultPixelSize = rData.maListBoxPreviewDefaultPixelSize;
674 mnListBoxPreviewDefaultLineWidth = rData.mnListBoxPreviewDefaultLineWidth;
675 mbPreviewUsesCheckeredBackground = rData.mbPreviewUsesCheckeredBackground;
678 void ImplStyleData::SetStandardStyles()
680 vcl::Font aStdFont( FAMILY_SWISS, Size( 0, 8 ) );
681 aStdFont.SetCharSet( osl_getThreadTextEncoding() );
682 aStdFont.SetWeight( WEIGHT_NORMAL );
683 if (!utl::ConfigManager::IsAvoidConfig())
684 aStdFont.SetFamilyName(utl::DefaultFontConfiguration::get().getUserInterfaceFont(LanguageTag("en")));
685 else
686 aStdFont.SetFamilyName("Liberation Serif");
687 maAppFont = aStdFont;
688 maHelpFont = aStdFont;
689 maMenuFont = aStdFont;
690 maToolFont = aStdFont;
691 maGroupFont = aStdFont;
692 maLabelFont = aStdFont;
693 maRadioCheckFont = aStdFont;
694 maPushButtonFont = aStdFont;
695 maFieldFont = aStdFont;
696 maIconFont = aStdFont;
697 maTabFont = aStdFont;
698 aStdFont.SetWeight( WEIGHT_BOLD );
699 maFloatTitleFont = aStdFont;
700 maTitleFont = aStdFont;
702 maFaceColor = Color( COL_LIGHTGRAY );
703 maCheckedColor = Color( 0xCC, 0xCC, 0xCC );
704 maLightColor = Color( COL_WHITE );
705 maLightBorderColor = Color( COL_LIGHTGRAY );
706 maShadowColor = Color( COL_GRAY );
707 maDarkShadowColor = Color( COL_BLACK );
708 maButtonTextColor = Color( COL_BLACK );
709 maButtonRolloverTextColor = Color( COL_BLACK );
710 maRadioCheckTextColor = Color( COL_BLACK );
711 maGroupTextColor = Color( COL_BLACK );
712 maLabelTextColor = Color( COL_BLACK );
713 maWindowColor = Color( COL_WHITE );
714 maWindowTextColor = Color( COL_BLACK );
715 maDialogColor = Color( COL_LIGHTGRAY );
716 maDialogTextColor = Color( COL_BLACK );
717 maWorkspaceColor = Color( 0xDF, 0xDF, 0xDE );
718 maMonoColor = Color( COL_BLACK );
719 maFieldColor = Color( COL_WHITE );
720 maFieldTextColor = Color( COL_BLACK );
721 maFieldRolloverTextColor = Color( COL_BLACK );
722 maActiveColor = Color( COL_BLUE );
723 maActiveTextColor = Color( COL_WHITE );
724 maActiveBorderColor = Color( COL_LIGHTGRAY );
725 maDeactiveColor = Color( COL_GRAY );
726 maDeactiveTextColor = Color( COL_LIGHTGRAY );
727 maDeactiveBorderColor = Color( COL_LIGHTGRAY );
728 maMenuColor = Color( COL_LIGHTGRAY );
729 maMenuBarColor = Color( COL_LIGHTGRAY );
730 maMenuBarRolloverColor = Color( COL_BLUE );
731 maMenuBorderColor = Color( COL_LIGHTGRAY );
732 maMenuTextColor = Color( COL_BLACK );
733 maMenuBarTextColor = Color( COL_BLACK );
734 maMenuBarRolloverTextColor = Color( COL_WHITE );
735 maMenuBarHighlightTextColor = Color( COL_WHITE );
736 maMenuHighlightColor = Color( COL_BLUE );
737 maMenuHighlightTextColor = Color( COL_WHITE );
738 maHighlightColor = Color( COL_BLUE );
739 maHighlightTextColor = Color( COL_WHITE );
740 maActiveTabColor = Color( COL_WHITE );
741 maInactiveTabColor = Color( COL_LIGHTGRAY );
742 maTabTextColor = Color( COL_BLACK );
743 maTabRolloverTextColor = Color( COL_BLACK );
744 maTabHighlightTextColor = Color( COL_BLACK );
745 maDisableColor = Color( COL_GRAY );
746 maHelpColor = Color( 0xFF, 0xFF, 0xE0 );
747 maHelpTextColor = Color( COL_BLACK );
748 maLinkColor = Color( COL_BLUE );
749 maVisitedLinkColor = Color( 0x00, 0x00, 0xCC );
750 maToolTextColor = Color( COL_BLACK );
751 maHighlightLinkColor = Color( COL_LIGHTBLUE );
752 maFontColor = Color( COL_BLACK );
753 maAlternatingRowColor = Color( 0xEE, 0xEE, 0xEE );
755 mnBorderSize = 1;
756 mnTitleHeight = 18;
757 mnFloatTitleHeight = 13;
758 mnTearOffTitleHeight = 8;
759 mbHighContrast = false;
760 mbUseSystemUIFonts = true;
761 mnUseFlatBorders = false;
762 mnUseFlatMenus = false;
763 mbPreferredUseImagesInMenus = true;
764 mbSkipDisabledInMenus = false;
765 mbHideDisabledMenuItems = false;
766 mbPreferredContextMenuShortcuts = true;
767 mbPrimaryButtonWarpsSlider = false;
770 StyleSettings::StyleSettings()
771 : mxData(std::make_shared<ImplStyleData>())
775 StyleSettings::~StyleSettings()
779 void
780 StyleSettings::SetFaceColor( const Color& rColor )
782 CopyData();
783 mxData->maFaceColor = rColor;
786 const Color&
787 StyleSettings::GetFaceColor() const
789 return mxData->maFaceColor;
792 void
793 StyleSettings::SetCheckedColor( const Color& rColor )
795 CopyData();
796 mxData->maCheckedColor = rColor;
799 const Color&
800 StyleSettings::GetCheckedColor() const
802 return mxData->maCheckedColor;
805 void
806 StyleSettings::SetLightColor( const Color& rColor )
808 CopyData();
809 mxData->maLightColor = rColor;
812 const Color&
813 StyleSettings::GetLightColor() const
815 return mxData->maLightColor;
818 void
819 StyleSettings::SetLightBorderColor( const Color& rColor )
821 CopyData();
822 mxData->maLightBorderColor = rColor;
825 const Color&
826 StyleSettings::GetLightBorderColor() const
828 return mxData->maLightBorderColor;
831 void
832 StyleSettings::SetShadowColor( const Color& rColor )
834 CopyData();
835 mxData->maShadowColor = rColor;
838 const Color&
839 StyleSettings::GetShadowColor() const
841 return mxData->maShadowColor;
844 void
845 StyleSettings::SetDarkShadowColor( const Color& rColor )
847 CopyData();
848 mxData->maDarkShadowColor = rColor;
851 const Color&
852 StyleSettings::GetDarkShadowColor() const
854 return mxData->maDarkShadowColor;
857 void
858 StyleSettings::SetButtonTextColor( const Color& rColor )
860 CopyData();
861 mxData->maButtonTextColor = rColor;
864 const Color&
865 StyleSettings::GetButtonTextColor() const
867 return mxData->maButtonTextColor;
870 void
871 StyleSettings::SetButtonRolloverTextColor( const Color& rColor )
873 CopyData();
874 mxData->maButtonRolloverTextColor = rColor;
877 const Color&
878 StyleSettings::GetButtonRolloverTextColor() const
880 return mxData->maButtonRolloverTextColor;
883 void
884 StyleSettings::SetRadioCheckTextColor( const Color& rColor )
886 CopyData();
887 mxData->maRadioCheckTextColor = rColor;
890 const Color&
891 StyleSettings::GetRadioCheckTextColor() const
893 return mxData->maRadioCheckTextColor;
896 void
897 StyleSettings::SetGroupTextColor( const Color& rColor )
899 CopyData();
900 mxData->maGroupTextColor = rColor;
903 const Color&
904 StyleSettings::GetGroupTextColor() const
906 return mxData->maGroupTextColor;
909 void
910 StyleSettings::SetLabelTextColor( const Color& rColor )
912 CopyData();
913 mxData->maLabelTextColor = rColor;
916 const Color&
917 StyleSettings::GetLabelTextColor() const
919 return mxData->maLabelTextColor;
922 void
923 StyleSettings::SetWindowColor( const Color& rColor )
925 CopyData();
926 mxData->maWindowColor = rColor;
929 const Color&
930 StyleSettings::GetWindowColor() const
932 return mxData->maWindowColor;
935 void
936 StyleSettings::SetWindowTextColor( const Color& rColor )
938 CopyData();
939 mxData->maWindowTextColor = rColor;
942 const Color&
943 StyleSettings::GetWindowTextColor() const
945 return mxData->maWindowTextColor;
948 void
949 StyleSettings::SetDialogColor( const Color& rColor )
951 CopyData();
952 mxData->maDialogColor = rColor;
955 const Color&
956 StyleSettings::GetDialogColor() const
958 return mxData->maDialogColor;
961 void
962 StyleSettings::SetDialogTextColor( const Color& rColor )
964 CopyData();
965 mxData->maDialogTextColor = rColor;
968 const Color&
969 StyleSettings::GetDialogTextColor() const
971 return mxData->maDialogTextColor;
974 void
975 StyleSettings::SetWorkspaceColor( const Color& rColor )
977 CopyData();
978 mxData->maWorkspaceColor = rColor;
981 const Color&
982 StyleSettings::GetWorkspaceColor() const
984 return mxData->maWorkspaceColor;
987 void
988 StyleSettings::SetFieldColor( const Color& rColor )
990 CopyData();
991 mxData->maFieldColor = rColor;
994 const Color&
995 StyleSettings::GetFieldColor() const
997 return mxData->maFieldColor;
1000 void
1001 StyleSettings::SetFieldTextColor( const Color& rColor )
1003 CopyData();
1004 mxData->maFieldTextColor = rColor;
1007 const Color&
1008 StyleSettings::GetFieldTextColor() const
1010 return mxData->maFieldTextColor;
1013 void
1014 StyleSettings::SetFieldRolloverTextColor( const Color& rColor )
1016 CopyData();
1017 mxData->maFieldRolloverTextColor = rColor;
1020 const Color&
1021 StyleSettings::GetFieldRolloverTextColor() const
1023 return mxData->maFieldRolloverTextColor;
1026 void
1027 StyleSettings::SetActiveColor( const Color& rColor )
1029 CopyData();
1030 mxData->maActiveColor = rColor;
1033 const Color&
1034 StyleSettings::GetActiveColor() const
1036 return mxData->maActiveColor;
1039 void
1040 StyleSettings::SetActiveTextColor( const Color& rColor )
1042 CopyData();
1043 mxData->maActiveTextColor = rColor;
1046 const Color&
1047 StyleSettings::GetActiveTextColor() const
1049 return mxData->maActiveTextColor;
1052 void
1053 StyleSettings::SetActiveBorderColor( const Color& rColor )
1055 CopyData();
1056 mxData->maActiveBorderColor = rColor;
1059 const Color&
1060 StyleSettings::GetActiveBorderColor() const
1062 return mxData->maActiveBorderColor;
1065 void
1066 StyleSettings::SetDeactiveColor( const Color& rColor )
1068 CopyData();
1069 mxData->maDeactiveColor = rColor;
1072 const Color&
1073 StyleSettings::GetDeactiveColor() const
1075 return mxData->maDeactiveColor;
1078 void
1079 StyleSettings::SetDeactiveTextColor( const Color& rColor )
1081 CopyData();
1082 mxData->maDeactiveTextColor = rColor;
1085 const Color&
1086 StyleSettings::GetDeactiveTextColor() const
1088 return mxData->maDeactiveTextColor;
1091 void
1092 StyleSettings::SetDeactiveBorderColor( const Color& rColor )
1094 CopyData();
1095 mxData->maDeactiveBorderColor = rColor;
1098 const Color&
1099 StyleSettings::GetDeactiveBorderColor() const
1101 return mxData->maDeactiveBorderColor;
1104 void
1105 StyleSettings::SetHighlightColor( const Color& rColor )
1107 CopyData();
1108 mxData->maHighlightColor = rColor;
1111 const Color&
1112 StyleSettings::GetHighlightColor() const
1114 return mxData->maHighlightColor;
1117 void
1118 StyleSettings::SetHighlightTextColor( const Color& rColor )
1120 CopyData();
1121 mxData->maHighlightTextColor = rColor;
1124 const Color&
1125 StyleSettings::GetHighlightTextColor() const
1127 return mxData->maHighlightTextColor;
1130 void
1131 StyleSettings::SetDisableColor( const Color& rColor )
1133 CopyData();
1134 mxData->maDisableColor = rColor;
1137 const Color&
1138 StyleSettings::GetDisableColor() const
1140 return mxData->maDisableColor;
1143 void
1144 StyleSettings::SetHelpColor( const Color& rColor )
1146 CopyData();
1147 mxData->maHelpColor = rColor;
1150 const Color&
1151 StyleSettings::GetHelpColor() const
1153 return mxData->maHelpColor;
1156 void
1157 StyleSettings::SetHelpTextColor( const Color& rColor )
1159 CopyData();
1160 mxData->maHelpTextColor = rColor;
1163 const Color&
1164 StyleSettings::GetHelpTextColor() const
1166 return mxData->maHelpTextColor;
1169 void
1170 StyleSettings::SetMenuColor( const Color& rColor )
1172 CopyData();
1173 mxData->maMenuColor = rColor;
1176 const Color&
1177 StyleSettings::GetMenuColor() const
1179 return mxData->maMenuColor;
1182 void
1183 StyleSettings::SetMenuBarColor( const Color& rColor )
1185 CopyData();
1186 mxData->maMenuBarColor = rColor;
1189 const Color&
1190 StyleSettings::GetMenuBarColor() const
1192 return mxData->maMenuBarColor;
1195 void
1196 StyleSettings::SetMenuBarRolloverColor( const Color& rColor )
1198 CopyData();
1199 mxData->maMenuBarRolloverColor = rColor;
1202 const Color&
1203 StyleSettings::GetMenuBarRolloverColor() const
1205 return mxData->maMenuBarRolloverColor;
1208 void
1209 StyleSettings::SetMenuBorderColor( const Color& rColor )
1211 CopyData();
1212 mxData->maMenuBorderColor = rColor;
1215 const Color&
1216 StyleSettings::GetMenuBorderColor() const
1218 return mxData->maMenuBorderColor;
1221 void
1222 StyleSettings::SetMenuTextColor( const Color& rColor )
1224 CopyData();
1225 mxData->maMenuTextColor = rColor;
1228 const Color&
1229 StyleSettings::GetMenuTextColor() const
1231 return mxData->maMenuTextColor;
1234 void
1235 StyleSettings::SetMenuBarTextColor( const Color& rColor )
1237 CopyData();
1238 mxData->maMenuBarTextColor = rColor;
1241 const Color&
1242 StyleSettings::GetMenuBarTextColor() const
1244 return mxData->maMenuBarTextColor;
1247 void
1248 StyleSettings::SetMenuBarRolloverTextColor( const Color& rColor )
1250 CopyData();
1251 mxData->maMenuBarRolloverTextColor = rColor;
1254 const Color&
1255 StyleSettings::GetMenuBarRolloverTextColor() const
1257 return mxData->maMenuBarRolloverTextColor;
1260 void
1261 StyleSettings::SetMenuBarHighlightTextColor( const Color& rColor )
1263 CopyData();
1264 mxData->maMenuBarHighlightTextColor = rColor;
1267 const Color&
1268 StyleSettings::GetMenuBarHighlightTextColor() const
1270 return mxData->maMenuBarHighlightTextColor;
1273 void
1274 StyleSettings::SetMenuHighlightColor( const Color& rColor )
1276 CopyData();
1277 mxData->maMenuHighlightColor = rColor;
1280 const Color&
1281 StyleSettings::GetMenuHighlightColor() const
1283 return mxData->maMenuHighlightColor;
1286 void
1287 StyleSettings::SetMenuHighlightTextColor( const Color& rColor )
1289 CopyData();
1290 mxData->maMenuHighlightTextColor = rColor;
1293 const Color&
1294 StyleSettings::GetMenuHighlightTextColor() const
1296 return mxData->maMenuHighlightTextColor;
1299 void
1300 StyleSettings::SetTabTextColor( const Color& rColor )
1302 CopyData();
1303 mxData->maTabTextColor = rColor;
1306 const Color&
1307 StyleSettings::GetTabTextColor() const
1309 return mxData->maTabTextColor;
1312 void
1313 StyleSettings::SetTabRolloverTextColor( const Color& rColor )
1315 CopyData();
1316 mxData->maTabRolloverTextColor = rColor;
1319 const Color&
1320 StyleSettings::GetTabRolloverTextColor() const
1322 return mxData->maTabRolloverTextColor;
1325 void
1326 StyleSettings::SetTabHighlightTextColor( const Color& rColor )
1328 CopyData();
1329 mxData->maTabHighlightTextColor = rColor;
1332 const Color&
1333 StyleSettings::GetTabHighlightTextColor() const
1335 return mxData->maTabHighlightTextColor;
1338 void
1339 StyleSettings::SetLinkColor( const Color& rColor )
1341 CopyData();
1342 mxData->maLinkColor = rColor;
1345 const Color&
1346 StyleSettings::GetLinkColor() const
1348 return mxData->maLinkColor;
1351 void
1352 StyleSettings::SetVisitedLinkColor( const Color& rColor )
1354 CopyData();
1355 mxData->maVisitedLinkColor = rColor;
1358 const Color&
1359 StyleSettings::GetVisitedLinkColor() const
1361 return mxData->maVisitedLinkColor;
1364 void
1365 StyleSettings::SetToolTextColor( const Color& rColor )
1367 CopyData();
1368 mxData->maToolTextColor = rColor;
1371 const Color&
1372 StyleSettings::GetToolTextColor() const
1374 return mxData->maToolTextColor;
1377 const Color&
1378 StyleSettings::GetHighlightLinkColor() const
1380 return mxData->maHighlightLinkColor;
1383 void
1384 StyleSettings::SetMonoColor( const Color& rColor )
1386 CopyData();
1387 mxData->maMonoColor = rColor;
1390 const Color&
1391 StyleSettings::GetMonoColor() const
1393 return mxData->maMonoColor;
1396 void
1397 StyleSettings::SetActiveTabColor( const Color& rColor )
1399 CopyData();
1400 mxData->maActiveTabColor = rColor;
1403 const Color&
1404 StyleSettings::GetActiveTabColor() const
1406 return mxData->maActiveTabColor;
1409 void
1410 StyleSettings::SetInactiveTabColor( const Color& rColor )
1412 CopyData();
1413 mxData->maInactiveTabColor = rColor;
1416 const Color&
1417 StyleSettings::GetInactiveTabColor() const
1419 return mxData->maInactiveTabColor;
1422 const Color&
1423 StyleSettings::GetAlternatingRowColor() const
1425 return mxData->maAlternatingRowColor;
1428 void
1429 StyleSettings::SetUseSystemUIFonts( bool bUseSystemUIFonts )
1431 CopyData();
1432 mxData->mbUseSystemUIFonts = bUseSystemUIFonts;
1435 bool
1436 StyleSettings::GetUseSystemUIFonts() const
1438 return mxData->mbUseSystemUIFonts;
1441 void
1442 StyleSettings::SetUseFlatBorders( bool bUseFlatBorders )
1444 CopyData();
1445 mxData->mnUseFlatBorders = bUseFlatBorders;
1448 bool
1449 StyleSettings::GetUseFlatBorders() const
1451 return (bool) mxData->mnUseFlatBorders;
1454 void
1455 StyleSettings::SetUseFlatMenus( bool bUseFlatMenus )
1457 CopyData();
1458 mxData->mnUseFlatMenus = bUseFlatMenus;
1461 bool
1462 StyleSettings::GetUseFlatMenus() const
1464 return (bool) mxData->mnUseFlatMenus;
1467 void
1468 StyleSettings::SetUseImagesInMenus( TriState eUseImagesInMenus )
1470 CopyData();
1471 mxData->meUseImagesInMenus = eUseImagesInMenus;
1474 void
1475 StyleSettings::SetPreferredUseImagesInMenus( bool bPreferredUseImagesInMenus )
1477 CopyData();
1478 mxData->mbPreferredUseImagesInMenus = bPreferredUseImagesInMenus;
1481 bool
1482 StyleSettings::GetPreferredUseImagesInMenus() const
1484 return mxData->mbPreferredUseImagesInMenus;
1487 void
1488 StyleSettings::SetSkipDisabledInMenus( bool bSkipDisabledInMenus )
1490 CopyData();
1491 mxData->mbSkipDisabledInMenus = bSkipDisabledInMenus;
1494 bool
1495 StyleSettings::GetSkipDisabledInMenus() const
1497 return mxData->mbSkipDisabledInMenus;
1500 void
1501 StyleSettings::SetHideDisabledMenuItems( bool bHideDisabledMenuItems )
1503 CopyData();
1504 mxData->mbHideDisabledMenuItems = bHideDisabledMenuItems;
1507 bool
1508 StyleSettings::GetHideDisabledMenuItems() const
1510 return mxData->mbHideDisabledMenuItems;
1513 void
1514 StyleSettings::SetContextMenuShortcuts( TriState eContextMenuShortcuts )
1516 CopyData();
1517 mxData->meContextMenuShortcuts = eContextMenuShortcuts;
1520 bool
1521 StyleSettings::GetContextMenuShortcuts() const
1523 switch (mxData->meContextMenuShortcuts)
1525 case TRISTATE_FALSE:
1526 return false;
1527 case TRISTATE_TRUE:
1528 return true;
1529 default: // TRISTATE_INDET:
1530 return GetPreferredUseImagesInMenus();
1534 void
1535 StyleSettings::SetPreferredContextMenuShortcuts( bool bContextMenuShortcuts )
1537 CopyData();
1538 mxData->mbPreferredContextMenuShortcuts = bContextMenuShortcuts;
1541 void
1542 StyleSettings::SetPrimaryButtonWarpsSlider( bool bPrimaryButtonWarpsSlider )
1544 CopyData();
1545 mxData->mbPrimaryButtonWarpsSlider = bPrimaryButtonWarpsSlider;
1548 bool
1549 StyleSettings::GetPrimaryButtonWarpsSlider() const
1551 return mxData->mbPrimaryButtonWarpsSlider;
1554 void
1555 StyleSettings::SetAppFont( const vcl::Font& rFont )
1557 CopyData();
1558 mxData->maAppFont = rFont;
1561 const vcl::Font&
1562 StyleSettings::GetAppFont() const
1564 return mxData->maAppFont;
1567 void
1568 StyleSettings::SetHelpFont( const vcl::Font& rFont )
1570 CopyData();
1571 mxData->maHelpFont = rFont;
1574 const vcl::Font&
1575 StyleSettings::GetHelpFont() const
1577 return mxData->maHelpFont;
1580 void
1581 StyleSettings::SetTitleFont( const vcl::Font& rFont )
1583 CopyData();
1584 mxData->maTitleFont = rFont;
1587 const vcl::Font&
1588 StyleSettings::GetTitleFont() const
1590 return mxData->maTitleFont;
1593 void
1594 StyleSettings::SetFloatTitleFont( const vcl::Font& rFont )
1596 CopyData();
1597 mxData->maFloatTitleFont = rFont;
1600 const vcl::Font&
1601 StyleSettings::GetFloatTitleFont() const
1603 return mxData->maFloatTitleFont;
1606 void
1607 StyleSettings::SetMenuFont( const vcl::Font& rFont )
1609 CopyData();
1610 mxData->maMenuFont = rFont;
1613 const vcl::Font&
1614 StyleSettings::GetMenuFont() const
1616 return mxData->maMenuFont;
1619 void
1620 StyleSettings::SetToolFont( const vcl::Font& rFont )
1622 CopyData();
1623 mxData->maToolFont = rFont;
1626 const vcl::Font&
1627 StyleSettings::GetToolFont() const
1629 return mxData->maToolFont;
1632 void
1633 StyleSettings::SetGroupFont( const vcl::Font& rFont )
1635 CopyData();
1636 mxData->maGroupFont = rFont;
1639 const vcl::Font&
1640 StyleSettings::GetGroupFont() const
1642 return mxData->maGroupFont;
1645 void
1646 StyleSettings::SetLabelFont( const vcl::Font& rFont )
1648 CopyData();
1649 mxData->maLabelFont = rFont;
1652 const vcl::Font&
1653 StyleSettings::GetLabelFont() const
1655 return mxData->maLabelFont;
1658 void
1659 StyleSettings::SetRadioCheckFont( const vcl::Font& rFont )
1661 CopyData();
1662 mxData->maRadioCheckFont = rFont;
1665 const vcl::Font&
1666 StyleSettings::GetRadioCheckFont() const
1668 return mxData->maRadioCheckFont;
1671 void
1672 StyleSettings::SetPushButtonFont( const vcl::Font& rFont )
1674 CopyData();
1675 mxData->maPushButtonFont = rFont;
1678 const vcl::Font&
1679 StyleSettings::GetPushButtonFont() const
1681 return mxData->maPushButtonFont;
1684 void
1685 StyleSettings::SetFieldFont( const vcl::Font& rFont )
1687 CopyData();
1688 mxData->maFieldFont = rFont;
1691 const vcl::Font&
1692 StyleSettings::GetFieldFont() const
1694 return mxData->maFieldFont;
1697 void
1698 StyleSettings::SetIconFont( const vcl::Font& rFont )
1700 CopyData();
1701 mxData->maIconFont = rFont;
1704 const vcl::Font&
1705 StyleSettings::GetIconFont() const
1707 return mxData->maIconFont;
1710 void
1711 StyleSettings::SetTabFont( const vcl::Font& rFont )
1713 CopyData();
1714 mxData->maTabFont = rFont;
1717 const vcl::Font&
1718 StyleSettings::GetTabFont() const
1720 return mxData->maTabFont;
1723 long
1724 StyleSettings::GetBorderSize() const
1726 return mxData->mnBorderSize;
1729 void
1730 StyleSettings::SetTitleHeight( long nSize )
1732 CopyData();
1733 mxData->mnTitleHeight = nSize;
1736 long
1737 StyleSettings::GetTitleHeight() const
1739 return mxData->mnTitleHeight;
1742 void
1743 StyleSettings::SetFloatTitleHeight( long nSize )
1745 CopyData();
1746 mxData->mnFloatTitleHeight = nSize;
1749 long
1750 StyleSettings::GetFloatTitleHeight() const
1752 return mxData->mnFloatTitleHeight;
1755 long
1756 StyleSettings::GetTearOffTitleHeight() const
1758 return mxData->mnTearOffTitleHeight;
1761 void
1762 StyleSettings::SetScrollBarSize( long nSize )
1764 CopyData();
1765 mxData->mnScrollBarSize = nSize;
1768 long
1769 StyleSettings::GetScrollBarSize() const
1771 return mxData->mnScrollBarSize;
1774 void
1775 StyleSettings::SetMinThumbSize( long nSize )
1777 CopyData();
1778 mxData->mnMinThumbSize = nSize;
1781 long
1782 StyleSettings::GetMinThumbSize() const
1784 return mxData->mnMinThumbSize;
1787 void
1788 StyleSettings::SetSpinSize( long nSize )
1790 CopyData();
1791 mxData->mnSpinSize = nSize;
1794 long
1795 StyleSettings::GetSpinSize() const
1797 return mxData->mnSpinSize;
1800 long
1801 StyleSettings::GetSplitSize() const
1803 return mxData->mnSplitSize;
1806 void
1807 StyleSettings::SetCursorSize( long nSize )
1809 CopyData();
1810 mxData->mnCursorSize = nSize;
1813 long
1814 StyleSettings::GetCursorSize() const
1816 return mxData->mnCursorSize;
1819 void
1820 StyleSettings::SetCursorBlinkTime( sal_uInt64 nBlinkTime )
1822 CopyData();
1823 mxData->mnCursorBlinkTime = nBlinkTime;
1826 sal_uInt64
1827 StyleSettings::GetCursorBlinkTime() const
1829 return (long) mxData->mnCursorBlinkTime;
1832 void
1833 StyleSettings::SetDragFullOptions( DragFullOptions nOptions )
1835 CopyData();
1836 mxData->mnDragFullOptions = nOptions;
1839 DragFullOptions
1840 StyleSettings::GetDragFullOptions() const
1842 return mxData->mnDragFullOptions;
1845 void
1846 StyleSettings::SetSelectionOptions( SelectionOptions nOptions )
1848 CopyData();
1849 mxData->mnSelectionOptions = nOptions;
1852 SelectionOptions
1853 StyleSettings::GetSelectionOptions() const
1855 return mxData->mnSelectionOptions;
1858 void
1859 StyleSettings::SetDisplayOptions( DisplayOptions nOptions )
1861 CopyData();
1862 mxData->mnDisplayOptions = nOptions;
1865 DisplayOptions
1866 StyleSettings::GetDisplayOptions() const
1868 return mxData->mnDisplayOptions;
1871 void
1872 StyleSettings::SetAntialiasingMinPixelHeight( long nMinPixel )
1874 CopyData();
1875 mxData->mnAntialiasedMin = nMinPixel;
1878 sal_uLong
1879 StyleSettings::GetAntialiasingMinPixelHeight() const
1881 return mxData->mnAntialiasedMin;
1884 void
1885 StyleSettings::SetOptions( StyleSettingsOptions nOptions )
1887 CopyData();
1888 mxData->mnOptions = nOptions;
1891 void
1892 StyleSettings::SetAutoMnemonic( bool bAutoMnemonic )
1894 CopyData();
1895 mxData->mbAutoMnemonic = bAutoMnemonic;
1898 bool
1899 StyleSettings::GetAutoMnemonic() const
1901 return mxData->mbAutoMnemonic;
1904 bool
1905 StyleSettings::GetDockingFloatsSupported()
1907 ImplSVData* pSVData = ImplGetSVData();
1908 return pSVData->maNWFData.mbCanDetermineWindowPosition;
1911 void
1912 StyleSettings::SetFontColor( const Color& rColor )
1914 CopyData();
1915 mxData->maFontColor = rColor;
1918 const Color&
1919 StyleSettings::GetFontColor() const
1921 return mxData->maFontColor;
1924 void
1925 StyleSettings::SetToolbarIconSize( ToolbarIconSize nSize )
1927 CopyData();
1928 mxData->mnToolbarIconSize = nSize;
1931 ToolbarIconSize
1932 StyleSettings::GetToolbarIconSize() const
1934 return mxData->mnToolbarIconSize;
1937 const DialogStyle&
1938 StyleSettings::GetDialogStyle() const
1940 return mxData->maDialogStyle;
1943 void
1944 StyleSettings::SetDialogStyle( const DialogStyle& rStyle )
1946 CopyData();
1947 mxData->maDialogStyle = rStyle;
1950 const FrameStyle&
1951 StyleSettings::GetFrameStyle() const
1953 return mxData->maFrameStyle;
1956 void
1957 StyleSettings::SetFrameStyle( const FrameStyle& rStyle )
1959 CopyData();
1960 mxData->maFrameStyle = rStyle;
1963 void
1964 StyleSettings::SetEdgeBlending(sal_uInt16 nCount)
1966 CopyData();
1967 mxData->mnEdgeBlending = nCount;
1970 sal_uInt16
1971 StyleSettings::GetEdgeBlending() const
1973 return mxData->mnEdgeBlending;
1976 const Color&
1977 StyleSettings::GetEdgeBlendingTopLeftColor() const
1979 return mxData->maEdgeBlendingTopLeftColor;
1982 const Color&
1983 StyleSettings::GetEdgeBlendingBottomRightColor() const
1985 return mxData->maEdgeBlendingBottomRightColor;
1988 void
1989 StyleSettings::SetListBoxMaximumLineCount(sal_uInt16 nCount)
1991 CopyData();
1992 mxData->mnListBoxMaximumLineCount = nCount;
1995 sal_uInt16
1996 StyleSettings::GetListBoxMaximumLineCount() const
1998 return mxData->mnListBoxMaximumLineCount;
2001 void
2002 StyleSettings::SetColorValueSetColumnCount(sal_uInt16 nCount)
2004 CopyData();
2005 mxData->mnColorValueSetColumnCount = nCount;
2008 sal_uInt16
2009 StyleSettings::GetColorValueSetColumnCount() const
2011 return mxData->mnColorValueSetColumnCount;
2014 sal_uInt16
2015 StyleSettings::GetColorValueSetMaximumRowCount() const
2017 return mxData->mnColorValueSetMaximumRowCount;
2020 sal_uInt16
2021 StyleSettings::GetListBoxPreviewDefaultLineWidth() const
2023 return mxData->mnListBoxPreviewDefaultLineWidth;
2026 void
2027 StyleSettings::SetPreviewUsesCheckeredBackground(bool bNew)
2029 CopyData();
2030 mxData->mbPreviewUsesCheckeredBackground = bNew;
2033 bool
2034 StyleSettings::GetPreviewUsesCheckeredBackground() const
2036 return mxData->mbPreviewUsesCheckeredBackground;
2039 bool
2040 StyleSettings::operator !=( const StyleSettings& rSet ) const
2042 return !(*this == rSet);
2045 const Size& StyleSettings::GetListBoxPreviewDefaultPixelSize() const
2047 if(0 == mxData->maListBoxPreviewDefaultPixelSize.Width() || 0 == mxData->maListBoxPreviewDefaultPixelSize.Height())
2049 const_cast< StyleSettings* >(this)->mxData->maListBoxPreviewDefaultPixelSize =
2050 Application::GetDefaultDevice()->LogicToPixel(mxData->maListBoxPreviewDefaultLogicSize, MapUnit::MapAppFont);
2053 return mxData->maListBoxPreviewDefaultPixelSize;
2056 void StyleSettings::Set3DColors( const Color& rColor )
2058 CopyData();
2059 mxData->maFaceColor = rColor;
2060 mxData->maLightBorderColor = rColor;
2061 mxData->maMenuBorderColor = rColor;
2062 mxData->maDarkShadowColor = Color( COL_BLACK );
2063 if ( rColor != Color( COL_LIGHTGRAY ) )
2065 mxData->maLightColor = rColor;
2066 mxData->maShadowColor = rColor;
2067 mxData->maDarkShadowColor=rColor;
2068 mxData->maLightColor.IncreaseLuminance( 64 );
2069 mxData->maShadowColor.DecreaseLuminance( 64 );
2070 mxData->maDarkShadowColor.DecreaseLuminance( 100 );
2071 sal_uLong nRed = mxData->maLightColor.GetRed();
2072 sal_uLong nGreen = mxData->maLightColor.GetGreen();
2073 sal_uLong nBlue = mxData->maLightColor.GetBlue();
2074 nRed += (sal_uLong)(mxData->maShadowColor.GetRed());
2075 nGreen += (sal_uLong)(mxData->maShadowColor.GetGreen());
2076 nBlue += (sal_uLong)(mxData->maShadowColor.GetBlue());
2077 mxData->maCheckedColor = Color( (sal_uInt8)(nRed/2), (sal_uInt8)(nGreen/2), (sal_uInt8)(nBlue/2) );
2079 else
2081 mxData->maCheckedColor = Color( 0x99, 0x99, 0x99 );
2082 mxData->maLightColor = Color( COL_WHITE );
2083 mxData->maShadowColor = Color( COL_GRAY );
2087 void StyleSettings::SetCheckedColorSpecialCase( )
2089 CopyData();
2090 // Light gray checked color special case
2091 if ( GetFaceColor() == COL_LIGHTGRAY )
2092 mxData->maCheckedColor = Color( 0xCC, 0xCC, 0xCC );
2093 else
2095 sal_uInt8 nRed = (sal_uInt8)(((sal_uInt16)mxData->maFaceColor.GetRed() + (sal_uInt16)mxData->maLightColor.GetRed())/2);
2096 sal_uInt8 nGreen = (sal_uInt8)(((sal_uInt16)mxData->maFaceColor.GetGreen() + (sal_uInt16)mxData->maLightColor.GetGreen())/2);
2097 sal_uInt8 nBlue = (sal_uInt8)(((sal_uInt16)mxData->maFaceColor.GetBlue() + (sal_uInt16)mxData->maLightColor.GetBlue())/2);
2098 mxData->maCheckedColor = Color( nRed, nGreen, nBlue );
2102 bool StyleSettings::GetUseImagesInMenus() const
2104 // icon mode selected in Tools -> Options... -> OpenOffice.org -> View
2105 switch (mxData->meUseImagesInMenus) {
2106 case TRISTATE_FALSE:
2107 return false;
2108 case TRISTATE_TRUE:
2109 return true;
2110 default: // TRISTATE_INDET:
2111 return GetPreferredUseImagesInMenus();
2115 static BitmapEx readBitmapEx( const OUString& rPath )
2117 OUString aPath( rPath );
2118 rtl::Bootstrap::expandMacros( aPath );
2120 // import the image
2121 Graphic aGraphic;
2122 if ( GraphicFilter::LoadGraphic( aPath, OUString(), aGraphic ) != GRFILTER_OK )
2123 return BitmapEx();
2124 return aGraphic.GetBitmapEx();
2127 enum WhichPersona { PERSONA_HEADER, PERSONA_FOOTER };
2129 /** Update the setting of the Persona header / footer in ImplStyleData */
2130 static void setupPersonaHeaderFooter( WhichPersona eWhich, OUString& rHeaderFooter, BitmapEx& rHeaderFooterBitmap, boost::optional<Color>& rMenuBarTextColor )
2132 uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
2133 if ( !xContext.is() )
2134 return;
2136 // don't burn time loading images we don't need.
2137 if ( Application::IsHeadlessModeEnabled() )
2138 return;
2140 // read from the configuration
2141 OUString aPersona( officecfg::Office::Common::Misc::Persona::get( xContext ) );
2142 OUString aPersonaSettings( officecfg::Office::Common::Misc::PersonaSettings::get( xContext ) );
2144 // have the settings changed? marks if header /footer prepared before
2145 //should maybe extended to a flag that marks if header /footer /both are loaded
2146 OUString aOldValue= eWhich==PERSONA_HEADER?OUString(aPersona + ";" + aPersonaSettings+";h" ):OUString(aPersona + ";" + aPersonaSettings+";f" );
2147 if ( rHeaderFooter == aOldValue )
2148 return;
2150 rHeaderFooter = aOldValue;
2151 rHeaderFooterBitmap = BitmapEx();
2152 rMenuBarTextColor = boost::none;
2154 // now read the new values and setup bitmaps
2155 OUString aHeader, aFooter;
2156 if ( aPersona == "own" || aPersona == "default" )
2158 sal_Int32 nIndex = 0;
2159 aHeader = aPersonaSettings.getToken( 0, ';', nIndex );
2160 if ( nIndex > 0 )
2161 aFooter = aPersonaSettings.getToken( 0, ';', nIndex );
2163 // change menu text color, advance nIndex to skip the '#'
2164 if ( nIndex > 0 )
2166 OUString aColor = aPersonaSettings.getToken( 0, ';', ++nIndex );
2167 rMenuBarTextColor = Color( aColor.toUInt64( 16 ) );
2171 OUString aName;
2172 switch ( eWhich ) {
2173 case PERSONA_HEADER: aName = aHeader; break;
2174 case PERSONA_FOOTER: aName = aFooter; break;
2177 if ( !aName.isEmpty() )
2179 OUString gallery("");
2180 // try the gallery first, then the program path:
2181 if ( aPersona == "own" && !aPersonaSettings.startsWith( "vnd.sun.star.expand" ) )
2183 gallery = "${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE( "bootstrap") "::UserInstallation}";
2184 rtl::Bootstrap::expandMacros( gallery );
2185 gallery += "/user/gallery/personas/";
2187 else if ( aPersona == "default" )
2189 gallery = "$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER;
2190 gallery += "/gallery/personas/";
2192 rHeaderFooterBitmap = readBitmapEx( gallery + aName );
2194 if ( rHeaderFooterBitmap.IsEmpty() )
2195 rHeaderFooterBitmap = readBitmapEx( "$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" + aName );
2198 // Something went wrong. Probably, the images are missing. Clear the persona properties in the registry.
2200 if( rHeaderFooterBitmap.IsEmpty() )
2202 std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
2203 officecfg::Office::Common::Misc::Persona::set( "no", batch );
2204 officecfg::Office::Common::Misc::PersonaSettings::set( "", batch );
2205 batch->commit();
2209 const BitmapEx StyleSettings::GetPersonaHeader() const
2211 setupPersonaHeaderFooter( PERSONA_HEADER, mxData->maPersonaHeaderFooter, mxData->maPersonaHeaderBitmap, mxData->maPersonaMenuBarTextColor );
2212 return mxData->maPersonaHeaderBitmap;
2215 const BitmapEx StyleSettings::GetPersonaFooter() const
2217 setupPersonaHeaderFooter( PERSONA_FOOTER, mxData->maPersonaHeaderFooter, mxData->maPersonaFooterBitmap, mxData->maPersonaMenuBarTextColor );
2218 return mxData->maPersonaFooterBitmap;
2221 const boost::optional<Color>& StyleSettings::GetPersonaMenuBarTextColor() const
2223 GetPersonaHeader();
2224 return mxData->maPersonaMenuBarTextColor;
2227 void StyleSettings::SetStandardStyles()
2229 CopyData();
2230 mxData->SetStandardStyles();
2233 Color StyleSettings::GetFaceGradientColor() const
2235 // compute a brighter face color that can be used in gradients
2236 // for a convex look (eg toolbars)
2238 sal_uInt16 h, s, b;
2239 GetFaceColor().RGBtoHSB( h, s, b );
2240 if( s > 1) s=1;
2241 if( b < 98) b=98;
2242 return Color( Color::HSBtoRGB( h, s, b ) );
2245 Color StyleSettings::GetSeparatorColor() const
2247 // compute a brighter shadow color for separators (used in toolbars or between menubar and toolbars on Windows XP)
2248 sal_uInt16 h, s, b;
2249 GetShadowColor().RGBtoHSB( h, s, b );
2250 b += b/4;
2251 s -= s/4;
2252 return Color( Color::HSBtoRGB( h, s, b ) );
2255 void StyleSettings::CopyData()
2257 // copy if other references exist
2258 if ( ! mxData.unique() ) {
2259 mxData = std::make_shared<ImplStyleData>(*mxData);
2263 bool StyleSettings::operator ==( const StyleSettings& rSet ) const
2265 if ( mxData == rSet.mxData )
2266 return true;
2268 if (mxData->mIconTheme != rSet.mxData->mIconTheme) {
2269 return false;
2272 if (*mxData->mIconThemeSelector != *rSet.mxData->mIconThemeSelector) {
2273 return false;
2276 if ( (mxData->mnOptions == rSet.mxData->mnOptions) &&
2277 (mxData->mbAutoMnemonic == rSet.mxData->mbAutoMnemonic) &&
2278 (mxData->mnDragFullOptions == rSet.mxData->mnDragFullOptions) &&
2279 (mxData->mnSelectionOptions == rSet.mxData->mnSelectionOptions) &&
2280 (mxData->mnDisplayOptions == rSet.mxData->mnDisplayOptions) &&
2281 (mxData->mnCursorSize == rSet.mxData->mnCursorSize) &&
2282 (mxData->mnCursorBlinkTime == rSet.mxData->mnCursorBlinkTime) &&
2283 (mxData->mnBorderSize == rSet.mxData->mnBorderSize) &&
2284 (mxData->mnTitleHeight == rSet.mxData->mnTitleHeight) &&
2285 (mxData->mnFloatTitleHeight == rSet.mxData->mnFloatTitleHeight) &&
2286 (mxData->mnTearOffTitleHeight == rSet.mxData->mnTearOffTitleHeight) &&
2287 (mxData->mnScrollBarSize == rSet.mxData->mnScrollBarSize) &&
2288 (mxData->mnMinThumbSize == rSet.mxData->mnMinThumbSize) &&
2289 (mxData->mnSplitSize == rSet.mxData->mnSplitSize) &&
2290 (mxData->mnSpinSize == rSet.mxData->mnSpinSize) &&
2291 (mxData->mnAntialiasedMin == rSet.mxData->mnAntialiasedMin) &&
2292 (mxData->mbHighContrast == rSet.mxData->mbHighContrast) &&
2293 (mxData->mbUseSystemUIFonts == rSet.mxData->mbUseSystemUIFonts) &&
2294 (mxData->mnUseFlatBorders == rSet.mxData->mnUseFlatBorders) &&
2295 (mxData->mnUseFlatMenus == rSet.mxData->mnUseFlatMenus) &&
2296 (mxData->maFaceColor == rSet.mxData->maFaceColor) &&
2297 (mxData->maCheckedColor == rSet.mxData->maCheckedColor) &&
2298 (mxData->maLightColor == rSet.mxData->maLightColor) &&
2299 (mxData->maLightBorderColor == rSet.mxData->maLightBorderColor) &&
2300 (mxData->maShadowColor == rSet.mxData->maShadowColor) &&
2301 (mxData->maDarkShadowColor == rSet.mxData->maDarkShadowColor) &&
2302 (mxData->maButtonTextColor == rSet.mxData->maButtonTextColor) &&
2303 (mxData->maRadioCheckTextColor == rSet.mxData->maRadioCheckTextColor) &&
2304 (mxData->maGroupTextColor == rSet.mxData->maGroupTextColor) &&
2305 (mxData->maLabelTextColor == rSet.mxData->maLabelTextColor) &&
2306 (mxData->maWindowColor == rSet.mxData->maWindowColor) &&
2307 (mxData->maWindowTextColor == rSet.mxData->maWindowTextColor) &&
2308 (mxData->maDialogColor == rSet.mxData->maDialogColor) &&
2309 (mxData->maDialogTextColor == rSet.mxData->maDialogTextColor) &&
2310 (mxData->maWorkspaceColor == rSet.mxData->maWorkspaceColor) &&
2311 (mxData->maMonoColor == rSet.mxData->maMonoColor) &&
2312 (mxData->maFieldColor == rSet.mxData->maFieldColor) &&
2313 (mxData->maFieldTextColor == rSet.mxData->maFieldTextColor) &&
2314 (mxData->maActiveColor == rSet.mxData->maActiveColor) &&
2315 (mxData->maActiveTextColor == rSet.mxData->maActiveTextColor) &&
2316 (mxData->maActiveBorderColor == rSet.mxData->maActiveBorderColor) &&
2317 (mxData->maDeactiveColor == rSet.mxData->maDeactiveColor) &&
2318 (mxData->maDeactiveTextColor == rSet.mxData->maDeactiveTextColor) &&
2319 (mxData->maDeactiveBorderColor == rSet.mxData->maDeactiveBorderColor) &&
2320 (mxData->maMenuColor == rSet.mxData->maMenuColor) &&
2321 (mxData->maMenuBarColor == rSet.mxData->maMenuBarColor) &&
2322 (mxData->maMenuBarRolloverColor == rSet.mxData->maMenuBarRolloverColor) &&
2323 (mxData->maMenuBorderColor == rSet.mxData->maMenuBorderColor) &&
2324 (mxData->maMenuTextColor == rSet.mxData->maMenuTextColor) &&
2325 (mxData->maMenuBarTextColor == rSet.mxData->maMenuBarTextColor) &&
2326 (mxData->maMenuBarRolloverTextColor == rSet.mxData->maMenuBarRolloverTextColor) &&
2327 (mxData->maMenuHighlightColor == rSet.mxData->maMenuHighlightColor) &&
2328 (mxData->maMenuHighlightTextColor == rSet.mxData->maMenuHighlightTextColor) &&
2329 (mxData->maHighlightColor == rSet.mxData->maHighlightColor) &&
2330 (mxData->maHighlightTextColor == rSet.mxData->maHighlightTextColor) &&
2331 (mxData->maTabTextColor == rSet.mxData->maTabTextColor) &&
2332 (mxData->maTabRolloverTextColor == rSet.mxData->maTabRolloverTextColor) &&
2333 (mxData->maTabHighlightTextColor == rSet.mxData->maTabHighlightTextColor) &&
2334 (mxData->maActiveTabColor == rSet.mxData->maActiveTabColor) &&
2335 (mxData->maInactiveTabColor == rSet.mxData->maInactiveTabColor) &&
2336 (mxData->maDisableColor == rSet.mxData->maDisableColor) &&
2337 (mxData->maHelpColor == rSet.mxData->maHelpColor) &&
2338 (mxData->maHelpTextColor == rSet.mxData->maHelpTextColor) &&
2339 (mxData->maLinkColor == rSet.mxData->maLinkColor) &&
2340 (mxData->maVisitedLinkColor == rSet.mxData->maVisitedLinkColor) &&
2341 (mxData->maToolTextColor == rSet.mxData->maToolTextColor) &&
2342 (mxData->maHighlightLinkColor == rSet.mxData->maHighlightLinkColor) &&
2343 (mxData->maAppFont == rSet.mxData->maAppFont) &&
2344 (mxData->maHelpFont == rSet.mxData->maHelpFont) &&
2345 (mxData->maTitleFont == rSet.mxData->maTitleFont) &&
2346 (mxData->maFloatTitleFont == rSet.mxData->maFloatTitleFont) &&
2347 (mxData->maMenuFont == rSet.mxData->maMenuFont) &&
2348 (mxData->maToolFont == rSet.mxData->maToolFont) &&
2349 (mxData->maGroupFont == rSet.mxData->maGroupFont) &&
2350 (mxData->maLabelFont == rSet.mxData->maLabelFont) &&
2351 (mxData->maRadioCheckFont == rSet.mxData->maRadioCheckFont) &&
2352 (mxData->maPushButtonFont == rSet.mxData->maPushButtonFont) &&
2353 (mxData->maFieldFont == rSet.mxData->maFieldFont) &&
2354 (mxData->maIconFont == rSet.mxData->maIconFont) &&
2355 (mxData->maTabFont == rSet.mxData->maTabFont) &&
2356 (mxData->meUseImagesInMenus == rSet.mxData->meUseImagesInMenus) &&
2357 (mxData->mbPreferredUseImagesInMenus == rSet.mxData->mbPreferredUseImagesInMenus) &&
2358 (mxData->mbSkipDisabledInMenus == rSet.mxData->mbSkipDisabledInMenus) &&
2359 (mxData->mbHideDisabledMenuItems == rSet.mxData->mbHideDisabledMenuItems) &&
2360 (mxData->mbPreferredContextMenuShortcuts == rSet.mxData->mbPreferredContextMenuShortcuts)&&
2361 (mxData->meContextMenuShortcuts == rSet.mxData->meContextMenuShortcuts) &&
2362 (mxData->mbPrimaryButtonWarpsSlider == rSet.mxData->mbPrimaryButtonWarpsSlider) &&
2363 (mxData->maFontColor == rSet.mxData->maFontColor) &&
2364 (mxData->mnEdgeBlending == rSet.mxData->mnEdgeBlending) &&
2365 (mxData->maEdgeBlendingTopLeftColor == rSet.mxData->maEdgeBlendingTopLeftColor) &&
2366 (mxData->maEdgeBlendingBottomRightColor == rSet.mxData->maEdgeBlendingBottomRightColor) &&
2367 (mxData->mnListBoxMaximumLineCount == rSet.mxData->mnListBoxMaximumLineCount) &&
2368 (mxData->mnColorValueSetColumnCount == rSet.mxData->mnColorValueSetColumnCount) &&
2369 (mxData->mnColorValueSetMaximumRowCount == rSet.mxData->mnColorValueSetMaximumRowCount) &&
2370 (mxData->maListBoxPreviewDefaultLogicSize == rSet.mxData->maListBoxPreviewDefaultLogicSize) &&
2371 (mxData->maListBoxPreviewDefaultPixelSize == rSet.mxData->maListBoxPreviewDefaultPixelSize) &&
2372 (mxData->mnListBoxPreviewDefaultLineWidth == rSet.mxData->mnListBoxPreviewDefaultLineWidth) &&
2373 (mxData->mbPreviewUsesCheckeredBackground == rSet.mxData->mbPreviewUsesCheckeredBackground))
2374 return true;
2375 else
2376 return false;
2379 ImplMiscData::ImplMiscData()
2381 mnEnableATT = TRISTATE_INDET;
2382 mnDisablePrinting = TRISTATE_INDET;
2383 static const char* pEnv = getenv("SAL_DECIMALSEP_ENABLED" ); // set default without UI
2384 mbEnableLocalizedDecimalSep = (pEnv != nullptr);
2385 // Should we display any windows?
2387 // need to hardly mask here for now, needs to be adapted of course...
2388 mbPseudoHeadless = getenv("VCL_HIDE_WINDOWS") || comphelper::LibreOfficeKit::isActive();
2391 ImplMiscData::ImplMiscData( const ImplMiscData& rData )
2393 mnEnableATT = rData.mnEnableATT;
2394 mnDisablePrinting = rData.mnDisablePrinting;
2395 mbEnableLocalizedDecimalSep = rData.mbEnableLocalizedDecimalSep;
2396 mbPseudoHeadless = rData.mbPseudoHeadless;
2399 MiscSettings::MiscSettings()
2400 : mxData(std::make_shared<ImplMiscData>())
2404 MiscSettings::~MiscSettings()
2408 bool MiscSettings::operator ==( const MiscSettings& rSet ) const
2410 if ( mxData == rSet.mxData )
2411 return true;
2413 if ( (mxData->mnEnableATT == rSet.mxData->mnEnableATT ) &&
2414 (mxData->mnDisablePrinting == rSet.mxData->mnDisablePrinting ) &&
2415 (mxData->mbEnableLocalizedDecimalSep == rSet.mxData->mbEnableLocalizedDecimalSep ) )
2416 return true;
2417 else
2418 return false;
2421 bool
2422 MiscSettings::operator !=( const MiscSettings& rSet ) const
2424 return !(*this == rSet);
2427 bool MiscSettings::GetDisablePrinting() const
2429 if( mxData->mnDisablePrinting == TRISTATE_INDET )
2431 OUString aEnable =
2432 vcl::SettingsConfigItem::get()->
2433 getValue( "DesktopManagement",
2434 "DisablePrinting" );
2435 mxData->mnDisablePrinting = aEnable.equalsIgnoreAsciiCase("true") ? TRISTATE_TRUE : TRISTATE_FALSE;
2438 return mxData->mnDisablePrinting != TRISTATE_FALSE;
2441 bool MiscSettings::GetEnableATToolSupport() const
2444 #ifdef _WIN32
2445 if( mxData->mnEnableATT == TRISTATE_INDET )
2447 // Check in the Windows registry if an AT tool wants Accessibility support to
2448 // be activated ..
2449 HKEY hkey;
2451 if( ERROR_SUCCESS == RegOpenKey(HKEY_CURRENT_USER,
2452 "Software\\LibreOffice\\Accessibility\\AtToolSupport",
2453 &hkey) )
2455 DWORD dwType;
2456 sal_uInt8 Data[6]; // possible values: "true", "false", "1", "0", DWORD
2457 DWORD cbData = sizeof(Data);
2459 if( ERROR_SUCCESS == RegQueryValueEx(hkey, "SupportAssistiveTechnology",
2460 nullptr, &dwType, Data, &cbData) )
2462 switch (dwType)
2464 case REG_SZ:
2465 mxData->mnEnableATT = ((0 == stricmp(reinterpret_cast<const char *>(Data), "1")) || (0 == stricmp(reinterpret_cast<const char *>(Data), "true"))) ? TRISTATE_TRUE : TRISTATE_FALSE;
2466 break;
2467 case REG_DWORD:
2468 switch (reinterpret_cast<DWORD *>(Data)[0]) {
2469 case 0:
2470 mxData->mnEnableATT = TRISTATE_FALSE;
2471 break;
2472 case 1:
2473 mxData->mnEnableATT = TRISTATE_TRUE;
2474 break;
2475 default:
2476 mxData->mnEnableATT = TRISTATE_INDET;
2477 //TODO: or TRISTATE_TRUE?
2478 break;
2480 break;
2481 default:
2482 // Unsupported registry type
2483 break;
2487 RegCloseKey(hkey);
2490 #endif
2492 if( mxData->mnEnableATT == TRISTATE_INDET )
2494 static const char* pEnv = getenv("SAL_ACCESSIBILITY_ENABLED" );
2495 if( !pEnv || !*pEnv )
2497 OUString aEnable =
2498 vcl::SettingsConfigItem::get()->
2499 getValue( "Accessibility",
2500 "EnableATToolSupport" );
2501 mxData->mnEnableATT = aEnable.equalsIgnoreAsciiCase("true") ? TRISTATE_TRUE : TRISTATE_FALSE;
2503 else
2505 mxData->mnEnableATT = TRISTATE_TRUE;
2509 return mxData->mnEnableATT != TRISTATE_FALSE;
2512 #ifdef _WIN32
2513 void MiscSettings::SetEnableATToolSupport( bool bEnable )
2515 if ( (bEnable ? TRISTATE_TRUE : TRISTATE_FALSE) != mxData->mnEnableATT )
2517 if( bEnable && !ImplInitAccessBridge() )
2518 return;
2520 HKEY hkey;
2522 // If the accessibility key in the Windows registry exists, change it synchronously
2523 if( ERROR_SUCCESS == RegOpenKey(HKEY_CURRENT_USER,
2524 "Software\\LibreOffice\\Accessibility\\AtToolSupport",
2525 &hkey) )
2527 DWORD dwType;
2528 sal_uInt8 Data[6]; // possible values: "true", "false", 1, 0
2529 DWORD cbData = sizeof(Data);
2531 if( ERROR_SUCCESS == RegQueryValueEx(hkey, "SupportAssistiveTechnology",
2532 nullptr, &dwType, Data, &cbData) )
2534 switch (dwType)
2536 case REG_SZ:
2537 RegSetValueEx(hkey, "SupportAssistiveTechnology",
2538 0, dwType,
2539 reinterpret_cast<sal_uInt8 const *>(bEnable ? "true" : "false"),
2540 bEnable ? sizeof("true") : sizeof("false"));
2541 break;
2542 case REG_DWORD:
2543 reinterpret_cast<DWORD *>(Data)[0] = bEnable ? 1 : 0;
2544 RegSetValueEx(hkey, "SupportAssistiveTechnology",
2545 0, dwType, Data, sizeof(DWORD));
2546 break;
2547 default:
2548 // Unsupported registry type
2549 break;
2553 RegCloseKey(hkey);
2556 vcl::SettingsConfigItem::get()->
2557 setValue( "Accessibility",
2558 "EnableATToolSupport",
2559 bEnable ? OUString("true") : OUString("false" ) );
2560 mxData->mnEnableATT = bEnable ? TRISTATE_TRUE : TRISTATE_FALSE;
2563 #endif
2565 void MiscSettings::SetEnableLocalizedDecimalSep( bool bEnable )
2567 // copy if other references exist
2568 if ( ! mxData.unique() ) {
2569 mxData = std::make_shared<ImplMiscData>(*mxData);
2571 mxData->mbEnableLocalizedDecimalSep = bEnable;
2574 bool MiscSettings::GetEnableLocalizedDecimalSep() const
2576 return mxData->mbEnableLocalizedDecimalSep;
2579 bool MiscSettings::GetPseudoHeadless() const
2581 return mxData->mbPseudoHeadless;
2584 ImplHelpData::ImplHelpData()
2586 mnTipDelay = 500;
2587 mnTipTimeout = 3000;
2588 mnBalloonDelay = 1500;
2591 ImplHelpData::ImplHelpData( const ImplHelpData& rData )
2593 mnTipDelay = rData.mnTipDelay;
2594 mnTipTimeout = rData.mnTipTimeout;
2595 mnBalloonDelay = rData.mnBalloonDelay;
2598 HelpSettings::HelpSettings()
2599 : mxData(std::make_shared<ImplHelpData>())
2603 HelpSettings::~HelpSettings()
2607 bool HelpSettings::operator ==( const HelpSettings& rSet ) const
2609 if ( mxData == rSet.mxData )
2610 return true;
2612 if ( (mxData->mnTipDelay == rSet.mxData->mnTipDelay ) &&
2613 (mxData->mnTipTimeout == rSet.mxData->mnTipTimeout ) &&
2614 (mxData->mnBalloonDelay == rSet.mxData->mnBalloonDelay ) )
2615 return true;
2616 else
2617 return false;
2620 sal_uLong
2621 HelpSettings::GetTipDelay() const
2623 return mxData->mnTipDelay;
2626 void
2627 HelpSettings::SetTipTimeout( sal_uLong nTipTimeout )
2629 // copy if other references exist
2630 if ( ! mxData.unique() ) {
2631 mxData = std::make_shared<ImplHelpData>(*mxData);
2633 mxData->mnTipTimeout = nTipTimeout;
2636 sal_uLong
2637 HelpSettings::GetTipTimeout() const
2639 return mxData->mnTipTimeout;
2642 sal_uLong
2643 HelpSettings::GetBalloonDelay() const
2645 return mxData->mnBalloonDelay;
2648 bool
2649 HelpSettings::operator !=( const HelpSettings& rSet ) const
2651 return !(*this == rSet);
2654 ImplAllSettingsData::ImplAllSettingsData()
2656 maLocale( LANGUAGE_SYSTEM ),
2657 maUILocale( LANGUAGE_SYSTEM )
2659 mnWindowUpdate = AllSettingsFlags::MOUSE | AllSettingsFlags::STYLE |
2660 AllSettingsFlags::MISC | AllSettingsFlags::LOCALE;
2661 mpLocaleDataWrapper = nullptr;
2662 mpUILocaleDataWrapper = nullptr;
2663 mpI18nHelper = nullptr;
2664 mpUII18nHelper = nullptr;
2665 if (!utl::ConfigManager::IsAvoidConfig())
2666 maMiscSettings.SetEnableLocalizedDecimalSep( maSysLocale.GetOptions().IsDecimalSeparatorAsLocale() );
2669 ImplAllSettingsData::ImplAllSettingsData( const ImplAllSettingsData& rData ) :
2670 maMouseSettings( rData.maMouseSettings ),
2671 maStyleSettings( rData.maStyleSettings ),
2672 maMiscSettings( rData.maMiscSettings ),
2673 maHelpSettings( rData.maHelpSettings ),
2674 maLocale( rData.maLocale ),
2675 maUILocale( rData.maUILocale )
2677 mnWindowUpdate = rData.mnWindowUpdate;
2678 // Pointer couldn't shared and objects haven't a copy ctor
2679 // So we create the cache objects new, if the GetFunction is
2680 // called
2681 mpLocaleDataWrapper = nullptr;
2682 mpUILocaleDataWrapper = nullptr;
2683 mpI18nHelper = nullptr;
2684 mpUII18nHelper = nullptr;
2687 ImplAllSettingsData::~ImplAllSettingsData()
2689 delete mpLocaleDataWrapper;
2690 delete mpUILocaleDataWrapper;
2691 delete mpI18nHelper;
2692 delete mpUII18nHelper;
2695 AllSettings::AllSettings()
2696 : mxData(std::make_shared<ImplAllSettingsData>())
2700 AllSettings::AllSettings( const AllSettings& rSet )
2702 mxData = rSet.mxData;
2705 AllSettings::~AllSettings()
2709 void AllSettings::CopyData()
2711 // copy if other references exist
2712 if ( ! mxData.unique() ) {
2713 mxData = std::make_shared<ImplAllSettingsData>(*mxData);
2718 AllSettingsFlags AllSettings::Update( AllSettingsFlags nFlags, const AllSettings& rSet )
2721 AllSettingsFlags nChangeFlags = AllSettingsFlags::NONE;
2723 if ( nFlags & AllSettingsFlags::MOUSE )
2725 if ( mxData->maMouseSettings != rSet.mxData->maMouseSettings )
2727 CopyData();
2728 mxData->maMouseSettings = rSet.mxData->maMouseSettings;
2729 nChangeFlags |= AllSettingsFlags::MOUSE;
2733 if ( nFlags & AllSettingsFlags::STYLE )
2735 if ( mxData->maStyleSettings != rSet.mxData->maStyleSettings )
2737 CopyData();
2738 mxData->maStyleSettings = rSet.mxData->maStyleSettings;
2739 nChangeFlags |= AllSettingsFlags::STYLE;
2743 if ( nFlags & AllSettingsFlags::MISC )
2745 if ( mxData->maMiscSettings != rSet.mxData->maMiscSettings )
2747 CopyData();
2748 mxData->maMiscSettings = rSet.mxData->maMiscSettings;
2749 nChangeFlags |= AllSettingsFlags::MISC;
2753 if ( nFlags & AllSettingsFlags::LOCALE )
2755 if ( mxData->maLocale != rSet.mxData->maLocale )
2757 SetLanguageTag( rSet.mxData->maLocale );
2758 nChangeFlags |= AllSettingsFlags::LOCALE;
2762 return nChangeFlags;
2765 AllSettingsFlags AllSettings::GetChangeFlags( const AllSettings& rSet ) const
2768 AllSettingsFlags nChangeFlags = AllSettingsFlags::NONE;
2770 if ( mxData->maStyleSettings != rSet.mxData->maStyleSettings )
2771 nChangeFlags |= AllSettingsFlags::STYLE;
2773 if ( mxData->maMiscSettings != rSet.mxData->maMiscSettings )
2774 nChangeFlags |= AllSettingsFlags::MISC;
2776 if ( mxData->maLocale != rSet.mxData->maLocale )
2777 nChangeFlags |= AllSettingsFlags::LOCALE;
2779 return nChangeFlags;
2782 bool AllSettings::operator ==( const AllSettings& rSet ) const
2784 if ( mxData == rSet.mxData )
2785 return true;
2787 if ( (mxData->maMouseSettings == rSet.mxData->maMouseSettings) &&
2788 (mxData->maStyleSettings == rSet.mxData->maStyleSettings) &&
2789 (mxData->maMiscSettings == rSet.mxData->maMiscSettings) &&
2790 (mxData->maHelpSettings == rSet.mxData->maHelpSettings) &&
2791 (mxData->maLocale == rSet.mxData->maLocale) &&
2792 (mxData->mnWindowUpdate == rSet.mxData->mnWindowUpdate) )
2794 return true;
2797 return false;
2800 void AllSettings::SetLanguageTag( const LanguageTag& rLanguageTag )
2802 if (mxData->maLocale != rLanguageTag)
2804 CopyData();
2806 mxData->maLocale = rLanguageTag;
2808 if ( mxData->mpLocaleDataWrapper )
2810 delete mxData->mpLocaleDataWrapper;
2811 mxData->mpLocaleDataWrapper = nullptr;
2813 if ( mxData->mpI18nHelper )
2815 delete mxData->mpI18nHelper;
2816 mxData->mpI18nHelper = nullptr;
2821 namespace
2823 bool GetConfigLayoutRTL(bool bMath)
2825 static const char* pEnv = getenv("SAL_RTL_ENABLED" );
2826 static int nUIMirroring = -1; // -1: undef, 0: auto, 1: on 2: off
2828 // environment always overrides
2829 if( pEnv )
2830 return true;
2832 bool bRTL = false;
2834 if( nUIMirroring == -1 )
2836 nUIMirroring = 0; // ask configuration only once
2837 utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithComponentContext(
2838 comphelper::getProcessComponentContext(),
2839 "org.openoffice.Office.Common/I18N/CTL" ); // note: case sensitive !
2840 if ( aNode.isValid() )
2842 bool bTmp = bool();
2843 css::uno::Any aValue = aNode.getNodeValue( OUString("UIMirroring") );
2844 if( aValue >>= bTmp )
2846 // found true or false; if it was nil, nothing is changed
2847 nUIMirroring = bTmp ? 1 : 2;
2852 if( nUIMirroring == 0 ) // no config found (eg, setup) or default (nil) was set: check language
2854 LanguageType aLang = LANGUAGE_DONTKNOW;
2855 ImplSVData* pSVData = ImplGetSVData();
2856 if ( pSVData->maAppData.mpSettings )
2857 aLang = pSVData->maAppData.mpSettings->GetUILanguageTag().getLanguageType();
2858 if (bMath)
2859 bRTL = MsLangId::isRightToLeftMath( aLang );
2860 else
2861 bRTL = MsLangId::isRightToLeft( aLang );
2863 else
2864 bRTL = (nUIMirroring == 1);
2866 return bRTL;
2870 bool AllSettings::GetLayoutRTL()
2872 if (utl::ConfigManager::IsAvoidConfig())
2873 return false;
2874 return GetConfigLayoutRTL(false);
2877 bool AllSettings::GetMathLayoutRTL()
2879 if (utl::ConfigManager::IsAvoidConfig())
2880 return false;
2881 return GetConfigLayoutRTL(true);
2884 const LanguageTag& AllSettings::GetLanguageTag() const
2886 if (utl::ConfigManager::IsAvoidConfig())
2888 static LanguageTag aRet("en-US");
2889 return aRet;
2892 if (comphelper::LibreOfficeKit::isActive())
2893 return comphelper::LibreOfficeKit::getLanguageTag();
2895 // SYSTEM locale means: use settings from SvtSysLocale that is resolved
2896 if ( mxData->maLocale.isSystemLocale() )
2897 mxData->maLocale = mxData->maSysLocale.GetLanguageTag();
2899 return mxData->maLocale;
2902 const LanguageTag& AllSettings::GetUILanguageTag() const
2904 if (utl::ConfigManager::IsAvoidConfig())
2906 static LanguageTag aRet("en-US");
2907 return aRet;
2910 if (comphelper::LibreOfficeKit::isActive())
2911 return comphelper::LibreOfficeKit::getLanguageTag();
2913 // the UILocale is never changed
2914 if ( mxData->maUILocale.isSystemLocale() )
2915 mxData->maUILocale = mxData->maSysLocale.GetUILanguageTag();
2917 return mxData->maUILocale;
2920 const LocaleDataWrapper& AllSettings::GetLocaleDataWrapper() const
2922 if ( !mxData->mpLocaleDataWrapper )
2923 const_cast<AllSettings*>(this)->mxData->mpLocaleDataWrapper = new LocaleDataWrapper(
2924 comphelper::getProcessComponentContext(), GetLanguageTag() );
2925 return *mxData->mpLocaleDataWrapper;
2928 const LocaleDataWrapper& AllSettings::GetUILocaleDataWrapper() const
2930 if ( !mxData->mpUILocaleDataWrapper )
2931 const_cast<AllSettings*>(this)->mxData->mpUILocaleDataWrapper = new LocaleDataWrapper(
2932 comphelper::getProcessComponentContext(), GetUILanguageTag() );
2933 return *mxData->mpUILocaleDataWrapper;
2936 const vcl::I18nHelper& AllSettings::GetLocaleI18nHelper() const
2938 if ( !mxData->mpI18nHelper ) {
2939 const_cast<AllSettings*>(this)->mxData->mpI18nHelper = new vcl::I18nHelper(
2940 comphelper::getProcessComponentContext(), GetLanguageTag() );
2942 return *mxData->mpI18nHelper;
2945 const vcl::I18nHelper& AllSettings::GetUILocaleI18nHelper() const
2947 if ( !mxData->mpUII18nHelper ) {
2948 const_cast<AllSettings*>(this)->mxData->mpUII18nHelper = new vcl::I18nHelper(
2949 comphelper::getProcessComponentContext(), GetUILanguageTag() );
2951 return *mxData->mpUII18nHelper;
2954 void AllSettings::LocaleSettingsChanged( ConfigurationHints nHint )
2956 AllSettings aAllSettings( Application::GetSettings() );
2957 if ( nHint & ConfigurationHints::DecSep )
2959 MiscSettings aMiscSettings = aAllSettings.GetMiscSettings();
2960 bool bIsDecSepAsLocale = aAllSettings.mxData->maSysLocale.GetOptions().IsDecimalSeparatorAsLocale();
2961 if ( aMiscSettings.GetEnableLocalizedDecimalSep() != bIsDecSepAsLocale )
2963 aMiscSettings.SetEnableLocalizedDecimalSep( bIsDecSepAsLocale );
2964 aAllSettings.SetMiscSettings( aMiscSettings );
2968 if ( nHint & ConfigurationHints::Locale )
2969 aAllSettings.SetLanguageTag( aAllSettings.mxData->maSysLocale.GetOptions().GetLanguageTag() );
2971 Application::SetSettings( aAllSettings );
2974 const StyleSettings&
2975 AllSettings::GetStyleSettings() const
2977 return mxData->maStyleSettings;
2980 StyleSettingsOptions
2981 StyleSettings::GetOptions() const
2983 return mxData->mnOptions;
2986 std::vector<vcl::IconThemeInfo>
2987 StyleSettings::GetInstalledIconThemes() const
2989 return mxData->mIconThemeScanner->GetFoundIconThemes();
2992 /*static*/ OUString
2993 StyleSettings::GetAutomaticallyChosenIconTheme() const
2995 OUString desktopEnvironment = Application::GetDesktopEnvironment();
2996 OUString themeName = mxData->mIconThemeSelector->SelectIconThemeForDesktopEnvironment(
2997 mxData->mIconThemeScanner->GetFoundIconThemes(),
2998 desktopEnvironment
3000 return themeName;
3003 void
3004 StyleSettings::SetIconTheme(const OUString& theme)
3006 CopyData();
3007 mxData->mIconTheme = theme;
3010 OUString
3011 StyleSettings::DetermineIconTheme() const
3013 OUString sTheme(mxData->mIconTheme);
3014 if (sTheme.isEmpty())
3016 // read from the configuration, or fallback to what the desktop wants
3017 uno::Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext());
3018 if (xContext.is())
3020 sTheme = officecfg::Office::Common::Misc::SymbolStyle::get(xContext);
3022 if (sTheme.isEmpty() || sTheme == "auto")
3023 sTheme = GetAutomaticallyChosenIconTheme();
3027 OUString r = mxData->mIconThemeSelector->SelectIconTheme(
3028 mxData->mIconThemeScanner->GetFoundIconThemes(),
3029 sTheme);
3030 return r;
3033 void
3034 StyleSettings::SetHighContrastMode(bool bHighContrast )
3036 if (mxData->mbHighContrast == bHighContrast) {
3037 return;
3040 CopyData();
3041 mxData->mbHighContrast = bHighContrast;
3042 mxData->mIconThemeSelector->SetUseHighContrastTheme(bHighContrast);
3045 bool
3046 StyleSettings::GetHighContrastMode() const
3048 return mxData->mbHighContrast;
3051 void
3052 StyleSettings::SetPreferredIconTheme(const OUString& theme, bool bDarkIconTheme)
3054 mxData->mIconThemeSelector->SetPreferredIconTheme(theme, bDarkIconTheme);
3057 void
3058 AllSettings::SetMouseSettings( const MouseSettings& rSet )
3060 CopyData();
3061 mxData->maMouseSettings = rSet;
3064 const MouseSettings&
3065 AllSettings::GetMouseSettings() const
3067 return mxData->maMouseSettings;
3070 void
3071 AllSettings::SetStyleSettings( const StyleSettings& rSet )
3073 CopyData();
3074 mxData->maStyleSettings = rSet;
3077 void
3078 AllSettings::SetMiscSettings( const MiscSettings& rSet )
3080 CopyData();
3081 mxData->maMiscSettings = rSet;
3084 const MiscSettings&
3085 AllSettings::GetMiscSettings() const
3087 return mxData->maMiscSettings;
3090 void
3091 AllSettings::SetHelpSettings( const HelpSettings& rSet )
3093 CopyData();
3094 mxData->maHelpSettings = rSet;
3097 const HelpSettings&
3098 AllSettings::GetHelpSettings() const
3100 return mxData->maHelpSettings;
3103 AllSettingsFlags
3104 AllSettings::GetWindowUpdate() const
3106 return mxData->mnWindowUpdate;
3109 bool
3110 AllSettings::operator !=( const AllSettings& rSet ) const
3112 return !(*this == rSet);
3115 SvtSysLocale&
3116 AllSettings::GetSysLocale()
3118 return mxData->maSysLocale;
3122 void StyleSettings::BatchSetBackgrounds( const Color &aBackColor,
3123 bool bCheckedColorSpecialCase )
3125 Set3DColors( aBackColor );
3126 SetFaceColor( aBackColor );
3127 SetDialogColor( aBackColor );
3128 SetWorkspaceColor( aBackColor );
3130 if (bCheckedColorSpecialCase)
3131 SetCheckedColorSpecialCase();
3134 void StyleSettings::BatchSetFonts( const vcl::Font& aAppFont,
3135 const vcl::Font& aLabelFont )
3137 SetAppFont( aAppFont );
3138 SetPushButtonFont( aAppFont );
3139 SetToolFont( aAppFont );
3140 SetHelpFont( aAppFont );
3142 SetMenuFont( aLabelFont );
3143 SetTabFont( aLabelFont );
3144 SetLabelFont( aLabelFont );
3145 SetRadioCheckFont( aLabelFont );
3146 SetFieldFont( aLabelFont );
3147 SetGroupFont( aLabelFont );
3148 SetIconFont( aLabelFont );
3151 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */