Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / vcl / settings.hxx
blob097605e7c251e80ed8d1fd3dc0bb0e59914a1939
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #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 <vcl/bitmapex.hxx>
27 #include <vcl/font.hxx>
28 #include <vcl/accel.hxx>
29 #include <vcl/wall.hxx>
30 #include <i18nlangtag/languagetag.hxx>
31 #include <unotools/syslocale.hxx>
32 #include <o3tl/typed_flags_set.hxx>
34 #include <memory>
36 namespace boost
38 template<typename T> class optional;
41 class CollatorWrapper;
42 class LocaleDataWrapper;
43 struct ImplMouseData;
44 struct ImplMiscData;
45 struct ImplHelpData;
46 struct ImplStyleData;
47 struct ImplAllSettingsData;
48 enum class ConfigurationHints;
50 namespace vcl {
51 class I18nHelper;
52 class IconThemeScanner;
53 class IconThemeSelector;
54 class IconThemeInfo;
58 enum class MouseSettingsOptions
60 NONE = 0x00,
61 AutoFocus = 0x01,
62 AutoCenterPos = 0x02,
63 AutoDefBtnPos = 0x04,
65 namespace o3tl
67 template<> struct typed_flags<MouseSettingsOptions> : is_typed_flags<MouseSettingsOptions, 0x07> {};
70 enum class MouseFollowFlags
72 Menu = 0x0001,
73 DDList = 0x0002,
75 namespace o3tl
77 template<> struct typed_flags<MouseFollowFlags> : is_typed_flags<MouseFollowFlags, 0x03> {};
80 enum class MouseMiddleButtonAction
82 Nothing, AutoScroll, PasteSelection
85 enum class MouseWheelBehaviour
87 Disable, FocusOnly, ALWAYS
90 class VCL_DLLPUBLIC MouseSettings
92 private:
93 void CopyData();
94 std::shared_ptr<ImplMouseData> mxData;
96 public:
97 MouseSettings();
99 ~MouseSettings();
101 void SetOptions( MouseSettingsOptions nOptions );
102 MouseSettingsOptions GetOptions() const;
104 void SetDoubleClickTime( sal_uInt64 nDoubleClkTime );
105 sal_uInt64 GetDoubleClickTime() const;
107 void SetDoubleClickWidth( long nDoubleClkWidth );
108 long GetDoubleClickWidth() const;
110 void SetDoubleClickHeight( long nDoubleClkHeight );
111 long GetDoubleClickHeight() const;
113 void SetStartDragWidth( long nDragWidth );
114 long GetStartDragWidth() const;
116 void SetStartDragHeight( long nDragHeight );
117 long GetStartDragHeight() const;
119 sal_uInt16 GetStartDragCode() const;
121 sal_uInt16 GetContextMenuCode() const;
123 sal_uInt16 GetContextMenuClicks() const;
125 sal_uLong GetScrollRepeat() const;
127 sal_uLong GetButtonStartRepeat() const;
129 void SetButtonRepeat( sal_uLong nRepeat );
130 sal_uLong GetButtonRepeat() const;
132 sal_uLong GetActionDelay() const;
134 void SetMenuDelay( sal_uLong nDelay );
135 sal_uLong GetMenuDelay() const;
137 void SetFollow( MouseFollowFlags nFollow );
138 MouseFollowFlags GetFollow() const;
140 void SetMiddleButtonAction( MouseMiddleButtonAction nAction );
141 MouseMiddleButtonAction GetMiddleButtonAction() const;
143 void SetWheelBehavior( MouseWheelBehaviour nBehavior );
144 MouseWheelBehaviour GetWheelBehavior() const;
146 bool operator ==( const MouseSettings& rSet ) const;
147 bool operator !=( const MouseSettings& rSet ) const;
150 struct DialogStyle
152 int content_area_border;
153 int content_area_spacing;
154 int button_spacing;
155 int action_area_border;
156 DialogStyle()
157 : content_area_border(2)
158 , content_area_spacing(0)
159 , button_spacing(6)
160 , action_area_border(5)
164 struct FrameStyle
166 int left;
167 int right;
168 int top;
169 int bottom;
170 FrameStyle()
171 : left(0)
172 , right(0)
173 , top(0)
174 , bottom(0)
179 enum class StyleSettingsOptions
181 NONE = 0x0000,
182 Mono = 0x0001,
183 NoMnemonics = 0x0002,
185 namespace o3tl
187 template<> struct typed_flags<StyleSettingsOptions> : is_typed_flags<StyleSettingsOptions, 0x0003> {};
190 enum class DragFullOptions
192 NONE = 0x0000,
193 WindowMove = 0x0001,
194 WindowSize = 0x0002,
195 Docking = 0x0010,
196 Split = 0x0020,
197 Scroll = 0x0040,
198 All = WindowMove | WindowSize | Docking | Split | Scroll,
200 namespace o3tl
202 template<> struct typed_flags<DragFullOptions> : is_typed_flags<DragFullOptions, 0x0073> {};
205 enum class SelectionOptions
207 NONE = 0x0000,
208 Focus = 0x0001,
209 Invert = 0x0002,
210 ShowFirst = 0x0004,
212 namespace o3tl
214 template<> struct typed_flags<SelectionOptions> : is_typed_flags<SelectionOptions, 0x0007> {};
217 enum class DisplayOptions
219 NONE = 0x0000,
220 AADisable = 0x0001,
222 namespace o3tl
224 template<> struct typed_flags<DisplayOptions> : is_typed_flags<DisplayOptions, 0x0001> {};
227 enum class ToolbarIconSize
229 Unknown = 0,
230 Small = 1, // unused
231 Large = 2,
232 Size32 = 3,
235 #define STYLE_CURSOR_NOBLINKTIME SAL_MAX_UINT64
237 class VCL_DLLPUBLIC StyleSettings
239 void CopyData();
241 private:
242 std::shared_ptr<ImplStyleData> mxData;
244 public:
245 StyleSettings();
246 ~StyleSettings();
248 void Set3DColors( const Color& rColor );
250 void SetFaceColor( const Color& rColor );
251 const Color& GetFaceColor() const;
253 Color GetFaceGradientColor() const;
255 Color GetSeparatorColor() const;
257 void SetCheckedColor( const Color& rColor );
258 void SetCheckedColorSpecialCase( );
259 const Color& GetCheckedColor() const;
261 void SetLightColor( const Color& rColor );
262 const Color& GetLightColor() const;
264 void SetLightBorderColor( const Color& rColor );
265 const Color& GetLightBorderColor() const;
267 void SetShadowColor( const Color& rColor );
268 const Color& GetShadowColor() const;
270 void SetDarkShadowColor( const Color& rColor );
271 const Color& GetDarkShadowColor() const;
273 void SetButtonTextColor( const Color& rColor );
274 const Color& GetButtonTextColor() const;
276 void SetButtonRolloverTextColor( const Color& rColor );
277 const Color& GetButtonRolloverTextColor() const;
279 void SetRadioCheckTextColor( const Color& rColor );
280 const Color& GetRadioCheckTextColor() const;
282 void SetGroupTextColor( const Color& rColor );
283 const Color& GetGroupTextColor() const;
285 void SetLabelTextColor( const Color& rColor );
286 const Color& GetLabelTextColor() const;
288 void SetWindowColor( const Color& rColor );
289 const Color& GetWindowColor() const;
291 void SetWindowTextColor( const Color& rColor );
292 const Color& GetWindowTextColor() const;
294 void SetDialogColor( const Color& rColor );
295 const Color& GetDialogColor() const;
297 void SetDialogTextColor( const Color& rColor );
298 const Color& GetDialogTextColor() const;
300 void SetWorkspaceColor( const Color& rColor );
301 const Color& GetWorkspaceColor() const;
303 void SetFieldColor( const Color& rColor );
304 const Color& GetFieldColor() const;
306 void SetFieldTextColor( const Color& rColor );
307 const Color& GetFieldTextColor() const;
309 void SetFieldRolloverTextColor( const Color& rColor );
310 const Color& GetFieldRolloverTextColor() const;
312 void SetActiveColor( const Color& rColor );
313 const Color& GetActiveColor() const;
315 void SetActiveTextColor( const Color& rColor );
316 const Color& GetActiveTextColor() const;
318 void SetActiveBorderColor( const Color& rColor );
319 const Color& GetActiveBorderColor() const;
321 void SetDeactiveColor( const Color& rColor );
322 const Color& GetDeactiveColor() const;
324 void SetDeactiveTextColor( const Color& rColor );
325 const Color& GetDeactiveTextColor() const;
327 void SetDeactiveBorderColor( const Color& rColor );
328 const Color& GetDeactiveBorderColor() const;
330 void SetHighlightColor( const Color& rColor );
331 const Color& GetHighlightColor() const;
333 void SetHighlightTextColor( const Color& rColor );
334 const Color& GetHighlightTextColor() const;
336 void SetDisableColor( const Color& rColor );
337 const Color& GetDisableColor() const;
339 void SetHelpColor( const Color& rColor );
340 const Color& GetHelpColor() const;
342 void SetHelpTextColor( const Color& rColor );
343 const Color& GetHelpTextColor() const;
345 void SetMenuColor( const Color& rColor );
346 const Color& GetMenuColor() const;
348 void SetMenuBarColor( const Color& rColor );
349 const Color& GetMenuBarColor() const;
351 void SetMenuBarRolloverColor( const Color& rColor );
352 const Color& GetMenuBarRolloverColor() const;
354 void SetMenuBorderColor( const Color& rColor );
355 const Color& GetMenuBorderColor() const;
357 void SetMenuTextColor( const Color& rColor );
358 const Color& GetMenuTextColor() const;
360 void SetMenuBarTextColor( const Color& rColor );
361 const Color& GetMenuBarTextColor() const;
363 void SetMenuBarRolloverTextColor( const Color& rColor );
364 const Color& GetMenuBarRolloverTextColor() const;
366 void SetMenuBarHighlightTextColor( const Color& rColor );
367 const Color& GetMenuBarHighlightTextColor() const;
369 void SetMenuHighlightColor( const Color& rColor );
370 const Color& GetMenuHighlightColor() const;
372 void SetMenuHighlightTextColor( const Color& rColor );
373 const Color& GetMenuHighlightTextColor() const;
375 void SetTabTextColor( const Color& rColor );
376 const Color& GetTabTextColor() const;
378 void SetTabRolloverTextColor( const Color& rColor );
379 const Color& GetTabRolloverTextColor() const;
381 void SetTabHighlightTextColor( const Color& rColor );
382 const Color& GetTabHighlightTextColor() const;
384 void SetToolTextColor( const Color& rColor );
385 const Color& GetToolTextColor() const;
387 void SetLinkColor( const Color& rColor );
388 const Color& GetLinkColor() const;
390 void SetVisitedLinkColor( const Color& rColor );
391 const Color& GetVisitedLinkColor() const;
393 const Color& GetHighlightLinkColor() const;
395 void SetMonoColor( const Color& rColor );
396 const Color& GetMonoColor() const;
398 void SetActiveTabColor( const Color& rColor );
399 const Color& GetActiveTabColor() const;
401 void SetInactiveTabColor( const Color& rColor );
402 const Color& GetInactiveTabColor() const;
404 const Color& GetAlternatingRowColor() const;
406 void SetHighContrastMode(bool bHighContrast );
407 bool GetHighContrastMode() const;
409 void SetUseSystemUIFonts( bool bUseSystemUIFonts );
410 bool GetUseSystemUIFonts() const;
412 void SetUseFlatBorders( bool bUseFlatBorders );
413 bool GetUseFlatBorders() const;
415 void SetUseFlatMenus( bool bUseFlatMenus );
416 bool GetUseFlatMenus() const;
418 void SetUseImagesInMenus( TriState eUseImagesInMenus );
419 bool GetUseImagesInMenus() const;
421 void SetPreferredUseImagesInMenus( bool bPreferredUseImagesInMenus );
422 bool GetPreferredUseImagesInMenus() const;
424 void SetSkipDisabledInMenus( bool bSkipDisabledInMenus );
425 bool GetSkipDisabledInMenus() const;
427 void SetHideDisabledMenuItems( bool bHideDisabledMenuItems );
428 bool GetHideDisabledMenuItems() const;
430 void SetContextMenuShortcuts( TriState eContextMenuShortcuts );
431 bool GetContextMenuShortcuts() const;
433 void SetPreferredContextMenuShortcuts( bool bContextMenuShortcuts );
434 bool GetPreferredContextMenuShortcuts() const;
436 void SetPrimaryButtonWarpsSlider( bool bPrimaryButtonWarpsSlider );
437 bool GetPrimaryButtonWarpsSlider() const;
439 void SetAppFont( const vcl::Font& rFont );
440 const vcl::Font& GetAppFont() const;
442 void SetHelpFont( const vcl::Font& rFont );
443 const vcl::Font& GetHelpFont() const;
445 void SetTitleFont( const vcl::Font& rFont );
446 const vcl::Font& GetTitleFont() const;
448 void SetFloatTitleFont( const vcl::Font& rFont );
449 const vcl::Font& GetFloatTitleFont() const;
451 void SetMenuFont( const vcl::Font& rFont );
452 const vcl::Font& GetMenuFont() const;
454 void SetToolFont( const vcl::Font& rFont );
455 const vcl::Font& GetToolFont() const;
457 void SetGroupFont( const vcl::Font& rFont );
458 const vcl::Font& GetGroupFont() const;
460 void SetLabelFont( const vcl::Font& rFont );
461 const vcl::Font& GetLabelFont() const;
463 void SetRadioCheckFont( const vcl::Font& rFont );
464 const vcl::Font& GetRadioCheckFont() const;
466 void SetPushButtonFont( const vcl::Font& rFont );
467 const vcl::Font& GetPushButtonFont() const;
469 void SetFieldFont( const vcl::Font& rFont );
470 const vcl::Font& GetFieldFont() const;
472 void SetIconFont( const vcl::Font& rFont );
473 const vcl::Font& GetIconFont() const;
475 void SetTabFont( const vcl::Font& rFont );
476 const vcl::Font& GetTabFont() const;
478 long GetBorderSize() const;
480 void SetTitleHeight( long nSize );
481 long GetTitleHeight() const;
483 void SetFloatTitleHeight( long nSize );
484 long GetFloatTitleHeight() const;
486 long GetTearOffTitleHeight() const;
488 void SetScrollBarSize( long nSize );
489 long GetScrollBarSize() const;
491 void SetMinThumbSize( long nSize );
492 long GetMinThumbSize() const;
494 void SetSpinSize( long nSize );
495 long GetSpinSize() const;
497 long GetSplitSize() const;
499 void SetCursorSize( long nSize );
500 long GetCursorSize() const;
502 void SetCursorBlinkTime( sal_uInt64 nBlinkTime );
503 sal_uInt64 GetCursorBlinkTime() const;
505 void SetDragFullOptions( DragFullOptions nOptions );
506 DragFullOptions GetDragFullOptions() const;
508 void SetSelectionOptions( SelectionOptions nOptions );
509 SelectionOptions GetSelectionOptions() const;
511 void SetDisplayOptions( DisplayOptions nOptions );
512 DisplayOptions GetDisplayOptions() const;
514 void SetAntialiasingMinPixelHeight( long nMinPixel );
515 sal_uLong GetAntialiasingMinPixelHeight() const;
517 void SetOptions( StyleSettingsOptions nOptions );
518 StyleSettingsOptions GetOptions() const;
520 void SetAutoMnemonic( bool bAutoMnemonic );
521 bool GetAutoMnemonic() const;
523 static bool GetDockingFloatsSupported();
525 void SetFontColor( const Color& rColor );
526 const Color& GetFontColor() const;
528 void SetToolbarIconSize( ToolbarIconSize nSize );
529 ToolbarIconSize GetToolbarIconSize() const;
531 /** Set the icon theme to use. */
532 void SetIconTheme(const OUString&);
534 /** Determine which icon theme should be used.
536 * This might not be the same as the one which has been set with SetIconTheme(),
537 * e.g., if high contrast mode is enabled.
539 * (for the detailed logic @see vcl::IconThemeSelector)
541 OUString DetermineIconTheme() const;
543 /** Obtain the list of icon themes which were found in the config folder
544 * @see vcl::IconThemeScanner for more details.
546 std::vector<vcl::IconThemeInfo> GetInstalledIconThemes() const;
548 /** Obtain the name of the icon theme which will be chosen automatically for the desktop environment.
549 * This method will only return icon themes which were actually found on the system.
551 OUString GetAutomaticallyChosenIconTheme() const;
553 /** Set a preferred icon theme.
554 * This theme will be preferred in GetAutomaticallyChosenIconTheme()
556 void SetPreferredIconTheme(const OUString&, bool bDarkIconTheme = false);
558 const DialogStyle& GetDialogStyle() const;
559 void SetDialogStyle( const DialogStyle& rStyle );
561 const FrameStyle& GetFrameStyle() const;
562 void SetFrameStyle( const FrameStyle& rStyle );
564 const BitmapEx GetPersonaHeader() const;
566 const BitmapEx GetPersonaFooter() const;
568 const boost::optional<Color>& GetPersonaMenuBarTextColor() const;
570 // global switch to allow EdgeBlenging; currently possible for ValueSet and ListBox
571 // when activated there using Get/SetEdgeBlending; default is true
572 void SetEdgeBlending(sal_uInt16 nCount);
573 sal_uInt16 GetEdgeBlending() const;
575 // TopLeft (default RGB_COLORDATA(0xC0, 0xC0, 0xC0)) and BottomRight (default RGB_COLORDATA(0x40, 0x40, 0x40))
576 // default colors for EdgeBlending
577 const Color& GetEdgeBlendingTopLeftColor() const;
578 const Color& GetEdgeBlendingBottomRightColor() const;
580 // maximum line count for ListBox control; to use this, call AdaptDropDownLineCountToMaximum() at the
581 // ListBox after it's ItemCount has changed/got filled. Default is 25. If more Items exist, a scrollbar
582 // will be used
583 void SetListBoxMaximumLineCount(sal_uInt16 nCount);
584 sal_uInt16 GetListBoxMaximumLineCount() const;
586 // maximum column count for the ColorValueSet control. Default is 12 and this is optimized for the
587 // color scheme which has 12-color aligned layout for the part taken over from Symphony. Do
588 // only change this if you know what you are doing.
589 void SetColorValueSetColumnCount(sal_uInt16 nCount);
590 sal_uInt16 GetColorValueSetColumnCount() const;
592 // maximum row/line count for the ColorValueSet control. If more lines would be needed, a scrollbar will
593 // be used.
594 sal_uInt16 GetColorValueSetMaximumRowCount() const;
596 const Size& GetListBoxPreviewDefaultPixelSize() const;
598 // the default LineWidth for ListBox UI previews (LineStyle, LineDash, LineStartEnd). Default is 1.
599 sal_uInt16 GetListBoxPreviewDefaultLineWidth() const;
601 // defines if previews which contain potentially transparent objects (e.g. the dash/line/LineStartEnd previews and others)
602 // use the default transparent visualization background (checkered background) as it has got standard in graphic programs nowadays
603 void SetPreviewUsesCheckeredBackground(bool bNew);
604 bool GetPreviewUsesCheckeredBackground() const;
606 void SetStandardStyles();
608 bool operator ==( const StyleSettings& rSet ) const;
609 bool operator !=( const StyleSettings& rSet ) const;
613 class VCL_DLLPUBLIC MiscSettings
615 std::shared_ptr<ImplMiscData> mxData;
617 public:
618 MiscSettings();
619 ~MiscSettings();
621 #ifdef _WIN32
622 void SetEnableATToolSupport( bool bEnable );
623 #endif
624 bool GetEnableATToolSupport() const;
625 bool GetDisablePrinting() const;
626 void SetEnableLocalizedDecimalSep( bool bEnable );
627 bool GetEnableLocalizedDecimalSep() const;
628 bool GetPseudoHeadless() const;
630 bool operator ==( const MiscSettings& rSet ) const;
631 bool operator !=( const MiscSettings& rSet ) const;
635 class VCL_DLLPUBLIC HelpSettings
637 std::shared_ptr<ImplHelpData> mxData;
639 public:
640 HelpSettings();
641 ~HelpSettings();
643 sal_uLong GetTipDelay() const;
644 void SetTipTimeout( sal_uLong nTipTimeout );
645 sal_uLong GetTipTimeout() const;
646 sal_uLong GetBalloonDelay() const;
648 bool operator ==( const HelpSettings& rSet ) const;
649 bool operator !=( const HelpSettings& rSet ) const;
653 enum class AllSettingsFlags {
654 NONE = 0x0000,
655 MOUSE = 0x0001,
656 STYLE = 0x0002,
657 MISC = 0x0004,
658 LOCALE = 0x0020,
660 namespace o3tl
662 template<> struct typed_flags<AllSettingsFlags> : is_typed_flags<AllSettingsFlags, 0x0027> {};
665 class VCL_DLLPUBLIC AllSettings
667 private:
668 void CopyData();
670 std::shared_ptr<ImplAllSettingsData> mxData;
672 public:
673 AllSettings();
674 AllSettings( const AllSettings& rSet );
675 ~AllSettings();
677 void SetMouseSettings( const MouseSettings& rSet );
678 const MouseSettings& GetMouseSettings() const;
680 void SetStyleSettings( const StyleSettings& rSet );
681 const StyleSettings& GetStyleSettings() const;
683 void SetMiscSettings( const MiscSettings& rSet );
684 const MiscSettings& GetMiscSettings() const;
686 void SetHelpSettings( const HelpSettings& rSet );
687 const HelpSettings& GetHelpSettings() const;
689 void SetLanguageTag( const LanguageTag& rLanguageTag );
690 const LanguageTag& GetLanguageTag() const;
691 const LanguageTag& GetUILanguageTag() const;
692 static bool GetLayoutRTL(); // returns true if UI language requires right-to-left Text Layout
693 static bool GetMathLayoutRTL(); // returns true if UI language requires right-to-left Math Layout
694 const LocaleDataWrapper& GetLocaleDataWrapper() const;
695 const LocaleDataWrapper& GetUILocaleDataWrapper() const;
696 const vcl::I18nHelper& GetLocaleI18nHelper() const;
697 const vcl::I18nHelper& GetUILocaleI18nHelper() const;
699 AllSettingsFlags GetWindowUpdate() const;
701 AllSettingsFlags Update( AllSettingsFlags nFlags, const AllSettings& rSettings );
702 AllSettingsFlags GetChangeFlags( const AllSettings& rSettings ) const;
704 bool operator ==( const AllSettings& rSet ) const;
705 bool operator !=( const AllSettings& rSet ) const;
706 static void LocaleSettingsChanged( ConfigurationHints nHint );
707 SvtSysLocale& GetSysLocale();
710 #endif // INCLUDED_VCL_SETTINGS_HXX
712 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */