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 .
20 #include <optaccessibility.hxx>
21 #include <dialmgr.hxx>
23 #include <svtools/accessibilityoptions.hxx>
24 #include <vcl/settings.hxx>
25 #include <vcl/svapp.hxx>
27 struct SvxAccessibilityOptionsTabPage_Impl
29 SvtAccessibilityOptions m_aConfig
;
30 SvxAccessibilityOptionsTabPage_Impl()
34 SvxAccessibilityOptionsTabPage::SvxAccessibilityOptionsTabPage(Window
* pParent
,
35 const SfxItemSet
& rSet
)
36 : SfxTabPage(pParent
, "OptAccessibilityPage",
37 "cui/ui/optaccessibilitypage.ui", rSet
)
38 , m_pImpl(new SvxAccessibilityOptionsTabPage_Impl
)
40 get(m_pAccessibilityTool
, "acctool");
41 get(m_pTextSelectionInReadonly
, "textselinreadonly");
42 get(m_pAnimatedGraphics
, "animatedgraphics");
43 get(m_pAnimatedTexts
, "animatedtext");
44 get(m_pTipHelpCB
, "tiphelptimeout");
45 get(m_pTipHelpNF
, "tiphelptimeoutnf");
47 get(m_pAutoDetectHC
, "autodetecthc");
48 get(m_pAutomaticFontColor
, "autofontcolor");
49 get(m_pPagePreviews
, "systempagepreviewcolor");
51 m_pTipHelpCB
->SetClickHdl(LINK(this, SvxAccessibilityOptionsTabPage
, TipHelpHdl
));
54 // UNIX: read the gconf2 setting instead to use the checkbox
55 m_pAccessibilityTool
->Hide();
59 SvxAccessibilityOptionsTabPage::~SvxAccessibilityOptionsTabPage()
64 SfxTabPage
* SvxAccessibilityOptionsTabPage::Create( Window
* pParent
, const SfxItemSet
& rAttrSet
)
66 return new SvxAccessibilityOptionsTabPage(pParent
, rAttrSet
);
69 bool SvxAccessibilityOptionsTabPage::FillItemSet( SfxItemSet
& )
71 //aConfig.Set... from controls
73 m_pImpl
->m_aConfig
.SetIsForPagePreviews( m_pPagePreviews
->IsChecked() );
74 m_pImpl
->m_aConfig
.SetIsHelpTipsDisappear( m_pTipHelpCB
->IsChecked() );
75 m_pImpl
->m_aConfig
.SetHelpTipSeconds( (short)m_pTipHelpNF
->GetValue() );
76 m_pImpl
->m_aConfig
.SetIsAllowAnimatedGraphics( m_pAnimatedGraphics
->IsChecked() );
77 m_pImpl
->m_aConfig
.SetIsAllowAnimatedText( m_pAnimatedTexts
->IsChecked() );
78 m_pImpl
->m_aConfig
.SetIsAutomaticFontColor( m_pAutomaticFontColor
->IsChecked() );
79 m_pImpl
->m_aConfig
.SetSelectionInReadonly( m_pTextSelectionInReadonly
->IsChecked());
80 m_pImpl
->m_aConfig
.SetAutoDetectSystemHC( m_pAutoDetectHC
->IsChecked());
82 if(m_pImpl
->m_aConfig
.IsModified())
83 m_pImpl
->m_aConfig
.Commit();
85 AllSettings aAllSettings
= Application::GetSettings();
86 MiscSettings aMiscSettings
= aAllSettings
.GetMiscSettings();
88 aMiscSettings
.SetEnableATToolSupport(m_pAccessibilityTool
->IsChecked());
90 aAllSettings
.SetMiscSettings(aMiscSettings
);
91 Application::MergeSystemSettings( aAllSettings
);
92 Application::SetSettings(aAllSettings
);
97 void SvxAccessibilityOptionsTabPage::Reset( const SfxItemSet
& )
99 //set controls from aConfig.Get...
101 m_pPagePreviews
->Check( m_pImpl
->m_aConfig
.GetIsForPagePreviews() );
102 EnableTipHelp( m_pImpl
->m_aConfig
.GetIsHelpTipsDisappear() );
103 m_pTipHelpNF
->SetValue( m_pImpl
->m_aConfig
.GetHelpTipSeconds() );
104 m_pAnimatedGraphics
->Check( m_pImpl
->m_aConfig
.GetIsAllowAnimatedGraphics() );
105 m_pAnimatedTexts
->Check( m_pImpl
->m_aConfig
.GetIsAllowAnimatedText() );
106 m_pAutomaticFontColor
->Check( m_pImpl
->m_aConfig
.GetIsAutomaticFontColor() );
107 m_pTextSelectionInReadonly
->Check( m_pImpl
->m_aConfig
.IsSelectionInReadonly() );
108 m_pAutoDetectHC
->Check( m_pImpl
->m_aConfig
.GetAutoDetectSystemHC() );
111 AllSettings aAllSettings
= Application::GetSettings();
112 MiscSettings aMiscSettings
= aAllSettings
.GetMiscSettings();
113 m_pAccessibilityTool
->Check(aMiscSettings
.GetEnableATToolSupport());
116 IMPL_LINK(SvxAccessibilityOptionsTabPage
, TipHelpHdl
, CheckBox
*, pBox
)
118 bool bChecked
= pBox
->IsChecked();
119 m_pTipHelpNF
->Enable(bChecked
);
123 void SvxAccessibilityOptionsTabPage::EnableTipHelp(bool bCheck
)
125 m_pTipHelpCB
->Check(bCheck
);
126 m_pTipHelpNF
->Enable(bCheck
);
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */