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 #ifndef INCLUDED_VCL_SETTINGS_HXX
21 #define INCLUDED_VCL_SETTINGS_HXX
23 #include <vcl/dllapi.h>
24 #include <tools/color.hxx>
25 #include <tools/gen.hxx>
26 #include <o3tl/typed_flags_set.hxx>
37 class LocaleDataWrapper
;
42 struct ImplAllSettingsData
;
43 enum class ConfigurationHints
;
52 enum class MouseSettingsOptions
60 template<> struct typed_flags
<MouseSettingsOptions
> : is_typed_flags
<MouseSettingsOptions
, 0x06> {};
63 enum class MouseFollowFlags
69 template<> struct typed_flags
<MouseFollowFlags
> : is_typed_flags
<MouseFollowFlags
, 0x01> {};
72 enum class MouseMiddleButtonAction
74 Nothing
, AutoScroll
, PasteSelection
77 enum class MouseWheelBehaviour
79 Disable
, FocusOnly
, ALWAYS
82 class VCL_DLLPUBLIC MouseSettings
86 std::shared_ptr
<ImplMouseData
> mxData
;
91 void SetOptions( MouseSettingsOptions nOptions
);
92 MouseSettingsOptions
GetOptions() const;
94 void SetDoubleClickTime( sal_uInt64 nDoubleClkTime
);
95 sal_uInt64
GetDoubleClickTime() const;
97 void SetDoubleClickWidth( sal_Int32 nDoubleClkWidth
);
98 sal_Int32
GetDoubleClickWidth() const;
100 void SetDoubleClickHeight( sal_Int32 nDoubleClkHeight
);
101 sal_Int32
GetDoubleClickHeight() const;
103 void SetStartDragWidth( sal_Int32 nDragWidth
);
104 sal_Int32
GetStartDragWidth() const;
106 void SetStartDragHeight( sal_Int32 nDragHeight
);
107 sal_Int32
GetStartDragHeight() const;
109 static sal_uInt16
GetStartDragCode();
111 static sal_uInt16
GetContextMenuCode();
113 static sal_uInt16
GetContextMenuClicks();
115 static sal_Int32
GetScrollRepeat();
117 static sal_Int32
GetButtonStartRepeat();
119 void SetButtonRepeat( sal_Int32 nRepeat
);
120 sal_Int32
GetButtonRepeat() const;
122 static sal_Int32
GetActionDelay();
124 void SetMenuDelay( sal_Int32 nDelay
);
125 sal_Int32
GetMenuDelay() const;
127 void SetFollow( MouseFollowFlags nFollow
);
128 MouseFollowFlags
GetFollow() const;
130 void SetMiddleButtonAction( MouseMiddleButtonAction nAction
);
131 MouseMiddleButtonAction
GetMiddleButtonAction() const;
133 void SetWheelBehavior( MouseWheelBehaviour nBehavior
);
134 MouseWheelBehaviour
GetWheelBehavior() const;
136 bool operator ==( const MouseSettings
& rSet
) const;
137 bool operator !=( const MouseSettings
& rSet
) const;
142 int content_area_border
;
144 int action_area_border
;
146 : content_area_border(2)
148 , action_area_border(5)
152 enum class StyleSettingsOptions
156 NoMnemonics
= 0x0002,
160 template<> struct typed_flags
<StyleSettingsOptions
> : is_typed_flags
<StyleSettingsOptions
, 0x0003> {};
163 enum class DragFullOptions
171 All
= WindowMove
| WindowSize
| Docking
| Split
| Scroll
,
175 template<> struct typed_flags
<DragFullOptions
> : is_typed_flags
<DragFullOptions
, 0x0073> {};
178 enum class SelectionOptions
185 template<> struct typed_flags
<SelectionOptions
> : is_typed_flags
<SelectionOptions
, 0x0004> {};
188 enum class DisplayOptions
195 template<> struct typed_flags
<DisplayOptions
> : is_typed_flags
<DisplayOptions
, 0x0001> {};
198 enum class ToolbarIconSize
206 #define STYLE_CURSOR_NOBLINKTIME SAL_MAX_UINT64
208 class VCL_DLLPUBLIC StyleSettings
213 std::shared_ptr
<ImplStyleData
> mxData
;
218 void Set3DColors( const Color
& rColor
);
220 void SetFaceColor( const Color
& rColor
);
221 const Color
& GetFaceColor() const;
223 Color
GetFaceGradientColor() const;
225 Color
GetSeparatorColor() const;
227 void SetCheckedColor( const Color
& rColor
);
228 void SetCheckedColorSpecialCase( );
229 const Color
& GetCheckedColor() const;
231 void SetLightColor( const Color
& rColor
);
232 const Color
& GetLightColor() const;
234 void SetLightBorderColor( const Color
& rColor
);
235 const Color
& GetLightBorderColor() const;
237 void SetShadowColor( const Color
& rColor
);
238 const Color
& GetShadowColor() const;
240 void SetDarkShadowColor( const Color
& rColor
);
241 const Color
& GetDarkShadowColor() const;
243 void SetDefaultButtonTextColor( const Color
& rColor
);
244 const Color
& GetDefaultButtonTextColor() const;
246 void SetButtonTextColor( const Color
& rColor
);
247 const Color
& GetButtonTextColor() const;
249 void SetDefaultActionButtonTextColor( const Color
& rColor
);
250 const Color
& GetDefaultActionButtonTextColor() const;
252 void SetActionButtonTextColor( const Color
& rColor
);
253 const Color
& GetActionButtonTextColor() const;
255 void SetFlatButtonTextColor( const Color
& rColor
);
256 const Color
& GetFlatButtonTextColor() const;
258 void SetDefaultButtonRolloverTextColor( const Color
& rColor
);
259 const Color
& GetDefaultButtonRolloverTextColor() const;
261 void SetButtonRolloverTextColor( const Color
& rColor
);
262 const Color
& GetButtonRolloverTextColor() const;
264 void SetDefaultActionButtonRolloverTextColor( const Color
& rColor
);
265 const Color
& GetDefaultActionButtonRolloverTextColor() const;
267 void SetActionButtonRolloverTextColor( const Color
& rColor
);
268 const Color
& GetActionButtonRolloverTextColor() const;
270 void SetFlatButtonRolloverTextColor( const Color
& rColor
);
271 const Color
& GetFlatButtonRolloverTextColor() const;
273 void SetDefaultButtonPressedRolloverTextColor( const Color
& rColor
);
274 const Color
& GetDefaultButtonPressedRolloverTextColor() const;
276 void SetButtonPressedRolloverTextColor( const Color
& rColor
);
277 const Color
& GetButtonPressedRolloverTextColor() const;
279 void SetDefaultActionButtonPressedRolloverTextColor( const Color
& rColor
);
280 const Color
& GetDefaultActionButtonPressedRolloverTextColor() const;
282 void SetActionButtonPressedRolloverTextColor( const Color
& rColor
);
283 const Color
& GetActionButtonPressedRolloverTextColor() const;
285 void SetFlatButtonPressedRolloverTextColor( const Color
& rColor
);
286 const Color
& GetFlatButtonPressedRolloverTextColor() const;
288 void SetRadioCheckTextColor( const Color
& rColor
);
289 const Color
& GetRadioCheckTextColor() const;
291 void SetGroupTextColor( const Color
& rColor
);
292 const Color
& GetGroupTextColor() const;
294 void SetLabelTextColor( const Color
& rColor
);
295 const Color
& GetLabelTextColor() const;
297 void SetWindowColor( const Color
& rColor
);
298 const Color
& GetWindowColor() const;
300 void SetWindowTextColor( const Color
& rColor
);
301 const Color
& GetWindowTextColor() const;
303 void SetDialogColor( const Color
& rColor
);
304 const Color
& GetDialogColor() const;
306 void SetDialogTextColor( const Color
& rColor
);
307 const Color
& GetDialogTextColor() const;
309 void SetWorkspaceColor( const Color
& rColor
);
310 const Color
& GetWorkspaceColor() const;
312 void SetFieldColor( const Color
& rColor
);
313 const Color
& GetFieldColor() const;
315 void SetFieldTextColor( const Color
& rColor
);
316 const Color
& GetFieldTextColor() const;
318 void SetFieldRolloverTextColor( const Color
& rColor
);
319 const Color
& GetFieldRolloverTextColor() const;
321 void SetActiveColor( const Color
& rColor
);
322 const Color
& GetActiveColor() const;
324 void SetActiveTextColor( const Color
& rColor
);
325 const Color
& GetActiveTextColor() const;
327 void SetActiveBorderColor( const Color
& rColor
);
328 const Color
& GetActiveBorderColor() const;
330 void SetDeactiveColor( const Color
& rColor
);
331 const Color
& GetDeactiveColor() const;
333 void SetDeactiveTextColor( const Color
& rColor
);
334 const Color
& GetDeactiveTextColor() const;
336 void SetDeactiveBorderColor( const Color
& rColor
);
337 const Color
& GetDeactiveBorderColor() const;
339 void SetHighlightColor( const Color
& rColor
);
340 const Color
& GetHighlightColor() const;
342 void SetHighlightTextColor( const Color
& rColor
);
343 const Color
& GetHighlightTextColor() const;
345 void SetDisableColor( const Color
& rColor
);
346 const Color
& GetDisableColor() const;
348 void SetHelpColor( const Color
& rColor
);
349 const Color
& GetHelpColor() const;
351 void SetHelpTextColor( const Color
& rColor
);
352 const Color
& GetHelpTextColor() const;
354 void SetMenuColor( const Color
& rColor
);
355 const Color
& GetMenuColor() const;
357 void SetMenuBarColor( const Color
& rColor
);
358 const Color
& GetMenuBarColor() const;
360 void SetMenuBarRolloverColor( const Color
& rColor
);
361 const Color
& GetMenuBarRolloverColor() const;
363 void SetMenuBorderColor( const Color
& rColor
);
364 const Color
& GetMenuBorderColor() const;
366 void SetMenuTextColor( const Color
& rColor
);
367 const Color
& GetMenuTextColor() const;
369 void SetMenuBarTextColor( const Color
& rColor
);
370 const Color
& GetMenuBarTextColor() const;
372 void SetMenuBarRolloverTextColor( const Color
& rColor
);
373 const Color
& GetMenuBarRolloverTextColor() const;
375 void SetMenuBarHighlightTextColor( const Color
& rColor
);
376 const Color
& GetMenuBarHighlightTextColor() const;
378 void SetMenuHighlightColor( const Color
& rColor
);
379 const Color
& GetMenuHighlightColor() const;
381 void SetMenuHighlightTextColor( const Color
& rColor
);
382 const Color
& GetMenuHighlightTextColor() const;
384 void SetTabTextColor( const Color
& rColor
);
385 const Color
& GetTabTextColor() const;
387 void SetTabRolloverTextColor( const Color
& rColor
);
388 const Color
& GetTabRolloverTextColor() const;
390 void SetTabHighlightTextColor( const Color
& rColor
);
391 const Color
& GetTabHighlightTextColor() const;
393 void SetToolTextColor( const Color
& rColor
);
394 const Color
& GetToolTextColor() const;
396 void SetLinkColor( const Color
& rColor
);
397 const Color
& GetLinkColor() const;
399 void SetVisitedLinkColor( const Color
& rColor
);
400 const Color
& GetVisitedLinkColor() const;
402 void SetMonoColor( const Color
& rColor
);
403 const Color
& GetMonoColor() const;
405 void SetActiveTabColor( const Color
& rColor
);
406 const Color
& GetActiveTabColor() const;
408 void SetInactiveTabColor( const Color
& rColor
);
409 const Color
& GetInactiveTabColor() const;
411 void SetAlternatingRowColor(const Color
& rColor
);
412 const Color
& GetAlternatingRowColor() const;
414 void SetHighContrastMode(bool bHighContrast
);
415 bool GetHighContrastMode() const;
417 void SetUseSystemUIFonts( bool bUseSystemUIFonts
);
418 bool GetUseSystemUIFonts() const;
420 void SetUseFontAAFromSystem(bool bUseFontAAFromSystem
);
421 bool GetUseFontAAFromSystem() const;
423 void SetUseFlatBorders( bool bUseFlatBorders
);
424 bool GetUseFlatBorders() const;
426 void SetUseFlatMenus( bool bUseFlatMenus
);
427 bool GetUseFlatMenus() const;
429 void SetUseImagesInMenus( TriState eUseImagesInMenus
);
430 bool GetUseImagesInMenus() const;
432 void SetPreferredUseImagesInMenus( bool bPreferredUseImagesInMenus
);
433 bool GetPreferredUseImagesInMenus() const;
435 void SetSkipDisabledInMenus( bool bSkipDisabledInMenus
);
436 bool GetSkipDisabledInMenus() const;
438 void SetHideDisabledMenuItems( bool bHideDisabledMenuItems
);
439 bool GetHideDisabledMenuItems() const;
441 void SetContextMenuShortcuts( TriState eContextMenuShortcuts
);
442 bool GetContextMenuShortcuts() const;
444 void SetPreferredContextMenuShortcuts( bool bContextMenuShortcuts
);
445 bool GetPreferredContextMenuShortcuts() const;
447 void SetPrimaryButtonWarpsSlider( bool bPrimaryButtonWarpsSlider
);
448 bool GetPrimaryButtonWarpsSlider() const;
450 void SetAppFont( const vcl::Font
& rFont
);
451 const vcl::Font
& GetAppFont() const;
453 void SetHelpFont( const vcl::Font
& rFont
);
454 const vcl::Font
& GetHelpFont() const;
456 void SetTitleFont( const vcl::Font
& rFont
);
457 const vcl::Font
& GetTitleFont() const;
459 void SetFloatTitleFont( const vcl::Font
& rFont
);
460 const vcl::Font
& GetFloatTitleFont() const;
462 void SetMenuFont( const vcl::Font
& rFont
);
463 const vcl::Font
& GetMenuFont() const;
465 void SetToolFont( const vcl::Font
& rFont
);
466 const vcl::Font
& GetToolFont() const;
468 void SetGroupFont( const vcl::Font
& rFont
);
469 const vcl::Font
& GetGroupFont() const;
471 void SetLabelFont( const vcl::Font
& rFont
);
472 const vcl::Font
& GetLabelFont() const;
474 void SetRadioCheckFont( const vcl::Font
& rFont
);
475 const vcl::Font
& GetRadioCheckFont() const;
477 void SetPushButtonFont( const vcl::Font
& rFont
);
478 const vcl::Font
& GetPushButtonFont() const;
480 void SetFieldFont( const vcl::Font
& rFont
);
481 const vcl::Font
& GetFieldFont() const;
483 void SetIconFont( const vcl::Font
& rFont
);
484 const vcl::Font
& GetIconFont() const;
486 void SetTabFont( const vcl::Font
& rFont
);
487 const vcl::Font
& GetTabFont() const;
489 static sal_Int32
GetBorderSize();
491 void SetTitleHeight( sal_Int32 nSize
);
492 sal_Int32
GetTitleHeight() const;
494 void SetFloatTitleHeight( sal_Int32 nSize
);
495 sal_Int32
GetFloatTitleHeight() const;
497 void SetScrollBarSize( sal_Int32 nSize
);
498 sal_Int32
GetScrollBarSize() const;
500 void SetMinThumbSize( sal_Int32 nSize
);
501 sal_Int32
GetMinThumbSize() const;
503 void SetSpinSize( sal_Int32 nSize
);
504 sal_Int32
GetSpinSize() const;
506 static sal_Int32
GetSplitSize();
508 void SetCursorSize( sal_Int32 nSize
);
509 sal_Int32
GetCursorSize() const;
511 void SetCursorBlinkTime( sal_uInt64 nBlinkTime
);
512 sal_uInt64
GetCursorBlinkTime() const;
514 void SetDragFullOptions( DragFullOptions nOptions
);
515 DragFullOptions
GetDragFullOptions() const;
517 void SetSelectionOptions( SelectionOptions nOptions
);
518 SelectionOptions
GetSelectionOptions() const;
520 void SetDisplayOptions( DisplayOptions nOptions
);
521 DisplayOptions
GetDisplayOptions() const;
523 void SetAntialiasingMinPixelHeight( sal_Int32 nMinPixel
);
524 sal_Int32
GetAntialiasingMinPixelHeight() const;
526 void SetOptions( StyleSettingsOptions nOptions
);
527 StyleSettingsOptions
GetOptions() const;
529 void SetAutoMnemonic( bool bAutoMnemonic
);
530 bool GetAutoMnemonic() const;
532 static bool GetDockingFloatsSupported();
534 void SetFontColor( const Color
& rColor
);
535 const Color
& GetFontColor() const;
537 void SetToolbarIconSize( ToolbarIconSize nSize
);
538 ToolbarIconSize
GetToolbarIconSize() const;
539 Size
GetToolbarIconSizePixel() const;
541 /** Set the icon theme to use. */
542 void SetIconTheme(const OUString
&);
544 /** Determine which icon theme should be used.
546 * This might not be the same as the one which has been set with SetIconTheme(),
547 * e.g., if high contrast mode is enabled.
549 * (for the detailed logic @see vcl::IconThemeSelector)
551 OUString
DetermineIconTheme() const;
553 /** Obtain the list of icon themes which were found in the config folder
554 * @see vcl::IconThemeScanner for more details.
556 std::vector
<vcl::IconThemeInfo
> const & GetInstalledIconThemes() const;
558 /** Obtain the name of the icon theme which will be chosen automatically for the desktop environment.
559 * This method will only return icon themes which were actually found on the system.
561 OUString
GetAutomaticallyChosenIconTheme() const;
563 /** Set a preferred icon theme.
564 * This theme will be preferred in GetAutomaticallyChosenIconTheme()
566 void SetPreferredIconTheme(const OUString
&, bool bDarkIconTheme
= false);
568 const DialogStyle
& GetDialogStyle() const;
570 BitmapEx
const & GetPersonaHeader() const;
572 BitmapEx
const & GetPersonaFooter() const;
574 const std::optional
<Color
>& GetPersonaMenuBarTextColor() const;
576 // global switch to allow EdgeBlenging; currently possible for ValueSet and ListBox
577 // when activated there using Get/SetEdgeBlending; default is true
578 void SetEdgeBlending(sal_uInt16 nCount
);
579 sal_uInt16
GetEdgeBlending() const;
581 // TopLeft (default Color(0xC0, 0xC0, 0xC0)) and BottomRight (default Color(0x40, 0x40, 0x40))
582 // default colors for EdgeBlending
583 const Color
& GetEdgeBlendingTopLeftColor() const;
584 const Color
& GetEdgeBlendingBottomRightColor() const;
586 // maximum line count for ListBox control; to use this, call AdaptDropDownLineCountToMaximum() at the
587 // ListBox after it's ItemCount has changed/got filled. Default is 25. If more Items exist, a scrollbar
589 void SetListBoxMaximumLineCount(sal_uInt16 nCount
);
590 sal_uInt16
GetListBoxMaximumLineCount() const;
592 // maximum column count for the ColorValueSet control. Default is 12 and this is optimized for the
593 // color scheme which has 12-color aligned layout for the part taken over from Symphony. Do
594 // only change this if you know what you are doing.
595 void SetColorValueSetColumnCount(sal_uInt16 nCount
);
596 sal_uInt16
GetColorValueSetColumnCount() const;
598 void SetListBoxPreviewDefaultLogicSize(Size
const & rSize
);
599 const Size
& GetListBoxPreviewDefaultPixelSize() const;
601 // the default LineWidth for ListBox UI previews (LineStyle, LineDash, LineStartEnd). Default is 1.
602 static sal_uInt16
GetListBoxPreviewDefaultLineWidth();
604 // defines if previews which contain potentially transparent objects (e.g. the dash/line/LineStartEnd previews and others)
605 // use the default transparent visualization background (checkered background) as it has got standard in graphic programs nowadays
606 void SetPreviewUsesCheckeredBackground(bool bNew
);
607 bool GetPreviewUsesCheckeredBackground() const;
609 void SetStandardStyles();
611 bool operator ==( const StyleSettings
& rSet
) const;
612 bool operator !=( const StyleSettings
& rSet
) const;
614 // Batch setters used by various backends
615 void BatchSetBackgrounds( const Color
&aBackColor
,
616 bool bCheckedColorSpecialCase
= true );
617 void BatchSetFonts( const vcl::Font
& aAppFont
,
618 const vcl::Font
& aLabelFont
);
622 class VCL_DLLPUBLIC MiscSettings
624 std::shared_ptr
<ImplMiscData
> mxData
;
630 void SetEnableATToolSupport( bool bEnable
);
632 bool GetEnableATToolSupport() const;
633 bool GetDisablePrinting() const;
634 void SetEnableLocalizedDecimalSep( bool bEnable
);
635 bool GetEnableLocalizedDecimalSep() const;
637 bool operator ==( const MiscSettings
& rSet
) const;
638 bool operator !=( const MiscSettings
& rSet
) const;
642 class VCL_DLLPUBLIC HelpSettings
644 std::shared_ptr
<ImplHelpData
> mxData
;
649 static sal_Int32
GetTipDelay();
650 void SetTipTimeout( sal_Int32 nTipTimeout
);
651 sal_Int32
GetTipTimeout() const;
652 static sal_Int32
GetBalloonDelay();
654 bool operator ==( const HelpSettings
& rSet
) const;
655 bool operator !=( const HelpSettings
& rSet
) const;
659 enum class AllSettingsFlags
{
668 template<> struct typed_flags
<AllSettingsFlags
> : is_typed_flags
<AllSettingsFlags
, 0x0027> {};
671 class VCL_DLLPUBLIC AllSettings
676 std::shared_ptr
<ImplAllSettingsData
> mxData
;
681 void SetMouseSettings( const MouseSettings
& rSet
);
682 const MouseSettings
& GetMouseSettings() const;
684 void SetStyleSettings( const StyleSettings
& rSet
);
685 const StyleSettings
& GetStyleSettings() const;
687 void SetMiscSettings( const MiscSettings
& rSet
);
688 const MiscSettings
& GetMiscSettings() const;
690 void SetHelpSettings( const HelpSettings
& rSet
);
691 const HelpSettings
& GetHelpSettings() const;
693 void SetLanguageTag(const OUString
& rLanguage
, bool bCanonicalize
);
694 void SetLanguageTag( const LanguageTag
& rLanguageTag
);
695 const LanguageTag
& GetLanguageTag() const;
696 const LanguageTag
& GetUILanguageTag() const;
697 static bool GetLayoutRTL(); // returns true if UI language requires right-to-left Text Layout
698 static bool GetMathLayoutRTL(); // returns true if UI language requires right-to-left Math Layout
699 static OUString
GetUIRootDir();
700 const LocaleDataWrapper
& GetLocaleDataWrapper() const;
701 const LocaleDataWrapper
& GetUILocaleDataWrapper() const;
702 const LocaleDataWrapper
& GetNeutralLocaleDataWrapper() const;
703 const vcl::I18nHelper
& GetLocaleI18nHelper() const;
704 const vcl::I18nHelper
& GetUILocaleI18nHelper() const;
706 static AllSettingsFlags
GetWindowUpdate()
707 { return AllSettingsFlags::MOUSE
| AllSettingsFlags::STYLE
| AllSettingsFlags::MISC
| AllSettingsFlags::LOCALE
; }
709 AllSettingsFlags
Update( AllSettingsFlags nFlags
, const AllSettings
& rSettings
);
710 AllSettingsFlags
GetChangeFlags( const AllSettings
& rSettings
) const;
712 bool operator ==( const AllSettings
& rSet
) const;
713 bool operator !=( const AllSettings
& rSet
) const;
714 static void LocaleSettingsChanged( ConfigurationHints nHint
);
715 SvtSysLocale
& GetSysLocale();
718 #endif // INCLUDED_VCL_SETTINGS_HXX
720 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */