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 : delete m_pImpl;
62 0 : }
63 :
64 0 : SfxTabPage* SvxAccessibilityOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
65 : {
66 0 : return new SvxAccessibilityOptionsTabPage(pParent, *rAttrSet);
67 : }
68 :
69 0 : bool SvxAccessibilityOptionsTabPage::FillItemSet( SfxItemSet* )
70 : {
71 : //aConfig.Set... from controls
72 :
73 0 : m_pImpl->m_aConfig.SetIsForPagePreviews( m_pPagePreviews->IsChecked() );
74 0 : m_pImpl->m_aConfig.SetIsHelpTipsDisappear( m_pTipHelpCB->IsChecked() );
75 0 : m_pImpl->m_aConfig.SetHelpTipSeconds( (short)m_pTipHelpNF->GetValue() );
76 0 : m_pImpl->m_aConfig.SetIsAllowAnimatedGraphics( m_pAnimatedGraphics->IsChecked() );
77 0 : m_pImpl->m_aConfig.SetIsAllowAnimatedText( m_pAnimatedTexts->IsChecked() );
78 0 : m_pImpl->m_aConfig.SetIsAutomaticFontColor( m_pAutomaticFontColor->IsChecked() );
79 0 : m_pImpl->m_aConfig.SetSelectionInReadonly( m_pTextSelectionInReadonly->IsChecked());
80 0 : m_pImpl->m_aConfig.SetAutoDetectSystemHC( m_pAutoDetectHC->IsChecked());
81 :
82 0 : if(m_pImpl->m_aConfig.IsModified())
83 0 : m_pImpl->m_aConfig.Commit();
84 :
85 0 : AllSettings aAllSettings = Application::GetSettings();
86 0 : MiscSettings aMiscSettings = aAllSettings.GetMiscSettings();
87 : #ifndef UNX
88 : aMiscSettings.SetEnableATToolSupport(m_pAccessibilityTool->IsChecked());
89 : #endif
90 0 : aAllSettings.SetMiscSettings(aMiscSettings);
91 0 : Application::MergeSystemSettings( aAllSettings );
92 0 : Application::SetSettings(aAllSettings);
93 :
94 0 : return false;
95 : }
96 :
97 0 : void SvxAccessibilityOptionsTabPage::Reset( const SfxItemSet* )
98 : {
99 : //set controls from aConfig.Get...
100 :
101 0 : m_pPagePreviews->Check( m_pImpl->m_aConfig.GetIsForPagePreviews() );
102 0 : EnableTipHelp( m_pImpl->m_aConfig.GetIsHelpTipsDisappear() );
103 0 : m_pTipHelpNF->SetValue( m_pImpl->m_aConfig.GetHelpTipSeconds() );
104 0 : m_pAnimatedGraphics->Check( m_pImpl->m_aConfig.GetIsAllowAnimatedGraphics() );
105 0 : m_pAnimatedTexts->Check( m_pImpl->m_aConfig.GetIsAllowAnimatedText() );
106 0 : m_pAutomaticFontColor->Check( m_pImpl->m_aConfig.GetIsAutomaticFontColor() );
107 0 : m_pTextSelectionInReadonly->Check( m_pImpl->m_aConfig.IsSelectionInReadonly() );
108 0 : m_pAutoDetectHC->Check( m_pImpl->m_aConfig.GetAutoDetectSystemHC() );
109 :
110 :
111 0 : AllSettings aAllSettings = Application::GetSettings();
112 0 : MiscSettings aMiscSettings = aAllSettings.GetMiscSettings();
113 0 : m_pAccessibilityTool->Check(aMiscSettings.GetEnableATToolSupport());
114 0 : }
115 :
116 0 : IMPL_LINK(SvxAccessibilityOptionsTabPage, TipHelpHdl, CheckBox*, pBox)
117 : {
118 0 : bool bChecked = pBox->IsChecked();
119 0 : m_pTipHelpNF->Enable(bChecked);
120 0 : return 0;
121 : }
122 :
123 0 : void SvxAccessibilityOptionsTabPage::EnableTipHelp(bool bCheck)
124 : {
125 0 : m_pTipHelpCB->Check(bCheck);
126 0 : m_pTipHelpNF->Enable(bCheck);
127 0 : }
128 :
129 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|