Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / vcl / source / app / settings.cxx
blob4887a283977b5b7a62b3a85c13ec89c530be10a9
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>
31 #include "i18nlangtag/mslangid.hxx"
32 #include "i18nlangtag/languagetag.hxx"
34 #include <comphelper/lok.hxx>
36 #include <vcl/graphicfilter.hxx>
37 #include <vcl/IconThemeScanner.hxx>
38 #include <vcl/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 <vcl/ImageTree.hxx>
45 #include <vcl/configsettings.hxx>
46 #include <vcl/gradient.hxx>
47 #include <vcl/outdev.hxx>
49 #include "unotools/fontcfg.hxx"
50 #include "unotools/localedatawrapper.hxx"
51 #include "unotools/collatorwrapper.hxx"
52 #include "unotools/confignode.hxx"
53 #include "unotools/configmgr.hxx"
54 #include "unotools/syslocaleoptions.hxx"
56 using namespace ::com::sun::star;
58 #include "svdata.hxx"
60 struct ImplMouseData
62 ImplMouseData();
63 ImplMouseData( const ImplMouseData& rData );
65 MouseSettingsOptions mnOptions;
66 sal_uInt64 mnDoubleClkTime;
67 long mnDoubleClkWidth;
68 long mnDoubleClkHeight;
69 long mnStartDragWidth;
70 long mnStartDragHeight;
71 sal_uInt16 mnStartDragCode;
72 sal_uInt16 mnContextMenuCode;
73 sal_uInt16 mnContextMenuClicks;
74 sal_uLong mnScrollRepeat;
75 sal_uLong mnButtonStartRepeat;
76 sal_uLong mnButtonRepeat;
77 sal_uLong mnActionDelay;
78 sal_uLong mnMenuDelay;
79 MouseFollowFlags mnFollow;
80 MouseMiddleButtonAction mnMiddleButtonAction;
81 MouseWheelBehaviour mnWheelBehavior;
84 struct ImplStyleData
86 ImplStyleData();
87 ImplStyleData( const ImplStyleData& rData );
89 void SetStandardStyles();
91 Color maActiveBorderColor;
92 Color maActiveColor;
93 Color maActiveTextColor;
94 Color maAlternatingRowColor;
95 Color maButtonTextColor;
96 Color maButtonRolloverTextColor;
97 Color maCheckedColor;
98 Color maDarkShadowColor;
99 Color maDeactiveBorderColor;
100 Color maDeactiveColor;
101 Color maDeactiveTextColor;
102 Color maDialogColor;
103 Color maDialogTextColor;
104 Color maDisableColor;
105 Color maFaceColor;
106 Color maFieldColor;
107 Color maFieldTextColor;
108 Color maFieldRolloverTextColor;
109 Color maFontColor;
110 Color maGroupTextColor;
111 Color maHelpColor;
112 Color maHelpTextColor;
113 Color maHighlightColor;
114 Color maHighlightLinkColor;
115 Color maHighlightTextColor;
116 Color maLabelTextColor;
117 Color maLightBorderColor;
118 Color maLightColor;
119 Color maLinkColor;
120 Color maMenuBarColor;
121 Color maMenuBarRolloverColor;
122 Color maMenuBorderColor;
123 Color maMenuColor;
124 Color maMenuHighlightColor;
125 Color maMenuHighlightTextColor;
126 Color maMenuTextColor;
127 Color maMenuBarTextColor;
128 Color maMenuBarRolloverTextColor;
129 Color maMenuBarHighlightTextColor;
130 Color maMonoColor;
131 Color maRadioCheckTextColor;
132 Color maShadowColor;
133 Color maVisitedLinkColor;
134 Color maToolTextColor;
135 Color maWindowColor;
136 Color maWindowTextColor;
137 Color maWorkspaceColor;
138 Color maActiveTabColor;
139 Color maInactiveTabColor;
140 Color maTabTextColor;
141 Color maTabRolloverTextColor;
142 Color maTabHighlightTextColor;
143 vcl::Font maAppFont;
144 vcl::Font maHelpFont;
145 vcl::Font maTitleFont;
146 vcl::Font maFloatTitleFont;
147 vcl::Font maMenuFont;
148 vcl::Font maToolFont;
149 vcl::Font maLabelFont;
150 vcl::Font maRadioCheckFont;
151 vcl::Font maPushButtonFont;
152 vcl::Font maFieldFont;
153 vcl::Font maIconFont;
154 vcl::Font maTabFont;
155 vcl::Font maGroupFont;
156 long mnBorderSize;
157 long mnTitleHeight;
158 long mnFloatTitleHeight;
159 long mnTearOffTitleHeight;
160 long mnScrollBarSize;
161 long mnSplitSize;
162 long mnSpinSize;
163 long mnCursorSize;
164 long mnAntialiasedMin;
165 sal_uInt64 mnCursorBlinkTime;
166 DragFullOptions mnDragFullOptions;
167 SelectionOptions mnSelectionOptions;
168 DisplayOptions mnDisplayOptions;
169 ToolbarIconSize mnToolbarIconSize;
170 bool mnUseFlatMenus;
171 StyleSettingsOptions mnOptions;
172 bool mbHighContrast;
173 bool mbUseSystemUIFonts;
174 bool mbAutoMnemonic;
175 TriState meUseImagesInMenus;
176 bool mnUseFlatBorders;
177 bool mbPreferredUseImagesInMenus;
178 long mnMinThumbSize;
179 std::shared_ptr<vcl::IconThemeScanner>
180 mIconThemeScanner;
181 std::shared_ptr<vcl::IconThemeSelector>
182 mIconThemeSelector;
184 rtl::OUString mIconTheme;
185 bool mbSkipDisabledInMenus;
186 bool mbHideDisabledMenuItems;
187 bool mbPreferredContextMenuShortcuts;
188 TriState meContextMenuShortcuts;
189 //mbPrimaryButtonWarpsSlider == true for "jump to here" behavior for primary button, otherwise
190 //primary means scroll by single page. Secondary button takes the alternative behaviour
191 bool mbPrimaryButtonWarpsSlider;
192 DialogStyle maDialogStyle;
193 FrameStyle maFrameStyle;
195 sal_uInt16 mnEdgeBlending;
196 Color maEdgeBlendingTopLeftColor;
197 Color maEdgeBlendingBottomRightColor;
198 sal_uInt16 mnListBoxMaximumLineCount;
199 sal_uInt16 mnColorValueSetColumnCount;
200 sal_uInt16 mnColorValueSetMaximumRowCount;
201 Size maListBoxPreviewDefaultLogicSize;
202 Size maListBoxPreviewDefaultPixelSize;
203 sal_uInt16 mnListBoxPreviewDefaultLineWidth;
204 bool mbPreviewUsesCheckeredBackground;
206 OUString maPersonaHeaderFooter; ///< Cache the settings to detect changes.
208 BitmapEx maPersonaHeaderBitmap; ///< Cache the header bitmap.
209 BitmapEx maPersonaFooterBitmap; ///< Cache the footer bitmap.
210 boost::optional<Color> maPersonaMenuBarTextColor; ///< Cache the menubar color.
213 struct ImplMiscData
215 ImplMiscData();
216 ImplMiscData( const ImplMiscData& rData );
217 TriState mnEnableATT;
218 bool mbEnableLocalizedDecimalSep;
219 TriState mnDisablePrinting;
220 bool mbPseudoHeadless;
223 struct ImplHelpData
225 ImplHelpData();
226 ImplHelpData( const ImplHelpData& rData );
228 sal_uLong mnTipDelay;
229 sal_uLong mnTipTimeout;
230 sal_uLong mnBalloonDelay;
233 struct ImplAllSettingsData
235 ImplAllSettingsData();
236 ImplAllSettingsData( const ImplAllSettingsData& rData );
237 ~ImplAllSettingsData();
239 MouseSettings maMouseSettings;
240 StyleSettings maStyleSettings;
241 MiscSettings maMiscSettings;
242 HelpSettings maHelpSettings;
243 LanguageTag maLocale;
244 AllSettingsFlags mnWindowUpdate;
245 LanguageTag maUILocale;
246 LocaleDataWrapper* mpLocaleDataWrapper;
247 LocaleDataWrapper* mpUILocaleDataWrapper;
248 vcl::I18nHelper* mpI18nHelper;
249 vcl::I18nHelper* mpUII18nHelper;
250 SvtSysLocale maSysLocale;
253 ImplMouseData::ImplMouseData()
255 mnOptions = MouseSettingsOptions::NONE;
256 mnDoubleClkTime = 500;
257 mnDoubleClkWidth = 2;
258 mnDoubleClkHeight = 2;
259 mnStartDragWidth = 2;
260 mnStartDragHeight = 2;
261 mnStartDragCode = MOUSE_LEFT;
262 mnContextMenuCode = MOUSE_RIGHT;
263 mnContextMenuClicks = 1;
264 mnMiddleButtonAction = MouseMiddleButtonAction::AutoScroll;
265 mnScrollRepeat = 100;
266 mnButtonStartRepeat = 370;
267 mnButtonRepeat = 90;
268 mnActionDelay = 250;
269 mnMenuDelay = 150;
270 mnFollow = MouseFollowFlags::Menu | MouseFollowFlags::DDList;
271 mnWheelBehavior = MouseWheelBehaviour::ALWAYS;
274 ImplMouseData::ImplMouseData( const ImplMouseData& rData )
276 mnOptions = rData.mnOptions;
277 mnDoubleClkTime = rData.mnDoubleClkTime;
278 mnDoubleClkWidth = rData.mnDoubleClkWidth;
279 mnDoubleClkHeight = rData.mnDoubleClkHeight;
280 mnStartDragWidth = rData.mnStartDragWidth;
281 mnStartDragHeight = rData.mnStartDragHeight;
282 mnStartDragCode = rData.mnStartDragCode;
283 mnContextMenuCode = rData.mnContextMenuCode;
284 mnContextMenuClicks = rData.mnContextMenuClicks;
285 mnMiddleButtonAction = rData.mnMiddleButtonAction;
286 mnScrollRepeat = rData.mnScrollRepeat;
287 mnButtonStartRepeat = rData.mnButtonStartRepeat;
288 mnButtonRepeat = rData.mnButtonRepeat;
289 mnActionDelay = rData.mnActionDelay;
290 mnMenuDelay = rData.mnMenuDelay;
291 mnFollow = rData.mnFollow;
292 mnWheelBehavior = rData.mnWheelBehavior;
295 void
296 MouseSettings::SetOptions(MouseSettingsOptions nOptions)
298 CopyData();
299 mxData->mnOptions = nOptions;
302 MouseSettingsOptions
303 MouseSettings::GetOptions() const
305 return mxData->mnOptions;
308 void
309 MouseSettings::SetDoubleClickTime( sal_uInt64 nDoubleClkTime )
311 CopyData();
312 mxData->mnDoubleClkTime = nDoubleClkTime;
315 sal_uInt64
316 MouseSettings::GetDoubleClickTime() const
318 return mxData->mnDoubleClkTime;
321 void
322 MouseSettings::SetDoubleClickWidth( long nDoubleClkWidth )
324 CopyData();
325 mxData->mnDoubleClkWidth = nDoubleClkWidth;
328 long
329 MouseSettings::GetDoubleClickWidth() const
331 return mxData->mnDoubleClkWidth;
334 void
335 MouseSettings::SetDoubleClickHeight( long nDoubleClkHeight )
337 CopyData();
338 mxData->mnDoubleClkHeight = nDoubleClkHeight;
341 long
342 MouseSettings::GetDoubleClickHeight() const
344 return mxData->mnDoubleClkHeight;
347 void
348 MouseSettings::SetStartDragWidth( long nDragWidth )
350 CopyData();
351 mxData->mnStartDragWidth = nDragWidth;
354 long
355 MouseSettings::GetStartDragWidth() const
357 return mxData->mnStartDragWidth;
360 void
361 MouseSettings::SetStartDragHeight( long nDragHeight )
363 CopyData();
364 mxData->mnStartDragHeight = nDragHeight;
367 long
368 MouseSettings::GetStartDragHeight() const
370 return mxData->mnStartDragHeight;
373 sal_uInt16
374 MouseSettings::GetStartDragCode() const
376 return mxData->mnStartDragCode;
379 sal_uInt16
380 MouseSettings::GetContextMenuCode() const
382 return mxData->mnContextMenuCode;
385 sal_uInt16
386 MouseSettings::GetContextMenuClicks() const
388 return mxData->mnContextMenuClicks;
391 sal_uLong
392 MouseSettings::GetScrollRepeat() const
394 return mxData->mnScrollRepeat;
397 sal_uLong
398 MouseSettings::GetButtonStartRepeat() const
400 return mxData->mnButtonStartRepeat;
403 void
404 MouseSettings::SetButtonRepeat( sal_uLong nRepeat )
406 CopyData();
407 mxData->mnButtonRepeat = nRepeat;
410 sal_uLong
411 MouseSettings::GetButtonRepeat() const
413 return mxData->mnButtonRepeat;
416 sal_uLong
417 MouseSettings::GetActionDelay() const
419 return mxData->mnActionDelay;
422 void
423 MouseSettings::SetMenuDelay( sal_uLong nDelay )
425 CopyData();
426 mxData->mnMenuDelay = nDelay;
429 sal_uLong
430 MouseSettings::GetMenuDelay() const
432 return mxData->mnMenuDelay;
435 void
436 MouseSettings::SetFollow( MouseFollowFlags nFollow )
438 CopyData();
439 mxData->mnFollow = nFollow;
442 MouseFollowFlags
443 MouseSettings::GetFollow() const
445 return mxData->mnFollow;
448 void
449 MouseSettings::SetMiddleButtonAction( MouseMiddleButtonAction nAction )
451 CopyData();
452 mxData->mnMiddleButtonAction = nAction;
455 MouseMiddleButtonAction
456 MouseSettings::GetMiddleButtonAction() const
458 return mxData->mnMiddleButtonAction;
461 void
462 MouseSettings::SetWheelBehavior( MouseWheelBehaviour nBehavior )
464 CopyData();
465 mxData->mnWheelBehavior = nBehavior;
468 MouseWheelBehaviour
469 MouseSettings::GetWheelBehavior() const
471 return mxData->mnWheelBehavior;
474 bool
475 MouseSettings::operator !=( const MouseSettings& rSet ) const
477 return !(*this == rSet);
480 MouseSettings::MouseSettings()
481 : mxData(std::make_shared<ImplMouseData>())
485 MouseSettings::~MouseSettings()
489 void MouseSettings::CopyData()
491 // copy if other references exist
492 if ( ! mxData.unique() ) {
493 mxData = std::make_shared<ImplMouseData>(*mxData);
497 bool MouseSettings::operator ==( const MouseSettings& rSet ) const
499 if ( mxData == rSet.mxData )
500 return true;
502 return
503 (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 );
522 ImplStyleData::ImplStyleData() :
523 mIconThemeScanner(vcl::IconThemeScanner::Create(vcl::IconThemeScanner::GetStandardIconThemePath())),
524 mIconThemeSelector(new vcl::IconThemeSelector()),
525 maPersonaHeaderFooter(),
526 maPersonaHeaderBitmap(),
527 maPersonaFooterBitmap(),
528 maPersonaMenuBarTextColor()
530 mnScrollBarSize = 16;
531 mnMinThumbSize = 16;
532 mnSplitSize = 3;
533 mnSpinSize = 16;
534 mnAntialiasedMin = 0;
535 mnCursorSize = 2;
536 mnCursorBlinkTime = STYLE_CURSOR_NOBLINKTIME;
537 mnDragFullOptions = DragFullOptions::All;
538 mnSelectionOptions = SelectionOptions::NONE;
539 mnDisplayOptions = DisplayOptions::NONE;
540 mnOptions = StyleSettingsOptions::NONE;
541 mbAutoMnemonic = true;
542 mnToolbarIconSize = ToolbarIconSize::Unknown;
543 meUseImagesInMenus = TRISTATE_INDET;
544 meContextMenuShortcuts = TRISTATE_INDET;
545 mnEdgeBlending = 35;
546 maEdgeBlendingTopLeftColor = RGB_COLORDATA(0xC0, 0xC0, 0xC0);
547 maEdgeBlendingBottomRightColor = RGB_COLORDATA(0x40, 0x40, 0x40);
548 mnListBoxMaximumLineCount = 25;
549 mnColorValueSetColumnCount = 12;
550 mnColorValueSetMaximumRowCount = 10;
551 maListBoxPreviewDefaultLogicSize = Size(15, 7);
552 maListBoxPreviewDefaultPixelSize = Size(0, 0); // on-demand calculated in GetListBoxPreviewDefaultPixelSize()
553 mnListBoxPreviewDefaultLineWidth = 1;
554 mbPreviewUsesCheckeredBackground = true;
556 SetStandardStyles();
559 ImplStyleData::ImplStyleData( const ImplStyleData& rData ) :
560 maActiveBorderColor( rData.maActiveBorderColor ),
561 maActiveColor( rData.maActiveColor ),
562 maActiveTextColor( rData.maActiveTextColor ),
563 maAlternatingRowColor( rData.maAlternatingRowColor ),
564 maButtonTextColor( rData.maButtonTextColor ),
565 maButtonRolloverTextColor( rData.maButtonRolloverTextColor ),
566 maCheckedColor( rData.maCheckedColor ),
567 maDarkShadowColor( rData.maDarkShadowColor ),
568 maDeactiveBorderColor( rData.maDeactiveBorderColor ),
569 maDeactiveColor( rData.maDeactiveColor ),
570 maDeactiveTextColor( rData.maDeactiveTextColor ),
571 maDialogColor( rData.maDialogColor ),
572 maDialogTextColor( rData.maDialogTextColor ),
573 maDisableColor( rData.maDisableColor ),
574 maFaceColor( rData.maFaceColor ),
575 maFieldColor( rData.maFieldColor ),
576 maFieldTextColor( rData.maFieldTextColor ),
577 maFieldRolloverTextColor( rData.maFieldRolloverTextColor ),
578 maFontColor( rData.maFontColor ),
579 maGroupTextColor( rData.maGroupTextColor ),
580 maHelpColor( rData.maHelpColor ),
581 maHelpTextColor( rData.maHelpTextColor ),
582 maHighlightColor( rData.maHighlightColor ),
583 maHighlightLinkColor( rData.maHighlightLinkColor ),
584 maHighlightTextColor( rData.maHighlightTextColor ),
585 maLabelTextColor( rData.maLabelTextColor ),
586 maLightBorderColor( rData.maLightBorderColor ),
587 maLightColor( rData.maLightColor ),
588 maLinkColor( rData.maLinkColor ),
589 maMenuBarColor( rData.maMenuBarColor ),
590 maMenuBarRolloverColor( rData.maMenuBarRolloverColor ),
591 maMenuBorderColor( rData.maMenuBorderColor ),
592 maMenuColor( rData.maMenuColor ),
593 maMenuHighlightColor( rData.maMenuHighlightColor ),
594 maMenuHighlightTextColor( rData.maMenuHighlightTextColor ),
595 maMenuTextColor( rData.maMenuTextColor ),
596 maMenuBarTextColor( rData.maMenuBarTextColor ),
597 maMenuBarRolloverTextColor( rData.maMenuBarRolloverTextColor ),
598 maMenuBarHighlightTextColor( rData.maMenuBarHighlightTextColor ),
599 maMonoColor( rData.maMonoColor ),
600 maRadioCheckTextColor( rData.maRadioCheckTextColor ),
601 maShadowColor( rData.maShadowColor ),
602 maVisitedLinkColor( rData.maVisitedLinkColor ),
603 maToolTextColor( rData.maToolTextColor ),
604 maWindowColor( rData.maWindowColor ),
605 maWindowTextColor( rData.maWindowTextColor ),
606 maWorkspaceColor( rData.maWorkspaceColor ),
607 maActiveTabColor( rData.maActiveTabColor ),
608 maInactiveTabColor( rData.maInactiveTabColor ),
609 maTabTextColor( rData.maTabTextColor ),
610 maTabRolloverTextColor( rData.maTabRolloverTextColor ),
611 maTabHighlightTextColor( rData.maTabHighlightTextColor ),
612 maAppFont( rData.maAppFont ),
613 maHelpFont( rData.maAppFont ),
614 maTitleFont( rData.maTitleFont ),
615 maFloatTitleFont( rData.maFloatTitleFont ),
616 maMenuFont( rData.maMenuFont ),
617 maToolFont( rData.maToolFont ),
618 maLabelFont( rData.maLabelFont ),
619 maRadioCheckFont( rData.maRadioCheckFont ),
620 maPushButtonFont( rData.maPushButtonFont ),
621 maFieldFont( rData.maFieldFont ),
622 maIconFont( rData.maIconFont ),
623 maTabFont( rData.maTabFont ),
624 maGroupFont( rData.maGroupFont ),
625 mIconTheme(rData.mIconTheme),
626 maDialogStyle( rData.maDialogStyle ),
627 maFrameStyle( rData.maFrameStyle ),
628 maPersonaHeaderFooter( rData.maPersonaHeaderFooter ),
629 maPersonaHeaderBitmap( rData.maPersonaHeaderBitmap ),
630 maPersonaFooterBitmap( rData.maPersonaFooterBitmap ),
631 maPersonaMenuBarTextColor( rData.maPersonaMenuBarTextColor )
633 mnBorderSize = rData.mnBorderSize;
634 mnTitleHeight = rData.mnTitleHeight;
635 mnFloatTitleHeight = rData.mnFloatTitleHeight;
636 mnTearOffTitleHeight = rData.mnTearOffTitleHeight;
637 mnScrollBarSize = rData.mnScrollBarSize;
638 mnMinThumbSize = rData.mnMinThumbSize;
639 mnSplitSize = rData.mnSplitSize;
640 mnSpinSize = rData.mnSpinSize;
641 mnAntialiasedMin = rData.mnAntialiasedMin;
642 mnCursorSize = rData.mnCursorSize;
643 mnCursorBlinkTime = rData.mnCursorBlinkTime;
644 mnDragFullOptions = rData.mnDragFullOptions;
645 mnSelectionOptions = rData.mnSelectionOptions;
646 mnDisplayOptions = rData.mnDisplayOptions;
647 mnOptions = rData.mnOptions;
648 mbHighContrast = rData.mbHighContrast;
649 mbUseSystemUIFonts = rData.mbUseSystemUIFonts;
650 mnUseFlatBorders = rData.mnUseFlatBorders;
651 mnUseFlatMenus = rData.mnUseFlatMenus;
652 mbAutoMnemonic = rData.mbAutoMnemonic;
653 meUseImagesInMenus = rData.meUseImagesInMenus;
654 mbPreferredUseImagesInMenus = rData.mbPreferredUseImagesInMenus;
655 mbSkipDisabledInMenus = rData.mbSkipDisabledInMenus;
656 mbHideDisabledMenuItems = rData.mbHideDisabledMenuItems;
657 mbPreferredContextMenuShortcuts = rData.mbPreferredContextMenuShortcuts;
658 meContextMenuShortcuts = rData.meContextMenuShortcuts;
659 mbPrimaryButtonWarpsSlider = rData.mbPrimaryButtonWarpsSlider;
660 mnToolbarIconSize = rData.mnToolbarIconSize;
661 mIconThemeScanner.reset(new vcl::IconThemeScanner(*rData.mIconThemeScanner));
662 mIconThemeSelector.reset(new vcl::IconThemeSelector(*rData.mIconThemeSelector));
663 mnEdgeBlending = rData.mnEdgeBlending;
664 maEdgeBlendingTopLeftColor = rData.maEdgeBlendingTopLeftColor;
665 maEdgeBlendingBottomRightColor = rData.maEdgeBlendingBottomRightColor;
666 mnListBoxMaximumLineCount = rData.mnListBoxMaximumLineCount;
667 mnColorValueSetColumnCount = rData.mnColorValueSetColumnCount;
668 mnColorValueSetMaximumRowCount = rData.mnColorValueSetMaximumRowCount;
669 maListBoxPreviewDefaultLogicSize = rData.maListBoxPreviewDefaultLogicSize;
670 maListBoxPreviewDefaultPixelSize = rData.maListBoxPreviewDefaultPixelSize;
671 mnListBoxPreviewDefaultLineWidth = rData.mnListBoxPreviewDefaultLineWidth;
672 mbPreviewUsesCheckeredBackground = rData.mbPreviewUsesCheckeredBackground;
675 void ImplStyleData::SetStandardStyles()
677 vcl::Font aStdFont( FAMILY_SWISS, Size( 0, 8 ) );
678 aStdFont.SetCharSet( osl_getThreadTextEncoding() );
679 aStdFont.SetWeight( WEIGHT_NORMAL );
680 if (!utl::ConfigManager::IsAvoidConfig())
681 aStdFont.SetFamilyName(utl::DefaultFontConfiguration::get().getUserInterfaceFont(LanguageTag("en")));
682 else
683 aStdFont.SetFamilyName("Liberation Serif");
684 maAppFont = aStdFont;
685 maHelpFont = aStdFont;
686 maMenuFont = aStdFont;
687 maToolFont = aStdFont;
688 maGroupFont = aStdFont;
689 maLabelFont = aStdFont;
690 maRadioCheckFont = aStdFont;
691 maPushButtonFont = aStdFont;
692 maFieldFont = aStdFont;
693 maIconFont = aStdFont;
694 maTabFont = aStdFont;
695 aStdFont.SetWeight( WEIGHT_BOLD );
696 maFloatTitleFont = aStdFont;
697 maTitleFont = aStdFont;
699 maFaceColor = Color( COL_LIGHTGRAY );
700 maCheckedColor = Color( 0xCC, 0xCC, 0xCC );
701 maLightColor = Color( COL_WHITE );
702 maLightBorderColor = Color( COL_LIGHTGRAY );
703 maShadowColor = Color( COL_GRAY );
704 maDarkShadowColor = Color( COL_BLACK );
705 maButtonTextColor = Color( COL_BLACK );
706 maButtonRolloverTextColor = Color( COL_BLACK );
707 maRadioCheckTextColor = Color( COL_BLACK );
708 maGroupTextColor = Color( COL_BLACK );
709 maLabelTextColor = Color( COL_BLACK );
710 maWindowColor = Color( COL_WHITE );
711 maWindowTextColor = Color( COL_BLACK );
712 maDialogColor = Color( COL_LIGHTGRAY );
713 maDialogTextColor = Color( COL_BLACK );
714 maWorkspaceColor = Color( 0xDF, 0xDF, 0xDE );
715 maMonoColor = Color( COL_BLACK );
716 maFieldColor = Color( COL_WHITE );
717 maFieldTextColor = Color( COL_BLACK );
718 maFieldRolloverTextColor = Color( COL_BLACK );
719 maActiveColor = Color( COL_BLUE );
720 maActiveTextColor = Color( COL_WHITE );
721 maActiveBorderColor = Color( COL_LIGHTGRAY );
722 maDeactiveColor = Color( COL_GRAY );
723 maDeactiveTextColor = Color( COL_LIGHTGRAY );
724 maDeactiveBorderColor = Color( COL_LIGHTGRAY );
725 maMenuColor = Color( COL_LIGHTGRAY );
726 maMenuBarColor = Color( COL_LIGHTGRAY );
727 maMenuBarRolloverColor = Color( COL_BLUE );
728 maMenuBorderColor = Color( COL_LIGHTGRAY );
729 maMenuTextColor = Color( COL_BLACK );
730 maMenuBarTextColor = Color( COL_BLACK );
731 maMenuBarRolloverTextColor = Color( COL_WHITE );
732 maMenuBarHighlightTextColor = Color( COL_WHITE );
733 maMenuHighlightColor = Color( COL_BLUE );
734 maMenuHighlightTextColor = Color( COL_WHITE );
735 maHighlightColor = Color( COL_BLUE );
736 maHighlightTextColor = Color( COL_WHITE );
737 maActiveTabColor = Color( COL_WHITE );
738 maInactiveTabColor = Color( COL_LIGHTGRAY );
739 maTabTextColor = Color( COL_BLACK );
740 maTabRolloverTextColor = Color( COL_BLACK );
741 maTabHighlightTextColor = Color( COL_BLACK );
742 maDisableColor = Color( COL_GRAY );
743 maHelpColor = Color( 0xFF, 0xFF, 0xE0 );
744 maHelpTextColor = Color( COL_BLACK );
745 maLinkColor = Color( COL_BLUE );
746 maVisitedLinkColor = Color( 0x00, 0x00, 0xCC );
747 maToolTextColor = Color( COL_BLACK );
748 maHighlightLinkColor = Color( COL_LIGHTBLUE );
749 maFontColor = Color( COL_BLACK );
750 maAlternatingRowColor = Color( 0xEE, 0xEE, 0xEE );
752 mnBorderSize = 1;
753 mnTitleHeight = 18;
754 mnFloatTitleHeight = 13;
755 mnTearOffTitleHeight = 8;
756 mbHighContrast = false;
757 mbUseSystemUIFonts = true;
758 mnUseFlatBorders = false;
759 mnUseFlatMenus = false;
760 mbPreferredUseImagesInMenus = true;
761 mbSkipDisabledInMenus = false;
762 mbHideDisabledMenuItems = false;
763 mbPreferredContextMenuShortcuts = true;
764 mbPrimaryButtonWarpsSlider = false;
767 StyleSettings::StyleSettings()
768 : mxData(std::make_shared<ImplStyleData>())
772 StyleSettings::~StyleSettings()
776 void
777 StyleSettings::SetFaceColor( const Color& rColor )
779 CopyData();
780 mxData->maFaceColor = rColor;
783 const Color&
784 StyleSettings::GetFaceColor() const
786 return mxData->maFaceColor;
789 void
790 StyleSettings::SetCheckedColor( const Color& rColor )
792 CopyData();
793 mxData->maCheckedColor = rColor;
796 const Color&
797 StyleSettings::GetCheckedColor() const
799 return mxData->maCheckedColor;
802 void
803 StyleSettings::SetLightColor( const Color& rColor )
805 CopyData();
806 mxData->maLightColor = rColor;
809 const Color&
810 StyleSettings::GetLightColor() const
812 return mxData->maLightColor;
815 void
816 StyleSettings::SetLightBorderColor( const Color& rColor )
818 CopyData();
819 mxData->maLightBorderColor = rColor;
822 const Color&
823 StyleSettings::GetLightBorderColor() const
825 return mxData->maLightBorderColor;
828 void
829 StyleSettings::SetShadowColor( const Color& rColor )
831 CopyData();
832 mxData->maShadowColor = rColor;
835 const Color&
836 StyleSettings::GetShadowColor() const
838 return mxData->maShadowColor;
841 void
842 StyleSettings::SetDarkShadowColor( const Color& rColor )
844 CopyData();
845 mxData->maDarkShadowColor = rColor;
848 const Color&
849 StyleSettings::GetDarkShadowColor() const
851 return mxData->maDarkShadowColor;
854 void
855 StyleSettings::SetButtonTextColor( const Color& rColor )
857 CopyData();
858 mxData->maButtonTextColor = rColor;
861 const Color&
862 StyleSettings::GetButtonTextColor() const
864 return mxData->maButtonTextColor;
867 void
868 StyleSettings::SetButtonRolloverTextColor( const Color& rColor )
870 CopyData();
871 mxData->maButtonRolloverTextColor = rColor;
874 const Color&
875 StyleSettings::GetButtonRolloverTextColor() const
877 return mxData->maButtonRolloverTextColor;
880 void
881 StyleSettings::SetRadioCheckTextColor( const Color& rColor )
883 CopyData();
884 mxData->maRadioCheckTextColor = rColor;
887 const Color&
888 StyleSettings::GetRadioCheckTextColor() const
890 return mxData->maRadioCheckTextColor;
893 void
894 StyleSettings::SetGroupTextColor( const Color& rColor )
896 CopyData();
897 mxData->maGroupTextColor = rColor;
900 const Color&
901 StyleSettings::GetGroupTextColor() const
903 return mxData->maGroupTextColor;
906 void
907 StyleSettings::SetLabelTextColor( const Color& rColor )
909 CopyData();
910 mxData->maLabelTextColor = rColor;
913 const Color&
914 StyleSettings::GetLabelTextColor() const
916 return mxData->maLabelTextColor;
919 void
920 StyleSettings::SetWindowColor( const Color& rColor )
922 CopyData();
923 mxData->maWindowColor = rColor;
926 const Color&
927 StyleSettings::GetWindowColor() const
929 return mxData->maWindowColor;
932 void
933 StyleSettings::SetWindowTextColor( const Color& rColor )
935 CopyData();
936 mxData->maWindowTextColor = rColor;
939 const Color&
940 StyleSettings::GetWindowTextColor() const
942 return mxData->maWindowTextColor;
945 void
946 StyleSettings::SetDialogColor( const Color& rColor )
948 CopyData();
949 mxData->maDialogColor = rColor;
952 const Color&
953 StyleSettings::GetDialogColor() const
955 return mxData->maDialogColor;
958 void
959 StyleSettings::SetDialogTextColor( const Color& rColor )
961 CopyData();
962 mxData->maDialogTextColor = rColor;
965 const Color&
966 StyleSettings::GetDialogTextColor() const
968 return mxData->maDialogTextColor;
971 void
972 StyleSettings::SetWorkspaceColor( const Color& rColor )
974 CopyData();
975 mxData->maWorkspaceColor = rColor;
978 const Color&
979 StyleSettings::GetWorkspaceColor() const
981 return mxData->maWorkspaceColor;
984 void
985 StyleSettings::SetFieldColor( const Color& rColor )
987 CopyData();
988 mxData->maFieldColor = rColor;
991 const Color&
992 StyleSettings::GetFieldColor() const
994 return mxData->maFieldColor;
997 void
998 StyleSettings::SetFieldTextColor( const Color& rColor )
1000 CopyData();
1001 mxData->maFieldTextColor = rColor;
1004 const Color&
1005 StyleSettings::GetFieldTextColor() const
1007 return mxData->maFieldTextColor;
1010 void
1011 StyleSettings::SetFieldRolloverTextColor( const Color& rColor )
1013 CopyData();
1014 mxData->maFieldRolloverTextColor = rColor;
1017 const Color&
1018 StyleSettings::GetFieldRolloverTextColor() const
1020 return mxData->maFieldRolloverTextColor;
1023 void
1024 StyleSettings::SetActiveColor( const Color& rColor )
1026 CopyData();
1027 mxData->maActiveColor = rColor;
1030 const Color&
1031 StyleSettings::GetActiveColor() const
1033 return mxData->maActiveColor;
1036 void
1037 StyleSettings::SetActiveTextColor( const Color& rColor )
1039 CopyData();
1040 mxData->maActiveTextColor = rColor;
1043 const Color&
1044 StyleSettings::GetActiveTextColor() const
1046 return mxData->maActiveTextColor;
1049 void
1050 StyleSettings::SetActiveBorderColor( const Color& rColor )
1052 CopyData();
1053 mxData->maActiveBorderColor = rColor;
1056 const Color&
1057 StyleSettings::GetActiveBorderColor() const
1059 return mxData->maActiveBorderColor;
1062 void
1063 StyleSettings::SetDeactiveColor( const Color& rColor )
1065 CopyData();
1066 mxData->maDeactiveColor = rColor;
1069 const Color&
1070 StyleSettings::GetDeactiveColor() const
1072 return mxData->maDeactiveColor;
1075 void
1076 StyleSettings::SetDeactiveTextColor( const Color& rColor )
1078 CopyData();
1079 mxData->maDeactiveTextColor = rColor;
1082 const Color&
1083 StyleSettings::GetDeactiveTextColor() const
1085 return mxData->maDeactiveTextColor;
1088 void
1089 StyleSettings::SetDeactiveBorderColor( const Color& rColor )
1091 CopyData();
1092 mxData->maDeactiveBorderColor = rColor;
1095 const Color&
1096 StyleSettings::GetDeactiveBorderColor() const
1098 return mxData->maDeactiveBorderColor;
1101 void
1102 StyleSettings::SetHighlightColor( const Color& rColor )
1104 CopyData();
1105 mxData->maHighlightColor = rColor;
1108 const Color&
1109 StyleSettings::GetHighlightColor() const
1111 return mxData->maHighlightColor;
1114 void
1115 StyleSettings::SetHighlightTextColor( const Color& rColor )
1117 CopyData();
1118 mxData->maHighlightTextColor = rColor;
1121 const Color&
1122 StyleSettings::GetHighlightTextColor() const
1124 return mxData->maHighlightTextColor;
1127 void
1128 StyleSettings::SetDisableColor( const Color& rColor )
1130 CopyData();
1131 mxData->maDisableColor = rColor;
1134 const Color&
1135 StyleSettings::GetDisableColor() const
1137 return mxData->maDisableColor;
1140 void
1141 StyleSettings::SetHelpColor( const Color& rColor )
1143 CopyData();
1144 mxData->maHelpColor = rColor;
1147 const Color&
1148 StyleSettings::GetHelpColor() const
1150 return mxData->maHelpColor;
1153 void
1154 StyleSettings::SetHelpTextColor( const Color& rColor )
1156 CopyData();
1157 mxData->maHelpTextColor = rColor;
1160 const Color&
1161 StyleSettings::GetHelpTextColor() const
1163 return mxData->maHelpTextColor;
1166 void
1167 StyleSettings::SetMenuColor( const Color& rColor )
1169 CopyData();
1170 mxData->maMenuColor = rColor;
1173 const Color&
1174 StyleSettings::GetMenuColor() const
1176 return mxData->maMenuColor;
1179 void
1180 StyleSettings::SetMenuBarColor( const Color& rColor )
1182 CopyData();
1183 mxData->maMenuBarColor = rColor;
1186 const Color&
1187 StyleSettings::GetMenuBarColor() const
1189 return mxData->maMenuBarColor;
1192 void
1193 StyleSettings::SetMenuBarRolloverColor( const Color& rColor )
1195 CopyData();
1196 mxData->maMenuBarRolloverColor = rColor;
1199 const Color&
1200 StyleSettings::GetMenuBarRolloverColor() const
1202 return mxData->maMenuBarRolloverColor;
1205 void
1206 StyleSettings::SetMenuBorderColor( const Color& rColor )
1208 CopyData();
1209 mxData->maMenuBorderColor = rColor;
1212 const Color&
1213 StyleSettings::GetMenuBorderColor() const
1215 return mxData->maMenuBorderColor;
1218 void
1219 StyleSettings::SetMenuTextColor( const Color& rColor )
1221 CopyData();
1222 mxData->maMenuTextColor = rColor;
1225 const Color&
1226 StyleSettings::GetMenuTextColor() const
1228 return mxData->maMenuTextColor;
1231 void
1232 StyleSettings::SetMenuBarTextColor( const Color& rColor )
1234 CopyData();
1235 mxData->maMenuBarTextColor = rColor;
1238 const Color&
1239 StyleSettings::GetMenuBarTextColor() const
1241 return mxData->maMenuBarTextColor;
1244 void
1245 StyleSettings::SetMenuBarRolloverTextColor( const Color& rColor )
1247 CopyData();
1248 mxData->maMenuBarRolloverTextColor = rColor;
1251 const Color&
1252 StyleSettings::GetMenuBarRolloverTextColor() const
1254 return mxData->maMenuBarRolloverTextColor;
1257 void
1258 StyleSettings::SetMenuBarHighlightTextColor( const Color& rColor )
1260 CopyData();
1261 mxData->maMenuBarHighlightTextColor = rColor;
1264 const Color&
1265 StyleSettings::GetMenuBarHighlightTextColor() const
1267 return mxData->maMenuBarHighlightTextColor;
1270 void
1271 StyleSettings::SetMenuHighlightColor( const Color& rColor )
1273 CopyData();
1274 mxData->maMenuHighlightColor = rColor;
1277 const Color&
1278 StyleSettings::GetMenuHighlightColor() const
1280 return mxData->maMenuHighlightColor;
1283 void
1284 StyleSettings::SetMenuHighlightTextColor( const Color& rColor )
1286 CopyData();
1287 mxData->maMenuHighlightTextColor = rColor;
1290 const Color&
1291 StyleSettings::GetMenuHighlightTextColor() const
1293 return mxData->maMenuHighlightTextColor;
1296 void
1297 StyleSettings::SetTabTextColor( const Color& rColor )
1299 CopyData();
1300 mxData->maTabTextColor = rColor;
1303 const Color&
1304 StyleSettings::GetTabTextColor() const
1306 return mxData->maTabTextColor;
1309 void
1310 StyleSettings::SetTabRolloverTextColor( const Color& rColor )
1312 CopyData();
1313 mxData->maTabRolloverTextColor = rColor;
1316 const Color&
1317 StyleSettings::GetTabRolloverTextColor() const
1319 return mxData->maTabRolloverTextColor;
1322 void
1323 StyleSettings::SetTabHighlightTextColor( const Color& rColor )
1325 CopyData();
1326 mxData->maTabHighlightTextColor = rColor;
1329 const Color&
1330 StyleSettings::GetTabHighlightTextColor() const
1332 return mxData->maTabHighlightTextColor;
1335 void
1336 StyleSettings::SetLinkColor( const Color& rColor )
1338 CopyData();
1339 mxData->maLinkColor = rColor;
1342 const Color&
1343 StyleSettings::GetLinkColor() const
1345 return mxData->maLinkColor;
1348 void
1349 StyleSettings::SetVisitedLinkColor( const Color& rColor )
1351 CopyData();
1352 mxData->maVisitedLinkColor = rColor;
1355 const Color&
1356 StyleSettings::GetVisitedLinkColor() const
1358 return mxData->maVisitedLinkColor;
1361 void
1362 StyleSettings::SetToolTextColor( const Color& rColor )
1364 CopyData();
1365 mxData->maToolTextColor = rColor;
1368 const Color&
1369 StyleSettings::GetToolTextColor() const
1371 return mxData->maToolTextColor;
1374 const Color&
1375 StyleSettings::GetHighlightLinkColor() const
1377 return mxData->maHighlightLinkColor;
1380 void
1381 StyleSettings::SetMonoColor( const Color& rColor )
1383 CopyData();
1384 mxData->maMonoColor = rColor;
1387 const Color&
1388 StyleSettings::GetMonoColor() const
1390 return mxData->maMonoColor;
1393 void
1394 StyleSettings::SetActiveTabColor( const Color& rColor )
1396 CopyData();
1397 mxData->maActiveTabColor = rColor;
1400 const Color&
1401 StyleSettings::GetActiveTabColor() const
1403 return mxData->maActiveTabColor;
1406 void
1407 StyleSettings::SetInactiveTabColor( const Color& rColor )
1409 CopyData();
1410 mxData->maInactiveTabColor = rColor;
1413 const Color&
1414 StyleSettings::GetInactiveTabColor() const
1416 return mxData->maInactiveTabColor;
1419 const Color&
1420 StyleSettings::GetAlternatingRowColor() const
1422 return mxData->maAlternatingRowColor;
1425 void
1426 StyleSettings::SetUseSystemUIFonts( bool bUseSystemUIFonts )
1428 CopyData();
1429 mxData->mbUseSystemUIFonts = bUseSystemUIFonts;
1432 bool
1433 StyleSettings::GetUseSystemUIFonts() const
1435 return mxData->mbUseSystemUIFonts;
1438 void
1439 StyleSettings::SetUseFlatBorders( bool bUseFlatBorders )
1441 CopyData();
1442 mxData->mnUseFlatBorders = bUseFlatBorders;
1445 bool
1446 StyleSettings::GetUseFlatBorders() const
1448 return mxData->mnUseFlatBorders;
1451 void
1452 StyleSettings::SetUseFlatMenus( bool bUseFlatMenus )
1454 CopyData();
1455 mxData->mnUseFlatMenus = bUseFlatMenus;
1458 bool
1459 StyleSettings::GetUseFlatMenus() const
1461 return mxData->mnUseFlatMenus;
1464 void
1465 StyleSettings::SetUseImagesInMenus( TriState eUseImagesInMenus )
1467 CopyData();
1468 mxData->meUseImagesInMenus = eUseImagesInMenus;
1471 void
1472 StyleSettings::SetPreferredUseImagesInMenus( bool bPreferredUseImagesInMenus )
1474 CopyData();
1475 mxData->mbPreferredUseImagesInMenus = bPreferredUseImagesInMenus;
1478 bool
1479 StyleSettings::GetPreferredUseImagesInMenus() const
1481 return mxData->mbPreferredUseImagesInMenus;
1484 void
1485 StyleSettings::SetSkipDisabledInMenus( bool bSkipDisabledInMenus )
1487 CopyData();
1488 mxData->mbSkipDisabledInMenus = bSkipDisabledInMenus;
1491 bool
1492 StyleSettings::GetSkipDisabledInMenus() const
1494 return mxData->mbSkipDisabledInMenus;
1497 void
1498 StyleSettings::SetHideDisabledMenuItems( bool bHideDisabledMenuItems )
1500 CopyData();
1501 mxData->mbHideDisabledMenuItems = bHideDisabledMenuItems;
1504 bool
1505 StyleSettings::GetHideDisabledMenuItems() const
1507 return mxData->mbHideDisabledMenuItems;
1510 void
1511 StyleSettings::SetContextMenuShortcuts( TriState eContextMenuShortcuts )
1513 CopyData();
1514 mxData->meContextMenuShortcuts = eContextMenuShortcuts;
1517 bool
1518 StyleSettings::GetContextMenuShortcuts() const
1520 switch (mxData->meContextMenuShortcuts)
1522 case TRISTATE_FALSE:
1523 return false;
1524 case TRISTATE_TRUE:
1525 return true;
1526 default: // TRISTATE_INDET:
1527 return GetPreferredContextMenuShortcuts();
1531 void
1532 StyleSettings::SetPreferredContextMenuShortcuts( bool bContextMenuShortcuts )
1534 CopyData();
1535 mxData->mbPreferredContextMenuShortcuts = bContextMenuShortcuts;
1538 bool
1539 StyleSettings::GetPreferredContextMenuShortcuts() const
1541 return mxData->mbPreferredContextMenuShortcuts;
1544 void
1545 StyleSettings::SetPrimaryButtonWarpsSlider( bool bPrimaryButtonWarpsSlider )
1547 CopyData();
1548 mxData->mbPrimaryButtonWarpsSlider = bPrimaryButtonWarpsSlider;
1551 bool
1552 StyleSettings::GetPrimaryButtonWarpsSlider() const
1554 return mxData->mbPrimaryButtonWarpsSlider;
1557 void
1558 StyleSettings::SetAppFont( const vcl::Font& rFont )
1560 CopyData();
1561 mxData->maAppFont = rFont;
1564 const vcl::Font&
1565 StyleSettings::GetAppFont() const
1567 return mxData->maAppFont;
1570 void
1571 StyleSettings::SetHelpFont( const vcl::Font& rFont )
1573 CopyData();
1574 mxData->maHelpFont = rFont;
1577 const vcl::Font&
1578 StyleSettings::GetHelpFont() const
1580 return mxData->maHelpFont;
1583 void
1584 StyleSettings::SetTitleFont( const vcl::Font& rFont )
1586 CopyData();
1587 mxData->maTitleFont = rFont;
1590 const vcl::Font&
1591 StyleSettings::GetTitleFont() const
1593 return mxData->maTitleFont;
1596 void
1597 StyleSettings::SetFloatTitleFont( const vcl::Font& rFont )
1599 CopyData();
1600 mxData->maFloatTitleFont = rFont;
1603 const vcl::Font&
1604 StyleSettings::GetFloatTitleFont() const
1606 return mxData->maFloatTitleFont;
1609 void
1610 StyleSettings::SetMenuFont( const vcl::Font& rFont )
1612 CopyData();
1613 mxData->maMenuFont = rFont;
1616 const vcl::Font&
1617 StyleSettings::GetMenuFont() const
1619 return mxData->maMenuFont;
1622 void
1623 StyleSettings::SetToolFont( const vcl::Font& rFont )
1625 CopyData();
1626 mxData->maToolFont = rFont;
1629 const vcl::Font&
1630 StyleSettings::GetToolFont() const
1632 return mxData->maToolFont;
1635 void
1636 StyleSettings::SetGroupFont( const vcl::Font& rFont )
1638 CopyData();
1639 mxData->maGroupFont = rFont;
1642 const vcl::Font&
1643 StyleSettings::GetGroupFont() const
1645 return mxData->maGroupFont;
1648 void
1649 StyleSettings::SetLabelFont( const vcl::Font& rFont )
1651 CopyData();
1652 mxData->maLabelFont = rFont;
1655 const vcl::Font&
1656 StyleSettings::GetLabelFont() const
1658 return mxData->maLabelFont;
1661 void
1662 StyleSettings::SetRadioCheckFont( const vcl::Font& rFont )
1664 CopyData();
1665 mxData->maRadioCheckFont = rFont;
1668 const vcl::Font&
1669 StyleSettings::GetRadioCheckFont() const
1671 return mxData->maRadioCheckFont;
1674 void
1675 StyleSettings::SetPushButtonFont( const vcl::Font& rFont )
1677 CopyData();
1678 mxData->maPushButtonFont = rFont;
1681 const vcl::Font&
1682 StyleSettings::GetPushButtonFont() const
1684 return mxData->maPushButtonFont;
1687 void
1688 StyleSettings::SetFieldFont( const vcl::Font& rFont )
1690 CopyData();
1691 mxData->maFieldFont = rFont;
1694 const vcl::Font&
1695 StyleSettings::GetFieldFont() const
1697 return mxData->maFieldFont;
1700 void
1701 StyleSettings::SetIconFont( const vcl::Font& rFont )
1703 CopyData();
1704 mxData->maIconFont = rFont;
1707 const vcl::Font&
1708 StyleSettings::GetIconFont() const
1710 return mxData->maIconFont;
1713 void
1714 StyleSettings::SetTabFont( const vcl::Font& rFont )
1716 CopyData();
1717 mxData->maTabFont = rFont;
1720 const vcl::Font&
1721 StyleSettings::GetTabFont() const
1723 return mxData->maTabFont;
1726 long
1727 StyleSettings::GetBorderSize() const
1729 return mxData->mnBorderSize;
1732 void
1733 StyleSettings::SetTitleHeight( long nSize )
1735 CopyData();
1736 mxData->mnTitleHeight = nSize;
1739 long
1740 StyleSettings::GetTitleHeight() const
1742 return mxData->mnTitleHeight;
1745 void
1746 StyleSettings::SetFloatTitleHeight( long nSize )
1748 CopyData();
1749 mxData->mnFloatTitleHeight = nSize;
1752 long
1753 StyleSettings::GetFloatTitleHeight() const
1755 return mxData->mnFloatTitleHeight;
1758 long
1759 StyleSettings::GetTearOffTitleHeight() const
1761 return mxData->mnTearOffTitleHeight;
1764 void
1765 StyleSettings::SetScrollBarSize( long nSize )
1767 CopyData();
1768 mxData->mnScrollBarSize = nSize;
1771 long
1772 StyleSettings::GetScrollBarSize() const
1774 return mxData->mnScrollBarSize;
1777 void
1778 StyleSettings::SetMinThumbSize( long nSize )
1780 CopyData();
1781 mxData->mnMinThumbSize = nSize;
1784 long
1785 StyleSettings::GetMinThumbSize() const
1787 return mxData->mnMinThumbSize;
1790 void
1791 StyleSettings::SetSpinSize( long nSize )
1793 CopyData();
1794 mxData->mnSpinSize = nSize;
1797 long
1798 StyleSettings::GetSpinSize() const
1800 return mxData->mnSpinSize;
1803 long
1804 StyleSettings::GetSplitSize() const
1806 return mxData->mnSplitSize;
1809 void
1810 StyleSettings::SetCursorSize( long nSize )
1812 CopyData();
1813 mxData->mnCursorSize = nSize;
1816 long
1817 StyleSettings::GetCursorSize() const
1819 return mxData->mnCursorSize;
1822 void
1823 StyleSettings::SetCursorBlinkTime( sal_uInt64 nBlinkTime )
1825 CopyData();
1826 mxData->mnCursorBlinkTime = nBlinkTime;
1829 sal_uInt64
1830 StyleSettings::GetCursorBlinkTime() const
1832 return (long) mxData->mnCursorBlinkTime;
1835 void
1836 StyleSettings::SetDragFullOptions( DragFullOptions nOptions )
1838 CopyData();
1839 mxData->mnDragFullOptions = nOptions;
1842 DragFullOptions
1843 StyleSettings::GetDragFullOptions() const
1845 return mxData->mnDragFullOptions;
1848 void
1849 StyleSettings::SetSelectionOptions( SelectionOptions nOptions )
1851 CopyData();
1852 mxData->mnSelectionOptions = nOptions;
1855 SelectionOptions
1856 StyleSettings::GetSelectionOptions() const
1858 return mxData->mnSelectionOptions;
1861 void
1862 StyleSettings::SetDisplayOptions( DisplayOptions nOptions )
1864 CopyData();
1865 mxData->mnDisplayOptions = nOptions;
1868 DisplayOptions
1869 StyleSettings::GetDisplayOptions() const
1871 return mxData->mnDisplayOptions;
1874 void
1875 StyleSettings::SetAntialiasingMinPixelHeight( long nMinPixel )
1877 CopyData();
1878 mxData->mnAntialiasedMin = nMinPixel;
1881 sal_uLong
1882 StyleSettings::GetAntialiasingMinPixelHeight() const
1884 return mxData->mnAntialiasedMin;
1887 void
1888 StyleSettings::SetOptions( StyleSettingsOptions nOptions )
1890 CopyData();
1891 mxData->mnOptions = nOptions;
1894 void
1895 StyleSettings::SetAutoMnemonic( bool bAutoMnemonic )
1897 CopyData();
1898 mxData->mbAutoMnemonic = bAutoMnemonic;
1901 bool
1902 StyleSettings::GetAutoMnemonic() const
1904 return mxData->mbAutoMnemonic;
1907 bool
1908 StyleSettings::GetDockingFloatsSupported()
1910 ImplSVData* pSVData = ImplGetSVData();
1911 return pSVData->maNWFData.mbCanDetermineWindowPosition;
1914 void
1915 StyleSettings::SetFontColor( const Color& rColor )
1917 CopyData();
1918 mxData->maFontColor = rColor;
1921 const Color&
1922 StyleSettings::GetFontColor() const
1924 return mxData->maFontColor;
1927 void
1928 StyleSettings::SetToolbarIconSize( ToolbarIconSize nSize )
1930 CopyData();
1931 mxData->mnToolbarIconSize = nSize;
1934 ToolbarIconSize
1935 StyleSettings::GetToolbarIconSize() const
1937 return mxData->mnToolbarIconSize;
1940 const DialogStyle&
1941 StyleSettings::GetDialogStyle() const
1943 return mxData->maDialogStyle;
1946 void
1947 StyleSettings::SetDialogStyle( const DialogStyle& rStyle )
1949 CopyData();
1950 mxData->maDialogStyle = rStyle;
1953 const FrameStyle&
1954 StyleSettings::GetFrameStyle() const
1956 return mxData->maFrameStyle;
1959 void
1960 StyleSettings::SetFrameStyle( const FrameStyle& rStyle )
1962 CopyData();
1963 mxData->maFrameStyle = rStyle;
1966 void
1967 StyleSettings::SetEdgeBlending(sal_uInt16 nCount)
1969 CopyData();
1970 mxData->mnEdgeBlending = nCount;
1973 sal_uInt16
1974 StyleSettings::GetEdgeBlending() const
1976 return mxData->mnEdgeBlending;
1979 const Color&
1980 StyleSettings::GetEdgeBlendingTopLeftColor() const
1982 return mxData->maEdgeBlendingTopLeftColor;
1985 const Color&
1986 StyleSettings::GetEdgeBlendingBottomRightColor() const
1988 return mxData->maEdgeBlendingBottomRightColor;
1991 void
1992 StyleSettings::SetListBoxMaximumLineCount(sal_uInt16 nCount)
1994 CopyData();
1995 mxData->mnListBoxMaximumLineCount = nCount;
1998 sal_uInt16
1999 StyleSettings::GetListBoxMaximumLineCount() const
2001 return mxData->mnListBoxMaximumLineCount;
2004 void
2005 StyleSettings::SetColorValueSetColumnCount(sal_uInt16 nCount)
2007 CopyData();
2008 mxData->mnColorValueSetColumnCount = nCount;
2011 sal_uInt16
2012 StyleSettings::GetColorValueSetColumnCount() const
2014 return mxData->mnColorValueSetColumnCount;
2017 sal_uInt16
2018 StyleSettings::GetColorValueSetMaximumRowCount() const
2020 return mxData->mnColorValueSetMaximumRowCount;
2023 sal_uInt16
2024 StyleSettings::GetListBoxPreviewDefaultLineWidth() const
2026 return mxData->mnListBoxPreviewDefaultLineWidth;
2029 void
2030 StyleSettings::SetPreviewUsesCheckeredBackground(bool bNew)
2032 CopyData();
2033 mxData->mbPreviewUsesCheckeredBackground = bNew;
2036 bool
2037 StyleSettings::GetPreviewUsesCheckeredBackground() const
2039 return mxData->mbPreviewUsesCheckeredBackground;
2042 bool
2043 StyleSettings::operator !=( const StyleSettings& rSet ) const
2045 return !(*this == rSet);
2048 const Size& StyleSettings::GetListBoxPreviewDefaultPixelSize() const
2050 if(0 == mxData->maListBoxPreviewDefaultPixelSize.Width() || 0 == mxData->maListBoxPreviewDefaultPixelSize.Height())
2052 const_cast< StyleSettings* >(this)->mxData->maListBoxPreviewDefaultPixelSize =
2053 Application::GetDefaultDevice()->LogicToPixel(mxData->maListBoxPreviewDefaultLogicSize, MapUnit::MapAppFont);
2056 return mxData->maListBoxPreviewDefaultPixelSize;
2059 void StyleSettings::Set3DColors( const Color& rColor )
2061 CopyData();
2062 mxData->maFaceColor = rColor;
2063 mxData->maLightBorderColor = rColor;
2064 mxData->maMenuBorderColor = rColor;
2065 mxData->maDarkShadowColor = Color( COL_BLACK );
2066 if ( rColor != Color( COL_LIGHTGRAY ) )
2068 mxData->maLightColor = rColor;
2069 mxData->maShadowColor = rColor;
2070 mxData->maDarkShadowColor=rColor;
2071 mxData->maLightColor.IncreaseLuminance( 64 );
2072 mxData->maShadowColor.DecreaseLuminance( 64 );
2073 mxData->maDarkShadowColor.DecreaseLuminance( 100 );
2074 sal_uLong nRed = mxData->maLightColor.GetRed();
2075 sal_uLong nGreen = mxData->maLightColor.GetGreen();
2076 sal_uLong nBlue = mxData->maLightColor.GetBlue();
2077 nRed += (sal_uLong)(mxData->maShadowColor.GetRed());
2078 nGreen += (sal_uLong)(mxData->maShadowColor.GetGreen());
2079 nBlue += (sal_uLong)(mxData->maShadowColor.GetBlue());
2080 mxData->maCheckedColor = Color( (sal_uInt8)(nRed/2), (sal_uInt8)(nGreen/2), (sal_uInt8)(nBlue/2) );
2082 else
2084 mxData->maCheckedColor = Color( 0x99, 0x99, 0x99 );
2085 mxData->maLightColor = Color( COL_WHITE );
2086 mxData->maShadowColor = Color( COL_GRAY );
2090 void StyleSettings::SetCheckedColorSpecialCase( )
2092 CopyData();
2093 // Light gray checked color special case
2094 if ( GetFaceColor() == COL_LIGHTGRAY )
2095 mxData->maCheckedColor = Color( 0xCC, 0xCC, 0xCC );
2096 else
2098 sal_uInt8 nRed = (sal_uInt8)(((sal_uInt16)mxData->maFaceColor.GetRed() + (sal_uInt16)mxData->maLightColor.GetRed())/2);
2099 sal_uInt8 nGreen = (sal_uInt8)(((sal_uInt16)mxData->maFaceColor.GetGreen() + (sal_uInt16)mxData->maLightColor.GetGreen())/2);
2100 sal_uInt8 nBlue = (sal_uInt8)(((sal_uInt16)mxData->maFaceColor.GetBlue() + (sal_uInt16)mxData->maLightColor.GetBlue())/2);
2101 mxData->maCheckedColor = Color( nRed, nGreen, nBlue );
2105 bool StyleSettings::GetUseImagesInMenus() const
2107 // icon mode selected in Tools -> Options... -> OpenOffice.org -> View
2108 switch (mxData->meUseImagesInMenus) {
2109 case TRISTATE_FALSE:
2110 return false;
2111 case TRISTATE_TRUE:
2112 return true;
2113 default: // TRISTATE_INDET:
2114 return GetPreferredUseImagesInMenus();
2118 static BitmapEx readBitmapEx( const OUString& rPath )
2120 OUString aPath( rPath );
2121 rtl::Bootstrap::expandMacros( aPath );
2123 // import the image
2124 Graphic aGraphic;
2125 if ( GraphicFilter::LoadGraphic( aPath, OUString(), aGraphic ) != GRFILTER_OK )
2126 return BitmapEx();
2127 return aGraphic.GetBitmapEx();
2130 enum WhichPersona { PERSONA_HEADER, PERSONA_FOOTER };
2132 /** Update the setting of the Persona header / footer in ImplStyleData */
2133 static void setupPersonaHeaderFooter( WhichPersona eWhich, OUString& rHeaderFooter, BitmapEx& rHeaderFooterBitmap, boost::optional<Color>& rMenuBarTextColor )
2135 uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
2136 if ( !xContext.is() )
2137 return;
2139 // don't burn time loading images we don't need.
2140 if ( Application::IsHeadlessModeEnabled() )
2141 return;
2143 // read from the configuration
2144 OUString aPersona( officecfg::Office::Common::Misc::Persona::get( xContext ) );
2145 OUString aPersonaSettings( officecfg::Office::Common::Misc::PersonaSettings::get( xContext ) );
2147 // have the settings changed? marks if header /footer prepared before
2148 //should maybe extended to a flag that marks if header /footer /both are loaded
2149 OUString aOldValue= eWhich==PERSONA_HEADER?OUString(aPersona + ";" + aPersonaSettings+";h" ):OUString(aPersona + ";" + aPersonaSettings+";f" );
2150 if ( rHeaderFooter == aOldValue )
2151 return;
2153 rHeaderFooter = aOldValue;
2154 rHeaderFooterBitmap = BitmapEx();
2155 rMenuBarTextColor = boost::none;
2157 // now read the new values and setup bitmaps
2158 OUString aHeader, aFooter;
2159 if ( aPersona == "own" || aPersona == "default" )
2161 sal_Int32 nIndex = 0;
2162 aHeader = aPersonaSettings.getToken( 0, ';', nIndex );
2163 if ( nIndex > 0 )
2164 aFooter = aPersonaSettings.getToken( 0, ';', nIndex );
2166 // change menu text color, advance nIndex to skip the '#'
2167 if ( nIndex > 0 )
2169 OUString aColor = aPersonaSettings.getToken( 0, ';', ++nIndex );
2170 rMenuBarTextColor = Color( aColor.toUInt64( 16 ) );
2174 OUString aName;
2175 switch ( eWhich ) {
2176 case PERSONA_HEADER: aName = aHeader; break;
2177 case PERSONA_FOOTER: aName = aFooter; break;
2180 if ( !aName.isEmpty() )
2182 OUString gallery("");
2183 // try the gallery first, then the program path:
2184 if ( aPersona == "own" && !aPersonaSettings.startsWith( "vnd.sun.star.expand" ) )
2186 gallery = "${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE( "bootstrap") "::UserInstallation}";
2187 rtl::Bootstrap::expandMacros( gallery );
2188 gallery += "/user/gallery/personas/";
2190 else if ( aPersona == "default" )
2192 gallery = "$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER;
2193 gallery += "/gallery/personas/";
2195 rHeaderFooterBitmap = readBitmapEx( gallery + aName );
2197 if ( rHeaderFooterBitmap.IsEmpty() )
2198 rHeaderFooterBitmap = readBitmapEx( "$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" + aName );
2201 // Something went wrong. Probably, the images are missing. Clear the persona properties in the registry.
2203 if( rHeaderFooterBitmap.IsEmpty() )
2205 std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
2206 officecfg::Office::Common::Misc::Persona::set( "no", batch );
2207 officecfg::Office::Common::Misc::PersonaSettings::set( "", batch );
2208 batch->commit();
2212 const BitmapEx StyleSettings::GetPersonaHeader() const
2214 setupPersonaHeaderFooter( PERSONA_HEADER, mxData->maPersonaHeaderFooter, mxData->maPersonaHeaderBitmap, mxData->maPersonaMenuBarTextColor );
2215 return mxData->maPersonaHeaderBitmap;
2218 const BitmapEx StyleSettings::GetPersonaFooter() const
2220 setupPersonaHeaderFooter( PERSONA_FOOTER, mxData->maPersonaHeaderFooter, mxData->maPersonaFooterBitmap, mxData->maPersonaMenuBarTextColor );
2221 return mxData->maPersonaFooterBitmap;
2224 const boost::optional<Color>& StyleSettings::GetPersonaMenuBarTextColor() const
2226 GetPersonaHeader();
2227 return mxData->maPersonaMenuBarTextColor;
2230 void StyleSettings::SetStandardStyles()
2232 CopyData();
2233 mxData->SetStandardStyles();
2236 Color StyleSettings::GetFaceGradientColor() const
2238 // compute a brighter face color that can be used in gradients
2239 // for a convex look (eg toolbars)
2241 sal_uInt16 h, s, b;
2242 GetFaceColor().RGBtoHSB( h, s, b );
2243 if( s > 1) s=1;
2244 if( b < 98) b=98;
2245 return Color( Color::HSBtoRGB( h, s, b ) );
2248 Color StyleSettings::GetSeparatorColor() const
2250 // compute a brighter shadow color for separators (used in toolbars or between menubar and toolbars on Windows XP)
2251 sal_uInt16 h, s, b;
2252 GetShadowColor().RGBtoHSB( h, s, b );
2253 b += b/4;
2254 s -= s/4;
2255 return Color( Color::HSBtoRGB( h, s, b ) );
2258 void StyleSettings::CopyData()
2260 // copy if other references exist
2261 if ( ! mxData.unique() ) {
2262 mxData = std::make_shared<ImplStyleData>(*mxData);
2266 bool StyleSettings::operator ==( const StyleSettings& rSet ) const
2268 if ( mxData == rSet.mxData )
2269 return true;
2271 if (mxData->mIconTheme != rSet.mxData->mIconTheme) {
2272 return false;
2275 if (*mxData->mIconThemeSelector != *rSet.mxData->mIconThemeSelector) {
2276 return false;
2279 return (mxData->mnOptions == rSet.mxData->mnOptions) &&
2280 (mxData->mbAutoMnemonic == rSet.mxData->mbAutoMnemonic) &&
2281 (mxData->mnDragFullOptions == rSet.mxData->mnDragFullOptions) &&
2282 (mxData->mnSelectionOptions == rSet.mxData->mnSelectionOptions) &&
2283 (mxData->mnDisplayOptions == rSet.mxData->mnDisplayOptions) &&
2284 (mxData->mnCursorSize == rSet.mxData->mnCursorSize) &&
2285 (mxData->mnCursorBlinkTime == rSet.mxData->mnCursorBlinkTime) &&
2286 (mxData->mnBorderSize == rSet.mxData->mnBorderSize) &&
2287 (mxData->mnTitleHeight == rSet.mxData->mnTitleHeight) &&
2288 (mxData->mnFloatTitleHeight == rSet.mxData->mnFloatTitleHeight) &&
2289 (mxData->mnTearOffTitleHeight == rSet.mxData->mnTearOffTitleHeight) &&
2290 (mxData->mnScrollBarSize == rSet.mxData->mnScrollBarSize) &&
2291 (mxData->mnMinThumbSize == rSet.mxData->mnMinThumbSize) &&
2292 (mxData->mnSplitSize == rSet.mxData->mnSplitSize) &&
2293 (mxData->mnSpinSize == rSet.mxData->mnSpinSize) &&
2294 (mxData->mnAntialiasedMin == rSet.mxData->mnAntialiasedMin) &&
2295 (mxData->mbHighContrast == rSet.mxData->mbHighContrast) &&
2296 (mxData->mbUseSystemUIFonts == rSet.mxData->mbUseSystemUIFonts) &&
2297 (mxData->mnUseFlatBorders == rSet.mxData->mnUseFlatBorders) &&
2298 (mxData->mnUseFlatMenus == rSet.mxData->mnUseFlatMenus) &&
2299 (mxData->maFaceColor == rSet.mxData->maFaceColor) &&
2300 (mxData->maCheckedColor == rSet.mxData->maCheckedColor) &&
2301 (mxData->maLightColor == rSet.mxData->maLightColor) &&
2302 (mxData->maLightBorderColor == rSet.mxData->maLightBorderColor) &&
2303 (mxData->maShadowColor == rSet.mxData->maShadowColor) &&
2304 (mxData->maDarkShadowColor == rSet.mxData->maDarkShadowColor) &&
2305 (mxData->maButtonTextColor == rSet.mxData->maButtonTextColor) &&
2306 (mxData->maRadioCheckTextColor == rSet.mxData->maRadioCheckTextColor) &&
2307 (mxData->maGroupTextColor == rSet.mxData->maGroupTextColor) &&
2308 (mxData->maLabelTextColor == rSet.mxData->maLabelTextColor) &&
2309 (mxData->maWindowColor == rSet.mxData->maWindowColor) &&
2310 (mxData->maWindowTextColor == rSet.mxData->maWindowTextColor) &&
2311 (mxData->maDialogColor == rSet.mxData->maDialogColor) &&
2312 (mxData->maDialogTextColor == rSet.mxData->maDialogTextColor) &&
2313 (mxData->maWorkspaceColor == rSet.mxData->maWorkspaceColor) &&
2314 (mxData->maMonoColor == rSet.mxData->maMonoColor) &&
2315 (mxData->maFieldColor == rSet.mxData->maFieldColor) &&
2316 (mxData->maFieldTextColor == rSet.mxData->maFieldTextColor) &&
2317 (mxData->maActiveColor == rSet.mxData->maActiveColor) &&
2318 (mxData->maActiveTextColor == rSet.mxData->maActiveTextColor) &&
2319 (mxData->maActiveBorderColor == rSet.mxData->maActiveBorderColor) &&
2320 (mxData->maDeactiveColor == rSet.mxData->maDeactiveColor) &&
2321 (mxData->maDeactiveTextColor == rSet.mxData->maDeactiveTextColor) &&
2322 (mxData->maDeactiveBorderColor == rSet.mxData->maDeactiveBorderColor) &&
2323 (mxData->maMenuColor == rSet.mxData->maMenuColor) &&
2324 (mxData->maMenuBarColor == rSet.mxData->maMenuBarColor) &&
2325 (mxData->maMenuBarRolloverColor == rSet.mxData->maMenuBarRolloverColor) &&
2326 (mxData->maMenuBorderColor == rSet.mxData->maMenuBorderColor) &&
2327 (mxData->maMenuTextColor == rSet.mxData->maMenuTextColor) &&
2328 (mxData->maMenuBarTextColor == rSet.mxData->maMenuBarTextColor) &&
2329 (mxData->maMenuBarRolloverTextColor == rSet.mxData->maMenuBarRolloverTextColor) &&
2330 (mxData->maMenuHighlightColor == rSet.mxData->maMenuHighlightColor) &&
2331 (mxData->maMenuHighlightTextColor == rSet.mxData->maMenuHighlightTextColor) &&
2332 (mxData->maHighlightColor == rSet.mxData->maHighlightColor) &&
2333 (mxData->maHighlightTextColor == rSet.mxData->maHighlightTextColor) &&
2334 (mxData->maTabTextColor == rSet.mxData->maTabTextColor) &&
2335 (mxData->maTabRolloverTextColor == rSet.mxData->maTabRolloverTextColor) &&
2336 (mxData->maTabHighlightTextColor == rSet.mxData->maTabHighlightTextColor) &&
2337 (mxData->maActiveTabColor == rSet.mxData->maActiveTabColor) &&
2338 (mxData->maInactiveTabColor == rSet.mxData->maInactiveTabColor) &&
2339 (mxData->maDisableColor == rSet.mxData->maDisableColor) &&
2340 (mxData->maHelpColor == rSet.mxData->maHelpColor) &&
2341 (mxData->maHelpTextColor == rSet.mxData->maHelpTextColor) &&
2342 (mxData->maLinkColor == rSet.mxData->maLinkColor) &&
2343 (mxData->maVisitedLinkColor == rSet.mxData->maVisitedLinkColor) &&
2344 (mxData->maToolTextColor == rSet.mxData->maToolTextColor) &&
2345 (mxData->maHighlightLinkColor == rSet.mxData->maHighlightLinkColor) &&
2346 (mxData->maAppFont == rSet.mxData->maAppFont) &&
2347 (mxData->maHelpFont == rSet.mxData->maHelpFont) &&
2348 (mxData->maTitleFont == rSet.mxData->maTitleFont) &&
2349 (mxData->maFloatTitleFont == rSet.mxData->maFloatTitleFont) &&
2350 (mxData->maMenuFont == rSet.mxData->maMenuFont) &&
2351 (mxData->maToolFont == rSet.mxData->maToolFont) &&
2352 (mxData->maGroupFont == rSet.mxData->maGroupFont) &&
2353 (mxData->maLabelFont == rSet.mxData->maLabelFont) &&
2354 (mxData->maRadioCheckFont == rSet.mxData->maRadioCheckFont) &&
2355 (mxData->maPushButtonFont == rSet.mxData->maPushButtonFont) &&
2356 (mxData->maFieldFont == rSet.mxData->maFieldFont) &&
2357 (mxData->maIconFont == rSet.mxData->maIconFont) &&
2358 (mxData->maTabFont == rSet.mxData->maTabFont) &&
2359 (mxData->meUseImagesInMenus == rSet.mxData->meUseImagesInMenus) &&
2360 (mxData->mbPreferredUseImagesInMenus == rSet.mxData->mbPreferredUseImagesInMenus) &&
2361 (mxData->mbSkipDisabledInMenus == rSet.mxData->mbSkipDisabledInMenus) &&
2362 (mxData->mbHideDisabledMenuItems == rSet.mxData->mbHideDisabledMenuItems) &&
2363 (mxData->mbPreferredContextMenuShortcuts == rSet.mxData->mbPreferredContextMenuShortcuts)&&
2364 (mxData->meContextMenuShortcuts == rSet.mxData->meContextMenuShortcuts) &&
2365 (mxData->mbPrimaryButtonWarpsSlider == rSet.mxData->mbPrimaryButtonWarpsSlider) &&
2366 (mxData->maFontColor == rSet.mxData->maFontColor) &&
2367 (mxData->mnEdgeBlending == rSet.mxData->mnEdgeBlending) &&
2368 (mxData->maEdgeBlendingTopLeftColor == rSet.mxData->maEdgeBlendingTopLeftColor) &&
2369 (mxData->maEdgeBlendingBottomRightColor == rSet.mxData->maEdgeBlendingBottomRightColor) &&
2370 (mxData->mnListBoxMaximumLineCount == rSet.mxData->mnListBoxMaximumLineCount) &&
2371 (mxData->mnColorValueSetColumnCount == rSet.mxData->mnColorValueSetColumnCount) &&
2372 (mxData->mnColorValueSetMaximumRowCount == rSet.mxData->mnColorValueSetMaximumRowCount) &&
2373 (mxData->maListBoxPreviewDefaultLogicSize == rSet.mxData->maListBoxPreviewDefaultLogicSize) &&
2374 (mxData->maListBoxPreviewDefaultPixelSize == rSet.mxData->maListBoxPreviewDefaultPixelSize) &&
2375 (mxData->mnListBoxPreviewDefaultLineWidth == rSet.mxData->mnListBoxPreviewDefaultLineWidth) &&
2376 (mxData->mbPreviewUsesCheckeredBackground == rSet.mxData->mbPreviewUsesCheckeredBackground);
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 return (mxData->mnEnableATT == rSet.mxData->mnEnableATT ) &&
2414 (mxData->mnDisablePrinting == rSet.mxData->mnDisablePrinting ) &&
2415 (mxData->mbEnableLocalizedDecimalSep == rSet.mxData->mbEnableLocalizedDecimalSep );
2418 bool
2419 MiscSettings::operator !=( const MiscSettings& rSet ) const
2421 return !(*this == rSet);
2424 bool MiscSettings::GetDisablePrinting() const
2426 if( mxData->mnDisablePrinting == TRISTATE_INDET )
2428 OUString aEnable =
2429 vcl::SettingsConfigItem::get()->
2430 getValue( "DesktopManagement",
2431 "DisablePrinting" );
2432 mxData->mnDisablePrinting = aEnable.equalsIgnoreAsciiCase("true") ? TRISTATE_TRUE : TRISTATE_FALSE;
2435 return mxData->mnDisablePrinting != TRISTATE_FALSE;
2438 bool MiscSettings::GetEnableATToolSupport() const
2441 #ifdef _WIN32
2442 if( mxData->mnEnableATT == TRISTATE_INDET )
2444 // Check in the Windows registry if an AT tool wants Accessibility support to
2445 // be activated ..
2446 HKEY hkey;
2448 if( ERROR_SUCCESS == RegOpenKey(HKEY_CURRENT_USER,
2449 "Software\\LibreOffice\\Accessibility\\AtToolSupport",
2450 &hkey) )
2452 DWORD dwType;
2453 sal_uInt8 Data[6]; // possible values: "true", "false", "1", "0", DWORD
2454 DWORD cbData = sizeof(Data);
2456 if( ERROR_SUCCESS == RegQueryValueEx(hkey, "SupportAssistiveTechnology",
2457 nullptr, &dwType, Data, &cbData) )
2459 switch (dwType)
2461 case REG_SZ:
2462 mxData->mnEnableATT = ((0 == stricmp(reinterpret_cast<const char *>(Data), "1")) || (0 == stricmp(reinterpret_cast<const char *>(Data), "true"))) ? TRISTATE_TRUE : TRISTATE_FALSE;
2463 break;
2464 case REG_DWORD:
2465 switch (reinterpret_cast<DWORD *>(Data)[0]) {
2466 case 0:
2467 mxData->mnEnableATT = TRISTATE_FALSE;
2468 break;
2469 case 1:
2470 mxData->mnEnableATT = TRISTATE_TRUE;
2471 break;
2472 default:
2473 mxData->mnEnableATT = TRISTATE_INDET;
2474 //TODO: or TRISTATE_TRUE?
2475 break;
2477 break;
2478 default:
2479 // Unsupported registry type
2480 break;
2484 RegCloseKey(hkey);
2487 #endif
2489 if( mxData->mnEnableATT == TRISTATE_INDET )
2491 static const char* pEnv = getenv("SAL_ACCESSIBILITY_ENABLED" );
2492 if( !pEnv || !*pEnv )
2494 OUString aEnable =
2495 vcl::SettingsConfigItem::get()->
2496 getValue( "Accessibility",
2497 "EnableATToolSupport" );
2498 mxData->mnEnableATT = aEnable.equalsIgnoreAsciiCase("true") ? TRISTATE_TRUE : TRISTATE_FALSE;
2500 else
2502 mxData->mnEnableATT = TRISTATE_TRUE;
2506 return mxData->mnEnableATT != TRISTATE_FALSE;
2509 #ifdef _WIN32
2510 void MiscSettings::SetEnableATToolSupport( bool bEnable )
2512 if ( (bEnable ? TRISTATE_TRUE : TRISTATE_FALSE) != mxData->mnEnableATT )
2514 if( bEnable && !ImplInitAccessBridge() )
2515 return;
2517 HKEY hkey;
2519 // If the accessibility key in the Windows registry exists, change it synchronously
2520 if( ERROR_SUCCESS == RegOpenKey(HKEY_CURRENT_USER,
2521 "Software\\LibreOffice\\Accessibility\\AtToolSupport",
2522 &hkey) )
2524 DWORD dwType;
2525 sal_uInt8 Data[6]; // possible values: "true", "false", 1, 0
2526 DWORD cbData = sizeof(Data);
2528 if( ERROR_SUCCESS == RegQueryValueEx(hkey, "SupportAssistiveTechnology",
2529 nullptr, &dwType, Data, &cbData) )
2531 switch (dwType)
2533 case REG_SZ:
2534 RegSetValueEx(hkey, "SupportAssistiveTechnology",
2535 0, dwType,
2536 reinterpret_cast<sal_uInt8 const *>(bEnable ? "true" : "false"),
2537 bEnable ? sizeof("true") : sizeof("false"));
2538 break;
2539 case REG_DWORD:
2540 reinterpret_cast<DWORD *>(Data)[0] = bEnable ? 1 : 0;
2541 RegSetValueEx(hkey, "SupportAssistiveTechnology",
2542 0, dwType, Data, sizeof(DWORD));
2543 break;
2544 default:
2545 // Unsupported registry type
2546 break;
2550 RegCloseKey(hkey);
2553 vcl::SettingsConfigItem::get()->
2554 setValue( "Accessibility",
2555 "EnableATToolSupport",
2556 bEnable ? OUString("true") : OUString("false" ) );
2557 mxData->mnEnableATT = bEnable ? TRISTATE_TRUE : TRISTATE_FALSE;
2560 #endif
2562 void MiscSettings::SetEnableLocalizedDecimalSep( bool bEnable )
2564 // copy if other references exist
2565 if ( ! mxData.unique() ) {
2566 mxData = std::make_shared<ImplMiscData>(*mxData);
2568 mxData->mbEnableLocalizedDecimalSep = bEnable;
2571 bool MiscSettings::GetEnableLocalizedDecimalSep() const
2573 return mxData->mbEnableLocalizedDecimalSep;
2576 bool MiscSettings::GetPseudoHeadless() const
2578 return mxData->mbPseudoHeadless;
2581 ImplHelpData::ImplHelpData()
2583 mnTipDelay = 500;
2584 mnTipTimeout = 3000;
2585 mnBalloonDelay = 1500;
2588 ImplHelpData::ImplHelpData( const ImplHelpData& rData )
2590 mnTipDelay = rData.mnTipDelay;
2591 mnTipTimeout = rData.mnTipTimeout;
2592 mnBalloonDelay = rData.mnBalloonDelay;
2595 HelpSettings::HelpSettings()
2596 : mxData(std::make_shared<ImplHelpData>())
2600 HelpSettings::~HelpSettings()
2604 bool HelpSettings::operator ==( const HelpSettings& rSet ) const
2606 if ( mxData == rSet.mxData )
2607 return true;
2609 return (mxData->mnTipDelay == rSet.mxData->mnTipDelay ) &&
2610 (mxData->mnTipTimeout == rSet.mxData->mnTipTimeout ) &&
2611 (mxData->mnBalloonDelay == rSet.mxData->mnBalloonDelay );
2614 sal_uLong
2615 HelpSettings::GetTipDelay() const
2617 return mxData->mnTipDelay;
2620 void
2621 HelpSettings::SetTipTimeout( sal_uLong nTipTimeout )
2623 // copy if other references exist
2624 if ( ! mxData.unique() ) {
2625 mxData = std::make_shared<ImplHelpData>(*mxData);
2627 mxData->mnTipTimeout = nTipTimeout;
2630 sal_uLong
2631 HelpSettings::GetTipTimeout() const
2633 return mxData->mnTipTimeout;
2636 sal_uLong
2637 HelpSettings::GetBalloonDelay() const
2639 return mxData->mnBalloonDelay;
2642 bool
2643 HelpSettings::operator !=( const HelpSettings& rSet ) const
2645 return !(*this == rSet);
2648 ImplAllSettingsData::ImplAllSettingsData()
2650 maLocale( LANGUAGE_SYSTEM ),
2651 maUILocale( LANGUAGE_SYSTEM )
2653 mnWindowUpdate = AllSettingsFlags::MOUSE | AllSettingsFlags::STYLE |
2654 AllSettingsFlags::MISC | AllSettingsFlags::LOCALE;
2655 mpLocaleDataWrapper = nullptr;
2656 mpUILocaleDataWrapper = nullptr;
2657 mpI18nHelper = nullptr;
2658 mpUII18nHelper = nullptr;
2659 if (!utl::ConfigManager::IsAvoidConfig())
2660 maMiscSettings.SetEnableLocalizedDecimalSep( maSysLocale.GetOptions().IsDecimalSeparatorAsLocale() );
2663 ImplAllSettingsData::ImplAllSettingsData( const ImplAllSettingsData& rData ) :
2664 maMouseSettings( rData.maMouseSettings ),
2665 maStyleSettings( rData.maStyleSettings ),
2666 maMiscSettings( rData.maMiscSettings ),
2667 maHelpSettings( rData.maHelpSettings ),
2668 maLocale( rData.maLocale ),
2669 maUILocale( rData.maUILocale )
2671 mnWindowUpdate = rData.mnWindowUpdate;
2672 // Pointer couldn't shared and objects haven't a copy ctor
2673 // So we create the cache objects new, if the GetFunction is
2674 // called
2675 mpLocaleDataWrapper = nullptr;
2676 mpUILocaleDataWrapper = nullptr;
2677 mpI18nHelper = nullptr;
2678 mpUII18nHelper = nullptr;
2681 ImplAllSettingsData::~ImplAllSettingsData()
2683 delete mpLocaleDataWrapper;
2684 delete mpUILocaleDataWrapper;
2685 delete mpI18nHelper;
2686 delete mpUII18nHelper;
2689 AllSettings::AllSettings()
2690 : mxData(std::make_shared<ImplAllSettingsData>())
2694 AllSettings::AllSettings( const AllSettings& rSet )
2696 mxData = rSet.mxData;
2699 AllSettings::~AllSettings()
2703 void AllSettings::CopyData()
2705 // copy if other references exist
2706 if ( ! mxData.unique() ) {
2707 mxData = std::make_shared<ImplAllSettingsData>(*mxData);
2712 AllSettingsFlags AllSettings::Update( AllSettingsFlags nFlags, const AllSettings& rSet )
2715 AllSettingsFlags nChangeFlags = AllSettingsFlags::NONE;
2717 if ( nFlags & AllSettingsFlags::MOUSE )
2719 if ( mxData->maMouseSettings != rSet.mxData->maMouseSettings )
2721 CopyData();
2722 mxData->maMouseSettings = rSet.mxData->maMouseSettings;
2723 nChangeFlags |= AllSettingsFlags::MOUSE;
2727 if ( nFlags & AllSettingsFlags::STYLE )
2729 if ( mxData->maStyleSettings != rSet.mxData->maStyleSettings )
2731 CopyData();
2732 mxData->maStyleSettings = rSet.mxData->maStyleSettings;
2733 nChangeFlags |= AllSettingsFlags::STYLE;
2737 if ( nFlags & AllSettingsFlags::MISC )
2739 if ( mxData->maMiscSettings != rSet.mxData->maMiscSettings )
2741 CopyData();
2742 mxData->maMiscSettings = rSet.mxData->maMiscSettings;
2743 nChangeFlags |= AllSettingsFlags::MISC;
2747 if ( nFlags & AllSettingsFlags::LOCALE )
2749 if ( mxData->maLocale != rSet.mxData->maLocale )
2751 SetLanguageTag( rSet.mxData->maLocale );
2752 nChangeFlags |= AllSettingsFlags::LOCALE;
2756 return nChangeFlags;
2759 AllSettingsFlags AllSettings::GetChangeFlags( const AllSettings& rSet ) const
2762 AllSettingsFlags nChangeFlags = AllSettingsFlags::NONE;
2764 if ( mxData->maStyleSettings != rSet.mxData->maStyleSettings )
2765 nChangeFlags |= AllSettingsFlags::STYLE;
2767 if ( mxData->maMiscSettings != rSet.mxData->maMiscSettings )
2768 nChangeFlags |= AllSettingsFlags::MISC;
2770 if ( mxData->maLocale != rSet.mxData->maLocale )
2771 nChangeFlags |= AllSettingsFlags::LOCALE;
2773 return nChangeFlags;
2776 bool AllSettings::operator ==( const AllSettings& rSet ) const
2778 if ( mxData == rSet.mxData )
2779 return true;
2781 if ( (mxData->maMouseSettings == rSet.mxData->maMouseSettings) &&
2782 (mxData->maStyleSettings == rSet.mxData->maStyleSettings) &&
2783 (mxData->maMiscSettings == rSet.mxData->maMiscSettings) &&
2784 (mxData->maHelpSettings == rSet.mxData->maHelpSettings) &&
2785 (mxData->maLocale == rSet.mxData->maLocale) &&
2786 (mxData->mnWindowUpdate == rSet.mxData->mnWindowUpdate) )
2788 return true;
2791 return false;
2794 void AllSettings::SetLanguageTag( const LanguageTag& rLanguageTag )
2796 if (mxData->maLocale != rLanguageTag)
2798 CopyData();
2800 mxData->maLocale = rLanguageTag;
2802 if ( mxData->mpLocaleDataWrapper )
2804 delete mxData->mpLocaleDataWrapper;
2805 mxData->mpLocaleDataWrapper = nullptr;
2807 if ( mxData->mpI18nHelper )
2809 delete mxData->mpI18nHelper;
2810 mxData->mpI18nHelper = nullptr;
2815 namespace
2817 bool GetConfigLayoutRTL(bool bMath)
2819 static const char* pEnv = getenv("SAL_RTL_ENABLED" );
2820 static int nUIMirroring = -1; // -1: undef, 0: auto, 1: on 2: off
2822 // environment always overrides
2823 if( pEnv )
2824 return true;
2826 bool bRTL = false;
2828 if( nUIMirroring == -1 )
2830 nUIMirroring = 0; // ask configuration only once
2831 utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithComponentContext(
2832 comphelper::getProcessComponentContext(),
2833 "org.openoffice.Office.Common/I18N/CTL" ); // note: case sensitive !
2834 if ( aNode.isValid() )
2836 bool bTmp = bool();
2837 css::uno::Any aValue = aNode.getNodeValue( OUString("UIMirroring") );
2838 if( aValue >>= bTmp )
2840 // found true or false; if it was nil, nothing is changed
2841 nUIMirroring = bTmp ? 1 : 2;
2846 if( nUIMirroring == 0 ) // no config found (eg, setup) or default (nil) was set: check language
2848 LanguageType aLang = SvtSysLocaleOptions().GetRealUILanguageTag().getLanguageType();
2849 if (bMath)
2850 bRTL = MsLangId::isRightToLeftMath( aLang );
2851 else
2852 bRTL = MsLangId::isRightToLeft( aLang );
2854 else
2855 bRTL = (nUIMirroring == 1);
2857 return bRTL;
2861 bool AllSettings::GetLayoutRTL()
2863 if (utl::ConfigManager::IsAvoidConfig())
2864 return false;
2865 return GetConfigLayoutRTL(false);
2868 bool AllSettings::GetMathLayoutRTL()
2870 if (utl::ConfigManager::IsAvoidConfig())
2871 return false;
2872 return GetConfigLayoutRTL(true);
2875 const LanguageTag& AllSettings::GetLanguageTag() const
2877 if (utl::ConfigManager::IsAvoidConfig())
2879 static LanguageTag aRet("en-US");
2880 return aRet;
2883 // SYSTEM locale means: use settings from SvtSysLocale that is resolved
2884 if ( mxData->maLocale.isSystemLocale() )
2885 mxData->maLocale = mxData->maSysLocale.GetLanguageTag();
2887 return mxData->maLocale;
2890 const LanguageTag& AllSettings::GetUILanguageTag() const
2892 if (utl::ConfigManager::IsAvoidConfig())
2894 static LanguageTag aRet("en-US");
2895 return aRet;
2898 // the UILocale is never changed
2899 if ( mxData->maUILocale.isSystemLocale() )
2900 mxData->maUILocale = mxData->maSysLocale.GetUILanguageTag();
2902 return mxData->maUILocale;
2905 const LocaleDataWrapper& AllSettings::GetLocaleDataWrapper() const
2907 if ( !mxData->mpLocaleDataWrapper )
2908 const_cast<AllSettings*>(this)->mxData->mpLocaleDataWrapper = new LocaleDataWrapper(
2909 comphelper::getProcessComponentContext(), GetLanguageTag() );
2910 return *mxData->mpLocaleDataWrapper;
2913 const LocaleDataWrapper& AllSettings::GetUILocaleDataWrapper() const
2915 if ( !mxData->mpUILocaleDataWrapper )
2916 const_cast<AllSettings*>(this)->mxData->mpUILocaleDataWrapper = new LocaleDataWrapper(
2917 comphelper::getProcessComponentContext(), GetUILanguageTag() );
2918 return *mxData->mpUILocaleDataWrapper;
2921 const vcl::I18nHelper& AllSettings::GetLocaleI18nHelper() const
2923 if ( !mxData->mpI18nHelper ) {
2924 const_cast<AllSettings*>(this)->mxData->mpI18nHelper = new vcl::I18nHelper(
2925 comphelper::getProcessComponentContext(), GetLanguageTag() );
2927 return *mxData->mpI18nHelper;
2930 const vcl::I18nHelper& AllSettings::GetUILocaleI18nHelper() const
2932 if ( !mxData->mpUII18nHelper ) {
2933 const_cast<AllSettings*>(this)->mxData->mpUII18nHelper = new vcl::I18nHelper(
2934 comphelper::getProcessComponentContext(), GetUILanguageTag() );
2936 return *mxData->mpUII18nHelper;
2939 void AllSettings::LocaleSettingsChanged( ConfigurationHints nHint )
2941 AllSettings aAllSettings( Application::GetSettings() );
2942 if ( nHint & ConfigurationHints::DecSep )
2944 MiscSettings aMiscSettings = aAllSettings.GetMiscSettings();
2945 bool bIsDecSepAsLocale = aAllSettings.mxData->maSysLocale.GetOptions().IsDecimalSeparatorAsLocale();
2946 if ( aMiscSettings.GetEnableLocalizedDecimalSep() != bIsDecSepAsLocale )
2948 aMiscSettings.SetEnableLocalizedDecimalSep( bIsDecSepAsLocale );
2949 aAllSettings.SetMiscSettings( aMiscSettings );
2953 if ( nHint & ConfigurationHints::Locale )
2954 aAllSettings.SetLanguageTag( aAllSettings.mxData->maSysLocale.GetOptions().GetLanguageTag() );
2956 Application::SetSettings( aAllSettings );
2959 const StyleSettings&
2960 AllSettings::GetStyleSettings() const
2962 return mxData->maStyleSettings;
2965 StyleSettingsOptions
2966 StyleSettings::GetOptions() const
2968 return mxData->mnOptions;
2971 std::vector<vcl::IconThemeInfo>
2972 StyleSettings::GetInstalledIconThemes() const
2974 return mxData->mIconThemeScanner->GetFoundIconThemes();
2977 /*static*/ OUString
2978 StyleSettings::GetAutomaticallyChosenIconTheme() const
2980 OUString desktopEnvironment = Application::GetDesktopEnvironment();
2981 OUString themeName = mxData->mIconThemeSelector->SelectIconThemeForDesktopEnvironment(
2982 mxData->mIconThemeScanner->GetFoundIconThemes(),
2983 desktopEnvironment
2985 return themeName;
2988 void
2989 StyleSettings::SetIconTheme(const OUString& theme)
2991 CopyData();
2992 mxData->mIconTheme = theme;
2995 OUString
2996 StyleSettings::DetermineIconTheme() const
2998 OUString sTheme(mxData->mIconTheme);
2999 if (sTheme.isEmpty())
3001 if (utl::ConfigManager::IsAvoidConfig())
3002 sTheme = "galaxy";
3003 else
3005 // read from the configuration, or fallback to what the desktop wants
3006 uno::Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext());
3007 if (xContext.is())
3009 sTheme = officecfg::Office::Common::Misc::SymbolStyle::get(xContext);
3011 if (sTheme.isEmpty() || sTheme == "auto")
3012 sTheme = GetAutomaticallyChosenIconTheme();
3017 OUString r = mxData->mIconThemeSelector->SelectIconTheme(
3018 mxData->mIconThemeScanner->GetFoundIconThemes(),
3019 sTheme);
3020 return r;
3023 void
3024 StyleSettings::SetHighContrastMode(bool bHighContrast )
3026 if (mxData->mbHighContrast == bHighContrast) {
3027 return;
3030 CopyData();
3031 mxData->mbHighContrast = bHighContrast;
3032 mxData->mIconThemeSelector->SetUseHighContrastTheme(bHighContrast);
3035 bool
3036 StyleSettings::GetHighContrastMode() const
3038 return mxData->mbHighContrast;
3041 void
3042 StyleSettings::SetPreferredIconTheme(const OUString& theme, bool bDarkIconTheme)
3044 mxData->mIconThemeSelector->SetPreferredIconTheme(theme, bDarkIconTheme);
3047 void
3048 AllSettings::SetMouseSettings( const MouseSettings& rSet )
3050 CopyData();
3051 mxData->maMouseSettings = rSet;
3054 const MouseSettings&
3055 AllSettings::GetMouseSettings() const
3057 return mxData->maMouseSettings;
3060 void
3061 AllSettings::SetStyleSettings( const StyleSettings& rSet )
3063 CopyData();
3064 mxData->maStyleSettings = rSet;
3067 void
3068 AllSettings::SetMiscSettings( const MiscSettings& rSet )
3070 CopyData();
3071 mxData->maMiscSettings = rSet;
3074 const MiscSettings&
3075 AllSettings::GetMiscSettings() const
3077 return mxData->maMiscSettings;
3080 void
3081 AllSettings::SetHelpSettings( const HelpSettings& rSet )
3083 CopyData();
3084 mxData->maHelpSettings = rSet;
3087 const HelpSettings&
3088 AllSettings::GetHelpSettings() const
3090 return mxData->maHelpSettings;
3093 AllSettingsFlags
3094 AllSettings::GetWindowUpdate() const
3096 return mxData->mnWindowUpdate;
3099 bool
3100 AllSettings::operator !=( const AllSettings& rSet ) const
3102 return !(*this == rSet);
3105 SvtSysLocale&
3106 AllSettings::GetSysLocale()
3108 return mxData->maSysLocale;
3111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */