1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
25 #include <win/svsys.h>
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/configsettings.hxx>
45 #include <vcl/outdev.hxx>
47 #include <unotools/fontcfg.hxx>
48 #include <unotools/localedatawrapper.hxx>
49 #include <unotools/confignode.hxx>
50 #include <unotools/configmgr.hxx>
51 #include <unotools/syslocale.hxx>
52 #include <unotools/syslocaleoptions.hxx>
54 using namespace ::com::sun::star
;
60 MouseSettingsOptions mnOptions
= MouseSettingsOptions::NONE
;
61 sal_uInt64 mnDoubleClkTime
= 500;
62 long mnDoubleClkWidth
= 2;
63 long mnDoubleClkHeight
= 2;
64 long mnStartDragWidth
= 2 ;
65 long mnStartDragHeight
= 2;
66 sal_uLong mnButtonRepeat
= 90;
67 sal_uLong mnMenuDelay
= 150;
68 MouseFollowFlags mnFollow
= MouseFollowFlags::Menu
| MouseFollowFlags::DDList
;
69 MouseMiddleButtonAction mnMiddleButtonAction
= MouseMiddleButtonAction::AutoScroll
;
70 MouseWheelBehaviour mnWheelBehavior
= MouseWheelBehaviour::ALWAYS
;
76 ImplStyleData( const ImplStyleData
& rData
);
78 void SetStandardStyles();
80 Color maActiveBorderColor
;
82 Color maActiveTextColor
;
83 Color maAlternatingRowColor
;
84 Color maButtonTextColor
;
85 Color maDefaultActionButtonTextColor
;
86 Color maActionButtonTextColor
;
87 Color maActionButtonRolloverTextColor
;
88 Color maButtonRolloverTextColor
;
89 Color maButtonPressedRolloverTextColor
;
91 Color maDarkShadowColor
;
92 Color maDeactiveBorderColor
;
93 Color maDeactiveColor
;
94 Color maDeactiveTextColor
;
96 Color maDialogTextColor
;
100 Color maFieldTextColor
;
101 Color maFieldRolloverTextColor
;
103 Color maGroupTextColor
;
105 Color maHelpTextColor
;
106 Color maHighlightColor
;
107 Color maHighlightLinkColor
;
108 Color maHighlightTextColor
;
109 Color maLabelTextColor
;
110 Color maLightBorderColor
;
113 Color maMenuBarColor
;
114 Color maMenuBarRolloverColor
;
115 Color maMenuBorderColor
;
117 Color maMenuHighlightColor
;
118 Color maMenuHighlightTextColor
;
119 Color maMenuTextColor
;
120 Color maMenuBarTextColor
;
121 Color maMenuBarRolloverTextColor
;
122 Color maMenuBarHighlightTextColor
;
124 Color maRadioCheckTextColor
;
126 Color maVisitedLinkColor
;
127 Color maToolTextColor
;
129 Color maWindowTextColor
;
130 Color maWorkspaceColor
;
131 Color maActiveTabColor
;
132 Color maInactiveTabColor
;
133 Color maTabTextColor
;
134 Color maTabRolloverTextColor
;
135 Color maTabHighlightTextColor
;
137 vcl::Font maHelpFont
;
138 vcl::Font maTitleFont
;
139 vcl::Font maFloatTitleFont
;
140 vcl::Font maMenuFont
;
141 vcl::Font maToolFont
;
142 vcl::Font maLabelFont
;
143 vcl::Font maRadioCheckFont
;
144 vcl::Font maPushButtonFont
;
145 vcl::Font maFieldFont
;
146 vcl::Font maIconFont
;
148 vcl::Font maGroupFont
;
150 long mnFloatTitleHeight
;
151 long mnScrollBarSize
;
154 long mnAntialiasedMin
;
155 sal_uInt64 mnCursorBlinkTime
;
156 DragFullOptions mnDragFullOptions
;
157 SelectionOptions mnSelectionOptions
;
158 DisplayOptions mnDisplayOptions
;
159 ToolbarIconSize mnToolbarIconSize
;
161 StyleSettingsOptions mnOptions
;
163 bool mbUseSystemUIFonts
;
165 * Disabling AA doesn't actually disable AA of fonts, instead it is taken
166 * from system settings.
168 bool mbUseFontAAFromSystem
;
170 TriState meUseImagesInMenus
;
171 bool mnUseFlatBorders
;
172 bool mbPreferredUseImagesInMenus
;
174 std::shared_ptr
<vcl::IconThemeScanner
>
176 std::shared_ptr
<vcl::IconThemeSelector
>
180 bool mbSkipDisabledInMenus
;
181 bool mbHideDisabledMenuItems
;
182 bool mbPreferredContextMenuShortcuts
;
183 TriState meContextMenuShortcuts
;
184 //mbPrimaryButtonWarpsSlider == true for "jump to here" behavior for primary button, otherwise
185 //primary means scroll by single page. Secondary button takes the alternative behaviour
186 bool mbPrimaryButtonWarpsSlider
;
187 DialogStyle maDialogStyle
;
189 sal_uInt16 mnEdgeBlending
;
190 Color maEdgeBlendingTopLeftColor
;
191 Color maEdgeBlendingBottomRightColor
;
192 sal_uInt16 mnListBoxMaximumLineCount
;
193 sal_uInt16 mnColorValueSetColumnCount
;
194 Size maListBoxPreviewDefaultLogicSize
;
195 Size maListBoxPreviewDefaultPixelSize
;
196 bool mbPreviewUsesCheckeredBackground
;
198 OUString maPersonaHeaderFooter
; ///< Cache the settings to detect changes.
200 BitmapEx maPersonaHeaderBitmap
; ///< Cache the header bitmap.
201 BitmapEx maPersonaFooterBitmap
; ///< Cache the footer bitmap.
202 boost::optional
<Color
> maPersonaMenuBarTextColor
; ///< Cache the menubar color.
208 TriState mnEnableATT
;
209 bool mbEnableLocalizedDecimalSep
;
210 TriState mnDisablePrinting
;
215 sal_uLong mnTipTimeout
= 3000;
218 struct ImplAllSettingsData
220 ImplAllSettingsData();
221 ImplAllSettingsData( const ImplAllSettingsData
& rData
);
222 ~ImplAllSettingsData();
224 MouseSettings maMouseSettings
;
225 StyleSettings maStyleSettings
;
226 MiscSettings maMiscSettings
;
227 HelpSettings maHelpSettings
;
228 LanguageTag maLocale
;
229 LanguageTag maUILocale
;
230 std::unique_ptr
<LocaleDataWrapper
> mpLocaleDataWrapper
;
231 std::unique_ptr
<LocaleDataWrapper
> mpUILocaleDataWrapper
;
232 std::unique_ptr
<vcl::I18nHelper
> mpI18nHelper
;
233 std::unique_ptr
<vcl::I18nHelper
> mpUII18nHelper
;
234 SvtSysLocale maSysLocale
;
238 MouseSettings::SetOptions(MouseSettingsOptions nOptions
)
241 mxData
->mnOptions
= nOptions
;
245 MouseSettings::GetOptions() const
247 return mxData
->mnOptions
;
251 MouseSettings::SetDoubleClickTime( sal_uInt64 nDoubleClkTime
)
254 mxData
->mnDoubleClkTime
= nDoubleClkTime
;
258 MouseSettings::GetDoubleClickTime() const
260 return mxData
->mnDoubleClkTime
;
264 MouseSettings::SetDoubleClickWidth( long nDoubleClkWidth
)
267 mxData
->mnDoubleClkWidth
= nDoubleClkWidth
;
271 MouseSettings::GetDoubleClickWidth() const
273 return mxData
->mnDoubleClkWidth
;
277 MouseSettings::SetDoubleClickHeight( long nDoubleClkHeight
)
280 mxData
->mnDoubleClkHeight
= nDoubleClkHeight
;
284 MouseSettings::GetDoubleClickHeight() const
286 return mxData
->mnDoubleClkHeight
;
290 MouseSettings::SetStartDragWidth( long nDragWidth
)
293 mxData
->mnStartDragWidth
= nDragWidth
;
297 MouseSettings::GetStartDragWidth() const
299 return mxData
->mnStartDragWidth
;
303 MouseSettings::SetStartDragHeight( long nDragHeight
)
306 mxData
->mnStartDragHeight
= nDragHeight
;
310 MouseSettings::GetStartDragHeight() const
312 return mxData
->mnStartDragHeight
;
316 MouseSettings::GetStartDragCode()
322 MouseSettings::GetContextMenuCode()
328 MouseSettings::GetContextMenuClicks()
334 MouseSettings::GetScrollRepeat()
340 MouseSettings::GetButtonStartRepeat()
346 MouseSettings::SetButtonRepeat( sal_uLong nRepeat
)
349 mxData
->mnButtonRepeat
= nRepeat
;
353 MouseSettings::GetButtonRepeat() const
355 return mxData
->mnButtonRepeat
;
359 MouseSettings::GetActionDelay()
365 MouseSettings::SetMenuDelay( sal_uLong nDelay
)
368 mxData
->mnMenuDelay
= nDelay
;
372 MouseSettings::GetMenuDelay() const
374 return mxData
->mnMenuDelay
;
378 MouseSettings::SetFollow( MouseFollowFlags nFollow
)
381 mxData
->mnFollow
= nFollow
;
385 MouseSettings::GetFollow() const
387 return mxData
->mnFollow
;
391 MouseSettings::SetMiddleButtonAction( MouseMiddleButtonAction nAction
)
394 mxData
->mnMiddleButtonAction
= nAction
;
397 MouseMiddleButtonAction
398 MouseSettings::GetMiddleButtonAction() const
400 return mxData
->mnMiddleButtonAction
;
404 MouseSettings::SetWheelBehavior( MouseWheelBehaviour nBehavior
)
407 mxData
->mnWheelBehavior
= nBehavior
;
411 MouseSettings::GetWheelBehavior() const
413 return mxData
->mnWheelBehavior
;
417 MouseSettings::operator !=( const MouseSettings
& rSet
) const
419 return !(*this == rSet
);
422 MouseSettings::MouseSettings()
423 : mxData(std::make_shared
<ImplMouseData
>())
427 void MouseSettings::CopyData()
429 // copy if other references exist
430 if (mxData
.use_count() > 1)
432 mxData
= std::make_shared
<ImplMouseData
>(*mxData
);
436 bool MouseSettings::operator ==( const MouseSettings
& rSet
) const
438 if ( mxData
== rSet
.mxData
)
442 (mxData
->mnOptions
== rSet
.mxData
->mnOptions
) &&
443 (mxData
->mnDoubleClkTime
== rSet
.mxData
->mnDoubleClkTime
) &&
444 (mxData
->mnDoubleClkWidth
== rSet
.mxData
->mnDoubleClkWidth
) &&
445 (mxData
->mnDoubleClkHeight
== rSet
.mxData
->mnDoubleClkHeight
) &&
446 (mxData
->mnStartDragWidth
== rSet
.mxData
->mnStartDragWidth
) &&
447 (mxData
->mnStartDragHeight
== rSet
.mxData
->mnStartDragHeight
) &&
448 (mxData
->mnMiddleButtonAction
== rSet
.mxData
->mnMiddleButtonAction
) &&
449 (mxData
->mnButtonRepeat
== rSet
.mxData
->mnButtonRepeat
) &&
450 (mxData
->mnMenuDelay
== rSet
.mxData
->mnMenuDelay
) &&
451 (mxData
->mnFollow
== rSet
.mxData
->mnFollow
) &&
452 (mxData
->mnWheelBehavior
== rSet
.mxData
->mnWheelBehavior
);
455 ImplStyleData::ImplStyleData() :
460 mnCursorBlinkTime(STYLE_CURSOR_NOBLINKTIME
),
461 mnDragFullOptions(DragFullOptions::All
),
462 mnSelectionOptions(SelectionOptions::NONE
),
463 mnDisplayOptions(DisplayOptions::NONE
),
464 mnToolbarIconSize(ToolbarIconSize::Unknown
),
465 mnOptions(StyleSettingsOptions::NONE
),
466 mbAutoMnemonic(true),
467 meUseImagesInMenus(TRISTATE_INDET
),
469 mIconThemeSelector(new vcl::IconThemeSelector()),
470 meContextMenuShortcuts(TRISTATE_INDET
),
472 maEdgeBlendingTopLeftColor(Color(0xC0, 0xC0, 0xC0)),
473 maEdgeBlendingBottomRightColor(Color(0x40, 0x40, 0x40)),
474 mnListBoxMaximumLineCount(25),
475 mnColorValueSetColumnCount(12),
476 maListBoxPreviewDefaultLogicSize(Size(15, 7)),
477 maListBoxPreviewDefaultPixelSize(Size(0, 0)), // on-demand calculated in GetListBoxPreviewDefaultPixelSize(),
478 mbPreviewUsesCheckeredBackground(true)
483 ImplStyleData::ImplStyleData( const ImplStyleData
& rData
) :
484 maActiveBorderColor( rData
.maActiveBorderColor
),
485 maActiveColor( rData
.maActiveColor
),
486 maActiveTextColor( rData
.maActiveTextColor
),
487 maAlternatingRowColor( rData
.maAlternatingRowColor
),
488 maButtonTextColor( rData
.maButtonTextColor
),
489 maDefaultActionButtonTextColor( rData
.maDefaultActionButtonTextColor
),
490 maActionButtonTextColor( rData
.maActionButtonTextColor
),
491 maActionButtonRolloverTextColor( rData
.maActionButtonRolloverTextColor
),
492 maButtonRolloverTextColor( rData
.maButtonRolloverTextColor
),
493 maButtonPressedRolloverTextColor( rData
.maButtonPressedRolloverTextColor
),
494 maCheckedColor( rData
.maCheckedColor
),
495 maDarkShadowColor( rData
.maDarkShadowColor
),
496 maDeactiveBorderColor( rData
.maDeactiveBorderColor
),
497 maDeactiveColor( rData
.maDeactiveColor
),
498 maDeactiveTextColor( rData
.maDeactiveTextColor
),
499 maDialogColor( rData
.maDialogColor
),
500 maDialogTextColor( rData
.maDialogTextColor
),
501 maDisableColor( rData
.maDisableColor
),
502 maFaceColor( rData
.maFaceColor
),
503 maFieldColor( rData
.maFieldColor
),
504 maFieldTextColor( rData
.maFieldTextColor
),
505 maFieldRolloverTextColor( rData
.maFieldRolloverTextColor
),
506 maFontColor( rData
.maFontColor
),
507 maGroupTextColor( rData
.maGroupTextColor
),
508 maHelpColor( rData
.maHelpColor
),
509 maHelpTextColor( rData
.maHelpTextColor
),
510 maHighlightColor( rData
.maHighlightColor
),
511 maHighlightLinkColor( rData
.maHighlightLinkColor
),
512 maHighlightTextColor( rData
.maHighlightTextColor
),
513 maLabelTextColor( rData
.maLabelTextColor
),
514 maLightBorderColor( rData
.maLightBorderColor
),
515 maLightColor( rData
.maLightColor
),
516 maLinkColor( rData
.maLinkColor
),
517 maMenuBarColor( rData
.maMenuBarColor
),
518 maMenuBarRolloverColor( rData
.maMenuBarRolloverColor
),
519 maMenuBorderColor( rData
.maMenuBorderColor
),
520 maMenuColor( rData
.maMenuColor
),
521 maMenuHighlightColor( rData
.maMenuHighlightColor
),
522 maMenuHighlightTextColor( rData
.maMenuHighlightTextColor
),
523 maMenuTextColor( rData
.maMenuTextColor
),
524 maMenuBarTextColor( rData
.maMenuBarTextColor
),
525 maMenuBarRolloverTextColor( rData
.maMenuBarRolloverTextColor
),
526 maMenuBarHighlightTextColor( rData
.maMenuBarHighlightTextColor
),
527 maMonoColor( rData
.maMonoColor
),
528 maRadioCheckTextColor( rData
.maRadioCheckTextColor
),
529 maShadowColor( rData
.maShadowColor
),
530 maVisitedLinkColor( rData
.maVisitedLinkColor
),
531 maToolTextColor( rData
.maToolTextColor
),
532 maWindowColor( rData
.maWindowColor
),
533 maWindowTextColor( rData
.maWindowTextColor
),
534 maWorkspaceColor( rData
.maWorkspaceColor
),
535 maActiveTabColor( rData
.maActiveTabColor
),
536 maInactiveTabColor( rData
.maInactiveTabColor
),
537 maTabTextColor( rData
.maTabTextColor
),
538 maTabRolloverTextColor( rData
.maTabRolloverTextColor
),
539 maTabHighlightTextColor( rData
.maTabHighlightTextColor
),
540 maAppFont( rData
.maAppFont
),
541 maHelpFont( rData
.maAppFont
),
542 maTitleFont( rData
.maTitleFont
),
543 maFloatTitleFont( rData
.maFloatTitleFont
),
544 maMenuFont( rData
.maMenuFont
),
545 maToolFont( rData
.maToolFont
),
546 maLabelFont( rData
.maLabelFont
),
547 maRadioCheckFont( rData
.maRadioCheckFont
),
548 maPushButtonFont( rData
.maPushButtonFont
),
549 maFieldFont( rData
.maFieldFont
),
550 maIconFont( rData
.maIconFont
),
551 maTabFont( rData
.maTabFont
),
552 maGroupFont( rData
.maGroupFont
),
553 mnTitleHeight(rData
.mnTitleHeight
),
554 mnFloatTitleHeight(rData
.mnFloatTitleHeight
),
555 mnScrollBarSize(rData
.mnScrollBarSize
),
556 mnSpinSize(rData
.mnSpinSize
),
557 mnCursorSize(rData
.mnCursorSize
),
558 mnAntialiasedMin(rData
.mnAntialiasedMin
),
559 mnCursorBlinkTime(rData
.mnCursorBlinkTime
),
560 mnDragFullOptions(rData
.mnDragFullOptions
),
561 mnSelectionOptions(rData
.mnSelectionOptions
),
562 mnDisplayOptions(rData
.mnDisplayOptions
),
563 mnToolbarIconSize(rData
.mnToolbarIconSize
),
564 mnUseFlatMenus(rData
.mnUseFlatMenus
),
565 mnOptions(rData
.mnOptions
),
566 mbHighContrast(rData
.mbHighContrast
),
567 mbUseSystemUIFonts(rData
.mbUseSystemUIFonts
),
568 mbUseFontAAFromSystem(rData
.mbUseFontAAFromSystem
),
569 mbAutoMnemonic(rData
.mbAutoMnemonic
),
570 meUseImagesInMenus(rData
.meUseImagesInMenus
),
571 mnUseFlatBorders(rData
.mnUseFlatBorders
),
572 mbPreferredUseImagesInMenus(rData
.mbPreferredUseImagesInMenus
),
573 mnMinThumbSize(rData
.mnMinThumbSize
),
574 mIconThemeScanner(rData
.mIconThemeScanner
?new vcl::IconThemeScanner(*rData
.mIconThemeScanner
):nullptr),
575 mIconThemeSelector(new vcl::IconThemeSelector(*rData
.mIconThemeSelector
)),
576 mIconTheme(rData
.mIconTheme
),
577 mbSkipDisabledInMenus(rData
.mbSkipDisabledInMenus
),
578 mbHideDisabledMenuItems(rData
.mbHideDisabledMenuItems
),
579 mbPreferredContextMenuShortcuts(rData
.mbPreferredContextMenuShortcuts
),
580 meContextMenuShortcuts(rData
.meContextMenuShortcuts
),
581 mbPrimaryButtonWarpsSlider(rData
.mbPrimaryButtonWarpsSlider
),
582 maDialogStyle( rData
.maDialogStyle
),
583 mnEdgeBlending(rData
.mnEdgeBlending
),
584 maEdgeBlendingTopLeftColor(rData
.maEdgeBlendingTopLeftColor
),
585 maEdgeBlendingBottomRightColor(rData
.maEdgeBlendingBottomRightColor
),
586 mnListBoxMaximumLineCount(rData
.mnListBoxMaximumLineCount
),
587 mnColorValueSetColumnCount(rData
.mnColorValueSetColumnCount
),
588 maListBoxPreviewDefaultLogicSize(rData
.maListBoxPreviewDefaultLogicSize
),
589 maListBoxPreviewDefaultPixelSize(rData
.maListBoxPreviewDefaultPixelSize
),
590 mbPreviewUsesCheckeredBackground(rData
.mbPreviewUsesCheckeredBackground
),
591 maPersonaHeaderFooter( rData
.maPersonaHeaderFooter
),
592 maPersonaHeaderBitmap( rData
.maPersonaHeaderBitmap
),
593 maPersonaFooterBitmap( rData
.maPersonaFooterBitmap
),
594 maPersonaMenuBarTextColor( rData
.maPersonaMenuBarTextColor
)
598 void ImplStyleData::SetStandardStyles()
600 vcl::Font
aStdFont( FAMILY_SWISS
, Size( 0, 8 ) );
601 aStdFont
.SetCharSet( osl_getThreadTextEncoding() );
602 aStdFont
.SetWeight( WEIGHT_NORMAL
);
603 if (!utl::ConfigManager::IsFuzzing())
604 aStdFont
.SetFamilyName(utl::DefaultFontConfiguration::get().getUserInterfaceFont(LanguageTag("en")));
606 aStdFont
.SetFamilyName("Liberation Sans");
607 maAppFont
= aStdFont
;
608 maHelpFont
= aStdFont
;
609 maMenuFont
= aStdFont
;
610 maToolFont
= aStdFont
;
611 maGroupFont
= aStdFont
;
612 maLabelFont
= aStdFont
;
613 maRadioCheckFont
= aStdFont
;
614 maPushButtonFont
= aStdFont
;
615 maFieldFont
= aStdFont
;
616 maIconFont
= aStdFont
;
617 maTabFont
= aStdFont
;
618 aStdFont
.SetWeight( WEIGHT_BOLD
);
619 maFloatTitleFont
= aStdFont
;
620 maTitleFont
= aStdFont
;
622 maFaceColor
= COL_LIGHTGRAY
;
623 maCheckedColor
= Color( 0xCC, 0xCC, 0xCC );
624 maLightColor
= COL_WHITE
;
625 maLightBorderColor
= COL_LIGHTGRAY
;
626 maShadowColor
= COL_GRAY
;
627 maDarkShadowColor
= COL_BLACK
;
628 maButtonTextColor
= COL_BLACK
;
629 maDefaultActionButtonTextColor
= COL_BLACK
;
630 maActionButtonTextColor
= COL_BLACK
;
631 maActionButtonRolloverTextColor
= COL_BLACK
;
632 maButtonRolloverTextColor
= COL_BLACK
;
633 maButtonPressedRolloverTextColor
= COL_BLACK
;
634 maRadioCheckTextColor
= COL_BLACK
;
635 maGroupTextColor
= COL_BLACK
;
636 maLabelTextColor
= COL_BLACK
;
637 maWindowColor
= COL_WHITE
;
638 maWindowTextColor
= COL_BLACK
;
639 maDialogColor
= COL_LIGHTGRAY
;
640 maDialogTextColor
= COL_BLACK
;
641 maWorkspaceColor
= Color( 0xDF, 0xDF, 0xDE );
642 maMonoColor
= COL_BLACK
;
643 maFieldColor
= COL_WHITE
;
644 maFieldTextColor
= COL_BLACK
;
645 maFieldRolloverTextColor
= COL_BLACK
;
646 maActiveColor
= COL_BLUE
;
647 maActiveTextColor
= COL_WHITE
;
648 maActiveBorderColor
= COL_LIGHTGRAY
;
649 maDeactiveColor
= COL_GRAY
;
650 maDeactiveTextColor
= COL_LIGHTGRAY
;
651 maDeactiveBorderColor
= COL_LIGHTGRAY
;
652 maMenuColor
= COL_LIGHTGRAY
;
653 maMenuBarColor
= COL_LIGHTGRAY
;
654 maMenuBarRolloverColor
= COL_BLUE
;
655 maMenuBorderColor
= COL_LIGHTGRAY
;
656 maMenuTextColor
= COL_BLACK
;
657 maMenuBarTextColor
= COL_BLACK
;
658 maMenuBarRolloverTextColor
= COL_WHITE
;
659 maMenuBarHighlightTextColor
= COL_WHITE
;
660 maMenuHighlightColor
= COL_BLUE
;
661 maMenuHighlightTextColor
= COL_WHITE
;
662 maHighlightColor
= COL_BLUE
;
663 maHighlightTextColor
= COL_WHITE
;
664 maActiveTabColor
= COL_WHITE
;
665 maInactiveTabColor
= COL_LIGHTGRAY
;
666 maTabTextColor
= COL_BLACK
;
667 maTabRolloverTextColor
= COL_BLACK
;
668 maTabHighlightTextColor
= COL_BLACK
;
669 maDisableColor
= COL_GRAY
;
670 maHelpColor
= Color( 0xFF, 0xFF, 0xE0 );
671 maHelpTextColor
= COL_BLACK
;
672 maLinkColor
= COL_BLUE
;
673 maVisitedLinkColor
= Color( 0x00, 0x00, 0xCC );
674 maToolTextColor
= COL_BLACK
;
675 maHighlightLinkColor
= COL_LIGHTBLUE
;
676 maFontColor
= COL_BLACK
;
677 maAlternatingRowColor
= Color( 0xEE, 0xEE, 0xEE );
680 mnFloatTitleHeight
= 13;
681 mbHighContrast
= false;
682 mbUseSystemUIFonts
= true;
683 mbUseFontAAFromSystem
= true;
684 mnUseFlatBorders
= false;
685 mnUseFlatMenus
= false;
686 mbPreferredUseImagesInMenus
= true;
687 mbSkipDisabledInMenus
= false;
688 mbHideDisabledMenuItems
= false;
689 mbPreferredContextMenuShortcuts
= true;
690 mbPrimaryButtonWarpsSlider
= false;
693 StyleSettings::StyleSettings()
694 : mxData(std::make_shared
<ImplStyleData
>())
699 StyleSettings::SetFaceColor( const Color
& rColor
)
702 mxData
->maFaceColor
= rColor
;
706 StyleSettings::GetFaceColor() const
708 return mxData
->maFaceColor
;
712 StyleSettings::SetCheckedColor( const Color
& rColor
)
715 mxData
->maCheckedColor
= rColor
;
719 StyleSettings::GetCheckedColor() const
721 return mxData
->maCheckedColor
;
725 StyleSettings::SetLightColor( const Color
& rColor
)
728 mxData
->maLightColor
= rColor
;
732 StyleSettings::GetLightColor() const
734 return mxData
->maLightColor
;
738 StyleSettings::SetLightBorderColor( const Color
& rColor
)
741 mxData
->maLightBorderColor
= rColor
;
745 StyleSettings::GetLightBorderColor() const
747 return mxData
->maLightBorderColor
;
751 StyleSettings::SetShadowColor( const Color
& rColor
)
754 mxData
->maShadowColor
= rColor
;
758 StyleSettings::GetShadowColor() const
760 return mxData
->maShadowColor
;
764 StyleSettings::SetDarkShadowColor( const Color
& rColor
)
767 mxData
->maDarkShadowColor
= rColor
;
771 StyleSettings::GetDarkShadowColor() const
773 return mxData
->maDarkShadowColor
;
777 StyleSettings::SetButtonTextColor( const Color
& rColor
)
780 mxData
->maButtonTextColor
= rColor
;
784 StyleSettings::GetButtonTextColor() const
786 return mxData
->maButtonTextColor
;
790 StyleSettings::SetDefaultActionButtonTextColor( const Color
& rColor
)
793 mxData
->maDefaultActionButtonTextColor
= rColor
;
797 StyleSettings::GetDefaultActionButtonTextColor() const
799 return mxData
->maDefaultActionButtonTextColor
;
803 StyleSettings::SetActionButtonTextColor( const Color
& rColor
)
806 mxData
->maActionButtonTextColor
= rColor
;
810 StyleSettings::GetActionButtonTextColor() const
812 return mxData
->maActionButtonTextColor
;
816 StyleSettings::SetActionButtonRolloverTextColor( const Color
& rColor
)
819 mxData
->maActionButtonRolloverTextColor
= rColor
;
823 StyleSettings::GetActionButtonRolloverTextColor() const
825 return mxData
->maActionButtonRolloverTextColor
;
829 StyleSettings::SetButtonRolloverTextColor( const Color
& rColor
)
832 mxData
->maButtonRolloverTextColor
= rColor
;
836 StyleSettings::GetButtonRolloverTextColor() const
838 return mxData
->maButtonRolloverTextColor
;
842 StyleSettings::SetButtonPressedRolloverTextColor( const Color
& rColor
)
845 mxData
->maButtonPressedRolloverTextColor
= rColor
;
849 StyleSettings::GetButtonPressedRolloverTextColor() const
851 return mxData
->maButtonPressedRolloverTextColor
;
855 StyleSettings::SetRadioCheckTextColor( const Color
& rColor
)
858 mxData
->maRadioCheckTextColor
= rColor
;
862 StyleSettings::GetRadioCheckTextColor() const
864 return mxData
->maRadioCheckTextColor
;
868 StyleSettings::SetGroupTextColor( const Color
& rColor
)
871 mxData
->maGroupTextColor
= rColor
;
875 StyleSettings::GetGroupTextColor() const
877 return mxData
->maGroupTextColor
;
881 StyleSettings::SetLabelTextColor( const Color
& rColor
)
884 mxData
->maLabelTextColor
= rColor
;
888 StyleSettings::GetLabelTextColor() const
890 return mxData
->maLabelTextColor
;
894 StyleSettings::SetWindowColor( const Color
& rColor
)
897 mxData
->maWindowColor
= rColor
;
901 StyleSettings::GetWindowColor() const
903 return mxData
->maWindowColor
;
907 StyleSettings::SetWindowTextColor( const Color
& rColor
)
910 mxData
->maWindowTextColor
= rColor
;
914 StyleSettings::GetWindowTextColor() const
916 return mxData
->maWindowTextColor
;
920 StyleSettings::SetDialogColor( const Color
& rColor
)
923 mxData
->maDialogColor
= rColor
;
927 StyleSettings::GetDialogColor() const
929 return mxData
->maDialogColor
;
933 StyleSettings::SetDialogTextColor( const Color
& rColor
)
936 mxData
->maDialogTextColor
= rColor
;
940 StyleSettings::GetDialogTextColor() const
942 return mxData
->maDialogTextColor
;
946 StyleSettings::SetWorkspaceColor( const Color
& rColor
)
949 mxData
->maWorkspaceColor
= rColor
;
953 StyleSettings::GetWorkspaceColor() const
955 return mxData
->maWorkspaceColor
;
959 StyleSettings::SetFieldColor( const Color
& rColor
)
962 mxData
->maFieldColor
= rColor
;
966 StyleSettings::GetFieldColor() const
968 return mxData
->maFieldColor
;
972 StyleSettings::SetFieldTextColor( const Color
& rColor
)
975 mxData
->maFieldTextColor
= rColor
;
979 StyleSettings::GetFieldTextColor() const
981 return mxData
->maFieldTextColor
;
985 StyleSettings::SetFieldRolloverTextColor( const Color
& rColor
)
988 mxData
->maFieldRolloverTextColor
= rColor
;
992 StyleSettings::GetFieldRolloverTextColor() const
994 return mxData
->maFieldRolloverTextColor
;
998 StyleSettings::SetActiveColor( const Color
& rColor
)
1001 mxData
->maActiveColor
= rColor
;
1005 StyleSettings::GetActiveColor() const
1007 return mxData
->maActiveColor
;
1011 StyleSettings::SetActiveTextColor( const Color
& rColor
)
1014 mxData
->maActiveTextColor
= rColor
;
1018 StyleSettings::GetActiveTextColor() const
1020 return mxData
->maActiveTextColor
;
1024 StyleSettings::SetActiveBorderColor( const Color
& rColor
)
1027 mxData
->maActiveBorderColor
= rColor
;
1031 StyleSettings::GetActiveBorderColor() const
1033 return mxData
->maActiveBorderColor
;
1037 StyleSettings::SetDeactiveColor( const Color
& rColor
)
1040 mxData
->maDeactiveColor
= rColor
;
1044 StyleSettings::GetDeactiveColor() const
1046 return mxData
->maDeactiveColor
;
1050 StyleSettings::SetDeactiveTextColor( const Color
& rColor
)
1053 mxData
->maDeactiveTextColor
= rColor
;
1057 StyleSettings::GetDeactiveTextColor() const
1059 return mxData
->maDeactiveTextColor
;
1063 StyleSettings::SetDeactiveBorderColor( const Color
& rColor
)
1066 mxData
->maDeactiveBorderColor
= rColor
;
1070 StyleSettings::GetDeactiveBorderColor() const
1072 return mxData
->maDeactiveBorderColor
;
1076 StyleSettings::SetHighlightColor( const Color
& rColor
)
1079 mxData
->maHighlightColor
= rColor
;
1083 StyleSettings::GetHighlightColor() const
1085 return mxData
->maHighlightColor
;
1089 StyleSettings::SetHighlightTextColor( const Color
& rColor
)
1092 mxData
->maHighlightTextColor
= rColor
;
1096 StyleSettings::GetHighlightTextColor() const
1098 return mxData
->maHighlightTextColor
;
1102 StyleSettings::SetDisableColor( const Color
& rColor
)
1105 mxData
->maDisableColor
= rColor
;
1109 StyleSettings::GetDisableColor() const
1111 return mxData
->maDisableColor
;
1115 StyleSettings::SetHelpColor( const Color
& rColor
)
1118 mxData
->maHelpColor
= rColor
;
1122 StyleSettings::GetHelpColor() const
1124 return mxData
->maHelpColor
;
1128 StyleSettings::SetHelpTextColor( const Color
& rColor
)
1131 mxData
->maHelpTextColor
= rColor
;
1135 StyleSettings::GetHelpTextColor() const
1137 return mxData
->maHelpTextColor
;
1141 StyleSettings::SetMenuColor( const Color
& rColor
)
1144 mxData
->maMenuColor
= rColor
;
1148 StyleSettings::GetMenuColor() const
1150 return mxData
->maMenuColor
;
1154 StyleSettings::SetMenuBarColor( const Color
& rColor
)
1157 mxData
->maMenuBarColor
= rColor
;
1161 StyleSettings::GetMenuBarColor() const
1163 return mxData
->maMenuBarColor
;
1167 StyleSettings::SetMenuBarRolloverColor( const Color
& rColor
)
1170 mxData
->maMenuBarRolloverColor
= rColor
;
1174 StyleSettings::GetMenuBarRolloverColor() const
1176 return mxData
->maMenuBarRolloverColor
;
1180 StyleSettings::SetMenuBorderColor( const Color
& rColor
)
1183 mxData
->maMenuBorderColor
= rColor
;
1187 StyleSettings::GetMenuBorderColor() const
1189 return mxData
->maMenuBorderColor
;
1193 StyleSettings::SetMenuTextColor( const Color
& rColor
)
1196 mxData
->maMenuTextColor
= rColor
;
1200 StyleSettings::GetMenuTextColor() const
1202 return mxData
->maMenuTextColor
;
1206 StyleSettings::SetMenuBarTextColor( const Color
& rColor
)
1209 mxData
->maMenuBarTextColor
= rColor
;
1213 StyleSettings::GetMenuBarTextColor() const
1215 return mxData
->maMenuBarTextColor
;
1219 StyleSettings::SetMenuBarRolloverTextColor( const Color
& rColor
)
1222 mxData
->maMenuBarRolloverTextColor
= rColor
;
1226 StyleSettings::GetMenuBarRolloverTextColor() const
1228 return mxData
->maMenuBarRolloverTextColor
;
1232 StyleSettings::SetMenuBarHighlightTextColor( const Color
& rColor
)
1235 mxData
->maMenuBarHighlightTextColor
= rColor
;
1239 StyleSettings::GetMenuBarHighlightTextColor() const
1241 return mxData
->maMenuBarHighlightTextColor
;
1245 StyleSettings::SetMenuHighlightColor( const Color
& rColor
)
1248 mxData
->maMenuHighlightColor
= rColor
;
1252 StyleSettings::GetMenuHighlightColor() const
1254 return mxData
->maMenuHighlightColor
;
1258 StyleSettings::SetMenuHighlightTextColor( const Color
& rColor
)
1261 mxData
->maMenuHighlightTextColor
= rColor
;
1265 StyleSettings::GetMenuHighlightTextColor() const
1267 return mxData
->maMenuHighlightTextColor
;
1271 StyleSettings::SetTabTextColor( const Color
& rColor
)
1274 mxData
->maTabTextColor
= rColor
;
1278 StyleSettings::GetTabTextColor() const
1280 return mxData
->maTabTextColor
;
1284 StyleSettings::SetTabRolloverTextColor( const Color
& rColor
)
1287 mxData
->maTabRolloverTextColor
= rColor
;
1291 StyleSettings::GetTabRolloverTextColor() const
1293 return mxData
->maTabRolloverTextColor
;
1297 StyleSettings::SetTabHighlightTextColor( const Color
& rColor
)
1300 mxData
->maTabHighlightTextColor
= rColor
;
1304 StyleSettings::GetTabHighlightTextColor() const
1306 return mxData
->maTabHighlightTextColor
;
1310 StyleSettings::SetLinkColor( const Color
& rColor
)
1313 mxData
->maLinkColor
= rColor
;
1317 StyleSettings::GetLinkColor() const
1319 return mxData
->maLinkColor
;
1323 StyleSettings::SetVisitedLinkColor( const Color
& rColor
)
1326 mxData
->maVisitedLinkColor
= rColor
;
1330 StyleSettings::GetVisitedLinkColor() const
1332 return mxData
->maVisitedLinkColor
;
1336 StyleSettings::SetToolTextColor( const Color
& rColor
)
1339 mxData
->maToolTextColor
= rColor
;
1343 StyleSettings::GetToolTextColor() const
1345 return mxData
->maToolTextColor
;
1349 StyleSettings::GetHighlightLinkColor() const
1351 return mxData
->maHighlightLinkColor
;
1355 StyleSettings::SetMonoColor( const Color
& rColor
)
1358 mxData
->maMonoColor
= rColor
;
1362 StyleSettings::GetMonoColor() const
1364 return mxData
->maMonoColor
;
1368 StyleSettings::SetActiveTabColor( const Color
& rColor
)
1371 mxData
->maActiveTabColor
= rColor
;
1375 StyleSettings::GetActiveTabColor() const
1377 return mxData
->maActiveTabColor
;
1381 StyleSettings::SetInactiveTabColor( const Color
& rColor
)
1384 mxData
->maInactiveTabColor
= rColor
;
1388 StyleSettings::GetInactiveTabColor() const
1390 return mxData
->maInactiveTabColor
;
1394 StyleSettings::GetAlternatingRowColor() const
1396 return mxData
->maAlternatingRowColor
;
1400 StyleSettings::SetUseSystemUIFonts( bool bUseSystemUIFonts
)
1403 mxData
->mbUseSystemUIFonts
= bUseSystemUIFonts
;
1407 StyleSettings::GetUseSystemUIFonts() const
1409 return mxData
->mbUseSystemUIFonts
;
1412 void StyleSettings::SetUseFontAAFromSystem(bool bUseFontAAFromSystem
)
1415 mxData
->mbUseFontAAFromSystem
= bUseFontAAFromSystem
;
1418 bool StyleSettings::GetUseFontAAFromSystem() const
1420 return mxData
->mbUseFontAAFromSystem
;
1424 StyleSettings::SetUseFlatBorders( bool bUseFlatBorders
)
1427 mxData
->mnUseFlatBorders
= bUseFlatBorders
;
1431 StyleSettings::GetUseFlatBorders() const
1433 return mxData
->mnUseFlatBorders
;
1437 StyleSettings::SetUseFlatMenus( bool bUseFlatMenus
)
1440 mxData
->mnUseFlatMenus
= bUseFlatMenus
;
1444 StyleSettings::GetUseFlatMenus() const
1446 return mxData
->mnUseFlatMenus
;
1450 StyleSettings::SetUseImagesInMenus( TriState eUseImagesInMenus
)
1453 mxData
->meUseImagesInMenus
= eUseImagesInMenus
;
1457 StyleSettings::SetPreferredUseImagesInMenus( bool bPreferredUseImagesInMenus
)
1460 mxData
->mbPreferredUseImagesInMenus
= bPreferredUseImagesInMenus
;
1464 StyleSettings::GetPreferredUseImagesInMenus() const
1466 return mxData
->mbPreferredUseImagesInMenus
;
1470 StyleSettings::SetSkipDisabledInMenus( bool bSkipDisabledInMenus
)
1473 mxData
->mbSkipDisabledInMenus
= bSkipDisabledInMenus
;
1477 StyleSettings::GetSkipDisabledInMenus() const
1479 return mxData
->mbSkipDisabledInMenus
;
1483 StyleSettings::SetHideDisabledMenuItems( bool bHideDisabledMenuItems
)
1486 mxData
->mbHideDisabledMenuItems
= bHideDisabledMenuItems
;
1490 StyleSettings::GetHideDisabledMenuItems() const
1492 return mxData
->mbHideDisabledMenuItems
;
1496 StyleSettings::SetContextMenuShortcuts( TriState eContextMenuShortcuts
)
1499 mxData
->meContextMenuShortcuts
= eContextMenuShortcuts
;
1503 StyleSettings::GetContextMenuShortcuts() const
1505 switch (mxData
->meContextMenuShortcuts
)
1507 case TRISTATE_FALSE
:
1511 default: // TRISTATE_INDET:
1512 return GetPreferredContextMenuShortcuts();
1517 StyleSettings::SetPreferredContextMenuShortcuts( bool bContextMenuShortcuts
)
1520 mxData
->mbPreferredContextMenuShortcuts
= bContextMenuShortcuts
;
1524 StyleSettings::GetPreferredContextMenuShortcuts() const
1526 return mxData
->mbPreferredContextMenuShortcuts
;
1530 StyleSettings::SetPrimaryButtonWarpsSlider( bool bPrimaryButtonWarpsSlider
)
1533 mxData
->mbPrimaryButtonWarpsSlider
= bPrimaryButtonWarpsSlider
;
1537 StyleSettings::GetPrimaryButtonWarpsSlider() const
1539 return mxData
->mbPrimaryButtonWarpsSlider
;
1543 StyleSettings::SetAppFont( const vcl::Font
& rFont
)
1546 mxData
->maAppFont
= rFont
;
1550 StyleSettings::GetAppFont() const
1552 return mxData
->maAppFont
;
1556 StyleSettings::SetHelpFont( const vcl::Font
& rFont
)
1559 mxData
->maHelpFont
= rFont
;
1563 StyleSettings::GetHelpFont() const
1565 return mxData
->maHelpFont
;
1569 StyleSettings::SetTitleFont( const vcl::Font
& rFont
)
1572 mxData
->maTitleFont
= rFont
;
1576 StyleSettings::GetTitleFont() const
1578 return mxData
->maTitleFont
;
1582 StyleSettings::SetFloatTitleFont( const vcl::Font
& rFont
)
1585 mxData
->maFloatTitleFont
= rFont
;
1589 StyleSettings::GetFloatTitleFont() const
1591 return mxData
->maFloatTitleFont
;
1595 StyleSettings::SetMenuFont( const vcl::Font
& rFont
)
1598 mxData
->maMenuFont
= rFont
;
1602 StyleSettings::GetMenuFont() const
1604 return mxData
->maMenuFont
;
1608 StyleSettings::SetToolFont( const vcl::Font
& rFont
)
1611 mxData
->maToolFont
= rFont
;
1615 StyleSettings::GetToolFont() const
1617 return mxData
->maToolFont
;
1621 StyleSettings::SetGroupFont( const vcl::Font
& rFont
)
1624 mxData
->maGroupFont
= rFont
;
1628 StyleSettings::GetGroupFont() const
1630 return mxData
->maGroupFont
;
1634 StyleSettings::SetLabelFont( const vcl::Font
& rFont
)
1637 mxData
->maLabelFont
= rFont
;
1641 StyleSettings::GetLabelFont() const
1643 return mxData
->maLabelFont
;
1647 StyleSettings::SetRadioCheckFont( const vcl::Font
& rFont
)
1650 mxData
->maRadioCheckFont
= rFont
;
1654 StyleSettings::GetRadioCheckFont() const
1656 return mxData
->maRadioCheckFont
;
1660 StyleSettings::SetPushButtonFont( const vcl::Font
& rFont
)
1663 mxData
->maPushButtonFont
= rFont
;
1667 StyleSettings::GetPushButtonFont() const
1669 return mxData
->maPushButtonFont
;
1673 StyleSettings::SetFieldFont( const vcl::Font
& rFont
)
1676 mxData
->maFieldFont
= rFont
;
1680 StyleSettings::GetFieldFont() const
1682 return mxData
->maFieldFont
;
1686 StyleSettings::SetIconFont( const vcl::Font
& rFont
)
1689 mxData
->maIconFont
= rFont
;
1693 StyleSettings::GetIconFont() const
1695 return mxData
->maIconFont
;
1699 StyleSettings::SetTabFont( const vcl::Font
& rFont
)
1702 mxData
->maTabFont
= rFont
;
1706 StyleSettings::GetTabFont() const
1708 return mxData
->maTabFont
;
1712 StyleSettings::GetBorderSize()
1718 StyleSettings::SetTitleHeight( long nSize
)
1721 mxData
->mnTitleHeight
= nSize
;
1725 StyleSettings::GetTitleHeight() const
1727 return mxData
->mnTitleHeight
;
1731 StyleSettings::SetFloatTitleHeight( long nSize
)
1734 mxData
->mnFloatTitleHeight
= nSize
;
1738 StyleSettings::GetFloatTitleHeight() const
1740 return mxData
->mnFloatTitleHeight
;
1744 StyleSettings::SetScrollBarSize( long nSize
)
1747 mxData
->mnScrollBarSize
= nSize
;
1751 StyleSettings::GetScrollBarSize() const
1753 return mxData
->mnScrollBarSize
;
1757 StyleSettings::SetMinThumbSize( long nSize
)
1760 mxData
->mnMinThumbSize
= nSize
;
1764 StyleSettings::GetMinThumbSize() const
1766 return mxData
->mnMinThumbSize
;
1770 StyleSettings::SetSpinSize( long nSize
)
1773 mxData
->mnSpinSize
= nSize
;
1777 StyleSettings::GetSpinSize() const
1779 return mxData
->mnSpinSize
;
1783 StyleSettings::GetSplitSize()
1789 StyleSettings::SetCursorSize( long nSize
)
1792 mxData
->mnCursorSize
= nSize
;
1796 StyleSettings::GetCursorSize() const
1798 return mxData
->mnCursorSize
;
1802 StyleSettings::SetCursorBlinkTime( sal_uInt64 nBlinkTime
)
1805 mxData
->mnCursorBlinkTime
= nBlinkTime
;
1809 StyleSettings::GetCursorBlinkTime() const
1811 return static_cast<long>(mxData
->mnCursorBlinkTime
);
1815 StyleSettings::SetDragFullOptions( DragFullOptions nOptions
)
1818 mxData
->mnDragFullOptions
= nOptions
;
1822 StyleSettings::GetDragFullOptions() const
1824 return mxData
->mnDragFullOptions
;
1828 StyleSettings::SetSelectionOptions( SelectionOptions nOptions
)
1831 mxData
->mnSelectionOptions
= nOptions
;
1835 StyleSettings::GetSelectionOptions() const
1837 return mxData
->mnSelectionOptions
;
1841 StyleSettings::SetDisplayOptions( DisplayOptions nOptions
)
1844 mxData
->mnDisplayOptions
= nOptions
;
1848 StyleSettings::GetDisplayOptions() const
1850 return mxData
->mnDisplayOptions
;
1854 StyleSettings::SetAntialiasingMinPixelHeight( long nMinPixel
)
1857 mxData
->mnAntialiasedMin
= nMinPixel
;
1861 StyleSettings::GetAntialiasingMinPixelHeight() const
1863 return mxData
->mnAntialiasedMin
;
1867 StyleSettings::SetOptions( StyleSettingsOptions nOptions
)
1870 mxData
->mnOptions
= nOptions
;
1874 StyleSettings::SetAutoMnemonic( bool bAutoMnemonic
)
1877 mxData
->mbAutoMnemonic
= bAutoMnemonic
;
1881 StyleSettings::GetAutoMnemonic() const
1883 return mxData
->mbAutoMnemonic
;
1887 StyleSettings::GetDockingFloatsSupported()
1889 ImplSVData
* pSVData
= ImplGetSVData();
1890 return pSVData
->maNWFData
.mbCanDetermineWindowPosition
;
1894 StyleSettings::SetFontColor( const Color
& rColor
)
1897 mxData
->maFontColor
= rColor
;
1901 StyleSettings::GetFontColor() const
1903 return mxData
->maFontColor
;
1907 StyleSettings::SetToolbarIconSize( ToolbarIconSize nSize
)
1910 mxData
->mnToolbarIconSize
= nSize
;
1914 StyleSettings::GetToolbarIconSize() const
1916 return mxData
->mnToolbarIconSize
;
1920 StyleSettings::GetDialogStyle() const
1922 return mxData
->maDialogStyle
;
1926 StyleSettings::SetEdgeBlending(sal_uInt16 nCount
)
1929 mxData
->mnEdgeBlending
= nCount
;
1933 StyleSettings::GetEdgeBlending() const
1935 return mxData
->mnEdgeBlending
;
1939 StyleSettings::GetEdgeBlendingTopLeftColor() const
1941 return mxData
->maEdgeBlendingTopLeftColor
;
1945 StyleSettings::GetEdgeBlendingBottomRightColor() const
1947 return mxData
->maEdgeBlendingBottomRightColor
;
1951 StyleSettings::SetListBoxMaximumLineCount(sal_uInt16 nCount
)
1954 mxData
->mnListBoxMaximumLineCount
= nCount
;
1958 StyleSettings::GetListBoxMaximumLineCount() const
1960 return mxData
->mnListBoxMaximumLineCount
;
1964 StyleSettings::SetColorValueSetColumnCount(sal_uInt16 nCount
)
1967 mxData
->mnColorValueSetColumnCount
= nCount
;
1971 StyleSettings::GetColorValueSetColumnCount() const
1973 return mxData
->mnColorValueSetColumnCount
;
1977 StyleSettings::GetColorValueSetMaximumRowCount()
1983 StyleSettings::GetListBoxPreviewDefaultLineWidth()
1989 StyleSettings::SetPreviewUsesCheckeredBackground(bool bNew
)
1992 mxData
->mbPreviewUsesCheckeredBackground
= bNew
;
1996 StyleSettings::GetPreviewUsesCheckeredBackground() const
1998 return mxData
->mbPreviewUsesCheckeredBackground
;
2002 StyleSettings::operator !=( const StyleSettings
& rSet
) const
2004 return !(*this == rSet
);
2007 void StyleSettings::SetListBoxPreviewDefaultLogicSize(Size
const& rSize
)
2009 mxData
->maListBoxPreviewDefaultLogicSize
= rSize
;
2012 const Size
& StyleSettings::GetListBoxPreviewDefaultPixelSize() const
2014 if(0 == mxData
->maListBoxPreviewDefaultPixelSize
.Width() || 0 == mxData
->maListBoxPreviewDefaultPixelSize
.Height())
2016 const_cast< StyleSettings
* >(this)->mxData
->maListBoxPreviewDefaultPixelSize
=
2017 Application::GetDefaultDevice()->LogicToPixel(mxData
->maListBoxPreviewDefaultLogicSize
, MapMode(MapUnit::MapAppFont
));
2020 return mxData
->maListBoxPreviewDefaultPixelSize
;
2023 void StyleSettings::Set3DColors( const Color
& rColor
)
2026 mxData
->maFaceColor
= rColor
;
2027 mxData
->maLightBorderColor
= rColor
;
2028 mxData
->maMenuBorderColor
= rColor
;
2029 mxData
->maDarkShadowColor
= COL_BLACK
;
2030 if ( rColor
!= COL_LIGHTGRAY
)
2032 mxData
->maLightColor
= rColor
;
2033 mxData
->maShadowColor
= rColor
;
2034 mxData
->maDarkShadowColor
=rColor
;
2035 mxData
->maLightColor
.IncreaseLuminance( 64 );
2036 mxData
->maShadowColor
.DecreaseLuminance( 64 );
2037 mxData
->maDarkShadowColor
.DecreaseLuminance( 100 );
2038 sal_uLong nRed
= mxData
->maLightColor
.GetRed();
2039 sal_uLong nGreen
= mxData
->maLightColor
.GetGreen();
2040 sal_uLong nBlue
= mxData
->maLightColor
.GetBlue();
2041 nRed
+= static_cast<sal_uLong
>(mxData
->maShadowColor
.GetRed());
2042 nGreen
+= static_cast<sal_uLong
>(mxData
->maShadowColor
.GetGreen());
2043 nBlue
+= static_cast<sal_uLong
>(mxData
->maShadowColor
.GetBlue());
2044 mxData
->maCheckedColor
= Color( static_cast<sal_uInt8
>(nRed
/2), static_cast<sal_uInt8
>(nGreen
/2), static_cast<sal_uInt8
>(nBlue
/2) );
2048 mxData
->maCheckedColor
= Color( 0x99, 0x99, 0x99 );
2049 mxData
->maLightColor
= COL_WHITE
;
2050 mxData
->maShadowColor
= COL_GRAY
;
2054 void StyleSettings::SetCheckedColorSpecialCase( )
2057 // Light gray checked color special case
2058 if ( GetFaceColor() == COL_LIGHTGRAY
)
2059 mxData
->maCheckedColor
= Color( 0xCC, 0xCC, 0xCC );
2062 sal_uInt8 nRed
= static_cast<sal_uInt8
>((static_cast<sal_uInt16
>(mxData
->maFaceColor
.GetRed()) + static_cast<sal_uInt16
>(mxData
->maLightColor
.GetRed()))/2);
2063 sal_uInt8 nGreen
= static_cast<sal_uInt8
>((static_cast<sal_uInt16
>(mxData
->maFaceColor
.GetGreen()) + static_cast<sal_uInt16
>(mxData
->maLightColor
.GetGreen()))/2);
2064 sal_uInt8 nBlue
= static_cast<sal_uInt8
>((static_cast<sal_uInt16
>(mxData
->maFaceColor
.GetBlue()) + static_cast<sal_uInt16
>(mxData
->maLightColor
.GetBlue()))/2);
2065 mxData
->maCheckedColor
= Color( nRed
, nGreen
, nBlue
);
2069 bool StyleSettings::GetUseImagesInMenus() const
2071 // icon mode selected in Tools -> Options... -> OpenOffice.org -> View
2072 switch (mxData
->meUseImagesInMenus
) {
2073 case TRISTATE_FALSE
:
2077 default: // TRISTATE_INDET:
2078 return GetPreferredUseImagesInMenus();
2082 static BitmapEx
readBitmapEx( const OUString
& rPath
)
2084 OUString
aPath( rPath
);
2085 rtl::Bootstrap::expandMacros( aPath
);
2089 if ( GraphicFilter::LoadGraphic( aPath
, OUString(), aGraphic
) != ERRCODE_NONE
)
2091 return aGraphic
.GetBitmapEx();
2094 enum WhichPersona
{ PERSONA_HEADER
, PERSONA_FOOTER
};
2096 /** Update the setting of the Persona header / footer in ImplStyleData */
2097 static void setupPersonaHeaderFooter( WhichPersona eWhich
, OUString
& rHeaderFooter
, BitmapEx
& rHeaderFooterBitmap
, boost::optional
<Color
>& rMenuBarTextColor
)
2099 uno::Reference
< uno::XComponentContext
> xContext( comphelper::getProcessComponentContext() );
2100 if ( !xContext
.is() )
2103 // don't burn time loading images we don't need.
2104 if ( Application::IsHeadlessModeEnabled() )
2107 // read from the configuration
2108 OUString
aPersona( officecfg::Office::Common::Misc::Persona::get( xContext
) );
2109 OUString
aPersonaSettings( officecfg::Office::Common::Misc::PersonaSettings::get( xContext
) );
2111 // have the settings changed? marks if header /footer prepared before
2112 //should maybe extended to a flag that marks if header /footer /both are loaded
2113 OUString aOldValue
= eWhich
==PERSONA_HEADER
?OUString(aPersona
+ ";" + aPersonaSettings
+";h" ):OUString(aPersona
+ ";" + aPersonaSettings
+";f" );
2114 if ( rHeaderFooter
== aOldValue
)
2117 rHeaderFooter
= aOldValue
;
2118 rHeaderFooterBitmap
= BitmapEx();
2119 rMenuBarTextColor
.reset();
2121 // now read the new values and setup bitmaps
2122 OUString aHeader
, aFooter
;
2123 if ( aPersona
== "own" || aPersona
== "default" )
2125 sal_Int32 nIndex
= 0;
2127 // Skip the persona slug, name, and preview
2128 aHeader
= aPersonaSettings
.getToken( 3, ';', nIndex
);
2131 aFooter
= aPersonaSettings
.getToken( 0, ';', nIndex
);
2133 // change menu text color, advance nIndex to skip the '#'
2136 OUString aColor
= aPersonaSettings
.getToken( 0, ';', ++nIndex
);
2137 rMenuBarTextColor
= Color( aColor
.toUInt32( 16 ) );
2143 case PERSONA_HEADER
: aName
= aHeader
; break;
2144 case PERSONA_FOOTER
: aName
= aFooter
; break;
2147 if ( !aName
.isEmpty() )
2149 OUString
gallery("");
2150 // try the gallery first, then the program path:
2151 if ( aPersona
== "own" && !aPersonaSettings
.startsWith( "vnd.sun.star.expand" ) )
2153 gallery
= "${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER
"/" SAL_CONFIGFILE( "bootstrap") "::UserInstallation}";
2154 rtl::Bootstrap::expandMacros( gallery
);
2155 gallery
+= "/user/gallery/personas/";
2157 else if ( aPersona
== "default" )
2159 gallery
= "$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER
"/gallery/personas/";
2161 rHeaderFooterBitmap
= readBitmapEx( gallery
+ aName
);
2163 if ( rHeaderFooterBitmap
.IsEmpty() )
2164 rHeaderFooterBitmap
= readBitmapEx( "$BRAND_BASE_DIR/" LIBO_ETC_FOLDER
"/" + aName
);
2167 // Something went wrong. Probably, the images are missing. Clear the persona properties in the registry.
2169 if( rHeaderFooterBitmap
.IsEmpty() )
2171 std::shared_ptr
<comphelper::ConfigurationChanges
> batch(comphelper::ConfigurationChanges::create());
2172 officecfg::Office::Common::Misc::Persona::set( "no", batch
);
2173 officecfg::Office::Common::Misc::PersonaSettings::set( "", batch
);
2178 BitmapEx
const & StyleSettings::GetPersonaHeader() const
2180 setupPersonaHeaderFooter( PERSONA_HEADER
, mxData
->maPersonaHeaderFooter
, mxData
->maPersonaHeaderBitmap
, mxData
->maPersonaMenuBarTextColor
);
2181 return mxData
->maPersonaHeaderBitmap
;
2184 BitmapEx
const & StyleSettings::GetPersonaFooter() const
2186 setupPersonaHeaderFooter( PERSONA_FOOTER
, mxData
->maPersonaHeaderFooter
, mxData
->maPersonaFooterBitmap
, mxData
->maPersonaMenuBarTextColor
);
2187 return mxData
->maPersonaFooterBitmap
;
2190 const boost::optional
<Color
>& StyleSettings::GetPersonaMenuBarTextColor() const
2193 return mxData
->maPersonaMenuBarTextColor
;
2196 void StyleSettings::SetStandardStyles()
2199 mxData
->SetStandardStyles();
2202 Color
StyleSettings::GetFaceGradientColor() const
2204 // compute a brighter face color that can be used in gradients
2205 // for a convex look (eg toolbars)
2208 GetFaceColor().RGBtoHSB( h
, s
, b
);
2211 return Color::HSBtoRGB( h
, s
, b
);
2214 Color
StyleSettings::GetSeparatorColor() const
2216 // compute a brighter shadow color for separators (used in toolbars or between menubar and toolbars on Windows XP)
2218 GetShadowColor().RGBtoHSB( h
, s
, b
);
2221 return Color::HSBtoRGB( h
, s
, b
);
2224 void StyleSettings::CopyData()
2226 // copy if other references exist
2227 if (mxData
.use_count() > 1)
2229 mxData
= std::make_shared
<ImplStyleData
>(*mxData
);
2233 bool StyleSettings::operator ==( const StyleSettings
& rSet
) const
2235 if ( mxData
== rSet
.mxData
)
2238 if (mxData
->mIconTheme
!= rSet
.mxData
->mIconTheme
) {
2242 if (*mxData
->mIconThemeSelector
!= *rSet
.mxData
->mIconThemeSelector
) {
2246 return (mxData
->mnOptions
== rSet
.mxData
->mnOptions
) &&
2247 (mxData
->mbAutoMnemonic
== rSet
.mxData
->mbAutoMnemonic
) &&
2248 (mxData
->mnDragFullOptions
== rSet
.mxData
->mnDragFullOptions
) &&
2249 (mxData
->mnSelectionOptions
== rSet
.mxData
->mnSelectionOptions
) &&
2250 (mxData
->mnDisplayOptions
== rSet
.mxData
->mnDisplayOptions
) &&
2251 (mxData
->mnCursorSize
== rSet
.mxData
->mnCursorSize
) &&
2252 (mxData
->mnCursorBlinkTime
== rSet
.mxData
->mnCursorBlinkTime
) &&
2253 (mxData
->mnTitleHeight
== rSet
.mxData
->mnTitleHeight
) &&
2254 (mxData
->mnFloatTitleHeight
== rSet
.mxData
->mnFloatTitleHeight
) &&
2255 (mxData
->mnScrollBarSize
== rSet
.mxData
->mnScrollBarSize
) &&
2256 (mxData
->mnMinThumbSize
== rSet
.mxData
->mnMinThumbSize
) &&
2257 (mxData
->mnSpinSize
== rSet
.mxData
->mnSpinSize
) &&
2258 (mxData
->mnAntialiasedMin
== rSet
.mxData
->mnAntialiasedMin
) &&
2259 (mxData
->mbHighContrast
== rSet
.mxData
->mbHighContrast
) &&
2260 (mxData
->mbUseSystemUIFonts
== rSet
.mxData
->mbUseSystemUIFonts
) &&
2261 (mxData
->mbUseFontAAFromSystem
== rSet
.mxData
->mbUseFontAAFromSystem
) &&
2262 (mxData
->mnUseFlatBorders
== rSet
.mxData
->mnUseFlatBorders
) &&
2263 (mxData
->mnUseFlatMenus
== rSet
.mxData
->mnUseFlatMenus
) &&
2264 (mxData
->maFaceColor
== rSet
.mxData
->maFaceColor
) &&
2265 (mxData
->maCheckedColor
== rSet
.mxData
->maCheckedColor
) &&
2266 (mxData
->maLightColor
== rSet
.mxData
->maLightColor
) &&
2267 (mxData
->maLightBorderColor
== rSet
.mxData
->maLightBorderColor
) &&
2268 (mxData
->maShadowColor
== rSet
.mxData
->maShadowColor
) &&
2269 (mxData
->maDarkShadowColor
== rSet
.mxData
->maDarkShadowColor
) &&
2270 (mxData
->maButtonTextColor
== rSet
.mxData
->maButtonTextColor
) &&
2271 (mxData
->maDefaultActionButtonTextColor
== rSet
.mxData
->maDefaultActionButtonTextColor
) &&
2272 (mxData
->maActionButtonTextColor
== rSet
.mxData
->maActionButtonTextColor
) &&
2273 (mxData
->maButtonRolloverTextColor
== rSet
.mxData
->maButtonRolloverTextColor
) &&
2274 (mxData
->maActionButtonRolloverTextColor
== rSet
.mxData
->maActionButtonRolloverTextColor
) &&
2275 (mxData
->maRadioCheckTextColor
== rSet
.mxData
->maRadioCheckTextColor
) &&
2276 (mxData
->maGroupTextColor
== rSet
.mxData
->maGroupTextColor
) &&
2277 (mxData
->maLabelTextColor
== rSet
.mxData
->maLabelTextColor
) &&
2278 (mxData
->maWindowColor
== rSet
.mxData
->maWindowColor
) &&
2279 (mxData
->maWindowTextColor
== rSet
.mxData
->maWindowTextColor
) &&
2280 (mxData
->maDialogColor
== rSet
.mxData
->maDialogColor
) &&
2281 (mxData
->maDialogTextColor
== rSet
.mxData
->maDialogTextColor
) &&
2282 (mxData
->maWorkspaceColor
== rSet
.mxData
->maWorkspaceColor
) &&
2283 (mxData
->maMonoColor
== rSet
.mxData
->maMonoColor
) &&
2284 (mxData
->maFieldColor
== rSet
.mxData
->maFieldColor
) &&
2285 (mxData
->maFieldTextColor
== rSet
.mxData
->maFieldTextColor
) &&
2286 (mxData
->maActiveColor
== rSet
.mxData
->maActiveColor
) &&
2287 (mxData
->maActiveTextColor
== rSet
.mxData
->maActiveTextColor
) &&
2288 (mxData
->maActiveBorderColor
== rSet
.mxData
->maActiveBorderColor
) &&
2289 (mxData
->maDeactiveColor
== rSet
.mxData
->maDeactiveColor
) &&
2290 (mxData
->maDeactiveTextColor
== rSet
.mxData
->maDeactiveTextColor
) &&
2291 (mxData
->maDeactiveBorderColor
== rSet
.mxData
->maDeactiveBorderColor
) &&
2292 (mxData
->maMenuColor
== rSet
.mxData
->maMenuColor
) &&
2293 (mxData
->maMenuBarColor
== rSet
.mxData
->maMenuBarColor
) &&
2294 (mxData
->maMenuBarRolloverColor
== rSet
.mxData
->maMenuBarRolloverColor
) &&
2295 (mxData
->maMenuBorderColor
== rSet
.mxData
->maMenuBorderColor
) &&
2296 (mxData
->maMenuTextColor
== rSet
.mxData
->maMenuTextColor
) &&
2297 (mxData
->maMenuBarTextColor
== rSet
.mxData
->maMenuBarTextColor
) &&
2298 (mxData
->maMenuBarRolloverTextColor
== rSet
.mxData
->maMenuBarRolloverTextColor
) &&
2299 (mxData
->maMenuHighlightColor
== rSet
.mxData
->maMenuHighlightColor
) &&
2300 (mxData
->maMenuHighlightTextColor
== rSet
.mxData
->maMenuHighlightTextColor
) &&
2301 (mxData
->maHighlightColor
== rSet
.mxData
->maHighlightColor
) &&
2302 (mxData
->maHighlightTextColor
== rSet
.mxData
->maHighlightTextColor
) &&
2303 (mxData
->maTabTextColor
== rSet
.mxData
->maTabTextColor
) &&
2304 (mxData
->maTabRolloverTextColor
== rSet
.mxData
->maTabRolloverTextColor
) &&
2305 (mxData
->maTabHighlightTextColor
== rSet
.mxData
->maTabHighlightTextColor
) &&
2306 (mxData
->maActiveTabColor
== rSet
.mxData
->maActiveTabColor
) &&
2307 (mxData
->maInactiveTabColor
== rSet
.mxData
->maInactiveTabColor
) &&
2308 (mxData
->maDisableColor
== rSet
.mxData
->maDisableColor
) &&
2309 (mxData
->maHelpColor
== rSet
.mxData
->maHelpColor
) &&
2310 (mxData
->maHelpTextColor
== rSet
.mxData
->maHelpTextColor
) &&
2311 (mxData
->maLinkColor
== rSet
.mxData
->maLinkColor
) &&
2312 (mxData
->maVisitedLinkColor
== rSet
.mxData
->maVisitedLinkColor
) &&
2313 (mxData
->maToolTextColor
== rSet
.mxData
->maToolTextColor
) &&
2314 (mxData
->maHighlightLinkColor
== rSet
.mxData
->maHighlightLinkColor
) &&
2315 (mxData
->maAppFont
== rSet
.mxData
->maAppFont
) &&
2316 (mxData
->maHelpFont
== rSet
.mxData
->maHelpFont
) &&
2317 (mxData
->maTitleFont
== rSet
.mxData
->maTitleFont
) &&
2318 (mxData
->maFloatTitleFont
== rSet
.mxData
->maFloatTitleFont
) &&
2319 (mxData
->maMenuFont
== rSet
.mxData
->maMenuFont
) &&
2320 (mxData
->maToolFont
== rSet
.mxData
->maToolFont
) &&
2321 (mxData
->maGroupFont
== rSet
.mxData
->maGroupFont
) &&
2322 (mxData
->maLabelFont
== rSet
.mxData
->maLabelFont
) &&
2323 (mxData
->maRadioCheckFont
== rSet
.mxData
->maRadioCheckFont
) &&
2324 (mxData
->maPushButtonFont
== rSet
.mxData
->maPushButtonFont
) &&
2325 (mxData
->maFieldFont
== rSet
.mxData
->maFieldFont
) &&
2326 (mxData
->maIconFont
== rSet
.mxData
->maIconFont
) &&
2327 (mxData
->maTabFont
== rSet
.mxData
->maTabFont
) &&
2328 (mxData
->meUseImagesInMenus
== rSet
.mxData
->meUseImagesInMenus
) &&
2329 (mxData
->mbPreferredUseImagesInMenus
== rSet
.mxData
->mbPreferredUseImagesInMenus
) &&
2330 (mxData
->mbSkipDisabledInMenus
== rSet
.mxData
->mbSkipDisabledInMenus
) &&
2331 (mxData
->mbHideDisabledMenuItems
== rSet
.mxData
->mbHideDisabledMenuItems
) &&
2332 (mxData
->mbPreferredContextMenuShortcuts
== rSet
.mxData
->mbPreferredContextMenuShortcuts
)&&
2333 (mxData
->meContextMenuShortcuts
== rSet
.mxData
->meContextMenuShortcuts
) &&
2334 (mxData
->mbPrimaryButtonWarpsSlider
== rSet
.mxData
->mbPrimaryButtonWarpsSlider
) &&
2335 (mxData
->maFontColor
== rSet
.mxData
->maFontColor
) &&
2336 (mxData
->mnEdgeBlending
== rSet
.mxData
->mnEdgeBlending
) &&
2337 (mxData
->maEdgeBlendingTopLeftColor
== rSet
.mxData
->maEdgeBlendingTopLeftColor
) &&
2338 (mxData
->maEdgeBlendingBottomRightColor
== rSet
.mxData
->maEdgeBlendingBottomRightColor
) &&
2339 (mxData
->mnListBoxMaximumLineCount
== rSet
.mxData
->mnListBoxMaximumLineCount
) &&
2340 (mxData
->mnColorValueSetColumnCount
== rSet
.mxData
->mnColorValueSetColumnCount
) &&
2341 (mxData
->maListBoxPreviewDefaultLogicSize
== rSet
.mxData
->maListBoxPreviewDefaultLogicSize
) &&
2342 (mxData
->maListBoxPreviewDefaultPixelSize
== rSet
.mxData
->maListBoxPreviewDefaultPixelSize
) &&
2343 (mxData
->mbPreviewUsesCheckeredBackground
== rSet
.mxData
->mbPreviewUsesCheckeredBackground
);
2346 ImplMiscData::ImplMiscData() :
2347 mnEnableATT(TRISTATE_INDET
),
2348 mnDisablePrinting(TRISTATE_INDET
)
2350 static const char* pEnv
= getenv("SAL_DECIMALSEP_ENABLED" ); // set default without UI
2351 mbEnableLocalizedDecimalSep
= (pEnv
!= nullptr);
2354 MiscSettings::MiscSettings()
2355 : mxData(std::make_shared
<ImplMiscData
>())
2359 bool MiscSettings::operator ==( const MiscSettings
& rSet
) const
2361 if ( mxData
== rSet
.mxData
)
2364 return (mxData
->mnEnableATT
== rSet
.mxData
->mnEnableATT
) &&
2365 (mxData
->mnDisablePrinting
== rSet
.mxData
->mnDisablePrinting
) &&
2366 (mxData
->mbEnableLocalizedDecimalSep
== rSet
.mxData
->mbEnableLocalizedDecimalSep
);
2370 MiscSettings::operator !=( const MiscSettings
& rSet
) const
2372 return !(*this == rSet
);
2375 bool MiscSettings::GetDisablePrinting() const
2377 if( mxData
->mnDisablePrinting
== TRISTATE_INDET
)
2380 vcl::SettingsConfigItem::get()->
2381 getValue( "DesktopManagement",
2382 "DisablePrinting" );
2383 mxData
->mnDisablePrinting
= aEnable
.equalsIgnoreAsciiCase("true") ? TRISTATE_TRUE
: TRISTATE_FALSE
;
2386 return mxData
->mnDisablePrinting
!= TRISTATE_FALSE
;
2389 bool MiscSettings::GetEnableATToolSupport() const
2393 if( mxData
->mnEnableATT
== TRISTATE_INDET
)
2395 // Check in the Windows registry if an AT tool wants Accessibility support to
2399 if( ERROR_SUCCESS
== RegOpenKeyW(HKEY_CURRENT_USER
,
2400 L
"Software\\LibreOffice\\Accessibility\\AtToolSupport",
2404 wchar_t Data
[6]; // possible values: "true", "false", "1", "0", DWORD
2405 DWORD cbData
= sizeof(Data
);
2407 if( ERROR_SUCCESS
== RegQueryValueExW(hkey
, L
"SupportAssistiveTechnology",
2408 nullptr, &dwType
, reinterpret_cast<LPBYTE
>(Data
), &cbData
) )
2413 mxData
->mnEnableATT
= ((0 == wcsicmp(Data
, L
"1")) || (0 == wcsicmp(Data
, L
"true"))) ? TRISTATE_TRUE
: TRISTATE_FALSE
;
2416 switch (reinterpret_cast<DWORD
*>(Data
)[0]) {
2418 mxData
->mnEnableATT
= TRISTATE_FALSE
;
2421 mxData
->mnEnableATT
= TRISTATE_TRUE
;
2424 mxData
->mnEnableATT
= TRISTATE_INDET
;
2425 //TODO: or TRISTATE_TRUE?
2430 // Unsupported registry type
2440 if( mxData
->mnEnableATT
== TRISTATE_INDET
)
2442 static const char* pEnv
= getenv("SAL_ACCESSIBILITY_ENABLED" );
2443 if( !pEnv
|| !*pEnv
)
2446 vcl::SettingsConfigItem::get()->
2447 getValue( "Accessibility",
2448 "EnableATToolSupport" );
2449 mxData
->mnEnableATT
= aEnable
.equalsIgnoreAsciiCase("true") ? TRISTATE_TRUE
: TRISTATE_FALSE
;
2453 mxData
->mnEnableATT
= TRISTATE_TRUE
;
2457 return mxData
->mnEnableATT
!= TRISTATE_FALSE
;
2461 void MiscSettings::SetEnableATToolSupport( bool bEnable
)
2463 if ( (bEnable
? TRISTATE_TRUE
: TRISTATE_FALSE
) != mxData
->mnEnableATT
)
2465 if( bEnable
&& !ImplInitAccessBridge() )
2470 // If the accessibility key in the Windows registry exists, change it synchronously
2471 if( ERROR_SUCCESS
== RegOpenKeyW(HKEY_CURRENT_USER
,
2472 L
"Software\\LibreOffice\\Accessibility\\AtToolSupport",
2476 wchar_t Data
[6]; // possible values: "true", "false", 1, 0
2477 DWORD cbData
= sizeof(Data
);
2479 if( ERROR_SUCCESS
== RegQueryValueExW(hkey
, L
"SupportAssistiveTechnology",
2480 nullptr, &dwType
, reinterpret_cast<LPBYTE
>(Data
), &cbData
) )
2485 RegSetValueExW(hkey
, L
"SupportAssistiveTechnology",
2487 reinterpret_cast<const BYTE
*>(bEnable
? L
"true" : L
"false"),
2488 bEnable
? sizeof(L
"true") : sizeof(L
"false"));
2491 reinterpret_cast<DWORD
*>(Data
)[0] = bEnable
? 1 : 0;
2492 RegSetValueExW(hkey
, L
"SupportAssistiveTechnology",
2493 0, dwType
, reinterpret_cast<const BYTE
*>(Data
), sizeof(DWORD
));
2496 // Unsupported registry type
2504 vcl::SettingsConfigItem::get()->
2505 setValue( "Accessibility",
2506 "EnableATToolSupport",
2507 bEnable
? OUString("true") : OUString("false" ) );
2508 mxData
->mnEnableATT
= bEnable
? TRISTATE_TRUE
: TRISTATE_FALSE
;
2513 void MiscSettings::SetEnableLocalizedDecimalSep( bool bEnable
)
2515 // copy if other references exist
2516 if (mxData
.use_count() > 1)
2518 mxData
= std::make_shared
<ImplMiscData
>(*mxData
);
2520 mxData
->mbEnableLocalizedDecimalSep
= bEnable
;
2523 bool MiscSettings::GetEnableLocalizedDecimalSep() const
2525 return mxData
->mbEnableLocalizedDecimalSep
;
2528 HelpSettings::HelpSettings()
2529 : mxData(std::make_shared
<ImplHelpData
>())
2533 bool HelpSettings::operator ==( const HelpSettings
& rSet
) const
2535 if ( mxData
== rSet
.mxData
)
2538 return (mxData
->mnTipTimeout
== rSet
.mxData
->mnTipTimeout
);
2542 HelpSettings::GetTipDelay()
2548 HelpSettings::SetTipTimeout( sal_uLong nTipTimeout
)
2550 // copy if other references exist
2551 if (mxData
.use_count() > 1)
2553 mxData
= std::make_shared
<ImplHelpData
>(*mxData
);
2555 mxData
->mnTipTimeout
= nTipTimeout
;
2559 HelpSettings::GetTipTimeout() const
2561 return mxData
->mnTipTimeout
;
2565 HelpSettings::GetBalloonDelay()
2571 HelpSettings::operator !=( const HelpSettings
& rSet
) const
2573 return !(*this == rSet
);
2576 ImplAllSettingsData::ImplAllSettingsData()
2578 maLocale( LANGUAGE_SYSTEM
),
2579 maUILocale( LANGUAGE_SYSTEM
)
2581 if (!utl::ConfigManager::IsFuzzing())
2582 maMiscSettings
.SetEnableLocalizedDecimalSep( maSysLocale
.GetOptions().IsDecimalSeparatorAsLocale() );
2585 ImplAllSettingsData::ImplAllSettingsData( const ImplAllSettingsData
& rData
) :
2586 maMouseSettings( rData
.maMouseSettings
),
2587 maStyleSettings( rData
.maStyleSettings
),
2588 maMiscSettings( rData
.maMiscSettings
),
2589 maHelpSettings( rData
.maHelpSettings
),
2590 maLocale( rData
.maLocale
),
2591 maUILocale( rData
.maUILocale
)
2593 // Create the cache objects new when their getter is called.
2596 ImplAllSettingsData::~ImplAllSettingsData()
2598 mpLocaleDataWrapper
.reset();
2599 mpUILocaleDataWrapper
.reset();
2600 mpI18nHelper
.reset();
2601 mpUII18nHelper
.reset();
2604 AllSettings::AllSettings()
2605 : mxData(std::make_shared
<ImplAllSettingsData
>())
2609 void AllSettings::CopyData()
2611 // copy if other references exist
2612 if (mxData
.use_count() > 1)
2614 mxData
= std::make_shared
<ImplAllSettingsData
>(*mxData
);
2619 AllSettingsFlags
AllSettings::Update( AllSettingsFlags nFlags
, const AllSettings
& rSet
)
2622 AllSettingsFlags nChangeFlags
= AllSettingsFlags::NONE
;
2624 if ( nFlags
& AllSettingsFlags::MOUSE
)
2626 if ( mxData
->maMouseSettings
!= rSet
.mxData
->maMouseSettings
)
2629 mxData
->maMouseSettings
= rSet
.mxData
->maMouseSettings
;
2630 nChangeFlags
|= AllSettingsFlags::MOUSE
;
2634 if ( nFlags
& AllSettingsFlags::STYLE
)
2636 if ( mxData
->maStyleSettings
!= rSet
.mxData
->maStyleSettings
)
2639 mxData
->maStyleSettings
= rSet
.mxData
->maStyleSettings
;
2640 nChangeFlags
|= AllSettingsFlags::STYLE
;
2644 if ( nFlags
& AllSettingsFlags::MISC
)
2646 if ( mxData
->maMiscSettings
!= rSet
.mxData
->maMiscSettings
)
2649 mxData
->maMiscSettings
= rSet
.mxData
->maMiscSettings
;
2650 nChangeFlags
|= AllSettingsFlags::MISC
;
2654 if ( nFlags
& AllSettingsFlags::LOCALE
)
2656 if ( mxData
->maLocale
!= rSet
.mxData
->maLocale
)
2658 SetLanguageTag( rSet
.mxData
->maLocale
);
2659 nChangeFlags
|= AllSettingsFlags::LOCALE
;
2663 return nChangeFlags
;
2666 AllSettingsFlags
AllSettings::GetChangeFlags( const AllSettings
& rSet
) const
2669 AllSettingsFlags nChangeFlags
= AllSettingsFlags::NONE
;
2671 if ( mxData
->maStyleSettings
!= rSet
.mxData
->maStyleSettings
)
2672 nChangeFlags
|= AllSettingsFlags::STYLE
;
2674 if ( mxData
->maMiscSettings
!= rSet
.mxData
->maMiscSettings
)
2675 nChangeFlags
|= AllSettingsFlags::MISC
;
2677 if ( mxData
->maLocale
!= rSet
.mxData
->maLocale
)
2678 nChangeFlags
|= AllSettingsFlags::LOCALE
;
2680 return nChangeFlags
;
2683 bool AllSettings::operator ==( const AllSettings
& rSet
) const
2685 if ( mxData
== rSet
.mxData
)
2688 if ( (mxData
->maMouseSettings
== rSet
.mxData
->maMouseSettings
) &&
2689 (mxData
->maStyleSettings
== rSet
.mxData
->maStyleSettings
) &&
2690 (mxData
->maMiscSettings
== rSet
.mxData
->maMiscSettings
) &&
2691 (mxData
->maHelpSettings
== rSet
.mxData
->maHelpSettings
) &&
2692 (mxData
->maLocale
== rSet
.mxData
->maLocale
) )
2700 void AllSettings::SetLanguageTag( const LanguageTag
& rLanguageTag
)
2702 if (mxData
->maLocale
!= rLanguageTag
)
2706 mxData
->maLocale
= rLanguageTag
;
2708 if ( mxData
->mpLocaleDataWrapper
)
2710 mxData
->mpLocaleDataWrapper
.reset();
2712 if ( mxData
->mpI18nHelper
)
2714 mxData
->mpI18nHelper
.reset();
2721 bool GetConfigLayoutRTL(bool bMath
)
2723 static const char* pEnv
= getenv("SAL_RTL_ENABLED" );
2724 static int nUIMirroring
= -1; // -1: undef, 0: auto, 1: on 2: off
2726 // environment always overrides
2732 if( nUIMirroring
== -1 )
2734 nUIMirroring
= 0; // ask configuration only once
2735 utl::OConfigurationNode aNode
= utl::OConfigurationTreeRoot::tryCreateWithComponentContext(
2736 comphelper::getProcessComponentContext(),
2737 "org.openoffice.Office.Common/I18N/CTL" ); // note: case sensitive !
2738 if ( aNode
.isValid() )
2741 css::uno::Any aValue
= aNode
.getNodeValue( "UIMirroring" );
2742 if( aValue
>>= bTmp
)
2744 // found true or false; if it was nil, nothing is changed
2745 nUIMirroring
= bTmp
? 1 : 2;
2750 if( nUIMirroring
== 0 ) // no config found (eg, setup) or default (nil) was set: check language
2752 LanguageType aLang
= SvtSysLocaleOptions().GetRealUILanguageTag().getLanguageType();
2754 bRTL
= MsLangId::isRightToLeftMath( aLang
);
2756 bRTL
= MsLangId::isRightToLeft( aLang
);
2759 bRTL
= (nUIMirroring
== 1);
2765 bool AllSettings::GetLayoutRTL()
2767 if (utl::ConfigManager::IsFuzzing())
2769 return GetConfigLayoutRTL(false);
2772 bool AllSettings::GetMathLayoutRTL()
2774 if (utl::ConfigManager::IsFuzzing())
2776 return GetConfigLayoutRTL(true);
2779 const LanguageTag
& AllSettings::GetLanguageTag() const
2781 if (utl::ConfigManager::IsFuzzing())
2783 static LanguageTag
aRet("en-US");
2787 if (comphelper::LibreOfficeKit::isActive())
2788 return comphelper::LibreOfficeKit::getLanguageTag();
2790 // SYSTEM locale means: use settings from SvtSysLocale that is resolved
2791 if ( mxData
->maLocale
.isSystemLocale() )
2792 mxData
->maLocale
= mxData
->maSysLocale
.GetLanguageTag();
2794 return mxData
->maLocale
;
2797 const LanguageTag
& AllSettings::GetUILanguageTag() const
2799 if (utl::ConfigManager::IsFuzzing())
2801 static LanguageTag
aRet("en-US");
2805 if (comphelper::LibreOfficeKit::isActive())
2806 return comphelper::LibreOfficeKit::getLanguageTag();
2808 // the UILocale is never changed
2809 if ( mxData
->maUILocale
.isSystemLocale() )
2810 mxData
->maUILocale
= mxData
->maSysLocale
.GetUILanguageTag();
2812 return mxData
->maUILocale
;
2815 const LocaleDataWrapper
& AllSettings::GetLocaleDataWrapper() const
2817 if ( !mxData
->mpLocaleDataWrapper
)
2818 const_cast<AllSettings
*>(this)->mxData
->mpLocaleDataWrapper
.reset( new LocaleDataWrapper(
2819 comphelper::getProcessComponentContext(), GetLanguageTag() ) );
2820 return *mxData
->mpLocaleDataWrapper
;
2823 const LocaleDataWrapper
& AllSettings::GetUILocaleDataWrapper() const
2825 if ( !mxData
->mpUILocaleDataWrapper
)
2826 const_cast<AllSettings
*>(this)->mxData
->mpUILocaleDataWrapper
.reset( new LocaleDataWrapper(
2827 comphelper::getProcessComponentContext(), GetUILanguageTag() ) );
2828 return *mxData
->mpUILocaleDataWrapper
;
2831 const vcl::I18nHelper
& AllSettings::GetLocaleI18nHelper() const
2833 if ( !mxData
->mpI18nHelper
) {
2834 const_cast<AllSettings
*>(this)->mxData
->mpI18nHelper
.reset( new vcl::I18nHelper(
2835 comphelper::getProcessComponentContext(), GetLanguageTag() ) );
2837 return *mxData
->mpI18nHelper
;
2840 const vcl::I18nHelper
& AllSettings::GetUILocaleI18nHelper() const
2842 if ( !mxData
->mpUII18nHelper
) {
2843 const_cast<AllSettings
*>(this)->mxData
->mpUII18nHelper
.reset( new vcl::I18nHelper(
2844 comphelper::getProcessComponentContext(), GetUILanguageTag() ) );
2846 return *mxData
->mpUII18nHelper
;
2849 void AllSettings::LocaleSettingsChanged( ConfigurationHints nHint
)
2851 AllSettings
aAllSettings( Application::GetSettings() );
2852 if ( nHint
& ConfigurationHints::DecSep
)
2854 MiscSettings aMiscSettings
= aAllSettings
.GetMiscSettings();
2855 bool bIsDecSepAsLocale
= aAllSettings
.mxData
->maSysLocale
.GetOptions().IsDecimalSeparatorAsLocale();
2856 if ( aMiscSettings
.GetEnableLocalizedDecimalSep() != bIsDecSepAsLocale
)
2858 aMiscSettings
.SetEnableLocalizedDecimalSep( bIsDecSepAsLocale
);
2859 aAllSettings
.SetMiscSettings( aMiscSettings
);
2863 if ( nHint
& ConfigurationHints::Locale
)
2864 aAllSettings
.SetLanguageTag( aAllSettings
.mxData
->maSysLocale
.GetOptions().GetLanguageTag() );
2866 Application::SetSettings( aAllSettings
);
2869 const StyleSettings
&
2870 AllSettings::GetStyleSettings() const
2872 return mxData
->maStyleSettings
;
2875 StyleSettingsOptions
2876 StyleSettings::GetOptions() const
2878 return mxData
->mnOptions
;
2881 std::vector
<vcl::IconThemeInfo
> const &
2882 StyleSettings::GetInstalledIconThemes() const
2884 if (!mxData
->mIconThemeScanner
) {
2885 const_cast<StyleSettings
*>(this)->mxData
->mIconThemeScanner
= vcl::IconThemeScanner::Create(vcl::IconThemeScanner::GetStandardIconThemePath());
2887 return mxData
->mIconThemeScanner
->GetFoundIconThemes();
2891 StyleSettings::GetAutomaticallyChosenIconTheme() const
2893 OUString desktopEnvironment
= Application::GetDesktopEnvironment();
2894 if (!mxData
->mIconThemeScanner
) {
2895 const_cast<StyleSettings
*>(this)->mxData
->mIconThemeScanner
= vcl::IconThemeScanner::Create(vcl::IconThemeScanner::GetStandardIconThemePath());
2897 OUString themeName
= mxData
->mIconThemeSelector
->SelectIconThemeForDesktopEnvironment(
2898 mxData
->mIconThemeScanner
->GetFoundIconThemes(),
2905 StyleSettings::SetIconTheme(const OUString
& theme
)
2908 mxData
->mIconTheme
= theme
;
2912 StyleSettings::DetermineIconTheme() const
2914 OUString
sTheme(mxData
->mIconTheme
);
2915 if (sTheme
.isEmpty())
2917 if (utl::ConfigManager::IsFuzzing())
2921 // read from the configuration, or fallback to what the desktop wants
2922 uno::Reference
<uno::XComponentContext
> xContext(comphelper::getProcessComponentContext());
2925 sTheme
= officecfg::Office::Common::Misc::SymbolStyle::get(xContext
);
2927 if (sTheme
.isEmpty() || sTheme
== "auto")
2928 sTheme
= GetAutomaticallyChosenIconTheme();
2933 if (!mxData
->mIconThemeScanner
) {
2934 const_cast<StyleSettings
*>(this)->mxData
->mIconThemeScanner
= vcl::IconThemeScanner::Create(vcl::IconThemeScanner::GetStandardIconThemePath());
2936 OUString r
= mxData
->mIconThemeSelector
->SelectIconTheme(
2937 mxData
->mIconThemeScanner
->GetFoundIconThemes(),
2943 StyleSettings::SetHighContrastMode(bool bHighContrast
)
2945 if (mxData
->mbHighContrast
== bHighContrast
) {
2950 mxData
->mbHighContrast
= bHighContrast
;
2951 mxData
->mIconThemeSelector
->SetUseHighContrastTheme(bHighContrast
);
2955 StyleSettings::GetHighContrastMode() const
2957 return mxData
->mbHighContrast
;
2961 StyleSettings::SetPreferredIconTheme(const OUString
& theme
, bool bDarkIconTheme
)
2963 mxData
->mIconThemeSelector
->SetPreferredIconTheme(theme
, bDarkIconTheme
);
2967 AllSettings::SetMouseSettings( const MouseSettings
& rSet
)
2970 mxData
->maMouseSettings
= rSet
;
2973 const MouseSettings
&
2974 AllSettings::GetMouseSettings() const
2976 return mxData
->maMouseSettings
;
2980 AllSettings::SetStyleSettings( const StyleSettings
& rSet
)
2983 mxData
->maStyleSettings
= rSet
;
2987 AllSettings::SetMiscSettings( const MiscSettings
& rSet
)
2990 mxData
->maMiscSettings
= rSet
;
2994 AllSettings::GetMiscSettings() const
2996 return mxData
->maMiscSettings
;
3000 AllSettings::SetHelpSettings( const HelpSettings
& rSet
)
3003 mxData
->maHelpSettings
= rSet
;
3007 AllSettings::GetHelpSettings() const
3009 return mxData
->maHelpSettings
;
3013 AllSettings::operator !=( const AllSettings
& rSet
) const
3015 return !(*this == rSet
);
3019 AllSettings::GetSysLocale()
3021 return mxData
->maSysLocale
;
3025 void StyleSettings::BatchSetBackgrounds( const Color
&aBackColor
,
3026 bool bCheckedColorSpecialCase
)
3028 Set3DColors( aBackColor
);
3029 SetFaceColor( aBackColor
);
3030 SetDialogColor( aBackColor
);
3031 SetWorkspaceColor( aBackColor
);
3033 if (bCheckedColorSpecialCase
)
3034 SetCheckedColorSpecialCase();
3037 void StyleSettings::BatchSetFonts( const vcl::Font
& aAppFont
,
3038 const vcl::Font
& aLabelFont
)
3040 SetAppFont( aAppFont
);
3041 SetPushButtonFont( aAppFont
);
3042 SetToolFont( aAppFont
);
3043 SetHelpFont( aAppFont
);
3045 SetMenuFont( aLabelFont
);
3046 SetTabFont( aLabelFont
);
3047 SetLabelFont( aLabelFont
);
3048 SetRadioCheckFont( aLabelFont
);
3049 SetFieldFont( aLabelFont
);
3050 SetGroupFont( aLabelFont
);
3051 SetIconFont( aLabelFont
);
3054 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */