Branch libreoffice-5-0-4
[LibreOffice.git] / vcl / source / app / settings.cxx
blob664f755411f96d6bdb188a5ac4c2b5c687c6b2ea
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 WNT
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 <vcl/graphicfilter.hxx>
36 #include <vcl/IconThemeScanner.hxx>
37 #include <vcl/IconThemeSelector.hxx>
38 #include <vcl/IconThemeInfo.hxx>
39 #include <vcl/svapp.hxx>
40 #include <vcl/event.hxx>
41 #include <vcl/settings.hxx>
42 #include <vcl/i18nhelp.hxx>
43 #include <vcl/implimagetree.hxx>
44 #include <vcl/configsettings.hxx>
45 #include <vcl/gradient.hxx>
46 #include <vcl/outdev.hxx>
48 #include "unotools/fontcfg.hxx"
49 #include "unotools/localedatawrapper.hxx"
50 #include "unotools/collatorwrapper.hxx"
51 #include "unotools/confignode.hxx"
52 #include "unotools/syslocaleoptions.hxx"
54 using namespace ::com::sun::star;
56 #include "svdata.hxx"
58 struct ImplMouseData
60 ImplMouseData();
61 ImplMouseData( const ImplMouseData& rData );
63 MouseSettingsOptions mnOptions;
64 sal_uInt64 mnDoubleClkTime;
65 long mnDoubleClkWidth;
66 long mnDoubleClkHeight;
67 long mnStartDragWidth;
68 long mnStartDragHeight;
69 sal_uInt16 mnStartDragCode;
70 sal_uInt16 mnContextMenuCode;
71 sal_uInt16 mnContextMenuClicks;
72 sal_uLong mnScrollRepeat;
73 sal_uLong mnButtonStartRepeat;
74 sal_uLong mnButtonRepeat;
75 sal_uLong mnActionDelay;
76 sal_uLong mnMenuDelay;
77 MouseFollowFlags mnFollow;
78 MouseMiddleButtonAction mnMiddleButtonAction;
79 MouseWheelBehaviour mnWheelBehavior;
82 struct ImplStyleData
84 ImplStyleData();
85 ImplStyleData( const ImplStyleData& rData );
87 void SetStandardStyles();
89 Color maActiveBorderColor;
90 Color maActiveColor;
91 Color maActiveTextColor;
92 Color maAlternatingRowColor;
93 Color maButtonTextColor;
94 Color maButtonRolloverTextColor;
95 Color maCheckedColor;
96 Color maDarkShadowColor;
97 Color maDeactiveBorderColor;
98 Color maDeactiveColor;
99 Color maDeactiveTextColor;
100 Color maDialogColor;
101 Color maDialogTextColor;
102 Color maDisableColor;
103 Color maFaceColor;
104 Color maFieldColor;
105 Color maFieldTextColor;
106 Color maFieldRolloverTextColor;
107 Color maFontColor;
108 Color maGroupTextColor;
109 Color maHelpColor;
110 Color maHelpTextColor;
111 Color maHighlightColor;
112 Color maHighlightLinkColor;
113 Color maHighlightTextColor;
114 Color maInfoTextColor;
115 Color maLabelTextColor;
116 Color maLightBorderColor;
117 Color maLightColor;
118 Color maLinkColor;
119 Color maMenuBarColor;
120 Color maMenuBarRolloverColor;
121 Color maMenuBorderColor;
122 Color maMenuColor;
123 Color maMenuHighlightColor;
124 Color maMenuHighlightTextColor;
125 Color maMenuTextColor;
126 Color maMenuBarTextColor;
127 Color maMenuBarRolloverTextColor;
128 Color maMenuBarHighlightTextColor;
129 Color maMonoColor;
130 Color maRadioCheckTextColor;
131 Color maShadowColor;
132 Color maVisitedLinkColor;
133 Color maWindowColor;
134 Color maWindowTextColor;
135 Color maWorkspaceColor;
136 Color maActiveTabColor;
137 Color maInactiveTabColor;
138 Color maTabTextColor;
139 Color maTabRolloverTextColor;
140 Color maTabHighlightTextColor;
141 vcl::Font maAppFont;
142 vcl::Font maHelpFont;
143 vcl::Font maTitleFont;
144 vcl::Font maFloatTitleFont;
145 vcl::Font maMenuFont;
146 vcl::Font maToolFont;
147 vcl::Font maLabelFont;
148 vcl::Font maInfoFont;
149 vcl::Font maRadioCheckFont;
150 vcl::Font maPushButtonFont;
151 vcl::Font maFieldFont;
152 vcl::Font maIconFont;
153 vcl::Font maTabFont;
154 vcl::Font maGroupFont;
155 long mnBorderSize;
156 long mnTitleHeight;
157 long mnFloatTitleHeight;
158 long mnTearOffTitleHeight;
159 long mnScrollBarSize;
160 long mnSplitSize;
161 long mnSpinSize;
162 long mnCursorSize;
163 long mnAntialiasedMin;
164 sal_uInt64 mnCursorBlinkTime;
165 DragFullOptions mnDragFullOptions;
166 SelectionOptions mnSelectionOptions;
167 DisplayOptions mnDisplayOptions;
168 ToolbarIconSize mnToolbarIconSize;
169 bool mnUseFlatMenus;
170 StyleSettingsOptions mnOptions;
171 sal_uInt16 mnScreenZoom;
172 sal_uInt16 mnScreenFontZoom;
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 mbAcceleratorsInContextMenus;
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;
194 const void* mpFontOptions;
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 mnScreenZoom = 100;
541 mnScreenFontZoom = 100;
542 mnDragFullOptions = DragFullOptions::All;
543 mnSelectionOptions = SelectionOptions::NONE;
544 mnDisplayOptions = DisplayOptions::NONE;
545 mnOptions = StyleSettingsOptions::NONE;
546 mbAutoMnemonic = true;
547 mnToolbarIconSize = ToolbarIconSize::Unknown;
548 meUseImagesInMenus = TRISTATE_INDET;
549 mpFontOptions = NULL;
550 mnEdgeBlending = 35;
551 maEdgeBlendingTopLeftColor = RGB_COLORDATA(0xC0, 0xC0, 0xC0);
552 maEdgeBlendingBottomRightColor = RGB_COLORDATA(0x40, 0x40, 0x40);
553 mnListBoxMaximumLineCount = 25;
554 mnColorValueSetColumnCount = 12;
555 mnColorValueSetMaximumRowCount = 20;
556 maListBoxPreviewDefaultLogicSize = Size(15, 7);
557 maListBoxPreviewDefaultPixelSize = Size(0, 0); // on-demand calculated in GetListBoxPreviewDefaultPixelSize()
558 mnListBoxPreviewDefaultLineWidth = 1;
559 mbPreviewUsesCheckeredBackground = true;
561 SetStandardStyles();
564 ImplStyleData::ImplStyleData( const ImplStyleData& rData ) :
565 maActiveBorderColor( rData.maActiveBorderColor ),
566 maActiveColor( rData.maActiveColor ),
567 maActiveTextColor( rData.maActiveTextColor ),
568 maAlternatingRowColor( rData.maAlternatingRowColor ),
569 maButtonTextColor( rData.maButtonTextColor ),
570 maButtonRolloverTextColor( rData.maButtonRolloverTextColor ),
571 maCheckedColor( rData.maCheckedColor ),
572 maDarkShadowColor( rData.maDarkShadowColor ),
573 maDeactiveBorderColor( rData.maDeactiveBorderColor ),
574 maDeactiveColor( rData.maDeactiveColor ),
575 maDeactiveTextColor( rData.maDeactiveTextColor ),
576 maDialogColor( rData.maDialogColor ),
577 maDialogTextColor( rData.maDialogTextColor ),
578 maDisableColor( rData.maDisableColor ),
579 maFaceColor( rData.maFaceColor ),
580 maFieldColor( rData.maFieldColor ),
581 maFieldTextColor( rData.maFieldTextColor ),
582 maFieldRolloverTextColor( rData.maFieldRolloverTextColor ),
583 maFontColor( rData.maFontColor ),
584 maGroupTextColor( rData.maGroupTextColor ),
585 maHelpColor( rData.maHelpColor ),
586 maHelpTextColor( rData.maHelpTextColor ),
587 maHighlightColor( rData.maHighlightColor ),
588 maHighlightLinkColor( rData.maHighlightLinkColor ),
589 maHighlightTextColor( rData.maHighlightTextColor ),
590 maInfoTextColor( rData.maInfoTextColor ),
591 maLabelTextColor( rData.maLabelTextColor ),
592 maLightBorderColor( rData.maLightBorderColor ),
593 maLightColor( rData.maLightColor ),
594 maLinkColor( rData.maLinkColor ),
595 maMenuBarColor( rData.maMenuBarColor ),
596 maMenuBarRolloverColor( rData.maMenuBarRolloverColor ),
597 maMenuBorderColor( rData.maMenuBorderColor ),
598 maMenuColor( rData.maMenuColor ),
599 maMenuHighlightColor( rData.maMenuHighlightColor ),
600 maMenuHighlightTextColor( rData.maMenuHighlightTextColor ),
601 maMenuTextColor( rData.maMenuTextColor ),
602 maMenuBarTextColor( rData.maMenuBarTextColor ),
603 maMenuBarRolloverTextColor( rData.maMenuBarRolloverTextColor ),
604 maMenuBarHighlightTextColor( rData.maMenuBarHighlightTextColor ),
605 maMonoColor( rData.maMonoColor ),
606 maRadioCheckTextColor( rData.maRadioCheckTextColor ),
607 maShadowColor( rData.maShadowColor ),
608 maVisitedLinkColor( rData.maVisitedLinkColor ),
609 maWindowColor( rData.maWindowColor ),
610 maWindowTextColor( rData.maWindowTextColor ),
611 maWorkspaceColor( rData.maWorkspaceColor ),
612 maActiveTabColor( rData.maActiveTabColor ),
613 maInactiveTabColor( rData.maInactiveTabColor ),
614 maTabTextColor( rData.maTabTextColor ),
615 maTabRolloverTextColor( rData.maTabRolloverTextColor ),
616 maTabHighlightTextColor( rData.maTabHighlightTextColor ),
617 maAppFont( rData.maAppFont ),
618 maHelpFont( rData.maAppFont ),
619 maTitleFont( rData.maTitleFont ),
620 maFloatTitleFont( rData.maFloatTitleFont ),
621 maMenuFont( rData.maMenuFont ),
622 maToolFont( rData.maToolFont ),
623 maLabelFont( rData.maLabelFont ),
624 maInfoFont( rData.maInfoFont ),
625 maRadioCheckFont( rData.maRadioCheckFont ),
626 maPushButtonFont( rData.maPushButtonFont ),
627 maFieldFont( rData.maFieldFont ),
628 maIconFont( rData.maIconFont ),
629 maTabFont( rData.maTabFont ),
630 maGroupFont( rData.maGroupFont ),
631 mIconTheme(rData.mIconTheme),
632 maDialogStyle( rData.maDialogStyle ),
633 maFrameStyle( rData.maFrameStyle ),
634 maPersonaHeaderFooter( rData.maPersonaHeaderFooter ),
635 maPersonaHeaderBitmap( rData.maPersonaHeaderBitmap ),
636 maPersonaFooterBitmap( rData.maPersonaFooterBitmap ),
637 maPersonaMenuBarTextColor( rData.maPersonaMenuBarTextColor )
639 mnBorderSize = rData.mnBorderSize;
640 mnTitleHeight = rData.mnTitleHeight;
641 mnFloatTitleHeight = rData.mnFloatTitleHeight;
642 mnTearOffTitleHeight = rData.mnTearOffTitleHeight;
643 mnScrollBarSize = rData.mnScrollBarSize;
644 mnMinThumbSize = rData.mnMinThumbSize;
645 mnSplitSize = rData.mnSplitSize;
646 mnSpinSize = rData.mnSpinSize;
647 mnAntialiasedMin = rData.mnAntialiasedMin;
648 mnCursorSize = rData.mnCursorSize;
649 mnCursorBlinkTime = rData.mnCursorBlinkTime;
650 mnScreenZoom = rData.mnScreenZoom;
651 mnScreenFontZoom = rData.mnScreenFontZoom;
652 mnDragFullOptions = rData.mnDragFullOptions;
653 mnSelectionOptions = rData.mnSelectionOptions;
654 mnDisplayOptions = rData.mnDisplayOptions;
655 mnOptions = rData.mnOptions;
656 mbHighContrast = rData.mbHighContrast;
657 mbUseSystemUIFonts = rData.mbUseSystemUIFonts;
658 mnUseFlatBorders = rData.mnUseFlatBorders;
659 mnUseFlatMenus = rData.mnUseFlatMenus;
660 mbAutoMnemonic = rData.mbAutoMnemonic;
661 meUseImagesInMenus = rData.meUseImagesInMenus;
662 mbPreferredUseImagesInMenus = rData.mbPreferredUseImagesInMenus;
663 mbSkipDisabledInMenus = rData.mbSkipDisabledInMenus;
664 mbHideDisabledMenuItems = rData.mbHideDisabledMenuItems;
665 mbAcceleratorsInContextMenus = rData.mbAcceleratorsInContextMenus;
666 mbPrimaryButtonWarpsSlider = rData.mbPrimaryButtonWarpsSlider;
667 mnToolbarIconSize = rData.mnToolbarIconSize;
668 mIconThemeScanner.reset(new vcl::IconThemeScanner(*rData.mIconThemeScanner));
669 mIconThemeSelector.reset(new vcl::IconThemeSelector(*rData.mIconThemeSelector));
670 mpFontOptions = rData.mpFontOptions;
671 mnEdgeBlending = rData.mnEdgeBlending;
672 maEdgeBlendingTopLeftColor = rData.maEdgeBlendingTopLeftColor;
673 maEdgeBlendingBottomRightColor = rData.maEdgeBlendingBottomRightColor;
674 mnListBoxMaximumLineCount = rData.mnListBoxMaximumLineCount;
675 mnColorValueSetColumnCount = rData.mnColorValueSetColumnCount;
676 mnColorValueSetMaximumRowCount = rData.mnColorValueSetMaximumRowCount;
677 maListBoxPreviewDefaultLogicSize = rData.maListBoxPreviewDefaultLogicSize;
678 maListBoxPreviewDefaultPixelSize = rData.maListBoxPreviewDefaultPixelSize;
679 mnListBoxPreviewDefaultLineWidth = rData.mnListBoxPreviewDefaultLineWidth;
680 mbPreviewUsesCheckeredBackground = rData.mbPreviewUsesCheckeredBackground;
683 void ImplStyleData::SetStandardStyles()
685 vcl::Font aStdFont( FAMILY_SWISS, Size( 0, 8 ) );
686 aStdFont.SetCharSet( osl_getThreadTextEncoding() );
687 aStdFont.SetWeight( WEIGHT_NORMAL );
688 aStdFont.SetName( utl::DefaultFontConfiguration::get().getUserInterfaceFont( LanguageTag("en")) );
689 maAppFont = aStdFont;
690 maHelpFont = aStdFont;
691 maMenuFont = aStdFont;
692 maToolFont = aStdFont;
693 maGroupFont = aStdFont;
694 maLabelFont = aStdFont;
695 maInfoFont = aStdFont;
696 maRadioCheckFont = aStdFont;
697 maPushButtonFont = aStdFont;
698 maFieldFont = aStdFont;
699 maIconFont = aStdFont;
700 maTabFont = aStdFont;
701 aStdFont.SetWeight( WEIGHT_BOLD );
702 maFloatTitleFont = aStdFont;
703 maTitleFont = aStdFont;
705 maFaceColor = Color( COL_LIGHTGRAY );
706 maCheckedColor = Color( 0xCC, 0xCC, 0xCC );
707 maLightColor = Color( COL_WHITE );
708 maLightBorderColor = Color( COL_LIGHTGRAY );
709 maShadowColor = Color( COL_GRAY );
710 maDarkShadowColor = Color( COL_BLACK );
711 maButtonTextColor = Color( COL_BLACK );
712 maButtonRolloverTextColor = Color( COL_BLACK );
713 maRadioCheckTextColor = Color( COL_BLACK );
714 maGroupTextColor = Color( COL_BLACK );
715 maLabelTextColor = Color( COL_BLACK );
716 maInfoTextColor = Color( COL_BLACK );
717 maWindowColor = Color( COL_WHITE );
718 maWindowTextColor = Color( COL_BLACK );
719 maDialogColor = Color( COL_LIGHTGRAY );
720 maDialogTextColor = Color( COL_BLACK );
721 maWorkspaceColor = Color( 0xDF, 0xDF, 0xDE );
722 maMonoColor = Color( COL_BLACK );
723 maFieldColor = Color( COL_WHITE );
724 maFieldTextColor = Color( COL_BLACK );
725 maFieldRolloverTextColor = Color( COL_BLACK );
726 maActiveColor = Color( COL_BLUE );
727 maActiveTextColor = Color( COL_WHITE );
728 maActiveBorderColor = Color( COL_LIGHTGRAY );
729 maDeactiveColor = Color( COL_GRAY );
730 maDeactiveTextColor = Color( COL_LIGHTGRAY );
731 maDeactiveBorderColor = Color( COL_LIGHTGRAY );
732 maMenuColor = Color( COL_LIGHTGRAY );
733 maMenuBarColor = Color( COL_LIGHTGRAY );
734 maMenuBarRolloverColor = Color( COL_BLUE );
735 maMenuBorderColor = Color( COL_LIGHTGRAY );
736 maMenuTextColor = Color( COL_BLACK );
737 maMenuBarTextColor = Color( COL_BLACK );
738 maMenuBarRolloverTextColor = Color( COL_WHITE );
739 maMenuBarHighlightTextColor = Color( COL_WHITE );
740 maMenuHighlightColor = Color( COL_BLUE );
741 maMenuHighlightTextColor = Color( COL_WHITE );
742 maHighlightColor = Color( COL_BLUE );
743 maHighlightTextColor = Color( COL_WHITE );
744 maActiveTabColor = Color( COL_WHITE );
745 maInactiveTabColor = Color( COL_LIGHTGRAY );
746 maTabTextColor = Color( COL_BLACK );
747 maTabRolloverTextColor = Color( COL_BLACK );
748 maTabHighlightTextColor = Color( COL_BLACK );
749 maDisableColor = Color( COL_GRAY );
750 maHelpColor = Color( 0xFF, 0xFF, 0xE0 );
751 maHelpTextColor = Color( COL_BLACK );
752 maLinkColor = Color( COL_BLUE );
753 maVisitedLinkColor = Color( 0x00, 0x00, 0xCC );
754 maHighlightLinkColor = Color( COL_LIGHTBLUE );
755 maFontColor = Color( COL_BLACK );
756 maAlternatingRowColor = Color( 0xEE, 0xEE, 0xEE );
758 mnBorderSize = 1;
759 mnTitleHeight = 18;
760 mnFloatTitleHeight = 13;
761 mnTearOffTitleHeight = 8;
762 mbHighContrast = false;
763 mbUseSystemUIFonts = true;
764 mnUseFlatBorders = false;
765 mnUseFlatMenus = false;
766 mbPreferredUseImagesInMenus = true;
767 mbSkipDisabledInMenus = false;
768 mbHideDisabledMenuItems = false;
769 mbAcceleratorsInContextMenus = true;
770 mbPrimaryButtonWarpsSlider = false;
773 StyleSettings::StyleSettings()
774 : mxData(std::make_shared<ImplStyleData>())
778 StyleSettings::~StyleSettings()
782 void
783 StyleSettings::SetFaceColor( const Color& rColor )
785 CopyData();
786 mxData->maFaceColor = rColor;
789 const Color&
790 StyleSettings::GetFaceColor() const
792 return mxData->maFaceColor;
795 void
796 StyleSettings::SetCheckedColor( const Color& rColor )
798 CopyData();
799 mxData->maCheckedColor = rColor;
802 const Color&
803 StyleSettings::GetCheckedColor() const
805 return mxData->maCheckedColor;
808 void
809 StyleSettings::SetLightColor( const Color& rColor )
811 CopyData();
812 mxData->maLightColor = rColor;
815 const Color&
816 StyleSettings::GetLightColor() const
818 return mxData->maLightColor;
821 void
822 StyleSettings::SetLightBorderColor( const Color& rColor )
824 CopyData();
825 mxData->maLightBorderColor = rColor;
828 const Color&
829 StyleSettings::GetLightBorderColor() const
831 return mxData->maLightBorderColor;
834 void
835 StyleSettings::SetShadowColor( const Color& rColor )
837 CopyData();
838 mxData->maShadowColor = rColor;
841 const Color&
842 StyleSettings::GetShadowColor() const
844 return mxData->maShadowColor;
847 void
848 StyleSettings::SetDarkShadowColor( const Color& rColor )
850 CopyData();
851 mxData->maDarkShadowColor = rColor;
854 const Color&
855 StyleSettings::GetDarkShadowColor() const
857 return mxData->maDarkShadowColor;
860 void
861 StyleSettings::SetButtonTextColor( const Color& rColor )
863 CopyData();
864 mxData->maButtonTextColor = rColor;
867 const Color&
868 StyleSettings::GetButtonTextColor() const
870 return mxData->maButtonTextColor;
873 void
874 StyleSettings::SetButtonRolloverTextColor( const Color& rColor )
876 CopyData();
877 mxData->maButtonRolloverTextColor = rColor;
880 const Color&
881 StyleSettings::GetButtonRolloverTextColor() const
883 return mxData->maButtonRolloverTextColor;
886 void
887 StyleSettings::SetRadioCheckTextColor( const Color& rColor )
889 CopyData();
890 mxData->maRadioCheckTextColor = rColor;
893 const Color&
894 StyleSettings::GetRadioCheckTextColor() const
896 return mxData->maRadioCheckTextColor;
899 void
900 StyleSettings::SetGroupTextColor( const Color& rColor )
902 CopyData();
903 mxData->maGroupTextColor = rColor;
906 const Color&
907 StyleSettings::GetGroupTextColor() const
909 return mxData->maGroupTextColor;
912 void
913 StyleSettings::SetLabelTextColor( const Color& rColor )
915 CopyData();
916 mxData->maLabelTextColor = rColor;
919 const Color&
920 StyleSettings::GetLabelTextColor() const
922 return mxData->maLabelTextColor;
925 void
926 StyleSettings::SetInfoTextColor( const Color& rColor )
928 CopyData();
929 mxData->maInfoTextColor = rColor;
932 const Color&
933 StyleSettings::GetInfoTextColor() const
935 return mxData->maInfoTextColor;
938 void
939 StyleSettings::SetWindowColor( const Color& rColor )
941 CopyData();
942 mxData->maWindowColor = rColor;
945 const Color&
946 StyleSettings::GetWindowColor() const
948 return mxData->maWindowColor;
951 void
952 StyleSettings::SetWindowTextColor( const Color& rColor )
954 CopyData();
955 mxData->maWindowTextColor = rColor;
958 const Color&
959 StyleSettings::GetWindowTextColor() const
961 return mxData->maWindowTextColor;
964 void
965 StyleSettings::SetDialogColor( const Color& rColor )
967 CopyData();
968 mxData->maDialogColor = rColor;
971 const Color&
972 StyleSettings::GetDialogColor() const
974 return mxData->maDialogColor;
977 void
978 StyleSettings::SetDialogTextColor( const Color& rColor )
980 CopyData();
981 mxData->maDialogTextColor = rColor;
984 const Color&
985 StyleSettings::GetDialogTextColor() const
987 return mxData->maDialogTextColor;
990 void
991 StyleSettings::SetWorkspaceColor( const Color& rColor )
993 CopyData();
994 mxData->maWorkspaceColor = rColor;
997 const Color&
998 StyleSettings::GetWorkspaceColor() const
1000 return mxData->maWorkspaceColor;
1003 void
1004 StyleSettings::SetFieldColor( const Color& rColor )
1006 CopyData();
1007 mxData->maFieldColor = rColor;
1010 const Color&
1011 StyleSettings::GetFieldColor() const
1013 return mxData->maFieldColor;
1016 void
1017 StyleSettings::SetFieldTextColor( const Color& rColor )
1019 CopyData();
1020 mxData->maFieldTextColor = rColor;
1023 const Color&
1024 StyleSettings::GetFieldTextColor() const
1026 return mxData->maFieldTextColor;
1029 void
1030 StyleSettings::SetFieldRolloverTextColor( const Color& rColor )
1032 CopyData();
1033 mxData->maFieldRolloverTextColor = rColor;
1036 const Color&
1037 StyleSettings::GetFieldRolloverTextColor() const
1039 return mxData->maFieldRolloverTextColor;
1042 void
1043 StyleSettings::SetActiveColor( const Color& rColor )
1045 CopyData();
1046 mxData->maActiveColor = rColor;
1049 const Color&
1050 StyleSettings::GetActiveColor() const
1052 return mxData->maActiveColor;
1055 void
1056 StyleSettings::SetActiveTextColor( const Color& rColor )
1058 CopyData();
1059 mxData->maActiveTextColor = rColor;
1062 const Color&
1063 StyleSettings::GetActiveTextColor() const
1065 return mxData->maActiveTextColor;
1068 void
1069 StyleSettings::SetActiveBorderColor( const Color& rColor )
1071 CopyData();
1072 mxData->maActiveBorderColor = rColor;
1075 const Color&
1076 StyleSettings::GetActiveBorderColor() const
1078 return mxData->maActiveBorderColor;
1081 void
1082 StyleSettings::SetDeactiveColor( const Color& rColor )
1084 CopyData();
1085 mxData->maDeactiveColor = rColor;
1088 const Color&
1089 StyleSettings::GetDeactiveColor() const
1091 return mxData->maDeactiveColor;
1094 void
1095 StyleSettings::SetDeactiveTextColor( const Color& rColor )
1097 CopyData();
1098 mxData->maDeactiveTextColor = rColor;
1101 const Color&
1102 StyleSettings::GetDeactiveTextColor() const
1104 return mxData->maDeactiveTextColor;
1107 void
1108 StyleSettings::SetDeactiveBorderColor( const Color& rColor )
1110 CopyData();
1111 mxData->maDeactiveBorderColor = rColor;
1114 const Color&
1115 StyleSettings::GetDeactiveBorderColor() const
1117 return mxData->maDeactiveBorderColor;
1120 void
1121 StyleSettings::SetHighlightColor( const Color& rColor )
1123 CopyData();
1124 mxData->maHighlightColor = rColor;
1127 const Color&
1128 StyleSettings::GetHighlightColor() const
1130 return mxData->maHighlightColor;
1133 void
1134 StyleSettings::SetHighlightTextColor( const Color& rColor )
1136 CopyData();
1137 mxData->maHighlightTextColor = rColor;
1140 const Color&
1141 StyleSettings::GetHighlightTextColor() const
1143 return mxData->maHighlightTextColor;
1146 void
1147 StyleSettings::SetDisableColor( const Color& rColor )
1149 CopyData();
1150 mxData->maDisableColor = rColor;
1153 const Color&
1154 StyleSettings::GetDisableColor() const
1156 return mxData->maDisableColor;
1159 void
1160 StyleSettings::SetHelpColor( const Color& rColor )
1162 CopyData();
1163 mxData->maHelpColor = rColor;
1166 const Color&
1167 StyleSettings::GetHelpColor() const
1169 return mxData->maHelpColor;
1172 void
1173 StyleSettings::SetHelpTextColor( const Color& rColor )
1175 CopyData();
1176 mxData->maHelpTextColor = rColor;
1179 const Color&
1180 StyleSettings::GetHelpTextColor() const
1182 return mxData->maHelpTextColor;
1185 void
1186 StyleSettings::SetMenuColor( const Color& rColor )
1188 CopyData();
1189 mxData->maMenuColor = rColor;
1192 const Color&
1193 StyleSettings::GetMenuColor() const
1195 return mxData->maMenuColor;
1198 void
1199 StyleSettings::SetMenuBarColor( const Color& rColor )
1201 CopyData();
1202 mxData->maMenuBarColor = rColor;
1205 const Color&
1206 StyleSettings::GetMenuBarColor() const
1208 return mxData->maMenuBarColor;
1211 void
1212 StyleSettings::SetMenuBarRolloverColor( const Color& rColor )
1214 CopyData();
1215 mxData->maMenuBarRolloverColor = rColor;
1218 const Color&
1219 StyleSettings::GetMenuBarRolloverColor() const
1221 return mxData->maMenuBarRolloverColor;
1224 void
1225 StyleSettings::SetMenuBorderColor( const Color& rColor )
1227 CopyData();
1228 mxData->maMenuBorderColor = rColor;
1231 const Color&
1232 StyleSettings::GetMenuBorderColor() const
1234 return mxData->maMenuBorderColor;
1237 void
1238 StyleSettings::SetMenuTextColor( const Color& rColor )
1240 CopyData();
1241 mxData->maMenuTextColor = rColor;
1244 const Color&
1245 StyleSettings::GetMenuTextColor() const
1247 return mxData->maMenuTextColor;
1250 void
1251 StyleSettings::SetMenuBarTextColor( const Color& rColor )
1253 CopyData();
1254 mxData->maMenuBarTextColor = rColor;
1257 const Color&
1258 StyleSettings::GetMenuBarTextColor() const
1260 return mxData->maMenuBarTextColor;
1263 void
1264 StyleSettings::SetMenuBarRolloverTextColor( const Color& rColor )
1266 CopyData();
1267 mxData->maMenuBarRolloverTextColor = rColor;
1270 const Color&
1271 StyleSettings::GetMenuBarRolloverTextColor() const
1273 return mxData->maMenuBarRolloverTextColor;
1276 void
1277 StyleSettings::SetMenuBarHighlightTextColor( const Color& rColor )
1279 CopyData();
1280 mxData->maMenuBarHighlightTextColor = rColor;
1283 const Color&
1284 StyleSettings::GetMenuBarHighlightTextColor() const
1286 return mxData->maMenuBarHighlightTextColor;
1289 void
1290 StyleSettings::SetMenuHighlightColor( const Color& rColor )
1292 CopyData();
1293 mxData->maMenuHighlightColor = rColor;
1296 const Color&
1297 StyleSettings::GetMenuHighlightColor() const
1299 return mxData->maMenuHighlightColor;
1302 void
1303 StyleSettings::SetMenuHighlightTextColor( const Color& rColor )
1305 CopyData();
1306 mxData->maMenuHighlightTextColor = rColor;
1309 const Color&
1310 StyleSettings::GetMenuHighlightTextColor() const
1312 return mxData->maMenuHighlightTextColor;
1315 void
1316 StyleSettings::SetTabTextColor( const Color& rColor )
1318 CopyData();
1319 mxData->maTabTextColor = rColor;
1322 const Color&
1323 StyleSettings::GetTabTextColor() const
1325 return mxData->maTabTextColor;
1328 void
1329 StyleSettings::SetTabRolloverTextColor( const Color& rColor )
1331 CopyData();
1332 mxData->maTabRolloverTextColor = rColor;
1335 const Color&
1336 StyleSettings::GetTabRolloverTextColor() const
1338 return mxData->maTabRolloverTextColor;
1341 void
1342 StyleSettings::SetTabHighlightTextColor( const Color& rColor )
1344 CopyData();
1345 mxData->maTabHighlightTextColor = rColor;
1348 const Color&
1349 StyleSettings::GetTabHighlightTextColor() const
1351 return mxData->maTabHighlightTextColor;
1354 void
1355 StyleSettings::SetLinkColor( const Color& rColor )
1357 CopyData();
1358 mxData->maLinkColor = rColor;
1361 const Color&
1362 StyleSettings::GetLinkColor() const
1364 return mxData->maLinkColor;
1367 void
1368 StyleSettings::SetVisitedLinkColor( const Color& rColor )
1370 CopyData();
1371 mxData->maVisitedLinkColor = rColor;
1374 const Color&
1375 StyleSettings::GetVisitedLinkColor() const
1377 return mxData->maVisitedLinkColor;
1380 const Color&
1381 StyleSettings::GetHighlightLinkColor() const
1383 return mxData->maHighlightLinkColor;
1386 void
1387 StyleSettings::SetMonoColor( const Color& rColor )
1389 CopyData();
1390 mxData->maMonoColor = rColor;
1393 const Color&
1394 StyleSettings::GetMonoColor() const
1396 return mxData->maMonoColor;
1399 void
1400 StyleSettings::SetActiveTabColor( const Color& rColor )
1402 CopyData();
1403 mxData->maActiveTabColor = rColor;
1406 const Color&
1407 StyleSettings::GetActiveTabColor() const
1409 return mxData->maActiveTabColor;
1412 void
1413 StyleSettings::SetInactiveTabColor( const Color& rColor )
1415 CopyData();
1416 mxData->maInactiveTabColor = rColor;
1419 const Color&
1420 StyleSettings::GetInactiveTabColor() const
1422 return mxData->maInactiveTabColor;
1425 void
1426 StyleSettings::SetAlternatingRowColor( const Color& rColor )
1428 CopyData();
1429 mxData->maAlternatingRowColor = rColor;
1432 const Color&
1433 StyleSettings::GetAlternatingRowColor() const
1435 return mxData->maAlternatingRowColor;
1438 void
1439 StyleSettings::SetUseSystemUIFonts( bool bUseSystemUIFonts )
1441 CopyData();
1442 mxData->mbUseSystemUIFonts = bUseSystemUIFonts;
1445 bool
1446 StyleSettings::GetUseSystemUIFonts() const
1448 return mxData->mbUseSystemUIFonts;
1451 void
1452 StyleSettings::SetUseFlatBorders( bool bUseFlatBorders )
1454 CopyData();
1455 mxData->mnUseFlatBorders = bUseFlatBorders;
1458 bool
1459 StyleSettings::GetUseFlatBorders() const
1461 return (bool) mxData->mnUseFlatBorders;
1464 void
1465 StyleSettings::SetUseFlatMenus( bool bUseFlatMenus )
1467 CopyData();
1468 mxData->mnUseFlatMenus = bUseFlatMenus;
1471 bool
1472 StyleSettings::GetUseFlatMenus() const
1474 return (bool) mxData->mnUseFlatMenus;
1477 void
1478 StyleSettings::SetUseImagesInMenus( TriState eUseImagesInMenus )
1480 CopyData();
1481 mxData->meUseImagesInMenus = eUseImagesInMenus;
1484 void
1485 StyleSettings::SetPreferredUseImagesInMenus( bool bPreferredUseImagesInMenus )
1487 CopyData();
1488 mxData->mbPreferredUseImagesInMenus = bPreferredUseImagesInMenus;
1491 bool
1492 StyleSettings::GetPreferredUseImagesInMenus() const
1494 return mxData->mbPreferredUseImagesInMenus;
1497 void
1498 StyleSettings::SetSkipDisabledInMenus( bool bSkipDisabledInMenus )
1500 CopyData();
1501 mxData->mbSkipDisabledInMenus = bSkipDisabledInMenus;
1504 bool
1505 StyleSettings::GetSkipDisabledInMenus() const
1507 return mxData->mbSkipDisabledInMenus;
1510 void
1511 StyleSettings::SetHideDisabledMenuItems( bool bHideDisabledMenuItems )
1513 CopyData();
1514 mxData->mbHideDisabledMenuItems = bHideDisabledMenuItems;
1517 bool
1518 StyleSettings::GetHideDisabledMenuItems() const
1520 return mxData->mbHideDisabledMenuItems;
1523 void
1524 StyleSettings::SetAcceleratorsInContextMenus( bool bAcceleratorsInContextMenus )
1526 CopyData();
1527 mxData->mbAcceleratorsInContextMenus = bAcceleratorsInContextMenus;
1530 bool
1531 StyleSettings::GetAcceleratorsInContextMenus() const
1533 return mxData->mbAcceleratorsInContextMenus;
1536 void
1537 StyleSettings::SetPrimaryButtonWarpsSlider( bool bPrimaryButtonWarpsSlider )
1539 CopyData();
1540 mxData->mbPrimaryButtonWarpsSlider = bPrimaryButtonWarpsSlider;
1543 bool
1544 StyleSettings::GetPrimaryButtonWarpsSlider() const
1546 return mxData->mbPrimaryButtonWarpsSlider;
1549 void
1550 StyleSettings::SetCairoFontOptions( const void *pOptions )
1552 CopyData();
1553 mxData->mpFontOptions = pOptions;
1556 const void*
1557 StyleSettings::GetCairoFontOptions() const
1559 return mxData->mpFontOptions;
1562 void
1563 StyleSettings::SetAppFont( const vcl::Font& rFont )
1565 CopyData();
1566 mxData->maAppFont = rFont;
1569 const vcl::Font&
1570 StyleSettings::GetAppFont() const
1572 return mxData->maAppFont;
1575 void
1576 StyleSettings::SetHelpFont( const vcl::Font& rFont )
1578 CopyData();
1579 mxData->maHelpFont = rFont;
1582 const vcl::Font&
1583 StyleSettings::GetHelpFont() const
1585 return mxData->maHelpFont;
1588 void
1589 StyleSettings::SetTitleFont( const vcl::Font& rFont )
1591 CopyData();
1592 mxData->maTitleFont = rFont;
1595 const vcl::Font&
1596 StyleSettings::GetTitleFont() const
1598 return mxData->maTitleFont;
1601 void
1602 StyleSettings::SetFloatTitleFont( const vcl::Font& rFont )
1604 CopyData();
1605 mxData->maFloatTitleFont = rFont;
1608 const vcl::Font&
1609 StyleSettings::GetFloatTitleFont() const
1611 return mxData->maFloatTitleFont;
1614 void
1615 StyleSettings::SetMenuFont( const vcl::Font& rFont )
1617 CopyData();
1618 mxData->maMenuFont = rFont;
1621 const vcl::Font&
1622 StyleSettings::GetMenuFont() const
1624 return mxData->maMenuFont;
1627 void
1628 StyleSettings::SetToolFont( const vcl::Font& rFont )
1630 CopyData();
1631 mxData->maToolFont = rFont;
1634 const vcl::Font&
1635 StyleSettings::GetToolFont() const
1637 return mxData->maToolFont;
1640 void
1641 StyleSettings::SetGroupFont( const vcl::Font& rFont )
1643 CopyData();
1644 mxData->maGroupFont = rFont;
1647 const vcl::Font&
1648 StyleSettings::GetGroupFont() const
1650 return mxData->maGroupFont;
1653 void
1654 StyleSettings::SetLabelFont( const vcl::Font& rFont )
1656 CopyData();
1657 mxData->maLabelFont = rFont;
1660 const vcl::Font&
1661 StyleSettings::GetLabelFont() const
1663 return mxData->maLabelFont;
1666 void
1667 StyleSettings::SetInfoFont( const vcl::Font& rFont )
1669 CopyData();
1670 mxData->maInfoFont = rFont;
1673 const vcl::Font&
1674 StyleSettings::GetInfoFont() const
1676 return mxData->maInfoFont;
1679 void
1680 StyleSettings::SetRadioCheckFont( const vcl::Font& rFont )
1682 CopyData();
1683 mxData->maRadioCheckFont = rFont;
1686 const vcl::Font&
1687 StyleSettings::GetRadioCheckFont() const
1689 return mxData->maRadioCheckFont;
1692 void
1693 StyleSettings::SetPushButtonFont( const vcl::Font& rFont )
1695 CopyData();
1696 mxData->maPushButtonFont = rFont;
1699 const vcl::Font&
1700 StyleSettings::GetPushButtonFont() const
1702 return mxData->maPushButtonFont;
1705 void
1706 StyleSettings::SetFieldFont( const vcl::Font& rFont )
1708 CopyData();
1709 mxData->maFieldFont = rFont;
1712 const vcl::Font&
1713 StyleSettings::GetFieldFont() const
1715 return mxData->maFieldFont;
1718 void
1719 StyleSettings::SetIconFont( const vcl::Font& rFont )
1721 CopyData();
1722 mxData->maIconFont = rFont;
1725 const vcl::Font&
1726 StyleSettings::GetIconFont() const
1728 return mxData->maIconFont;
1731 void
1732 StyleSettings::SetTabFont( const vcl::Font& rFont )
1734 CopyData();
1735 mxData->maTabFont = rFont;
1738 const vcl::Font&
1739 StyleSettings::GetTabFont() const
1741 return mxData->maTabFont;
1744 long
1745 StyleSettings::GetBorderSize() const
1747 return mxData->mnBorderSize;
1750 void
1751 StyleSettings::SetTitleHeight( long nSize )
1753 CopyData();
1754 mxData->mnTitleHeight = nSize;
1757 long
1758 StyleSettings::GetTitleHeight() const
1760 return mxData->mnTitleHeight;
1763 void
1764 StyleSettings::SetFloatTitleHeight( long nSize )
1766 CopyData();
1767 mxData->mnFloatTitleHeight = nSize;
1770 long
1771 StyleSettings::GetFloatTitleHeight() const
1773 return mxData->mnFloatTitleHeight;
1776 long
1777 StyleSettings::GetTearOffTitleHeight() const
1779 return mxData->mnTearOffTitleHeight;
1782 void
1783 StyleSettings::SetScrollBarSize( long nSize )
1785 CopyData();
1786 mxData->mnScrollBarSize = nSize;
1789 long
1790 StyleSettings::GetScrollBarSize() const
1792 return mxData->mnScrollBarSize;
1795 void
1796 StyleSettings::SetMinThumbSize( long nSize )
1798 CopyData();
1799 mxData->mnMinThumbSize = nSize;
1802 long
1803 StyleSettings::GetMinThumbSize() const
1805 return mxData->mnMinThumbSize;
1808 void
1809 StyleSettings::SetSpinSize( long nSize )
1811 CopyData();
1812 mxData->mnSpinSize = nSize;
1815 long
1816 StyleSettings::GetSpinSize() const
1818 return mxData->mnSpinSize;
1821 long
1822 StyleSettings::GetSplitSize() const
1824 return mxData->mnSplitSize;
1827 void
1828 StyleSettings::SetCursorSize( long nSize )
1830 CopyData();
1831 mxData->mnCursorSize = nSize;
1834 long
1835 StyleSettings::GetCursorSize() const
1837 return mxData->mnCursorSize;
1840 void
1841 StyleSettings::SetCursorBlinkTime( sal_uInt64 nBlinkTime )
1843 CopyData();
1844 mxData->mnCursorBlinkTime = nBlinkTime;
1847 sal_uInt64
1848 StyleSettings::GetCursorBlinkTime() const
1850 return (long) mxData->mnCursorBlinkTime;
1853 void
1854 StyleSettings::SetScreenZoom( sal_uInt16 nPercent )
1856 CopyData();
1857 mxData->mnScreenZoom = nPercent;
1860 sal_uInt16
1861 StyleSettings::GetScreenZoom() const
1863 return mxData->mnScreenZoom;
1866 void
1867 StyleSettings::SetScreenFontZoom( sal_uInt16 nPercent )
1869 CopyData();
1870 mxData->mnScreenFontZoom = nPercent;
1873 sal_uInt16
1874 StyleSettings::GetScreenFontZoom() const
1876 return mxData->mnScreenFontZoom;
1879 void
1880 StyleSettings::SetDragFullOptions( DragFullOptions nOptions )
1882 CopyData();
1883 mxData->mnDragFullOptions = nOptions;
1886 DragFullOptions
1887 StyleSettings::GetDragFullOptions() const
1889 return mxData->mnDragFullOptions;
1892 void
1893 StyleSettings::SetSelectionOptions( SelectionOptions nOptions )
1895 CopyData();
1896 mxData->mnSelectionOptions = nOptions;
1899 SelectionOptions
1900 StyleSettings::GetSelectionOptions() const
1902 return mxData->mnSelectionOptions;
1905 void
1906 StyleSettings::SetDisplayOptions( DisplayOptions nOptions )
1908 CopyData();
1909 mxData->mnDisplayOptions = nOptions;
1912 DisplayOptions
1913 StyleSettings::GetDisplayOptions() const
1915 return mxData->mnDisplayOptions;
1918 void
1919 StyleSettings::SetAntialiasingMinPixelHeight( long nMinPixel )
1921 CopyData();
1922 mxData->mnAntialiasedMin = nMinPixel;
1925 sal_uLong
1926 StyleSettings::GetAntialiasingMinPixelHeight() const
1928 return mxData->mnAntialiasedMin;
1931 void
1932 StyleSettings::SetOptions( StyleSettingsOptions nOptions )
1934 CopyData();
1935 mxData->mnOptions = nOptions;
1938 void
1939 StyleSettings::SetAutoMnemonic( bool bAutoMnemonic )
1941 CopyData();
1942 mxData->mbAutoMnemonic = bAutoMnemonic;
1945 bool
1946 StyleSettings::GetAutoMnemonic() const
1948 return mxData->mbAutoMnemonic;
1951 void
1952 StyleSettings::SetFontColor( const Color& rColor )
1954 CopyData();
1955 mxData->maFontColor = rColor;
1958 const Color&
1959 StyleSettings::GetFontColor() const
1961 return mxData->maFontColor;
1964 void
1965 StyleSettings::SetToolbarIconSize( ToolbarIconSize nSize )
1967 CopyData();
1968 mxData->mnToolbarIconSize = nSize;
1971 ToolbarIconSize
1972 StyleSettings::GetToolbarIconSize() const
1974 return mxData->mnToolbarIconSize;
1977 const DialogStyle&
1978 StyleSettings::GetDialogStyle() const
1980 return mxData->maDialogStyle;
1983 void
1984 StyleSettings::SetDialogStyle( const DialogStyle& rStyle )
1986 CopyData();
1987 mxData->maDialogStyle = rStyle;
1990 const FrameStyle&
1991 StyleSettings::GetFrameStyle() const
1993 return mxData->maFrameStyle;
1996 void
1997 StyleSettings::SetFrameStyle( const FrameStyle& rStyle )
1999 CopyData();
2000 mxData->maFrameStyle = rStyle;
2003 void
2004 StyleSettings::SetEdgeBlending(sal_uInt16 nCount)
2006 CopyData();
2007 mxData->mnEdgeBlending = nCount;
2010 sal_uInt16
2011 StyleSettings::GetEdgeBlending() const
2013 return mxData->mnEdgeBlending;
2016 const Color&
2017 StyleSettings::GetEdgeBlendingTopLeftColor() const
2019 return mxData->maEdgeBlendingTopLeftColor;
2022 const Color&
2023 StyleSettings::GetEdgeBlendingBottomRightColor() const
2025 return mxData->maEdgeBlendingBottomRightColor;
2028 void
2029 StyleSettings::SetListBoxMaximumLineCount(sal_uInt16 nCount)
2031 CopyData();
2032 mxData->mnListBoxMaximumLineCount = nCount;
2035 sal_uInt16
2036 StyleSettings::GetListBoxMaximumLineCount() const
2038 return mxData->mnListBoxMaximumLineCount;
2041 void
2042 StyleSettings::SetColorValueSetColumnCount(sal_uInt16 nCount)
2044 CopyData();
2045 mxData->mnColorValueSetColumnCount = nCount;
2048 sal_uInt16
2049 StyleSettings::GetColorValueSetColumnCount() const
2051 return mxData->mnColorValueSetColumnCount;
2054 sal_uInt16
2055 StyleSettings::GetColorValueSetMaximumRowCount() const
2057 return mxData->mnColorValueSetMaximumRowCount;
2060 sal_uInt16
2061 StyleSettings::GetListBoxPreviewDefaultLineWidth() const
2063 return mxData->mnListBoxPreviewDefaultLineWidth;
2066 void
2067 StyleSettings::SetPreviewUsesCheckeredBackground(bool bNew)
2069 CopyData();
2070 mxData->mbPreviewUsesCheckeredBackground = bNew;
2073 bool
2074 StyleSettings::GetPreviewUsesCheckeredBackground() const
2076 return mxData->mbPreviewUsesCheckeredBackground;
2079 bool
2080 StyleSettings::operator !=( const StyleSettings& rSet ) const
2082 return !(*this == rSet);
2085 const Size& StyleSettings::GetListBoxPreviewDefaultPixelSize() const
2087 if(0 == mxData->maListBoxPreviewDefaultPixelSize.Width() || 0 == mxData->maListBoxPreviewDefaultPixelSize.Height())
2089 const_cast< StyleSettings* >(this)->mxData->maListBoxPreviewDefaultPixelSize =
2090 Application::GetDefaultDevice()->LogicToPixel(mxData->maListBoxPreviewDefaultLogicSize, MAP_APPFONT);
2093 return mxData->maListBoxPreviewDefaultPixelSize;
2096 void StyleSettings::Set3DColors( const Color& rColor )
2098 CopyData();
2099 mxData->maFaceColor = rColor;
2100 mxData->maLightBorderColor = rColor;
2101 mxData->maMenuBorderColor = rColor;
2102 mxData->maDarkShadowColor = Color( COL_BLACK );
2103 if ( rColor != Color( COL_LIGHTGRAY ) )
2105 mxData->maLightColor = rColor;
2106 mxData->maShadowColor = rColor;
2107 mxData->maDarkShadowColor=rColor;
2108 mxData->maLightColor.IncreaseLuminance( 64 );
2109 mxData->maShadowColor.DecreaseLuminance( 64 );
2110 mxData->maDarkShadowColor.DecreaseLuminance( 100 );
2111 sal_uLong nRed = mxData->maLightColor.GetRed();
2112 sal_uLong nGreen = mxData->maLightColor.GetGreen();
2113 sal_uLong nBlue = mxData->maLightColor.GetBlue();
2114 nRed += (sal_uLong)(mxData->maShadowColor.GetRed());
2115 nGreen += (sal_uLong)(mxData->maShadowColor.GetGreen());
2116 nBlue += (sal_uLong)(mxData->maShadowColor.GetBlue());
2117 mxData->maCheckedColor = Color( (sal_uInt8)(nRed/2), (sal_uInt8)(nGreen/2), (sal_uInt8)(nBlue/2) );
2119 else
2121 mxData->maCheckedColor = Color( 0x99, 0x99, 0x99 );
2122 mxData->maLightColor = Color( COL_WHITE );
2123 mxData->maShadowColor = Color( COL_GRAY );
2127 void StyleSettings::SetCheckedColorSpecialCase( )
2129 CopyData();
2130 // Light gray checked color special case
2131 if ( GetFaceColor() == COL_LIGHTGRAY )
2132 mxData->maCheckedColor = Color( 0xCC, 0xCC, 0xCC );
2133 else
2135 sal_uInt8 nRed = (sal_uInt8)(((sal_uInt16)mxData->maFaceColor.GetRed() + (sal_uInt16)mxData->maLightColor.GetRed())/2);
2136 sal_uInt8 nGreen = (sal_uInt8)(((sal_uInt16)mxData->maFaceColor.GetGreen() + (sal_uInt16)mxData->maLightColor.GetGreen())/2);
2137 sal_uInt8 nBlue = (sal_uInt8)(((sal_uInt16)mxData->maFaceColor.GetBlue() + (sal_uInt16)mxData->maLightColor.GetBlue())/2);
2138 mxData->maCheckedColor = Color( nRed, nGreen, nBlue );
2142 bool StyleSettings::GetUseImagesInMenus() const
2144 // icon mode selected in Tools -> Options... -> OpenOffice.org -> View
2145 switch (mxData->meUseImagesInMenus) {
2146 case TRISTATE_FALSE:
2147 return false;
2148 case TRISTATE_TRUE:
2149 return true;
2150 default: // TRISTATE_INDET:
2151 return GetPreferredUseImagesInMenus();
2155 static BitmapEx readBitmapEx( const OUString& rPath )
2157 OUString aPath( rPath );
2158 rtl::Bootstrap::expandMacros( aPath );
2160 // import the image
2161 Graphic aGraphic;
2162 if ( GraphicFilter::LoadGraphic( aPath, OUString(), aGraphic ) != GRFILTER_OK )
2163 return BitmapEx();
2164 return aGraphic.GetBitmapEx();
2167 enum WhichPersona { PERSONA_HEADER, PERSONA_FOOTER };
2169 /** Update the setting of the Persona header / footer in ImplStyleData */
2170 static void setupPersonaHeaderFooter( WhichPersona eWhich, OUString& rHeaderFooter, BitmapEx& rHeaderFooterBitmap, boost::optional<Color>& rMenuBarTextColor )
2172 uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
2173 if ( !xContext.is() )
2174 return;
2176 // don't burn time loading images we don't need.
2177 if ( Application::IsHeadlessModeEnabled() )
2178 return;
2180 // read from the configuration
2181 OUString aPersona( officecfg::Office::Common::Misc::Persona::get( xContext ) );
2182 OUString aPersonaSettings( officecfg::Office::Common::Misc::PersonaSettings::get( xContext ) );
2184 // have the settings changed? marks if header /footer prepared before
2185 //should maybe extended to a flag that marks if header /footer /both are loaded
2186 OUString aOldValue= eWhich==PERSONA_HEADER?OUString(aPersona + ";" + aPersonaSettings+";h" ):OUString(aPersona + ";" + aPersonaSettings+";f" );
2187 if ( rHeaderFooter == aOldValue )
2188 return;
2190 rHeaderFooter = aOldValue;
2191 rHeaderFooterBitmap = BitmapEx();
2192 rMenuBarTextColor = boost::none;
2194 // now read the new values and setup bitmaps
2195 OUString aHeader, aFooter;
2196 if ( aPersona == "own" || aPersona == "default" )
2198 sal_Int32 nIndex = 0;
2199 aHeader = aPersonaSettings.getToken( 0, ';', nIndex );
2200 if ( nIndex > 0 )
2201 aFooter = aPersonaSettings.getToken( 0, ';', nIndex );
2203 // change menu text color, advance nIndex to skip the '#'
2204 if ( nIndex > 0 )
2206 OUString aColor = aPersonaSettings.getToken( 0, ';', ++nIndex );
2207 rMenuBarTextColor = Color( aColor.toUInt64( 16 ) );
2211 OUString aName;
2212 switch ( eWhich ) {
2213 case PERSONA_HEADER: aName = aHeader; break;
2214 case PERSONA_FOOTER: aName = aFooter; break;
2217 if ( !aName.isEmpty() )
2219 OUString gallery("");
2220 // try the gallery first, then the program path:
2221 if ( aPersona == "own" && !aPersonaSettings.startsWith( "vnd.sun.star.expand" ) )
2223 gallery = "${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE( "bootstrap") "::UserInstallation}";
2224 rtl::Bootstrap::expandMacros( gallery );
2225 gallery += "/user/gallery/personas/";
2227 else if ( aPersona == "default" )
2229 gallery = "$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER;
2230 gallery += "/gallery/personas/";
2232 rHeaderFooterBitmap = readBitmapEx( gallery + aName );
2234 if ( rHeaderFooterBitmap.IsEmpty() )
2235 rHeaderFooterBitmap = readBitmapEx( "$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" + aName );
2238 // Something went wrong. Probably, the images are missing. Clear the persona properties in the registry.
2240 if( rHeaderFooterBitmap.IsEmpty() )
2242 std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
2243 officecfg::Office::Common::Misc::Persona::set( "no", batch );
2244 officecfg::Office::Common::Misc::PersonaSettings::set( "", batch );
2245 batch->commit();
2249 const BitmapEx StyleSettings::GetPersonaHeader() const
2251 setupPersonaHeaderFooter( PERSONA_HEADER, mxData->maPersonaHeaderFooter, mxData->maPersonaHeaderBitmap, mxData->maPersonaMenuBarTextColor );
2252 return mxData->maPersonaHeaderBitmap;
2255 const BitmapEx StyleSettings::GetPersonaFooter() const
2257 setupPersonaHeaderFooter( PERSONA_FOOTER, mxData->maPersonaHeaderFooter, mxData->maPersonaFooterBitmap, mxData->maPersonaMenuBarTextColor );
2258 return mxData->maPersonaFooterBitmap;
2261 const boost::optional<Color>& StyleSettings::GetPersonaMenuBarTextColor() const
2263 GetPersonaHeader();
2264 return mxData->maPersonaMenuBarTextColor;
2267 void StyleSettings::SetStandardStyles()
2269 CopyData();
2270 mxData->SetStandardStyles();
2273 Color StyleSettings::GetFaceGradientColor() const
2275 // compute a brighter face color that can be used in gradients
2276 // for a convex look (eg toolbars)
2278 sal_uInt16 h, s, b;
2279 GetFaceColor().RGBtoHSB( h, s, b );
2280 if( s > 1) s=1;
2281 if( b < 98) b=98;
2282 return Color( Color::HSBtoRGB( h, s, b ) );
2285 Color StyleSettings::GetSeparatorColor() const
2287 // compute a brighter shadow color for separators (used in toolbars or between menubar and toolbars on Windows XP)
2288 sal_uInt16 h, s, b;
2289 GetShadowColor().RGBtoHSB( h, s, b );
2290 b += b/4;
2291 s -= s/4;
2292 return Color( Color::HSBtoRGB( h, s, b ) );
2295 void StyleSettings::CopyData()
2297 // copy if other references exist
2298 if ( ! mxData.unique() ) {
2299 mxData = std::make_shared<ImplStyleData>(*mxData);
2303 bool StyleSettings::operator ==( const StyleSettings& rSet ) const
2305 if ( mxData == rSet.mxData )
2306 return true;
2308 if (mxData->mIconTheme != rSet.mxData->mIconTheme) {
2309 return false;
2312 if (*mxData->mIconThemeSelector != *rSet.mxData->mIconThemeSelector) {
2313 return false;
2316 if ( (mxData->mnOptions == rSet.mxData->mnOptions) &&
2317 (mxData->mbAutoMnemonic == rSet.mxData->mbAutoMnemonic) &&
2318 (mxData->mnDragFullOptions == rSet.mxData->mnDragFullOptions) &&
2319 (mxData->mnSelectionOptions == rSet.mxData->mnSelectionOptions) &&
2320 (mxData->mnDisplayOptions == rSet.mxData->mnDisplayOptions) &&
2321 (mxData->mnCursorSize == rSet.mxData->mnCursorSize) &&
2322 (mxData->mnCursorBlinkTime == rSet.mxData->mnCursorBlinkTime) &&
2323 (mxData->mnBorderSize == rSet.mxData->mnBorderSize) &&
2324 (mxData->mnTitleHeight == rSet.mxData->mnTitleHeight) &&
2325 (mxData->mnFloatTitleHeight == rSet.mxData->mnFloatTitleHeight) &&
2326 (mxData->mnTearOffTitleHeight == rSet.mxData->mnTearOffTitleHeight) &&
2327 (mxData->mnScrollBarSize == rSet.mxData->mnScrollBarSize) &&
2328 (mxData->mnMinThumbSize == rSet.mxData->mnMinThumbSize) &&
2329 (mxData->mnSplitSize == rSet.mxData->mnSplitSize) &&
2330 (mxData->mnSpinSize == rSet.mxData->mnSpinSize) &&
2331 (mxData->mnAntialiasedMin == rSet.mxData->mnAntialiasedMin) &&
2332 (mxData->mnScreenZoom == rSet.mxData->mnScreenZoom) &&
2333 (mxData->mnScreenFontZoom == rSet.mxData->mnScreenFontZoom) &&
2334 (mxData->mbHighContrast == rSet.mxData->mbHighContrast) &&
2335 (mxData->mbUseSystemUIFonts == rSet.mxData->mbUseSystemUIFonts) &&
2336 (mxData->mnUseFlatBorders == rSet.mxData->mnUseFlatBorders) &&
2337 (mxData->mnUseFlatMenus == rSet.mxData->mnUseFlatMenus) &&
2338 (mxData->maFaceColor == rSet.mxData->maFaceColor) &&
2339 (mxData->maCheckedColor == rSet.mxData->maCheckedColor) &&
2340 (mxData->maLightColor == rSet.mxData->maLightColor) &&
2341 (mxData->maLightBorderColor == rSet.mxData->maLightBorderColor) &&
2342 (mxData->maShadowColor == rSet.mxData->maShadowColor) &&
2343 (mxData->maDarkShadowColor == rSet.mxData->maDarkShadowColor) &&
2344 (mxData->maButtonTextColor == rSet.mxData->maButtonTextColor) &&
2345 (mxData->maRadioCheckTextColor == rSet.mxData->maRadioCheckTextColor) &&
2346 (mxData->maGroupTextColor == rSet.mxData->maGroupTextColor) &&
2347 (mxData->maLabelTextColor == rSet.mxData->maLabelTextColor) &&
2348 (mxData->maInfoTextColor == rSet.mxData->maInfoTextColor) &&
2349 (mxData->maWindowColor == rSet.mxData->maWindowColor) &&
2350 (mxData->maWindowTextColor == rSet.mxData->maWindowTextColor) &&
2351 (mxData->maDialogColor == rSet.mxData->maDialogColor) &&
2352 (mxData->maDialogTextColor == rSet.mxData->maDialogTextColor) &&
2353 (mxData->maWorkspaceColor == rSet.mxData->maWorkspaceColor) &&
2354 (mxData->maMonoColor == rSet.mxData->maMonoColor) &&
2355 (mxData->maFieldColor == rSet.mxData->maFieldColor) &&
2356 (mxData->maFieldTextColor == rSet.mxData->maFieldTextColor) &&
2357 (mxData->maActiveColor == rSet.mxData->maActiveColor) &&
2358 (mxData->maActiveTextColor == rSet.mxData->maActiveTextColor) &&
2359 (mxData->maActiveBorderColor == rSet.mxData->maActiveBorderColor) &&
2360 (mxData->maDeactiveColor == rSet.mxData->maDeactiveColor) &&
2361 (mxData->maDeactiveTextColor == rSet.mxData->maDeactiveTextColor) &&
2362 (mxData->maDeactiveBorderColor == rSet.mxData->maDeactiveBorderColor) &&
2363 (mxData->maMenuColor == rSet.mxData->maMenuColor) &&
2364 (mxData->maMenuBarColor == rSet.mxData->maMenuBarColor) &&
2365 (mxData->maMenuBarRolloverColor == rSet.mxData->maMenuBarRolloverColor) &&
2366 (mxData->maMenuBorderColor == rSet.mxData->maMenuBorderColor) &&
2367 (mxData->maMenuTextColor == rSet.mxData->maMenuTextColor) &&
2368 (mxData->maMenuBarTextColor == rSet.mxData->maMenuBarTextColor) &&
2369 (mxData->maMenuBarRolloverTextColor == rSet.mxData->maMenuBarRolloverTextColor) &&
2370 (mxData->maMenuHighlightColor == rSet.mxData->maMenuHighlightColor) &&
2371 (mxData->maMenuHighlightTextColor == rSet.mxData->maMenuHighlightTextColor) &&
2372 (mxData->maHighlightColor == rSet.mxData->maHighlightColor) &&
2373 (mxData->maHighlightTextColor == rSet.mxData->maHighlightTextColor) &&
2374 (mxData->maTabTextColor == rSet.mxData->maTabTextColor) &&
2375 (mxData->maTabRolloverTextColor == rSet.mxData->maTabRolloverTextColor) &&
2376 (mxData->maTabHighlightTextColor == rSet.mxData->maTabHighlightTextColor) &&
2377 (mxData->maActiveTabColor == rSet.mxData->maActiveTabColor) &&
2378 (mxData->maInactiveTabColor == rSet.mxData->maInactiveTabColor) &&
2379 (mxData->maDisableColor == rSet.mxData->maDisableColor) &&
2380 (mxData->maHelpColor == rSet.mxData->maHelpColor) &&
2381 (mxData->maHelpTextColor == rSet.mxData->maHelpTextColor) &&
2382 (mxData->maLinkColor == rSet.mxData->maLinkColor) &&
2383 (mxData->maVisitedLinkColor == rSet.mxData->maVisitedLinkColor) &&
2384 (mxData->maHighlightLinkColor == rSet.mxData->maHighlightLinkColor) &&
2385 (mxData->maAppFont == rSet.mxData->maAppFont) &&
2386 (mxData->maHelpFont == rSet.mxData->maHelpFont) &&
2387 (mxData->maTitleFont == rSet.mxData->maTitleFont) &&
2388 (mxData->maFloatTitleFont == rSet.mxData->maFloatTitleFont) &&
2389 (mxData->maMenuFont == rSet.mxData->maMenuFont) &&
2390 (mxData->maToolFont == rSet.mxData->maToolFont) &&
2391 (mxData->maGroupFont == rSet.mxData->maGroupFont) &&
2392 (mxData->maLabelFont == rSet.mxData->maLabelFont) &&
2393 (mxData->maInfoFont == rSet.mxData->maInfoFont) &&
2394 (mxData->maRadioCheckFont == rSet.mxData->maRadioCheckFont) &&
2395 (mxData->maPushButtonFont == rSet.mxData->maPushButtonFont) &&
2396 (mxData->maFieldFont == rSet.mxData->maFieldFont) &&
2397 (mxData->maIconFont == rSet.mxData->maIconFont) &&
2398 (mxData->maTabFont == rSet.mxData->maTabFont) &&
2399 (mxData->meUseImagesInMenus == rSet.mxData->meUseImagesInMenus) &&
2400 (mxData->mbPreferredUseImagesInMenus == rSet.mxData->mbPreferredUseImagesInMenus) &&
2401 (mxData->mbSkipDisabledInMenus == rSet.mxData->mbSkipDisabledInMenus) &&
2402 (mxData->mbHideDisabledMenuItems == rSet.mxData->mbHideDisabledMenuItems) &&
2403 (mxData->mbAcceleratorsInContextMenus == rSet.mxData->mbAcceleratorsInContextMenus)&&
2404 (mxData->mbPrimaryButtonWarpsSlider == rSet.mxData->mbPrimaryButtonWarpsSlider) &&
2405 (mxData->maFontColor == rSet.mxData->maFontColor) &&
2406 (mxData->mnEdgeBlending == rSet.mxData->mnEdgeBlending) &&
2407 (mxData->maEdgeBlendingTopLeftColor == rSet.mxData->maEdgeBlendingTopLeftColor) &&
2408 (mxData->maEdgeBlendingBottomRightColor == rSet.mxData->maEdgeBlendingBottomRightColor) &&
2409 (mxData->mnListBoxMaximumLineCount == rSet.mxData->mnListBoxMaximumLineCount) &&
2410 (mxData->mnColorValueSetColumnCount == rSet.mxData->mnColorValueSetColumnCount) &&
2411 (mxData->mnColorValueSetMaximumRowCount == rSet.mxData->mnColorValueSetMaximumRowCount) &&
2412 (mxData->maListBoxPreviewDefaultLogicSize == rSet.mxData->maListBoxPreviewDefaultLogicSize) &&
2413 (mxData->maListBoxPreviewDefaultPixelSize == rSet.mxData->maListBoxPreviewDefaultPixelSize) &&
2414 (mxData->mnListBoxPreviewDefaultLineWidth == rSet.mxData->mnListBoxPreviewDefaultLineWidth) &&
2415 (mxData->mbPreviewUsesCheckeredBackground == rSet.mxData->mbPreviewUsesCheckeredBackground))
2416 return true;
2417 else
2418 return false;
2421 ImplMiscData::ImplMiscData()
2423 mnEnableATT = TRISTATE_INDET;
2424 mnDisablePrinting = TRISTATE_INDET;
2425 static const char* pEnv = getenv("SAL_DECIMALSEP_ENABLED" ); // set default without UI
2426 mbEnableLocalizedDecimalSep = (pEnv != NULL);
2427 pEnv = getenv("VCL_HIDE_WINDOWS"); // do not display any windows
2428 mbPseudoHeadless = (pEnv != NULL);
2431 ImplMiscData::ImplMiscData( const ImplMiscData& rData )
2433 mnEnableATT = rData.mnEnableATT;
2434 mnDisablePrinting = rData.mnDisablePrinting;
2435 mbEnableLocalizedDecimalSep = rData.mbEnableLocalizedDecimalSep;
2436 mbPseudoHeadless = rData.mbPseudoHeadless;
2439 MiscSettings::MiscSettings()
2440 : mxData(std::make_shared<ImplMiscData>())
2444 MiscSettings::~MiscSettings()
2448 void MiscSettings::CopyData()
2450 // copy if other references exist
2451 if ( ! mxData.unique() ) {
2452 mxData = std::make_shared<ImplMiscData>(*mxData);
2456 bool MiscSettings::operator ==( const MiscSettings& rSet ) const
2458 if ( mxData == rSet.mxData )
2459 return true;
2461 if ( (mxData->mnEnableATT == rSet.mxData->mnEnableATT ) &&
2462 (mxData->mnDisablePrinting == rSet.mxData->mnDisablePrinting ) &&
2463 (mxData->mbEnableLocalizedDecimalSep == rSet.mxData->mbEnableLocalizedDecimalSep ) )
2464 return true;
2465 else
2466 return false;
2469 bool
2470 MiscSettings::operator !=( const MiscSettings& rSet ) const
2472 return !(*this == rSet);
2475 bool MiscSettings::GetDisablePrinting() const
2477 if( mxData->mnDisablePrinting == TRISTATE_INDET )
2479 OUString aEnable =
2480 vcl::SettingsConfigItem::get()->
2481 getValue( OUString( "DesktopManagement" ),
2482 OUString( "DisablePrinting" ) );
2483 mxData->mnDisablePrinting = aEnable.equalsIgnoreAsciiCase("true") ? TRISTATE_TRUE : TRISTATE_FALSE;
2486 return mxData->mnDisablePrinting != TRISTATE_FALSE;
2489 bool MiscSettings::GetEnableATToolSupport() const
2492 #ifdef WNT
2493 if( mxData->mnEnableATT == TRISTATE_INDET )
2495 // Check in the Windows registry if an AT tool wants Accessibility support to
2496 // be activated ..
2497 HKEY hkey;
2499 if( ERROR_SUCCESS == RegOpenKey(HKEY_CURRENT_USER,
2500 "Software\\LibreOffice\\Accessibility\\AtToolSupport",
2501 &hkey) )
2503 DWORD dwType;
2504 sal_uInt8 Data[6]; // possible values: "true", "false", "1", "0", DWORD
2505 DWORD cbData = sizeof(Data);
2507 if( ERROR_SUCCESS == RegQueryValueEx(hkey, "SupportAssistiveTechnology",
2508 NULL, &dwType, Data, &cbData) )
2510 switch (dwType)
2512 case REG_SZ:
2513 mxData->mnEnableATT = ((0 == stricmp((const char *) Data, "1")) || (0 == stricmp((const char *) Data, "true"))) ? TRISTATE_TRUE : TRISTATE_FALSE;
2514 break;
2515 case REG_DWORD:
2516 switch (((DWORD *) Data)[0]) {
2517 case 0:
2518 mxData->mnEnableATT = TRISTATE_FALSE;
2519 break;
2520 case 1:
2521 mxData->mnEnableATT = TRISTATE_TRUE;
2522 break;
2523 default:
2524 mxData->mnEnableATT = TRISTATE_INDET;
2525 //TODO: or TRISTATE_TRUE?
2526 break;
2528 break;
2529 default:
2530 // Unsupported registry type
2531 break;
2535 RegCloseKey(hkey);
2538 #endif
2540 if( mxData->mnEnableATT == TRISTATE_INDET )
2542 static const char* pEnv = getenv("SAL_ACCESSIBILITY_ENABLED" );
2543 if( !pEnv || !*pEnv )
2545 OUString aEnable =
2546 vcl::SettingsConfigItem::get()->
2547 getValue( OUString( "Accessibility" ),
2548 OUString( "EnableATToolSupport" ) );
2549 mxData->mnEnableATT = aEnable.equalsIgnoreAsciiCase("true") ? TRISTATE_TRUE : TRISTATE_FALSE;
2551 else
2553 mxData->mnEnableATT = TRISTATE_TRUE;
2557 return mxData->mnEnableATT != TRISTATE_FALSE;
2560 #ifdef WNT
2561 void MiscSettings::SetEnableATToolSupport( bool bEnable )
2563 if ( (bEnable ? TRISTATE_TRUE : TRISTATE_FALSE) != mxData->mnEnableATT )
2565 if( bEnable && !ImplInitAccessBridge() )
2566 return;
2568 HKEY hkey;
2570 // If the accessibility key in the Windows registry exists, change it synchronously
2571 if( ERROR_SUCCESS == RegOpenKey(HKEY_CURRENT_USER,
2572 "Software\\LibreOffice\\Accessibility\\AtToolSupport",
2573 &hkey) )
2575 DWORD dwType;
2576 sal_uInt8 Data[6]; // possible values: "true", "false", 1, 0
2577 DWORD cbData = sizeof(Data);
2579 if( ERROR_SUCCESS == RegQueryValueEx(hkey, "SupportAssistiveTechnology",
2580 NULL, &dwType, Data, &cbData) )
2582 switch (dwType)
2584 case REG_SZ:
2585 RegSetValueEx(hkey, "SupportAssistiveTechnology",
2586 0, dwType,
2587 bEnable ? (sal_uInt8 *) "true" : (sal_uInt8 *) "false",
2588 bEnable ? sizeof("true") : sizeof("false"));
2589 break;
2590 case REG_DWORD:
2591 ((DWORD *) Data)[0] = bEnable ? 1 : 0;
2592 RegSetValueEx(hkey, "SupportAssistiveTechnology",
2593 0, dwType, Data, sizeof(DWORD));
2594 break;
2595 default:
2596 // Unsupported registry type
2597 break;
2601 RegCloseKey(hkey);
2604 vcl::SettingsConfigItem::get()->
2605 setValue( OUString( "Accessibility" ),
2606 OUString( "EnableATToolSupport" ),
2607 bEnable ? OUString("true") : OUString("false" ) );
2608 mxData->mnEnableATT = bEnable ? TRISTATE_TRUE : TRISTATE_FALSE;
2611 #endif
2613 void MiscSettings::SetEnableLocalizedDecimalSep( bool bEnable )
2615 CopyData();
2616 mxData->mbEnableLocalizedDecimalSep = bEnable;
2619 bool MiscSettings::GetEnableLocalizedDecimalSep() const
2621 return mxData->mbEnableLocalizedDecimalSep;
2624 bool MiscSettings::GetPseudoHeadless() const
2626 return mxData->mbPseudoHeadless;
2629 ImplHelpData::ImplHelpData()
2631 mnTipDelay = 500;
2632 mnTipTimeout = 3000;
2633 mnBalloonDelay = 1500;
2636 ImplHelpData::ImplHelpData( const ImplHelpData& rData )
2638 mnTipDelay = rData.mnTipDelay;
2639 mnTipTimeout = rData.mnTipTimeout;
2640 mnBalloonDelay = rData.mnBalloonDelay;
2643 HelpSettings::HelpSettings()
2644 : mxData(std::make_shared<ImplHelpData>())
2648 HelpSettings::~HelpSettings()
2652 void HelpSettings::CopyData()
2654 // copy if other references exist
2655 if ( ! mxData.unique() ) {
2656 mxData = std::make_shared<ImplHelpData>(*mxData);
2660 bool HelpSettings::operator ==( const HelpSettings& rSet ) const
2662 if ( mxData == rSet.mxData )
2663 return true;
2665 if ( (mxData->mnTipDelay == rSet.mxData->mnTipDelay ) &&
2666 (mxData->mnTipTimeout == rSet.mxData->mnTipTimeout ) &&
2667 (mxData->mnBalloonDelay == rSet.mxData->mnBalloonDelay ) )
2668 return true;
2669 else
2670 return false;
2673 sal_uLong
2674 HelpSettings::GetTipDelay() const
2676 return mxData->mnTipDelay;
2679 void
2680 HelpSettings::SetTipTimeout( sal_uLong nTipTimeout )
2682 CopyData();
2683 mxData->mnTipTimeout = nTipTimeout;
2686 sal_uLong
2687 HelpSettings::GetTipTimeout() const
2689 return mxData->mnTipTimeout;
2692 sal_uLong
2693 HelpSettings::GetBalloonDelay() const
2695 return mxData->mnBalloonDelay;
2698 bool
2699 HelpSettings::operator !=( const HelpSettings& rSet ) const
2701 return !(*this == rSet);
2704 ImplAllSettingsData::ImplAllSettingsData()
2706 maLocale( LANGUAGE_SYSTEM ),
2707 maUILocale( LANGUAGE_SYSTEM )
2709 mnWindowUpdate = AllSettingsFlags::MOUSE | AllSettingsFlags::STYLE |
2710 AllSettingsFlags::MISC | AllSettingsFlags::LOCALE;
2711 mpLocaleDataWrapper = NULL;
2712 mpUILocaleDataWrapper = NULL;
2713 mpI18nHelper = NULL;
2714 mpUII18nHelper = NULL;
2715 maMiscSettings.SetEnableLocalizedDecimalSep( maSysLocale.GetOptions().IsDecimalSeparatorAsLocale() );
2718 ImplAllSettingsData::ImplAllSettingsData( const ImplAllSettingsData& rData ) :
2719 maMouseSettings( rData.maMouseSettings ),
2720 maStyleSettings( rData.maStyleSettings ),
2721 maMiscSettings( rData.maMiscSettings ),
2722 maHelpSettings( rData.maHelpSettings ),
2723 maLocale( rData.maLocale ),
2724 maUILocale( rData.maUILocale )
2726 mnWindowUpdate = rData.mnWindowUpdate;
2727 // Pointer couldn't shared and objects haven't a copy ctor
2728 // So we create the cache objects new, if the GetFunction is
2729 // called
2730 mpLocaleDataWrapper = NULL;
2731 mpUILocaleDataWrapper = NULL;
2732 mpI18nHelper = NULL;
2733 mpUII18nHelper = NULL;
2736 ImplAllSettingsData::~ImplAllSettingsData()
2738 delete mpLocaleDataWrapper;
2739 delete mpUILocaleDataWrapper;
2740 delete mpI18nHelper;
2741 delete mpUII18nHelper;
2744 AllSettings::AllSettings()
2745 : mxData(std::make_shared<ImplAllSettingsData>())
2749 AllSettings::AllSettings( const AllSettings& rSet )
2751 mxData = rSet.mxData;
2754 AllSettings::~AllSettings()
2758 void AllSettings::CopyData()
2760 // copy if other references exist
2761 if ( ! mxData.unique() ) {
2762 mxData = std::make_shared<ImplAllSettingsData>(*mxData);
2767 AllSettingsFlags AllSettings::Update( AllSettingsFlags nFlags, const AllSettings& rSet )
2770 AllSettingsFlags nChangeFlags = AllSettingsFlags::NONE;
2772 if ( nFlags & AllSettingsFlags::MOUSE )
2774 if ( mxData->maMouseSettings != rSet.mxData->maMouseSettings )
2776 CopyData();
2777 mxData->maMouseSettings = rSet.mxData->maMouseSettings;
2778 nChangeFlags |= AllSettingsFlags::MOUSE;
2782 if ( nFlags & AllSettingsFlags::STYLE )
2784 if ( mxData->maStyleSettings != rSet.mxData->maStyleSettings )
2786 CopyData();
2787 mxData->maStyleSettings = rSet.mxData->maStyleSettings;
2788 nChangeFlags |= AllSettingsFlags::STYLE;
2792 if ( nFlags & AllSettingsFlags::MISC )
2794 if ( mxData->maMiscSettings != rSet.mxData->maMiscSettings )
2796 CopyData();
2797 mxData->maMiscSettings = rSet.mxData->maMiscSettings;
2798 nChangeFlags |= AllSettingsFlags::MISC;
2802 if ( nFlags & AllSettingsFlags::LOCALE )
2804 if ( mxData->maLocale != rSet.mxData->maLocale )
2806 SetLanguageTag( rSet.mxData->maLocale );
2807 nChangeFlags |= AllSettingsFlags::LOCALE;
2811 return nChangeFlags;
2814 AllSettingsFlags AllSettings::GetChangeFlags( const AllSettings& rSet ) const
2817 AllSettingsFlags nChangeFlags = AllSettingsFlags::NONE;
2819 if ( mxData->maStyleSettings != rSet.mxData->maStyleSettings )
2820 nChangeFlags |= AllSettingsFlags::STYLE;
2822 if ( mxData->maMiscSettings != rSet.mxData->maMiscSettings )
2823 nChangeFlags |= AllSettingsFlags::MISC;
2825 if ( mxData->maLocale != rSet.mxData->maLocale )
2826 nChangeFlags |= AllSettingsFlags::LOCALE;
2828 return nChangeFlags;
2831 bool AllSettings::operator ==( const AllSettings& rSet ) const
2833 if ( mxData == rSet.mxData )
2834 return true;
2836 if ( (mxData->maMouseSettings == rSet.mxData->maMouseSettings) &&
2837 (mxData->maStyleSettings == rSet.mxData->maStyleSettings) &&
2838 (mxData->maMiscSettings == rSet.mxData->maMiscSettings) &&
2839 (mxData->maHelpSettings == rSet.mxData->maHelpSettings) &&
2840 (mxData->maLocale == rSet.mxData->maLocale) &&
2841 (mxData->mnWindowUpdate == rSet.mxData->mnWindowUpdate) )
2843 return true;
2846 return false;
2849 void AllSettings::SetLanguageTag( const LanguageTag& rLanguageTag )
2851 if (mxData->maLocale != rLanguageTag)
2853 CopyData();
2855 mxData->maLocale = rLanguageTag;
2857 if ( mxData->mpLocaleDataWrapper )
2859 delete mxData->mpLocaleDataWrapper;
2860 mxData->mpLocaleDataWrapper = NULL;
2862 if ( mxData->mpI18nHelper )
2864 delete mxData->mpI18nHelper;
2865 mxData->mpI18nHelper = NULL;
2870 namespace
2872 bool GetConfigLayoutRTL(bool bMath)
2874 static const char* pEnv = getenv("SAL_RTL_ENABLED" );
2875 static int nUIMirroring = -1; // -1: undef, 0: auto, 1: on 2: off
2877 // environment always overrides
2878 if( pEnv )
2879 return true;
2881 bool bRTL = false;
2883 if( nUIMirroring == -1 )
2885 nUIMirroring = 0; // ask configuration only once
2886 utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithComponentContext(
2887 comphelper::getProcessComponentContext(),
2888 OUString("org.openoffice.Office.Common/I18N/CTL") ); // note: case sensitive !
2889 if ( aNode.isValid() )
2891 bool bTmp = bool();
2892 ::com::sun::star::uno::Any aValue = aNode.getNodeValue( OUString("UIMirroring") );
2893 if( aValue >>= bTmp )
2895 // found true or false; if it was nil, nothing is changed
2896 nUIMirroring = bTmp ? 1 : 2;
2901 if( nUIMirroring == 0 ) // no config found (eg, setup) or default (nil) was set: check language
2903 LanguageType aLang = LANGUAGE_DONTKNOW;
2904 ImplSVData* pSVData = ImplGetSVData();
2905 if ( pSVData->maAppData.mpSettings )
2906 aLang = pSVData->maAppData.mpSettings->GetUILanguageTag().getLanguageType();
2907 if (bMath)
2908 bRTL = MsLangId::isRightToLeftMath( aLang );
2909 else
2910 bRTL = MsLangId::isRightToLeft( aLang );
2912 else
2913 bRTL = (nUIMirroring == 1);
2915 return bRTL;
2919 bool AllSettings::GetLayoutRTL()
2921 return GetConfigLayoutRTL(false);
2924 bool AllSettings::GetMathLayoutRTL()
2926 return GetConfigLayoutRTL(true);
2929 const LanguageTag& AllSettings::GetLanguageTag() const
2931 // SYSTEM locale means: use settings from SvtSysLocale that is resolved
2932 if ( mxData->maLocale.isSystemLocale() )
2933 mxData->maLocale = mxData->maSysLocale.GetLanguageTag();
2935 return mxData->maLocale;
2938 const LanguageTag& AllSettings::GetUILanguageTag() const
2940 // the UILocale is never changed
2941 if ( mxData->maUILocale.isSystemLocale() )
2942 mxData->maUILocale = mxData->maSysLocale.GetUILanguageTag();
2944 return mxData->maUILocale;
2947 const LocaleDataWrapper& AllSettings::GetLocaleDataWrapper() const
2949 if ( !mxData->mpLocaleDataWrapper )
2950 const_cast<AllSettings*>(this)->mxData->mpLocaleDataWrapper = new LocaleDataWrapper(
2951 comphelper::getProcessComponentContext(), GetLanguageTag() );
2952 return *mxData->mpLocaleDataWrapper;
2955 const LocaleDataWrapper& AllSettings::GetUILocaleDataWrapper() const
2957 if ( !mxData->mpUILocaleDataWrapper )
2958 const_cast<AllSettings*>(this)->mxData->mpUILocaleDataWrapper = new LocaleDataWrapper(
2959 comphelper::getProcessComponentContext(), GetUILanguageTag() );
2960 return *mxData->mpUILocaleDataWrapper;
2963 const vcl::I18nHelper& AllSettings::GetLocaleI18nHelper() const
2965 if ( !mxData->mpI18nHelper ) {
2966 const_cast<AllSettings*>(this)->mxData->mpI18nHelper = new vcl::I18nHelper(
2967 comphelper::getProcessComponentContext(), GetLanguageTag() );
2969 return *mxData->mpI18nHelper;
2972 const vcl::I18nHelper& AllSettings::GetUILocaleI18nHelper() const
2974 if ( !mxData->mpUII18nHelper ) {
2975 const_cast<AllSettings*>(this)->mxData->mpUII18nHelper = new vcl::I18nHelper(
2976 comphelper::getProcessComponentContext(), GetUILanguageTag() );
2978 return *mxData->mpUII18nHelper;
2981 void AllSettings::LocaleSettingsChanged( sal_uInt32 nHint )
2983 AllSettings aAllSettings( Application::GetSettings() );
2984 if ( nHint & SYSLOCALEOPTIONS_HINT_DECSEP )
2986 MiscSettings aMiscSettings = aAllSettings.GetMiscSettings();
2987 bool bIsDecSepAsLocale = aAllSettings.mxData->maSysLocale.GetOptions().IsDecimalSeparatorAsLocale();
2988 if ( aMiscSettings.GetEnableLocalizedDecimalSep() != bIsDecSepAsLocale )
2990 aMiscSettings.SetEnableLocalizedDecimalSep( bIsDecSepAsLocale );
2991 aAllSettings.SetMiscSettings( aMiscSettings );
2995 if ( (nHint & SYSLOCALEOPTIONS_HINT_LOCALE) )
2996 aAllSettings.SetLanguageTag( aAllSettings.mxData->maSysLocale.GetOptions().GetLanguageTag() );
2998 Application::SetSettings( aAllSettings );
3001 const StyleSettings&
3002 AllSettings::GetStyleSettings() const
3004 return mxData->maStyleSettings;
3007 StyleSettingsOptions
3008 StyleSettings::GetOptions() const
3010 return mxData->mnOptions;
3013 std::vector<vcl::IconThemeInfo>
3014 StyleSettings::GetInstalledIconThemes() const
3016 return mxData->mIconThemeScanner->GetFoundIconThemes();
3019 /*static*/ OUString
3020 StyleSettings::GetAutomaticallyChosenIconTheme() const
3022 OUString desktopEnvironment = Application::GetDesktopEnvironment();
3023 OUString themeName = mxData->mIconThemeSelector->SelectIconThemeForDesktopEnvironment(
3024 mxData->mIconThemeScanner->GetFoundIconThemes(),
3025 desktopEnvironment
3027 return themeName;
3030 void
3031 StyleSettings::SetIconTheme(const OUString& theme)
3033 CopyData();
3034 mxData->mIconTheme = theme;
3037 OUString
3038 StyleSettings::DetermineIconTheme() const
3040 OUString sTheme(mxData->mIconTheme);
3041 if (sTheme.isEmpty())
3043 // read from the configuration, or fallback to what the desktop wants
3044 uno::Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext());
3045 if (xContext.is())
3047 sTheme = officecfg::Office::Common::Misc::SymbolStyle::get(xContext);
3049 if (sTheme.isEmpty() || sTheme == "auto")
3050 sTheme = GetAutomaticallyChosenIconTheme();
3054 OUString r = mxData->mIconThemeSelector->SelectIconTheme(
3055 mxData->mIconThemeScanner->GetFoundIconThemes(),
3056 sTheme);
3057 return r;
3060 void
3061 StyleSettings::SetHighContrastMode(bool bHighContrast )
3063 if (mxData->mbHighContrast == bHighContrast) {
3064 return;
3067 CopyData();
3068 mxData->mbHighContrast = bHighContrast;
3069 mxData->mIconThemeSelector->SetUseHighContrastTheme(bHighContrast);
3072 bool
3073 StyleSettings::GetHighContrastMode() const
3075 return mxData->mbHighContrast;
3078 void
3079 StyleSettings::SetPreferredIconTheme(const OUString& theme)
3081 mxData->mIconThemeSelector->SetPreferredIconTheme(theme);
3084 void
3085 AllSettings::SetMouseSettings( const MouseSettings& rSet )
3087 CopyData();
3088 mxData->maMouseSettings = rSet;
3091 const MouseSettings&
3092 AllSettings::GetMouseSettings() const
3094 return mxData->maMouseSettings;
3097 void
3098 AllSettings::SetStyleSettings( const StyleSettings& rSet )
3100 CopyData();
3101 mxData->maStyleSettings = rSet;
3104 void
3105 AllSettings::SetMiscSettings( const MiscSettings& rSet )
3107 CopyData();
3108 mxData->maMiscSettings = rSet;
3111 const MiscSettings&
3112 AllSettings::GetMiscSettings() const
3114 return mxData->maMiscSettings;
3117 void
3118 AllSettings::SetHelpSettings( const HelpSettings& rSet )
3120 CopyData();
3121 mxData->maHelpSettings = rSet;
3124 const HelpSettings&
3125 AllSettings::GetHelpSettings() const
3127 return mxData->maHelpSettings;
3130 AllSettingsFlags
3131 AllSettings::GetWindowUpdate() const
3133 return mxData->mnWindowUpdate;
3136 bool
3137 AllSettings::operator !=( const AllSettings& rSet ) const
3139 return !(*this == rSet);
3142 SvtSysLocale&
3143 AllSettings::GetSysLocale()
3145 return mxData->maSysLocale;
3148 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */