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 <tools/solar.h>
24 #include <vcl/dllapi.h>
25 #include <tools/color.hxx>
26 #include <tools/gen.hxx>
27 #include <o3tl/typed_flags_set.hxx>
38 class LocaleDataWrapper
;
43 struct ImplAllSettingsData
;
44 enum class ConfigurationHints
;
53 enum class MouseSettingsOptions
62 template<> struct typed_flags
<MouseSettingsOptions
> : is_typed_flags
<MouseSettingsOptions
, 0x07> {};
65 enum class MouseFollowFlags
72 template<> struct typed_flags
<MouseFollowFlags
> : is_typed_flags
<MouseFollowFlags
, 0x03> {};
75 enum class MouseMiddleButtonAction
77 Nothing
, AutoScroll
, PasteSelection
80 enum class MouseWheelBehaviour
82 Disable
, FocusOnly
, ALWAYS
85 class VCL_DLLPUBLIC MouseSettings
89 std::shared_ptr
<ImplMouseData
> mxData
;
94 void SetOptions( MouseSettingsOptions nOptions
);
95 MouseSettingsOptions
GetOptions() const;
97 void SetDoubleClickTime( sal_uInt64 nDoubleClkTime
);
98 sal_uInt64
GetDoubleClickTime() const;
100 void SetDoubleClickWidth( tools::Long nDoubleClkWidth
);
101 tools::Long
GetDoubleClickWidth() const;
103 void SetDoubleClickHeight( tools::Long nDoubleClkHeight
);
104 tools::Long
GetDoubleClickHeight() const;
106 void SetStartDragWidth( tools::Long nDragWidth
);
107 tools::Long
GetStartDragWidth() const;
109 void SetStartDragHeight( tools::Long nDragHeight
);
110 tools::Long
GetStartDragHeight() const;
112 static sal_uInt16
GetStartDragCode();
114 static sal_uInt16
GetContextMenuCode();
116 static sal_uInt16
GetContextMenuClicks();
118 static sal_uLong
GetScrollRepeat();
120 static sal_uLong
GetButtonStartRepeat();
122 void SetButtonRepeat( sal_uLong nRepeat
);
123 sal_uLong
GetButtonRepeat() const;
125 static sal_uLong
GetActionDelay();
127 void SetMenuDelay( sal_uLong nDelay
);
128 sal_uLong
GetMenuDelay() const;
130 void SetFollow( MouseFollowFlags nFollow
);
131 MouseFollowFlags
GetFollow() const;
133 void SetMiddleButtonAction( MouseMiddleButtonAction nAction
);
134 MouseMiddleButtonAction
GetMiddleButtonAction() const;
136 void SetWheelBehavior( MouseWheelBehaviour nBehavior
);
137 MouseWheelBehaviour
GetWheelBehavior() const;
139 bool operator ==( const MouseSettings
& rSet
) const;
140 bool operator !=( const MouseSettings
& rSet
) const;
145 int content_area_border
;
147 int action_area_border
;
149 : content_area_border(2)
151 , action_area_border(5)
155 enum class StyleSettingsOptions
159 NoMnemonics
= 0x0002,
163 template<> struct typed_flags
<StyleSettingsOptions
> : is_typed_flags
<StyleSettingsOptions
, 0x0003> {};
166 enum class DragFullOptions
174 All
= WindowMove
| WindowSize
| Docking
| Split
| Scroll
,
178 template<> struct typed_flags
<DragFullOptions
> : is_typed_flags
<DragFullOptions
, 0x0073> {};
181 enum class SelectionOptions
190 template<> struct typed_flags
<SelectionOptions
> : is_typed_flags
<SelectionOptions
, 0x0007> {};
193 enum class DisplayOptions
200 template<> struct typed_flags
<DisplayOptions
> : is_typed_flags
<DisplayOptions
, 0x0001> {};
203 enum class ToolbarIconSize
211 #define STYLE_CURSOR_NOBLINKTIME SAL_MAX_UINT64
213 class VCL_DLLPUBLIC StyleSettings
218 std::shared_ptr
<ImplStyleData
> mxData
;
223 void Set3DColors( const Color
& rColor
);
225 void SetFaceColor( const Color
& rColor
);
226 const Color
& GetFaceColor() const;
228 Color
GetFaceGradientColor() const;
230 Color
GetSeparatorColor() const;
232 void SetCheckedColor( const Color
& rColor
);
233 void SetCheckedColorSpecialCase( );
234 const Color
& GetCheckedColor() const;
236 void SetLightColor( const Color
& rColor
);
237 const Color
& GetLightColor() const;
239 void SetLightBorderColor( const Color
& rColor
);
240 const Color
& GetLightBorderColor() const;
242 void SetShadowColor( const Color
& rColor
);
243 const Color
& GetShadowColor() const;
245 void SetDarkShadowColor( const Color
& rColor
);
246 const Color
& GetDarkShadowColor() const;
248 void SetDefaultButtonTextColor( const Color
& rColor
);
249 const Color
& GetDefaultButtonTextColor() const;
251 void SetButtonTextColor( const Color
& rColor
);
252 const Color
& GetButtonTextColor() const;
254 void SetDefaultActionButtonTextColor( const Color
& rColor
);
255 const Color
& GetDefaultActionButtonTextColor() const;
257 void SetActionButtonTextColor( const Color
& rColor
);
258 const Color
& GetActionButtonTextColor() const;
260 void SetFlatButtonTextColor( const Color
& rColor
);
261 const Color
& GetFlatButtonTextColor() const;
263 void SetDefaultButtonRolloverTextColor( const Color
& rColor
);
264 const Color
& GetDefaultButtonRolloverTextColor() const;
266 void SetButtonRolloverTextColor( const Color
& rColor
);
267 const Color
& GetButtonRolloverTextColor() const;
269 void SetDefaultActionButtonRolloverTextColor( const Color
& rColor
);
270 const Color
& GetDefaultActionButtonRolloverTextColor() const;
272 void SetActionButtonRolloverTextColor( const Color
& rColor
);
273 const Color
& GetActionButtonRolloverTextColor() const;
275 void SetFlatButtonRolloverTextColor( const Color
& rColor
);
276 const Color
& GetFlatButtonRolloverTextColor() const;
278 void SetDefaultButtonPressedRolloverTextColor( const Color
& rColor
);
279 const Color
& GetDefaultButtonPressedRolloverTextColor() const;
281 void SetButtonPressedRolloverTextColor( const Color
& rColor
);
282 const Color
& GetButtonPressedRolloverTextColor() const;
284 void SetDefaultActionButtonPressedRolloverTextColor( const Color
& rColor
);
285 const Color
& GetDefaultActionButtonPressedRolloverTextColor() const;
287 void SetActionButtonPressedRolloverTextColor( const Color
& rColor
);
288 const Color
& GetActionButtonPressedRolloverTextColor() const;
290 void SetFlatButtonPressedRolloverTextColor( const Color
& rColor
);
291 const Color
& GetFlatButtonPressedRolloverTextColor() const;
293 void SetRadioCheckTextColor( const Color
& rColor
);
294 const Color
& GetRadioCheckTextColor() const;
296 void SetGroupTextColor( const Color
& rColor
);
297 const Color
& GetGroupTextColor() const;
299 void SetLabelTextColor( const Color
& rColor
);
300 const Color
& GetLabelTextColor() const;
302 void SetWindowColor( const Color
& rColor
);
303 const Color
& GetWindowColor() const;
305 void SetWindowTextColor( const Color
& rColor
);
306 const Color
& GetWindowTextColor() const;
308 void SetDialogColor( const Color
& rColor
);
309 const Color
& GetDialogColor() const;
311 void SetDialogTextColor( const Color
& rColor
);
312 const Color
& GetDialogTextColor() const;
314 void SetWorkspaceColor( const Color
& rColor
);
315 const Color
& GetWorkspaceColor() const;
317 void SetFieldColor( const Color
& rColor
);
318 const Color
& GetFieldColor() const;
320 void SetFieldTextColor( const Color
& rColor
);
321 const Color
& GetFieldTextColor() const;
323 void SetFieldRolloverTextColor( const Color
& rColor
);
324 const Color
& GetFieldRolloverTextColor() const;
326 void SetActiveColor( const Color
& rColor
);
327 const Color
& GetActiveColor() const;
329 void SetActiveTextColor( const Color
& rColor
);
330 const Color
& GetActiveTextColor() const;
332 void SetActiveBorderColor( const Color
& rColor
);
333 const Color
& GetActiveBorderColor() const;
335 void SetDeactiveColor( const Color
& rColor
);
336 const Color
& GetDeactiveColor() const;
338 void SetDeactiveTextColor( const Color
& rColor
);
339 const Color
& GetDeactiveTextColor() const;
341 void SetDeactiveBorderColor( const Color
& rColor
);
342 const Color
& GetDeactiveBorderColor() const;
344 void SetHighlightColor( const Color
& rColor
);
345 const Color
& GetHighlightColor() const;
347 void SetHighlightTextColor( const Color
& rColor
);
348 const Color
& GetHighlightTextColor() const;
350 void SetDisableColor( const Color
& rColor
);
351 const Color
& GetDisableColor() const;
353 void SetHelpColor( const Color
& rColor
);
354 const Color
& GetHelpColor() const;
356 void SetHelpTextColor( const Color
& rColor
);
357 const Color
& GetHelpTextColor() const;
359 void SetMenuColor( const Color
& rColor
);
360 const Color
& GetMenuColor() const;
362 void SetMenuBarColor( const Color
& rColor
);
363 const Color
& GetMenuBarColor() const;
365 void SetMenuBarRolloverColor( const Color
& rColor
);
366 const Color
& GetMenuBarRolloverColor() const;
368 void SetMenuBorderColor( const Color
& rColor
);
369 const Color
& GetMenuBorderColor() const;
371 void SetMenuTextColor( const Color
& rColor
);
372 const Color
& GetMenuTextColor() const;
374 void SetMenuBarTextColor( const Color
& rColor
);
375 const Color
& GetMenuBarTextColor() const;
377 void SetMenuBarRolloverTextColor( const Color
& rColor
);
378 const Color
& GetMenuBarRolloverTextColor() const;
380 void SetMenuBarHighlightTextColor( const Color
& rColor
);
381 const Color
& GetMenuBarHighlightTextColor() const;
383 void SetMenuHighlightColor( const Color
& rColor
);
384 const Color
& GetMenuHighlightColor() const;
386 void SetMenuHighlightTextColor( const Color
& rColor
);
387 const Color
& GetMenuHighlightTextColor() const;
389 void SetTabTextColor( const Color
& rColor
);
390 const Color
& GetTabTextColor() const;
392 void SetTabRolloverTextColor( const Color
& rColor
);
393 const Color
& GetTabRolloverTextColor() const;
395 void SetTabHighlightTextColor( const Color
& rColor
);
396 const Color
& GetTabHighlightTextColor() const;
398 void SetToolTextColor( const Color
& rColor
);
399 const Color
& GetToolTextColor() const;
401 void SetLinkColor( const Color
& rColor
);
402 const Color
& GetLinkColor() const;
404 void SetVisitedLinkColor( const Color
& rColor
);
405 const Color
& GetVisitedLinkColor() const;
407 const Color
& GetHighlightLinkColor() const;
409 void SetMonoColor( const Color
& rColor
);
410 const Color
& GetMonoColor() const;
412 void SetActiveTabColor( const Color
& rColor
);
413 const Color
& GetActiveTabColor() const;
415 void SetInactiveTabColor( const Color
& rColor
);
416 const Color
& GetInactiveTabColor() const;
418 void SetAlternatingRowColor(const Color
& rColor
);
419 const Color
& GetAlternatingRowColor() const;
421 void SetHighContrastMode(bool bHighContrast
);
422 bool GetHighContrastMode() const;
424 void SetUseSystemUIFonts( bool bUseSystemUIFonts
);
425 bool GetUseSystemUIFonts() const;
427 void SetUseFontAAFromSystem(bool bUseFontAAFromSystem
);
428 bool GetUseFontAAFromSystem() const;
430 void SetUseFlatBorders( bool bUseFlatBorders
);
431 bool GetUseFlatBorders() const;
433 void SetUseFlatMenus( bool bUseFlatMenus
);
434 bool GetUseFlatMenus() const;
436 void SetUseImagesInMenus( TriState eUseImagesInMenus
);
437 bool GetUseImagesInMenus() const;
439 void SetPreferredUseImagesInMenus( bool bPreferredUseImagesInMenus
);
440 bool GetPreferredUseImagesInMenus() const;
442 void SetSkipDisabledInMenus( bool bSkipDisabledInMenus
);
443 bool GetSkipDisabledInMenus() const;
445 void SetHideDisabledMenuItems( bool bHideDisabledMenuItems
);
446 bool GetHideDisabledMenuItems() const;
448 void SetContextMenuShortcuts( TriState eContextMenuShortcuts
);
449 bool GetContextMenuShortcuts() const;
451 void SetPreferredContextMenuShortcuts( bool bContextMenuShortcuts
);
452 bool GetPreferredContextMenuShortcuts() const;
454 void SetPrimaryButtonWarpsSlider( bool bPrimaryButtonWarpsSlider
);
455 bool GetPrimaryButtonWarpsSlider() const;
457 void SetAppFont( const vcl::Font
& rFont
);
458 const vcl::Font
& GetAppFont() const;
460 void SetHelpFont( const vcl::Font
& rFont
);
461 const vcl::Font
& GetHelpFont() const;
463 void SetTitleFont( const vcl::Font
& rFont
);
464 const vcl::Font
& GetTitleFont() const;
466 void SetFloatTitleFont( const vcl::Font
& rFont
);
467 const vcl::Font
& GetFloatTitleFont() const;
469 void SetMenuFont( const vcl::Font
& rFont
);
470 const vcl::Font
& GetMenuFont() const;
472 void SetToolFont( const vcl::Font
& rFont
);
473 const vcl::Font
& GetToolFont() const;
475 void SetGroupFont( const vcl::Font
& rFont
);
476 const vcl::Font
& GetGroupFont() const;
478 void SetLabelFont( const vcl::Font
& rFont
);
479 const vcl::Font
& GetLabelFont() const;
481 void SetRadioCheckFont( const vcl::Font
& rFont
);
482 const vcl::Font
& GetRadioCheckFont() const;
484 void SetPushButtonFont( const vcl::Font
& rFont
);
485 const vcl::Font
& GetPushButtonFont() const;
487 void SetFieldFont( const vcl::Font
& rFont
);
488 const vcl::Font
& GetFieldFont() const;
490 void SetIconFont( const vcl::Font
& rFont
);
491 const vcl::Font
& GetIconFont() const;
493 void SetTabFont( const vcl::Font
& rFont
);
494 const vcl::Font
& GetTabFont() const;
496 static tools::Long
GetBorderSize();
498 void SetTitleHeight( tools::Long nSize
);
499 tools::Long
GetTitleHeight() const;
501 void SetFloatTitleHeight( tools::Long nSize
);
502 tools::Long
GetFloatTitleHeight() const;
504 void SetScrollBarSize( tools::Long nSize
);
505 tools::Long
GetScrollBarSize() const;
507 void SetMinThumbSize( tools::Long nSize
);
508 tools::Long
GetMinThumbSize() const;
510 void SetSpinSize( tools::Long nSize
);
511 tools::Long
GetSpinSize() const;
513 static tools::Long
GetSplitSize();
515 void SetCursorSize( tools::Long nSize
);
516 tools::Long
GetCursorSize() const;
518 void SetCursorBlinkTime( sal_uInt64 nBlinkTime
);
519 sal_uInt64
GetCursorBlinkTime() const;
521 void SetDragFullOptions( DragFullOptions nOptions
);
522 DragFullOptions
GetDragFullOptions() const;
524 void SetSelectionOptions( SelectionOptions nOptions
);
525 SelectionOptions
GetSelectionOptions() const;
527 void SetDisplayOptions( DisplayOptions nOptions
);
528 DisplayOptions
GetDisplayOptions() const;
530 void SetAntialiasingMinPixelHeight( tools::Long nMinPixel
);
531 sal_uLong
GetAntialiasingMinPixelHeight() const;
533 void SetOptions( StyleSettingsOptions nOptions
);
534 StyleSettingsOptions
GetOptions() const;
536 void SetAutoMnemonic( bool bAutoMnemonic
);
537 bool GetAutoMnemonic() const;
539 static bool GetDockingFloatsSupported();
541 void SetFontColor( const Color
& rColor
);
542 const Color
& GetFontColor() const;
544 void SetToolbarIconSize( ToolbarIconSize nSize
);
545 ToolbarIconSize
GetToolbarIconSize() const;
547 /** Set the icon theme to use. */
548 void SetIconTheme(const OUString
&);
550 /** Determine which icon theme should be used.
552 * This might not be the same as the one which has been set with SetIconTheme(),
553 * e.g., if high contrast mode is enabled.
555 * (for the detailed logic @see vcl::IconThemeSelector)
557 OUString
DetermineIconTheme() const;
559 /** Obtain the list of icon themes which were found in the config folder
560 * @see vcl::IconThemeScanner for more details.
562 std::vector
<vcl::IconThemeInfo
> const & GetInstalledIconThemes() const;
564 /** Obtain the name of the icon theme which will be chosen automatically for the desktop environment.
565 * This method will only return icon themes which were actually found on the system.
567 OUString
GetAutomaticallyChosenIconTheme() const;
569 /** Set a preferred icon theme.
570 * This theme will be preferred in GetAutomaticallyChosenIconTheme()
572 void SetPreferredIconTheme(const OUString
&, bool bDarkIconTheme
= false);
574 const DialogStyle
& GetDialogStyle() const;
576 BitmapEx
const & GetPersonaHeader() const;
578 BitmapEx
const & GetPersonaFooter() const;
580 const std::optional
<Color
>& GetPersonaMenuBarTextColor() const;
582 // global switch to allow EdgeBlenging; currently possible for ValueSet and ListBox
583 // when activated there using Get/SetEdgeBlending; default is true
584 void SetEdgeBlending(sal_uInt16 nCount
);
585 sal_uInt16
GetEdgeBlending() const;
587 // TopLeft (default Color(0xC0, 0xC0, 0xC0)) and BottomRight (default Color(0x40, 0x40, 0x40))
588 // default colors for EdgeBlending
589 const Color
& GetEdgeBlendingTopLeftColor() const;
590 const Color
& GetEdgeBlendingBottomRightColor() const;
592 // maximum line count for ListBox control; to use this, call AdaptDropDownLineCountToMaximum() at the
593 // ListBox after it's ItemCount has changed/got filled. Default is 25. If more Items exist, a scrollbar
595 void SetListBoxMaximumLineCount(sal_uInt16 nCount
);
596 sal_uInt16
GetListBoxMaximumLineCount() const;
598 // maximum column count for the ColorValueSet control. Default is 12 and this is optimized for the
599 // color scheme which has 12-color aligned layout for the part taken over from Symphony. Do
600 // only change this if you know what you are doing.
601 void SetColorValueSetColumnCount(sal_uInt16 nCount
);
602 sal_uInt16
GetColorValueSetColumnCount() const;
604 // maximum row/line count for the ColorValueSet control. If more lines would be needed, a scrollbar will
606 static sal_uInt16
GetColorValueSetMaximumRowCount();
608 void SetListBoxPreviewDefaultLogicSize(Size
const & rSize
);
609 const Size
& GetListBoxPreviewDefaultPixelSize() const;
611 // the default LineWidth for ListBox UI previews (LineStyle, LineDash, LineStartEnd). Default is 1.
612 static sal_uInt16
GetListBoxPreviewDefaultLineWidth();
614 // defines if previews which contain potentially transparent objects (e.g. the dash/line/LineStartEnd previews and others)
615 // use the default transparent visualization background (checkered background) as it has got standard in graphic programs nowadays
616 void SetPreviewUsesCheckeredBackground(bool bNew
);
617 bool GetPreviewUsesCheckeredBackground() const;
619 void SetStandardStyles();
621 bool operator ==( const StyleSettings
& rSet
) const;
622 bool operator !=( const StyleSettings
& rSet
) const;
624 // Batch setters used by various backends
625 void BatchSetBackgrounds( const Color
&aBackColor
,
626 bool bCheckedColorSpecialCase
= true );
627 void BatchSetFonts( const vcl::Font
& aAppFont
,
628 const vcl::Font
& aLabelFont
);
632 class VCL_DLLPUBLIC MiscSettings
634 std::shared_ptr
<ImplMiscData
> mxData
;
640 void SetEnableATToolSupport( bool bEnable
);
642 bool GetEnableATToolSupport() const;
643 bool GetDisablePrinting() const;
644 void SetEnableLocalizedDecimalSep( bool bEnable
);
645 bool GetEnableLocalizedDecimalSep() const;
647 bool operator ==( const MiscSettings
& rSet
) const;
648 bool operator !=( const MiscSettings
& rSet
) const;
652 class VCL_DLLPUBLIC HelpSettings
654 std::shared_ptr
<ImplHelpData
> mxData
;
659 static sal_uLong
GetTipDelay();
660 void SetTipTimeout( sal_uLong nTipTimeout
);
661 sal_uLong
GetTipTimeout() const;
662 static sal_uLong
GetBalloonDelay();
664 bool operator ==( const HelpSettings
& rSet
) const;
665 bool operator !=( const HelpSettings
& rSet
) const;
669 enum class AllSettingsFlags
{
678 template<> struct typed_flags
<AllSettingsFlags
> : is_typed_flags
<AllSettingsFlags
, 0x0027> {};
681 class VCL_DLLPUBLIC AllSettings
686 std::shared_ptr
<ImplAllSettingsData
> mxData
;
691 void SetMouseSettings( const MouseSettings
& rSet
);
692 const MouseSettings
& GetMouseSettings() const;
694 void SetStyleSettings( const StyleSettings
& rSet
);
695 const StyleSettings
& GetStyleSettings() const;
697 void SetMiscSettings( const MiscSettings
& rSet
);
698 const MiscSettings
& GetMiscSettings() const;
700 void SetHelpSettings( const HelpSettings
& rSet
);
701 const HelpSettings
& GetHelpSettings() const;
703 void SetLanguageTag(const OUString
& rLanguage
, bool bCanonicalize
);
704 void SetLanguageTag( const LanguageTag
& rLanguageTag
);
705 const LanguageTag
& GetLanguageTag() const;
706 const LanguageTag
& GetUILanguageTag() const;
707 static bool GetLayoutRTL(); // returns true if UI language requires right-to-left Text Layout
708 static bool GetMathLayoutRTL(); // returns true if UI language requires right-to-left Math Layout
709 static OUString
GetUIRootDir();
710 const LocaleDataWrapper
& GetLocaleDataWrapper() const;
711 const LocaleDataWrapper
& GetUILocaleDataWrapper() const;
712 const LocaleDataWrapper
& GetNeutralLocaleDataWrapper() const;
713 const vcl::I18nHelper
& GetLocaleI18nHelper() const;
714 const vcl::I18nHelper
& GetUILocaleI18nHelper() const;
716 static AllSettingsFlags
GetWindowUpdate()
717 { return AllSettingsFlags::MOUSE
| AllSettingsFlags::STYLE
| AllSettingsFlags::MISC
| AllSettingsFlags::LOCALE
; }
719 AllSettingsFlags
Update( AllSettingsFlags nFlags
, const AllSettings
& rSettings
);
720 AllSettingsFlags
GetChangeFlags( const AllSettings
& rSettings
) const;
722 bool operator ==( const AllSettings
& rSet
) const;
723 bool operator !=( const AllSettings
& rSet
) const;
724 static void LocaleSettingsChanged( ConfigurationHints nHint
);
725 SvtSysLocale
& GetSysLocale();
728 #endif // INCLUDED_VCL_SETTINGS_HXX
730 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */