Line data Source code
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 <dialmgr.hxx>
22 : #include <cuires.hrc>
23 : #include <svtools/accessibilityoptions.hxx>
24 : #include <vcl/settings.hxx>
25 : #include <vcl/svapp.hxx>
26 :
27 0 : struct SvxAccessibilityOptionsTabPage_Impl
28 : {
29 : SvtAccessibilityOptions m_aConfig;
30 0 : SvxAccessibilityOptionsTabPage_Impl()
31 0 : : m_aConfig(){}
32 : };
33 :
34 0 : SvxAccessibilityOptionsTabPage::SvxAccessibilityOptionsTabPage(vcl::Window* pParent,
35 : const SfxItemSet& rSet)
36 : : SfxTabPage(pParent, "OptAccessibilityPage",
37 : "cui/ui/optaccessibilitypage.ui", &rSet)
38 0 : , m_pImpl(new SvxAccessibilityOptionsTabPage_Impl)
39 : {
40 0 : get(m_pAccessibilityTool, "acctool");
41 0 : get(m_pTextSelectionInReadonly, "textselinreadonly");
42 0 : get(m_pAnimatedGraphics, "animatedgraphics");
43 0 : get(m_pAnimatedTexts, "animatedtext");
44 0 : get(m_pTipHelpCB, "tiphelptimeout");
45 0 : get(m_pTipHelpNF, "tiphelptimeoutnf");
46 :
47 0 : get(m_pAutoDetectHC, "autodetecthc");
48 0 : get(m_pAutomaticFontColor, "autofontcolor");
49 0 : get(m_pPagePreviews, "systempagepreviewcolor");
50 :
51 0 : m_pTipHelpCB->SetClickHdl(LINK(this, SvxAccessibilityOptionsTabPage, TipHelpHdl));
52 :
53 : #ifdef UNX
54 : // UNIX: read the gconf2 setting instead to use the checkbox
55 0 : m_pAccessibilityTool->Hide();
56 : #endif
57 0 : }
58 :
59 0 : SvxAccessibilityOptionsTabPage::~SvxAccessibilityOptionsTabPage()
60 : {
61 0 : disposeOnce();
62 0 : }
63 :
64 0 : void SvxAccessibilityOptionsTabPage::dispose()
65 : {
66 0 : delete m_pImpl;
67 0 : m_pImpl = NULL;
68 0 : m_pAccessibilityTool.clear();
69 0 : m_pTextSelectionInReadonly.clear();
70 0 : m_pAnimatedGraphics.clear();
71 0 : m_pAnimatedTexts.clear();
72 0 : m_pTipHelpCB.clear();
73 0 : m_pTipHelpNF.clear();
74 0 : m_pAutoDetectHC.clear();
75 0 : m_pAutomaticFontColor.clear();
76 0 : m_pPagePreviews.clear();
77 0 : SfxTabPage::dispose();
78 0 : }
79 :
80 0 : VclPtr<SfxTabPage> SvxAccessibilityOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
81 : {
82 0 : return VclPtr<SvxAccessibilityOptionsTabPage>::Create(pParent, *rAttrSet);
83 : }
84 :
85 0 : bool SvxAccessibilityOptionsTabPage::FillItemSet( SfxItemSet* )
86 : {
87 : //aConfig.Set... from controls
88 :
89 0 : m_pImpl->m_aConfig.SetIsForPagePreviews( m_pPagePreviews->IsChecked() );
90 0 : m_pImpl->m_aConfig.SetIsHelpTipsDisappear( m_pTipHelpCB->IsChecked() );
91 0 : m_pImpl->m_aConfig.SetHelpTipSeconds( (short)m_pTipHelpNF->GetValue() );
92 0 : m_pImpl->m_aConfig.SetIsAllowAnimatedGraphics( m_pAnimatedGraphics->IsChecked() );
93 0 : m_pImpl->m_aConfig.SetIsAllowAnimatedText( m_pAnimatedTexts->IsChecked() );
94 0 : m_pImpl->m_aConfig.SetIsAutomaticFontColor( m_pAutomaticFontColor->IsChecked() );
95 0 : m_pImpl->m_aConfig.SetSelectionInReadonly( m_pTextSelectionInReadonly->IsChecked());
96 0 : m_pImpl->m_aConfig.SetAutoDetectSystemHC( m_pAutoDetectHC->IsChecked());
97 :
98 0 : AllSettings aAllSettings = Application::GetSettings();
99 0 : MiscSettings aMiscSettings = aAllSettings.GetMiscSettings();
100 : #ifndef UNX
101 : aMiscSettings.SetEnableATToolSupport(m_pAccessibilityTool->IsChecked());
102 : #endif
103 0 : aAllSettings.SetMiscSettings(aMiscSettings);
104 0 : Application::MergeSystemSettings( aAllSettings );
105 0 : Application::SetSettings(aAllSettings);
106 :
107 0 : return false;
108 : }
109 :
110 0 : void SvxAccessibilityOptionsTabPage::Reset( const SfxItemSet* )
111 : {
112 : //set controls from aConfig.Get...
113 :
114 0 : m_pPagePreviews->Check( m_pImpl->m_aConfig.GetIsForPagePreviews() );
115 0 : EnableTipHelp( m_pImpl->m_aConfig.GetIsHelpTipsDisappear() );
116 0 : m_pTipHelpNF->SetValue( m_pImpl->m_aConfig.GetHelpTipSeconds() );
117 0 : m_pAnimatedGraphics->Check( m_pImpl->m_aConfig.GetIsAllowAnimatedGraphics() );
118 0 : m_pAnimatedTexts->Check( m_pImpl->m_aConfig.GetIsAllowAnimatedText() );
119 0 : m_pAutomaticFontColor->Check( m_pImpl->m_aConfig.GetIsAutomaticFontColor() );
120 0 : m_pTextSelectionInReadonly->Check( m_pImpl->m_aConfig.IsSelectionInReadonly() );
121 0 : m_pAutoDetectHC->Check( m_pImpl->m_aConfig.GetAutoDetectSystemHC() );
122 :
123 :
124 0 : AllSettings aAllSettings = Application::GetSettings();
125 0 : MiscSettings aMiscSettings = aAllSettings.GetMiscSettings();
126 0 : m_pAccessibilityTool->Check(aMiscSettings.GetEnableATToolSupport());
127 0 : }
128 :
129 0 : IMPL_LINK(SvxAccessibilityOptionsTabPage, TipHelpHdl, CheckBox*, pBox)
130 : {
131 0 : bool bChecked = pBox->IsChecked();
132 0 : m_pTipHelpNF->Enable(bChecked);
133 0 : return 0;
134 : }
135 :
136 0 : void SvxAccessibilityOptionsTabPage::EnableTipHelp(bool bCheck)
137 : {
138 0 : m_pTipHelpCB->Check(bCheck);
139 0 : m_pTipHelpNF->Enable(bCheck);
140 0 : }
141 :
142 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|