1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
|
/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: optaccessibility.cxx,v $
*
* $Revision: 1.9 $
*
* last change: $Author: hr $ $Date: 2007-06-27 17:24:00 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
*
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2005 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
#ifdef SVX_DLLIMPLEMENTATION
#undef SVX_DLLIMPLEMENTATION
#endif
#ifndef _SVX_OPTACCESSIBILITY_HXX
#include <optaccessibility.hxx>
#endif
#include <optaccessibility.hrc>
#include <svx/dialmgr.hxx>
#include <svx/dialogs.hrc>
#ifndef INCLUDED_SVTOOLS_ACCESSIBILITYOPTIONS_HXX
#include <svtools/accessibilityoptions.hxx>
#endif
#ifndef _SV_SETTINGS_HXX
#include <vcl/settings.hxx>
#endif
#ifndef _SV_SVAPP_HXX
#include <vcl/svapp.hxx>
#endif
static void MovePosY( Window& _rWin, long _nDelta )
{
Point aPoint = _rWin.GetPosPixel();
aPoint.Y() += _nDelta;
_rWin.SetPosPixel( aPoint );
}
struct SvxAccessibilityOptionsTabPage_Impl
{
SvtAccessibilityOptions m_aConfig;
SvxAccessibilityOptionsTabPage_Impl()
: m_aConfig(){}
};
SvxAccessibilityOptionsTabPage::SvxAccessibilityOptionsTabPage( Window* pParent, const SfxItemSet& rSet )
:SfxTabPage(pParent, SVX_RES( RID_SVXPAGE_ACCESSIBILITYCONFIG ), rSet)
,m_aMiscellaneousLabel (this, SVX_RES(FL_MISCELLANEOUS ))
,m_aAccessibilityTool (this, SVX_RES(CB_ACCESSIBILITY_TOOL ))
,m_aTextSelectionInReadonly (this, SVX_RES(CB_TEXTSELECTION ))
,m_aAnimatedGraphics (this, SVX_RES(CB_ANIMATED_GRAPHICS ))
,m_aAnimatedTexts (this, SVX_RES(CB_ANIMATED_TEXTS ))
,m_aTipHelpCB (this, SVX_RES(CB_TIPHELP ))
,m_aTipHelpNF (this, SVX_RES(NF_TIPHELP ))
,m_aTipHelpFT (this, SVX_RES(FT_TIPHELP ))
,m_aHCOptionsLabel (this, SVX_RES(FL_HC_OPTIONS ))
,m_aAutoDetectHC (this, SVX_RES(CB_AUTO_DETECT_HC ))
,m_aAutomaticFontColor (this, SVX_RES(CB_AUTOMATIC_FONT_COLOR))
,m_aPagePreviews (this, SVX_RES(CB_PAGE_PREVIEWS ))
,m_pImpl(new SvxAccessibilityOptionsTabPage_Impl)
{
FreeResource();
m_aTipHelpCB.SetClickHdl(LINK(this, SvxAccessibilityOptionsTabPage, TipHelpHdl));
long nHeightDelta = 0; // to correct positions _under_ m_aAccessibilityTool
#ifdef UNX
{
// UNIX: read the gconf2 setting instead to use the checkbox
m_aAccessibilityTool.Hide();
nHeightDelta = -( ROWA_2 - ROWA_1 );
}
#else
// calculate the height of the checkbox. Do we need two (default in resource) or only one line
String aText = m_aAccessibilityTool.GetText();
long nWidth = m_aAccessibilityTool.GetTextWidth( aText );
long nCtrlWidth = m_aAccessibilityTool.GetSizePixel().Width() - ( COL2 - COL1 );
if ( nWidth > nCtrlWidth )
{
long nDelta = 2 * RSC_CD_FIXEDLINE_HEIGHT + LINESPACE - RSC_CD_CHECKBOX_HEIGHT;
nHeightDelta = nDelta;
Size aSize = m_aAccessibilityTool.LogicToPixel( Size( 0, nDelta ), MAP_APPFONT );
nDelta = aSize.Height();
aSize = m_aAccessibilityTool.GetSizePixel();
aSize.Height() += nDelta;
m_aAccessibilityTool.SetSizePixel( aSize );
}
#endif
if( nHeightDelta )
{ //adjust positions of controls under m_aAccessibilityTool
Size aSize = m_aAccessibilityTool.LogicToPixel( Size( 0, nHeightDelta ), MAP_APPFONT );
nHeightDelta = aSize.Height();
MovePosY( m_aTextSelectionInReadonly, nHeightDelta );
MovePosY( m_aAnimatedGraphics, nHeightDelta );
MovePosY( m_aAnimatedTexts, nHeightDelta );
MovePosY( m_aTipHelpCB, nHeightDelta );
MovePosY( m_aTipHelpNF, nHeightDelta );
MovePosY( m_aTipHelpFT, nHeightDelta );
MovePosY( m_aHCOptionsLabel, nHeightDelta );
MovePosY( m_aAutoDetectHC, nHeightDelta );
MovePosY( m_aAutomaticFontColor, nHeightDelta );
MovePosY( m_aPagePreviews, nHeightDelta );
}
}
SvxAccessibilityOptionsTabPage::~SvxAccessibilityOptionsTabPage()
{
delete m_pImpl;
}
SfxTabPage* SvxAccessibilityOptionsTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
{
return new SvxAccessibilityOptionsTabPage(pParent, rAttrSet);
}
BOOL SvxAccessibilityOptionsTabPage::FillItemSet( SfxItemSet& )
{
//aConfig.Set... from controls
m_pImpl->m_aConfig.SetIsForPagePreviews( m_aPagePreviews.IsChecked() );
m_pImpl->m_aConfig.SetIsHelpTipsDisappear( m_aTipHelpCB.IsChecked() );
m_pImpl->m_aConfig.SetHelpTipSeconds( (short)m_aTipHelpNF.GetValue() );
m_pImpl->m_aConfig.SetIsAllowAnimatedGraphics( m_aAnimatedGraphics.IsChecked() );
m_pImpl->m_aConfig.SetIsAllowAnimatedText( m_aAnimatedTexts.IsChecked() );
m_pImpl->m_aConfig.SetIsAutomaticFontColor( m_aAutomaticFontColor.IsChecked() );
m_pImpl->m_aConfig.SetSelectionInReadonly( m_aTextSelectionInReadonly.IsChecked());
m_pImpl->m_aConfig.SetAutoDetectSystemHC( m_aAutoDetectHC.IsChecked());
if(m_pImpl->m_aConfig.IsModified())
m_pImpl->m_aConfig.Commit();
#ifndef UNX
AllSettings aAllSettings = Application::GetSettings();
MiscSettings aMiscSettings = aAllSettings.GetMiscSettings();
aMiscSettings.SetEnableATToolSupport( m_aAccessibilityTool.IsChecked() );
aAllSettings.SetMiscSettings(aMiscSettings);
Application::SetSettings(aAllSettings);
Application::MergeSystemSettings( aAllSettings );
#endif
return FALSE;
}
void SvxAccessibilityOptionsTabPage::Reset( const SfxItemSet& )
{
//set controls from aConfig.Get...
m_aPagePreviews.Check( m_pImpl->m_aConfig.GetIsForPagePreviews() );
EnableTipHelp( m_pImpl->m_aConfig.GetIsHelpTipsDisappear() );
m_aTipHelpNF.SetValue( m_pImpl->m_aConfig.GetHelpTipSeconds() );
m_aAnimatedGraphics.Check( m_pImpl->m_aConfig.GetIsAllowAnimatedGraphics() );
m_aAnimatedTexts.Check( m_pImpl->m_aConfig.GetIsAllowAnimatedText() );
m_aAutomaticFontColor.Check( m_pImpl->m_aConfig.GetIsAutomaticFontColor() );
// m_aSystemFont.Check( m_pImpl->m_aConfig.GetIsSystemFont() );
m_aTextSelectionInReadonly.Check( m_pImpl->m_aConfig.IsSelectionInReadonly() );
m_aAutoDetectHC.Check( m_pImpl->m_aConfig.GetAutoDetectSystemHC() );
AllSettings aAllSettings = Application::GetSettings();
MiscSettings aMiscSettings = aAllSettings.GetMiscSettings();
m_aAccessibilityTool.Check( aMiscSettings.GetEnableATToolSupport() );
}
IMPL_LINK(SvxAccessibilityOptionsTabPage, TipHelpHdl, CheckBox*, pBox)
{
sal_Bool bChecked = pBox->IsChecked();
m_aTipHelpNF.Enable(bChecked);
return 0;
}
void SvxAccessibilityOptionsTabPage::EnableTipHelp(sal_Bool bCheck)
{
m_aTipHelpCB.Check(bCheck);
m_aTipHelpNF.Enable(bCheck);
}
|