LibreOffice Module cui (master) 1
optaccessibility.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#include "optaccessibility.hxx"
21#include <vcl/settings.hxx>
22#include <vcl/svapp.hxx>
23#include <officecfg/Office/Common.hxx>
24
26 const SfxItemSet& rSet)
27 : SfxTabPage(pPage, pController, "cui/ui/optaccessibilitypage.ui", "OptAccessibilityPage", &rSet)
28 , m_xAccessibilityTool(m_xBuilder->weld_check_button("acctool"))
29 , m_xTextSelectionInReadonly(m_xBuilder->weld_check_button("textselinreadonly"))
30 , m_xAnimatedGraphics(m_xBuilder->weld_check_button("animatedgraphics"))
31 , m_xAnimatedTexts(m_xBuilder->weld_check_button("animatedtext"))
32 , m_xHighContrast(m_xBuilder->weld_combo_box("highcontrast"))
33 , m_xAutomaticFontColor(m_xBuilder->weld_check_button("autofontcolor"))
34 , m_xPagePreviews(m_xBuilder->weld_check_button("systempagepreviewcolor"))
35{
36#ifdef UNX
37 // UNIX: read the gconf2 setting instead to use the checkbox
39#endif
40}
41
43{
44}
45
46std::unique_ptr<SfxTabPage> SvxAccessibilityOptionsTabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet)
47{
48 return std::make_unique<SvxAccessibilityOptionsTabPage>(pPage, pController, *rAttrSet);
49}
50
52{
53 std::shared_ptr<comphelper::ConfigurationChanges> batch( comphelper::ConfigurationChanges::create() );
54 if ( !officecfg::Office::Common::Accessibility::IsForPagePreviews::isReadOnly() )
55 officecfg::Office::Common::Accessibility::IsForPagePreviews::set(m_xPagePreviews->get_active(), batch);
56 if ( !officecfg::Office::Common::Accessibility::IsAllowAnimatedGraphics::isReadOnly() )
57 officecfg::Office::Common::Accessibility::IsAllowAnimatedGraphics::set(m_xAnimatedGraphics->get_active(), batch);
58 if ( !officecfg::Office::Common::Accessibility::IsAllowAnimatedText::isReadOnly() )
59 officecfg::Office::Common::Accessibility::IsAllowAnimatedText::set(m_xAnimatedTexts->get_active(), batch);
60 if ( !officecfg::Office::Common::Accessibility::IsAutomaticFontColor::isReadOnly() )
61 officecfg::Office::Common::Accessibility::IsAutomaticFontColor::set(m_xAutomaticFontColor->get_active(), batch);
62 if ( !officecfg::Office::Common::Accessibility::IsSelectionInReadonly::isReadOnly() )
63 officecfg::Office::Common::Accessibility::IsSelectionInReadonly::set(m_xTextSelectionInReadonly->get_active(), batch);
64 if ( !officecfg::Office::Common::Accessibility::HighContrast::isReadOnly() )
65 officecfg::Office::Common::Accessibility::HighContrast::set(m_xHighContrast->get_active(), batch);
66 batch->commit();
67
69 MiscSettings aMiscSettings = aAllSettings.GetMiscSettings();
70#ifndef UNX
71 aMiscSettings.SetEnableATToolSupport(m_xAccessibilityTool->get_active());
72#endif
73 aAllSettings.SetMiscSettings(aMiscSettings);
75 Application::SetSettings(aAllSettings);
76
77 return false;
78}
79
81{
82 m_xPagePreviews->set_active( officecfg::Office::Common::Accessibility::IsForPagePreviews::get() );
83 if( officecfg::Office::Common::Accessibility::IsForPagePreviews::isReadOnly() )
84 m_xPagePreviews->set_sensitive(false);
85
86 m_xAnimatedGraphics->set_active( officecfg::Office::Common::Accessibility::IsAllowAnimatedGraphics::get() );
87 if( officecfg::Office::Common::Accessibility::IsAllowAnimatedGraphics::isReadOnly() )
88 m_xAnimatedGraphics->set_sensitive(false);
89
90 m_xAnimatedTexts->set_active( officecfg::Office::Common::Accessibility::IsAllowAnimatedText::get() );
91 if( officecfg::Office::Common::Accessibility::IsAllowAnimatedText::isReadOnly() )
92 m_xAnimatedTexts->set_sensitive(false);
93
94 m_xAutomaticFontColor->set_active( officecfg::Office::Common::Accessibility::IsAutomaticFontColor::get() );
95 if( officecfg::Office::Common::Accessibility::IsAutomaticFontColor::isReadOnly() )
96 m_xAutomaticFontColor->set_sensitive(false);
97
98 m_xTextSelectionInReadonly->set_active( officecfg::Office::Common::Accessibility::IsSelectionInReadonly::get() );
99 if( officecfg::Office::Common::Accessibility::IsSelectionInReadonly::isReadOnly() )
100 m_xTextSelectionInReadonly->set_sensitive(false);
101
102 m_xHighContrast->set_active( officecfg::Office::Common::Accessibility::HighContrast::get() );
103 if( officecfg::Office::Common::Accessibility::HighContrast::isReadOnly() )
104 m_xHighContrast->set_sensitive(false);
105
106 AllSettings aAllSettings = Application::GetSettings();
107 const MiscSettings& aMiscSettings = aAllSettings.GetMiscSettings();
108 m_xAccessibilityTool->set_active(aMiscSettings.GetEnableATToolSupport());
109}
110
111/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetMiscSettings(const MiscSettings &rSet)
const MiscSettings & GetMiscSettings() const
static void MergeSystemSettings(AllSettings &rSettings)
static const AllSettings & GetSettings()
static void SetSettings(const AllSettings &rSettings)
bool GetEnableATToolSupport() const
std::unique_ptr< weld::CheckButton > m_xAnimatedTexts
virtual void Reset(const SfxItemSet *rSet) override
std::unique_ptr< weld::CheckButton > m_xPagePreviews
virtual ~SvxAccessibilityOptionsTabPage() override
std::unique_ptr< weld::ComboBox > m_xHighContrast
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
std::unique_ptr< weld::CheckButton > m_xAnimatedGraphics
virtual bool FillItemSet(SfxItemSet *rSet) override
SvxAccessibilityOptionsTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
std::unique_ptr< weld::CheckButton > m_xAccessibilityTool
std::unique_ptr< weld::CheckButton > m_xAutomaticFontColor
std::unique_ptr< weld::CheckButton > m_xTextSelectionInReadonly
static std::shared_ptr< ConfigurationChanges > create()
static SfxItemSet & rSet