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 .
21 #include <svtools/apearcfg.hxx>
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>
29 #include <com/sun/star/uno/Sequence.hxx>
31 static bool bInitialized
= false;
33 bool SvtTabAppearanceCfg::IsInitialized() { return bInitialized
; }
35 void SvtTabAppearanceCfg::SetInitialized() { bInitialized
= true; }
37 void SvtTabAppearanceCfg::SetApplicationDefaults ( Application
* pApp
)
39 AllSettings hAppSettings
= Application::GetSettings();
40 StyleSettings hAppStyle
= hAppSettings
.GetStyleSettings();
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();
49 hAppStyle
.SetUseSystemUIFonts( bUseSystemUIFonts
);
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();
57 hAppStyle
.SetAntialiasingMinPixelHeight( nAAMinPixelHeight
);
58 hAppStyle
.SetDisplayOptions( bFontAntialiasing
? DisplayOptions::NONE
: DisplayOptions::AADisable
);
62 MouseSettings hMouseSettings
= hAppSettings
.GetMouseSettings();
63 MouseSettingsOptions nMouseOptions
= hMouseSettings
.GetOptions();
65 nMouseOptions
&= ~ MouseSettingsOptions(MouseSettingsOptions::AutoCenterPos
| MouseSettingsOptions::AutoDefBtnPos
);
67 SnapType nSnapMode
= static_cast<SnapType
>(officecfg::Office::Common::View::Dialog::MousePositioning::get());
70 case SnapType::ToButton
:
71 nMouseOptions
|= MouseSettingsOptions::AutoDefBtnPos
;
73 case SnapType::ToMiddle
:
74 nMouseOptions
|= MouseSettingsOptions::AutoCenterPos
;
80 hMouseSettings
.SetOptions(nMouseOptions
);
81 hMouseSettings
.SetMiddleButtonAction(nMiddleMouse
);
83 // Merge and Publish Settings
85 MouseFollowFlags nFollow
= hMouseSettings
.GetFollow();
87 nFollow
|= MouseFollowFlags::Menu
;
89 nFollow
&= ~MouseFollowFlags::Menu
;
90 hMouseSettings
.SetFollow( nFollow
);
92 hAppSettings
.SetMouseSettings( hMouseSettings
);
94 hAppSettings
.SetStyleSettings( hAppStyle
);
95 Application::MergeSystemSettings ( hAppSettings
); // Allow system-settings to apply
96 pApp
->OverrideSystemSettings ( hAppSettings
);
98 Application::SetSettings ( hAppSettings
);
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */