Branch libreoffice-5-0-4
[LibreOffice.git] / include / vcl / settings.hxx
blob006e758be57928438d15f1e34e1063dc9993a3ca
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 <boost/optional.hpp>
35 #include <memory>
37 class CollatorWrapper;
38 class LocaleDataWrapper;
39 struct ImplMouseData;
40 struct ImplMiscData;
41 struct ImplHelpData;
42 struct ImplStyleData;
43 struct ImplAllSettingsData;
45 namespace vcl {
46 class I18nHelper;
47 class IconThemeScanner;
48 class IconThemeSelector;
49 class IconThemeInfo;
52 // - MouseSettings -
54 enum class MouseSettingsOptions
56 NONE = 0x00,
57 AutoFocus = 0x01,
58 AutoCenterPos = 0x02,
59 AutoDefBtnPos = 0x04,
61 namespace o3tl
63 template<> struct typed_flags<MouseSettingsOptions> : is_typed_flags<MouseSettingsOptions, 0x07> {};
66 enum class MouseFollowFlags
68 Menu = 0x0001,
69 DDList = 0x0002,
71 namespace o3tl
73 template<> struct typed_flags<MouseFollowFlags> : is_typed_flags<MouseFollowFlags, 0x03> {};
76 enum class MouseMiddleButtonAction
78 Nothing, AutoScroll, PasteSelection
81 enum class MouseWheelBehaviour
83 Disable, FocusOnly, ALWAYS
86 class VCL_DLLPUBLIC MouseSettings
88 private:
89 void CopyData();
90 std::shared_ptr<ImplMouseData> mxData;
92 public:
93 MouseSettings();
95 ~MouseSettings();
97 void SetOptions( MouseSettingsOptions nOptions );
98 MouseSettingsOptions GetOptions() const;
100 void SetDoubleClickTime( sal_uInt64 nDoubleClkTime );
101 sal_uInt64 GetDoubleClickTime() const;
103 void SetDoubleClickWidth( long nDoubleClkWidth );
104 long GetDoubleClickWidth() const;
106 void SetDoubleClickHeight( long nDoubleClkHeight );
107 long GetDoubleClickHeight() const;
109 void SetStartDragWidth( long nDragWidth );
110 long GetStartDragWidth() const;
112 void SetStartDragHeight( long nDragHeight );
113 long GetStartDragHeight() const;
115 sal_uInt16 GetStartDragCode() const;
117 sal_uInt16 GetContextMenuCode() const;
119 sal_uInt16 GetContextMenuClicks() const;
121 sal_uLong GetScrollRepeat() const;
123 sal_uLong GetButtonStartRepeat() const;
125 void SetButtonRepeat( sal_uLong nRepeat );
126 sal_uLong GetButtonRepeat() const;
128 sal_uLong GetActionDelay() const;
130 void SetMenuDelay( sal_uLong nDelay );
131 sal_uLong GetMenuDelay() const;
133 void SetFollow( MouseFollowFlags nFollow );
134 MouseFollowFlags GetFollow() const;
136 void SetMiddleButtonAction( MouseMiddleButtonAction nAction );
137 MouseMiddleButtonAction GetMiddleButtonAction() const;
139 void SetWheelBehavior( MouseWheelBehaviour nBehavior );
140 MouseWheelBehaviour GetWheelBehavior() const;
142 bool operator ==( const MouseSettings& rSet ) const;
143 bool operator !=( const MouseSettings& rSet ) const;
146 struct DialogStyle
148 int content_area_border;
149 int content_area_spacing;
150 int button_spacing;
151 int action_area_border;
152 DialogStyle()
153 : content_area_border(2)
154 , content_area_spacing(0)
155 , button_spacing(6)
156 , action_area_border(5)
160 struct FrameStyle
162 int left;
163 int right;
164 int top;
165 int bottom;
166 FrameStyle()
167 : left(0)
168 , right(0)
169 , top(0)
170 , bottom(0)
176 // - StyleSettings -
179 enum class StyleSettingsOptions
181 NONE = 0x0000,
182 Mono = 0x0001,
183 Color = 0x0002,
184 Flat = 0x0004,
185 Great = 0x0008,
186 Highlight = 0x0010,
187 AdvancedUser = 0x0020,
188 ScrollArrow = 0x0040,
189 SpinArrow = 0x0080,
190 SpinUpDown = 0x0100,
191 NoMnemonics = 0x0200,
193 namespace o3tl
195 template<> struct typed_flags<StyleSettingsOptions> : is_typed_flags<StyleSettingsOptions, 0x03ff> {};
198 enum class DragFullOptions
200 NONE = 0x0000,
201 WindowMove = 0x0001,
202 WindowSize = 0x0002,
203 Docking = 0x0010,
204 Split = 0x0020,
205 Scroll = 0x0040,
206 All = WindowMove | WindowSize | Docking | Split | Scroll,
208 namespace o3tl
210 template<> struct typed_flags<DragFullOptions> : is_typed_flags<DragFullOptions, 0x0073> {};
213 enum class SelectionOptions
215 NONE = 0x0000,
216 Word = 0x0001,
217 Focus = 0x0002,
218 Invert = 0x0004,
219 ShowFirst = 0x0008,
221 namespace o3tl
223 template<> struct typed_flags<SelectionOptions> : is_typed_flags<SelectionOptions, 0x000f> {};
226 enum class DisplayOptions
228 NONE = 0x0000,
229 AADisable = 0x0001,
231 namespace o3tl
233 template<> struct typed_flags<DisplayOptions> : is_typed_flags<DisplayOptions, 0x0001> {};
236 enum class ToolbarIconSize
238 Unknown = 0,
239 Small = 1,
240 Large = 2,
243 #define STYLE_CURSOR_NOBLINKTIME SAL_MAX_UINT64
245 class VCL_DLLPUBLIC StyleSettings
247 void CopyData();
249 private:
250 std::shared_ptr<ImplStyleData> mxData;
252 public:
253 StyleSettings();
254 ~StyleSettings();
256 void Set3DColors( const Color& rColor );
258 void SetFaceColor( const Color& rColor );
259 const Color& GetFaceColor() const;
261 Color GetFaceGradientColor() const;
263 Color GetSeparatorColor() const;
265 void SetCheckedColor( const Color& rColor );
266 void SetCheckedColorSpecialCase( );
267 const Color& GetCheckedColor() const;
269 void SetLightColor( const Color& rColor );
270 const Color& GetLightColor() const;
272 void SetLightBorderColor( const Color& rColor );
273 const Color& GetLightBorderColor() const;
275 void SetShadowColor( const Color& rColor );
276 const Color& GetShadowColor() const;
278 void SetDarkShadowColor( const Color& rColor );
279 const Color& GetDarkShadowColor() const;
281 void SetButtonTextColor( const Color& rColor );
282 const Color& GetButtonTextColor() const;
284 void SetButtonRolloverTextColor( const Color& rColor );
285 const Color& GetButtonRolloverTextColor() const;
287 void SetRadioCheckTextColor( const Color& rColor );
288 const Color& GetRadioCheckTextColor() const;
290 void SetGroupTextColor( const Color& rColor );
291 const Color& GetGroupTextColor() const;
293 void SetLabelTextColor( const Color& rColor );
294 const Color& GetLabelTextColor() const;
296 void SetInfoTextColor( const Color& rColor );
297 const Color& GetInfoTextColor() const;
299 void SetWindowColor( const Color& rColor );
300 const Color& GetWindowColor() const;
302 void SetWindowTextColor( const Color& rColor );
303 const Color& GetWindowTextColor() const;
305 void SetDialogColor( const Color& rColor );
306 const Color& GetDialogColor() const;
308 void SetDialogTextColor( const Color& rColor );
309 const Color& GetDialogTextColor() const;
311 void SetWorkspaceColor( const Color& rColor );
312 const Color& GetWorkspaceColor() const;
314 void SetFieldColor( const Color& rColor );
315 const Color& GetFieldColor() const;
317 void SetFieldTextColor( const Color& rColor );
318 const Color& GetFieldTextColor() const;
320 void SetFieldRolloverTextColor( const Color& rColor );
321 const Color& GetFieldRolloverTextColor() const;
323 void SetActiveColor( const Color& rColor );
324 const Color& GetActiveColor() const;
326 void SetActiveTextColor( const Color& rColor );
327 const Color& GetActiveTextColor() const;
329 void SetActiveBorderColor( const Color& rColor );
330 const Color& GetActiveBorderColor() const;
332 void SetDeactiveColor( const Color& rColor );
333 const Color& GetDeactiveColor() const;
335 void SetDeactiveTextColor( const Color& rColor );
336 const Color& GetDeactiveTextColor() const;
338 void SetDeactiveBorderColor( const Color& rColor );
339 const Color& GetDeactiveBorderColor() const;
341 void SetHighlightColor( const Color& rColor );
342 const Color& GetHighlightColor() const;
344 void SetHighlightTextColor( const Color& rColor );
345 const Color& GetHighlightTextColor() const;
347 void SetDisableColor( const Color& rColor );
348 const Color& GetDisableColor() const;
350 void SetHelpColor( const Color& rColor );
351 const Color& GetHelpColor() const;
353 void SetHelpTextColor( const Color& rColor );
354 const Color& GetHelpTextColor() const;
356 void SetMenuColor( const Color& rColor );
357 const Color& GetMenuColor() const;
359 void SetMenuBarColor( const Color& rColor );
360 const Color& GetMenuBarColor() const;
362 void SetMenuBarRolloverColor( const Color& rColor );
363 const Color& GetMenuBarRolloverColor() const;
365 void SetMenuBorderColor( const Color& rColor );
366 const Color& GetMenuBorderColor() const;
368 void SetMenuTextColor( const Color& rColor );
369 const Color& GetMenuTextColor() const;
371 void SetMenuBarTextColor( const Color& rColor );
372 const Color& GetMenuBarTextColor() const;
374 void SetMenuBarRolloverTextColor( const Color& rColor );
375 const Color& GetMenuBarRolloverTextColor() const;
377 void SetMenuBarHighlightTextColor( const Color& rColor );
378 const Color& GetMenuBarHighlightTextColor() const;
380 void SetMenuHighlightColor( const Color& rColor );
381 const Color& GetMenuHighlightColor() const;
383 void SetMenuHighlightTextColor( const Color& rColor );
384 const Color& GetMenuHighlightTextColor() const;
386 void SetTabTextColor( const Color& rColor );
387 const Color& GetTabTextColor() const;
389 void SetTabRolloverTextColor( const Color& rColor );
390 const Color& GetTabRolloverTextColor() const;
392 void SetTabHighlightTextColor( const Color& rColor );
393 const Color& GetTabHighlightTextColor() const;
395 void SetLinkColor( const Color& rColor );
396 const Color& GetLinkColor() const;
398 void SetVisitedLinkColor( const Color& rColor );
399 const Color& GetVisitedLinkColor() const;
401 const Color& GetHighlightLinkColor() const;
403 void SetMonoColor( const Color& rColor );
404 const Color& GetMonoColor() const;
406 void SetActiveTabColor( const Color& rColor );
407 const Color& GetActiveTabColor() const;
409 void SetInactiveTabColor( const Color& rColor );
410 const Color& GetInactiveTabColor() const;
412 void SetAlternatingRowColor( const Color& rColor );
413 const Color& GetAlternatingRowColor() const;
415 void SetHighContrastMode(bool bHighContrast );
416 bool GetHighContrastMode() const;
418 void SetUseSystemUIFonts( bool bUseSystemUIFonts );
419 bool GetUseSystemUIFonts() const;
421 void SetUseFlatBorders( bool bUseFlatBorders );
422 bool GetUseFlatBorders() const;
424 void SetUseFlatMenus( bool bUseFlatMenus );
425 bool GetUseFlatMenus() const;
427 void SetUseImagesInMenus( TriState eUseImagesInMenus );
428 bool GetUseImagesInMenus() const;
430 void SetPreferredUseImagesInMenus( bool bPreferredUseImagesInMenus );
431 bool GetPreferredUseImagesInMenus() const;
433 void SetSkipDisabledInMenus( bool bSkipDisabledInMenus );
434 bool GetSkipDisabledInMenus() const;
436 void SetHideDisabledMenuItems( bool bHideDisabledMenuItems );
437 bool GetHideDisabledMenuItems() const;
439 void SetAcceleratorsInContextMenus( bool bAcceleratorsInContextMenus );
440 bool GetAcceleratorsInContextMenus() const;
442 void SetPrimaryButtonWarpsSlider( bool bPrimaryButtonWarpsSlider );
443 bool GetPrimaryButtonWarpsSlider() const;
445 void SetCairoFontOptions( const void *pOptions );
446 const void* GetCairoFontOptions() const;
448 void SetAppFont( const vcl::Font& rFont );
449 const vcl::Font& GetAppFont() const;
451 void SetHelpFont( const vcl::Font& rFont );
452 const vcl::Font& GetHelpFont() const;
454 void SetTitleFont( const vcl::Font& rFont );
455 const vcl::Font& GetTitleFont() const;
457 void SetFloatTitleFont( const vcl::Font& rFont );
458 const vcl::Font& GetFloatTitleFont() const;
460 void SetMenuFont( const vcl::Font& rFont );
461 const vcl::Font& GetMenuFont() const;
463 void SetToolFont( const vcl::Font& rFont );
464 const vcl::Font& GetToolFont() const;
466 void SetGroupFont( const vcl::Font& rFont );
467 const vcl::Font& GetGroupFont() const;
469 void SetLabelFont( const vcl::Font& rFont );
470 const vcl::Font& GetLabelFont() const;
472 void SetInfoFont( const vcl::Font& rFont );
473 const vcl::Font& GetInfoFont() const;
475 void SetRadioCheckFont( const vcl::Font& rFont );
476 const vcl::Font& GetRadioCheckFont() const;
478 void SetPushButtonFont( const vcl::Font& rFont );
479 const vcl::Font& GetPushButtonFont() const;
481 void SetFieldFont( const vcl::Font& rFont );
482 const vcl::Font& GetFieldFont() const;
484 void SetIconFont( const vcl::Font& rFont );
485 const vcl::Font& GetIconFont() const;
487 void SetTabFont( const vcl::Font& rFont );
488 const vcl::Font& GetTabFont() const;
490 long GetBorderSize() const;
492 void SetTitleHeight( long nSize );
493 long GetTitleHeight() const;
495 void SetFloatTitleHeight( long nSize );
496 long GetFloatTitleHeight() const;
498 long GetTearOffTitleHeight() const;
500 void SetScrollBarSize( long nSize );
501 long GetScrollBarSize() const;
503 void SetMinThumbSize( long nSize );
504 long GetMinThumbSize() const;
506 void SetSpinSize( long nSize );
507 long GetSpinSize() const;
509 long GetSplitSize() const;
511 void SetCursorSize( long nSize );
512 long GetCursorSize() const;
514 void SetCursorBlinkTime( sal_uInt64 nBlinkTime );
515 sal_uInt64 GetCursorBlinkTime() const;
517 void SetScreenZoom( sal_uInt16 nPercent );
518 sal_uInt16 GetScreenZoom() const;
520 void SetScreenFontZoom( sal_uInt16 nPercent );
521 sal_uInt16 GetScreenFontZoom() const;
523 void SetDragFullOptions( DragFullOptions nOptions );
524 DragFullOptions GetDragFullOptions() const;
526 void SetSelectionOptions( SelectionOptions nOptions );
527 SelectionOptions GetSelectionOptions() const;
529 void SetDisplayOptions( DisplayOptions nOptions );
530 DisplayOptions GetDisplayOptions() const;
532 void SetAntialiasingMinPixelHeight( long nMinPixel );
533 sal_uLong GetAntialiasingMinPixelHeight() const;
535 void SetOptions( StyleSettingsOptions nOptions );
536 StyleSettingsOptions GetOptions() const;
538 void SetAutoMnemonic( bool bAutoMnemonic );
539 bool GetAutoMnemonic() const;
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> 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&);
574 const DialogStyle& GetDialogStyle() const;
575 void SetDialogStyle( const DialogStyle& rStyle );
577 const FrameStyle& GetFrameStyle() const;
578 void SetFrameStyle( const FrameStyle& rStyle );
580 const BitmapEx GetPersonaHeader() const;
582 const BitmapEx GetPersonaFooter() const;
584 const boost::optional<Color>& GetPersonaMenuBarTextColor() const;
586 // global switch to allow EdgeBlenging; currently possible for ValueSet and ListBox
587 // when activated there using Get/SetEdgeBlending; default is true
588 void SetEdgeBlending(sal_uInt16 nCount);
589 sal_uInt16 GetEdgeBlending() const;
591 // TopLeft (default RGB_COLORDATA(0xC0, 0xC0, 0xC0)) and BottomRight (default RGB_COLORDATA(0x40, 0x40, 0x40))
592 // default colors for EdgeBlending
593 const Color& GetEdgeBlendingTopLeftColor() const;
594 const Color& GetEdgeBlendingBottomRightColor() const;
596 // maximum line count for ListBox control; to use this, call AdaptDropDownLineCountToMaximum() at the
597 // ListBox after it's ItemCount has changed/got filled. Default is 25. If more Items exist, a scrollbar
598 // will be used
599 void SetListBoxMaximumLineCount(sal_uInt16 nCount);
600 sal_uInt16 GetListBoxMaximumLineCount() const;
602 // maximum column count for the ColorValueSet control. Default is 12 and this is optimized for the
603 // color scheme which has 12-color alogned layout for the part taken over from Symphony. Do
604 // only change this if you know what you are doing.
605 void SetColorValueSetColumnCount(sal_uInt16 nCount);
606 sal_uInt16 GetColorValueSetColumnCount() const;
608 // maximum row/line count for the ColorValueSet control. If more lines would be needed, a scrollbar will
609 // be used. Default is 40.
610 sal_uInt16 GetColorValueSetMaximumRowCount() const;
612 const Size& GetListBoxPreviewDefaultPixelSize() const;
614 // the default LineWidth for ListBox UI previews (LineStyle, LineDash, LineStartEnd). Default is 1.
615 sal_uInt16 GetListBoxPreviewDefaultLineWidth() const;
617 // defines if previews which containn potentially transparent objects (e.g. the dash/line/LineStartEnd previews and others)
618 // use the default transparent visualization background (checkered background) as it has got standard in graphic programs nowadays
619 void SetPreviewUsesCheckeredBackground(bool bNew);
620 bool GetPreviewUsesCheckeredBackground() const;
622 void SetStandardStyles();
624 bool operator ==( const StyleSettings& rSet ) const;
625 bool operator !=( const StyleSettings& rSet ) const;
629 // - MiscSettings -
632 class VCL_DLLPUBLIC MiscSettings
634 void CopyData();
636 private:
637 std::shared_ptr<ImplMiscData> mxData;
639 public:
640 MiscSettings();
641 ~MiscSettings();
643 #ifdef WNT
644 void SetEnableATToolSupport( bool bEnable );
645 #endif
646 bool GetEnableATToolSupport() const;
647 bool GetDisablePrinting() const;
648 void SetEnableLocalizedDecimalSep( bool bEnable );
649 bool GetEnableLocalizedDecimalSep() const;
650 bool GetPseudoHeadless() const;
652 bool operator ==( const MiscSettings& rSet ) const;
653 bool operator !=( const MiscSettings& rSet ) const;
657 // - HelpSettings -
659 class VCL_DLLPUBLIC HelpSettings
661 void CopyData();
662 std::shared_ptr<ImplHelpData> mxData;
664 public:
665 HelpSettings();
666 ~HelpSettings();
668 sal_uLong GetTipDelay() const;
669 void SetTipTimeout( sal_uLong nTipTimeout );
670 sal_uLong GetTipTimeout() const;
671 sal_uLong GetBalloonDelay() const;
673 bool operator ==( const HelpSettings& rSet ) const;
674 bool operator !=( const HelpSettings& rSet ) const;
678 // - AllSettings -
680 enum class AllSettingsFlags {
681 NONE = 0x0000,
682 MOUSE = 0x0001,
683 STYLE = 0x0002,
684 MISC = 0x0004,
685 LOCALE = 0x0020,
687 namespace o3tl
689 template<> struct typed_flags<AllSettingsFlags> : is_typed_flags<AllSettingsFlags, 0x0027> {};
692 class VCL_DLLPUBLIC AllSettings
694 private:
695 void CopyData();
697 std::shared_ptr<ImplAllSettingsData> mxData;
699 public:
700 AllSettings();
701 AllSettings( const AllSettings& rSet );
702 ~AllSettings();
704 void SetMouseSettings( const MouseSettings& rSet );
705 const MouseSettings& GetMouseSettings() const;
707 void SetStyleSettings( const StyleSettings& rSet );
708 const StyleSettings& GetStyleSettings() const;
710 void SetMiscSettings( const MiscSettings& rSet );
711 const MiscSettings& GetMiscSettings() const;
713 void SetHelpSettings( const HelpSettings& rSet );
714 const HelpSettings& GetHelpSettings() const;
716 void SetLanguageTag( const LanguageTag& rLanguageTag );
717 const LanguageTag& GetLanguageTag() const;
718 const LanguageTag& GetUILanguageTag() const;
719 static bool GetLayoutRTL(); // returns true if UI language requires right-to-left Text Layout
720 static bool GetMathLayoutRTL(); // returns true if UI language requires right-to-left Math Layout
721 const LocaleDataWrapper& GetLocaleDataWrapper() const;
722 const LocaleDataWrapper& GetUILocaleDataWrapper() const;
723 const vcl::I18nHelper& GetLocaleI18nHelper() const;
724 const vcl::I18nHelper& GetUILocaleI18nHelper() const;
726 AllSettingsFlags GetWindowUpdate() const;
728 AllSettingsFlags Update( AllSettingsFlags nFlags, const AllSettings& rSettings );
729 AllSettingsFlags GetChangeFlags( const AllSettings& rSettings ) const;
731 bool operator ==( const AllSettings& rSet ) const;
732 bool operator !=( const AllSettings& rSet ) const;
733 static void LocaleSettingsChanged( sal_uInt32 nHint );
734 SvtSysLocale& GetSysLocale();
737 #endif // INCLUDED_VCL_SETTINGS_HXX
739 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */