LibreOffice Module svtools (master) 1
apearcfg.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20
21#include <svtools/apearcfg.hxx>
22
23#include <o3tl/any.hxx>
24#include <officecfg/Office/Common.hxx>
25#include <tools/debug.hxx>
26#include <vcl/settings.hxx>
27#include <vcl/svapp.hxx>
28
29#include <com/sun/star/uno/Sequence.hxx>
30
31static bool bInitialized = false;
32
34
36
38{
40 StyleSettings hAppStyle = hAppSettings.GetStyleSettings();
41
42 // Look & Feel
43
44 // SetStandard...Styles() resets the UseSystemUIFonts flag,
45 // but we don't want to change it now, so save the flag before ...
46 bool bUseSystemUIFonts = hAppStyle.GetUseSystemUIFonts();
47 hAppStyle.SetStandardStyles();
48 // and set it here
49 hAppStyle.SetUseSystemUIFonts( bUseSystemUIFonts );
50
51 bool bFontAntialiasing = officecfg::Office::Common::View::FontAntiAliasing::Enabled::get();
52 sal_Int16 nAAMinPixelHeight = officecfg::Office::Common::View::FontAntiAliasing::MinPixelHeight::get();
53 MouseMiddleButtonAction nMiddleMouse = static_cast<MouseMiddleButtonAction>(officecfg::Office::Common::View::Dialog::MiddleMouseButton::get());
54 bool bMenuMouseFollow = officecfg::Office::Common::View::Menu::FollowMouse::get();
55
56 // font anti aliasing
57 hAppStyle.SetAntialiasingMinPixelHeight( nAAMinPixelHeight );
58 hAppStyle.SetDisplayOptions( bFontAntialiasing ? DisplayOptions::NONE : DisplayOptions::AADisable );
59
60 // Mouse Snap
61
62 MouseSettings hMouseSettings = hAppSettings.GetMouseSettings();
63 MouseSettingsOptions nMouseOptions = hMouseSettings.GetOptions();
64
65 nMouseOptions &= ~ MouseSettingsOptions(MouseSettingsOptions::AutoCenterPos | MouseSettingsOptions::AutoDefBtnPos);
66
67 sal_uInt16 nSnapMode = officecfg::Office::Common::View::Dialog::MousePositioning::get();
68 switch ( nSnapMode )
69 {
70 case 0: // ToButton
71 nMouseOptions |= MouseSettingsOptions::AutoDefBtnPos;
72 break;
73 case 1: // ToMiddle
74 nMouseOptions |= MouseSettingsOptions::AutoCenterPos;
75 break;
76 case 2: // NONE
77 default:
78 break;
79 }
80 hMouseSettings.SetOptions(nMouseOptions);
81 hMouseSettings.SetMiddleButtonAction(nMiddleMouse);
82
83 // Merge and Publish Settings
84
85 MouseFollowFlags nFollow = hMouseSettings.GetFollow();
86 if(bMenuMouseFollow)
87 nFollow |= MouseFollowFlags::Menu;
88 else
89 nFollow &= ~MouseFollowFlags::Menu;
90 hMouseSettings.SetFollow( nFollow );
91
92 hAppSettings.SetMouseSettings( hMouseSettings );
93
94 hAppSettings.SetStyleSettings( hAppStyle );
95 Application::MergeSystemSettings ( hAppSettings ); // Allow system-settings to apply
96 pApp->OverrideSystemSettings ( hAppSettings );
97
98 Application::SetSettings ( hAppSettings );
99}
100
101
102/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static bool bInitialized
Definition: apearcfg.cxx:31
const MouseSettings & GetMouseSettings() const
void SetMouseSettings(const MouseSettings &rSet)
const StyleSettings & GetStyleSettings() const
void SetStyleSettings(const StyleSettings &rSet)
virtual void OverrideSystemSettings(AllSettings &rSettings)
static void MergeSystemSettings(AllSettings &rSettings)
static const AllSettings & GetSettings()
static void SetSettings(const AllSettings &rSettings)
void SetFollow(MouseFollowFlags nFollow)
void SetMiddleButtonAction(MouseMiddleButtonAction nAction)
MouseFollowFlags GetFollow() const
void SetOptions(MouseSettingsOptions nOptions)
MouseSettingsOptions GetOptions() const
void SetStandardStyles()
void SetUseSystemUIFonts(bool bUseSystemUIFonts)
void SetAntialiasingMinPixelHeight(sal_Int32 nMinPixel)
void SetDisplayOptions(DisplayOptions nOptions)
bool GetUseSystemUIFonts() const
SVT_DLLPUBLIC void SetApplicationDefaults(Application *pApp)
Definition: apearcfg.cxx:37
SVT_DLLPUBLIC void SetInitialized()
Definition: apearcfg.cxx:35
SVT_DLLPUBLIC bool IsInitialized()
Definition: apearcfg.cxx:33
MouseSettingsOptions
MouseMiddleButtonAction
MouseFollowFlags